genetic-algorithm-feature-selection icon indicating copy to clipboard operation
genetic-algorithm-feature-selection copied to clipboard

Asking about vars object

Open NuruddinKhoiry opened this issue 3 years ago • 1 comments

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

NuruddinKhoiry avatar May 17 '22 08:05 NuruddinKhoiry

+1

jhoanborges avatar Apr 02 '23 16:04 jhoanborges