<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title/><link>https://notes.bencuan.me/cs188/</link><description>Recent content on</description><generator>Hugo</generator><language>en</language><atom:link href="https://notes.bencuan.me/cs188/index.xml" rel="self" type="application/rss+xml"/><item><title>Agents and Environments</title><link>https://notes.bencuan.me/cs188/Agents-and-Environments/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Agents-and-Environments/</guid><description>&lt;h2 id="designing-rational-agents"&gt;
 Designing Rational Agents
 &lt;a class="anchor" href="#designing-rational-agents"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;How do we actually build AI systems?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An agent is any entity that &lt;strong&gt;perceives&lt;/strong&gt; (through sensors) ****and &lt;strong&gt;acts&lt;/strong&gt; (through actuators or effectors)&lt;strong&gt;.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;One possible goal of making an AI is to create a &lt;strong&gt;rational agent -&lt;/strong&gt; one that selects actions that maximize its expected utility.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;agent function&lt;/strong&gt; maps perception to action. It is generated by an &lt;strong&gt;agent program&lt;/strong&gt; running on a machine.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="evaluating-the-environment"&gt;
 Evaluating the Environment
 &lt;a class="anchor" href="#evaluating-the-environment"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The task environment can be described using &lt;strong&gt;PEAS:&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Search Problems</title><link>https://notes.bencuan.me/cs188/Search-Problems/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Search-Problems/</guid><description>&lt;p&gt;Search problems consist of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A state space $S$&lt;/li&gt;
&lt;li&gt;An initial state $s_0$&lt;/li&gt;
&lt;li&gt;Possible actions $A(s)$ in each state&lt;/li&gt;
&lt;li&gt;Transition model that converts a current state and action into the next state&lt;/li&gt;
&lt;li&gt;A goal test $G(s)$ that returns true or false depending on if $s$ is at the goal&lt;/li&gt;
&lt;li&gt;An action cost&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As an example, suppose you are travelling:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The state space is all cities you can go to.&lt;/li&gt;
&lt;li&gt;The initial state is which city you start in.&lt;/li&gt;
&lt;li&gt;Actions are to navigate to adjacent cities.&lt;/li&gt;
&lt;li&gt;The transition model is the process of travelling to another city.&lt;/li&gt;
&lt;li&gt;The goal test is to check if you are in the desired city.&lt;/li&gt;
&lt;li&gt;The action cost is the road distance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Search problems are typically conducted on &lt;strong&gt;models,&lt;/strong&gt; which are imperfect representations of the real world. Models are almost always wrong to some extent.&lt;/p&gt;</description></item><item><title>Games</title><link>https://notes.bencuan.me/cs188/Games/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Games/</guid><description>&lt;p&gt;A &lt;strong&gt;game&lt;/strong&gt; is a task environment with more than one agent. Some characteristics of games could be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Deterministic vs Stochastic&lt;/li&gt;
&lt;li&gt;Fully observable vs Partially observable&lt;/li&gt;
&lt;li&gt;Number of players&lt;/li&gt;
&lt;li&gt;Team vs Individual&lt;/li&gt;
&lt;li&gt;Turn based vs Simultaneous&lt;/li&gt;
&lt;li&gt;Zero sum vs General sum
&lt;ul&gt;
&lt;li&gt;Zero sum: where agents have opposite utilities (one maximizes, the other one minimizes)&lt;/li&gt;
&lt;li&gt;General sum: agents have independent utilities, allowing for cooperation, alliances, competition&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;strong&gt;standard game&lt;/strong&gt; is deterministic, observable, two-player, turn-based, and zero-sum. It can be formulated using:&lt;/p&gt;</description></item><item><title>Logic</title><link>https://notes.bencuan.me/cs188/Logic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Logic/</guid><description>&lt;h1 id="what-is-logic-and-why-is-it-important"&gt;
 What is logic and why is it important?
 &lt;a class="anchor" href="#what-is-logic-and-why-is-it-important"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;In the beginning of the course, we discussed &lt;strong&gt;atomic, factored, and structured&lt;/strong&gt; representations (atomic = single points per state, factored = representation of multiple states, structured = language to describe those states).&lt;/p&gt;
&lt;p&gt;While search problems deal with atomic representations, &lt;strong&gt;logic deals with factored representations.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="knowledge"&gt;
 Knowledge
 &lt;a class="anchor" href="#knowledge"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Agents acquire knowledge through perception, learning, and language. Agents need to know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The effects of actions (transition model),&lt;/li&gt;
&lt;li&gt;How the world affects sensors (sensor model),&lt;/li&gt;
&lt;li&gt;And the current state of the world (especially important for partially observable worlds).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;strong&gt;knowledge base&lt;/strong&gt; is a set of sentences in a formal language. It is a declarative approach to building an agent:&lt;/p&gt;</description></item><item><title>Bayes Nets</title><link>https://notes.bencuan.me/cs188/Bayes-Nets/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Bayes-Nets/</guid><description>&lt;h1 id="probability-review"&gt;
 Probability Review
 &lt;a class="anchor" href="#probability-review"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;For the underlying probability theory (independence, conditional probability, distributions), see [[cs70/probability/probability-overview]]. For Bayesian parameter estimation on the resulting CPTs, see [[data102/parameter estimation]].&lt;/p&gt;
&lt;h1 id="bayes-nets"&gt;
 Bayes Nets
 &lt;a class="anchor" href="#bayes-nets"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Bayes Nets consist of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nodes corresponding to a variable in the problem&lt;/li&gt;
&lt;li&gt;A CPT (Conditional Probability Table) for each node&lt;/li&gt;
&lt;li&gt;Edges between variables that encode a direct influence (conditional probability)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Must be a directed acyclic graph (no cycles)&lt;/li&gt;
&lt;li&gt;Space complexity: $O(n \cdot d^k)$
&lt;ul&gt;
&lt;li&gt;$n$ variables (number of CPT’s)&lt;/li&gt;
&lt;li&gt;$d$ possible values per tables&lt;/li&gt;
&lt;li&gt;$k$ maximum variables in one table&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Global semantics:&lt;/p&gt;</description></item><item><title>Markov Models</title><link>https://notes.bencuan.me/cs188/Markov-Models/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Markov-Models/</guid><description>&lt;p&gt;A Markov Model is basically a Bayes net that is an infinitely long chain (”time series bayes net”).&lt;/p&gt;
&lt;p&gt;Typically, each node is a random variable that represents a specific point in time.&lt;/p&gt;
&lt;p&gt;Markov models follow the &lt;strong&gt;memoryless property,&lt;/strong&gt; which states that the random variable for time step $i+1$ is independent of all other variables except the random variable at time step $i$. (For the probability-theory foundation of this construction, see [[cs70/probability/markov-chains]].)&lt;/p&gt;</description></item><item><title>Utilities and Decision Trees</title><link>https://notes.bencuan.me/cs188/Utilities-and-Decision-Trees/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Utilities-and-Decision-Trees/</guid><description>&lt;h1 id="utility"&gt;
 Utility
 &lt;a class="anchor" href="#utility"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Utilities are values that determine the relative benefit of a particular state: the higher the utility, the better. For the statistical-decision-theory perspective on the same idea (loss functions, estimators, Bayes vs. minimax risk), see [[data102/decision theory]].&lt;/p&gt;
&lt;p&gt;Rational agents follow the &lt;strong&gt;principle of maximum expected utility (MEU):&lt;/strong&gt; they always choose whichever actions maximize expected utility. Rational agents must also have &lt;strong&gt;rational preferences&lt;/strong&gt; and therefore follow the &lt;strong&gt;axioms of rationality:&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Markov Decision Processes</title><link>https://notes.bencuan.me/cs188/Markov-Decision-Processes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Markov-Decision-Processes/</guid><description>&lt;h2 id="what-is-a-markov-decision-process"&gt;
 What is a Markov Decision Process?
 &lt;a class="anchor" href="#what-is-a-markov-decision-process"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A Markov Decision Process is a Markov model that solves &lt;strong&gt;nondeterministic search problems&lt;/strong&gt; (where an action can result in multiple possible successor states). The same formalism is treated from an inference/decision-theory perspective in [[data102/Markov Decision Processes]].&lt;/p&gt;
&lt;p&gt;A MDP is defined by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A set of states $s$&lt;/li&gt;
&lt;li&gt;A set of actions $a$&lt;/li&gt;
&lt;li&gt;A transition model $T(s, a, s’)$ that represents the probability $P(s’ | s, a)$ - that the action $a$ taken at state $s$ will lead to a new state $s’$. (Allowed by memoryless property)&lt;/li&gt;
&lt;li&gt;A reward function $R(s, a, s’)$ per transition&lt;/li&gt;
&lt;li&gt;Discount factor $\gamma \in [0, 1]$&lt;/li&gt;
&lt;li&gt;A start state&lt;/li&gt;
&lt;li&gt;A terminal (absorbing state)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The utility function of an MDP can be calculated as follows:&lt;/p&gt;</description></item><item><title>Machine Learning</title><link>https://notes.bencuan.me/cs188/Machine-Learning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Machine-Learning/</guid><description>&lt;h2 id="what-is-machine-learning"&gt;
 What is Machine Learning?
 &lt;a class="anchor" href="#what-is-machine-learning"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So far, we’ve used Bayes’ Nets, Markov Decision Processes, etc. to solve models. But how do we actually determine what those models are in the first place?&lt;/p&gt;
&lt;p&gt;This is where machine learning comes in: the process of improving models through experience. There are two different categories of algorithms: &lt;strong&gt;supervised learning,&lt;/strong&gt; where relationships are inferred between given input and output data to predict outputs for new inputs, and &lt;strong&gt;unsupervised learning,&lt;/strong&gt; where no outputs are given and the algorithm recognizes structures or patterns in the inputs. ****&lt;/p&gt;</description></item><item><title>Neural Networks</title><link>https://notes.bencuan.me/cs188/Neural-Networks/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Neural-Networks/</guid><description>&lt;p&gt;&lt;strong&gt;General idea:&lt;/strong&gt; Combine multiple simple regression models together to increase complexity of the overall model.&lt;/p&gt;
&lt;h2 id="optimization"&gt;
 Optimization
 &lt;a class="anchor" href="#optimization"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;h3 id="gradient-ascent-and-descent"&gt;
 Gradient Ascent and Descent
 &lt;a class="anchor" href="#gradient-ascent-and-descent"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;The difference:&lt;/strong&gt; gradient ascent maximizes a log-likelihood function; gradient descent minimizes a loss function.&lt;/p&gt;
&lt;p&gt;Gradient Ascent algorithm:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;randomly init w
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;while&lt;/span&gt; w &lt;span style="color:#f92672"&gt;not&lt;/span&gt; converged:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; weight &lt;span style="color:#f92672"&gt;in&lt;/span&gt; w:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		weight &lt;span style="color:#f92672"&gt;=&lt;/span&gt; weight &lt;span style="color:#f92672"&gt;+&lt;/span&gt; learning_rate &lt;span style="color:#f92672"&gt;*&lt;/span&gt; gradient(log_likelihood(w), weight)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;convergence is when gradient = 0, or no change occurs between two runs&lt;/li&gt;
&lt;li&gt;$w$ is a vector of $N$ weights&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gradient(log_liklihood(w), weight)&lt;/code&gt; represents the operation $\nabla_{weight} \log l(\bold{w})$, which returns a vector of $N$ partial derivatives $\partial_{weight} \log l(w_i)$ for every weight $w_i$.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Gradient Descent algorithm:&lt;/p&gt;</description></item><item><title>Reinforcement Learning</title><link>https://notes.bencuan.me/cs188/Reinforcement-Learning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/Reinforcement-Learning/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Reinforcement Learning (RL) is an example of &lt;strong&gt;online planning,&lt;/strong&gt; where agents have no prior knowledge of rewards or transitions and must explore an environment before using an estimated policy. The Data 102 treatment of the same material, with more emphasis on the statistical-inference side, is at [[data102/Reinforcement Learning]] (see also [[data102/bandits]] for exploration/exploitation tradeoffs).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Model-based learning: attempts to estimate transition and reward functions with samples attained during exploration before solving MDP with estimates using value or policy iteration&lt;/li&gt;
&lt;li&gt;Model-free learning: attempts to estimate values/Q-values of states directly without constructing a reward or transition model in MDP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Passive reinforcement learning: agent is given a policy and learns the values of states under that policy.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs188/CS188-Index/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs188/CS188-Index/</guid><description>&lt;p&gt;[[Agents and Environments]]
[[Search Problems]]
[[Games]]
[[Logic]]
[[Bayes Nets]]
[[Markov Models]]
[[Utilities and Decision Trees]]
[[Markov Decision Processes]]
[[Machine Learning]]
[[Neural Networks]]
[[Reinforcement Learning]]&lt;/p&gt;
&lt;p&gt;[[Project 5 Notes]]&lt;/p&gt;</description></item></channel></rss>