java.lang.Object
com.pervasive.datarush.operators.AbstractLogicalOperator
com.pervasive.datarush.operators.CompositeOperator
com.pervasive.datarush.analytics.viz.DrawDiagnosticsChart
- All Implemented Interfaces:
LogicalOperator
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
FieldsModifier and TypeFieldDescriptionstatic final intThe default number of input ports -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionprotected voidcompose(CompositionContext context) Compose the body of this operator.Returns the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).Returns the desired chart type (ROC, Gains, Lift).Returns the confidence field names for each input port (null entries for disconnected ports).getInput(int idx) Returns the input port for the given index.booleanReturns whether the input ports with index > 0 are optional.Returns the output port.Returns the path of the .png output file (null means no output file will be generated).intReturns the number of input ports.intReturns the number of results.Returns the actual target field names for all input ports (null entries for disconnected ports).Returns the target value ("true class")voidsetChartNames(List<String> chartNames) Sets the predictor names for each input port to be displayed as the chart legend (null entries for disconnected input ports).voidsetChartType(ChartType chartType) Sets the desired chart type (ROC, Gains, Lift).voidsetConfidenceFieldNames(List<String> confidenceFieldNames) Sets the confidence field names for each input port (null entries for disconnected ports).voidsetOutputPath(String outputPath) Sets the path of the .png output file (null means no output file will be generated).voidsetResultSize(int resultSize) Sets the number of results.voidsetTargetFieldNames(List<String> targetFieldNames) Sets the actual target field names for all input ports (null entries for disconnected ports).voidsetTargetValue(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 Details
-
DEFAULT_INPUT_PORT_COUNT
public static final int DEFAULT_INPUT_PORT_COUNTThe default number of input ports- See Also:
-
-
Constructor Details
-
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 Details
-
getInput
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
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
Returns the actual target field names for all input ports (null entries for disconnected ports).- Returns:
- the target field names
-
setTargetFieldNames
Sets the actual target field names for all input ports (null entries for disconnected ports).- Parameters:
targetFieldNames- the target field names
-
getTargetValue
Returns the target value ("true class")- Returns:
- the target value
-
setTargetValue
Sets the target value ("true class")- Parameters:
targetValue- the target value
-
getConfidenceFieldNames
Returns the confidence field names for each input port (null entries for disconnected ports).- Returns:
- the confidence field names
-
setConfidenceFieldNames
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
Returns the desired chart type (ROC, Gains, Lift).- Returns:
- the chart type
-
setChartType
Sets the desired chart type (ROC, Gains, Lift).- Parameters:
chartType- the desired chart type
-
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
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
Returns the path of the .png output file (null means no output file will be generated).- Returns:
- the output path
-
setOutputPath
Sets the path of the .png output file (null means no output file will be generated).- Parameters:
outputPath- the output path
-
compose
Description copied from class:CompositeOperatorCompose 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:
composein classCompositeOperator- Parameters:
context- the context
-