Packages

class ZeroShotRelationExtractionModel extends nlp.annotators.re.ZeroShotRelationExtractionModel

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
nlp.annotators.re.ZeroShotRelationExtractionModel, 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. ZeroShotRelationExtractionModel
  3. RelationEncoding
  4. MedicalBertForSequenceClassification
  5. CheckLicense
  6. HasEngine
  7. HasCaseSensitiveProperties
  8. InternalWriteOnnxModel
  9. WriteTensorflowModel
  10. HasBatchedAnnotate
  11. AnnotatorModel
  12. CanBeLazy
  13. RawAnnotator
  14. HasOutputAnnotationCol
  15. HasInputAnnotationCols
  16. HasOutputAnnotatorType
  17. ParamsAndFeaturesWritable
  18. HasFeatures
  19. DefaultParamsWritable
  20. MLWritable
  21. Model
  22. Transformer
  23. PipelineStage
  24. Logging
  25. Params
  26. Serializable
  27. Serializable
  28. Identifiable
  29. AnyRef
  30. 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], metadata: Option[Map[String, Value]]): Unit
    Definition Classes
    CheckLicense
  19. def checkValidScope(scope: String): Unit
    Definition Classes
    CheckLicense
  20. def checkValidScopeAndEnvironment(scope: String, spark: Option[SparkSession], checkLp: Boolean, metadata: Option[Map[String, Value]]): Unit
    Definition Classes
    CheckLicense
  21. def checkValidScopesAndEnvironment(scopes: Seq[String], spark: Option[SparkSession], checkLp: Boolean, metadata: Option[Map[String, Value]]): 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
    Definition Classes
    ZeroShotRelationExtractionModel
  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. final val extraInputCols: StringArrayParam
    Attributes
    protected
    Definition Classes
    HasInputAnnotationCols
  37. def extraValidate(structType: StructType): Boolean
    Attributes
    protected
    Definition Classes
    RawAnnotator
  38. def extraValidateMsg: String
    Attributes
    protected
    Definition Classes
    RawAnnotator
  39. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  40. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  41. val features: ArrayBuffer[Feature[_, _, _]]
    Definition Classes
    HasFeatures
  42. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  43. def get[T](feature: StructFeature[T]): Option[T]
    Attributes
    protected
    Definition Classes
    HasFeatures
  44. def get[K, V](feature: MapFeature[K, V]): Option[Map[K, V]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  45. def get[T](feature: SetFeature[T]): Option[Set[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  46. def get[T](feature: ArrayFeature[T]): Option[Array[T]]
    Attributes
    protected
    Definition Classes
    HasFeatures
  47. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  48. def getBatchSize: Int
    Definition Classes
    HasBatchedAnnotate
  49. def getCaseSensitive: Boolean
    Definition Classes
    HasCaseSensitiveProperties
  50. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  51. def getClasses: Array[String]

    Returns labels used to train this model

    Returns labels used to train this model

    Definition Classes
    ZeroShotRelationExtractionModelMedicalBertForSequenceClassification
  52. def getCoalesceSentences: Boolean

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

  54. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  55. def getEngine: String
    Definition Classes
    HasEngine
  56. def getInputCols: Array[String]
    Definition Classes
    HasInputAnnotationCols
  57. def getLabels: Map[String, Int]

    Returns the Labels parameter

    Returns the Labels parameter

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

  61. def getModelIfNotSet: MedicalBertClassification

  62. def getMultiLabel: Boolean

    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

    Definition Classes
    ZeroShotRelationExtractionModel
  63. def getNegativeRelationships: Array[String]

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

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

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

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

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

    Definition Classes
    ZeroShotRelationExtractionModel
  68. def getSignatures: Option[Map[String, String]]

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

    Input annotator types : CHUNK, DOCUMENT

    Input annotator types : CHUNK, DOCUMENT

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

    Max sentence length to process (Default: 128)

    Max sentence length to process (Default: 128)

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

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

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

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

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

    Output annotator type : CATEGORY

    Output annotator type : CATEGORY

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

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

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

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

  112. val sentenceSeparator: String
    Attributes
    protected
    Definition Classes
    ZeroShotRelationExtractionModel
  113. def sentenceStartTokenId: Int

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

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

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

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

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

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

    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

    Definition Classes
    ZeroShotRelationExtractionModel
  140. 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

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

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

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

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

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

    Set definitions of relational categories

    Set definitions of relational categories

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

    Set definitions of relational categories

    Set definitions of relational categories

    Definition Classes
    ZeroShotRelationExtractionModel
  146. def setSignatures(value: Map[String, String]): ZeroShotRelationExtractionModel.this.type

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

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