GithubHelp home page GithubHelp logo

himanshu-dutta / featureselect Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 30 KB

Feature Select provides an elegant solution to the problem of handpicking the suite of the most suitable features from a tabular dataset, using mathematical optimization.

License: MIT License

Python 100.00%

featureselect's Introduction

Feature Select PyPackage

Feature Select is a simple yet effective solution to select features from a numeric dataset, which yields the best results, given a Machine Learning algorithm.

Features

  • Multiple optimization algorithms to work with.
  • Works with most class based Machine Learning models over a range of libraries.
  • Compatible with all platforms.

Quickstart

Install the latest Feature Select with

pip install featureselect

Usage

from featureselect import DEOptimizer, SAOptimizer, GAOptimizer, PSOptimizer
from sklearn.tree import DecisionTreeClassifier
import pandas as pd

# loading a dataset
dataset = pd.read_csv("dataset.csv", header=None)
dataset[34] = dataset[34].apply(lambda x: 1 if x == "g" else 0)
dataset = dataset.dropna()
X, y = dataset.iloc[:, :-1].to_numpy(), dataset.iloc[:, -1].to_numpy()

# best_accuracy, index_of_best_features = GAOptimizer((X, y), DecisionTreeClassifier, epochs = 10, threshold=0.6, verbose=1, max_depth=3)
# best_accuracy, index_of_best_features = SAOptimizer((X, y), DecisionTreeClassifier, epochs = 10, threshold=0.6, verbose=True, max_depth=3)
# best_accuracy, index_of_best_features = PSOptimizer((X, y), DecisionTreeClassifier, epochs = 10, verbose=1, max_depth=3)


best_accuracy, index_of_best_features = DEOptimizer((X, y), DecisionTreeClassifier, epochs = 10, threshold=0.6, verbose=1, max_depth=3)

#############
#   Output
#############
Initial Accuracy: 0.887.
----------------------------------
*  Epoch:  1 | Accuracy: 0.958.
----------------------------------
*  Epoch:  2 | Accuracy: 0.958.
----------------------------------
*  Epoch:  3 | Accuracy: 0.958.
----------------------------------
*  Epoch:  4 | Accuracy: 0.958.
----------------------------------
*  Epoch:  5 | Accuracy: 0.972.
----------------------------------
*  Epoch:  6 | Accuracy: 0.972.
----------------------------------
*  Epoch:  7 | Accuracy: 0.972.
----------------------------------
*  Epoch:  8 | Accuracy: 0.972.
----------------------------------
*  Epoch:  9 | Accuracy: 0.986.
----------------------------------
*  Epoch: 10 | Accuracy: 0.986.
----------------------------------
(0.9859154929577465, array([ 2,  4,  5,  6,  9, 11, 12, 13, 14, 17, 19, 20, 21, 24, 26, 29, 32]))

Note

The project is still in developement phase and will be expanded and made better over time. Any contribution to it is welcomed. Stable release would be made available soon.

featureselect's People

Contributors

himanshu-dutta avatar

Stargazers

Jay Dulera avatar

Watchers

James Cloos avatar  avatar

featureselect's Issues

SVM (Support Vector Machine)

Hello

Is there a way to try to use SVM classifier instead of DT or RF?

I've been trying to use it but it returns an error each time!

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.