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, InternalWriteOnnxModel, 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. InternalWriteOnnxModel
  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 getLabels: Map[String, Int]

    Returns the Labels parameter

    Returns the Labels parameter

    Definition Classes
    MedicalBertForSequenceClassification
  57. def getLazyAnnotator: Boolean
    Definition Classes
    CanBeLazy
  58. def getLicenseScopes: Seq[String]
    Attributes
    protected
    Definition Classes
    MedicalBertForSequenceClassification
  59. def getMaxSentenceLength: Int

  60. def getModelIfNotSet: MedicalBertClassification

  61. def getMultiLabel: Boolean

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

  62. def getNegativeRelationships: Array[String]

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

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

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

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

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

    Input annotator types : CHUNK, DOCUMENT

    Input annotator types : CHUNK, DOCUMENT

    Definition Classes
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification → HasInputAnnotationCols
  76. final val inputCols: StringArrayParam
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  77. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  78. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  79. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  80. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  81. 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
  82. val lazyAnnotator: BooleanParam
    Definition Classes
    CanBeLazy
  83. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  84. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  85. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  86. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  87. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  88. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  89. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  90. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  91. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  92. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  93. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  94. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  95. val maxSentenceLength: IntParam

    Max sentence length to process (Default: 128)

    Max sentence length to process (Default: 128)

    Definition Classes
    MedicalBertForSequenceClassification
  96. def msgHelper(schema: StructType): String
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  97. 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.

  98. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  99. var negativeRelationships: StringArrayParam

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

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

    Output annotator type : CATEGORY

    Output annotator type : CATEGORY

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

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

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

  111. val sentenceSeparator: String
    Attributes
    protected
  112. def sentenceStartTokenId: Int

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

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

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

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

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

  136. def setModelIfNotSet(spark: SparkSession, onnxWrapper: InternalOnnxWrapper, sentenceSeparator: Option[String]): ZeroShotRelationExtractionModel.this.type
  137. def setMultiLabel(value: Boolean): ZeroShotRelationExtractionModel.this.type

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

  138. 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

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

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

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

    Set definitions of relational categories

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

    Set definitions of relational categories

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

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

  146. 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
  147. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  148. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  149. final def transform(dataset: Dataset[_]): DataFrame
    Definition Classes
    AnnotatorModel → Transformer
  150. def transform(dataset: Dataset[_], paramMap: ParamMap): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" )
  151. def transform(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): DataFrame
    Definition Classes
    Transformer
    Annotations
    @Since( "2.0.0" ) @varargs()
  152. final def transformSchema(schema: StructType): StructType
    Definition Classes
    RawAnnotator → PipelineStage
  153. def transformSchema(schema: StructType, logging: Boolean): StructType
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  154. val uid: String
  155. def validate(schema: StructType): Boolean
    Attributes
    protected
    Definition Classes
    RawAnnotator
  156. 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
  157. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  158. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  159. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  160. def wrapColumnMetadata(col: Column): Column
    Attributes
    protected
    Definition Classes
    RawAnnotator
  161. def write: MLWriter
    Definition Classes
    ParamsAndFeaturesWritable → DefaultParamsWritable → MLWritable
  162. def writeOnnxModel(path: String, spark: SparkSession, onnxWrapper: InternalOnnxWrapper, suffix: String, fileName: String, encrypt: Boolean): Unit
    Definition Classes
    InternalWriteOnnxModel
  163. def writeOnnxModel(path: String, spark: SparkSession, onnxWrapper: InternalOnnxWrapper, suffix: String, fileName: String): Unit
    Definition Classes
    InternalWriteOnnxModel
  164. def writeOnnxModels(path: String, spark: SparkSession, onnxWrappersWithNames: Seq[(InternalOnnxWrapper, String)], suffix: String, encrypt: Boolean = false): Unit
    Definition Classes
    InternalWriteOnnxModel
  165. def writeOnnxModels(path: String, spark: SparkSession, onnxWrappersWithNames: Seq[(InternalOnnxWrapper, String)], suffix: String): Unit
    Definition Classes
    InternalWriteOnnxModel
  166. def writeTensorflowHub(path: String, tfPath: String, spark: SparkSession, suffix: String): Unit
    Definition Classes
    WriteTensorflowModel
  167. def writeTensorflowModel(path: String, spark: SparkSession, tensorflow: TensorflowWrapper, suffix: String, filename: String, configProtoBytes: Option[Array[Byte]]): Unit
    Definition Classes
    WriteTensorflowModel
  168. 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 InternalWriteOnnxModel

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