public final class ParameterLearning extends Object
learn(com.bayesserver.data.EvidenceReaderCommand, com.bayesserver.learning.parameters.ParameterLearningOptions)
for sample code.Constructor and Description |
---|
ParameterLearning(Network network,
InferenceFactory factory)
Initializes a new instance of the
ParameterLearning class. |
Modifier and Type | Method and Description |
---|---|
Network |
getNetwork()
Returns the relevant network.
|
ParameterLearningOutput |
learn(EvidenceReaderCommand readerCommand,
List<DistributionSpecification> distributionSpecifications,
ParameterLearningOptions options)
Learns the parameters of a Bayesian network or Dynamic Bayesian network, from data.
|
ParameterLearningOutput |
learn(EvidenceReaderCommand readerCommand,
ParameterLearningOptions options)
Learns the parameters of a Bayesian network or Dynamic Bayesian network, from data.
|
static ParameterLearningOutput |
learnDistributed(Network network,
List<DistributionSpecification> distributionSpecifications,
ParameterLearningOptions options,
Distributer<DistributerContext> distributer)
Learns the parameters of a Bayesian network or Dynamic Bayesian network from data, on a distributed platform.
|
static ParameterLearningOutput |
learnDistributed(Network network,
ParameterLearningOptions options,
Distributer<DistributerContext> distributer)
Learns the parameters of a Bayesian network or Dynamic Bayesian network from data, on a distributed platform.
|
static void |
learnDistributedMapper(EvidencePartition<DistributedMapperContext> partition,
NameValuesReader configuration,
NameValuesWriter output,
InferenceFactory factory)
This method should be called during distributed parameter learning on a distributed partition.
|
static void |
learnDistributedReducer(Iterable<NameValuesReader> inputs,
NameValuesReader configuration,
NameValuesWriter output)
Aggregates (reduces) the results obtained from the distributed calls to
learnDistributedMapper(com.bayesserver.data.distributed.EvidencePartition<com.bayesserver.learning.parameters.DistributedMapperContext>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter, com.bayesserver.inference.InferenceFactory) . |
public ParameterLearning(Network network, InferenceFactory factory)
ParameterLearning
class.
Learning uses inference as a subroutine, and creates one or more inference engines via the [factory] parameter.network
- The network whose parameters are being learnt.factory
- The inference factory used to create inference engines in cases when learning requires inference.public Network getNetwork()
public ParameterLearningOutput learn(EvidenceReaderCommand readerCommand, ParameterLearningOptions options)
readerCommand
- Can create a reader containing the data to learn from.options
- Learning options.public static void learnDistributedReducer(Iterable<NameValuesReader> inputs, NameValuesReader configuration, NameValuesWriter output)
learnDistributedMapper(com.bayesserver.data.distributed.EvidencePartition<com.bayesserver.learning.parameters.DistributedMapperContext>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter, com.bayesserver.inference.InferenceFactory)
.inputs
- The results from each distributed mapper.configuration
- Configuration data that was distributed during the call to learnDistributed(com.bayesserver.Network, com.bayesserver.learning.parameters.ParameterLearningOptions, com.bayesserver.Distributer<com.bayesserver.learning.parameters.DistributerContext>)
.output
- The aggregated results which will be used by the driver program which called learnDistributed(com.bayesserver.Network, com.bayesserver.learning.parameters.ParameterLearningOptions, com.bayesserver.Distributer<com.bayesserver.learning.parameters.DistributerContext>)
.public static void learnDistributedMapper(EvidencePartition<DistributedMapperContext> partition, NameValuesReader configuration, NameValuesWriter output, InferenceFactory factory)
partition
- The distributed data to be learnt from.configuration
- Configuration data that was distributed during the call to learnDistributed(com.bayesserver.Network, com.bayesserver.learning.parameters.ParameterLearningOptions, com.bayesserver.Distributer<com.bayesserver.learning.parameters.DistributerContext>)
.output
- Stores the result of the distributed process. These results will later be passed to an aggregator (reducer).factory
- The inference factory used to create inference engines in cases when learning requires inference.public static ParameterLearningOutput learnDistributed(Network network, ParameterLearningOptions options, Distributer<DistributerContext> distributer)
network
- The network whose parameters are being learnt.options
- Learning options.distributer
- The caller must implement this interface, which allows processing to be distributed.
learnDistributedMapper(com.bayesserver.data.distributed.EvidencePartition<com.bayesserver.learning.parameters.DistributedMapperContext>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter, com.bayesserver.inference.InferenceFactory)
should be called in the map phase, andlearnDistributedReducer(java.lang.Iterable<com.bayesserver.NameValuesReader>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter)
should be called to reduce the results.public static ParameterLearningOutput learnDistributed(Network network, List<DistributionSpecification> distributionSpecifications, ParameterLearningOptions options, Distributer<DistributerContext> distributer)
com.bayesserver.learning.parameters.ParameterLearning#learn(IEvidenceReader, ParameterLearningOptions)
for sample code.network
- The network whose parameters are being learnt.distributionSpecifications
- The distributions to learn and options.options
- Learning options.distributer
- The caller must implement this interface, which allows processing to be distributed.
learnDistributedMapper(com.bayesserver.data.distributed.EvidencePartition<com.bayesserver.learning.parameters.DistributedMapperContext>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter, com.bayesserver.inference.InferenceFactory)
should be called in the map phase, andlearnDistributedReducer(java.lang.Iterable<com.bayesserver.NameValuesReader>, com.bayesserver.NameValuesReader, com.bayesserver.NameValuesWriter)
should be called to reduce the results.public ParameterLearningOutput learn(EvidenceReaderCommand readerCommand, List<DistributionSpecification> distributionSpecifications, ParameterLearningOptions options)
Network
are replaced during learning. If necessary, a copy of the original network can be made prior to learning, to keep the original values.readerCommand
- Can create a reader containing the data to learn from.distributionSpecifications
- The distributions to learn and options.options
- Learning options.Copyright © 2023. All rights reserved.