Class RelevanceTreeInference
An exact probabilistic inference algorithm for Bayesian networks and Dynamic Bayesian networks, that can compute multiple distributions more efficiently than the VariableEliminationInference algorithm.
Inherited Members
Namespace: BayesServer.Inference.RelevanceTree
Assembly: BayesServer.Inference.dll
Syntax
public sealed class RelevanceTreeInference : IInference, IDisposable
Constructors
RelevanceTreeInference(Network)
Initializes a new instance of the RelevanceTreeInference class, with the target Bayesian network.
Declaration
public RelevanceTreeInference(Network network)
Parameters
| Type | Name | Description |
|---|---|---|
| Network | network | The target Network. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Raised if |
Properties
BaseEvidence
Optional evidence which can be used to calculate the lift of queries. Defaults to null.
Declaration
public IEvidence BaseEvidence { get; set; }
Property Value
| Type | Description |
|---|---|
| IEvidence |
Remarks
When Comparison is true queries are adjusted based on marginals calculated with this evidence or no evidence if this value is null.
See Also
Evidence
Represents the evidence, or case data (e.g. row in a database) used in a query.
Declaration
public IEvidence Evidence { get; set; }
Property Value
| Type | Description |
|---|---|
| IEvidence |
Remarks
The distributions are only recalculated by BayesServer.Inference.IInference.Query, not each time evidence is changed.
<p>For more information see <xref href="BayesServer.Inference.IEvidence" data-throw-if-not-resolved="false"></xref>.</p>
Network
The target Bayesian network.
Declaration
public Network Network { get; }
Property Value
| Type | Description |
|---|---|
| Network |
QueryDistributions
Gets or sets the collection of distributions to calculate. See IQueryDistributionCollection.
Declaration
public IQueryDistributionCollection QueryDistributions { get; set; }
Property Value
| Type | Description |
|---|---|
| IQueryDistributionCollection |
Remarks
If required, a query distribution collection can be dynamically attached or detached. Also note that individual elements can be enabled or disabled on a per query basis.
QueryFunctions
Gets or sets the collection of functions to evaluate, after QueryDistributions have been calculated.
Declaration
public IQueryFunctionCollection QueryFunctions { get; set; }
Property Value
| Type | Description |
|---|---|
| IQueryFunctionCollection |
Remarks
If required, a query function collection can be dynamically attached or detached. Also note that individual elements can be enabled or disabled on a per query basis.
QueryLifecycle
Optional, allowing callers to hook into query lifecycle events, such as begin query and end query.
Declaration
public IQueryLifecycle QueryLifecycle { get; set; }
Property Value
| Type | Description |
|---|---|
| IQueryLifecycle |
Methods
Dispose()
Stops listening to notifications on the underlying Network.
Declaration
public void Dispose()
~RelevanceTreeInference()
Stops listening to notifications on the underlying Network before the RelevanceTreeInference instance is reclaimed by garbage collection.
Declaration
protected ~RelevanceTreeInference()
Query(IQueryOptions, IQueryOutput)
Calculates a number of distributions, e.g. P(A) and P(B) given the evidence (case data, e.g. row in a database), and if requested the log-likelihood of the data.
Declaration
public void Query(IQueryOptions queryOptions, IQueryOutput queryOutput)
Parameters
| Type | Name | Description |
|---|---|---|
| IQueryOptions | queryOptions | Options governing which calculations are performed and how. |
| IQueryOutput | queryOutput | Returns any information, in addition to the distributions, that is requested. For example the log-likelihood. |
Remarks
Each time this method is called the distributions have their values replaced, acting like buffers.
As well as requesting distributions of the form P(A), P(B) it is also possible to request distributions over a number of variables such as P(A,B).
If CLGaussian distributions are requested that include instantiated discrete variables, an algorithm may legitimately return mean and covariance values equal to NaN for entries corresponding to inconsistent discrete combinations. For example, if a CLGaussian is requested that includes a discrete variable 'Gender' with states 'Male' and 'Female' and evidence is set to 'Female' then any mean and covariance entries that correspond to 'Male' may be set to NaN. NaN values will always be accompanied by a corresponding zero value in the Table.
Exceptions
| Type | Condition |
|---|---|
| InvalidNetworkException | Raised if the network is invalid. |
| InconsistentEvidenceException | Raised if inconsistent evidence is detected, or underflow/overflow occurs when calculating queries or the conflict measure. Note that log-likelihood calculations do not raise this exception, but instead report -Infinity or +Infinity. |
Events
QueryExecuted
The event that is fired when the BayesServer.Inference.IInference.Query method completes.
Declaration
public event EventHandler<QueryExecutedEventArgs> QueryExecuted
Event Type
| Type | Description |
|---|---|
| EventHandler<QueryExecutedEventArgs> |
QueryExecuting
The event that is fired when the BayesServer.Inference.IInference.Query method begins.
Declaration
public event EventHandler<QueryExecutingEventArgs> QueryExecuting
Event Type
| Type | Description |
|---|---|
| EventHandler<QueryExecutingEventArgs> |