public void SetDistribution( RandomVariable variable, IDictionary<string, string> variableAbbreviations, IEnumerable<RandomVariable> variableParents, DiscreteDistribution distribution) { _variable = variable; _variableParents = variableParents; _variableAbbreviations = variableAbbreviations; if (variable != null) { if (distribution != null) { _distributions = new DistributionSet(distribution); } else { _distributions = variable.Distributions; } } else { _distributions = new DistributionSet(); } RefreshUI(); }
public static DistributionSet ToDistributionSet(this JToken json0) { JArray json = (JArray)json0; List<Tuple<FObservation, DiscreteDistribution>> distributions = new List<Tuple<FObservation, DiscreteDistribution>>(); foreach (var d_j in json.Values<JObject>()) { FObservation o = d_j["key"].ToObservation(); DiscreteDistribution d = d_j["distribution"].ToDiscreteDistribution(); distributions.Add(new Tuple<FObservation, DiscreteDistribution>(o, d)); } DistributionSet set = new DistributionSet(distributions); return set; }