Skip to main content

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

sklearn_embeddings-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sklearn_embeddings-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

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

Hashes for sklearn_embeddings-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5e98f48708ed3a921264ad95c57f9d374b99f53c6a06923902201e7cd87c8957
MD5 19488948dc7b8ce0a22f7e2c0826f973
BLAKE2b-256 8f5673c16135993f38e94688602d5159a2b466a17a3c9cd57da407acc201962a

See more details on using hashes here.

File details

Details for the file sklearn_embeddings-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sklearn_embeddings-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 175d90eb43d342fa8a0952de89c057368f0a27f07005c10d9d0d4c361a879d46
MD5 7a76d53ad718670f64989751bba65616
BLAKE2b-256 c2f729e6a477d5529cfcdd01758145583ccaa8bede34ecfb2b772f8c713bc6f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page