static Person ParseLine(CsvReader csv, bool train = true) { int index = train ? 0 : -1; bool survived = false; if (train) survived = csv[index] == "1"; string pclass = csv[index + 1]; string name = csv[index + 2]; string sex = csv[index + 3]; string age = csv[index + 4]; string sibsp = csv[index + 5]; string parch = csv[index + 6]; string ticket = csv[index + 7]; string fare= csv[index + 8]; string cabin = csv[index + 9]; string embarked = csv[index + 10]; Person p = new Person( pclass, name, sex, age, sibsp, parch, ticket, fare, cabin, embarked, survived ); return p; }
public bool Predict(Person p) { object modality = p[_pivot]; if (_children.ContainsKey(modality)) return _children[modality].Predict(p); else return _defaultReturn; }
public bool Predict(Person p) { // Vote between oracles Index nbTrueVote = 0; Index nbFalseVote = 0; foreach (var tree in _trees) { if (tree.Predict(p)) nbTrueVote++; else nbFalseVote++; } return nbTrueVote > nbFalseVote; }
public bool Predict(Person p) { return _alwaysReturn; }