Class SparseGammaList
Represents a sparse list of Gamma 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]
[DataContract]
[Quality(QualityBand.Stable)]
public class SparseGammaList : SparseDistributionList<Gamma, double, SparseGammaList>, ISparseList<Gamma>, ISparseEnumerable<Gamma>, IList<Gamma>, ICollection<Gamma>, IEnumerable<Gamma>, IList, ICollection, IEnumerable, IDistribution<ISparseList<double>>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<ISparseList<double>>, CanGetLogProb<ISparseList<double>>, Sampleable<ISparseList<double>>, SettableTo<SparseGammaList>, SettableToProduct<SparseGammaList>, SettableToProduct<SparseGammaList, SparseGammaList>, SettableToPower<SparseGammaList>, SettableToRatio<SparseGammaList>, SettableToRatio<SparseGammaList, SparseGammaList>, SettableToWeightedSum<SparseGammaList>, CanGetLogAverageOf<SparseGammaList>, CanGetLogAverageOfPower<SparseGammaList>, CanGetAverageLog<SparseGammaList>, CanGetMean<ISparseList<double>>, CanGetVariance<ISparseList<double>>
Constructors
SparseGammaList()
Initializes a new instance of the SparseGammaList class.
Declaration
public SparseGammaList()
Methods
FromMeanAndMeanLog(Int32, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given mean and mean log.
Declaration
public static SparseGammaList FromMeanAndMeanLog(int size, double mean, double meanLog)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | mean | Desired expected value. |
| Double | meanLog | Desired expected logarithm. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromMeanAndMeanLog(Int32, Double, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given mean and mean log.
Declaration
public static SparseGammaList FromMeanAndMeanLog(int size, double mean, double meanLog, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | mean | Desired expected value. |
| Double | meanLog | Desired expected logarithm. |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromMeanAndVariance(Int32, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given mean and variance.
Declaration
public static SparseGammaList FromMeanAndVariance(int size, double mean, double variance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | mean | The desired mean. |
| Double | variance | The desired variance. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromMeanAndVariance(Int32, Double, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given mean and variance.
Declaration
public static SparseGammaList FromMeanAndVariance(int size, double mean, double variance, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | mean | The desired mean. |
| Double | variance | The desired variance. |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromNatural(Int32, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having the specified natural parameters.
Declaration
public static SparseGammaList FromNatural(int size, double shapeMinus1, double rate)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shapeMinus1 | shape - 1. |
| Double | rate | rate = 1/scale. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromNatural(Int32, Double, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having the specified natural parameters.
Declaration
public static SparseGammaList FromNatural(int size, double shapeMinus1, double rate, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shapeMinus1 | shape - 1. |
| Double | rate | rate = 1/scale. |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndRate(Vector, Vector)
Returns a new instance of the SparseGammaList class of a given size with given shape and rate Vectors.
Declaration
public static SparseGammaList FromShapeAndRate(Vector shape, Vector rate)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | shape | The shape vector. |
| Vector | rate | The rate vector (= 1/scale). |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndRate(Vector, Vector, Double)
Returns a new instance of the SparseGammaList class of a given size with given shape and rate Vectors.
Declaration
public static SparseGammaList FromShapeAndRate(Vector shape, Vector rate, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | shape | The shape vector. |
| Vector | rate | The rate vector (= 1/scale). |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndRate(Int32, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given shape and rate.
Declaration
public static SparseGammaList FromShapeAndRate(int size, double shape, double rate)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shape | The shape value. |
| Double | rate | The rate value (= 1/scale). |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndRate(Int32, Double, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given shape and rate.
Declaration
public static SparseGammaList FromShapeAndRate(int size, double shape, double rate, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shape | The shape value. |
| Double | rate | The rate value (= 1/scale). |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndScale(ISparseList<Double>, ISparseList<Double>)
Returns a new instance of the SparseGammaList class from sparse lists of shapes and scales.
Declaration
public static SparseGammaList FromShapeAndScale(ISparseList<double> shape, ISparseList<double> scale)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseList<Double> | shape | The shape values. |
| ISparseList<Double> | scale | The scale values. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndScale(ISparseList<Double>, ISparseList<Double>, Double)
CReturns a new instance of the SparseGammaList class from sparse lists of shapes and scales.
Declaration
public static SparseGammaList FromShapeAndScale(ISparseList<double> shape, ISparseList<double> scale, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseList<Double> | shape | The shape values. |
| ISparseList<Double> | scale | The scale values. |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndScale(Int32, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given shape and scale.
Declaration
public static SparseGammaList FromShapeAndScale(int size, double shape, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shape | The shape value. |
| Double | scale | The scale value. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
FromShapeAndScale(Int32, Double, Double, Double)
Returns a new instance of the SparseGammaList class of a given size, with each element having a given shape and scale.
Declaration
public static SparseGammaList FromShapeAndScale(int size, double shape, double scale, double tolerance)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | size | The size of the list. |
| Double | shape | The shape value. |
| Double | scale | The scale value. |
| Double | tolerance | The tolerance for the approximation. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The new SparseGammaList instance. |
Sample(ISparseList<Double>, ISparseList<Double>)
Samples from a list of Gamma distributions with the specified vectors. of shapes and rates
Declaration
public static ISparseList<double> Sample(ISparseList<double> shapes, ISparseList<double> rates)
Parameters
| Type | Name | Description |
|---|---|---|
| ISparseList<Double> | shapes | Vector of shapes. |
| ISparseList<Double> | rates | Vector of rates. |
Returns
| Type | Description |
|---|---|
| ISparseList<Double> | The sample. |
Operators
Division(SparseGammaList, SparseGammaList)
Creates a SparseGammaList distribution which is the ratio of two others.
Declaration
public static SparseGammaList operator /(SparseGammaList numerator, SparseGammaList denominator)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGammaList | numerator | The numerator. |
| SparseGammaList | denominator | The denominator. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The resulting SparseGammaList distribution. |
ExclusiveOr(SparseGammaList, Double)
Creates a SparseGammaList distribution which is the power of another.
Declaration
public static SparseGammaList operator ^(SparseGammaList dist, double exponent)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGammaList | dist | The other distribution. |
| Double | exponent | The exponent. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The resulting SparseGammaList distribution. |
Multiply(SparseGammaList, SparseGammaList)
Creates a SparseGammaList distribution which is the product of two others.
Declaration
public static SparseGammaList operator *(SparseGammaList a, SparseGammaList b)
Parameters
| Type | Name | Description |
|---|---|---|
| SparseGammaList | a | The first distribution. |
| SparseGammaList | b | The second distribution. |
Returns
| Type | Description |
|---|---|
| SparseGammaList | The resulting SparseGammaList distribution. |