public class ClassConditionalProbabilities extends SimpleBatchFilter implements WeightedAttributesHandler, WeightedInstancesHandler
-N Don't apply this transformation to numeric attributes
-C Don't apply this transformation to nominal attributes
-min-values <integer> Transform nominal attributes with at least this many values. -1 means always transform.
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
-spread-attribute-weight When generating binary attributes, spread weight of old attribute across new attributes. Do not give each new attribute the old weight.
| Modifier and Type | Field and Description |
|---|---|
protected NaiveBayes |
m_estimator
The Naive Bayes classifier to use for class conditional estimation
|
protected java.util.Map<java.lang.String,Estimator[]> |
m_estimatorLookup
A lookup of estimators from Naive Bayes
|
protected boolean |
m_excludeNominalAttributes
True if nominal attributes are to be excluded from the transformation
|
protected boolean |
m_excludeNumericAttributes
True if numeric attributes are to be excluded from the transformation
|
protected int |
m_nominalConversionThreshold
Don't convert nominal attributes with fewer than this number of values. -1
means always convert
|
protected Remove |
m_remove
Remove filter to use for creating a set of untouched attributes
|
protected boolean |
m_SpreadAttributeWeight
Whether to spread attribute weight when creating binary attributes
|
protected Instances |
m_unchanged
The attributes from the original data that are untouched by this
transformation
|
m_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
ClassConditionalProbabilities() |
| Modifier and Type | Method and Description |
|---|---|
protected Instance |
convertInstance(Instance current)
Convert an input instance
|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based on the input format and returns this.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
NaiveBayes |
getEstimator()
Get the naive Bayes estimator in use
|
boolean |
getExcludeNominalAttributes()
Get whether nominal attributes are to be excluded from the transformation
|
boolean |
getExcludeNumericAttributes()
Get whether numeric attributes are being excluded from the transformation
|
int |
getNominalConversionThreshold()
Get the minimum number of values a nominal attribute must have in order to
be transformed. -1 indicates no minimum (i.e. transform all nominal
attributes)
|
Remove |
getRemoveFilter()
Get the remove filter in use
|
java.lang.String |
getRevision()
Returns the revision string.
|
boolean |
getSpreadAttributeWeight()
If true, when generating attributes, spread weight of old
attribute across new attributes.
|
java.lang.String |
globalInfo()
Global help info for this method
|
boolean |
input(Instance inst)
Input an instance for filtering.
|
static void |
main(java.lang.String[] args)
Main method for testing this class
|
protected Instances |
process(Instances instances)
Processes the given data (may change the provided dataset) and returns the
modified version.
|
void |
setEstimator(NaiveBayes nb)
Set the naive Bayes estimator to use
|
void |
setExcludeNominalAttributes(boolean e)
Set whether nominal attributes are to be excluded from the transformation
|
void |
setExcludeNumericAttributes(boolean e)
Set whether numeric attributes are being excluded from the transformation
|
void |
setNominalConversionThreshold(int n)
Set the minimum number of values a nominal attribute must have in order to
be transformed. -1 indicates no minimum (i.e. transform all nominal
attributes)
|
void |
setRemoveFilter(Remove r) |
void |
setSpreadAttributeWeight(boolean p)
If true, when generating attributes, spread weight of old
attribute across new attributes.
|
allowAccessToFullInputFormat, batchFinished, hasImmediateOutputFormatreset, setInputFormatbatchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOptions, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, listOptions, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOptions, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapperprotected boolean m_excludeNumericAttributes
protected boolean m_excludeNominalAttributes
protected int m_nominalConversionThreshold
protected NaiveBayes m_estimator
protected Remove m_remove
protected Instances m_unchanged
protected java.util.Map<java.lang.String,Estimator[]> m_estimatorLookup
protected boolean m_SpreadAttributeWeight
public static void main(java.lang.String[] args)
args - argspublic java.lang.String globalInfo()
globalInfo in class SimpleFilter@OptionMetadata(displayName="Exclude numeric attributes", description="Don\'t apply this transformation to numeric attributes", commandLineParamName="N", commandLineParamIsFlag=true, commandLineParamSynopsis="-N", displayOrder=1) public boolean getExcludeNumericAttributes()
public void setExcludeNumericAttributes(boolean e)
e - true if numeric attributes are to be excluded@OptionMetadata(displayName="Exclude nominal attributes", description="Don\'t apply this transformation to nominal attributes", commandLineParamName="C", commandLineParamIsFlag=true, commandLineParamSynopsis="-C", displayOrder=2) public boolean getExcludeNominalAttributes()
public void setExcludeNominalAttributes(boolean e)
e - true if nominal attributes are to be excluded@OptionMetadata(displayName="Spread weight across new attributes", description="When generating attributes, spread weight of old\nattribute across new attributes. Do not give each new attribute the old weight.", commandLineParamName="spread-attribute-weight", commandLineParamIsFlag=true, commandLineParamSynopsis="-spread-attribute-weight", displayOrder=3) public void setSpreadAttributeWeight(boolean p)
p - whether weight is spreadpublic boolean getSpreadAttributeWeight()
@OptionMetadata(displayName="Nominal conversion threshold", description="Transform nominal attributes with at least this many values.\n-1 means always transform.", commandLineParamName="min-values", commandLineParamSynopsis="-min-values <integer>", displayOrder=3) public int getNominalConversionThreshold()
public void setNominalConversionThreshold(int n)
n - the number of values of a nominal attribute after which the
transformation appliesprotected Instances determineOutputFormat(Instances inputFormat) throws java.lang.Exception
SimpleFilterdetermineOutputFormat in class SimpleFilterinputFormat - the input format to base the output format onjava.lang.Exception - in case the determination goes wrongSimpleFilter.hasImmediateOutputFormat(),
Filter.batchFinished()protected Instances process(Instances instances) throws java.lang.Exception
SimpleFilterprocess in class SimpleFilterinstances - the data to processjava.lang.Exception - in case the processing goes wrongFilter.batchFinished()protected Instance convertInstance(Instance current) throws java.lang.Exception
current - the input instance to convertjava.lang.Exception - if a problem occurspublic boolean input(Instance inst) throws java.lang.Exception
SimpleBatchFilterinput in class SimpleBatchFilterinst - the input instancejava.lang.IllegalStateException - if no input structure has been definedjava.lang.Exception - if something goes wrongSimpleBatchFilter.batchFinished()public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filter@ProgrammaticProperty public NaiveBayes getEstimator()
public void setEstimator(NaiveBayes nb)
nb - the naive Bayes estimator to use@ProgrammaticProperty public Remove getRemoveFilter()
public void setRemoveFilter(Remove r)