class ZeroShotRelationExtractionModel extends MedicalBertForSequenceClassification with RelationEncoding with HasEngine

ZeroShotRelationExtractionModel implements zero shot binary relations extraction by utilizing BERT transformer models trained on the NLI (Natural Language Inference) task. The model inputs consists of documents/sentences and paired NER chunks, usually obtained by RENerChunksFilter. The definitions of relations which are extracted is given by a dictionary structures, specifying a set of statements regarding the relationship of named entities. These statements are automatically appended to each document in the dataset and the NLI model is used to determine whether a particular relationship between entities.

Pretrained models can be loaded with pretrained of the companion object:

val zeroShotRE = ZeroShotRelationExtractionModel.pretrained()
  .setInputCols("token", "document")
  .setOutputCol("label")

For available pretrained models please see the Models Hub.

Example

val documentAssembler = new DocumentAssembler()
  .setInputCol("text")
  .setOutputCol("document")

val tokenizer = new Tokenizer()
  .setInputCols(Array("document"))
  .setOutputCol("tokens")

val sentencer = new SentenceDetector()
  .setInputCols(Array("document"))
  .setOutputCol("sentences")

val embeddings = WordEmbeddingsModel
  .pretrained("embeddings_clinical", "en", "clinical/models")
  .setInputCols(Array("sentences", "tokens"))
  .setOutputCol("embeddings")

val posTagger = PerceptronModel
  .pretrained("pos_clinical", "en", "clinical/models")
  .setInputCols(Array("sentences", "tokens"))
  .setOutputCol("posTags")

val nerTagger = MedicalNerModel
  .pretrained("ner_clinical", "en", "clinical/models")
  .setInputCols(Array("sentences", "tokens", "embeddings"))
  .setOutputCol("nerTags")

val nerConverter = new NerConverter()
  .setInputCols(Array("sentences", "tokens", "nerTags"))
  .setOutputCol("nerChunks")

val dependencyParser = DependencyParserModel
  .pretrained("dependency_conllu", "en")
  .setInputCols(Array("document", "posTags", "tokens"))
  .setOutputCol("dependencies")

val reNerFilter = new RENerChunksFilter()
  .setRelationPairs(Array("problem-test","problem-treatment"))
  .setMaxSyntacticDistance(4)
  .setDocLevelRelations(false)
  .setInputCols(Array("nerChunks", "dependencies"))
  .setOutputCol("RENerChunks")

val re = ZeroShotRelationExtractionModel
  .load("/tmp/spark_sbert_zero_shot")
  .setRelationalCategories(
    Map(
      "CURE" -> Array("{TREATMENT} cures {PROBLEM}."),
      "IMPROVE" -> Array("{TREATMENT} improves {PROBLEM}.", "{TREATMENT} cures {PROBLEM}."),
      "REVEAL" -> Array("{TEST} reveals {PROBLEM}.")
      ))
  .setPredictionThreshold(0.9f)
  .setMultiLabel(false)
  .setInputCols(Array("sentences", "RENerChunks"))
  .setOutputCol("relations)

val pipeline = new Pipeline()
  .setStages(Array(
    documentAssembler,
    sentencer,
    tokenizer,
    embeddings,
    posTagger,
    nerTagger,
    nerConverter,
    dependencyParser,
    reNerFilter,
    re))

val model = pipeline.fit(Seq("").toDS.toDF("text"))
val results = model.transform(
  Seq("Paracetamol can alleviate headache or sickness. An MRI test can be used to find cancer.").toDS.toDF("text"))

results
  .selectExpr("EXPLODE(relations) as relation")
  .selectExpr("relation.result", "relation.metadata.confidence")
  .show(truncate = false)

+-------+----------+
|result |confidence|
+-------+----------+
|REVEAL |0.9760039 |
|IMPROVE|0.98819494|
|IMPROVE|0.9929625 |
+-------+----------+
See also

http://jmlr.org/papers/v21/20-074.html for details about using NLI models for zero shot categorization

RENerChunksFilter on how to generate paired named entity chunks for relation extraction

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

Instance Constructors

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

    uid

    required uid for storing annotator to disk

Type Members

  1. type AnnotationContent = Seq[Row]
    Attributes
    protected
    Definition Classes
    AnnotatorModel
  2. 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. def $$[T](feature: StructFeature[T]): T
    Attributes
    protected
    Definition Classes
    HasFeatures
  5. def $$[K, V](feature: MapFeature[K, V]): Map[K, V]
    Attributes
    protected
    Definition Classes
    HasFeatures
  6. def $$[T](feature: SetFeature[T]): Set[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  7. def $$[T](feature: ArrayFeature[T]): Array[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  8. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def _transform(dataset: Dataset[_], recursivePipeline: Option[PipelineModel]): DataFrame
    Attributes
    protected
    Definition Classes
    AnnotatorModel
  10. def afterAnnotate(dataset: DataFrame): DataFrame
    Attributes
    protected
    Definition Classes
    AnnotatorModel
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def batchAnnotate(batchedAnnotations: Seq[Array[Annotation]]): Seq[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

    batchedAnnotations

    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
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification → HasBatchedAnnotate
  13. def batchProcess(rows: Iterator[_]): Iterator[Row]
    Definition Classes
    HasBatchedAnnotate
  14. val batchSize: IntParam
    Definition Classes
    HasBatchedAnnotate
  15. def beforeAnnotate(dataset: Dataset[_]): Dataset[_]
    Attributes
    protected
    Definition Classes
    MedicalBertForSequenceClassification → AnnotatorModel
  16. val caseSensitive: BooleanParam
    Definition Classes
    HasCaseSensitiveProperties
  17. final def checkSchema(schema: StructType, inputAnnotatorType: String): Boolean
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  18. def checkValidEnvironment(spark: Option[SparkSession], scopes: Seq[String]): Unit
    Definition Classes
    CheckLicense
  19. def checkValidScope(scope: String): Unit
    Definition Classes
    CheckLicense
  20. def checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  21. def checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean): Unit
    Definition Classes
    CheckLicense
  22. final def clear(param: Param[_]): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    Params
  23. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  24. val coalesceSentences: BooleanParam

    Instead of 1 class per sentence (if inputCols is sentence) output 1 class per document by averaging probabilities in all sentences.

    Instead of 1 class per sentence (if inputCols is sentence) output 1 class per document by averaging probabilities in all sentences. Due to max sequence length limit in almost all transformer models such as BERT (512 tokens), this parameter helps feeding all the sentences into the model and averaging all the probabilities for the entire document instead of probabilities per sentence. (Default: false)

    Definition Classes
    MedicalBertForSequenceClassification
  25. val configProtoBytes: IntArrayParam

    ConfigProto from tensorflow, serialized into byte array.

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

    Definition Classes
    MedicalBertForSequenceClassification
  26. def copy(extra: ParamMap): MedicalBertForSequenceClassification
    Definition Classes
    RawAnnotator → Model → Transformer → PipelineStage → Params
  27. def copyValues[T <: Params](to: T, extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  28. final def defaultCopy[T <: Params](extra: ParamMap): T
    Attributes
    protected
    Definition Classes
    Params
  29. def encodeRelations(nerChunkAnnotations: Seq[Annotation], sentenceAnnotations: Seq[Annotation]): Seq[DLRelationInstance]
    Definition Classes
    RelationEncoding
  30. val engine: Param[String]
    Definition Classes
    HasEngine
  31. val entityVarPattern: Regex
    Attributes
    protected
  32. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  33. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  34. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  35. def explainParams(): String
    Definition Classes
    Params
  36. def extraValidate(structType: StructType): Boolean
    Attributes
    protected
    Definition Classes
    RawAnnotator
  37. def extraValidateMsg: String
    Attributes
    protected
    Definition Classes
    RawAnnotator
  38. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  39. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  40. val features: ArrayBuffer[Feature[_, _, _]]
    Definition Classes
    HasFeatures
  41. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. def get[T](feature: StructFeature[T]): Option[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  43. def get[K, V](feature: MapFeature[K, V]): Option[Map[K, V]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  44. def get[T](feature: SetFeature[T]): Option[Set[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  45. def get[T](feature: ArrayFeature[T]): Option[Array[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  46. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  47. def getBatchSize: Int
    Definition Classes
    HasBatchedAnnotate
  48. def getCaseSensitive: Boolean
    Definition Classes
    HasCaseSensitiveProperties
  49. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  50. def getClasses: Array[String]

    Returns labels used to train this model

    Returns labels used to train this model

    Definition Classes
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification
  51. def getCoalesceSentences: Boolean

  52. def getConfigProtoBytes: Option[Array[Byte]]

  53. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  54. def getEngine: String
    Definition Classes
    HasEngine
  55. def getInputCols: Array[String]
    Definition Classes
    HasInputAnnotationCols
  56. def getLazyAnnotator: Boolean
    Definition Classes
    CanBeLazy
  57. def getLicenseScopes: Seq[String]
    Attributes
    protected
    Definition Classes
    MedicalBertForSequenceClassification
  58. def getMaxSentenceLength: Int

  59. def getModelIfNotSet: MedicalBertClassification

  60. def getMultiLabel: Boolean

    Whether or not a pair of entities can be categorized by multiple relations

  61. def getNegativeRelationships: Array[String]

    Get the list of relational categories which serve as negative examples and are not included in the output annotations

  62. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  63. final def getOutputCol: String
    Definition Classes
    HasOutputAnnotationCol
  64. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  65. def getPredictionThreshold: Float

    Get the minimal confidence score to encode a relation (Default: 0.5f)

  66. def getSignatures: Option[Map[String, String]]

  67. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  68. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  69. def hasParent: Boolean
    Definition Classes
    Model
  70. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  71. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  72. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  73. val inputAnnotatorTypes: Array[AnnotatorType]

    Input annotator types : CHUNK, DOCUMENT

    Input annotator types : CHUNK, DOCUMENT

    Definition Classes
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification → HasInputAnnotationCols
  74. final val inputCols: StringArrayParam
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  75. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  76. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  77. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  78. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  79. val labels: MapFeature[String, Int]

    Labels used to decode predicted IDs back to string tags

    Labels used to decode predicted IDs back to string tags

    Definition Classes
    MedicalBertForSequenceClassification
  80. val lazyAnnotator: BooleanParam
    Definition Classes
    CanBeLazy
  81. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  82. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  83. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  84. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  85. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  86. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  87. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  88. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  89. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  90. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  91. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  92. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  93. val maxSentenceLength: IntParam

    Max sentence length to process (Default: 128)

    Max sentence length to process (Default: 128)

    Definition Classes
    MedicalBertForSequenceClassification
  94. def msgHelper(schema: StructType): String
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  95. var multiLabel: BooleanParam

    Whether or not a pair of entities can be categorized by multiple relations.

    Whether or not a pair of entities can be categorized by multiple relations. False by default.

  96. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  97. var negativeRelationships: StringArrayParam

    List of relational categories which server as negative examples and are not included in the output annotations

  98. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  99. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  100. def onWrite(path: String, spark: SparkSession): Unit
    Definition Classes
    MedicalBertForSequenceClassification → ParamsAndFeaturesWritable
  101. val optionalInputAnnotatorTypes: Array[String]
    Definition Classes
    HasInputAnnotationCols
  102. val outputAnnotatorType: String

    Output annotator type : CATEGORY

    Output annotator type : CATEGORY

    Definition Classes
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification → HasOutputAnnotatorType
  103. final val outputCol: Param[String]
    Attributes
    protected
    Definition Classes
    HasOutputAnnotationCol
  104. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  105. var parent: Estimator[MedicalBertForSequenceClassification]
    Definition Classes
    Model
  106. var predictionThreshold: FloatParam

    Minimal confidence score to encode a relation (Default: 0.5f)

  107. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  108. def sentenceEndTokenId: Int

  109. val sentenceSeparator: String
    Attributes
    protected
  110. def sentenceStartTokenId: Int

  111. def set[T](feature: StructFeature[T], value: T): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  112. def set[K, V](feature: MapFeature[K, V], value: Map[K, V]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  113. def set[T](feature: SetFeature[T], value: Set[T]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  114. def set[T](feature: ArrayFeature[T], value: Array[T]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  115. final def set(paramPair: ParamPair[_]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    Params
  116. final def set(param: String, value: Any): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    Params
  117. final def set[T](param: Param[T], value: T): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    Params
  118. def setBatchSize(size: Int): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    HasBatchedAnnotate
  119. def setCaseSensitive(value: Boolean): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    HasCaseSensitiveProperties
  120. def setCoalesceSentences(value: Boolean): ZeroShotRelationExtractionModel.this.type

  121. def setConfigProtoBytes(bytes: Array[Int]): ZeroShotRelationExtractionModel.this.type

  122. def setDefault[T](feature: StructFeature[T], value: () ⇒ T): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  123. def setDefault[K, V](feature: MapFeature[K, V], value: () ⇒ Map[K, V]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  124. def setDefault[T](feature: SetFeature[T], value: () ⇒ Set[T]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  125. def setDefault[T](feature: ArrayFeature[T], value: () ⇒ Array[T]): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    HasFeatures
  126. final def setDefault(paramPairs: ParamPair[_]*): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected
    Definition Classes
    Params
  127. final def setDefault[T](param: Param[T], value: T): ZeroShotRelationExtractionModel.this.type
    Attributes
    protected[org.apache.spark.ml]
    Definition Classes
    Params
  128. final def setInputCols(value: String*): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    HasInputAnnotationCols
  129. def setInputCols(value: Array[String]): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    HasInputAnnotationCols
  130. def setLabels(value: Map[String, Int]): ZeroShotRelationExtractionModel.this.type

  131. def setLazyAnnotator(value: Boolean): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    CanBeLazy
  132. def setMaxSentenceLength(value: Int): ZeroShotRelationExtractionModel.this.type

  133. def setModelIfNotSet(spark: SparkSession, tensorflowWrapper: TensorflowWrapper, sentenceSeparator: Option[String] = None): ZeroShotRelationExtractionModel.this.type

  134. def setModelIfNotSet(spark: SparkSession, onnxWrapper: OnnxWrapper, sentenceSeparator: Option[String]): ZeroShotRelationExtractionModel.this.type
  135. def setMultiLabel(value: Boolean): ZeroShotRelationExtractionModel.this.type

    Whether or not a pair of entities can be categorized by multiple relations

  136. def setNegativeRelationships(negativeRelationships: Array[String]): ZeroShotRelationExtractionModel.this.type

    Set the list of relational categories which serve as negative examples and are not included in the output annotations

  137. final def setOutputCol(value: String): ZeroShotRelationExtractionModel.this.type
    Definition Classes
    HasOutputAnnotationCol
  138. def setParent(parent: Estimator[MedicalBertForSequenceClassification]): MedicalBertForSequenceClassification
    Definition Classes
    Model
  139. def setPredictionThreshold(predictionThreshold: Float): ZeroShotRelationExtractionModel.this.type

    Set the minimal confidence score to encode a relation (Default: 0.5f)

  140. def setRelationalCategories(categories: HashMap[String, List[String]]): ZeroShotRelationExtractionModel.this.type

    Set definitions of relational categories

  141. def setRelationalCategories(categories: Map[String, Array[String]]): ZeroShotRelationExtractionModel.this.type

    Set definitions of relational categories

  142. def setSignatures(value: Map[String, String]): ZeroShotRelationExtractionModel.this.type

  143. def setVocabulary(value: Map[String, Int]): ZeroShotRelationExtractionModel.this.type

  144. val signatures: MapFeature[String, String]

    It contains TF model signatures for the laded saved model

    It contains TF model signatures for the laded saved model

    Definition Classes
    MedicalBertForSequenceClassification
  145. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  146. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  147. final def transform(dataset: Dataset[_]): DataFrame
    Definition Classes
    AnnotatorModel → Transformer
  148. def transform(dataset: Dataset[_], paramMap: ParamMap): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" )
  149. def transform(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" ) @varargs()
  150. final def transformSchema(schema: StructType): StructType
    Definition Classes
    RawAnnotator → PipelineStage
  151. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  152. val uid: String
  153. def validate(schema: StructType): Boolean
    Attributes
    protected
    Definition Classes
    RawAnnotator
  154. val vocabulary: MapFeature[String, Int]

    Vocabulary used to encode the words to ids with WordPieceEncoder

    Vocabulary used to encode the words to ids with WordPieceEncoder

    Definition Classes
    MedicalBertForSequenceClassification
  155. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  156. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  157. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  158. def wrapColumnMetadata(col: Column): Column
    Attributes
    protected
    Definition Classes
    RawAnnotator
  159. def write: MLWriter
    Definition Classes
    ParamsAndFeaturesWritable → DefaultParamsWritable → MLWritable
  160. def writeOnnxModel(path: String, spark: SparkSession, onnxWrapper: OnnxWrapper, suffix: String, fileName: String): Unit
    Definition Classes
    WriteOnnxModel
  161. def writeOnnxModels(path: String, spark: SparkSession, onnxWrappersWithNames: Seq[(OnnxWrapper, String)], suffix: String): Unit
    Definition Classes
    WriteOnnxModel
  162. def writeTensorflowHub(path: String, tfPath: String, spark: SparkSession, suffix: String): Unit
    Definition Classes
    WriteTensorflowModel
  163. def writeTensorflowModel(path: String, spark: SparkSession, tensorflow: TensorflowWrapper, suffix: String, filename: String, configProtoBytes: Option[Array[Byte]]): Unit
    Definition Classes
    WriteTensorflowModel
  164. 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

Inherited from RelationEncoding

Inherited from CheckLicense

Inherited from HasEngine

Inherited from HasCaseSensitiveProperties

Inherited from WriteOnnxModel

Inherited from WriteTensorflowModel

Inherited from HasBatchedAnnotate[MedicalBertForSequenceClassification]

Inherited from AnnotatorModel[MedicalBertForSequenceClassification]

Inherited from CanBeLazy

Inherited from RawAnnotator[MedicalBertForSequenceClassification]

Inherited from HasOutputAnnotationCol

Inherited from HasInputAnnotationCols

Inherited from HasOutputAnnotatorType

Inherited from ParamsAndFeaturesWritable

Inherited from HasFeatures

Inherited from DefaultParamsWritable

Inherited from MLWritable

Inherited from Model[MedicalBertForSequenceClassification]

Inherited from Transformer

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

A list of (hyper-)parameter keys this annotator can take. Users can set and get the parameter values through setters and getters, respectively.

Annotator types

Required input and expected output annotator types

Members

Parameter setters

Parameter getters