class FewShotAssertionClassifierApproach extends GenericClassifierApproach
An implementation of multinomial logistic regression.
Example
Define pipeline stages to prepare the data
val documentAssembler = new DocumentAssembler() .setInputCol("text") .setOutputCol("document") val sentenceEmbeddings = BertSentenceEmbeddings .pretrained() .setInputCols(Array("document")) .setOutputCol("sentence_embedding") val featuresAssembler = new FeaturesAssembler() .setInputCols(Array("sentence_embedding")) .setOutputCol("feature_vector") val logRegClassifier = new FewShotAssertionClassifierApproach() .setInputCols("feature_vector") .setOutputCol("prediction") .setLabelColumn("label") .setModelFile("src/test/resources/classification/log_reg_graph.pb") .setEpochsNumber(10) .setBatchSize(1) .setMultiClass(false) .setlearningRate(0.01f) val pipeline = new Pipeline().setStages(Array( documentAssembler, sentenceEmbeddings, featuresAssembler, logRegClassifier, )) val model = pipeline.fit(trainingData)
- See also
DocumentLogRegClassifierModel for instantiated models
- Grouped
- Alphabetic
- By Inheritance
- FewShotAssertionClassifierApproach
- GenericClassifierApproach
- CheckLicense
- HandleExceptionParams
- GenericClassifierParams
- AnnotatorApproach
- CanBeLazy
- DefaultParamsWritable
- MLWritable
- HasOutputAnnotatorType
- HasOutputAnnotationCol
- HasInputAnnotationCols
- Estimator
- PipelineStage
- Logging
- Params
- Serializable
- Serializable
- Identifiable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Type Members
-
type
AnnotatorType = String
- Definition Classes
- HasOutputAnnotatorType
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
$[T](param: Param[T]): T
- Attributes
- protected
- Definition Classes
- Params
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
_fit(dataset: Dataset[_], recursiveStages: Option[PipelineModel]): GenericClassifierModel
- Attributes
- protected
- Definition Classes
- AnnotatorApproach
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
val
batchSize: IntParam
Batch size
Batch size
- Definition Classes
- GenericClassifierParams
-
def
beforeTraining(spark: SparkSession): Unit
- Definition Classes
- GenericClassifierApproach → AnnotatorApproach
-
final
def
checkSchema(schema: StructType, inputAnnotatorType: String): Boolean
- Attributes
- protected
- Definition Classes
- HasInputAnnotationCols
-
def
checkValidEnvironment(spark: Option[SparkSession], scopes: Seq[String]): Unit
- Definition Classes
- CheckLicense
-
def
checkValidScope(scope: String): Unit
- Definition Classes
- CheckLicense
-
def
checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean): Unit
- Definition Classes
- CheckLicense
-
def
checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean): Unit
- Definition Classes
- CheckLicense
-
final
def
clear(param: Param[_]): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- Params
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
copy(extra: ParamMap): Estimator[GenericClassifierModel]
- Definition Classes
- AnnotatorApproach → Estimator → PipelineStage → Params
-
def
copyValues[T <: Params](to: T, extra: ParamMap): T
- Attributes
- protected
- Definition Classes
- Params
-
val
datasetInfo: Param[String]
Descriptive information about the dataset being used.
Descriptive information about the dataset being used.
- Definition Classes
- GenericClassifierParams
-
final
def
defaultCopy[T <: Params](extra: ParamMap): T
- Attributes
- protected
- Definition Classes
- Params
-
val
description: String
Trains TensorFlow model for multi-class text classification
Trains TensorFlow model for multi-class text classification
- Definition Classes
- GenericClassifierApproach → AnnotatorApproach
-
val
doExceptionHandling: BooleanParam
If true, exceptions are handled.
If true, exceptions are handled. If exception causing data is passed to the model, a error annotation is emitted which has the exception message. Processing continues with the next one. This comes with a performance penalty.
- Definition Classes
- HandleExceptionParams
-
val
dropout: FloatParam
Dropout coefficient
Dropout coefficient
- Definition Classes
- GenericClassifierParams
-
val
epochsN: IntParam
Maximum number of epochs to train
Maximum number of epochs to train
- Definition Classes
- GenericClassifierParams
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
explainParam(param: Param[_]): String
- Definition Classes
- Params
-
def
explainParams(): String
- Definition Classes
- Params
-
final
def
extractParamMap(): ParamMap
- Definition Classes
- Params
-
final
def
extractParamMap(extra: ParamMap): ParamMap
- Definition Classes
- Params
-
val
featureScaling: Param[String]
Feature scaling method.
Feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling)
- Definition Classes
- GenericClassifierParams
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
fit(dataset: Dataset[_]): GenericClassifierModel
- Definition Classes
- AnnotatorApproach → Estimator
-
def
fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[GenericClassifierModel]
- Definition Classes
- Estimator
- Annotations
- @Since( "2.0.0" )
-
def
fit(dataset: Dataset[_], paramMap: ParamMap): GenericClassifierModel
- Definition Classes
- Estimator
- Annotations
- @Since( "2.0.0" )
-
def
fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): GenericClassifierModel
- Definition Classes
- Estimator
- Annotations
- @Since( "2.0.0" ) @varargs()
-
val
fixImbalance: BooleanParam
Fix the imbalance in the training set by replicating examples of under represented categories
Fix the imbalance in the training set by replicating examples of under represented categories
- Definition Classes
- GenericClassifierParams
-
final
def
get[T](param: Param[T]): Option[T]
- Definition Classes
- Params
-
def
getBatchSize: Int
Batch size
Batch size
- Definition Classes
- GenericClassifierParams
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getDatasetInfo: String
get descriptive information about the dataset being used
get descriptive information about the dataset being used
- Definition Classes
- GenericClassifierParams
-
final
def
getDefault[T](param: Param[T]): Option[T]
- Definition Classes
- Params
-
def
getDropout: Float
Dropout coefficient
Dropout coefficient
- Definition Classes
- GenericClassifierParams
-
def
getExistingLabels(): Array[String]
- Attributes
- protected
- Definition Classes
- GenericClassifierApproach
-
def
getFeatureScaling: String
Get feature scaling method
Get feature scaling method
- Definition Classes
- GenericClassifierParams
-
def
getFixImbalance: Boolean
Fix imbalance in training set
Fix imbalance in training set
- Definition Classes
- GenericClassifierParams
-
def
getInputCols: Array[String]
- Definition Classes
- HasInputAnnotationCols
-
def
getLabelColumn: String
Column with label per each document
Column with label per each document
- Definition Classes
- GenericClassifierParams
-
def
getLazyAnnotator: Boolean
- Definition Classes
- CanBeLazy
-
def
getLearningRate: Float
Learning Rate
Learning Rate
- Definition Classes
- GenericClassifierParams
-
def
getMaxEpochs: Int
Maximum number of epochs to train
Maximum number of epochs to train
- Definition Classes
- GenericClassifierParams
-
def
getModelFile: String
Model file name
Model file name
- Definition Classes
- GenericClassifierParams
-
def
getMultiClass: Boolean
Gets the model multi class prediction mode
Gets the model multi class prediction mode
- Definition Classes
- GenericClassifierParams
-
final
def
getOrDefault[T](param: Param[T]): T
- Definition Classes
- Params
-
final
def
getOutputCol: String
- Definition Classes
- HasOutputAnnotationCol
-
def
getOutputLogsPath: String
Get output logs path
Get output logs path
- Definition Classes
- GenericClassifierParams
-
def
getParam(paramName: String): Param[Any]
- Definition Classes
- Params
-
def
getTFWrapper(): TensorflowWrapper
- Attributes
- protected
- Definition Classes
- GenericClassifierApproach
-
def
getValidationSplit: Float
Choose the proportion of training dataset to be validated against the model on each Epoch.
Choose the proportion of training dataset to be validated against the model on each Epoch. The value should be between 0.0 and 1.0 and by default it is 0.0 and off.
- Definition Classes
- GenericClassifierParams
-
final
def
hasDefault[T](param: Param[T]): Boolean
- Definition Classes
- Params
-
def
hasParam(paramName: String): Boolean
- Definition Classes
- Params
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
-
def
initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
val
inputAnnotatorTypes: Array[AnnotatorType]
Input annotator types : SENTENCE_EMBEDDINGS
Input annotator types : SENTENCE_EMBEDDINGS
- Definition Classes
- FewShotAssertionClassifierApproach → GenericClassifierApproach → HasInputAnnotationCols
-
final
val
inputCols: StringArrayParam
- Attributes
- protected
- Definition Classes
- HasInputAnnotationCols
-
final
def
isDefined(param: Param[_]): Boolean
- Definition Classes
- Params
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isSet(param: Param[_]): Boolean
- Definition Classes
- Params
-
def
isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
-
val
labelColumn: Param[String]
Column with label per each document
Column with label per each document
- Definition Classes
- GenericClassifierParams
-
val
lazyAnnotator: BooleanParam
- Definition Classes
- CanBeLazy
-
val
learningRate: FloatParam
Learning Rate
Learning Rate
- Definition Classes
- GenericClassifierParams
-
def
log: Logger
- Attributes
- protected
- Definition Classes
- Logging
-
def
logDebug(msg: ⇒ String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logDebug(msg: ⇒ String): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logError(msg: ⇒ String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logError(msg: ⇒ String): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logInfo(msg: ⇒ String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logInfo(msg: ⇒ String): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logName: String
- Attributes
- protected
- Definition Classes
- Logging
-
def
logTrace(msg: ⇒ String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logTrace(msg: ⇒ String): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logWarning(msg: ⇒ String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
def
logWarning(msg: ⇒ String): Unit
- Attributes
- protected
- Definition Classes
- Logging
-
val
modelFile: Param[String]
Location of file of the model used for classification
Location of file of the model used for classification
- Definition Classes
- GenericClassifierParams
-
def
msgHelper(schema: StructType): String
- Attributes
- protected
- Definition Classes
- HasInputAnnotationCols
-
val
multiClass: BooleanParam
If multiClass is set, the model will return all the labels with corresponding scores.
If multiClass is set, the model will return all the labels with corresponding scores. By default, multiClass is false.
- Definition Classes
- GenericClassifierParams
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
onTrained(model: GenericClassifierModel, spark: SparkSession): Unit
- Definition Classes
- AnnotatorApproach
-
val
optionalInputAnnotatorTypes: Array[String]
- Definition Classes
- HasInputAnnotationCols
-
val
outputAnnotatorType: String
Output annotator type : CATEGORY
Output annotator type : CATEGORY
- Definition Classes
- GenericClassifierApproach → HasOutputAnnotatorType
-
final
val
outputCol: Param[String]
- Attributes
- protected
- Definition Classes
- HasOutputAnnotationCol
-
val
outputLogsPath: Param[String]
Folder path to save training logs.
Folder path to save training logs. If no path is specified, the logs won't be stored in disk. The path can be a local file path, a distributed file path (HDFS, DBFS), or a cloud storage (S3).
- Definition Classes
- GenericClassifierParams
-
lazy val
params: Array[Param[_]]
- Definition Classes
- Params
-
def
resumeTraining: Boolean
- Attributes
- protected
- Definition Classes
- GenericClassifierApproach
-
def
save(path: String): Unit
- Definition Classes
- MLWritable
- Annotations
- @Since( "1.6.0" ) @throws( ... )
-
final
def
set(paramPair: ParamPair[_]): FewShotAssertionClassifierApproach.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
set(param: String, value: Any): FewShotAssertionClassifierApproach.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
set[T](param: Param[T], value: T): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- Params
-
def
setBatchSize(batch: Int): FewShotAssertionClassifierApproach.this.type
Batch size
Batch size
- Definition Classes
- GenericClassifierParams
-
def
setDatasetInfo(value: String): FewShotAssertionClassifierApproach.this.type
set descriptive information about the dataset being used
set descriptive information about the dataset being used
- Definition Classes
- GenericClassifierParams
-
final
def
setDefault(paramPairs: ParamPair[_]*): FewShotAssertionClassifierApproach.this.type
- Attributes
- protected
- Definition Classes
- Params
-
final
def
setDefault[T](param: Param[T], value: T): FewShotAssertionClassifierApproach.this.type
- Attributes
- protected[org.apache.spark.ml]
- Definition Classes
- Params
-
def
setDoExceptionHandling(value: Boolean): FewShotAssertionClassifierApproach.this.type
If true, exceptions are handled.
If true, exceptions are handled. If exception causing data is passed to the model, a error annotation is emitted which has the exception message. Processing continues with the next one. This comes with a performance penalty.
- Definition Classes
- HandleExceptionParams
-
def
setDropout(dropout: Float): FewShotAssertionClassifierApproach.this.type
Dropout coefficient
Dropout coefficient
- Definition Classes
- GenericClassifierParams
-
def
setEpochsNumber(epochs: Int): FewShotAssertionClassifierApproach.this.type
Maximum number of epochs to train
Maximum number of epochs to train
- Definition Classes
- GenericClassifierParams
-
def
setFeatureScaling(featureScaling: String): FewShotAssertionClassifierApproach.this.type
Set the feature scaling method.
Set the feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling)
- Definition Classes
- GenericClassifierParams
-
def
setFixImbalance(fix: Boolean): FewShotAssertionClassifierApproach.this.type
Fix imbalance of training set
Fix imbalance of training set
- Definition Classes
- GenericClassifierParams
-
final
def
setInputCols(value: String*): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- HasInputAnnotationCols
-
def
setInputCols(value: Array[String]): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- HasInputAnnotationCols
-
def
setLabelColumn(column: String): FewShotAssertionClassifierApproach.this.type
Column with label per each document
Column with label per each document
- Definition Classes
- GenericClassifierParams
-
def
setLazyAnnotator(value: Boolean): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- CanBeLazy
-
def
setModelFile(modelFile: String): FewShotAssertionClassifierApproach.this.type
Set the model file name
Set the model file name
- Definition Classes
- GenericClassifierParams
-
def
setMultiClass(value: Boolean): FewShotAssertionClassifierApproach.this.type
Sets the model in multi class prediction mode
Sets the model in multi class prediction mode
- Definition Classes
- GenericClassifierParams
-
final
def
setOutputCol(value: String): FewShotAssertionClassifierApproach.this.type
- Definition Classes
- HasOutputAnnotationCol
-
def
setOutputLogsPath(outputLogsPath: String): FewShotAssertionClassifierApproach.this.type
Set the output log path
Set the output log path
- Definition Classes
- GenericClassifierParams
-
def
setValidationSplit(validationSplit: Float): FewShotAssertionClassifierApproach.this.type
Choose the proportion of training dataset to be validated against the model on each Epoch.
Choose the proportion of training dataset to be validated against the model on each Epoch. The value should be between 0.0 and 1.0 and by default it is 0.0 and off.
- Definition Classes
- GenericClassifierParams
-
def
setlearningRate(lr: Float): FewShotAssertionClassifierApproach.this.type
Learning Rate
Learning Rate
- Definition Classes
- GenericClassifierParams
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Identifiable → AnyRef → Any
-
def
train(dataset: Dataset[_], recursivePipeline: Option[PipelineModel]): FewShotAssertionClassifierModel
- Definition Classes
- FewShotAssertionClassifierApproach → GenericClassifierApproach → AnnotatorApproach
-
final
def
transformSchema(schema: StructType): StructType
- Definition Classes
- AnnotatorApproach → PipelineStage
-
def
transformSchema(schema: StructType, logging: Boolean): StructType
- Attributes
- protected
- Definition Classes
- PipelineStage
- Annotations
- @DeveloperApi()
-
val
uid: String
- Definition Classes
- FewShotAssertionClassifierApproach → GenericClassifierApproach → Identifiable
-
def
validate(schema: StructType): Boolean
- Attributes
- protected
- Definition Classes
- AnnotatorApproach
-
val
validationSplit: FloatParam
The proportion of training dataset to be used as validation set.
The proportion of training dataset to be used as validation set.
The model will be validated against this dataset on each Epoch and will not be used for training. The value should be between 0.0 and 1.0.
- Definition Classes
- GenericClassifierParams
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
write: MLWriter
- Definition Classes
- DefaultParamsWritable → MLWritable
Inherited from GenericClassifierApproach
Inherited from CheckLicense
Inherited from HandleExceptionParams
Inherited from GenericClassifierParams
Inherited from AnnotatorApproach[GenericClassifierModel]
Inherited from CanBeLazy
Inherited from DefaultParamsWritable
Inherited from MLWritable
Inherited from HasOutputAnnotatorType
Inherited from HasOutputAnnotationCol
Inherited from HasInputAnnotationCols
Inherited from Estimator[GenericClassifierModel]
Inherited from PipelineStage
Inherited from Logging
Inherited from Params
Inherited from Serializable
Inherited from Serializable
Inherited from Identifiable
Inherited from AnyRef
Inherited from Any
Parameters
Annotator types
Required input and expected output annotator types