public List <DataPrediction> PredictWithKNN() { List <DataPrediction> newData = this.dataForPredict; Pattern newPattern = new Pattern(); listPoint.setData(this.dataForPredict); listImportantPoint = listPoint.GetlistImportPoint(deepCompare); GenListPattern(); FindKNN(); newPattern = CanculatorAvengerListOfSequence(); foreach (var pnt in newPattern.listPoint) { DataPrediction dt = new DataPrediction(newData[newData.Count - 1].getTime().AddDays(pnt.lenghBeforeDay), pnt.value); dt.isNewPoint = true; newData.Add(dt); } for (int i = 0; i < newData.Count; i++) { for (int j = 0; j < listImportantPoint.Count; j++) { if (i.Equals(listImportantPoint[j].index)) { newData[i].isIPoint = true; break; } } } return(newData); }
private void Init(List <DataPrediction> data, int lenghOfPattern, int numOfKNN, double deepCompare) { this.numOfKNN = numOfKNN; this.dataForPredict = data; this.patternLengh = lenghOfPattern; listPoint = new FindImportantPoint(dataForPredict); listPatter = new List <Pattern>(); listImportantPoint = listPoint.GetlistImportPoint(deepCompare); listKNN = new List <int>(this.numOfKNN); listSequence = new List <Pattern>(); GenListPattern(); this.deepCompare = deepCompare; }