Sentence-Transformer embeddings for scikit-learn
Project description
sklearn-embeddings
Overview
sklearn-embeddings is a Python package that integrates sentence-transformer based embeddings with scikit-learn classifiers and clustering algorithms. This allows users to leverage powerful natural language processing capabilities within the familiar scikit-learn framework.
Installation
To install sklearn-embeddings, you can use pip:
pip install sklearn-embeddings
Usage
Here is a simple example of how to use sklearn-embeddings with a scikit-learn classifier:
from sklearn_embeddings.embeddings import SentenceTransformerEmbedding
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
# Sample data
documents = ["This is a sentence.", "This is another sentence."]
labels = [True, False]
# Create a pipeline with the embedding model and a classifier
pipeline = make_pipeline(
SentenceTransformerEmbedding(),
LogisticRegression()
)
# Fit the model
pipeline.fit(documents, labels)
# Make predictions
predictions = pipeline.predict(["A new sentence to classify."])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sklearn_embeddings-0.1.0.tar.gz.
File metadata
- Download URL: sklearn_embeddings-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e98f48708ed3a921264ad95c57f9d374b99f53c6a06923902201e7cd87c8957
|
|
| MD5 |
19488948dc7b8ce0a22f7e2c0826f973
|
|
| BLAKE2b-256 |
8f5673c16135993f38e94688602d5159a2b466a17a3c9cd57da407acc201962a
|
File details
Details for the file sklearn_embeddings-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sklearn_embeddings-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175d90eb43d342fa8a0952de89c057368f0a27f07005c10d9d0d4c361a879d46
|
|
| MD5 |
7a76d53ad718670f64989751bba65616
|
|
| BLAKE2b-256 |
c2f729e6a477d5529cfcdd01758145583ccaa8bede34ecfb2b772f8c713bc6f3
|