0

こちらから「Matlab Weka Interface」をインストールしました。BayesNet を使用するための私のコードは次のとおりですが、例外がスローされます。オプションを渡す方法を教えてください。

コード:

    try
    classifierNo=classifierNo+1;
    wekaClassifierName = 'bayes.BayesNet';
    wekaClassifierConfig = {'-D -Q weka.classifiers.bayes.net.search.local.K2 -- -P 1 -S BAYES -E weka.classifiers.bayes.net.estimate.SimpleEstimator -- -A 0.5'};

    for i = 1:10
        test = (indices == i); 
        train = ~test;
        testSize = sum(test);

        if testOriginal==0
            train = [num2cell(mskMat(train,:)),irisLabels(train,:)];
            test  = [num2cell(global_origMat(test,:)),irisLabels(test,:)];

            %Convert to weka format
            train = matlab2weka('iTrain',featureNames,train,classIndex);
            test =  matlab2weka('iTest',featureNames,test);

            %Train the classifier
            nb = trainWekaClassifier(train,wekaClassifierName,wekaClassifierConfig);

            %Test the classifier
            predicted = wekaClassify(test,nb);

            %The actual class labels (i.e. indices thereof)
            actual = test.attributeToDoubleArray(classIndex-1); 

            correctRate = sum(actual == predicted)/testSize;
        else
            train = [num2cell(global_origMat(train,:)),irisLabels(train,:)];
            test  = [num2cell(global_origMat(test,:)),irisLabels(test,:)];

            %Convert to weka format
            train = matlab2weka('iTrain',featureNames,train,classIndex);
            test =  matlab2weka('iTest',featureNames,test);

            %Train the classifier
            nb = trainWekaClassifier(train,wekaClassifierName,wekaClassifierConfig);

            %Test the classifier
            predicted = wekaClassify(test,nb);

            %The actual class labels (i.e. indices thereof)
            actual = test.attributeToDoubleArray(classIndex-1); 

            correctRate = sum(actual == predicted)/testSize;
        end
    end

    fprintf ('%f \n\t\t\t\t\t\t',correctRate);
    sumCorrect(classifierNo)=sumCorrect(classifierNo)+correctRate;
    repeatClassifier(classifierNo) = repeatClassifier(classifierNo) + 1;
end

エラーは次のとおりです。

weka.classifiers.bayes.BayesNet/setOptions の使用エラー
Java 例外が発生しました:
java.lang.Exception: 無効なオプション: -D -Q weka.classifiers.bayes.net.search.local.K2 -- -P 1 -S BAYES -E
weka.classifiers.bayes.net.estimate.SimpleEstimator -- -A 0.5

    weka.core.Utils.checkForRemainingOptions (Utils.java:482) で

    weka.classifiers.bayes.BayesNet.setOptions (BayesNet.java:510) で"
4

1 に答える 1