hamedbabaeigiglou commited on
Commit
b1e516f
·
verified ·
1 Parent(s): a7fd601

minor update to readme

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