Skip to main content

Utilities for pandas.

Project description

PyPI-Status PyPI-Versions Build-Status Codecov LICENCE

scikit-learn wrappers for Python fastText.

>>> from skift import FirstColFtClassifier
>>> df = pandas.DataFrame([['woof', 0], ['meow', 1]], columns=['txt', 'lbl'])
>>> sk_clf = FirstColFtClassifier()
>>> sk_clf.fit(df[['txt']], df['lbl'])
>>> sk_clf.predict([['woof']])
[0]

1 Installation

Dependencies:

  • numpy

  • scikit-learn

  • fastText Python package

pip install skift

NOTICE: Installing skift will not install any of its dependencies. They should be install separately.

2 Features

  • Adheres to the scikit-learn classifier API, including predict_proba.

  • Caters to the common use case of pandas.DataFrame inputs.

  • Enables easy stacking of fastText with other types of scikit-learn-compliant classifiers.

  • Pickle-able classifier objects.

  • Pure python.

  • Supports Python 3.4+.

  • Fully tested.

3 Wrappers

skift includes several wrappers:

3.1 Standard wrappers

  • FirstColFtClassifier - An sklearn classifier adapter for fasttext that takes the first column of input ndarray objects as input.

  • IdxBasedFtClassifier - An sklearn classifier adapter for fasttext that takes input by index.

3.2 pandas-dependent wrappers

These wrappers assume the X parameters given to fit, predict, and predict_proba methods is a pandas.DataFrame object:

  • FirstObjFtClassifier - An sklearn adapter for fasttext using the first object column as input.

  • ColLblBasedFtClassifier - An sklearn adapter for fasttext taking input by column label.

4 Contributing

Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.

4.1 Installing for development

Clone:

git clone git@github.com:shaypal5/skift.git

Install in development mode:

cd skift
pip install -e .

4.2 Running the tests

To run the tests use:

pip install pytest pytest-cov coverage
cd skift
pytest

4.3 Adding documentation

The project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow these conventions.

5 Credits

Created by Shay Palachy (shay.palachy@gmail.com).

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

skift-0.0.3.tar.gz (22.7 kB view hashes)

Uploaded Source

Built Distribution

skift-0.0.3-py2.py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page