hamedbabaeigiglou commited on
Commit
9f32d75
·
verified ·
1 Parent(s): 35293d4

minor update to readme

Browse files
Files changed (1) hide show
  1. README.md +29 -12
README.md CHANGED
@@ -7,7 +7,7 @@ tags:
7
  - OntoLearner
8
  - ontology-learning
9
  - chemistry
10
- pretty_name: Agricultural
11
  ---
12
  <div align="center">
13
  <img src="https://raw.githubusercontent.com/sciknoworg/OntoLearner/main/images/logo.png" alt="OntoLearner"
@@ -69,34 +69,51 @@ ontology.load()
69
  data = ontology.extract()
70
  ```
71
 
 
72
  **How use the loaded dataset for LLM4OL Paradigm task settings?**
73
  ``` python
 
74
  from ontolearner import AFO, LearnerPipeline, train_test_split
75
 
 
76
  ontology = AFO()
77
- ontology.load()
78
  data = ontology.extract()
79
 
80
  # Split into train and test sets
81
- train_data, test_data = train_test_split(data, test_size=0.2)
82
 
83
- # Create a learning pipeline (for RAG-based learning)
 
84
  pipeline = LearnerPipeline(
85
- task = "term-typing", # Other options: "taxonomy-discovery" or "non-taxonomy-discovery"
86
- retriever_id = "sentence-transformers/all-MiniLM-L6-v2",
87
- llm_id = "mistralai/Mistral-7B-Instruct-v0.1",
88
- hf_token = "your_huggingface_token" # Only needed for gated models
 
89
  )
90
 
91
- # Train and evaluate
92
- results, metrics = pipeline.fit_predict_evaluate(
93
  train_data=train_data,
94
  test_data=test_data,
95
- top_k=3,
96
- test_limit=10
 
97
  )
 
 
 
 
 
 
 
 
 
98
  ```
99
 
 
 
100
  For more detailed documentation, see the [![Documentation](https://img.shields.io/badge/Documentation-ontolearner.readthedocs.io-blue)](https://ontolearner.readthedocs.io)
101
 
102
 
 
7
  - OntoLearner
8
  - ontology-learning
9
  - chemistry
10
+ pretty_name: Chemistry
11
  ---
12
  <div align="center">
13
  <img src="https://raw.githubusercontent.com/sciknoworg/OntoLearner/main/images/logo.png" alt="OntoLearner"
 
69
  data = ontology.extract()
70
  ```
71
 
72
+
73
  **How use the loaded dataset for LLM4OL Paradigm task settings?**
74
  ``` python
75
+ # Import core modules from the OntoLearner library
76
  from ontolearner import AFO, LearnerPipeline, train_test_split
77
 
78
+ # Load the AFO ontology, which contains concepts related to wines, their properties, and categories
79
  ontology = AFO()
80
+ ontology.load() # Load entities, types, and structured term annotations from the ontology
81
  data = ontology.extract()
82
 
83
  # Split into train and test sets
84
+ train_data, test_data = train_test_split(data, test_size=0.2, random_state=42)
85
 
86
+ # Initialize a multi-component learning pipeline (retriever + LLM)
87
+ # This configuration enables a Retrieval-Augmented Generation (RAG) setup
88
  pipeline = LearnerPipeline(
89
+ retriever_id='sentence-transformers/all-MiniLM-L6-v2', # Dense retriever model for nearest neighbor search
90
+ llm_id='Qwen/Qwen2.5-0.5B-Instruct', # Lightweight instruction-tuned LLM for reasoning
91
+ hf_token='...', # Hugging Face token for accessing gated models
92
+ batch_size=32, # Batch size for training/prediction if supported
93
+ top_k=5 # Number of top retrievals to include in RAG prompting
94
  )
95
 
96
+ # Run the pipeline: training, prediction, and evaluation in one call
97
+ outputs = pipeline(
98
  train_data=train_data,
99
  test_data=test_data,
100
+ evaluate=True, # Compute metrics like precision, recall, and F1
101
+ task='term-typing' # Specifies the task
102
+ # Other options: "taxonomy-discovery" or "non-taxonomy-discovery"
103
  )
104
+
105
+ # Print final evaluation metrics
106
+ print("Metrics:", outputs['metrics'])
107
+
108
+ # Print the total time taken for the full pipeline execution
109
+ print("Elapsed time:", outputs['elapsed_time'])
110
+
111
+ # Print all outputs (including predictions)
112
+ print(outputs)
113
  ```
114
 
115
+
116
+
117
  For more detailed documentation, see the [![Documentation](https://img.shields.io/badge/Documentation-ontolearner.readthedocs.io-blue)](https://ontolearner.readthedocs.io)
118
 
119