/// <summary> /// Sets this BernoulliIntegerSubset distribution to the weighted sum of two other such distributions /// </summary> /// <param name="weight1"></param> /// <param name="value1"></param> /// <param name="weight2"></param> /// <param name="value2"></param> /// <remarks>Not yet implemented</remarks> public void SetToSum(double weight1, BernoulliIntegerSubset value1, double weight2, BernoulliIntegerSubset value2) { if (weight1 + weight2 == 0) { SetToUniform(); } else { LogOddsVector.SetToFunction(value1.GetProbTrueVector(), value2.GetProbTrueVector(), (x, y) => MMath.Logit((weight1 * x + weight2 * y) / (weight1 + weight2))); } }
/// <summary> /// Gets a vector of P(true) values. /// </summary> /// <returns></returns> public void SetProbTrueVector(SparseVector probTrueVector) { LogOddsVector.SetToFunction(probTrueVector, MMath.Logit); }
/// <summary> /// Tests if all Bernoulli elements are uniform. /// </summary> /// <returns></returns> public bool IsUniform() { return(LogOddsVector.EqualsAll(0)); }
/// <summary> /// Sets all Bernoulli elements to uniform. /// </summary> public void SetToUniform() { LogOddsVector.SetAllElementsTo(0.0); }
public SparseBernoulliList(Vector logOddsVector) : this(logOddsVector.Count) { LogOddsVector.SetTo(logOddsVector); }
/// <summary> /// Sets this BernoulliIntegerSubset distribution to the ratio of two other such distributions /// </summary> /// <param name="numerator"></param> /// <param name="denominator"></param> public void SetToRatio(BernoulliIntegerSubset numerator, BernoulliIntegerSubset denominator) { LogOddsVector.SetToDifference(numerator.LogOddsVector, denominator.LogOddsVector); }
/// <summary> /// Sets this BernoulliIntegerSubset distribution to another such distribution /// </summary> /// <param name="value"></param> public void SetTo(BernoulliIntegerSubset value) { LogOddsVector.SetTo(value.LogOddsVector); }
/// <summary> /// Sets this BernoulliIntegerSubset distribution to a product of two other such distributions /// </summary> /// <param name="a"></param> /// <param name="b"></param> public void SetToProduct(BernoulliIntegerSubset a, BernoulliIntegerSubset b) { LogOddsVector.SetToSum(a.LogOddsVector, b.LogOddsVector); }
/// <summary> /// Clones this object. /// </summary> /// <returns></returns> public object Clone() { BernoulliIntegerSubset clone = new BernoulliIntegerSubset((SparseVector)LogOddsVector.Clone()); return(clone); }
public BernoulliIntegerSubset(Vector logOddsVector) : this(logOddsVector.Count) { LogOddsVector.SetTo(logOddsVector); }