1

I have a file with suffix of .data and .dat as my dataset and I need to convert it into .idx and .arrf to use it as an input. I need it for my java project, I'll be appreciate of your helpping. here is the sample of my data: lib.stat.cmu.edu/datasets/NO2.dat

  BufferedReader r = new BufferedReader(new FileReader("data.arff"));
  Instances data = new Instances(r);
  data.setClassIndex(data.numAttributes() - 1);
  normalize(data);
  r.close();

  /* The data.idx must contain 3 serialized integer array obects.
   * They contain the instance indeies in the data file that belong to, respectively,
   * the labeled set, the unlabeled set and the test set
   */
  ObjectInputStream objin = new ObjectInputStream(new FileInputStream("data.idx"));
  int[] labeledIdx = (int[]) objin.readObject();
  int[] unlabeledIdx = (int[]) objin.readObject();
  int[] testIdx = (int[]) objin.readObject();

  Instances labeled = new Instances(data, 0);
  Instances unlabeled = new Instances(data, 0);
  Instances test = new Instances(data, 0);
zara-90
  • 38
  • 2
  • 8

0 Answers0