Skip to main content

bess Python Package

Project description

# Bess: An python Package for Best Subset Selection in Linear and Logistic Model


## Introduction

One of the main tasks of statistical modeling is to exploit the association between
a response variable and multiple predictors. Linear model (LM), as a simple parametric
regression model, is often used to capture linear dependence between response and
predictors. The anothe model--generalized linear model (GLM), can be considered as
the extensions of linear model, depending on the types of responses. Parameter estimation in these models
can be computationally intensive when the number of predictors is large. Meanwhile,
Occam鈥檚 razor is widely accepted as a heuristic rule for statistical modeling,
which balances goodness of 铿乼 and model complexity. This rule leads to a relative
small subset of important predictors.

**bess** package provides solutions for best subset selection problem for sparse LM,
and GLM models.

We consider a primal-dual active set (PDAS) approach to exactly solve the best subset
selection problem for sparse LM, GLM and CoxPH models. The PDAS algorithm for linear
least squares problems was 铿乺st introduced by [Ito and Kunisch (2013)](https://iopscience.iop.org/article/10.1088/0266-5611/30/1/015001)
and later discussed by [Jiao, Jin, and Lu (2015)](https://arxiv.org/abs/1403.0515) and [Huang, Jiao, Liu, and Lu (2017)](https://arxiv.org/abs/1701.05128).
It utilizes an active set updating strategy and 铿乼s the sub-models through use of
complementary primal and dual variables. We generalize the PDAS algorithm for
general convex loss functions with the best subset constraint, and further
extend it to support both sequential and golden section search strategies
for optimal k determination.


## Install

Python Version
- python >= 3.5

Modules needed
- numpy

The package has been publish in PyPI. You can easy install by:
```sh
$ pip install bess
```

## Example
```python console
>>> from bess.bess import *
>>> import numpy as np
>>> np.random.seed(123) # fix seed to get the same result

### Data information
>>> train_X = np.random.normal(0, 1, 10 * 5).reshape((10, 5)) # train_x
>>> train_y = np.random.normal(0, 1, 10) # train_y
>>> test_X = np.random.normal(0, 1, 10 * 5).reshape((10, 5)) # test_x
>>> data_type = 1 #data_type: 1:regression 2:2-classification

### Model information.
>>> sequence = [1, 2, 3]
>>> model = SPDAS_LM(sequence=sequence)

### Fit model.
>>> model.fit(train_X, train_y, data_type)

### Predict.
>>> model.predict(test_X)
[0.8487986542970937, -0.3262548528320405, -1.2427679709665753, -1.1018898695690327, -1.1589700150336006, 0.9170341511542658, -0.7894714094101583, -0.40658125651728766, -0.5161022067202307, -0.17317826396384567]

```

## Reference

- Wen, C. , Zhang, A. , Quan, S. , & Wang, X. . (2017). [Bess: an r package for best subset selection in linear, logistic and coxph models](https://arxiv.org/pdf/1709.06254.pdf)


## Bug report

Connect to [@Jiang-Kangkang](https://github.com/Jiang-Kangkang), or send an email to Jiang Kangkang(jiangkk3@mail2.sysu.edu.cn)



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

bess-0.0.2.win-amd64.zip (348.1 kB view details)

Uploaded Source

Built Distributions

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

bess-0.0.2-cp38-cp38-win_amd64.whl (350.8 kB view details)

Uploaded CPython 3.8Windows x86-64

bess-0.0.2-cp37-cp37m-win_amd64.whl (350.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

bess-0.0.2-cp36-cp36m-win_amd64.whl (350.8 kB view details)

Uploaded CPython 3.6mWindows x86-64

File details

Details for the file bess-0.0.2.win-amd64.zip.

File metadata

  • Download URL: bess-0.0.2.win-amd64.zip
  • Upload date:
  • Size: 348.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bess-0.0.2.win-amd64.zip
Algorithm Hash digest
SHA256 51df3f6dfc2a7427067f9010f8936e9763a82c5add695f3f63ba152e2735ef3a
MD5 e9056997413a2e90d48359f73f72f7e5
BLAKE2b-256 1079008d3577f40cfacfd170c53eb96ec37738cc23e04d9187944358f5626b9c

See more details on using hashes here.

File details

Details for the file bess-0.0.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: bess-0.0.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 350.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bess-0.0.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 cacd7629f11199459746ba708e233e6ebbdf02de7fa6491265cf50a6f96564db
MD5 db84e7ea0d34daebde1f9ff3d192aa6e
BLAKE2b-256 123fad0afbef875cc9e2aa18d620282e1077490aad27fbb7aecdf4e0d7c481c5

See more details on using hashes here.

File details

Details for the file bess-0.0.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: bess-0.0.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 350.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bess-0.0.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e27e24f7daab02ef48a9c2e05beecb8838e94068142f7ed7280e9742ec847336
MD5 2f01f4c9df89c4f8ff809bb458a5016c
BLAKE2b-256 2e4f43dd4c9cc0b57be45788616c30fe9be0ed3584ee3a4f23fc03f7a5f05701

See more details on using hashes here.

File details

Details for the file bess-0.0.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: bess-0.0.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 350.8 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bess-0.0.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f99cc0496344bb00c1a6e536826ca2c32460c3d9dc61b4e5b57023679117a914
MD5 19838aab7e19562629a4cf6d5a64ba47
BLAKE2b-256 5bea468d3d779e9b4f6e8cb6d4c5f4b6e03016483ecabdc51efaab95927d8472

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