public class Discretize extends Expression
Modifier and Type | Class and Description |
---|---|
protected class |
Discretize.DiscretizeBin
Inner class to encapsulate DiscretizeBin elements
|
Modifier and Type | Field and Description |
---|---|
protected ArrayList<Discretize.DiscretizeBin> |
m_bins
The bins for this discretization
|
protected String |
m_defaultValue
The default value (if defined)
|
protected boolean |
m_defaultValueDefined
True if a default value has been specified
|
protected int |
m_fieldIndex
The index of the field
|
protected String |
m_fieldName
The name of the field to be discretized
|
protected boolean |
m_mapMissingDefined
True if a replacement for missing values has been specified
|
protected String |
m_mapMissingTo
The value of the missing value replacement (if defined)
|
protected Attribute |
m_outputDef
The output structure of this discretization
|
m_fieldDefs, m_opType
Constructor and Description |
---|
Discretize(Element discretize,
FieldMetaInfo.Optype opType,
ArrayList<Attribute> fieldDefs)
Constructs a Discretize Expression
|
Modifier and Type | Method and Description |
---|---|
protected Attribute |
getOutputDef()
Return the structure of the result of applying this Expression
as an Attribute.
|
double |
getResult(double[] incoming)
Get the result of evaluating the expression.
|
String |
getResultCategorical(double[] incoming)
Gets the result of evaluating the expression when the
optype is categorical or ordinal as the actual String
value.
|
void |
setFieldDefs(ArrayList<Attribute> fieldDefs)
Set the field definitions for this Expression to use
|
String |
toString(String pad) |
getExpression, getExpression, getFieldDef, getFieldDefIndex, getOptype, getResultContinuous, toString
protected String m_fieldName
protected int m_fieldIndex
protected boolean m_mapMissingDefined
protected String m_mapMissingTo
protected boolean m_defaultValueDefined
protected String m_defaultValue
protected ArrayList<Discretize.DiscretizeBin> m_bins
protected Attribute m_outputDef
public Discretize(Element discretize, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs) throws Exception
discretize
- the Element containing the discretize expressionopType
- the optype of this Discretize ExpressionfieldDefs
- the structure of the incoming fieldsException
- if the optype is not categorical/ordinal or if there
is a problem parsing this elementpublic void setFieldDefs(ArrayList<Attribute> fieldDefs) throws Exception
setFieldDefs
in class Expression
fieldDefs
- the field definitions to useException
- if there is a problem setting the field definitionsprotected Attribute getOutputDef()
getOutputDef
in class Expression
public double getResult(double[] incoming) throws Exception
getResult
in class Expression
incoming
- the incoming parameter valuesException
- if there is a problem computing the resultpublic String getResultCategorical(double[] incoming) throws Exception
getResultCategorical
in class Expression
incoming
- the incoming parameter valuesException
- if the optype is continuouspublic String toString(String pad)
toString
in class Expression
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.