public object Calculate(CustomDataElement testDataObject, int k, List <string> fileData, string[] selectColumns, string classColumn) { var data = DataSetup.SetUpData(fileData, selectColumns, classColumn); var neighbors = GetNeighbors(data, testDataObject, k); var type = SelectType(neighbors); return(type); }
/// <summary> /// Main calculation method. /// </summary> /// <param name="testDataElement">new test object data</param> /// <param name="fileData">input data</param> /// <param name="selectColumns">selected data column numbers</param> /// <param name="classColumn">class column number</param> /// <returns></returns> public string Calculate(CustomDataElement testDataElement, List <string> fileData, string[] selectColumns, string classColumn) { var data = DataSetup.SetUpData(fileData, selectColumns, classColumn); var classDictionary = SeparateData(data); var summary = GetClassSummary(classDictionary); var probabilities = GetProbabilities(summary, testDataElement); var prediction = GetPrediction(probabilities); return(prediction.Key); }