Skip to content

Commit

Permalink
Merge pull request #113 from PythonPredictions/develop
Browse files Browse the repository at this point in the history
Release (develop -> master) of milestone 1.1.0.
  • Loading branch information
sandervh14 authored Oct 5, 2021
2 parents a44a693 + df7882e commit 16342ab
Show file tree
Hide file tree
Showing 35 changed files with 6,287 additions and 1,144 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ junit/
*.mo
*.pot

# Django stuff:
# Django stuff
*.log
local_settings.py

# Flask stuff:
# Flask stuff
instance/
.webassets-cache

# Scrapy stuff:
# Scrapy stuff
.scrapy

# Sphinx documentation
Expand Down
65 changes: 26 additions & 39 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

.. image:: https://github.com/PythonPredictions/cobra/raw/master/material/logo.png
:width: 700

.. image:: https://img.shields.io/pypi/v/pythonpredictions-cobra.svg
:target: https://pypi.org/project/pythonpredictions-cobra/
Expand All @@ -9,26 +11,20 @@

------------------------------------------------------------------------------------------------------------------------------------

=====
cobra
=====
.. image:: material\logo.png
:width: 300
**Cobra** is a Python package to build predictive models using linear or logistic regression with a focus on performance and interpretation. It consists of several modules for data preprocessing, feature selection and model evaluation. The underlying methodology was developed at `Python Predictions <https://www.pythonpredictions.com>`_ in the course of hundreds of business-related prediction challenges. It has been tweaked, tested and optimized over the years based on feedback from clients, our team, and academic researchers.

**cobra** is a Python package to build predictive models using logistic regression with a focus on performance and interpretation. It consists of several modules for data preprocessing, feature selection and model evaluation. The underlying methodology was developed at Python Predictions in the course of hundreds of business-related prediction challenges. It has been tweaked, tested and optimized over the years based on feedback from clients, our team, and academic researchers.

Main Features
Main features
=============

- Prepare a given pandas DataFrame for predictive modelling:

- partition into train/selection/validation sets
- create bins from continuous variables
- regroup categorical variables based on statistical significance
- replace missing values and
- add columns with incidence rate per category/bin
- replace missing values
- add columns where categories/bins are replaced with average of target values (linear regression) or with incidence rate (logistic regression)

- Perform univariate feature selection based on AUC
- Perform univariate feature selection based on RMSE (linear regression) or AUC (logistic regression)
- Compute correlation matrix of predictors
- Find the suitable variables using forward feature selection
- Evaluate model performance and visualize the results
Expand All @@ -41,49 +37,40 @@ These instructions will get you a copy of the project up and running on your loc
Requirements
------------

This package requires the usual Python packages for data science:

- numpy (>=1.19.4)
- pandas (>=1.1.5)
- scipy (>=1.5.4)
- scikit-learn (>=0.23.1)
- matplotlib (>=3.3.3)
- seaborn (>=0.11.0)


These packages, along with their versions are listed in ``requirements.txt`` and can be installed using ``pip``: ::

This package requires only the usual Python libraries for data science, being numpy, pandas, scipy, scikit-learn, matplotlib, seaborn, and tqdm. These packages, along with their versions are listed in ``requirements.txt`` and can be installed using ``pip``: ::

pip install -r requirements.txt


**Note**: if you want to install cobra with e.g. pip, you don't have to install all of these requirements as these are automatically installed with cobra itself.
**Note**: if you want to install Cobra with e.g. pip, you don't have to install all of these requirements as these are automatically installed with Cobra itself.

Installation
------------

The easiest way to install cobra is using ``pip``: ::
The easiest way to install Cobra is using ``pip``: ::

pip install -U pythonpredictions-cobra

Contributing to cobra
=====================

We'd love you to contribute to the development of cobra! There are many ways in which you can contribute, the most common of which is to contribute to the source code or documentation of the project. However, there are many other ways you can contribute (report issues, improve code coverage by adding unit tests, ...).
We use GitHub issue to track all bugs and feature requests. Feel free to open an issue in case you found a bug or in case you wish to see a new feature added.
Documentation and extra material
================================

- A `blog post <https://www.pythonpredictions.com/news/the-little-trick-we-apply-to-obtain-explainability-by-design/>`_ on the overall methodology.

- A `research article <https://doi.org/10.1016/j.dss.2016.11.007>`_ by Geert Verstraeten (co-founder Python Predictions) discussing the preprocessing approach we use in Cobra.

For more details, check our `wiki <https://github.com/PythonPredictions/cobra/wiki/Contributing-guidelines-&-workflows>`_.
- HTML documentation of the `individual modules <https://pythonpredictions.github.io/cobra.io/docstring/modules.html>`_.

Help and Support
================
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra/tutorials/tutorial_Cobra_logistic_regression.ipynb>`_ for **logistic regression**.

Documentation
-------------
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra/tutorials/tutorial_Cobra_linear_regression.ipynb>`__ for **linear regression**.

- HTML documentation of the `individual modules <https://pythonpredictions.github.io/cobra.io/docstring/modules.html>`_
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra.io/tutorial.html>`_
- Check out the Data Science Leuven Meetup `talk <https://www.youtube.com/watch?v=w7ceZZqMEaA&feature=youtu.be>`_ by one of the core developers (second presentation). His `slides <https://github.com/PythonPredictions/Cobra-DS-meetup-Leuven/blob/main/DS_Leuven_meetup_20210209_cobra.pdf>`_ and `related material <https://github.com/PythonPredictions/Cobra-DS-meetup-Leuven>`_ are also available.

Contributing to Cobra
=====================

Outreach
-------------
We'd love you to contribute to the development of Cobra! There are many ways in which you can contribute, the most common of which is to contribute to the source code or documentation of the project. However, there are many other ways you can contribute (report issues, improve code coverage by adding unit tests, ...).
We use GitHub issues to track all bugs and feature requests. Feel free to open an issue in case you found a bug or in case you wish to see a new feature added.

- Check out the Data Science Leuven Meetup `talk <https://www.youtube.com/watch?v=w7ceZZqMEaA&feature=youtu.be>`_ by one of the core developers (second presentation)
For more details, check out our `wiki <https://github.com/PythonPredictions/cobra/wiki/Contributing-guidelines-&-workflows>`_.
1 change: 1 addition & 0 deletions cobra/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .version import __version__
7 changes: 4 additions & 3 deletions cobra/evaluation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from .plotting_utils import plot_univariate_predictor_quality
from .plotting_utils import plot_correlation_matrix

from .evaluator import Evaluator

# from .evaluator import Evaluator
from .evaluator import ClassificationEvaluator, RegressionEvaluator

__all__ = ["generate_pig_tables",
"compute_pig_table",
Expand All @@ -18,4 +18,5 @@
"plot_variable_importance",
"plot_univariate_predictor_quality",
"plot_correlation_matrix",
"Evaluator"]
"ClassificationEvaluator",
"RegressionEvaluator"]
Loading

0 comments on commit 16342ab

Please sign in to comment.