public double Expect(Col other) { var n = N + other.N; return(N / n * Variety() + other.N / n * other.Variety()); }
public void Read(string fileName) { int numIgnoreCols = 0; using (var reader = new StreamReader(fileName)) { int row = 0; while (!reader.EndOfStream) { var line = reader.ReadLine().Trim(); var values = line.Split(','); if (Cols.Count > 0 && Cols.Count() != values.Count()) //toss mismatched { Console.Error.WriteLine("Possible Error on line " + row); } if (row == 0) { int colNum = 1; //we have a well-defined header foreach (var c in values) { var newCol = Col.Create(c.Trim()); newCol.Index = colNum; colNum++; Cols.Add(newCol); if (newCol.Ignore) { numIgnoreCols++; } } row++; continue; } int col = 0; var currRow = new Row(); int numColValues = 0; foreach (var c in values) { if (Cols[col].Ignore) { col++; continue; } //TODO don't let both the Row and Cols hang onto the Cells. I think I would dump the Row Construct? var cell = currRow.AddCell(c.Trim(), Cols[col].CellType, Cols[col], row); if (!cell.IsEmpty()) { numColValues++; Cols[col].AddCell(cell); } col++; } row++; Rows.Add(currRow); int predictor = 0; foreach (var predict in _predicts) { var prediction = predict.AddRow(currRow, Cols); if (prediction != null) { _predictReporter[predictor].RecordPrediction(currRow.GetGoals().First().RawValue, prediction); } predictor++; } } } }
public abstract bool IsCentralTendencyDifferent(Col other, double epsilon);