sparknlp_jsl._tf_graph_builders.graph_builders.RelationExtractionTFGraphBuilder#
- class sparknlp_jsl._tf_graph_builders.graph_builders.RelationExtractionTFGraphBuilder(build_params)[source]#
Bases:
GenericClassifierTFGraphBuilder
Class to build the the TF graphs for RelationExtractionApproach
Examples
>>> from sparknlp_jsl.training import tf_graph >>> from sparknlp_jsl.base import * >>> from sparknlp.annotator import * >>> from sparknlp_jsl.annotator import * >>> from sparknlp_jsl.annotator import * >>> tf_graph.build("relation_extraction", build_params={"input_dim": 6000, "output_dim": 3, 'batch_norm':1, "hidden_layers": [300, 200], "hidden_act": "relu", 'hidden_act_l2':1}, model_location=".", model_filename="re_with_BN") >>> re_approach = RelationExtractionApproach() \ ... .setLabelColumn("rel") \ ... .setInputCols(["embeddings", "pos_tags", "train_ner_chunks", "dependencies"]) \ ... .setOutputCol("relations") \ ... .setModelFile('./re_with_BN') \ ... .setEpochsNumber(70) \ ... .setBatchSize(200) \ ... .setFixImbalance(True) \ ... .setLearningRate(0.001) \ ... .setFromEntity("begin1i", "end1i", "label1") \ ... .setToEntity("begin2i", "end2i", "label2") \ ... .setValidationSplit(0.2)
Methods
__init__
(build_params)build
(model_location, model_filename)check_build_params
()get_build_param
(build_param)get_build_params
()get_build_params_with_defaults
()get_model_build_param_explanations
()get_model_build_params
()get_model_filename
()supports_auto_file_name
()