optimize_para {binaryRL} | R Documentation |
Process: Optimizing Parameters
Description
This function is an internal function of 'fit_p'. We isolate it from direct use by capable users.
The function provides several optimization algorithms:
1. L-BFGS-B (from 'stats::optim');
2. Simulated Annealing ('GenSA');
3. Genetic Algorithm ('GA');
4. Differential Evolution ('DEoptim');
5. Particle Swarm Optimization ('pso');
6. Bayesian Optimization ('mlrMBO');
7. Covariance Matrix Adapting Evolutionary Strategy ('cmaes');
8. Nonlinear Optimization ('nloptr')
For more information, please refer to the GitHub repository: https://github.com/yuki-961004/binaryRL
Usage
optimize_para(
data,
id,
obj_func,
n_params,
n_trials,
lower,
upper,
initial_params = NA,
initial_size = 50,
iteration = 10,
seed = 123,
algorithm
)
Arguments
data |
[data.frame] raw data. This data should include the following mandatory columns:
|
id |
[integer] which subject is going to be analyzed. is being analyzed. The value should correspond to an entry in the "sub" column, which must contain the subject IDs. e.g., 'id = 18' |
obj_func |
[function] A function with only ONE argument 'params'. Refer to 'binaryRL::TD' to mimic the establishment of an objective function. |
n_params |
[integer] The number of free parameters in your model. |
n_trials |
[integer] The total number of trials in your experiment. |
lower |
[vector] lower bounds of free parameters |
upper |
[vector] upper bounds of free parameters |
initial_params |
[vector] Initial values for the free parameters. automatically generate initial values. for 'L-BFGS-B', 'GenSA', set 'initial = c(0, 0, ...)' |
initial_size |
[integer] Initial population size for the free parameters. automatically generate initial values. for 'Bayesian', 'GA', set 'initial = 50' |
iteration |
[integer] the number of iteration |
seed |
[integer] random seed. This ensures that the results are reproducible and remain the same each time the function is run. default: 'seed = 123' |
algorithm |
[character] Choose an algorithm package from 'L-BFGS-B', 'GenSA', 'GA', 'DEoptim', 'PSO', 'Bayesian', 'CMA-ES'. In addition, any algorithm from the 'nloptr' package is also supported. If your chosen 'nloptr' algorithm requires a local search, you need to input a character vector. The first element represents the algorithm used for global search, and the second element represents the algorithm used for local search. |
Value
the result of binaryRL with optimal parameters