Last active
February 27, 2016 23:57
-
-
Save xinmeng1/cdb7153b50cf827c1240 to your computer and use it in GitHub Desktop.
WEKA tipAdd value to an attribute in instances.For example:you create a instances from a csv. One of the attribute is name "Label" which is nominal type(maybe infect and normal).However the csv file only have normal label data. So when the instance created by the csv, the attribute only contain normal.@Attribute label {normal}.You need to add in…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instances normalFullData = normalFullLoad.getDataSet(); | |
normalFullData.setClassIndex(normalFullData.numAttributes()-1); | |
//Add value "infect" to class attribute | |
AddValues filter = new AddValues(); | |
filter.setLabels("infect"); | |
boolean x = filter.setInputFormat(normalFullData); | |
normalFullData = Filter.useFilter(normalFullData, filter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WEKA tip
Add value to an attribute in instances.
For example:
you create a instances from a csv. One of the attribute is name "Label" which is nominal type(maybe infect and normal).
However the csv file only have normal label data. So when the instance created by the csv, the attribute only contain normal.
@Attribute label {normal}.
You need to add infect to this attribute:
Step by step:
Done!