cromp

The official implementation of CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters) along with experimental test pipeline

https://github.com/kb-open/cromp

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

constrained-regression cromp interpretable-ai multiple-linear-regression operationalizing-machine-learning prior-knowledge wage-model
Last synced: 6 months ago · JSON representation ·

Repository

The official implementation of CROMP (Constrained Regression with Ordered and Margin-sensitive Parameters) along with experimental test pipeline

Basic Info
  • Host: GitHub
  • Owner: kb-open
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 2.57 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 5
Topics
constrained-regression cromp interpretable-ai multiple-linear-regression operationalizing-machine-learning prior-knowledge wage-model
Created over 3 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

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: bash pip install cromp


💻 Dependencies

The package depends on: * python >= 3.11 * scipy * numpy * pandas

The tests depend additionally on: * scikit-learn * Data scientist salary data * Ames House price data * SCB Sweden wage 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.

```python

from cromp import CROMPTrain, CROMPPredict

df = pd.readcsv("tests/data/ameshousepricesdata.csv") dftrain = df.iloc[:-50, :] dftest = df.iloc[-50:, :]

targetcol = 'SalePrice' featsinascorder = ['1stFlrSF', 'TotalBsmtSF', 'GrLivArea'] featsinno_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)!

retsuccess = model.configconstraints(featsinascorder, mingappct=0.5, featsinnoorder, lb=0.0, ub=100.0, no_intercept=True)

Train

retsuccess, crompmodel = model.train(dftrain, targetcol)

Predict

model = CROMPPredict(crompmodel) result = model.predict(dftest) ```


☕ 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:

bibtex @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} }

Owner

  • Name: K B
  • Login: kb-open
  • Kind: user
  • Company: https://inxiteout.ai/

Citation (CITATION.cff)

cff-version: 1.2.0
title: >-
  CROMP (Constrained Regression with Ordered and
  Margin-sensitive Parameters)
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Kaushik
    family-names: Bar
    email: kb.opendev@gmail.com
    affiliation: Inxite Out Pvt Ltd
    orcid: 'https://orcid.org/0000-0002-1167-7303'
repository-code: 'https://github.com/kb-open/CROMP'
repository-artifact: 'https://pypi.org/project/cromp/'
abstract: >-
  This software provides the official implementation
  of CROMP (Constrained Regression with Ordered and
  Margin-sensitive Parameters).
keywords:
  - cromp
  - constrained regression
  - interpretable ai
license: MIT
date-released: '2022-10-06'
version: v0.0.3
publisher: 
  name: "Zenodo"
doi: 10.5281/zenodo.7152807
url: 'https://doi.org/10.5281/zenodo.7152807'

GitHub Events

Total
  • Release event: 2
  • Push event: 18
  • Create event: 2
Last Year
  • Release event: 2
  • Push event: 18
  • Create event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 45
  • Total Committers: 2
  • Avg Commits per committer: 22.5
  • Development Distribution Score (DDS): 0.089
Top Committers
Name Email Commits
kaushikbar k****t@g****m 41
Kaushik Bar 7****n@u****m 4

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 14 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 12
  • Total maintainers: 1
pypi.org: cromp

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. In addition, CROMP also allows coefficients without any order or margin restrictions.

  • Homepage: https://github.com/kb-open/CROMP
  • Documentation: https://cromp.readthedocs.io/
  • License: MIT License Copyright (c) 2022 Kaushik Bar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.1.1
    published 7 months ago
  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 14 Last month
Rankings
Dependent packages count: 6.6%
Average: 30.0%
Forks count: 30.5%
Dependent repos count: 30.6%
Stargazers count: 32.3%
Downloads: 49.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

tests/requirements.txt pypi
  • scikit-learn * test
.github/workflows/test_build.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
pyproject.toml pypi
setup.py pypi