Using (classificationKNN.fit) in Matlab

7 visualizaciones (últimos 30 días)
B.K.
B.K. el 21 de Oct. de 2013
Editada: B.K. el 23 de Oct. de 2013
Hi,
I want to define a set of weights for the distance measure in KNN method. According to the MATLAB help the distance weight function can be a 'equal','inverse','squaredinverse', or a function handle. I tried to define the weights using the following function.
function WGT=gene
weights=round(rand(a,b))
WGT=T
end
However, when I apply KNN the weights does not changed and are equally distributed. My fitting code is
(fitness=ClassificationKNN.fit(train_attribute,train_class,'Numneighbors',4,'distanceweight',@gene_weights))
Can anyone help with this problem please. Thank you in advance Best Regards

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by