GithubHelp home page GithubHelp logo

tgsmith61591 / skoot Goto Github PK

View Code? Open in Web Editor NEW
55.0 6.0 11.0 10.66 MB

A package for data science practitioners. This library implements a number of helpful, common data transformations with a scikit-learn friendly interface in an effort to expedite the modeling process.

Home Page: https://alkaline-ml.com/skoot

License: MIT License

Shell 1.69% Python 91.05% Fortran 6.80% Makefile 0.46%
scikit-learn skutil imbalanced-data machine-learning data-science python pandas

skoot's Introduction

codecov Supported versions Supported versions Supported versions CircleCI Build Status

skoot

Skoot is a lightweight python library of machine learning transformer classes that interact with scikit-learn and pandas. Its objective is to expedite data munging and pre-processing tasks that can tend to take up so much of data science practitioners' time. See the documentation for more info.

Note that skoot is the preferred alternative to the now deprecated skutil library

Two minutes to model-readiness

Real world data is nasty. Most data scientists spend the majority of their time tackling data cleansing tasks. With skoot, we can automate away so much of the bespoke hacking solutions that consume data scientists' time.

In this example, we'll examine a common dataset (the adult dataset from the UCI machine learning repo) that requires significant pre-processing.

from skoot.datasets import load_adult_df
from skoot.feature_selection import FeatureFilter
from skoot.decomposition import SelectivePCA
from skoot.preprocessing import DummyEncoder
from skoot.utils.dataframe import get_numeric_columns
from skoot.utils.dataframe import get_categorical_columns
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score

# load the dataset with the skoot-native loader & split it
adult = load_adult_df(tgt_name="target")
y = adult.pop("target")
X_train, X_test, y_train, y_test = train_test_split(
    adult, y, random_state=42, test_size=0.2)
    
# get numeric and categorical feature names
num_cols = get_numeric_columns(X_train).columns
obj_cols = get_categorical_columns(X_train).columns

# remove the education-num from the num_cols since we're going to remove it
num_cols = num_cols[~(num_cols == "education-num")]
    
# build a pipeline
pipe = Pipeline([
    # drop out the ordinal level that's otherwise equal to "education"
    ("dropper", FeatureFilter(cols=["education-num"])),
    
    # decompose the numeric features with PCA
    ("pca", SelectivePCA(cols=num_cols)),
    
    # dummy encode the categorical features
    ("dummy", DummyEncoder(cols=obj_cols, handle_unknown="ignore")),
    
    # and a simple classifier class
    ("clf", RandomForestClassifier(n_estimators=100, random_state=42))
])

pipe.fit(X_train, y_train)

# produce predictions
preds = pipe.predict(X_test)
print("Test accuracy: %.3f" % accuracy_score(y_test, preds))

For more tutorials, check out the documentation.

skoot's People

Contributors

tgsmith61591 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

skoot's Issues

Date field utilities

Build transformers for common date field utilities

This was requested in skutil but the project has since been deprecated.

pip install Skoot on Mac keeps failing with ERROR: Could not find a version that satisfies the requirement skoot (from versions: none).

Description

pip install Skoot on Mac keeps failing with
ERROR: Could not find a version that satisfies the requirement skoot (from versions: none)
ERROR: No matching distribution found for skoot

Steps/Code to Reproduce

pip install skoot
using python version : Python 2.7.17
using pip version : pip 19.3.1

Expected Results

No errors thrown, successful installation of Skoot

Actual Results

ERROR: Could not find a version that satisfies the requirement skoot (from versions: none)
ERROR: No matching distribution found for skoot

Versions

platform - Darwin-19.2.0-x86_64-i386-64bit
sys - ('Python', '2.7.17 (default, Oct 24 2019, 12:57:47) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)]')
Skoot -( not able to install )
numpy -("NumPy", numpy.version)
scipy - ('SciPy', '1.2.3')
sklearn - scikit-learn->sklearn (1.16.6)

String fields with typos

Description

TODO: Create a transformer that can map values in text fields to known "good" values given Levenstein distance or some other method.

Windows: pip install not working

Hi, I can't install skoot neither via pip, nor anaconda.

> pip install skoot
Collecting skoot
  Could not find a version that satisfies the requirement skoot (from versions: )
No matching distribution found for skoot

Any ideas why that might be?
Thank you!

Documentation

Build Sphinx doc prior to first release

Need to build sphinx doc

Package Roadmap

Is skoot still an active project? Or is there a successor to this concept? Looking to build something similar for my specific workflow, but maybe it would be mutually beneficial to contribute to this project.

Examples

Create examples

Related to #2, we need examples to be included in the doc.

Wrapped classes still reference sklearn user-guide

The "See Also" section of wrapped sklearn estimators still references sklearn user_guide refs. We need to monkey patch "Selective" (or whatever prefix we are using) in front of them so they link in our documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.