Class ProbabilityDistribution
Helpers for calculating probabilities of positive input values, using maximum values or quantiles to define the distribution's shape.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Statistics
Assembly: BotBrain.Core.dll
Syntax
public static class ProbabilityDistribution
Remarks
"Pseudo" represents not true probabilities, where the area is not necessarily equal to 1.
Methods
View SourceCalculateExponentialRate(float, float)
Calculates the rate for a exponential distribution where the given value represents a certain quantile of the survival function.
Declaration
public static float CalculateExponentialRate(float value, float quantile)
Parameters
Type | Name | Description |
---|---|---|
float | value | The value whose surviving probability equals the quantile. |
float | quantile | The quantile. |
Returns
Type | Description |
---|---|
float | The rate value. |
CalculateLogLogisticScale(float, float, float)
Calculates the scale for a log-logistic distribution where the given value represents a certain quantile of the survival function.
Declaration
public static float CalculateLogLogisticScale(float value, float quantile, float shape)
Parameters
Type | Name | Description |
---|---|---|
float | value | The value whose surviving probability equals the quantile. |
float | quantile | The quantile. |
float | shape | The shape parameter, beta. |
Returns
Type | Description |
---|---|
float | The scale value. |
Exponential(float, float)
Calculates the survival function of a exponential distribution.
Declaration
public static float Exponential(float x, float rate)
Parameters
Type | Name | Description |
---|---|---|
float | x | The value whose surviving probability to return. |
float | rate | The rate parameter, lambda. |
Returns
Type | Description |
---|---|
float | The surviving probability of the value. |
Linear(float, float)
Calculates a pseudo-probability density function using a line from the point (x = 0, y = 1).
Declaration
public static float Linear(float x, float maxValue)
Parameters
Type | Name | Description |
---|---|---|
float | x | The value whose probability to return. |
float | maxValue | The maximum value, or the first value with a probability of zero. |
Returns
Type | Description |
---|---|
float | The probability of the value. |
LinearFromSlopeIntercept(float, float, float)
Calculates a pseudo-probability density function using a line.
Declaration
public static float LinearFromSlopeIntercept(float x, float slope = -1, float intercept = 1)
Parameters
Type | Name | Description |
---|---|---|
float | x | The value whose probability to return. |
float | slope | The slope of the line. |
float | intercept | The y-axis intercept, 1 by default. |
Returns
Type | Description |
---|---|
float | The probability of the value. |
LogLogistic(float, float, float)
Calculates the survival function of a log-logistic distribution.
Declaration
public static float LogLogistic(float x, float scale, float shape)
Parameters
Type | Name | Description |
---|---|---|
float | x | The value whose surviving probability to return. |
float | scale | The scale parameter, alpha. |
float | shape | The shape parameter, beta. |
Returns
Type | Description |
---|---|
float | The surviving probability of the value. |