class GenericClassifierModel extends AnnotatorModel[GenericClassifierModel] with GenericClassifierParams with HasStorageRef with ParamsAndFeaturesWritable with WriteTensorflowModel with HasSimpleAnnotate[GenericClassifierModel] with HandleExceptionParams with HasSafeAnnotate[GenericClassifierModel] with CheckLicense

Creates a generic single-label classifier which uses pre-generated Tensorflow graphs. The model operates on FEATURE_VECTOR annotations which can be produced using FeatureAssembler. Requires the FeaturesAssembler to create the input.

See also

GenericClassifierApproach for an example and on how to define your own model

Linear Supertypes
CheckLicense, HasSafeAnnotate[GenericClassifierModel], HandleExceptionParams, HasSimpleAnnotate[GenericClassifierModel], WriteTensorflowModel, HasStorageRef, GenericClassifierParams, AnnotatorModel[GenericClassifierModel], CanBeLazy, RawAnnotator[GenericClassifierModel], HasOutputAnnotationCol, HasInputAnnotationCols, HasOutputAnnotatorType, ParamsAndFeaturesWritable, HasFeatures, DefaultParamsWritable, MLWritable, Model[GenericClassifierModel], Transformer, PipelineStage, Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. GenericClassifierModel
  2. CheckLicense
  3. HasSafeAnnotate
  4. HandleExceptionParams
  5. HasSimpleAnnotate
  6. WriteTensorflowModel
  7. HasStorageRef
  8. GenericClassifierParams
  9. AnnotatorModel
  10. CanBeLazy
  11. RawAnnotator
  12. HasOutputAnnotationCol
  13. HasInputAnnotationCols
  14. HasOutputAnnotatorType
  15. ParamsAndFeaturesWritable
  16. HasFeatures
  17. DefaultParamsWritable
  18. MLWritable
  19. Model
  20. Transformer
  21. PipelineStage
  22. Logging
  23. Params
  24. Serializable
  25. Serializable
  26. Identifiable
  27. AnyRef
  28. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Parameters

  1. val batchSize: IntParam

    Batch size

    Batch size

    Definition Classes
    GenericClassifierParams
  2. val datasetInfo: Param[String]

    Descriptive information about the dataset being used.

    Descriptive information about the dataset being used.

    Definition Classes
    GenericClassifierParams
  3. 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
  4. val dropout: FloatParam

    Dropout coefficient

    Dropout coefficient

    Definition Classes
    GenericClassifierParams
  5. val epochsN: IntParam

    Maximum number of epochs to train

    Maximum number of epochs to train

    Definition Classes
    GenericClassifierParams
  6. val featureScaling: Param[String]

    Feature scaling method.

    Feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling)

    Definition Classes
    GenericClassifierParams
  7. 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
  8. val labelColumn: Param[String]

    Column with label per each document

    Column with label per each document

    Definition Classes
    GenericClassifierParams
  9. val learningRate: FloatParam

    Learning Rate

    Learning Rate

    Definition Classes
    GenericClassifierParams
  10. 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
  11. 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
  12. 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
  13. 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

Annotator types

Required input and expected output annotator types

  1. val inputAnnotatorTypes: Array[AnnotatorType]

    Output annotator type : FEATURE_VECTOR

    Output annotator type : FEATURE_VECTOR

    Definition Classes
    GenericClassifierModel → HasInputAnnotationCols
  2. val outputAnnotatorType: String

    Output annotator type : CATEGORY

    Output annotator type : CATEGORY

    Definition Classes
    GenericClassifierModel → HasOutputAnnotatorType

Members

  1. type AnnotatorType = String
    Definition Classes
    HasOutputAnnotatorType
  1. def annotate(annotations: Seq[Annotation]): Seq[Annotation]

    takes a document and annotations and produces new annotations of this annotator's annotation type

    takes a document and annotations and produces new annotations of this annotator's annotation type

    annotations

    Annotations that correspond to inputAnnotationCols generated by previous annotators if any

    returns

    any number of annotations processed for every input annotation. Not necessary one to one relationship

    Definition Classes
    GenericClassifierModel → HasSimpleAnnotate
  2. def checkValidEnvironment(spark: Option[SparkSession], scopes: Seq[String]): Unit
    Definition Classes
    CheckLicense
  3. def checkValidScope(scope: String): Unit
    Definition Classes
    CheckLicense
  4. def checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  5. def checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  6. val classes: StringArrayParam
  7. final def clear(param: Param[_]): GenericClassifierModel.this.type
    Definition Classes
    Params
  8. def copy(extra: ParamMap): GenericClassifierModel
    Definition Classes
    RawAnnotator → Model → Transformer → PipelineStage → Params
  9. def createDatabaseConnection(database: Name): RocksDBConnection
    Definition Classes
    HasStorageRef
  10. def dfAnnotate: UserDefinedFunction
    Definition Classes
    HasSimpleAnnotate
  11. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  12. def explainParams(): String
    Definition Classes
    Params
  13. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  14. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  15. val features: ArrayBuffer[Feature[_, _, _]]
    Definition Classes
    HasFeatures
  16. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  17. def getCategories(): Array[String]
  18. def getCategoryName(id: Int): String
  19. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  20. def getEncoder: GenericClassifierDataEncoder
  21. def getInputCols: Array[String]
    Definition Classes
    HasInputAnnotationCols
  22. def getLazyAnnotator: Boolean
    Definition Classes
    CanBeLazy
  23. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  24. final def getOutputCol: String
    Definition Classes
    HasOutputAnnotationCol
  25. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  26. def getStorageRef: String
    Definition Classes
    HasStorageRef
  27. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  28. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  29. def hasParent: Boolean
    Definition Classes
    Model
  30. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  31. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  32. val lazyAnnotator: BooleanParam
    Definition Classes
    CanBeLazy
  33. def model: TensorflowGenericClassifier
  34. def onWrite(path: String, spark: SparkSession): Unit
    Definition Classes
    GenericClassifierModel → ParamsAndFeaturesWritable
  35. val optionalInputAnnotatorTypes: Array[String]
    Definition Classes
    HasInputAnnotationCols
  36. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  37. var parent: Estimator[GenericClassifierModel]
    Definition Classes
    Model
  38. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  39. final def set[T](param: Param[T], value: T): GenericClassifierModel.this.type
    Definition Classes
    Params
  40. def setCategoryNames(categoryNames: Array[String]): GenericClassifierModel.this.type
  41. def setEncoder(encoder: GenericClassifierDataEncoder): GenericClassifierModel.this.type
  42. final def setInputCols(value: String*): GenericClassifierModel.this.type
    Definition Classes
    HasInputAnnotationCols
  43. def setInputCols(value: Array[String]): GenericClassifierModel.this.type
    Definition Classes
    HasInputAnnotationCols
  44. def setLazyAnnotator(value: Boolean): GenericClassifierModel.this.type
    Definition Classes
    CanBeLazy
  45. final def setOutputCol(value: String): GenericClassifierModel.this.type
    Definition Classes
    HasOutputAnnotationCol
  46. def setParent(parent: Estimator[GenericClassifierModel]): GenericClassifierModel
    Definition Classes
    Model
  47. def setStorageRef(value: String): GenericClassifierModel.this.type
    Definition Classes
    HasStorageRef
  48. def setTensorflowModel(spark: SparkSession, tf: TensorflowWrapper): GenericClassifierModel.this.type
  49. val storageRef: Param[String]
    Definition Classes
    HasStorageRef
  50. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  51. final def transform(dataset: Dataset[_]): DataFrame
    Definition Classes
    AnnotatorModel → Transformer
  52. def transform(dataset: Dataset[_], paramMap: ParamMap): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" )
  53. def transform(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" ) @varargs()
  54. final def transformSchema(schema: StructType): StructType
    Definition Classes
    RawAnnotator → PipelineStage
  55. val uid: String
    Definition Classes
    GenericClassifierModel → Identifiable
  56. def validateStorageRef(dataset: Dataset[_], inputCols: Array[String], annotatorType: String): Unit
    Definition Classes
    HasStorageRef
  57. def write: MLWriter
    Definition Classes
    ParamsAndFeaturesWritable → DefaultParamsWritable → MLWritable
  58. def writeTensorflowHub(path: String, tfPath: String, spark: SparkSession, suffix: String): Unit
    Definition Classes
    WriteTensorflowModel
  59. def writeTensorflowModel(path: String, spark: SparkSession, tensorflow: TensorflowWrapper, suffix: String, filename: String, configProtoBytes: Option[Array[Byte]]): Unit
    Definition Classes
    WriteTensorflowModel
  60. def writeTensorflowModelV2(path: String, spark: SparkSession, tensorflow: TensorflowWrapper, suffix: String, filename: String, configProtoBytes: Option[Array[Byte]], savedSignatures: Option[Map[String, String]]): Unit
    Definition Classes
    WriteTensorflowModel

Parameter setters

  1. def setBatchSize(batch: Int): GenericClassifierModel.this.type

    Batch size

    Batch size

    Definition Classes
    GenericClassifierParams
  2. def setDatasetInfo(value: String): GenericClassifierModel.this.type

    set descriptive information about the dataset being used

    set descriptive information about the dataset being used

    Definition Classes
    GenericClassifierParams
  3. def setDoExceptionHandling(value: Boolean): GenericClassifierModel.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
  4. def setDropout(dropout: Float): GenericClassifierModel.this.type

    Dropout coefficient

    Dropout coefficient

    Definition Classes
    GenericClassifierParams
  5. def setEpochsNumber(epochs: Int): GenericClassifierModel.this.type

    Maximum number of epochs to train

    Maximum number of epochs to train

    Definition Classes
    GenericClassifierParams
  6. def setFeatureScaling(featureScaling: String): GenericClassifierModel.this.type

    Set the feature scaling method.

    Set the feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling)

    Definition Classes
    GenericClassifierParams
  7. def setFixImbalance(fix: Boolean): GenericClassifierModel.this.type

    Fix imbalance of training set

    Fix imbalance of training set

    Definition Classes
    GenericClassifierParams
  8. def setLabelColumn(column: String): GenericClassifierModel.this.type

    Column with label per each document

    Column with label per each document

    Definition Classes
    GenericClassifierParams
  9. def setModelFile(modelFile: String): GenericClassifierModel.this.type

    Set the model file name

    Set the model file name

    Definition Classes
    GenericClassifierParams
  10. def setMultiClass(value: Boolean): GenericClassifierModel.this.type

    Sets the model in multi class prediction mode

    Sets the model in multi class prediction mode

    Definition Classes
    GenericClassifierParams
  11. def setOutputLogsPath(outputLogsPath: String): GenericClassifierModel.this.type

    Set the output log path

    Set the output log path

    Definition Classes
    GenericClassifierParams
  12. def setValidationSplit(validationSplit: Float): GenericClassifierModel.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
  13. def setlearningRate(lr: Float): GenericClassifierModel.this.type

    Learning Rate

    Learning Rate

    Definition Classes
    GenericClassifierParams

Parameter getters

  1. def getBatchSize: Int

    Batch size

    Batch size

    Definition Classes
    GenericClassifierParams
  2. def getDatasetInfo: String

    get descriptive information about the dataset being used

    get descriptive information about the dataset being used

    Definition Classes
    GenericClassifierParams
  3. def getDropout: Float

    Dropout coefficient

    Dropout coefficient

    Definition Classes
    GenericClassifierParams
  4. def getFeatureScaling: String

    Get feature scaling method

    Get feature scaling method

    Definition Classes
    GenericClassifierParams
  5. def getFixImbalance: Boolean

    Fix imbalance in training set

    Fix imbalance in training set

    Definition Classes
    GenericClassifierParams
  6. def getLabelColumn: String

    Column with label per each document

    Column with label per each document

    Definition Classes
    GenericClassifierParams
  7. def getLearningRate: Float

    Learning Rate

    Learning Rate

    Definition Classes
    GenericClassifierParams
  8. def getMaxEpochs: Int

    Maximum number of epochs to train

    Maximum number of epochs to train

    Definition Classes
    GenericClassifierParams
  9. def getModelFile: String

    Model file name

    Model file name

    Definition Classes
    GenericClassifierParams
  10. def getMultiClass: Boolean

    Gets the model multi class prediction mode

    Gets the model multi class prediction mode

    Definition Classes
    GenericClassifierParams
  11. def getOutputLogsPath: String

    Get output logs path

    Get output logs path

    Definition Classes
    GenericClassifierParams
  12. 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