internal MathematicianName(IEnumerable <MathematicianName> priorNames, string firstName, string lastName) { Prior = priorNames.ToList(); FirstName = firstName; LastName = lastName; HashCode = FirstName.Sha256Hash() .Concatenate(LastName.Sha256Hash()) .Concatenate(Prior.Select(x => x.HashCodeInt).ToArray()) .ToByteArray(); _hashCodeInt = new Lazy <BigInteger>(ComputeHashCodeInt); }
public CategoricalDistribution AskBayesianModel(object owner, IContextLookup globalVars, IDictionary <string, RandomVariable> randomVariables, FiniteProbabilityModel model) { var priorProps = Prior.Select(objProp => objProp.GetProposition(owner, globalVars, randomVariables)); switch (QueryType) { case BayesianQueryType.Prior: return(model.priorDistribution(priorProps.ToArray())); case BayesianQueryType.Posterior: var posteriorProps = Posteriors.Select(objProp => objProp.GetProposition(owner, globalVars, randomVariables)); return(model.posteriorDistribution(priorProps.ToArray()[0], posteriorProps.ToArray())); case BayesianQueryType.Joint: return(model.jointDistribution((priorProps.ToArray()))); default: throw new ArgumentOutOfRangeException(); } }