|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.NodeModel
org.knime.base.node.mine.scorer.accuracy.AccuracyScorerNodeModel
public class AccuracyScorerNodeModel
The hilite scorer node's model. The scoring is performed on two given columns set by the dialog. The row keys are stored for later hiliting purpose.
AccuracyScorerNodeFactory
Field Summary | |
---|---|
(package private) static String |
FIRST_COMP_ID
Identifier in model spec to address first column name to compare. |
(package private) static int |
INPORT
The input port 0. |
protected static NodeLogger |
LOGGER
The node logger for this class. |
(package private) static int |
OUTPORT_0
The output port 0: confusion matrix. |
(package private) static int |
OUTPORT_1
The output port 1: accuracy measures. |
(package private) static String |
SECOND_COMP_ID
Identifier in model spec to address first second name to compare. |
Fields inherited from interface org.knime.base.node.viz.plotter.DataProvider |
---|
END, START |
Constructor Summary | |
---|---|
AccuracyScorerNodeModel()
Inits a new ScorerNodeModel with one in- and one output. |
Method Summary | |
---|---|
protected DataTableSpec[] |
configure(DataTableSpec[] inSpecs)
This function is called whenever the derived model should re-configure its output DataTableSpecs. |
(package private) boolean |
containsConfusionMatrixKeys(int x,
int y,
Set<RowKey> keys)
Checks if the specified confusion matrix cell contains at least one of the given keys. |
protected DataCell[] |
determineColValues(BufferedDataTable in,
int index1,
int index2,
ExecutionMonitor exec)
Called to determine all possible values in the respective columns. |
protected BufferedDataTable[] |
execute(BufferedDataTable[] data,
ExecutionContext exec)
Starts the scoring in the scorer. |
protected static int |
findValue(DataCell[] source,
DataCell key)
Finds the position where key is located in source. |
double |
getAccuracy()
|
(package private) Point[] |
getCompleteHilitedCells(Set<RowKey> keys)
Returns all cells of the confusion matrix (as Points) if the given key set contains all keys of that cell. |
int |
getCorrectCount()
Get the correct classification count, i.e. |
DataArray |
getDataArray(int index)
Provides the data that should be visualized. |
double |
getError()
|
int |
getFalseCount()
Get the misclassification count, i.e. |
String |
getFirstCompareColumn()
Returns the first column to compare. |
int |
getNrRows()
Get the number of rows in the input table. |
protected HiLiteHandler |
getOutHiLiteHandler(int outIndex)
Returns the HiLiteHandler for the given output index. |
(package private) BitSet |
getRocCurve()
Returns a bit set with data for the ROC curve. |
(package private) int[][] |
getScorerCount()
|
String |
getSecondCompareColumn()
Returns the second column to compare. |
(package private) Set<RowKey> |
getSelectedSet(Point[] cells)
Determines the row keys (as DataCells) which belong to the given cell of the confusion matrix. |
(package private) String[] |
getValues()
|
protected void |
loadInternals(File internDir,
ExecutionMonitor exec)
Load internals into the derived NodeModel . |
protected void |
loadValidatedSettingsFrom(NodeSettingsRO settings)
Sets new settings from the passed object in the model. |
protected void |
reset()
Resets all internal data. |
protected void |
saveInternals(File internDir,
ExecutionMonitor exec)
Save internals of the derived NodeModel . |
protected void |
saveSettingsTo(NodeSettingsWO settings)
Adds to the given NodeSettings the model specific
settings. |
(package private) void |
setCompareColumn(String first,
String second)
Sets the columns that will be compared during execution. |
protected void |
validateSettings(NodeSettingsRO settings)
Validates the settings in the passed NodeSettings object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final NodeLogger LOGGER
static final String FIRST_COMP_ID
static final String SECOND_COMP_ID
static final int INPORT
static final int OUTPORT_0
static final int OUTPORT_1
Constructor Detail |
---|
AccuracyScorerNodeModel()
ScorerNodeModel
with one in- and one output.
Method Detail |
---|
protected BufferedDataTable[] execute(BufferedDataTable[] data, ExecutionContext exec) throws CanceledExecutionException
execute
in class NodeModel
data
- the input data of length oneexec
- the execution monitor
CanceledExecutionException
- if user canceled executionNodeModel.execute(BufferedDataTable[],ExecutionContext)
protected void reset()
reset
in class NodeModel
void setCompareColumn(String first, String second)
first
- the first columnsecond
- the second column
NullPointerException
- if one of the parameters is null
protected DataTableSpec[] configure(DataTableSpec[] inSpecs) throws InvalidSettingsException
The passed DataTableSpec elements are never null
but can
be empty. The model may return null
data table spec(s) for
the outputs. But still, the model may be in an executable state. Note,
after the model has been executed this function will not be called
anymore, as the output DataTableSpecs are then being pulled from the
output DataTables. A derived NodeModel
that cannot provide
any DataTableSpecs at its outputs before execution (because the table
structure is unknown at this point) can return an array
containing just null
elements.
Implementation note: This method is called from the
NodeModel.configure(PortObjectSpec[])
method unless that method is
overwritten.
configure
in class NodeModel
inSpecs
- An array of DataTableSpecs (as many as this model has
inputs). Do NOT modify the contents of this array. None of the
DataTableSpecs in the array can be null
but
empty. If the predecessor node is not yet connected, or
doesn't provide a DataTableSpecs at its output port.
null
DataTableSpec elements are changed to empty
once.
InvalidSettingsException
- if the #configure()
failed, that is, the settings are inconsistent with given
DataTableSpec elements.public int getCorrectCount()
public int getFalseCount()
public int getNrRows()
getFalseCount()
+ getCorrectCount()
, though it
must be at least the sum of both. The difference is the number of rows
containing a missing value in either of the target columns.
public double getError()
public double getAccuracy()
protected void loadValidatedSettingsFrom(NodeSettingsRO settings) throws InvalidSettingsException
#validateSettings(NodeSettings)
method. The model must set
its internal configuration according to the settings object passed.
loadValidatedSettingsFrom
in class NodeModel
settings
- The settings to read.
InvalidSettingsException
- If a property is not available.NodeModel.saveSettingsTo(NodeSettingsWO)
,
NodeModel.validateSettings(NodeSettingsRO)
protected void saveSettingsTo(NodeSettingsWO settings)
NodeSettings
the model specific
settings. The settings don't need to be complete or consistent. If, right
after startup, no valid settings are available this method can write
either nothing or invalid settings.
Method is called by the Node
if the current settings need
to be saved or transfered to the node's dialog.
saveSettingsTo
in class NodeModel
settings
- The object to write settings into.NodeModel.loadValidatedSettingsFrom(NodeSettingsRO)
,
NodeModel.validateSettings(NodeSettingsRO)
protected void validateSettings(NodeSettingsRO settings) throws InvalidSettingsException
NodeSettings
object.
The specified settings should be checked for completeness and
consistency. It must be possible to load a settings object validated
here without any exception in the
#loadValidatedSettings(NodeSettings)
method. The method
must not change the current settings in the model - it is supposed to
just check them. If some settings are missing, invalid, inconsistent, or
just not right throw an exception with a message useful to the user.
validateSettings
in class NodeModel
settings
- The settings to validate.
InvalidSettingsException
- If the validation of the settings
failed.NodeModel.saveSettingsTo(NodeSettingsWO)
,
NodeModel.loadValidatedSettingsFrom(NodeSettingsRO)
Set<RowKey> getSelectedSet(Point[] cells)
cells
- the cells of the confusion matrix for which the keys should be
returned
protected DataCell[] determineColValues(BufferedDataTable in, int index1, int index2, ExecutionMonitor exec) throws CanceledExecutionException
in
- the input tableindex1
- the first column to compareindex2
- the second column to compareexec
- object to check with if user canceled
CanceledExecutionException
- if user canceled operationprotected static int findValue(DataCell[] source, DataCell key)
source
- the source arraykey
- the key to find
boolean containsConfusionMatrixKeys(int x, int y, Set<RowKey> keys)
x
- the x value to specify the matrix celly
- the y value to specify the matrix cellkeys
- the keys to check
Point[] getCompleteHilitedCells(Set<RowKey> keys)
keys
- the keys to check for
protected void loadInternals(File internDir, ExecutionMonitor exec) throws IOException
NodeModel
. This method is
only called if the Node
was executed. Read all your
internal structures from the given file directory to create your internal
data structure which is necessary to provide all node functionalities
after the workflow is loaded, e.g. view content and/or hilite mapping.
loadInternals
in class NodeModel
internDir
- The directory to read from.exec
- Used to report progress and to cancel the load process.
IOException
- If an error occurs during reading from this dir.NodeModel.saveInternals(File,ExecutionMonitor)
protected void saveInternals(File internDir, ExecutionMonitor exec) throws IOException
NodeModel
. This method is
only called if the Node
is executed. Write all your
internal structures into the given file directory which are necessary to
recreate this model when the workflow is loaded, e.g. view content and/or
hilite mapping.
saveInternals
in class NodeModel
internDir
- The directory to write into.exec
- Used to report progress and to cancel the save process.
IOException
- If an error occurs during writing to this dir.NodeModel.loadInternals(File,ExecutionMonitor)
int[][] getScorerCount()
BitSet getRocCurve()
BitSet.length()
- 1, i.e. the last
set bit must be ignored, it is just the end marker.
String[] getValues()
public DataArray getDataArray(int index)
DataArray
should be returned.
getDataArray
in interface DataProvider
index
- if the data of more than one data table should be
visualized.
public String getFirstCompareColumn()
public String getSecondCompareColumn()
protected HiLiteHandler getOutHiLiteHandler(int outIndex)
HiLiteHandler
for the given output index. This
default implementation simply passes on the handler of input port 0 or
generates a new one if this node has no inputs.
getOutHiLiteHandler
in class NodeModel
outIndex
- The output index.
HiLiteHandler
for the given output port.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |