lio.probdistributions.bitchain
Class MarginalProbabilityVector

java.lang.Object
  extended by lio.probdistributions.bitchain.BinaryProbDistribution
      extended by lio.probdistributions.bitchain.MarginalProbabilityVector
All Implemented Interfaces:
LiOResource, ProbDistribution

public class MarginalProbabilityVector
extends BinaryProbDistribution

This class implements a probability distribution for binary elements assuming that all variables are independents. Thus, it uses a vector to store the marginal probabilities. *


Field Summary
 
Fields inherited from class lio.probdistributions.bitchain.BinaryProbDistribution
data, laplace, size
 
Constructor Summary
MarginalProbabilityVector()
           
 
Method Summary
 void convexCombination(double[] nMarginals, double alpha)
          Updates the probability vector by doing the convex combination with the one recevied a parameter.
 void convexCombination(MarginalProbabilityVector model, double alpha)
          Updates the probability vector by doing the convex combination with the one recevied a parameter.
 LiOResourceDefinition getDefinition()
          Return a LiOResDescription object with the information of each object.
 double[] getMarginals()
          Getter for property proVector.
 void learn(Individual[] individuals)
          Learns a probability distribution from a set of data
static void main(java.lang.String[] args)
          Main method to test the task.
static Individual[] sample(double[] pMarginals, int nIndividuals)
          Samples a population from a vector of marginal probabilities
 Individual[] sample(int nIndividuals)
          Samples some individuals from a probability distribution
 
Methods inherited from class lio.probdistributions.bitchain.BinaryProbDistribution
isLaplace, setLaplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarginalProbabilityVector

public MarginalProbabilityVector()
Method Detail

learn

public void learn(Individual[] individuals)
Learns a probability distribution from a set of data

Parameters:
individuals - Set of individiduals from which de distribution is estimated.

sample

public Individual[] sample(int nIndividuals)
Samples some individuals from a probability distribution

Parameters:
nIndividuals: - Number of individuals that must be sampled.
Returns:
the sampled individuals.

sample

public static Individual[] sample(double[] pMarginals,
                                  int nIndividuals)
Samples a population from a vector of marginal probabilities

Returns:
the specified number of samples.

convexCombination

public void convexCombination(double[] nMarginals,
                              double alpha)
Updates the probability vector by doing the convex combination with the one recevied a parameter.

Parameters:
newProbVector - New probability vector.
alpha - Learning Rate.

convexCombination

public void convexCombination(MarginalProbabilityVector model,
                              double alpha)
Updates the probability vector by doing the convex combination with the one recevied a parameter.

Parameters:
model - Marginal Probabilty Vector used to update the current one.
alpha - Learning Rate.

getDefinition

public LiOResourceDefinition getDefinition()
Return a LiOResDescription object with the information of each object. That object holds the name and all parameters that describe the object

Returns:
A definition of the object.

main

public static void main(java.lang.String[] args)
Main method to test the task.


getMarginals

public double[] getMarginals()
Getter for property proVector.

Returns:
Value of property proVector.