A collection of Scikit-learn-compatible transformers for feature engineering, preprocessing, and pipeline utilities.
Project description
Scikit-extensions
A collection of Scikit-learn-compatible transformers for feature engineering, preprocessing, and pipeline utilities.
Installation
pip install scikit-extensions
Or with Poetry:
poetry add scikit-extensions
Features
1. StatsModelsOLS
A scikit-learn compatible wrapper for statsmodels OLS regression that provides additional statistical insights.
from skext.linear_model import OLSRegressor
# Create and fit model
model = OLSRegressor(fit_intercept=True)
model.fit(X, y)
# Get predictions
y_pred = model.predict(X_test)
# Access statsmodels summary
print(model.summary())
2. MulticollinearityRemover
Removes highly correlated features using various strategies.
from skext.multicolinerity import MulticollinearityRemover
# Initialize transformer
remover = MulticollinearityRemover(
correlation_threshold=0.8,
strategy='variance' # Options: 'first', 'last', 'variance', 'missing_ratio', 'random'
)
# Fit and transform
X_transformed = remover.fit_transform(X)
# Get selected features
selected_features = remover.selected_features_
3. MultiLabelBinarizerTransformer
Transform multi-label columns in pandas DataFrames to binary indicator matrices.
from skext.multilabels import MultiLabelBinarizerTransformer
# Sample data
data = pd.DataFrame({
'tags': [['python', 'ml'], ['python'], ['ml', 'deep-learning']],
'categories': [['tech'], ['tech', 'tutorial'], ['tutorial']]
})
# Initialize and transform
mlb = MultiLabelBinarizerTransformer(sparse_output=False)
transformed = mlb.fit_transform(data)
Development
- Clone the repository:
git clone https://github.com/sh99-git/scikit-extensions.git
cd scikit-extensions
- Install dependencies:
poetry install
Running Tests
make test # Run tests with coverage
make build # Run tests and build package
License
MIT License. See LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests (
make test) - Submit a pull request
Requirements
- Python ≥ 3.10
- scikit-learn ≥ 1.7.2
- pandas ≥ 2.3.2
- statsmodels ≥ 0.14.5
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scikit_extensions-0.1.3.tar.gz.
File metadata
- Download URL: scikit_extensions-0.1.3.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.14.0-33-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc31507b853298057d1264ef143678b83b786f83e5d8344a26cbee561c054863
|
|
| MD5 |
e2acb5f3325cb316733715db7045ab51
|
|
| BLAKE2b-256 |
9d8e8e3e4c844aea8f08338404eba25496ef387036ba14137e89e0192631ab2f
|
File details
Details for the file scikit_extensions-0.1.3-py3-none-any.whl.
File metadata
- Download URL: scikit_extensions-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.14.0-33-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6f17de201fe4c5a107897f1aa7d6b6ec3dfb691f7696c865396f5cfc4cc44ff
|
|
| MD5 |
ede795ae69ee42a963fd8721caa078d5
|
|
| BLAKE2b-256 |
db0e04887fd03f387cf7bd85a2c941b8c90f8f4a5e0549174267ac769a365a5f
|