Skip to main content

A Python library for sparse-input neural networks using group concave regularization

Project description

GCRNet: Sparse-Input Neural Networks with Group Concave Regularization

Project Page|Paper

GCRNet is a Python library that implements a novel framework for sparse-input neural networks using group concave regularization. Leveraging the power of concave penalties, specifically MCP and SCAD, GCRNet provides a comprehensive approach for simultaneous feature selection and non-linear function estimation. The proposed framework considers all outgoing connections from a single input neuron as a group and applies an appropriate concave penalty to the $l_2$ norm of weights within each group. By selectively shrinking the weights of certain groups to exact zeros, GCRNet constructs a neural network that utilizes only a small subset of variables, enhancing both the accuracy and interpretability of the feature selection process. GCRNet offers versatile functionality, supporting regression or classification tasks with continuous, binary, or time-to-event outcomes.

Installation

Installation with pip

To install with pip, run the following command:

pip install --user gcrnet

Installation from GitHub

You can also clone the repository and install manually:

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

Usage

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

from gcrnet import GCRNet
lam=np.exp(np.linspace(np.log(0.01),np.log(0.5), 50))
gmcp_net = GCRNet(task_type='regression',device=torch.device("cpu"), input_dim=train_data['X'].shape[1], output_dim=1, hidden_dims=[10,5], activation="relu",
    optimizer="Adam",learning_rate=0.001, batch_size=train_data['X'].shape[0], 
    alpha=0.01, lam=lam, penalty="MCP",drop_input=True)

# fit model and tune parameters
param_grid={"alpha":[0.03]}
gmcp_net= gmcp_net.fit_and_validate(X=train_data['X'], y=train_data['y'], 
                              param_grid=param_grid, init_num_epochs=2000, num_epochs=200, verbose=True, print_interval=200)

For more details, please see our Colab notebooks:

Acknowledgements and References

Some of our codebase and its structure are inspired by https://github.com/runopti/stg.

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

@misc{luo2023sparseinput,
      title={Sparse-Input Neural Network using Group Concave Regularization}, 
      author={Bin Luo and Susan Halabi},
      year={2023},
      eprint={2307.00344},
      archivePrefix={arXiv},
      primaryClass={stat.ML}
}

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

gcrnet-1.1.0.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcrnet-1.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file gcrnet-1.1.0.tar.gz.

File metadata

  • Download URL: gcrnet-1.1.0.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gcrnet-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b9354a082fdcd1f8e3c36d18b28badbae936eddcba8da0433f3c82399c9eefff
MD5 339fe454e9bc5bad1be2c7d3cd3bbbae
BLAKE2b-256 194d49a61561da82c280e9e4cb63c252f8aa65ab51cdbca0816e9fd7a3683023

See more details on using hashes here.

File details

Details for the file gcrnet-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: gcrnet-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gcrnet-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e53109b23b5e1fe69031224d39718a38466a841eeba4d44958ddc7e066940942
MD5 318cc7c3487f9ae44e44b496d59f2ead
BLAKE2b-256 e4f318a687aa5ca9a3eddd02cb27541880985cccfd639c53c5f95319c916fe16

See more details on using hashes here.

Supported by

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