Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How to build nominal class attribute in WEKA?

  1. #1
    Join Date
    Apr 2016
    Posts
    2

    Default How to build nominal class attribute in WEKA?

    Hello

    I'm using the J48 tree classifier in WEKA. I have a two class problem with class values of 0 and 1. I'm providing the labels in the following way:

    Code:
        int[] trainingLabels;
        ArrayList<Attribute> atts = new ArrayList<Attribute>();
        List<Instance> instances = new ArrayList<Instance>();
        Attribute current = new Attribute("Class", 17);
        for (int obj = 0; obj < instances.size(); obj++) {
            instances.get(obj).setValue(current, trainingLabels[obj]);
        }
        atts.add(current);
    When I run my classifier I'm getting the error "Cannot handle numeric class".

    How can I build my class attribute as a nominal attribute but with numeric (0 and 1) values?

  2. #2
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    This has been answered on the Weka mailing list:

    https://list.waikato.ac.nz/pipermail...il/066627.html

    Cheers,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.