Skip to main content

Feature embeddings with LightGBM

Project description

LightGBM Embeddings

Feature embeddings with LightGBM

Installation

pip install lightgbm-embedding

Examples

import pandas as pd
from sklearn.model_selection import train_test_split
from lightgbm_embedding import LightgbmEmbedding

df = pd.read_csv(
    "https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/0e7a9b0a5d22642a06d3d5b9bcbad9890c8ee534/iris.csv"
)
cols = df.columns[:-1]
target = df.columns[-1]
num_classes = df[target].nunique()

X_train, X_test = train_test_split(
    df, test_size=0.2, stratify=df[target], random_state=42
)

n_dim = 20
emb = LightgbmEmbedding(n_dim=n_dim)
emb.fit(X_train[cols], X_train[target])
X_train_embed = emb.transform(X_train[cols])
X_test_embed = emb.transform(X_test[cols])

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

lightgbm_embedding-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

lightgbm_embedding-0.1.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file lightgbm_embedding-0.1.2.tar.gz.

File metadata

  • Download URL: lightgbm_embedding-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.8 Windows/10

File hashes

Hashes for lightgbm_embedding-0.1.2.tar.gz
Algorithm Hash digest
SHA256 17e3cf50db97547726a99aedda9903476537de2025fff6f678edcf56f3a38c76
MD5 27d77f1e6b332e9c308fa7fb2d6fbd4a
BLAKE2b-256 8ea40f870862cb7ef404e7289bc22097b244c8bb969aa12bda9d1b09dfffd32d

See more details on using hashes here.

File details

Details for the file lightgbm_embedding-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lightgbm_embedding-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fae8a35da1ed4e0f3fb7c6465e6315a307a82f719f146f65d4ba4e0ff20d0691
MD5 44f024f79f7d5ad8068e8151f37eb547
BLAKE2b-256 0103773f2dfff2ad05d3f396aedb13c119ed8cc605eef312c47ddc518978fcba

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