Skip to content

Asking about vars object #6

@NuruddinKhoiry

Description

@NuruddinKhoiry

Hi

I am new and interested in studying GA with R. I have a question regarding the "vars" in your script.

custom_fitness <- function(vars, data_x, data_y, p_sampling)
{

speeding up things with sampling

ix=get_sample(data_x, percentage_tr_rows = p_sampling)
data_2=data_x[ix,]
data_y_smp=data_y[ix]

keep only vars from current solution

names=colnames(data_2)
names_2=names[vars==1]
.
.
.

ga_GA_1 = ga(fitness = function(vars) custom_fitness(vars = vars,
data_x = data_x,
.
.
.

Could you please explain to me what vars look like? Would you mind showing me the structure of vars as the input when you pass the fitness = function(vars)
Is it the first row in the data_x? or the first column in data_x? or the entire data of data_x at a particular generation? or something else?

Best regards,
Khoiri

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions