MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / asClassificationDataSet

Method asClassificationDataSet

JSAT/src/jsat/SimpleDataSet.java:91–100  ·  view source on GitHub ↗

Converts this dataset into one meant for classification problems. The given categorical feature index is removed from the data and made the target variable for the classification problem. @param index the classification variable index, should be in the range [0, #getNumCategoricalVars() ) @

(int index)

Source from the content-addressed store, hash-verified

89 * the target of a classification dataset
90 */
91 public ClassificationDataSet asClassificationDataSet(int index)
92 {
93 if(index < 0)
94 throw new IllegalArgumentException("Index must be a non-negative value");
95 else if(getNumCategoricalVars() == 0)
96 throw new IllegalArgumentException("Dataset has no categorical variables, can not create classification dataset");
97 else if(index >= getNumCategoricalVars())
98 throw new IllegalArgumentException("Index " + index + " is larger than number of categorical features " + getNumCategoricalVars());
99 return new ClassificationDataSet(this, index);
100 }
101
102 /**
103 * Converts this dataset into one meant for regression problems. The

Callers 4

testWriteReadMethod · 0.95
testCluster_WeightedMethod · 0.80
testCluster_WeightedMethod · 0.80

Calls 1

getNumCategoricalVarsMethod · 0.80

Tested by 4

testWriteReadMethod · 0.76
testCluster_WeightedMethod · 0.64
testCluster_WeightedMethod · 0.64