sanity / quickml

A fast and easy to use decision tree learner in java
http://quickml.org/
GNU Lesser General Public License v3.0
231 stars 54 forks source link

how to store serializable data in char array #124

Closed assaddia closed 9 years ago

assaddia commented 9 years ago

Sir I am new in java I apply you algorithm on may data set I get same result that I was getting in matlab my data set has binary classification 1 for notstress and 2 for stress. the problem is that I am getting difficulty to manipulate the result.

Serializable a= randomForest.getClassificationByMaxProb(attributes); System.out.println("Assigned class: " + a);

i am getting the result for the given test sample.

Assigned class: 1

i want to manipulate this class which is 1 by storing it in into any char or int variable to generate interrupt that the person is stress or not stress and show the probability of this class in the plot to show the level I get the probability of the class which was in the form of double. but I want to put the serializable a in to int or char pleas reply Regards Asad

assaddia commented 9 years ago

Serializable classification= randomForest.getClassificationByMaxProb(attributes); String strClassification = classification.toString(); // This is your string value, you can manipulate it with string compatible functions int intClassification = Integer.parseInt(strClassification); //This is your integer value, you can do mathematical manipulations. System.out.println("Assigned class: " + classification); System.out.println("Assigned class: " + strClassification); System.out.println("Assigned class: " + intClassification);