SubsetByExpression Select Instances

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

SubsetByExpression Select Instances

Gaetano
Hi. This is my arff file:
@attribute anno numeric
@attribute day numeric
@attribute ora numeric

I would like to know how to set the SubsetByExpression filter options to select the rows of the dataset based on the value of the 3 attributes.

I tried this but it gives me a syntax error:
        String[] options = new String[2];
        options[0]="-E";
        options[1]="ATT1=2012 AND ATT2=1 AND ATT3=2";
        SubsetByExpression filter = new SubsetByExpression();
        filter.setOptions(options);
        filter.setInputFormat(dataset);
        Instances testset = SubsetByExpression.useFilter(dataset, filter);


Syntax error
instead expected token classes are [EOF, PLUS, MINUS, TIMES, DIVISION, POW, AND, OR, LT, LE, GT, GE, IS, REGEXP]
Exception in thread "main" weka.core.expressionlanguage.core.SyntaxException: Syntax error at token 'IDENTIFIER'!

Thanks

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SubsetByExpression Select Instances

Mark Hall
Try using "and" instead of "AND". SubsetByExpression appears to be case sensitive for key words.

Cheers,
Mark.

On 29/05/17, 11:48 AM, "Gaetano" <[hidden email] on behalf of [hidden email]> wrote:

    Hi. This is my arff file:
    @attribute anno numeric
    @attribute day numeric
    @attribute ora numeric
   
    I would like to know how to set the SubsetByExpression filter options to
    select the rows of the dataset based on the value of the 3 attributes.
   
    I tried this but it gives me a syntax error:
            String[] options = new String[2];
            options[0]="-E";
            options[1]="ATT1=2012 AND ATT2=1 AND ATT3=2";
            SubsetByExpression filter = new SubsetByExpression();
            filter.setOptions(options);
            filter.setInputFormat(dataset);
            Instances testset = SubsetByExpression.useFilter(dataset, filter);
   
   
    Syntax error
    instead expected token classes are [EOF, PLUS, MINUS, TIMES, DIVISION, POW,
    AND, OR, LT, LE, GT, GE, IS, REGEXP]
    Exception in thread "main"
    weka.core.expressionlanguage.core.SyntaxException: Syntax error at token
    'IDENTIFIER'!
   
    Thanks
   
   
   
   
   
    --
    View this message in context: http://weka.8497.n7.nabble.com/SubsetByExpression-Select-Instances-tp40791.html
    Sent from the WEKA mailing list archive at Nabble.com.
    _______________________________________________
    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...