class_docstr: Algorithm for training a Named Entity Recognition Model
  
  For instantiated/pretrained models, see :class:`.NerCrfModel`.
  
  This Named Entity recognition annotator allows for a generic model to be
  trained by utilizing a CRF machine learning algorithm. The training data
  should be a labeled Spark Dataset, e.g. :class:`.CoNLL` 2003 IOB with
  `Annotation` type columns. The data should have columns of type
  ``DOCUMENT, TOKEN, POS, WORD_EMBEDDINGS`` and an additional label column of
  annotator type ``NAMED_ENTITY``.
  
  Excluding the label, this can be done with for example:
  
  - a :class:`.SentenceDetector`,
  - a :class:`.Tokenizer`,
  - a :class:`.PerceptronModel` and
  - a :class:`.WordEmbeddingsModel`.
  
  Optionally the user can provide an entity dictionary file with
  :meth:`.setExternalFeatures` for better accuracy.
  
  For extended examples of usage, see the `Examples <https://github.com/JohnSnowLabs/spark-nlp/blob/master/examples/python/training/english/crf-ner/ner_dl_crf.ipynb>`__.
  
  ========================================= ======================
  Input Annotation types                    Output Annotation type
  ========================================= ======================
  ``DOCUMENT, TOKEN, POS, WORD_EMBEDDINGS`` ``NAMED_ENTITY``
  ========================================= ======================
  
  Parameters
  ----------
  labelColumn
      Column with label per each token
  entities
      Entities to recognize
  minEpochs
      Minimum number of epochs to train, by default 0
  maxEpochs
      Maximum number of epochs to train, by default 1000
  verbose
      Level of verbosity during training, by default 4
  randomSeed
      Random seed
  l2
      L2 regularization coefficient, by default 1.0
  c0
      c0 params defining decay speed for gradient, by default 2250000
  lossEps
      If Epoch relative improvement less than eps then training is stopped, by
      default 0.001
  minW
      Features with less weights then this param value will be filtered
  includeConfidence
      Whether to include confidence scores in annotation metadata, by default
      False
  externalFeatures
      Additional dictionaries paths to use as a features
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from sparknlp.training import *
  >>> from pyspark.ml import Pipeline
  
  This CoNLL dataset already includes a sentence, token, POS tags and label
  column with their respective annotator types. If a custom dataset is used,
  these need to be defined with for example:
  
  >>> documentAssembler = DocumentAssembler() \
  ...     .setInputCol("text") \
  ...     .setOutputCol("document")
  >>> sentence = SentenceDetector() \
  ...     .setInputCols(["document"]) \
  ...     .setOutputCol("sentence")
  >>> tokenizer = Tokenizer() \
  ...     .setInputCols(["sentence"]) \
  ...     .setOutputCol("token")
  >>> posTagger = PerceptronModel.pretrained() \
  ...     .setInputCols(["sentence", "token"]) \
  ...     .setOutputCol("pos")
  
  Then training can start:
  
  >>> embeddings = WordEmbeddingsModel.pretrained() \
  ...     .setInputCols(["sentence", "token"]) \
  ...     .setOutputCol("embeddings") \
  ...     .setCaseSensitive(False)
  >>> nerTagger = NerCrfApproach() \
  ...     .setInputCols(["sentence", "token", "pos", "embeddings"]) \
  ...     .setLabelColumn("label") \
  ...     .setMinEpochs(1) \
  ...     .setMaxEpochs(3) \
  ...     .setOutputCol("ner")
  >>> pipeline = Pipeline().setStages([
  ...     embeddings,
  ...     nerTagger
  ... ])
  
  We use the sentences, tokens, POS tags and labels from the CoNLL dataset.
  
  >>> conll = CoNLL()
  >>> trainingData = conll.readDataset(spark, "src/test/resources/conll2003/eng.train")
  >>> pipelineModel = pipeline.fit(trainingData)
  
  See Also
  --------
  NerDLApproach : for a deep learning based approach
  NerConverter : to further process the results
class_docstr_tok: ["Algorithm","for","training","a","Named","Entity","Recognition","Model","For","instantiated\/pretrained","models",",","see",":","class",":","`",".NerCrfModel","`",".","This","Named","Entity","recognition","annotator","allows","for","a","generic","model","to","be","trained","by","utilizing","a","CRF","machine","learning","algorithm",".","The","training","data","should","be","a","labeled","Spark","Dataset",",","e.g",".",":","class",":","`",".CoNLL","`","2003","IOB","with","`","Annotation","`","type","columns",".","The","data","should","have","columns","of","type","``","DOCUMENT",",","TOKEN",",","POS",",","WORD_EMBEDDINGS","``","and","an","additional","label","column","of","annotator","type","``","NAMED_ENTITY","``",".","Excluding","the","label",",","this","can","be","done","with","for","example",":","-","a",":","class",":","`",".SentenceDetector","`",",","-","a",":","class",":","`",".Tokenizer","`",",","-","a",":","class",":","`",".PerceptronModel","`","and","-","a",":","class",":","`",".WordEmbeddingsModel","`",".","Optionally","the","user","can","provide","an","entity","dictionary","file","with",":","meth",":","`",".setExternalFeatures","`","for","better","accuracy",".","For","extended","examples","of","usage",",","see","the","`","Examples","<","https",":","\/\/github.com\/JohnSnowLabs\/spark-nlp\/blob\/master\/examples\/python\/training\/english\/crf-ner\/ner_dl_crf.ipynb",">","`","__",".","=========================================","======================","Input","Annotation","types","Output","Annotation","type","=========================================","======================","``","DOCUMENT",",","TOKEN",",","POS",",","WORD_EMBEDDINGS","``","``","NAMED_ENTITY","``","=========================================","======================","Parameters","--","--","--","--","--","labelColumn","Column","with","label","per","each","token","entities","Entities","to","recognize","minEpochs","Minimum","number","of","epochs","to","train",",","by","default","0","maxEpochs","Maximum","number","of","epochs","to","train",",","by","default","1000","verbose","Level","of","verbosity","during","training",",","by","default","4","randomSeed","Random","seed","l2","L2","regularization","coefficient",",","by","default","1.0","c0","c0","params","defining","decay","speed","for","gradient",",","by","default","2250000","lossEps","If","Epoch","relative","improvement","less","than","eps","then","training","is","stopped",",","by","default","0.001","minW","Features","with","less","weights","then","this","param","value","will","be","filtered","includeConfidence","Whether","to","include","confidence","scores","in","annotation","metadata",",","by","default","False","externalFeatures","Additional","dictionaries","paths","to","use","as","a","features","Examples","--","--","--","--",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","sparknlp.training","import","*",">",">",">","from","pyspark.ml","import","Pipeline","This","CoNLL","dataset","already","includes","a","sentence",",","token",",","POS","tags","and","label","column","with","their","respective","annotator","types",".","If","a","custom","dataset","is","used",",","these","need","to","be","defined","with","for","example",":",">",">",">","documentAssembler","=","DocumentAssembler","(",")","\\","...",".setInputCol","(","``","text","''",")","\\","...",".setOutputCol","(","``","document","''",")",">",">",">","sentence","=","SentenceDetector","(",")","\\","...",".setInputCols","(","[","``","document","''","]",")","\\","...",".setOutputCol","(","``","sentence","''",")",">",">",">","tokenizer","=","Tokenizer","(",")","\\","...",".setInputCols","(","[","``","sentence","''","]",")","\\","...",".setOutputCol","(","``","token","''",")",">",">",">","posTagger","=","PerceptronModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''","]",")","\\","...",".setOutputCol","(","``","pos","''",")","Then","training","can","start",":",">",">",">","embeddings","=","WordEmbeddingsModel.pretrained","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''","]",")","\\","...",".setOutputCol","(","``","embeddings","''",")","\\","...",".setCaseSensitive","(","False",")",">",">",">","nerTagger","=","NerCrfApproach","(",")","\\","...",".setInputCols","(","[","``","sentence","''",",","``","token","''",",","``","pos","''",",","``","embeddings","''","]",")","\\","...",".setLabelColumn","(","``","label","''",")","\\","...",".setMinEpochs","(","1",")","\\","...",".setMaxEpochs","(","3",")","\\","...",".setOutputCol","(","``","ner","''",")",">",">",">","pipeline","=","Pipeline","(",")",".setStages","(","[","...","embeddings",",","...","nerTagger","...","]",")","We","use","the","sentences",",","tokens",",","POS","tags","and","labels","from","the","CoNLL","dataset",".",">",">",">","conll","=","CoNLL","(",")",">",">",">","trainingData","=","conll.readDataset","(","spark",",","``","src\/test\/resources\/conll2003\/eng.train","''",")",">",">",">","pipelineModel","=","pipeline.fit","(","trainingData",")","See","Also","--","--","--","--","NerDLApproach",":","for","a","deep","learning","based","approach","NerConverter",":","to","further","process","the","results"]
docstr: Sets minimum weight value.
  
  Features with less weights then this param value will be filtered.
  
  Parameters
  ----------
  w : float
      Minimum weight value
docstr_tok: ["Sets","minimum","weight","value",".","Features","with","less","weights","then","this","param","value","will","be","filtered",".","Parameters","--","--","--","--","--","w",":","float","Minimum","weight","value"]
code: def setMinW(self, w):
      """Sets minimum weight value.
  
      Features with less weights then this param value will be filtered.
  
      Parameters
      ----------
      w : float
          Minimum weight value
      """
      return self._set(minW=w)
  
file_path: spark-nlp/python/sparknlp/annotator/ner/ner_crf.py
imports: from sparknlp.common import *
  from sparknlp.annotator.ner.ner_approach import NerApproach
label_desc: Use image node_id 4 for calling the NerCrfApproach obj's underlying member method code with example usage: obj.setMinW(w) and returns: self