net.sf.javaml.tools.data.FileHandler Java Examples
The following examples show how to use
net.sf.javaml.tools.data.FileHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JMLNeurophSample.java From NeurophFramework with Apache License 2.0 | 5 votes |
public static void main(String[] args) { try { //create jml dataset Dataset jmlDataset = FileHandler.loadDataset(new File("datasets/iris.data"), 4, ","); // normalize dataset NormalizeMidrange nmr=new NormalizeMidrange(0,1); nmr.build(jmlDataset); nmr.filter(jmlDataset); //print data as read from file System.out.println(jmlDataset); //convert jml dataset to neuroph DataSet neurophDataset = JMLDataSetConverter.convertJMLToNeurophDataset(jmlDataset, 4, 3); //convert neuroph dataset to jml Dataset jml = JMLDataSetConverter.convertNeurophToJMLDataset(neurophDataset); //print out both to compare them System.out.println("Java-ML data set read from file"); printDataset(jmlDataset); System.out.println("Neuroph data set converted from Java-ML data set"); printDataset(neurophDataset); System.out.println("Java-ML data set reconverted from Neuroph data set"); printDataset(jml); System.out.println("JMLNeuroph classifier test"); //test NeurophJMLClassifier testJMLNeurophClassifier(jmlDataset); } catch (Exception ex) { Logger.getLogger(JMLNeurophSample.class.getName()).log(Level.SEVERE, null, ex); } }
Example #2
Source File: JavaMLClusterers.java From apogen with Apache License 2.0 | 5 votes |
public static LinkedHashMap<Integer, LinkedList<String>> runKmedoid(String filename, String numClusters, boolean distance) throws IOException { LinkedHashMap<Integer, LinkedList<String>> output = null; Clusterer c = new KMedoids(Integer.parseInt(numClusters), 500, new EuclideanDistance()); // if (distance) { //// c = new KMedoidsDistance(Integer.parseInt(numClusters), 500, //// new EuclideanDistance()); // c = new KMedoids(Integer.parseInt(numClusters), 500, new // EuclideanDistance()); // } else { // c = new KMedoids(Integer.parseInt(numClusters), 500, // new EuclideanDistance()); // } Dataset data = FileHandler.loadDataset(new File(filename), 0, ","); Dataset[] clusters = c.cluster(data); output = convert(clusters); return output; }