Re: weka.classifiers Message-ID: <243D7022-0287-480F-8058-AE92B9AFB568@waikato.ac.nz> Content-Type: text/plain; charset=us-ascii

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weka.classifiers Message-ID: <243D7022-0287-480F-8058-AE92B9AFB568@waikato.ac.nz> Content-Type: text/plain; charset=us-ascii

sa afef
Hi Eibe , Actually i have an algorithm for binary classification  that i use it with Matlab and in which there is this  part

function wekaFilter = trainWekaDiscretizer(wekaData,type,attributes,options)
% Train a weka classifier.
%
% wekaData - A weka java Instances object holding all of the training data.

% type    -  A string naming the type of classifier to train relative to
%            the weka.classifiers package. 
%
% options - an optional cell array of strings listing the options specific
%           to the classifier. See the weka documentation for details.
%
% List of a few selected weka classifiers - there are many many more:
%
% bayes.BayesNet
% bayes.NaiveBayes
% bayes.NaiveBayesMultinomial
% bayes.HNB
% functions.GaussianProcesses
% functions.IsotonicRegression
% functions.Logistic
% functions.MultilayerPerceptron
% functions.RBFNetwork
% functions.SVMreg
% lazy.IBk
% lazy.LBR
% misc.HyperPipes
% trees.RandomForest
% ...
%
% Written by Matthew Dunham (modified version by Bart Minnaert)

    if(~wekaPathCheck),wekaFilter = []; return,end
    if strcmp(type,'eib') || strcmp(type,'efb')
        wekaFilter = javaObject('weka.filters.unsupervised.attribute.Discretize');
        if strcmp(type,'efb')
           wekaFilter.setUseEqualFrequency(true);
        end
    else
        wekaFilter = javaObject('weka.filters.supervised.attribute.Discretize');
        if strcmp(type,'kon')
            wekaFilter.setUseKononenko(true);
        end
    end
    if(nargin == 4 && ~isempty(options))
        wekaFilter.setOptions(options);
    end
    j = 0;
    for i=0:wekaData.numAttributes-2 %correction for class
        if attributes(i+1) == 1
             j = j+1;
            attrIdxs(j) = i;
        end
    end
    if exist('attrIdxs')
        wekaFilter.setAttributeIndicesArray(attrIdxs);
    end
    wekaFilter.setInputFormat(wekaData);
    for i=0:wekaData.numInstances-1
        wekaFilter.input(wekaData.instance(i));
    end
    wekaFilter.batchFinished();
end

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: weka.classifiers Message-ID: <243D7022-0287-480F-8058-AE92B9AFB568@waikato.ac.nz> Content-Type: text/plain; charset=us-ascii

Eibe Frank-2
Administrator
And you have problems with it?

Cheers,
Eibe

> On 9 May 2017, at 21:31, sa afef <[hidden email]> wrote:
>
> Hi Eibe , Actually i have an algorithm for binary classification  that i use it with Matlab and in which there is this  part
>
> function wekaFilter = trainWekaDiscretizer(wekaData,type,attributes,options)
> % Train a weka classifier.
> %
> % wekaData - A weka java Instances object holding all of the training data.
>
> % type    -  A string naming the type of classifier to train relative to
> %            the weka.classifiers package.
> %
> % options - an optional cell array of strings listing the options specific
> %           to the classifier. See the weka documentation for details.
> %
> % List of a few selected weka classifiers - there are many many more:
> %
> % bayes.BayesNet
> % bayes.NaiveBayes
> % bayes.NaiveBayesMultinomial
> % bayes.HNB
> % functions.GaussianProcesses
> % functions.IsotonicRegression
> % functions.Logistic
> % functions.MultilayerPerceptron
> % functions.RBFNetwork
> % functions.SVMreg
> % lazy.IBk
> % lazy.LBR
> % misc.HyperPipes
> % trees.RandomForest
> % ...
> %
> % Written by Matthew Dunham (modified version by Bart Minnaert)
>
>     if(~wekaPathCheck),wekaFilter = []; return,end
>     if strcmp(type,'eib') || strcmp(type,'efb')
>         wekaFilter = javaObject('weka.filters.unsupervised.attribute.Discretize');
>         if strcmp(type,'efb')
>            wekaFilter.setUseEqualFrequency(true);
>         end
>     else
>         wekaFilter = javaObject('weka.filters.supervised.attribute.Discretize');
>         if strcmp(type,'kon')
>             wekaFilter.setUseKononenko(true);
>         end
>     end
>     if(nargin == 4 && ~isempty(options))
>         wekaFilter.setOptions(options);
>     end
>     j = 0;
>     for i=0:wekaData.numAttributes-2 %correction for class
>         if attributes(i+1) == 1
>              j = j+1;
>             attrIdxs(j) = i;
>         end
>     end
>     if exist('attrIdxs')
>         wekaFilter.setAttributeIndicesArray(attrIdxs);
>     end
>     wekaFilter.setInputFormat(wekaData);
>     for i=0:wekaData.numInstances-1
>         wekaFilter.input(wekaData.instance(i));
>     end
>     wekaFilter.batchFinished();
> end
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Loading...