com.rapidminer.operator.learner.meta
Class BayBoostModel

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.operator.AbstractModel
              extended by com.rapidminer.operator.learner.PredictionModel
                  extended by com.rapidminer.operator.learner.meta.BayBoostModel
All Implemented Interfaces:
IOObject, Model, ResultObject, Saveable, Readable, Reportable, LoggingHandler, java.io.Serializable

public class BayBoostModel
extends PredictionModel

A model for the Bayesian Boosting algorithm by Martin Scholz.

Author:
Martin Scholz
See Also:
Serialized Form

Constructor Summary
BayBoostModel(ExampleSet exampleSet, java.util.List<BayBoostBaseModelInfo> modelInfos, double[] priors)
           
 
Method Summary
static boolean adjustIntermediateProducts(double[] products, double[] liftFactors)
          Helper method to adjust the intermediate products during model application.
 BayBoostBaseModelInfo getBayBoostBaseModelInfo(int index)
           
 ContingencyMatrix getContingencyMatrix(int index)
          Getter method for a specific confusion matrix
 Model getModel(int index)
          Getter method for embedded models
 double[] getModelWeights()
          This method is only supported for boolean target attributes.
 int getNumberOfModels()
           
 double[] getPriors()
          Getter for the prior array
 java.awt.Component getVisualizationComponent(IOContainer container)
          Returns a editor pane that displays the ResultObjectAdapter.toResultString() result encoded as html.
 ExampleSet performPrediction(ExampleSet exampleSet, Attribute predictedLabel)
          Iterates over all models and returns the class with maximum likelihood.
 void setMaxModelNumber(int numModels)
          Using this setter with a positive value makes the model discard all but the specified number of base models.
 void setParameter(java.lang.String name, java.lang.String value)
          Setting the parameter MAX_MODEL_NUMBER allows to discard all but the first n models for specified n.
 java.lang.String toString()
           
 
Methods inherited from class com.rapidminer.operator.learner.PredictionModel
apply, checkCompatibility, copyPredictedLabel, createPredictedLabel, getLabel, removePredictedLabel, removePredictedLabel
 
Methods inherited from class com.rapidminer.operator.AbstractModel
getExtension, getFileDescription, getName, getResultIcon, getTrainingHeader, isUpdatable, setParameter, updateModel
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, isSavable, log, logError, logNote, logWarning, save, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
copy, getLog, getSource, initWriting, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.ResultObject
getActions, toResultString
 
Methods inherited from interface com.rapidminer.operator.IOObject
copy, getLog, getSource, setLoggingHandler, setSource, write
 
Methods inherited from interface com.rapidminer.operator.Saveable
isSavable, save
 

Constructor Detail

BayBoostModel

public BayBoostModel(ExampleSet exampleSet,
                     java.util.List<BayBoostBaseModelInfo> modelInfos,
                     double[] priors)
Parameters:
exampleSet - the example set used for training
modelInfos - a List of Object[2] arrays, each entry holding a model and a double[][] array containing weights for all prediction/label combinations.
priors - an array of the prior probabilities of labels
Method Detail

getBayBoostBaseModelInfo

public BayBoostBaseModelInfo getBayBoostBaseModelInfo(int index)

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
                  throws OperatorException
Setting the parameter MAX_MODEL_NUMBER allows to discard all but the first n models for specified n. CONV_TO_CRISP allows to set another threshold than 0.5 for boolean prediction problems.

Throws:
OperatorException

setMaxModelNumber

public void setMaxModelNumber(int numModels)
Using this setter with a positive value makes the model discard all but the specified number of base models. A value of -1 turns off this option.


getVisualizationComponent

public java.awt.Component getVisualizationComponent(IOContainer container)
Description copied from class: ResultObjectAdapter
Returns a editor pane that displays the ResultObjectAdapter.toResultString() result encoded as html. Please note that the returned pane is already enclosed by a scroll pane. If you overwrite this method you should again ensure that the returned component is scrollable. The given container is totally ignored.

Specified by:
getVisualizationComponent in interface ResultObject
Overrides:
getVisualizationComponent in class ResultObjectAdapter

toString

public java.lang.String toString()
Specified by:
toString in interface Readable
Overrides:
toString in class PredictionModel
Returns:
a String representation of this boosting model.

getNumberOfModels

public int getNumberOfModels()
Returns:
the number of embedded models

getPriors

public double[] getPriors()
Getter for the prior array


getModel

public Model getModel(int index)
Getter method for embedded models

Parameters:
index - the number of a model part of this boost model
Returns:
binary or nominal decision model for the given classification index.

getContingencyMatrix

public ContingencyMatrix getContingencyMatrix(int index)
Getter method for a specific confusion matrix

Parameters:
index - the number of the model for which to read the confusion matrix
Returns:
a ConfusionMatrix object

performPrediction

public ExampleSet performPrediction(ExampleSet exampleSet,
                                    Attribute predictedLabel)
                             throws OperatorException
Iterates over all models and returns the class with maximum likelihood.

Specified by:
performPrediction in class PredictionModel
Parameters:
exampleSet - the set of examples to be classified
predictedLabel - the label that finally holds the predictions
Throws:
OperatorException

adjustIntermediateProducts

public static boolean adjustIntermediateProducts(double[] products,
                                                 double[] liftFactors)
Helper method to adjust the intermediate products during model application.

Parameters:
products - the intermediate products, these values are changed by the method
liftFactors - the factor vector that applies for the prediction for the current example
Returns:
true iff the class is deterministically known after applying this method

getModelWeights

public double[] getModelWeights()
                         throws OperatorException
This method is only supported for boolean target attributes. It computes a flattened version of model weights. In constrast to the original version the final predictions are additive logarithms of the lift ratios, additively rescaled so that the prediction false of model i produces -i if true produces weight i. This means that only one weight per model is required. The first component of the returned array is the part that is independent of any prediction, the i-th component is the weight of model i. The (log-)linear model predicts depending on whether the linear combination of predictions (either -1 or 1) is greater than 0 or not. Infinite values are problematic, so a min/max value is used.

Returns:
the flattened weights of all models
Throws:
OperatorException


Copyright © 2001-2009 by Rapid-I