# LightGBM Embeddings
Feature embeddings with LightGBM
## Installation
pip install lightgbm-embedding
## Examples
```python
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])
```
Raw data
{
"_id": null,
"home_page": null,
"name": "lightgbm_embedding",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": "lightgbm, embeddings",
"author": "Atilla Karaahmeto\u011flu",
"author_email": "atilla.karaahmetoglu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3a/e5/133bb0de75c38062cf2074453d9826d86accbb3718f8434777993a0a6e1a/lightgbm_embedding-0.2.0.tar.gz",
"platform": null,
"description": "# LightGBM Embeddings\n\nFeature embeddings with LightGBM\n\n## Installation\n\n pip install lightgbm-embedding\n\n## Examples\n```python\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom lightgbm_embedding import LightgbmEmbedding\n\ndf = pd.read_csv(\n \"https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/0e7a9b0a5d22642a06d3d5b9bcbad9890c8ee534/iris.csv\"\n)\ncols = df.columns[:-1]\ntarget = df.columns[-1]\nnum_classes = df[target].nunique()\n\nX_train, X_test = train_test_split(\n df, test_size=0.2, stratify=df[target], random_state=42\n)\n\nn_dim = 20\nemb = LightgbmEmbedding(n_dim=n_dim)\nemb.fit(X_train[cols], X_train[target])\nX_train_embed = emb.transform(X_train[cols])\nX_test_embed = emb.transform(X_test[cols])\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Feature embeddings with LightGBM",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"lightgbm",
" embeddings"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1f60285e670ca9833512f6fbc0435e67d1bc4191b1020d802187bba2fda21fbb",
"md5": "adca3fc33433fe34763be3b70322f7ea",
"sha256": "28902d6a6db580d81487aefa26fa8cb1c51903d9e915ff52be10646eeddac530"
},
"downloads": -1,
"filename": "lightgbm_embedding-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "adca3fc33433fe34763be3b70322f7ea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 5222,
"upload_time": "2025-01-12T11:24:34",
"upload_time_iso_8601": "2025-01-12T11:24:34.717152Z",
"url": "https://files.pythonhosted.org/packages/1f/60/285e670ca9833512f6fbc0435e67d1bc4191b1020d802187bba2fda21fbb/lightgbm_embedding-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3ae5133bb0de75c38062cf2074453d9826d86accbb3718f8434777993a0a6e1a",
"md5": "e933fa82004aa8759f596b1009770aa4",
"sha256": "1b919821bc9190901d3ea294a45a609f19fc8db8d0ec6e7942295f0f33deee65"
},
"downloads": -1,
"filename": "lightgbm_embedding-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "e933fa82004aa8759f596b1009770aa4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 4043,
"upload_time": "2025-01-12T11:24:35",
"upload_time_iso_8601": "2025-01-12T11:24:35.855160Z",
"url": "https://files.pythonhosted.org/packages/3a/e5/133bb0de75c38062cf2074453d9826d86accbb3718f8434777993a0a6e1a/lightgbm_embedding-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-12 11:24:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "lightgbm_embedding"
}