Feature embeddings with LightGBM
Project description
LightGBM Embeddings
Feature embeddings with LightGBM
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
Release history Release notifications | RSS feed
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
Close
Hashes for lightgbm_embedding-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 316e74077403ccd23084869e26a80ab2dfc0d4c315108ff0ebbaa34d98644f17 |
|
MD5 | 9299d488915fed8455c8d008c172b229 |
|
BLAKE2b-256 | eb9719deb1d0596b69db90cda22b958e18b56266daad0836c5dfd8a60edb29c9 |