ArffLoader arffLoader = new ArffLoader(); arffLoader.setFile(new File(fName1)); Instances newData1 = arffLoader.getDataSet(); arffLoader.setFile(new File(fName2)); Instances newData2 = arffLoader.getDataSet(); Instances mergedData = Instances.mergeInstances( newData1 ,newData2);
public class Main { private static final String ARFF_FILE_PATH = "YOUR_ARFF_FILE_PATH"; public static void main(String[] args) throws IOException { ArffLoader arffLoader = new ArffLoader(); File datasetFile = new File(ARFF_FILE_PATH); arffLoader.setFile(datasetFile); Instances dataInstances = arffLoader.getDataSet(); for(Instance inst : dataInstances){ System.out.println("Instance:" + inst); } } }
import java.io.*; import weka.core.Instance; import weka.core.Instances; import weka.core.converters.ArffLoader; import weka.core.converters.ArffLoader.ArffReader; public class assign3 { public static void main(String args[]) throws IOException { ArffLoader arffloader=new ArffLoader(); File filedata = new File("/home/cse611/Downloads/iris.arff"); arffloader.setFile(filedata); Instances data = arffloader.getDataSet();`enter code here` for(Instance inst : data){ System.out.println("Instance:" + inst); } } }
ArffLoader loader= new ArffLoader(); loader.setSource(new File("C:/Users/..../Desktop/maitre.arff")); Instances data= loader.getDataSet();
ArffLoader loader = new ArffLoader(); loader.setFile(new File("data.arff")); Instances structure = loader.getDataSet(); structure.setClassIndex(1);
private static void build_model() { // TODO Auto-generated method stub try{ // load data ArffLoader loader = new ArffLoader(); loader.setFile(new File("D:\\MAIN PROJECT\\data.arff")); Instances structure = loader.getDataSet(); structure.setClassIndex(structure.numAttributes() - 1); System.out.println("Attributes : "+structure.numAttributes()); System.out.println("Instances : "+structure.numInstances()); // train SMO System.out.println("Before creating smo object"); SMO smo = new SMO(); System.out.println("SMO object created"); smo.buildClassifier(structure); System.out.println("Classifier build"); System.out.println(smo); System.out.println("\nModel build successfully"); } catch(Exception e){ System.out.println("\nstack trace : " + e); } }
File input = new File(inputString); loader.setFile(input); setInstances(loader.getDataSet()); } catch (Exception ex) { ex.printStackTrace();
File input = new File(inputString); loader.setFile(input); setInstances(loader.getDataSet()); } catch (Exception ex) { ex.printStackTrace();
Instances unlabeled = trainLoader.getDataSet();
File input = new File(inputString); loader.setFile(input); Instances inst = loader.getDataSet(); if (index == -1) { inst.setClassIndex(inst.numAttributes() - 1);
File input = new File(inputString); loader.setFile(input); Instances inst = loader.getDataSet(); if (index == -1) { inst.setClassIndex(inst.numAttributes() - 1);
File inputFile = new File(inputString); al.setSource(inputFile); setInstances(al.getDataSet());
File inputFile = new File(inputString); al.setSource(inputFile); setInstances(al.getDataSet());
Instances unlabeled = trainLoader.getDataSet();
saver.setInstances(loader.getDataSet()); saver.writeBatch();