Generative bayesian network
NodeJs package containing a bayesian network capable of randomly sampling from a distribution defined by a json file.
Installation
Usage
Examples
API Reference
All public classes, methods and their parameters can be inspected in this API reference.
BayesianNetwork
BayesianNetwork is an implementation of a bayesian network capable of randomly sampling from the distribution
represented by the network.
new BayesianNetwork(networkDefinition)
Param | Type | Description |
---|
networkDefinition | object | object defining the network structure and distributions |
bayesianNetwork.generateSample(inputValues)
Randomly samples from the distribution represented by the bayesian network.
Can generate samples not found in the data used to create the definition file.
Param | Type | Description |
---|
inputValues | object | node values that are known already |
bayesianNetwork.generateConsistentSampleWhenPossible(valuePossibilities)
Randomly samples from the distribution represented by the bayesian network.
Cannot generate samples not found in the data used to create the definition file,
so it only generates samples when it is possible to be consistent with the data.
Param | Type | Description |
---|
valuePossibilities | object | a dictionary of lists of possible values for nodes (if a node isn't present in the dictionary, all values are possible) |