Undefined variable "weka" or class "weka.filters.supervised.attribute.AttributeSelection".
je débute en matlab, et j'ai un erreur que je comrend pas:
je fait run pour ce code tot d'abords:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
curPath = pwd;
%% load weka jar, and common interfacing methods.
path(path, [curPath filesep 'lib']);
path(path, [curPath filesep 'lib' filesep 'weka']);
loadWeka(['lib' filesep 'weka']);
%% feature selection algorithms
path(path,[curPath filesep 'fs_sup_blogreg']);
path(path,[curPath filesep 'fs_sup_cfs']);
path(path,[curPath filesep 'fs_sup_chisquare']);
path(path,[curPath filesep 'fs_sup_fcbf']);
path(path,[curPath filesep 'fs_sup_fisher_score']);
path(path,[curPath filesep 'fs_sup_gini_index']);
path(path,[curPath filesep 'fs_sup_information_gain']);
path(path,[curPath filesep 'fs_sup_kruskalwallis']);
path(path,[curPath filesep 'fs_sup_mrmr']);
path(path,[curPath filesep 'fs_sup_relieff']);
path(path,[curPath filesep 'fs_sup_sbmlr']);
path(path,[curPath filesep 'fs_sup_ttest']);
path(path,[curPath filesep 'fs_uns_spec']);
%% predictors
path(path,[curPath filesep 'classifiers' filesep 'knn']);
path(path,[curPath filesep 'classifiers' filesep 'svm']);
path(path,[curPath filesep 'classifiers' filesep 'j48']);
path(path,[curPath filesep 'classifiers' filesep 'bayes']);
path(path,[curPath filesep 'clusters' filesep 'kmeans']);
%% data preprocessors
path(path,[curPath filesep 'preprocessor']);
%% evaluator
path(path,[curPath filesep 'evaluator' filesep 'fsevaluator']);
%% ability to run experiments.
%path(path, [curPath filesep 'examples' filesep 'code' filesep ...
% 'result_statistic' filesep 'supervised' filesep]);
clear curPath; |
puis je fait appel à la fonction :
Code:
1 2 3 4 5 6 7
|
nomfile=['./FishierMatAppSelection1']
a=load(nomfile);
Xapp=a.X;
Yapp=a.Y;
out = fsFCBF(Xapp,Yapp) |
qui contient un code de la selection de variables de la fonction FCBF et voile le code de cette fonction:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
function [out] = fsFCBF(X,Y)
%Using Weka's feature selection algorithm
% X, the features on current trunk, each colum is a feature vector on all
% instances, and each row is a part of the instance
% Y, the label of instances, in single column form: 1 2 3 4 5 ...
% a.E = 'weka.attributeSelection.SymmetricalUncertAttributeSetEval';
% a.S = 'weka.attributeSelection.FCBFSearch -D false -T -1.7976931348623157E308 -N -1';
tempY = SY2MY(Y);
t = weka.filters.supervised.attribute.AttributeSelection();
%% handle options
a.E = 'weka.attributeSelection.SymmetricalUncertAttributeSetEval';
a.S = 'weka.attributeSelection.FCBFSearch -D false -T -1.7976931348623157E308 -N -1';
tmp=wekaArgumentString({'-E',a.E});
tmp=wekaArgumentString({'-S',a.S},tmp);
t.setOptions(tmp);
%% train classifier
cat = wekaCategoricalData(X,tempY);
t.setInputFormat(cat);
newDat = weka.filters.Filter.useFilter(cat,t);
clear cat;
out.fList = [];
numF = newDat.numAttributes()-2;
for i = 0:numF
str = newDat.attribute(i).name;
str = str.toCharArray()';
strArry = strread(str,'%s');
out.fList(i+1) = str2num(strArry{2});
end |
donc on appelant cet fonction il me lance un erreur:
Code:
1 2 3 4 5 6 7 8
|
??? Undefined variable "weka" or class "weka.filters.supervised.attribute.AttributeSelection".
Error in ==> fsFCBF at 12
t = weka.filters.supervised.attribute.AttributeSelection();
Error in ==> AppelFonction at 14
out = fsFCBF(Xapp,Yapp) |
j'ai pas comris cet erreur et j'ai compris comment le corriger??