static void InitValfri() { ValfriStatic.MatrixOfPoints = DictToMatrix.GetMatrix(Dataset.ListOfPoints); ValfriStatic.Targets = GetTargetFromDataSet(ValfriStatic.MatrixOfPoints); SetColor.Init(ValfriStatic.Targets); ValfriStatic.MatrixOfPoints = RemoveIndexAndTarget(ValfriStatic.MatrixOfPoints); Normalize.Initiate(ValfriStatic.MatrixOfPoints); ValfriStatic.NormalizedMatrixOfPoints = Normalize.Matrix(ValfriStatic.MatrixOfPoints); ValfriStatic.FeaturesToDisplay = Dataset.FeatureNames; }
public static void NewPrediction() { if (usedFeatures.Count > 0) { NewDataPoints[0][usedFeatures[0]] = newPred[0]; NewDataPoints[0][usedFeatures[1]] = newPred[1]; NewDataPoints[0][usedFeatures[2]] = newPred[2]; } else { NewDataPoints[0][NewDataPoints[0].Keys.ElementAt(1)] = newPred[0]; NewDataPoints[0][NewDataPoints[0].Keys.ElementAt(2)] = newPred[1]; NewDataPoints[0][NewDataPoints[0].Keys.ElementAt(3)] = newPred[2]; } var obj = CreateNewObject(NewDataPoints[0].Keys.Count() - 2, NewDataPoints[0]); var classified = Knn.Classify(obj, DictToMatrix.DictionaryListToMatrix(ListOfPoints), GetNumberOfTargets(GetDataSetTargets()), K); if (classified is - 1) { return; }