private Tuple <double, double> ProceedRow(double[] sarr, Domain.DataRow <double> row) { double rsum = 0; for (int i = 0; i < row.Values.Length; i++) { double diff = (sarr[i] - row.Values[i]);// * _corrs[i]; rsum += Math.Pow(diff, Pow); } double dist = Math.Pow(rsum, 1 / Pow); var tp = new Tuple <double, double>(dist, row.Target); return(tp); }
private static double[] GetRowValues(DataModifier modifier, DataLoader loader, Domain.DataRow <float> row) { if (modifier == null) { return(Array.ConvertAll(row.Values, x => (double)x)); } var vals = new Dictionary <string, double>(); for (int i = 0; i < row.Values.Length; i++) { string colname = loader.RowColumnByIdx[i]; vals.Add(colname, row.Values[i]); } var mvals = modifier.GetModifiedDataVector(vals); return(mvals); }