ds-utils-transformers
Scikit-learn pipeline transformers for multi-label binarization and sentence embeddings. Use for integrating MultiLabelBinarizer and sentence-transformers…
от idanmoradarthas★ 37 звёзд на GitHub
Установить ds-utils-transformers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
ds-utils-transformers
Production-ready, scikit-learn compatible transformers for multi-label lists and dense text embeddings.
Purpose
ds_utils.transformers resolves standard scikit-learn API incompatibilities when working with complex feature types like list-of-tags columns and freeform text. It provides:
MultiLabelBinarizerTransformer: Enables multi-label tag binarization insidePipelineandColumnTransformerwith fullget_feature_names_out()andset_output(transform="pandas")compatibility.SentenceEmbeddingTransformer: Encodes text columns into dense semantic vectors usingsentence-transformerswithin unified sklearn workflows.
- When to use: Building composite feature processing pipelines combining tabular, categorical lists, and unstructured text into a single deployable scikit-learn Pipeline.
- When NOT to use: For standalone functional tag appending without pipeline persistence (use ds-utils-strings), or exploratory correlation plots (use ds-utils-preprocess).
Prerequisites
- Python 3.11 or higher.
- data-science-utils package installed (pip install data-science-utils).
- Core dependencies: numpy, pandas, scikit-learn.
- Optional dependency for
SentenceEmbeddingTransformer: pip install data-science-utils[nlp] (provides sentence-transformers and torch).
Instructions
Task-to-Approach Map
| Pipeline Task | Transformer Class | Input Format | Output |
|---|---|---|---|
| Binarize list of tags inside Pipeline / ColumnTransformer | MultiLabelBinarizerTransformer |
Iterable of iterables (e.g., "tagA", "tagB") |
2D float64 array / DataFrame |
| Encode text columns into semantic embedding vectors | SentenceEmbeddingTransformer |
1D iterable of strings | 2D float array (e.g., $N \times 384$) |
| Return Pandas DataFrames from Pipeline stages | .set_output(transform="pandas") |
Compatible with both transformers | Pandas DataFrame with clean headers |
Detailed constructor options, return types, and parameter defaults are in references/api_reference.md.
End-to-End Multimodal Pipeline Workflow
A typical production dataset contains mixed data types: numerical columns, a multi-label tag column, and freeform text descriptions.
Raw Multimodal DataFrame
(numerical features + list tags + text descriptions)
│
ColumnTransformer
┌────────────────┼────────────────┐
▼ ▼ ▼
[StandardScaler] [MultiLabel] [SentenceEmbed]
Numeric Columns List of Tags Text Column
└────────────────┬────────────────┘
▼
set_output(transform="pandas")
│
▼
Downstream Estimator
(e.g., RandomForestClassifier)
Inputs you need
The steps below assume:
- A DataFrame
dfcontaining numeric column(s), a list-of-tags column (or delimited string), a text column, and a target column. - Your training and testing partitions (
X_train,y_train,X_test,y_test).
import pandas as pd
# Load your multimodal dataset (replace with your data)
df = pd.read_csv("your_dataset")
# Note: If your tag column is a delimited string (e.g. "python,sql"), convert to lists first:
# df["tags"] = df["tags"].fillna("").str.split(",")
# X_train, X_test, y_train, y_test = train_test_split(df.drop(columns=["target"]), df["target"], ...)
Step 1: Multi-Label Tag Transformation
Question: how do we encode multi-label tag lists into indicator columns inside a scikit-learn Pipeline?
from ds_utils.transformers.multi_label_binarizer import MultiLabelBinarizerTransformer
# Format illustration only - replace with your column(s)
sample_tags = [["python", "cloud"], ["sql"], ["cloud", "docker"]]
mlb = MultiLabelBinarizerTransformer()
mlb.set_output(transform="pandas")
df_tags = mlb.fit_transform(sample_tags)
print(df_tags.columns.tolist())
- What to look for: Clean feature column names prefixed with
label_. - Action: Use
MultiLabelBinarizerTransformeras a stage insideColumnTransformer. If your raw data contains delimited strings, split them into Python lists viadf[col].str.split(",")before transforming. - Caution: The transformer expects an iterable of iterables; passing flat strings directly treats whole strings as single labels.
Step 2: Dense Semantic Embeddings (SentenceEmbeddingTransformer)
Question: how do we transform unstructured text descriptions into dense semantic vectors within a Pipeline?
from ds_utils.transformers.sentence_embedding import SentenceEmbeddingTransformer
# Format illustration only - replace with your column(s)
sample_texts = ["Production database incident", "Quarterly financial report", "Bug report: UI login failure"]
embedder = SentenceEmbeddingTransformer(normalize_embeddings=True)
embedder.set_output(transform="pandas")
df_embed = emb
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/api_reference.md
FAQ
Что делает скилл ds-utils-transformers?
Scikit-learn pipeline transformers for multi-label binarization and sentence embeddings. Use for integrating MultiLabelBinarizer and sentence-transformers into sklearn Pipeline, ColumnTransformer, and set_output(transform="pandas"). Do NOT use for basic univariate feature plotting or correlation dendrograms.
Как установить скилл ds-utils-transformers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ds-utils-transformers запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…