|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.mine.bayes.naivebayes.datamodel.AttributeModel
org.knime.base.node.mine.bayes.naivebayes.datamodel.NumericalAttributeModel
class NumericalAttributeModel
This AttributeModel
implementation calculates the probability for
numerical attributes by assuming a Gaussian distribution of the data.
Field Summary | |
---|---|
(package private) static String |
MODEL_TYPE
The unique type of this model used for saving/loading. |
(package private) static double |
PROB_FACT_DEN
Pre calculated factor used to calculate the standard deviation. |
Fields inherited from class org.knime.base.node.mine.bayes.naivebayes.datamodel.AttributeModel |
---|
MODEL_CONTAINS_NO_CLASS_VALUES, MODEL_CONTAINS_NO_RECORDS |
Constructor Summary | |
---|---|
NumericalAttributeModel(String attributeName,
boolean skipMissingVals)
Constructor for class NumericalRowValue. |
|
NumericalAttributeModel(String attributeName,
boolean skipMissingVals,
int noOfMissingVals,
Config config)
Constructor for class NumericalAttributeModel. |
Method Summary | |
---|---|
(package private) void |
addValueInternal(String classValue,
DataCell attrValue)
Adds the given value to the concrete implementation. |
(package private) Collection<String> |
getClassValues()
|
(package private) Class<? extends DataValue> |
getCompatibleType()
|
(package private) String |
getHTMLView(int totalNoOfRecs)
|
(package private) String |
getHTMLViewHeadLine()
|
(package private) Integer |
getNoOfRecs4ClassValue(String classValue)
|
(package private) double |
getProbabilityInternal(String classValue,
DataCell attributeValue,
double laplaceCorrector)
This should also handle missing values. |
(package private) String |
getType()
|
(package private) void |
saveModelInternal(Config config)
|
String |
toString()
|
(package private) void |
validate()
Called after all training rows where added to validate the model. |
Methods inherited from class org.knime.base.node.mine.bayes.naivebayes.datamodel.AttributeModel |
---|
addValue, compareTo, createHTMLTable, createTableHeader, getAttributeName, getInvalidCause, getMissingValueHeader, getNoOfMissingVals, getProbability, loadModel, saveModel, setInvalidCause, sortCollection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final double PROB_FACT_DEN
static final String MODEL_TYPE
Constructor Detail |
---|
NumericalAttributeModel(String attributeName, boolean skipMissingVals)
attributeName
- the row captionskipMissingVals
- set to true
if the missing values
should be skipped during learning and predictionNumericalAttributeModel(String attributeName, boolean skipMissingVals, int noOfMissingVals, Config config) throws InvalidSettingsException
attributeName
- the name of the attributeskipMissingVals
- set to true
if the missing values
should be skipped during learning and predictionnoOfMissingVals
- the number of missing valuesconfig
- the Config
object to read from
InvalidSettingsException
- if the settings are invalidMethod Detail |
---|
void saveModelInternal(Config config)
saveModelInternal
in class AttributeModel
config
- the config object to save tovoid addValueInternal(String classValue, DataCell attrValue)
addValueInternal
in class AttributeModel
classValue
- the class valueattrValue
- the attribute value. Could be a missing value.void validate() throws InvalidSettingsException
validate
in class AttributeModel
InvalidSettingsException
- if the model isn't validClass<? extends DataValue> getCompatibleType()
getCompatibleType
in class AttributeModel
DataValue
class to check if the rows
are compatibleCollection<String> getClassValues()
getClassValues
in class AttributeModel
Integer getNoOfRecs4ClassValue(String classValue)
getNoOfRecs4ClassValue
in class AttributeModel
classValue
- the class value we want the number of records for
null
if only missing values where in this row for the
given class value or the class value wasn't found at alldouble getProbabilityInternal(String classValue, DataCell attributeValue, double laplaceCorrector)
getProbabilityInternal
in class AttributeModel
classValue
- the class value to calculate the probability forattributeValue
- the attribute value to calculate the
probability for. Could be a missing value.laplaceCorrector
- the Laplace corrector to use. A value greater 0
overcomes zero counts.
String getHTMLViewHeadLine()
getHTMLViewHeadLine
in class AttributeModel
String getType()
getType
in class AttributeModel
String getHTMLView(int totalNoOfRecs)
getHTMLView
in class AttributeModel
totalNoOfRecs
- the total number of records in the training data
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |