2
$\begingroup$

I'm a beginner in the RL field, and I would like to check that my understanding of certain RL concepts.

Value function: How good it is to be in a state S following policy π. Value function

So, the value functions here are 0.3 and 0.9

Q function(also called state-action value, or just action value): How good it is to be in a state S and perform action A while following policy π. It uses reward to measure the state-action value

enter image description here

So, the state-action values here are 0.03,0.02,0.5 and 0.9

Q value: The overall expected rewards after performing action A in state S, and continuing with policy π until the end of the episode. So, essentially I can only calculate the Q value if I know all the state-action values of the actions I will be taking in the single episode.(Because the Q value takes into account the actions after the current action A, till the end of the episode, following policy π)

Reward: The metric used to tell the agent how good/bad it's action was. It is a constant value. For e.g

 1. Fall in pond --> -1
 2. On stone path --> +1
 3. Reach home--> +10

Return: The sum of rewards in a single episode

Policy π: A set of specific instructions an agent will follow in an episode. For example, the policy will look like:

In state 1, take action 3 ( which takes me to state 2)

In state 2, take action 2 ( which takes me to state 3)

In state 3, take action 1 ( Which takes me to state 4)

In state 4, take action 2 ( Which takes me to terminal state)

1 episode completed

And my policy will keep updating each episode to get the best return

$\endgroup$
1
$\begingroup$

Value function: How good it is to be in a state $s$ following policy $\pi$.

There are different value functions. There's the state value function, often denoted as $v(s)$ (or $V(s)$), so it's a function of only one variable, i.e. $s$ (a state). There's the state-action value function $q(s, a)$ (or $Q(s, a$)). A value function is a function, so it's not a number or a vector, or whatever. It's a function, so it maps inputs to outputs. In the first case, it maps states to real numbers. In the second case, it maps states and actions to real numbers. So, we could denote the state value function as $v : \mathcal{S} \rightarrow \mathbb{R}$ (where $\mathcal{S}$ is the set of states in your environment) and state-action value function as $q : \mathcal{S} \times \mathcal{A}\rightarrow \mathbb{R}$ (where $\mathcal{A}$ is the set of actions and $\times$ means "combination of").

So, your definition of a value function is not quite correct. The value function $v(s)$ doesn't represent "how good it is to be in a state $s$ following a policy $\pi$", but "how good it is to be in a state $s$ AND THEN following policy $\pi$". To emphasize this, you often use the notation $v_{\pi}(s)$ rather than simply $v(s)$.

See What are the value functions used in reinforcement learning? for more details about existing value functions in reinforcement learning. And to see the full definition of the value functions, I suggest you read Sutton and Barto's book.

Q function (also called state-action value, or just action value): How good it is to be in a state $s$ and perform action $a$ while following policy $\pi$. It uses reward to measure the state-action value

As I said above, the $q$ function is a "value function" too. It's just a different value function than $v$.

Again, the same thing I said for $v$ also applies here, so "how good it is to be in a state $s$ and perform action $a$ while following policy $\pi$" is incorrect for the same reason your definition for $v$ was incorrect. The $q$ function can be defined as "how good it is to be in a state $s$ and take action $a$, AND, AFTER THAT, follow a given policy $\pi$. Again, to emphasize that $q$ is defined in terms of $\pi$, we often use the notation $q_\pi$.

Reward: The metric used to tell the agent how good/bad it's action was. It is a constant value.

This is roughly correct, but the reward doesn't have to be constant and it depends on your problem. Also, there's also the related notion of "reward function", which is the function that assigns rewards to each action. So, when defining your problem as a Markov decision process, you need to define this reward function. Actually, this is probably the most important function in reinforcement learning (because this is the way you teach the agent to behave).

Return: The sum of rewards in a single episode

This is roughly correct. However, note that the sum can also be a "weighted sum".

Policy: A set of specific instructions an agent will follow in an episode.

This is roughly correct, but a policy can also have some randomness in it. For example, if you are in state $s$, your policy could say "always take action $a_i$", but another policy could say "take action $a_i$ with probability $p$ and action $a_j$ with probably $1 - p$. Also, note that the policy is not restricted to an episode. It's a general function that tells the agent how to behave independently of the episode.

(Sorry, I didn't look at your examples. Maybe I will review this answer later to look at your examples too, but the information in this answer should already tell you if your examples are correct or not).

| improve this answer | |
$\endgroup$
1
$\begingroup$

I think most of it is correct.

Q function(also called state-action value, or just action value): How good it is to be in a state S and perform action A while following policy π. It uses reward to measure the state-action value

This is a bit off. Q function basically tells you how good it is to be in state S and perform action A, and follow policy $\pi$ from the next state onwards. The action A that you take can be any action from the action space and need not be according to the policy $\pi$.

Also, I think Q-function and Q-value are mostly used interchangeably to mean the same thing.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Ah, so my action A can be different , which will affect the subsequent effectiveness policy π? (e.g my policy π requires the state to be 1 to be effective, but when I take action A it takes me to state 3 instead which means my policy isn't as effective. Hence, the Q value of this action(to state 3) will be relatively low) $\endgroup$ – BG10 Apr 16 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.