Skip to main content

Research Paper Research Paper DOI PyPI - Python PyPI - License PyPI - PyPi Build

✏️ 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 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 regression models with prior knowledge") under publication.

Author: Kaushik Bar

🎯 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
  • Coefficients without any order or margin restrictions

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.11
  • scipy
  • numpy
  • pandas

The tests depend additionally on:


🚀 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'
>>> feats_in_asc_order = ['1stFlrSF', 'TotalBsmtSF', 'GrLivArea']
>>> feats_in_no_order = []

>>> # Instantiate model
>>> model = CROMPTrain()

>>> # Configure constraints: 
>>> # (i) Dollar increase for each unit of increase of each of the above factors is bounded between 0 and 100.
>>> # (ii) Dollar increase for each unit increase in 'TotalBsmtSF' is at least 50% more than that for '1stFlrSF'.
>>> # (iii) Dollar increase for each unit increase in 'GrLivArea' is at least 50% more than that for 'TotalBsmtSF'.
>>> # (iv) Zero price for zero area (obviously)!
>>> ret_success = model.config_constraints(feats_in_asc_order, min_gap_pct=0.5, feats_in_no_order, lb=0.0, ub=100.0, no_intercept=True)

>>> # Train
>>> ret_success, cromp_model = model.train(df_train, target_col)

>>> # Predict
>>> model = CROMPPredict(cromp_model)
>>> result = model.predict(df_test)

☕ Contact

Feel free to contact Kaushik Bar if you have any further questions / feedback.

Author Affiliation: Inxite Out Pvt Ltd


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},
publisher = {Zenodo},
doi = {10.5281/zenodo.7152807},
url = {https://doi.org/10.5281/zenodo.7152807},
publisher = {Intelligent Decision Technologies, Volume 19, Issue 6, Pp. 4380-4395, Nov 2025, Sage Journals},
doi = {10.1177/18724981251393590},
url = {https://doi.org/10.1177/18724981251393590}
}

Release files for cromp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cromp 0.1.2
File Size Uploaded
cromp-0.1.2.tar.gz 11.5 kB Details

Release files / cromp-0.1.2.tar.gz

Download URL cromp-0.1.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2ecfbdad31012c084a3498583c82c91a272b34f8be9912a1a43b1fd995fc0721
BLAKE2b-256 checksum
How to use checksums
0325292640262ef128cbf07411b28c2c8cee93c61ad58e93212cc4dd4094b3a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page