List of usage examples for weka.classifiers.functions LibLINEAR LibLINEAR
LibLINEAR
From source file:gr.ntua.sentimentanalysis.TrainingThread.java
License:Open Source License
public void run() { //Display info about this particular thread System.out.println(Thread.currentThread()); String[] inputPaths = {//from ww w . jav a 2 s .c o m "C:\\FOT\\SentimentAnalysisServiceGraphs\\standfordTrainingSet\\trainingNegativeTweets", "C:\\FOT\\SentimentAnalysisServiceGraphs\\standfordTrainingSet\\trainingPositiveTweets" }; String[][] documents = new String[inputPaths.length][]; for (int i = 0; i < inputPaths.length; i++) { documents[i] = (String[]) SerializationUtilities.loadSerializedObject(inputPaths[i]); System.out.println("Documents\t:\t" + documents[i].length); } System.out.println("Preparing instances..."); a.vmcl = new VectorModels(0.5, 0.0, documents); a.vmcl.prepareData(true, a.REP_MODEL); a.instances = a.vmcl.getInstances(); System.out.println("Training classifier..."); a.classifier = new LibLINEAR(); try { a.classifier.buildClassifier(a.instances); } catch (Exception e) { e.printStackTrace(); } System.out.println("Classifier was trained!"); }