- java.lang.Object
-
- com.pervasive.datarush.operators.AbstractLogicalOperator
-
- com.pervasive.datarush.operators.CompositeOperator
-
- com.pervasive.datarush.analytics.viz.DrawDiagnosticsChart
-
- All Implemented Interfaces:
LogicalOperator
public class DrawDiagnosticsChart extends CompositeOperator
This operator takes the output of one or multiple predictors and uses the confidence values produced by these predictors along with the actual target values ("true class") to produce diagnostic charts.
Supported chart types are ROC, Gains and Lift:
- An ROC (Receiver Operating Characteristics) chart shows how the true positive rate (y-axis) compares to the false positive rate (x-axis) as the confidence threshold decreases.
- A Gains chart (CRC, Cumulative Response Chart) shows how the true positive rate (y-axis) changes as the percentage of the targeted population (x-axis) increases.
- A Lift chart shows how the lift (the ratio between predictor result and baseline; y-axis) changes as the percentage of the targeted population (x-axis) increases.
This operator accepts an arbitrary number of input ports. The first port is always mandatory, the other ports may be optional, dependent on the constructor settings used.
Note: This operator is not parallelizable. In cluster mode, it will execute on a single node.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INPUT_PORT_COUNT
The default number of input ports
-
Constructor Summary
Constructors Constructor Description DrawDiagnosticsChart()
Creates an operator with a default number of (optional) input ports.DrawDiagnosticsChart(int inputPortsCount)
Creates an operator with the given number of mandatory input ports.DrawDiagnosticsChart(int inputPortsCount, boolean optional)
Creates an operator with the given number of input ports.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
compose(CompositionContext context)
Compose the body of this operator.List<String>
getChartNames()
Returns the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).ChartType
getChartType()
Returns the desired chart type (ROC, Gains, Lift).List<String>
getConfidenceFieldNames()
Returns the confidence field names for each input port (null entries for disconnected ports).RecordPort
getInput(int idx)
Returns the input port for the given index.boolean
getInputPortsOptional()
Returns whether the input ports with index > 0 are optional.RecordPort
getOutput()
Returns the output port.String
getOutputPath()
Returns the path of the .png output file (null means no output file will be generated).int
getPortCount()
Returns the number of input ports.int
getResultSize()
Returns the number of results.List<String>
getTargetFieldNames()
Returns the actual target field names for all input ports (null entries for disconnected ports).String
getTargetValue()
Returns the target value ("true class")void
setChartNames(List<String> chartNames)
Sets the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).void
setChartType(ChartType chartType)
Sets the desired chart type (ROC, Gains, Lift).void
setConfidenceFieldNames(List<String> confidenceFieldNames)
Sets the confidence field names for each input port (null entries for disconnected ports).void
setOutputPath(String outputPath)
Sets the path of the .png output file (null means no output file will be generated).void
setResultSize(int resultSize)
Sets the number of results.void
setTargetFieldNames(List<String> targetFieldNames)
Sets the actual target field names for all input ports (null entries for disconnected ports).void
setTargetValue(String targetValue)
Sets the target value ("true class")-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
-
-
-
Field Detail
-
DEFAULT_INPUT_PORT_COUNT
public static final int DEFAULT_INPUT_PORT_COUNT
The default number of input ports- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DrawDiagnosticsChart
public DrawDiagnosticsChart()
Creates an operator with a default number of (optional) input ports.
-
DrawDiagnosticsChart
public DrawDiagnosticsChart(int inputPortsCount)
Creates an operator with the given number of mandatory input ports.- Parameters:
inputPortsCount
- The number of input ports.
-
DrawDiagnosticsChart
public DrawDiagnosticsChart(int inputPortsCount, boolean optional)
Creates an operator with the given number of input ports.- Parameters:
inputPortsCount
- The number of input ports.optional
- If true, all input ports except for the first will be optional.
-
-
Method Detail
-
getInput
public RecordPort getInput(int idx) throws IndexOutOfBoundsException
Returns the input port for the given index.- Parameters:
idx
- The index of the input port. It must be within the configured range.- Returns:
- the input port
- Throws:
IndexOutOfBoundsException
- if the index is outside the configured range.
-
getOutput
public RecordPort getOutput()
Returns the output port.- Returns:
- the output port
-
getPortCount
public int getPortCount()
Returns the number of input ports.- Returns:
- the number of input ports
-
getInputPortsOptional
public boolean getInputPortsOptional()
Returns whether the input ports with index > 0 are optional. The port with index 0 is always mandatory, other ports are always either all optional or all mandatory.- Returns:
- true if the ports with index > 0 are optional, false if the ports with index > 0 are mandatory
-
getTargetFieldNames
public List<String> getTargetFieldNames()
Returns the actual target field names for all input ports (null entries for disconnected ports).- Returns:
- the target field names
-
setTargetFieldNames
public void setTargetFieldNames(List<String> targetFieldNames)
Sets the actual target field names for all input ports (null entries for disconnected ports).- Parameters:
targetFieldNames
- the target field names
-
getTargetValue
public String getTargetValue()
Returns the target value ("true class")- Returns:
- the target value
-
setTargetValue
public void setTargetValue(String targetValue)
Sets the target value ("true class")- Parameters:
targetValue
- the target value
-
getConfidenceFieldNames
public List<String> getConfidenceFieldNames()
Returns the confidence field names for each input port (null entries for disconnected ports).- Returns:
- the confidence field names
-
setConfidenceFieldNames
public void setConfidenceFieldNames(List<String> confidenceFieldNames)
Sets the confidence field names for each input port (null entries for disconnected ports).- Parameters:
confidenceFieldNames
- the confidence field names
-
getResultSize
public int getResultSize()
Returns the number of results. The sequence of confusion matrices (one per input data point) will be split into the given number of equal sized slices. This reduced set will be used for chart creation.- Returns:
- the number of results
-
setResultSize
public void setResultSize(int resultSize)
Sets the number of results. The sequence of confusion matrices (one per input data point) will be split into the given number of equal sized slices. This reduced set will be used for chart creation.- Parameters:
resultSize
- the number of results
-
getChartType
public ChartType getChartType()
Returns the desired chart type (ROC, Gains, Lift).- Returns:
- the chart type
-
setChartType
public void setChartType(ChartType chartType)
Sets the desired chart type (ROC, Gains, Lift).- Parameters:
chartType
- the desired chart type
-
getChartNames
public List<String> getChartNames()
Returns the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).- Returns:
- the predictor/chart names
-
setChartNames
public void setChartNames(List<String> chartNames)
Sets the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).- Parameters:
chartNames
- the predictor/chart names
-
getOutputPath
public String getOutputPath()
Returns the path of the .png output file (null means no output file will be generated).- Returns:
- the output path
-
setOutputPath
public void setOutputPath(String outputPath)
Sets the path of the .png output file (null means no output file will be generated).- Parameters:
outputPath
- the output path
-
compose
protected void compose(CompositionContext context)
Description copied from class:CompositeOperator
Compose the body of this operator. Implementations should do the following:- Perform any validation of configuration, input types, etc
- Instantiate and configure sub-operators, adding them to the provided context via
the method
OperatorComposable.add(O)
- Create necessary connections via the method
OperatorComposable.connect(P, P)
. This includes connections from the composite's input ports to sub-operators, connections between sub-operators, and connections from sub-operators output ports to the composite's output ports
- Specified by:
compose
in classCompositeOperator
- Parameters:
context
- the context
-
-