The Hybrid Text Classification Model combines the powerful sentence embedding capabilities of Sentence Transformers with the simplicity and effectiveness of a Logistic Regression classifier from scikit-learn. This package is designed to offer an easy-to-use interface for training and predicting text classifications, ideal for a wide range of NLP tasks.
- Sentence Embedding: Utilizes Sentence Transformers for generating rich text embeddings.
- Classification: Incorporates a Logistic Regression classifier for efficient text classification.
- Easy Integration: Designed for straightforward integration into existing Python projects.
- Logging: Includes logging for transparent monitoring of the training and prediction processes.
- Customizable: Supports customization of the underlying Sentence Transformer model and Logistic Regression classifier.
Ensure you have Python 3.6+ installed on your system. You can then install the package using the following steps:
- Clone the repository:
git clone https://github.com/ameyachawlaggsipu/Hybrid_LLM_Classifier.git
- Navigate to the cloned directory:
cd Hybrid_LLM_Classifier
- Install the package:
pip install .
This will install the Hybrid Model package along with its dependencies.
Here's how to get started with the Hybrid Model package:
First, import and initialize the HybridModel with a pre-trained Sentence Transformer model ID.
from hybrid_model.model import HybridModel
model_id = "all-MiniLM-L6-v2" # Example Sentence Transformer model ID
hybrid_model = HybridModel(model_id=model_id)
To train the model, provide a list of text samples and their corresponding labels.
text_list = ["This is a positive example.", "This is a negative example."]
label_list = [1, 0] # Example binary labels
# Train the model
hybrid_model.train(text_list, label_list)
Once trained, you can use the model to predict the classification of new text samples.
predictions = hybrid_model.predict(["This is a test."])
print(predictions)
Contributions to improve the Hybrid Model package are welcome. Please feel free to fork the repository, make changes, and submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.