package generic_classifier
- Alphabetic
- Public
- All
Type Members
-
class
GenericClassifierApproach extends AnnotatorApproach[GenericClassifierModel] with GenericClassifierParams with HandleExceptionParams with CheckLicense
Trains a TensorFlow model for generic classification of feature vectors.
Trains a TensorFlow model for generic classification of feature vectors. It takes FEATURE_VECTOR annotations from
FeaturesAssembler
as input, classifies them and outputs CATEGORY annotations. Please see the Parameters section for required training parameters.For a more extensive example please see the Spark NLP Workshop.
Example
val features_asm = new FeaturesAssembler() .setInputCols(Array("feature_1", "feature_2", "...", "feature_n")) .setOutputCol("features") val gen_clf = new GenericClassifierApproach() .setLabelColumn("target") .setInputCols("features") .setOutputCol("prediction") .setModelFile("/path/to/graph_file.pb") .setEpochsNumber(50) .setBatchSize(100) .setFeatureScaling("zscore") .setlearningRate(0.001f) .setFixImbalance(true) .setOutputLogsPath("logs") .setValidationSplit(0.2f) // keep 20% of the data for validation purposes val pipeline = new Pipeline().setStages(Array( features_asm, gen_clf )) val clf_model = pipeline.fit(data)
- See also
GenericClassifierModel for the trained model
-
class
GenericClassifierDataEncoder extends Serializable
- Annotations
- @SerialVersionUID()
-
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.
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
- trait GenericClassifierParams extends Params
- trait ReadablePretrainedGenericClassifier[T <: GenericClassifierModel] extends ParamsAndFeaturesReadable[T] with HasPretrained[T]
- trait ReadsGenericClassifierGraph[T <: GenericClassifierModel] extends ParamsAndFeaturesReadable[T] with ReadTensorflowModel
Value Members
- object GenericClassifierApproach extends DefaultParamsReadable[GenericClassifierApproach] with Serializable
- object GenericClassifierModel extends ReadsGenericClassifierGraph[GenericClassifierModel] with ReadablePretrainedGenericClassifier[GenericClassifierModel] with Serializable