private CategorisedEpisode EvaluateCategories(CategoricalAxis axis, Episode episode) { var key = Tuple.Create(episode, axis); Enum[] categories; if (!_evaluateCache.TryGetValue(key, out categories)) { categories = CategoricalAxisEvaluator.Evaluate(axis, episode.World, episode.Hero).ToArray(); _evaluateCache[key] = categories; } return(new CategorisedEpisode { Episode = episode, Categories = categories, }); }
private static List <DataPoint> EpisodesToDataPoints(List <Episode> episodes) { return(episodes.AsParallel().Select(episode => new DataPoint { Episode = episode, Class = (byte)episode.Tactic, Weight = (float)episode.Weight, Attributes = EnumUtils.GetEnumValues <ContinuousAxis>() .Select(axis => (float)ContinuousAxisEvaluator.Evaluate(axis, episode.World, episode.Hero)) .ToArray(), Categories = EnumUtils.GetEnumValues <CategoricalAxis>() .Select(axis => PolicyHelper.CategoriesToBits(CategoricalAxisEvaluator.Evaluate(axis, episode.World, episode.Hero))) .ToArray(), }).ToList()); }