public void ChangePathType(PathType newType) { PathTypeState state = null; lastSetType = newType; switch (newType) { case PathType.city: state = new CityType(); break; case PathType.desert: state = new DesertType(); break; case PathType.field: state = new FieldType(); break; case PathType.forest: state = new ForestType(); break; case PathType.mountain: state = new MountainType(); break; case PathType.road: state = new RoadType(); break; case PathType.rocks: state = new RocksType(); break; case PathType.swamp: state = new SwampType(); break; case PathType.water: state = new WaterType(); break; } if (_pathType != null) { _pathType.OnExitState(); } _pathType = state; _pathType.OnEnterState(this); }
public RandomForest(XmlReader reader, string targetDataField = "_target") { Trees = new List <DecisionTree <T> >(); ReadDataFields(reader, targetDataField); reader.ReadToFollowing("MiningModel"); if (reader.Name == "MiningModel") { switch (reader.GetAttribute("functionName")) { case "regression": Type = ForestType.Regression; break; case "classification": Type = ForestType.Classification; break; default: Type = ForestType.Unknown; break; } } ValidateRandomForestData(); reader.ReadToFollowing("Segment"); while (reader.Name == "Segment") { reader.ReadToFollowing("Node"); Trees.Add(NewDecisionTree((XElement)XNode.ReadFrom(reader))); reader.ReadToFollowing("Segment"); } }