Ejemplo n.º 1
0
        private string[] CreateActionList(Histogram actionFeatures, HashedDistanceHistogram actions)
        {
            HashSet <string> actionSet = new HashSet <string>();

            while (actionSet.Count < actions.UniqueActions)
            {
                int featureCount = (int)actionFeatures.Sample(rand);
                var ac           = $"{{ {MakeFeatureVector(featureCount)} }}";
                if (!actionSet.Contains(ac))
                {
                    actionSet.Add(ac);
                }
            }

            var actionList = actionSet.ToArray();

            return(actionList);
        }
Ejemplo n.º 2
0
        public StatsFileStepProvider(string statsConfig, int seed, int steps)
        {
            this.rand  = new Random(seed);
            this.steps = steps;

            var obj = JObject.Parse(File.ReadAllText(statsConfig));

            int evtCount        = (int)obj["EventCount"];
            int obsCount        = (int)obj["ObservationCount"];
            int activationCount = (int)obj["ActivationCount"];

            this.pObs = obsCount / (double)evtCount;
            this.pAct = activationCount / (double)evtCount;

            this.sharedCtxFeatures = new Histogram((JObject)obj["SharedContextFeaturesDistribution"]);
            this.actionFeatures    = new Histogram((JObject)obj["ActionFeaturesDistribution"]);
            this.actionCount       = new Histogram((JObject)obj["ActionCountDistribution"]);
            this.actions           = new HashedDistanceHistogram((JObject)obj["RepetitionHistogram"]);
            this.actionList        = CreateActionList(actionFeatures, actions);
            this.recentActions     = new RotatingActionHash();
        }