Weight optimization using genetic algorithm in MATLAB -


i new genetic algorithm , hoping guys can me out.

i have dataset:

dataset = [[3 4 4 4]           ;[2 3 2 3]           ;[1 1 3 2]           ;[3 2 4 3]           ;[0 3 1 0]]; 

where last column [4, 3, 2, 3, 0] represents actual labels; , first 3 columns represent feature vector [x1 x2 x3].

i want use genetic algorithm optimize weights [w1 w2 w3].

how can achieve ??

your weights optimization variables. basic optimization:

w = [w1 w2 w3]; x = [x1 x2 x3]; wopt = ga(@fitnessfunc(w, x), length(w))  function y = fitnessfunc(w,x)     y = w(1) * x(1) + w(2) * x(2) + w(3) * x(3); 

see matlab documentation on ga more options on ga function call , passing parameters how construct program.

remember weights variables you're optimizing. dataset x values parameters.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -