| func_gamma | R Documentation |
U(R) = {R}^{\gamma}
func_gamma(shown, reward, rownum, params, hidden, ...)
shown |
Which options shown in this trial. |
reward |
The feedback received by the agent from the environment at trial(t) following the execution of action(a) |
rownum |
The trial number |
params |
Parameters used by the model's internal functions, see params |
|
All hidden variables within the MDP process belong here. | |
... |
It currently contains the following information; additional information may be added in future package versions.
|
A List
output [NumericVector]
A numeric value representing the reward after transformation by a utility function.
By default, it follows Stevens' power law, assuming a power
relationship between physical magnitude and perceived utility.
The default parameter is gamma = 1, corresponding to a
linear transformation.
hidden [CharacterVector]
User-defined internal variables generated by this function. These represent intermediate (latent) states produced during computation, which can be read or modified by other functions in the MDP process.
func_gamma <- function(
shown,
reward,
params,
...
){
list2env(list(...), envir = environment())
# If you need extra information(...)
# Column names may be lost(C++), indexes are recommended
# e.g.
# Trial <- idinfo[3]
# Frame <- exinfo[1]
# Action <- behave[1]
gamma <- params[["gamma"]]
# Stevens' Power Law
utility <- ((reward >= 0) * 2 - 1) * (abs(reward) ^ gamma)
return(list(output = utility, hidden = hidden))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.