Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How to build WEKA dataset from arrays?

  1. #1

    Default How to build WEKA dataset from arrays?


    I want to use the Java WEKA library for classification. I only need classifiers such as LibSVM, NaiveBayes or C4.5 trees.
    My labels are stored in a 1D double array. My training and test set are stored in a 2D double array where the rows are the data points and the columns are the features.

    double[] labels = new double[N];
    double[][] trainingData = new double[N][D];
    double[][] testData = new double[X][D];
    N is the number of data points in the training data, X is the number of data points in the test data and D is the number of features.

    Now, I have seen that WEKA needs Instances to build the model and Instance for prediction.
    How can I get this type of objects from my data?

    Second, is it ok if my classes are 0 and 1 or do they have to be -1 and 1?

  2. #2
    Join Date
    Aug 2006


    Take a look at the Wiki section on the ARFF format and programatic use (for Weka 3.7):


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.