HGF
Documentation for ActionModels.
Tutorials
Functions
ActionModels.premade_agents
ActionModels.Agent
ActionModels.RejectParameters
ActionModels.create_agent_model
ActionModels.fit_model
ActionModels.get_history
ActionModels.get_history
ActionModels.get_history
ActionModels.get_parameters
ActionModels.get_parameters
ActionModels.get_parameters
ActionModels.get_parameters
ActionModels.get_posteriors
ActionModels.get_states
ActionModels.get_states
ActionModels.get_states
ActionModels.get_states
ActionModels.give_inputs!
ActionModels.give_inputs!
ActionModels.give_inputs!
ActionModels.init_agent
ActionModels.multiple_actions
ActionModels.plot_predictive_simulation
ActionModels.plot_trajectory
ActionModels.plot_trajectory!
ActionModels.plot_trajectory!
ActionModels.premade_agent
ActionModels.reset!
ActionModels.reset!
ActionModels.set_parameters!
ActionModels.set_parameters!
ActionModels.set_parameters!
ActionModels.single_input!
ActionModels.premade_agents
— ConstantActionModels.Agent
— TypeActionModels.RejectParameters
— TypeCustom error type which will result in rejection of a sample
ActionModels.create_agent_model
— MethodActionModels.fit_model
— Method"" fitmodel(agent::Agent,inputs::Array,actions::Vector,parampriors::Dict,fixedparameters::Dict = Dict(); sampler = NUTS(),niterations = 1000, n_chains = 1,verbose = true,)
Returns a summary of the fitted parameters (parameters specified with param_prios).
Arguments
- 'agent::Agent': a specified agent created with either premade agent or init_agent.
- 'inputs:Array': array of inputs.
- 'actions::Array': array of actions.
- 'param_priors::Dict': priors (written as distributions) for the parameters you wish to fit.
- 'fixed_parameters::Dict = Dict()': fixed parameters.
- 'imputemissingactions = false': if true, include missing actions in the fitting process.
- 'sampler = NUTS()': specify the type of sampler.
- 'n_iterations = 1000': iterations pr. chain.
- 'n_chains = 1': amount of chains.
- 'verbose = true': set to false to hide warnings
ActionModels.get_history
— MethodActionModels.get_history
— MethodActionModels.get_history
— MethodActionModels.get_parameters
— Methodget_parameters(agent::Agent, target_param::Union{String,Tuple})
Get out target parameter from agent
ActionModels.get_parameters
— Methodget_parameters(agent::Agent, target_parameters::Vector)
Returns a vector of the target parameters specefied in target_parameters
get_parameters(agent::Agent)
Returns all parameters from agent
ActionModels.get_parameters
— MethodActionModels.get_parameters
— MethodActionModels.get_posteriors
— Methodget_posteriors(chain::Chains; type::String = "median")
Extracting parameters from a Turing chain
ActionModels.get_states
— Methodget_states(agent::Agent, target_state::Union{String,Tuple})
extract target state from agent's states.
ActionModels.get_states
— Methodget_states(agent::Agent, target_states::Vector)
specify a vector of target states you wish to extract.
ActionModels.get_states
— MethodGet_states(agent::Agent)
Get all target states from an agent.
ActionModels.get_states
— MethodActionModels.give_inputs!
— Methodgive_inputs!(agent::Agent, inputs::Array)
Function for inputting multiple observations to an agent. Input is structured as an Array, with each row being a single input consisting of multiple numbers.
ActionModels.give_inputs!
— Methodgive_inputs!(agent::Agent, inputs::Real)
Convenience method for inputting multiple observations to an agent. Input is here just a single value.
ActionModels.give_inputs!
— Methodgive_inputs!(agent::Agent, inputs::Vector)
Function for inputting multiple observations to an agent. Input is structured as an Array, with each row being a single input consisting of multiple numbers.
ActionModels.init_agent
— MethodActionModels.multiple_actions
— Methodmultiple_actions(agent::Agent, input::Any)
If an agent is specified with multiple action models
Runs each action model sequentially and returns the action distributions for each action model given agent and input.
ActionModels.plot_predictive_simulation
— Methodplotpredictivesimulation(paramdistributions::Union{Chains,Dict}, agent::Agent, inputs::Array, targetstate::Union{String,Tuple}; fixedparameters::Dict = Dict(), nsimulations::Int = 100, verbose::Bool = true, mediancolor::Union{String,Symbol} = :red, title::String = "Sampled trajectories", label::Union{String,Tuple} = targetstate, alpha::Real = 0.1, linewidth::Real = 2, )
compute predictive simulation of target state/states given a set of parameter distributions.
Arguments
- 'param_distributions::Union{Chains,Dict}': The parameter distributions you want to sample from during the predictive simulation. This can be a turing chain of posteriors or a regular parameter distribution.
- 'agent::Agent': specified premade agent or custom made agent.
- 'inputs::Array': input observations to your agent
- 'target_state::Union{String,Tuple}': the state(s) or actions you want to do simulate. Note that the target state(s) need to be in the agents history.
- 'fixed_parameters::Dict = Dict()': The fixed parameters which do not vary during the simulation.
- 'n_simulations::Int = 100': amount of simulations you want to run.
- 'verbose::Bool = true': if you wish to hide warnings set to false
- 'median_color::Union{String,Symbol} = :red': specify color of median value in the plot
- 'label::Union{String,Tuple} = target_state': label on graph
- 'alpha::Real = 0.1':
- 'linewidth::Real = 2': specify linewidth on your plot
ActionModels.plot_trajectory!
— MethodActionModels.plot_trajectory!
— MethodActionModels.plot_trajectory
— MethodActionModels.premade_agent
— Functionfunction premade_agent(
model_name::String, parameters_list::NamedTuple = (;)
)
Making a premade agent consisting of a model (a premade agent), and a list of configuations (parameter values) for the agent.
ActionModels.reset!
— Methodreset!(agent::Agent)
reset an agent to initial state parameters.
ActionModels.reset!
— MethodActionModels.set_parameters!
— Methodset_parameters!(agent::Agent, parameters::Dict)
Setting multiple parameters in dictionary where parameter name is specified followed by parameter value.
ActionModels.set_parameters!
— Methodsetparameters!(agent::Agent, targetparam::Union{String,Tuple}, param_value::Any)
Function for setting a single parameter in an agent. Input to the function is an agent, the parameter name and the parameter value.
ActionModels.set_parameters!
— MethodActionModels.single_input!
— Methodsingle_input!(agent::Agent, input)
Function for giving an input to an Agent.