1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-28 13:48:56 +08:00

Update knn.go to allow all FloatAttributes.

This commit is contained in:
Donnie Adams 2015-09-15 14:53:01 -07:00
parent 353cd38e7c
commit bce1f15444

View File

@ -124,6 +124,12 @@ func (KNN *KNNClassifier) Predict(what base.FixedDataGrid) base.FixedDataGrid {
}
}
// If every Attribute is a FloatAttribute, then we remove the last one
// because that is the Attribute we are trying to predict.
if len(allNumericAttrs) == len(allAttrs) {
allNumericAttrs = allNumericAttrs[:len(allNumericAttrs)-1]
}
// Generate return vector
ret := base.GeneratePredictionVector(what)