Class BinaryResponseProcessor<T extends Output<T>>
java.lang.Object
org.tribuo.data.columnar.processors.response.BinaryResponseProcessor<T>
- All Implemented Interfaces:
- com.oracle.labs.mlrg.olcut.config.Configurable,- com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,- ResponseProcessor<T>
public class BinaryResponseProcessor<T extends Output<T>>
extends Object
implements ResponseProcessor<T>
A 
ResponseProcessor that takes a single value of the
  field as the positive class and all other values as the negative
  class.
 
 We support specifying field names and default values both singly through fieldName and positiveResponse
 and in a list through fieldNames and positiveResponses. The constructors and configuration preprocessing
 have differing behaviors based on which fields are populated:
 
-  fieldNamesandpositiveResponsesare both populated and the same length: fieldNames[i]'s positiveResponse is positiveResponses[i]
-  fieldNamesandpositiveResponseare both populated: positiveResponse is broadcast across all fieldNames
-  fieldNameandpositiveResponseare both populated: fieldNames[0] == fieldName, positiveResponses[0] == positiveResponse
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionBinaryResponseProcessor(String fieldName, String positiveResponse, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values.BinaryResponseProcessor(List<String> fieldNames, String positiveResponse, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values.BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values.BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory, boolean displayField) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values.BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory, String positiveName, String negativeName, boolean displayField) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values.
- 
Method SummaryModifier and TypeMethodDescriptionDeprecated.Gets the field names this ResponseProcessor uses.Gets the OutputFactory this ResponseProcessor uses.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenancevoidDeprecated.Returns Optional.empty() if it failed to process out a response.This method has a default implementation for backwards compatibility with Tribuo 4.0 and 4.1.voidsetFieldName(String fieldName) Deprecated.toString()
- 
Field Details- 
POSITIVE_NAME
- 
NEGATIVE_NAME
 
- 
- 
Constructor Details- 
BinaryResponseProcessorpublic BinaryResponseProcessor(String fieldName, String positiveResponse, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values. Defaults toPOSITIVE_NAMEfor positive outputs andNEGATIVE_NAMEfor negative outputs.- Parameters:
- fieldName- The field name to read.
- positiveResponse- The positive response to look for.
- outputFactory- The output factory to use.
 
- 
BinaryResponseProcessorpublic BinaryResponseProcessor(List<String> fieldNames, String positiveResponse, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values. Defaults toPOSITIVE_NAMEfor positive outputs andNEGATIVE_NAMEfor negative outputs.- Parameters:
- fieldNames- The field names to read.
- positiveResponse- The positive response to look for.
- outputFactory- The output factory to use.
 
- 
BinaryResponseProcessorpublic BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values. The lengths of fieldNames and positiveResponses must be the same. Defaults toPOSITIVE_NAMEfor positive outputs andNEGATIVE_NAMEfor negative outputs.- Parameters:
- fieldNames- The field names to read.
- positiveResponses- The positive responses to look for.
- outputFactory- The output factory to use.
 
- 
BinaryResponseProcessorpublic BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory, boolean displayField) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values. The lengths of fieldNames and positiveResponses must be the same. Defaults toPOSITIVE_NAMEfor positive outputs andNEGATIVE_NAMEfor negative outputs.- Parameters:
- fieldNames- The field names to read.
- positiveResponses- The positive responses to look for.
- outputFactory- The output factory to use.
- displayField- whether to include field names in the generated labels.
 
- 
BinaryResponseProcessorpublic BinaryResponseProcessor(List<String> fieldNames, List<String> positiveResponses, OutputFactory<T> outputFactory, String positiveName, String negativeName, boolean displayField) Constructs a binary response processor which emits a positive value for a single string and a negative value for all other field values. The lengths of fieldNames and positiveResponses must be the same.- Parameters:
- fieldNames- The field names to read.
- positiveResponses- The positive responses to look for.
- outputFactory- The output factory to use.
- positiveName- The value of a 'positive' output
- negativeName- the value of a 'negative' output
- displayField- whether to include field names in the generated labels.
 
 
- 
- 
Method Details- 
postConfigpublic void postConfig()- Specified by:
- postConfigin interface- com.oracle.labs.mlrg.olcut.config.Configurable
 
- 
getOutputFactoryDescription copied from interface:ResponseProcessorGets the OutputFactory this ResponseProcessor uses.- Specified by:
- getOutputFactoryin interface- ResponseProcessor<T extends Output<T>>
- Returns:
- The output factory.
 
- 
getFieldNameDeprecated.- Specified by:
- getFieldNamein interface- ResponseProcessor<T extends Output<T>>
- Returns:
- The field name.
 
- 
setFieldNameDeprecated.- Specified by:
- setFieldNamein interface- ResponseProcessor<T extends Output<T>>
- Parameters:
- fieldName- The field name.
 
- 
processDeprecated.- Specified by:
- processin interface- ResponseProcessor<T extends Output<T>>
- Parameters:
- value- The value to process.
- Returns:
- The response value if found.
 
- 
processDescription copied from interface:ResponseProcessorReturns Optional.empty() if it failed to process out a response.This method has a default implementation for backwards compatibility with Tribuo 4.0 and 4.1. This method should be overridden by code which depends on newer versions of Tribuo. The default implementation will be removed when the deprecated members are removed. Unless is is overridden it will throw anIllegalArgumentExceptionwhen called with multiple values.- Specified by:
- processin interface- ResponseProcessor<T extends Output<T>>
- Parameters:
- values- The value to process.
- Returns:
- The response values if found.
 
- 
getFieldNamesDescription copied from interface:ResponseProcessorGets the field names this ResponseProcessor uses.- Specified by:
- getFieldNamesin interface- ResponseProcessor<T extends Output<T>>
- Returns:
- The field names.
 
- 
toString
- 
getProvenance
 
-