class_docstr: Trains a ClassifierDL for generic Multi-class Text Classification.
  
  ClassifierDL uses the state-of-the-art Universal Sentence Encoder as an
  input for text classifications.
  The ClassifierDL annotator uses a deep learning model (DNNs) we have built
  inside TensorFlow and supports up to 100 classes.
  
  For instantiated/pretrained models, see :class:`.ClassifierDLModel`.
  
  Setting a test dataset to monitor model metrics can be done with
  ``.setTestDataset``. The method expects a path to a parquet file containing a
  dataframe that has the same required columns as the training dataframe. The
  pre-processing steps for the training dataframe should also be applied to the test
  dataframe. The following example will show how to create the test dataset:
  
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> embeddings = UniversalSentenceEncoder.pretrained() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("sentence_embeddings")
  >>> preProcessingPipeline = Pipeline().setStages([documentAssembler, embeddings])
  >>> (train, test) = data.randomSplit([0.8, 0.2])
  >>> preProcessingPipeline \
  ...     .fit(test) \
  ...     .transform(test)
  ...     .write \
  ...     .mode("overwrite") \
  ...     .parquet("test_data")
  >>> classifier = ClassifierDLApproach() \
  ...     .setInputCols(["sentence_embeddings"]) \
  ...     .setOutputCol("category") \
  ...     .setLabelColumn("label") \
  ...     .setTestDataset("test_data")
  
  For extended examples of usage, see the Examples
  `Examples  <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/training/english/classification/ClassifierDL_Train_multi_class_news_category_classifier.ipynb>`__.
  
  ======================= ======================
  Input Annotation types  Output Annotation type
  ======================= ======================
  ``SENTENCE_EMBEDDINGS`` ``CATEGORY``
  ======================= ======================
  
  Parameters
  ----------
  batchSize
      Batch size, by default 64
  configProtoBytes
      ConfigProto from tensorflow, serialized into byte array.
  dropout
      Dropout coefficient, by default 0.5
  enableOutputLogs
      Whether to use stdout in addition to Spark logs, by default False
  evaluationLogExtended
      Whether logs for validation to be extended: it displays time and evaluation of
      each label. Default is False.
  labelColumn
      Column with label per each token
  lr
      Learning Rate, by default 0.005
  maxEpochs
      Maximum number of epochs to train, by default 30
  outputLogsPath
      Folder path to save training logs
  randomSeed
      Random seed for shuffling
  testDataset
      Path to test dataset. If set used to calculate statistic on it during training.
  validationSplit
      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.
  verbose
      Level of verbosity during training
  
  Notes
  -----
  - This annotator accepts a label column of a single item in either type of
    String, Int, Float, or Double.
  - UniversalSentenceEncoder, Transformer based embeddings, or
    SentenceEmbeddings can be used for the ``inputCol``.
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  
  In this example, the training data ``"sentiment.csv"`` has the form of::
  
      text,label
      This movie is the best movie I have wached ever! In my opinion this movie can win an award.,0
      This was a terrible movie! The acting was bad really bad!,1
      ...
  
  Then traning can be done like so:
  
  >>> smallCorpus = spark.read.option("header","True").csv("src/test/resources/classifier/sentiment.csv")
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> useEmbeddings = UniversalSentenceEncoder.pretrained() \
  ...     .setInputCols("document") \
  ...     .setOutputCol("sentence_embeddings")
  >>> docClassifier = ClassifierDLApproach() \
  ...     .setInputCols("sentence_embeddings") \
  ...     .setOutputCol("category") \
  ...     .setLabelColumn("label") \
  ...     .setBatchSize(64) \
  ...     .setMaxEpochs(20) \
  ...     .setLr(5e-3) \
  ...     .setDropout(0.5)
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     useEmbeddings,
  ...     docClassifier
  ... ])
  >>> pipelineModel = pipeline.fit(smallCorpus)
  
  See Also
  --------
  MultiClassifierDLApproach : for multi-class classification
  SentimentDLApproach : for sentiment analysis
class_docstr_tok: ["Trains","a","ClassifierDL","for","generic","Multi-class","Text","Classification",".","ClassifierDL","uses","the","state-of-the-art","Universal","Sentence","Encoder","as","an","input","for","text","classifications",".","The","ClassifierDL","annotator","uses","a","deep","learning","model","(","DNNs",")","we","have","built","inside","TensorFlow","and","supports","up","to","100","classes",".","For","instantiated\/pretrained","models",",","see",":","class",":","`",".ClassifierDLModel","`",".","Setting","a","test","dataset","to","monitor","model","metrics","can","be","done","with","``",".setTestDataset","``",".","The","method","expects","a","path","to","a","parquet","file","containing","a","dataframe","that","has","the","same","required","columns","as","the","training","dataframe",".","The","pre-processing","steps","for","the","training","dataframe","should","also","be","applied","to","the","test","dataframe",".","The","following","example","will","show","how","to","create","the","test","dataset",":",">",">",">","documentAssembler","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","embeddings","=","UniversalSentenceEncoder.pretrained","(",")","\\","...",".setInputCols","(","[","``","document","''","]",")","\\","...",".setOutputCol","(","``","sentence_embeddings","''",")",">",">",">","preProcessingPipeline","=","Pipeline","(",")",".setStages","(","[","documentAssembler",",","embeddings","]",")",">",">",">","(","train",",","test",")","=","data.randomSplit","(","[","0.8",",","0.2","]",")",">",">",">","preProcessingPipeline","\\","...",".fit","(","test",")","\\","...",".transform","(","test",")","...",".write","\\","...",".mode","(","``","overwrite","''",")","\\","...",".parquet","(","``","test_data","''",")",">",">",">","classifier","=","ClassifierDLApproach","(",")","\\","...",".setInputCols","(","[","``","sentence_embeddings","''","]",")","\\","...",".setOutputCol","(","``","category","''",")","\\","...",".setLabelColumn","(","``","label","''",")","\\","...",".setTestDataset","(","``","test_data","''",")","For","extended","examples","of","usage",",","see","the","Examples","`","Examples","<","https",":","\/\/github.com\/JohnSnowLabs\/spark-nlp\/blob\/master\/examples\/python\/training\/english\/classification\/ClassifierDL_Train_multi_class_news_category_classifier.ipynb",">","`","__",".","=======================","======================","Input","Annotation","types","Output","Annotation","type","=======================","======================","``","SENTENCE_EMBEDDINGS","``","``","CATEGORY","``","=======================","======================","Parameters","--","--","--","--","--","batchSize","Batch","size",",","by","default","64","configProtoBytes","ConfigProto","from","tensorflow",",","serialized","into","byte","array",".","dropout","Dropout","coefficient",",","by","default","0.5","enableOutputLogs","Whether","to","use","stdout","in","addition","to","Spark","logs",",","by","default","False","evaluationLogExtended","Whether","logs","for","validation","to","be","extended",":","it","displays","time","and","evaluation","of","each","label",".","Default","is","False",".","labelColumn","Column","with","label","per","each","token","lr","Learning","Rate",",","by","default","0.005","maxEpochs","Maximum","number","of","epochs","to","train",",","by","default","30","outputLogsPath","Folder","path","to","save","training","logs","randomSeed","Random","seed","for","shuffling","testDataset","Path","to","test","dataset",".","If","set","used","to","calculate","statistic","on","it","during","training",".","validationSplit","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",".","verbose","Level","of","verbosity","during","training","Notes","--","--","-","-","This","annotator","accepts","a","label","column","of","a","single","item","in","either","type","of","String",",","Int",",","Float",",","or","Double",".","-","UniversalSentenceEncoder",",","Transformer","based","embeddings",",","or","SentenceEmbeddings","can","be","used","for","the","``","inputCol","``",".","Examples","--","--","--","--",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","pyspark.ml","import","Pipeline","In","this","example",",","the","training","data","``","``","sentiment.csv","''","``","has","the","form","of",":",":","text",",","label","This","movie","is","the","best","movie","I","have","wached","ever","!","In","my","opinion","this","movie","can","win","an","award.,0","This","was","a","terrible","movie","!","The","acting","was","bad","really","bad","!",",1","...","Then","traning","can","be","done","like","so",":",">",">",">","smallCorpus","=","spark.read.option","(","``","header","''",",","''","True","''",")",".csv","(","``","src\/test\/resources\/classifier\/sentiment.csv","''",")",">",">",">","documentAssembler","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","useEmbeddings","=","UniversalSentenceEncoder.pretrained","(",")","\\","...",".setInputCols","(","``","document","''",")","\\","...",".setOutputCol","(","``","sentence_embeddings","''",")",">",">",">","docClassifier","=","ClassifierDLApproach","(",")","\\","...",".setInputCols","(","``","sentence_embeddings","''",")","\\","...",".setOutputCol","(","``","category","''",")","\\","...",".setLabelColumn","(","``","label","''",")","\\","...",".setBatchSize","(","64",")","\\","...",".setMaxEpochs","(","20",")","\\","...",".setLr","(","5e-3",")","\\","...",".setDropout","(","0.5",")",">",">",">","pipeline","=","Pipeline","(",")",".setStages","(","[","...","documentAssembler",",","...","useEmbeddings",",","...","docClassifier","...","]",")",">",">",">","pipelineModel","=","pipeline.fit","(","smallCorpus",")","See","Also","--","--","--","--","MultiClassifierDLApproach",":","for","multi-class","classification","SentimentDLApproach",":","for","sentiment","analysis"]
code: def __init__(self):
      super(ClassifierDLApproach, self).__init__(
          classname="com.johnsnowlabs.nlp.annotators.classifier.dl.ClassifierDLApproach"
      )
      self._setDefault(
          maxEpochs=30,
          lr=float(0.005),
          batchSize=64,
          dropout=float(0.5),
          enableOutputLogs=False,
          evaluationLogExtended=False,
      )
  
file_path: spark-nlp/python/sparknlp/annotator/classifier_dl/classifier_dl.py
imports: from sparknlp.annotator.param import EvaluationDLParams, ClassifierEncoder
  from sparknlp.base import DocumentAssembler
  from sparknlp.common import *
label_desc: Use image node_id 3 to create a new ClassifierDLApproach object from inherited base classes: AnnotatorApproach, EvaluationDLParams, ClassifierEncoder with example: obj = ClassifierDLApproach()