@PublicationReference(author="Christopher M. Bishop",title="Pattern Recognition and Machine Learning",type=Book,year=2006,pages={152,159}) @PublicationReference(author="Hanna M. Wallach",title="Introduction to Gaussian Process Regression",type=Misc,year=2005,url="http://www.cs.umass.edu/~wallach/talks/gp_intro.pdf") @PublicationReference(author="Wikipedia",title="Bayesian linear regression",type=WebPage,year=2010,url="http://en.wikipedia.org/wiki/Bayesian_linear_regression") public class BayesianLinearRegression extends AbstractCloneableSerializable implements BayesianRegression<java.lang.Double,MultivariateGaussian>
Modifier and Type | Class and Description |
---|---|
static class |
BayesianLinearRegression.IncrementalEstimator
Incremental estimator for BayesianLinearRegression
|
class |
BayesianLinearRegression.PredictiveDistribution
Creates the predictive distribution for the likelihood of a given point.
|
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_OUTPUT_VARIANCE
Default output variance, 1.0.
|
static double |
DEFAULT_WEIGHT_VARIANCE
Default weight variance, 1.0.
|
protected double |
outputVariance
Assumed known variance of the outputs (measurements),
must be greater than zero.
|
protected MultivariateGaussian |
weightPrior
Prior distribution of the weights, typically a zero-mean,
diagonal-variance distribution.
|
Constructor and Description |
---|
BayesianLinearRegression(double outputVariance,
MultivariateGaussian weightPrior)
Creates a new instance of BayesianLinearRegression
|
BayesianLinearRegression(int dimensionality)
Creates a new instance of BayesianLinearRegression
|
Modifier and Type | Method and Description |
---|---|
BayesianLinearRegression |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
UnivariateGaussian |
createConditionalDistribution(Vectorizable input,
Vector weights)
Creates the distribution from which the outputs are generated, given
the weights and the input to consider.
|
BayesianLinearRegression.PredictiveDistribution |
createPredictiveDistribution(MultivariateGaussian posterior)
Creates the predictive distribution of outputs given the weight posterior
|
double |
getOutputVariance()
Getter for outputVariance
|
MultivariateGaussian |
getWeightPrior()
Getter for weightPrior
|
MultivariateGaussian.PDF |
learn(java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Double>> data)
The
learn method creates an object of ResultType using
data of type DataType , using some form of "learning" algorithm. |
void |
setOutputVariance(double outputVariance)
Setter for outputVariance
|
void |
setWeightPrior(MultivariateGaussian weightPrior)
Setter for weightPrior
|
public static final double DEFAULT_OUTPUT_VARIANCE
public static final double DEFAULT_WEIGHT_VARIANCE
protected double outputVariance
protected MultivariateGaussian weightPrior
public BayesianLinearRegression(int dimensionality)
dimensionality
- Sets up the parameters (except featureMap) for the given dimensionality
of objects in feature space.public BayesianLinearRegression(double outputVariance, MultivariateGaussian weightPrior)
outputVariance
- Assumed known variance of the outputs (measurements),
must be greater than zero.weightPrior
- Prior distribution of the weights, typically a zero-mean,
diagonal-variance distribution.public BayesianLinearRegression clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public MultivariateGaussian.PDF learn(java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Double>> data)
BatchLearner
learn
method creates an object of ResultType
using
data of type DataType
, using some form of "learning" algorithm.learn
in interface BatchLearner<java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Double>>,MultivariateGaussian>
data
- The data that the learning algorithm will use to create an
object of ResultType
.public UnivariateGaussian createConditionalDistribution(Vectorizable input, Vector weights)
createConditionalDistribution
in interface BayesianRegression<java.lang.Double,MultivariateGaussian>
input
- Input to condition onweights
- Weights that determine the meanpublic MultivariateGaussian getWeightPrior()
public void setWeightPrior(MultivariateGaussian weightPrior)
weightPrior
- Prior distribution of the weights, typically a zero-mean,
diagonal-variance distribution.public double getOutputVariance()
public void setOutputVariance(double outputVariance)
outputVariance
- Assumed known variance of the outputs (measurements),
must be greater than zero.public BayesianLinearRegression.PredictiveDistribution createPredictiveDistribution(MultivariateGaussian posterior)
createPredictiveDistribution
in interface BayesianRegression<java.lang.Double,MultivariateGaussian>
posterior
- Posterior distribution of weights.