The official implementation of CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters). CROMP allows user-defined order among the coefficients, user-defined minimum margins (i.e., percentage gaps) between them, and user-defined lower and upper bounds for each coefficient.
Project description
✏️ CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters)
This repo provides the official implementation of CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters) along with the test dataset and the experimental test pipeline code to reproduce the benchmarking results as described in the CROMP paper ("Constrained Regression with Ordered and Margin-sensitive Parameters: Application in improving interpretability for wage models with prior knowledge").
Author: Kaushik Bar
Author Affiliation: Inxite Out Pvt Ltd
🎯 Quick Info
CROMP allows:
- User-defined order among the coefficients
- User-defined minimum margins (i.e., percentage gaps) between the coefficients
- User-defined lower and upper bounds for each coefficient
This package is both interpretable and accurate. There is no other package / library available in the public domain today with these capabilities.
💻 Installation
Install using PyPI:
pip install cromp
💻 Dependencies
The package depends on:
- python >= 3.6
- scipy
- numpy
- pandas
The tests depend additionally on:
- scikit-learn
- Data scientist salary data
- Ames House price data
🚀 Usage
Below is a minimal usage guide. This library aloows flexibility for more fine-grained controls for each coefficient separately. Please go through the tests in addition to see more examples.
>>> from cromp import CROMPTrain, CROMPPredict
>>> df = pd.read_csv("tests/data/ames_house_prices_data.csv")
>>> df_train = df.iloc[:-50, :]
>>> df_test = df.iloc[-50:, :]
>>> target_col = 'SalePrice'
>>> feature_cols_in_asc_order = ['1stFlrSF', 'TotalBsmtSF', 'GrLivArea']
>>> # Instantiate and configure
>>> model = CROMPTrain()
>>> ret_success = model.configure(df_train, target_col, feature_cols_in_asc_order, min_gap_pct=0.5, lb=0.0, ub=100.0, no_intercept=True)
>>> # Train
>>> ret_success, wages = model.train()
>>> # Predict
>>> model = CROMPPredict(wages)
>>> ret_success, result = model.predict(df_test, feature_cols_in_asc_order)
☕ Contact
Feel free to contact Kaushik Bar if you have any further questions / feedback.
Citation
To cite CROMP in your work, please use the following bibtex reference:
@software{Bar_CROMP_Constrained_Regression_2022,
author = {Bar, Kaushik},
license = {MIT},
month = {10},
title = {{CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters)}},
url = {https://github.com/kb-open/CROMP},
year = {2022}
version = {v0.0.3},
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.