All Projects → runopti → stg

runopti / stg

Licence: MIT License
Python/R library for feature selection in neural nets. ("Feature selection using Stochastic Gates", ICML 2020)

Programming Languages

python
139335 projects - #7 most used programming language
r
7636 projects

Projects that are alternatives of or similar to stg

Mlr
Machine Learning in R
Stars: ✭ 1,542 (+3180.85%)
Mutual labels:  regression, feature-selection, classification
Lightautoml
LAMA - automatic model creation framework
Stars: ✭ 196 (+317.02%)
Mutual labels:  regression, classification
Dynaml
Scala Library/REPL for Machine Learning Research
Stars: ✭ 195 (+314.89%)
Mutual labels:  regression, classification
Predictive-Maintenance-of-Aircraft-Engine
In this project I aim to apply Various Predictive Maintenance Techniques to accurately predict the impending failure of an aircraft turbofan engine.
Stars: ✭ 48 (+2.13%)
Mutual labels:  regression, classification
Remixautoml
R package for automation of machine learning, forecasting, feature engineering, model evaluation, model interpretation, data generation, and recommenders.
Stars: ✭ 159 (+238.3%)
Mutual labels:  regression, classification
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (+259.57%)
Mutual labels:  regression, classification
Orange3
🍊 📊 💡 Orange: Interactive data analysis
Stars: ✭ 3,152 (+6606.38%)
Mutual labels:  regression, classification
Machine Learning With Python
Practice and tutorial-style notebooks covering wide variety of machine learning techniques
Stars: ✭ 2,197 (+4574.47%)
Mutual labels:  regression, classification
Machine-Learning-Specialization
Project work and Assignments for Machine learning specialization course on Coursera by University of washington
Stars: ✭ 27 (-42.55%)
Mutual labels:  regression, classification
ugtm
ugtm: a Python package for Generative Topographic Mapping
Stars: ✭ 34 (-27.66%)
Mutual labels:  regression, classification
machine learning from scratch matlab python
Vectorized Machine Learning in Python 🐍 From Scratch
Stars: ✭ 28 (-40.43%)
Mutual labels:  regression, classification
Java Deep Learning Cookbook
Code for Java Deep Learning Cookbook
Stars: ✭ 156 (+231.91%)
Mutual labels:  regression, classification
Applied Ml
Code and Resources for "Applied Machine Learning"
Stars: ✭ 156 (+231.91%)
Mutual labels:  regression, classification
Uci Ml Api
Simple API for UCI Machine Learning Dataset Repository (search, download, analyze)
Stars: ✭ 190 (+304.26%)
Mutual labels:  regression, classification
Snape
Snape is a convenient artificial dataset generator that wraps sklearn's make_classification and make_regression and then adds in 'realism' features such as complex formating, varying scales, categorical variables, and missing values.
Stars: ✭ 155 (+229.79%)
Mutual labels:  regression, classification
Deepfashion
Apparel detection using deep learning
Stars: ✭ 223 (+374.47%)
Mutual labels:  regression, classification
InstantDL
InstantDL: An easy and convenient deep learning pipeline for image segmentation and classification
Stars: ✭ 33 (-29.79%)
Mutual labels:  regression, classification
Benchmarks
Comparison tools
Stars: ✭ 139 (+195.74%)
Mutual labels:  regression, classification
100daysofmlcode
My journey to learn and grow in the domain of Machine Learning and Artificial Intelligence by performing the #100DaysofMLCode Challenge.
Stars: ✭ 146 (+210.64%)
Mutual labels:  regression, classification
R-Machine-Learning
D-Lab's 6 hour introduction to machine learning in R. Learn the fundamentals of machine learning, regression, and classification, using tidymodels in R.
Stars: ✭ 27 (-42.55%)
Mutual labels:  regression, classification

Feature Selection using Stochastic Gates (STG)

Project Page|Paper

Feature Selection using Stochastic Gates (STG) is a method for feature selection in neural network estimation problems. The new procedure is based on probabilistic relaxation of the l0 norm of features, or the count of the number of selected features. The proposed framework simultaneously learns either a nonlinear regression or classification function while selecting a small subset of features.

stg_image
Top: Each stochastic gate z_d is drawn from the STG approximation of the Bernoulli distribution (shown as the blue histogram on the right). Specifically, z_d is obtained by applying the hard-sigmoid function to a mean-shifted Gaussian random variable. Bottom: The z_d stochastic gate is attached to the x_d input feature, where the trainable parameter µ_d controls the probability of the gate being active

Python

Installation

Installation with pip

To install with pip, run the following command:

pip install --user stg

Installation from GitHub

You can also clone the repository and install manually:

git clone 
cd stg/python
python setup.py install --user

Usage

Once you install the library, you can import STG to create a model instance:

from stg import STG
model = STG(task_type='regression',input_dim=X_train.shape[1], output_dim=1, hidden_dims=[500, 50, 10], activation='tanh', optimizer='SGD', learning_rate=0.1, batch_size=X_train.shape[0], feature_selection=True, sigma=0.5, lam=0.1, random_state=1, device="cpu") 

model.fit(X_train, y_train, nr_epochs=3000, valid_X=X_valid, valid_y=y_valid, print_interval=1000)
# Start training...

For more details, please see our Colab notebooks:

R

Installation

You first need to install the python package.

Installation from CRAN

Run the following command in your R console:

install.packages("Rstg")

Installation from Github

git clone git://github.com/runopti/stg.git
cd stg/python
python setup.py install --user
cd ../Rstg
R CMD INSTALL .

Usage

Please set the python path for reticulate to the python environment that you install the python stg package via this command in your R console or at the beginning of your R script.

reticulate::use_python("path_to_your_python_env_with_stg")

Then you can instantiate a trainer:

stg_trainer <- stg(task_type='regression', input_dim=100L, output_dim=1L, hidden_dims = c(500,50, 10), activation='tanh', optimizer='SGD', learning_rate=0.1, batch_size=100L, feature_selection=TRUE, sigma=0.5, lam=0.1, random_state=0.1)

You can then fit the model to data as follows:

# After preparing `X_train`, `y_train`, `X_valid`, and `y_valid'
stg_trainer$fit(X_train, y_train, nr_epochs=5000L, valid_X=X_valid, valid_y=y_valid, print_interval=1000L)

You can save your trained model

stg_trainer$save_checkpoint('r_test_model.pth')

and load the model

stg_trainer$load_checkpoint('r_test_mode.pth')

Acknowledgements and References

We thank Junchen Yang for his help to develop the R wrapper. Some of our codebase and its structure is inspired by https://github.com/vacancy/Jacinle.

If you find our library useful in your research, please consider citing us:

@incollection{icml2020_5085,
 author = {Yamada, Yutaro and Lindenbaum, Ofir and Negahban, Sahand and Kluger, Yuval},
 booktitle = {Proceedings of Machine Learning and Systems 2020},
 pages = {8952--8963},
 title = {Feature Selection using Stochastic Gates},
 year = {2020}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].