Java examples for Machine Learning AI:weka
CSV 2 weka Arff
import java.io.File; import java.io.IOException; import weka.core.Instances; import weka.core.converters.ArffSaver; import weka.core.converters.CSVLoader; public class CSV2Arff { public static void main(String[] args) throws IOException { CSVLoader loader = new CSVLoader(); loader.setSource(new File("house.csv")); Instances data = loader.getDataSet(); ArffSaver saver = new ArffSaver(); saver.setInstances(data);//from ww w . ja v a2s .c om saver.setFile(new File("house-new.arff")); saver.writeBatch(); } }