Class SparseBernoulliList
Represents a sparse list of Bernoulli distributions, optimized for the case where many share the same parameter value. The class supports an approximation tolerance which allows elements close to the common value to be automatically reset to the common value.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[Serializable]
[Quality(QualityBand.Stable)]
[DataContract]
public class SparseBernoulliList : SparseDistributionList<Bernoulli, bool, SparseBernoulliList>, ISparseList<Bernoulli>, ISparseEnumerable<Bernoulli>, IList<Bernoulli>, ICollection<Bernoulli>, IEnumerable<Bernoulli>, IList, ICollection, IEnumerable, IDistribution<ISparseList<bool>>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<ISparseList<bool>>, CanGetLogProb<ISparseList<bool>>, Sampleable<ISparseList<bool>>, SettableTo<SparseBernoulliList>, SettableToProduct<SparseBernoulliList>, SettableToProduct<SparseBernoulliList, SparseBernoulliList>, SettableToPower<SparseBernoulliList>, SettableToRatio<SparseBernoulliList>, SettableToRatio<SparseBernoulliList, SparseBernoulliList>, SettableToWeightedSum<SparseBernoulliList>, CanGetLogAverageOf<SparseBernoulliList>, CanGetLogAverageOfPower<SparseBernoulliList>, CanGetAverageLog<SparseBernoulliList>, CanGetMean<ISparseList<double>>, CanGetVariance<ISparseList<double>>
Constructors
SparseBernoulliList()
Initializes a new instance of the SparseBernoulliList class
Declaration
public SparseBernoulliList()
Methods
FromLogOdds(ISparseList<Double>)
Returns a new instance of the SparseBernoulliList class of a given size from a sparse list of log odds.
Declaration
public static SparseBernoulliList FromLogOdds(ISparseList<double> logOdds)
Parameters
Type | Name | Description |
---|---|---|
ISparseList<Double> | logOdds | The sparse list of log odds. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromLogOdds(ISparseList<Double>, Double)
Returns a new instance of the SparseBernoulliList class of a given size from a sparse list of log odds.
Declaration
public static SparseBernoulliList FromLogOdds(ISparseList<double> logOdds, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
ISparseList<Double> | logOdds | The sparse list of log odds. |
Double | tolerance | The tolerance for the approximation. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromLogOdds(Int32, Double)
Returns a new instance of the SparseBernoulliList class of a given size, with each element having a given log odds.
Declaration
public static SparseBernoulliList FromLogOdds(int size, double logOdds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | The size of the list. |
Double | logOdds | The desired log odds. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromLogOdds(Int32, Double, Double)
Returns a new instance of the SparseBernoulliList class of a given size, with each element having a given log odds.
Declaration
public static SparseBernoulliList FromLogOdds(int size, double logOdds, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | The size of the list. |
Double | logOdds | The desired log odds. |
Double | tolerance | The tolerance for the approximation. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromProbTrue(ISparseList<Double>)
Returns a new instance of the SparseBernoulliList class of a given size from a sparse list of probability true.
Declaration
public static SparseBernoulliList FromProbTrue(ISparseList<double> probTrue)
Parameters
Type | Name | Description |
---|---|---|
ISparseList<Double> | probTrue | The sparse list of probability of true. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromProbTrue(ISparseList<Double>, Double)
Returns a new instance of the SparseBernoulliList class of a given size from a sparse list of probability true.
Declaration
public static SparseBernoulliList FromProbTrue(ISparseList<double> probTrue, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
ISparseList<Double> | probTrue | The sparse list of probability of true. |
Double | tolerance | The tolerance for the approximation. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromProbTrue(Int32, Double)
Returns a new instance of the SparseBernoulliList class of a given size, with each element having a given probability of true.
Declaration
public static SparseBernoulliList FromProbTrue(int size, double probTrue)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | The size of the list. |
Double | probTrue | The desired probability of true. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
FromProbTrue(Int32, Double, Double)
Returns a new instance of the SparseBernoulliList class, with each element having a given probability of true.
Declaration
public static SparseBernoulliList FromProbTrue(int size, double probTrue, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | The size of the list. |
Double | probTrue | The desired probability of true. |
Double | tolerance | The tolerance for the approximation. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The new SparseBernoulliList instance. |
Sample(ISparseList<Double>)
Samples from a SparseBernoulliList with the specified probability of true.
Declaration
public static ISparseList<bool> Sample(ISparseList<double> probTrue)
Parameters
Type | Name | Description |
---|---|---|
ISparseList<Double> | probTrue | Probability of true. |
Returns
Type | Description |
---|---|
ISparseList<Boolean> | The sample. |
Operators
Division(SparseBernoulliList, SparseBernoulliList)
Creates a SparseBernoulliList distribution which is the ratio of two others.
Declaration
public static SparseBernoulliList operator /(SparseBernoulliList numerator, SparseBernoulliList denominator)
Parameters
Type | Name | Description |
---|---|---|
SparseBernoulliList | numerator | The numerator. |
SparseBernoulliList | denominator | The denominator. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The resulting SparseBernoulliList distribution. |
ExclusiveOr(SparseBernoulliList, Double)
Creates a SparseBernoulliList distribution which is the power of another.
Declaration
public static SparseBernoulliList operator ^(SparseBernoulliList dist, double exponent)
Parameters
Type | Name | Description |
---|---|---|
SparseBernoulliList | dist | The other distribution. |
Double | exponent | The exponent. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The resulting SparseBernoulliList distribution. |
Multiply(SparseBernoulliList, SparseBernoulliList)
Creates a SparseBernoulliList distribution which is the product of two others.
Declaration
public static SparseBernoulliList operator *(SparseBernoulliList a, SparseBernoulliList b)
Parameters
Type | Name | Description |
---|---|---|
SparseBernoulliList | a | The first distribution. |
SparseBernoulliList | b | The second distribution. |
Returns
Type | Description |
---|---|
SparseBernoulliList | The resulting SparseBernoulliList distribution. |