Skip to main content

Fast feature subset selection library

Project description

ffselect

Fast feature subset selection library

This algorithm performs feature subset selection in O(n log n) or O(n) time

It may be useful for eliminating polynomial features with n equal to hundreds or thousands, where regular subset selection algorithms cannot perform in adequate time.

Usage

from ffselect.subset import MinSubsetSelection, FastSubsetSelection

MinSubsetSelection(data, target, fit_function, features, loss=True, interactive=True)
"""
Minimal feature subset selection algorithm
    data: Input data to pass to the fitting function
    target: Target parameter feature name
    fit_function: Callable function that fits the model and returns R^2/loss
    features: List of feature names
    loss: Set to true (by default) if the fitting function returns loss, R^2 otherwise
    interactive: Print output (default True)
    
    return: Tuple with the resulting R^2/loss and the list of features
"""


def FastSubsetSelection(data, target, fit_function, features, threshold = None, loss = True, interactive = True):
"""
Fast feature subset selection algorithm in linear time. May drop important features
    data: Input data to pass to the fitting function
    target: Target parameter feature name
    fit_function: Callable function that fits the model and returns R^2/loss
    features: List of feature names
    threshold: Minimal difference in loss/R^2 at which we drop the feature
    loss: Set to true (by default) if the fitting function returns loss, R^2 otherwise
    interactive: Print output (default True)
    
    return: Tuple with the resulting R^2/loss and the list of features
"""

Please view subset.ipynb for the complete example

Installation

pip3 install ffselect

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

ffselect-0.0.1.tar.gz (40.1 kB view hashes)

Uploaded Source

Built Distribution

ffselect-0.0.1-py3-none-any.whl (28.2 kB view hashes)

Uploaded 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