@Deprecated public class NaiveBayesModel extends Object
AttributeModel
. Which provides the
probability information for each class value.Modifier and Type | Field and Description |
---|---|
static NumberFormat |
HTML_VALUE_FORMATER
Deprecated.
The
NumberFormater to use in the html views. |
Constructor and Description |
---|
NaiveBayesModel(BufferedDataTable data,
String classColName,
ExecutionContext exec,
int maxNoOfNominalVals,
boolean skipMissingVals)
Deprecated.
Constructor which iterates through the
DataTable to
calculate the needed Bayes variables. |
NaiveBayesModel(ConfigRO predParams)
Deprecated.
Constructor for class NaiveBayesModel.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
check4MissingCols(DataTableSpec tableSpec)
Deprecated.
Checks if the model contains attributes which are not present in the
given table specification which could influence the prediction result.
|
List<String> |
check4UnknownCols(DataTableSpec tableSpec)
Deprecated.
Checks if the given table specification contains columns which are not
covered by the learned model.
|
boolean |
containsSkippedAttributes()
Deprecated.
|
AttributeModel |
getAttributeModel(String attributeName)
Deprecated.
|
Collection<AttributeModel> |
getAttributeModels()
Deprecated.
|
List<String> |
getAttributesWithMissingVals()
Deprecated.
|
DataType |
getClassColumnDataType()
Deprecated.
|
String |
getClassColumnName()
Deprecated.
|
double |
getClassPriorProbability(String classValue)
Deprecated.
|
double[] |
getClassProbabilities(String[] attributeNames,
DataRow row,
List<String> classValues,
boolean normalize,
double laplaceCorrector)
Deprecated.
|
String |
getHTMLView()
Deprecated.
|
String |
getMostLikelyClass(String[] attrNames,
DataRow row,
double laplaceCorrector)
Deprecated.
Returns the name of the class with the highest probability for the
given row.
|
int |
getNoOfRecs()
Deprecated.
|
List<AttributeModel> |
getSkippedAttributes()
Deprecated.
|
String |
getSkippedAttributesString(int max2Show)
Deprecated.
|
List<String> |
getSortedClassValues()
Deprecated.
|
String |
getSummary()
Deprecated.
|
void |
savePredictorParams(ConfigWO predParams)
Deprecated.
|
String |
toString()
Deprecated.
|
void |
updateModel(DataRow row,
DataTableSpec tableSpec,
int classColIdx)
Deprecated.
Updates the current
NaiveBayesModel with the values from the
given DataRow . |
public static final NumberFormat HTML_VALUE_FORMATER
NumberFormater
to use in the html views.public NaiveBayesModel(BufferedDataTable data, String classColName, ExecutionContext exec, int maxNoOfNominalVals, boolean skipMissingVals) throws CanceledExecutionException, InvalidSettingsException
DataTable
to
calculate the needed Bayes variables.data
- The BufferedDataTable
with the dataclassColName
- The name of the column with the classexec
- the ExecutionContext
to provide progress
information and check for cancelmaxNoOfNominalVals
- the maximum number of supported unique
nominal attribute valuesskipMissingVals
- set to true
if the missing values
should be skipped during learning and predictionCanceledExecutionException
- if the user presses the cancel
button during model creationInvalidSettingsException
- if the input data contains no rowspublic NaiveBayesModel(ConfigRO predParams) throws InvalidSettingsException
predParams
- the ModelContentRO
to read fromInvalidSettingsException
- if a mandatory key is not availablepublic void updateModel(DataRow row, DataTableSpec tableSpec, int classColIdx) throws InvalidSettingsException
NaiveBayesModel
with the values from the
given DataRow
.row
- DataRow with values for updatetableSpec
- underlying DataTableSpecclassColIdx
- the index of the class columnInvalidSettingsException
- if missing values occur in class column
or an attribute has too many values.public void savePredictorParams(ConfigWO predParams)
predParams
- to save the modelpublic boolean containsSkippedAttributes()
true
if the model contains skipped attributespublic List<AttributeModel> getSkippedAttributes()
public String getSkippedAttributesString(int max2Show)
max2Show
- the maximum number of missing attributes to displaypublic List<String> getSortedClassValues()
public double getClassPriorProbability(String classValue)
classValue
- the value of the class we want the probability forpublic double[] getClassProbabilities(String[] attributeNames, DataRow row, List<String> classValues, boolean normalize, double laplaceCorrector)
attributeNames
- the name of the attributes we want the normalized
probability values forrow
- the row with the values in the same order like the
attribute namesclassValues
- the class values to calculate the probability fornormalize
- set to true
if the probability values
should be normalizedlaplaceCorrector
- the Laplace corrector to use. A value greater 0
tolerates zero counts (i.e. does not produce 0 probabilities)public int getNoOfRecs()
public String getClassColumnName()
public DataType getClassColumnDataType()
DataType
of the column with the class attribute.public String getSummary()
public String getHTMLView()
public List<String> getAttributesWithMissingVals()
public AttributeModel getAttributeModel(String attributeName)
attributeName
- the name of the attributenull
if the attribute is not knownpublic Collection<AttributeModel> getAttributeModels()
Collection
with all
AttributeModel
objectspublic String getMostLikelyClass(String[] attrNames, DataRow row, double laplaceCorrector)
attrNames
- the attribute names in the same order
they appear in the given data rowrow
- the row with the attributes in the same order like in the
training data tablelaplaceCorrector
- the Laplace corrector to use. A value greater 0
overcomes zero countspublic List<String> check4UnknownCols(DataTableSpec tableSpec)
tableSpec
- the DataTableSpec
to check for unknown
columnsList
public List<String> check4MissingCols(DataTableSpec tableSpec)
tableSpec
- the DataTableSpec
to check for missing
columnsList
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.