Packages

class AssertionDLApproach extends AnnotatorApproach[AssertionDLModel] with Logging with CheckLicense

Contains all the methods for training an AssertionDLModel. For pretrained models please use AssertionDLModel and see the Models Hub for available models.

Example

First, pipeline stages for pre-processing the dataset (containing columns for text and label) are defined.

val document = new DocumentAssembler()
  .setInputCol("text")
  .setOutputCol("document")
val chunk = new Doc2Chunk()
  .setInputCols("document")
  .setOutputCol("chunk")
val token = new Tokenizer()
  .setInputCols("document")
  .setOutputCol("token")
val embeddings = WordEmbeddingsModel.pretrained("embeddings_clinical", "en", "clinical/models")
  .setInputCols("document", "token")
  .setOutputCol("embeddings")

Define AssertionDLApproach with parameters and start training

val assertionStatus = new AssertionDLApproach()
  .setLabelCol("label")
  .setInputCols("document", "chunk", "embeddings")
  .setOutputCol("assertion")
  .setBatchSize(128)
  .setDropout(0.012f)
  .setLearningRate(0.015f)
  .setEpochs(1)
  .setStartCol("start")
  .setEndCol("end")
  .setMaxSentLen(250)

val trainingPipeline = new Pipeline().setStages(Array(
  document,
  chunk,
  token,
  embeddings,
  assertionStatus
))

val assertionModel = trainingPipeline.fit(data)
val assertionResults = assertionModel.transform(data).cache()
See also

AssertionDLModel for using pretrained models

AssertionLogRegModel for non deep learning based extraction

Linear Supertypes
CheckLicense, Logging, AnnotatorApproach[AssertionDLModel], CanBeLazy, DefaultParamsWritable, MLWritable, HasOutputAnnotatorType, HasOutputAnnotationCol, HasInputAnnotationCols, Estimator[AssertionDLModel], PipelineStage, Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. AssertionDLApproach
  2. CheckLicense
  3. Logging
  4. AnnotatorApproach
  5. CanBeLazy
  6. DefaultParamsWritable
  7. MLWritable
  8. HasOutputAnnotatorType
  9. HasOutputAnnotationCol
  10. HasInputAnnotationCols
  11. Estimator
  12. PipelineStage
  13. Logging
  14. Params
  15. Serializable
  16. Serializable
  17. Identifiable
  18. AnyRef
  19. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AssertionDLApproach()
  2. new AssertionDLApproach(uid: String)

    uid

    a unique identifier for the instantiated AnnotatorModel

Type Members

  1. type AnnotatorType = String
    Definition Classes
    HasOutputAnnotatorType

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def $[T](param: Param[T]): T
    Attributes
    protected
    Definition Classes
    Params
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def _fit(dataset: Dataset[_], recursiveStages: Option[PipelineModel]): AssertionDLModel
    Attributes
    protected
    Definition Classes
    AnnotatorApproach
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. val batchSize: IntParam

    Size for each batch in the optimization process (Default: 64)

  8. def beforeTraining(spark: SparkSession): Unit
    Definition Classes
    AnnotatorApproach
  9. final def checkSchema(schema: StructType, inputAnnotatorType: String): Boolean
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  10. def checkValidEnvironment(spark: Option[SparkSession]): Unit
    Definition Classes
    CheckLicense
  11. def checkValidScope(scope: String): Unit
    Definition Classes
    CheckLicense
  12. def checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  13. def checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  14. val chunkCol: Param[String]

    Column with extracted NER chunks

  15. final def clear(param: Param[_]): AssertionDLApproach.this.type
    Definition Classes
    Params
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  17. val configProtoBytes: IntArrayParam

    ConfigProto from tensorflow, serialized into byte array.

    ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()

  18. final def copy(extra: ParamMap): Estimator[AssertionDLModel]
    Definition Classes
    AnnotatorApproach → Estimator → PipelineStage → Params
  19. def copyValues[T <: Params](to: T, extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  20. final def defaultCopy[T <: Params](extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  21. val description: String
    Definition Classes
    AssertionDLApproach → AnnotatorApproach
  22. val dropout: FloatParam

    Dropout at the output of each layer (Default: 0.05f)

  23. val enableOutputLogs: BooleanParam

    Whether to output to annotators log folder (Default: false)

  24. val endCol: Param[String]

    Column with token number for last target token

  25. val epochs: IntParam

    Number of epochs for the optimization process (Default: 5)

  26. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  28. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  29. def explainParams(): String
    Definition Classes
    Params
  30. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  31. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  32. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. final def fit(dataset: Dataset[_]): AssertionDLModel
    Definition Classes
    AnnotatorApproach → Estimator
  34. def fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[AssertionDLModel]
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  35. def fit(dataset: Dataset[_], paramMap: ParamMap): AssertionDLModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  36. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): AssertionDLModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  37. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  38. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  39. def getConfigProtoBytes: Option[Array[Byte]]

    ConfigProto from tensorflow, serialized into byte array.

    ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()

  40. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  41. def getEnableOutputLogs: Boolean

    Whether to output to annotators log folder

  42. def getIncludeConfidence: Boolean

    whether to include confidence scores in annotation metadata

  43. def getInputCols: Array[String]
    Definition Classes
    HasInputAnnotationCols
  44. def getLazyAnnotator: Boolean
    Definition Classes
    CanBeLazy
  45. def getLogName: String
    Definition Classes
    Logging
  46. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  47. final def getOutputCol: String
    Definition Classes
    HasOutputAnnotationCol
  48. def getOutputLogsPath: String

    Folder path to save training logs

  49. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  50. def getScopeWindow: (Int, Int)

    Get scope window

  51. val graphFile: Param[String]

    File path that contain external graph file

  52. val graphFolder: Param[String]

    Folder path that contain external graph files

  53. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  54. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  55. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  56. val includeConfidence: BooleanParam

    Whether to include confidence scores in annotation metadata

  57. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  58. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  59. val inputAnnotatorTypes: Array[String]

    Input Annotator Types: DOCUMENT, CHUNK, WORD_EMBEDDINGS

    Input Annotator Types: DOCUMENT, CHUNK, WORD_EMBEDDINGS

    Definition Classes
    AssertionDLApproach → HasInputAnnotationCols
  60. final val inputCols: StringArrayParam
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  61. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  62. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  63. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  64. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  65. val labelCol: Param[String]

    Column with one label per document.

    Column with one label per document. Example of possible values: “present”, “absent”, “hypothetical”, “conditional”, “associated_with_other_person”, etc.

  66. val lazyAnnotator: BooleanParam
    Definition Classes
    CanBeLazy
  67. val learningRate: FloatParam

    Learning rate for the optimization process (Default: 0.0012f)

  68. def log(value: ⇒ String, minLevel: Level): Unit
    Attributes
    protected
    Definition Classes
    Logging
  69. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  70. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  71. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  72. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  73. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  74. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  75. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  76. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  77. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  78. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  79. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  80. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  81. val logger: Logger
    Attributes
    protected
    Definition Classes
    Logging
  82. val maxSentLen: IntParam

    Max possible length of a sentence, must match graph model (Default: 250)

  83. def msgHelper(schema: StructType): String
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  84. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  85. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  86. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  87. def onTrained(model: AssertionDLModel, spark: SparkSession): Unit
    Definition Classes
    AnnotatorApproach
  88. val optionalInputAnnotatorTypes: Array[String]
    Definition Classes
    HasInputAnnotationCols
  89. val outputAnnotatorType: AnnotatorType

    Output annotator type: ASSERTION

    Output annotator type: ASSERTION

    Definition Classes
    AssertionDLApproach → HasOutputAnnotatorType
  90. final val outputCol: Param[String]
    Attributes
    protected
    Definition Classes
    HasOutputAnnotationCol
  91. def outputLog(value: ⇒ String, uuid: String, shouldLog: Boolean, outputLogsPath: String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  92. val outputLogsPath: Param[String]

    Folder path to save training logs

  93. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  94. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  95. val scopeWindow: IntArrayParam

    The scope window of the assertion (whole sentence by default)

  96. final def set(paramPair: ParamPair[_]): AssertionDLApproach.this.type
    Attributes
    protected
    Definition Classes
    Params
  97. final def set(param: String, value: Any): AssertionDLApproach.this.type
    Attributes
    protected
    Definition Classes
    Params
  98. final def set[T](param: Param[T], value: T): AssertionDLApproach.this.type
    Definition Classes
    Params
  99. def setBatchSize(size: Int): AssertionDLApproach.this.type

    Size for each batch in the optimization process

  100. def setChunkCol(c: String): AssertionDLApproach.this.type

    Column with extracted NER chunks

  101. def setConfigProtoBytes(bytes: Array[Int]): AssertionDLApproach.this.type

    ConfigProto from tensorflow, serialized into byte array.

    ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()

  102. final def setDefault(paramPairs: ParamPair[_]*): AssertionDLApproach.this.type
    Attributes
    protected
    Definition Classes
    Params
  103. final def setDefault[T](param: Param[T], value: T): AssertionDLApproach.this.type
    Attributes
    protected
    Definition Classes
    Params
  104. def setDropout(factor: Float): AssertionDLApproach.this.type

    Dropout at the output of each layer

  105. def setEnableOutputLogs(v: Boolean): AssertionDLApproach.this.type

    Whether to output to annotators log folder

  106. def setEndCol(e: String): AssertionDLApproach.this.type

    Column with token number for last target token

  107. def setEpochs(number: Int): AssertionDLApproach.this.type

    Number of epochs for the optimization process

  108. def setGraphFile(path: String): AssertionDLApproach.this.type

    Folder path that contain external graph files

  109. def setGraphFolder(path: String): AssertionDLApproach.this.type

    Folder path that contain external graph files

  110. def setIncludeConfidence(value: Boolean): AssertionDLApproach.this.type

    Whether to include confidence scores in annotation metadata

  111. final def setInputCols(value: String*): AssertionDLApproach.this.type
    Definition Classes
    HasInputAnnotationCols
  112. def setInputCols(value: Array[String]): AssertionDLApproach.this.type
    Definition Classes
    HasInputAnnotationCols
  113. def setLabelCol(label: String): AssertionDLApproach.this.type

    Column with one label per document

  114. def setLazyAnnotator(value: Boolean): AssertionDLApproach.this.type
    Definition Classes
    CanBeLazy
  115. def setLearningRate(rate: Float): AssertionDLApproach.this.type

    Learning rate for the optimization process

  116. def setMaxSentLen(len: Int): AssertionDLApproach.this.type

    Max possible length of a sentence, must match graph model

  117. final def setOutputCol(value: String): AssertionDLApproach.this.type
    Definition Classes
    HasOutputAnnotationCol
  118. def setOutputLogsPath(v: String): AssertionDLApproach.this.type

    Folder path to save training logs

  119. def setScopeWindow(window: (Int, Int)): AssertionDLApproach.this.type

    Max possible length of a sentence.

  120. def setStartCol(s: String): AssertionDLApproach.this.type

    Column with token number for first target token

  121. def setValidationSplit(validationSplit: Float): AssertionDLApproach.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.

  122. def setVerbose(verbose: Level): AssertionDLApproach.this.type

    Level of verbosity during training

  123. val startCol: Param[String]

    Column with token number for first target token

  124. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  125. val testDataset: ExternalResourceParam

    Path to test dataset.

    Path to test dataset. If set used to calculate statistic on it during training

  126. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  127. def train(dataset: Dataset[_], recursivePipeline: Option[PipelineModel]): AssertionDLModel

    Trains the dataset with recursive pipeline and uses methods trainWithChunk() and trainwithStartEnd() The choice of training happens based on the startCol value of the DL Approach

    Trains the dataset with recursive pipeline and uses methods trainWithChunk() and trainwithStartEnd() The choice of training happens based on the startCol value of the DL Approach

    dataset

    a collection of inputs to train

    recursivePipeline

    an instance of PipelineModel

    returns

    an instance of trained AssertionDLModel

    Definition Classes
    AssertionDLApproach → AnnotatorApproach
  128. final def transformSchema(schema: StructType): StructType
    Definition Classes
    AnnotatorApproach → PipelineStage
  129. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  130. val uid: String
    Definition Classes
    AssertionDLApproach → Identifiable
  131. def validate(schema: StructType): Boolean
    Attributes
    protected
    Definition Classes
    AnnotatorApproach
  132. val validationSplit: FloatParam

    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.

  133. val verbose: IntParam

    Level of verbosity during training

  134. val verboseLevel: Level
    Definition Classes
    AssertionDLApproach → Logging
  135. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  136. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  137. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  138. def write: MLWriter
    Definition Classes
    DefaultParamsWritable → MLWritable

Inherited from CheckLicense

Inherited from Logging

Inherited from AnnotatorApproach[AssertionDLModel]

Inherited from CanBeLazy

Inherited from DefaultParamsWritable

Inherited from MLWritable

Inherited from HasOutputAnnotatorType

Inherited from HasOutputAnnotationCol

Inherited from HasInputAnnotationCols

Inherited from Estimator[AssertionDLModel]

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

Members

Parameter setters

Parameter getters