bayes-server
Version:
Bayes Server JavaScript API
168 lines (157 loc) • 7.45 kB
TypeScript
import { IDistribution, IList, VariableContext, CLGaussian, Table } from './core';
/**
* Calculates entropy, joint entropy or conditional entropy, which can be used to determine the uncertainty in the states of a discrete distribution.
*
* A higher values indicates less certainty about being in a particular state.
*/
export declare class Entropy {
/**
* Measures the uncertainty of a distribution.
*
* @param {IDistribution} joint The marginal or joint distribution.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: IDistribution, logarithmBase: LogarithmBase): number;
/**
* Measures the uncertainty of a distribution conditional on one or more variables.
*
* @param {IDistribution} joint The marginal or joint distribution.
*
* @param {IList<VariableContext>} conditionOn Any conditional variables. I.e. those on the right hand side of H(Y|X) when calculating conditional entropy.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: IDistribution, conditionOn: IList<VariableContext>, logarithmBase: LogarithmBase): number;
/**
* Measures the uncertainty of a distribution conditional on one or more variables.
*
* @param {Table} joint The marginal or joint distribution.
*
* @param {IList<VariableContext>} conditionOn Any conditional variables. I.e. those on the right hand side of H(Y|X) when calculating conditional entropy.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: Table, conditionOn: IList<VariableContext>, logarithmBase: LogarithmBase): number;
/**
* Measures the uncertainty of a distribution.
*
* @param {Table} joint The marginal or joint distribution.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: Table, logarithmBase: LogarithmBase): number;
/**
* Measures the uncertainty of a distribution conditional on one or more variables.
*
* @param {CLGaussian} joint The marginal or joint distribution.
*
* @param {IList<VariableContext>} conditionOn Any conditional variables. I.e. those on the right hand side of H(Y|X) when calculating conditional entropy.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: CLGaussian, conditionOn: IList<VariableContext>, logarithmBase: LogarithmBase): number;
/**
* Measures the uncertainty of a distribution.
*
* @param {CLGaussian} joint The marginal or joint distribution.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The entropy value.
*/
static calculate(joint: CLGaussian, logarithmBase: LogarithmBase): number;
private static _Calculate_autogen0(joint, logarithmBase);
private static _Calculate_autogen1(joint, conditionOn, logarithmBase);
private static _Calculate_autogen2(joint, conditionOn, logarithmBase);
private static _Calculate_autogen3(joint, logarithmBase);
private static _Calculate_autogen4(joint, conditionOn, logarithmBase);
private static _Calculate_autogen5(joint, logarithmBase);
}
/**
* Calculate the Kullback–Leibler divergence between 2 distributions with the same variables, D(P||Q).
*
* A value of 0 indicates that the two distributions behave in a very similar or identical way.
*/
export declare class KullbackLeibler {
/**
* Calculates the Kullback-Leibler divergence D(P||Q). Supports multivariate distributions. Supports discrete or continuous distributions.
*
* @param {IDistribution} priorQ The distribution Q in D(P||Q), e.g. the Prior.
*
* @param {IDistribution} posteriorP The distribution P in D(P||Q), e.g. the Posterior.
*
* @param {LogarithmBase} logarithm The base of the computation.
* @return {number} The Kullback-Leibler divergence in NATS if the logarithm is natural, BITS if the logarithm is base 2.
*/
static divergence(priorQ: IDistribution, posteriorP: IDistribution, logarithm: LogarithmBase): number;
}
/**
* Determines the base of the logarithm to use during calculations such as mutual information.
*/
export declare class LogarithmBase {
/**
* Natural (base e) logarithm.
*/
static readonly Natural: LogarithmBase;
/**
* Base 2 logarithm.
*/
static readonly Two: LogarithmBase;
}
/**
* Calculates mutual information or conditional mutual information, which measures the dependence between two variables.
*/
export declare class MutualInformation {
/**
* Measures the dependence between two variables.
*
* @param {IDistribution} joint The joint distribution over two (head) variables.
*
* @param {VariableContext} x X in the expression I(X,Y).
*
* @param {VariableContext} y Y in the expression I(X,Y).
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The mutual information value.
*/
static calculate(joint: IDistribution, x: VariableContext, y: VariableContext, logarithmBase: LogarithmBase): number;
/**
* Calculates mutual information or conditional mutual information, which measures the dependence between two variables.
*
* @param {IDistribution} joint The joint distribution over two or more variables.
*
* @param {VariableContext} x X in the expression I(X,Y) or I(X,Y|Z).
*
* @param {VariableContext} y Y in the expression I(X,Y) or I(X,Y|Z).
*
* @param {IList<VariableContext>} conditionOn Any conditional variables. I.e. Z in the expression I(X,Y|Z) when calculating conditional mutual information.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The mutual information value.
*/
static calculate(joint: IDistribution, x: VariableContext, y: VariableContext, conditionOn: IList<VariableContext>, logarithmBase: LogarithmBase): number;
/**
* Calculates mutual information or conditional mutual information, which measures the dependence between two variables.
*
* @param {IDistribution} joint The joint distribution over two or more variables.
*
* @param {IList<VariableContext>} x X in the expression I(X,Y) or I(X,Y|Z).
*
* @param {IList<VariableContext>} y Y in the expression I(X,Y) or I(X,Y|Z).
*
* @param {IList<VariableContext>} conditionOn Any conditional variables. I.e. Z in the expression I(X,Y|Z) when calculating conditional mutual information.
*
* @param {LogarithmBase} logarithmBase The logarithm base to use for the calculations.
* @return {number} The mutual information value.
*/
static calculate(joint: IDistribution, x: IList<VariableContext>, y: IList<VariableContext>, conditionOn: IList<VariableContext>, logarithmBase: LogarithmBase): number;
private static _Calculate_autogen0(joint, x, y, logarithmBase);
private static _Calculate_autogen1(joint, x, y, conditionOn, logarithmBase);
private static _Calculate_autogen2(joint, x, y, conditionOn, logarithmBase);
private static _ts_x_(p_autogen9, p_autogen10, p_autogen11, p_autogen12, p_autogen13);
}