olaf.pipeline.pipeline_component.concept_relation_hierarchy package

Submodules

olaf.pipeline.pipeline_component.concept_relation_hierarchy.llm_based_hierarchisation module

class olaf.pipeline.pipeline_component.concept_relation_hierarchy.llm_based_hierarchisation.LLMBasedHierarchisation(prompt_template: Callable[[str], List[Dict[str, str]]] | None = None, llm_generator: LLMGenerator | None = None, doc_context_max_len: int | None = 4000)[source]

Bases: PipelineComponent

LLM based concept hierarchisation.

Attributes

prompt_template: Callable[[str], List[Dict[str, str]]]

Prompt template used to give instructions and context to the LLM.

llm_generator: LLMGenerator

The LLM model used to generate the concept hierarchy.

doc_context_max_len: int

Maximum number of characters for the document context in the prompt.

check_resources() None[source]

Method to check that the component has access to all its required resources.

get_performance_report() Dict[str, Any][source]

A getter for the pipeline component performance report. If the component has been optimised, it only returns the best performance. Otherwise, it returns the results obtained with the set parameters.

Returns

Dict[str, Any]

The pipeline component performance report.

optimise(validation_terms: Set[str], option_values_map: Set[float]) None[source]

A method to optimise the pipeline component by tuning the configuration.

run(pipeline: Pipeline) None[source]

Method that is responsible for the execution of the component. Metarelations are created based on the concepts.

Parameters

pipeline: Pipeline

The pipeline to run the component with.

olaf.pipeline.pipeline_component.concept_relation_hierarchy.subsumption_hierarchisation module

class olaf.pipeline.pipeline_component.concept_relation_hierarchy.subsumption_hierarchisation.SubsumptionHierarchisation(threshold: float | None = None)[source]

Bases: PipelineComponent

Extract hierarchisation metarelations based on subsumption.

Attributes

thresholdfloat, optional

Threshold used to validate the subsumption relation or not, by default 0.5.

check_resources() None[source]

Method to check that the component has access to all its required resources.

This pipeline component does not need any access to any external resource.

get_performance_report() Dict[str, Any][source]
A getter for the pipeline component performance report.

If the component has been optimised, it only returns the best performance. Otherwise, it returns the results obtained with the set parameters.

Returns

Dict[str, Any]

The pipeline component performance report.

optimise(validation_terms: Set[str], option_values_map: Set[float]) None[source]

A method to optimise the pipeline component by tuning the options.

run(pipeline: Pipeline) None[source]

Execution of the subsumption hierarchisation process on pipeline concepts. Generalisation metarelations are created.

Parameters

pipelinePipeline

The pipeline running.

Module contents