You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.
17
15
18
-
**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.
19
-
20
-
Main Features
16
+
Main features
21
17
=============
22
18
23
19
- Prepare a given pandas DataFrame for predictive modelling:
24
20
25
21
- partition into train/selection/validation sets
26
22
- create bins from continuous variables
27
23
- regroup categorical variables based on statistical significance
28
-
- replace missing values and
29
-
- add columns with incidence rate per category/bin
24
+
- replace missing values
25
+
- add columns where categories/bins are replaced with average of target values (linear regression) or with incidence rate (logistic regression)
30
26
31
-
- Perform univariate feature selection based on AUC
27
+
- Perform univariate feature selection based on RMSE (linear regression) or AUC (logistic regression)
32
28
- Compute correlation matrix of predictors
33
29
- Find the suitable variables using forward feature selection
34
30
- Evaluate model performance and visualize the results
@@ -41,49 +37,40 @@ These instructions will get you a copy of the project up and running on your loc
41
37
Requirements
42
38
------------
43
39
44
-
This package requires the usual Python packages for data science:
45
-
46
-
- numpy (>=1.19.4)
47
-
- pandas (>=1.1.5)
48
-
- scipy (>=1.5.4)
49
-
- scikit-learn (>=0.23.1)
50
-
- matplotlib (>=3.3.3)
51
-
- seaborn (>=0.11.0)
52
-
53
-
54
-
These packages, along with their versions are listed in ``requirements.txt`` and can be installed using ``pip``: ::
55
-
40
+
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``: ::
56
41
57
42
pip install -r requirements.txt
58
43
59
44
60
-
**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.
45
+
**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.
61
46
62
47
Installation
63
48
------------
64
49
65
-
The easiest way to install cobra is using ``pip``: ::
50
+
The easiest way to install Cobra is using ``pip``: ::
66
51
67
52
pip install -U pythonpredictions-cobra
68
53
69
-
Contributing to cobra
70
-
=====================
71
54
72
-
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, ...).
73
-
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.
55
+
Documentation and extra material
56
+
================================
57
+
58
+
- A `blog post <https://www.pythonpredictions.com/news/the-little-trick-we-apply-to-obtain-explainability-by-design/>`_ on the overall methodology.
59
+
60
+
- 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.
74
61
75
-
For more details, check our `wiki <https://github.com/PythonPredictions/cobra/wiki/Contributing-guidelines-&-workflows>`_.
62
+
- HTML documentation of the `individual modules <https://pythonpredictions.github.io/cobra.io/docstring/modules.html>`_.
76
63
77
-
Help and Support
78
-
================
64
+
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra/tutorials/tutorial_Cobra_logistic_regression.ipynb>`_ for **logistic regression**.
79
65
80
-
Documentation
81
-
-------------
66
+
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra/tutorials/tutorial_Cobra_linear_regression.ipynb>`__ for **linear regression**.
82
67
83
-
- HTML documentation of the `individual modules <https://pythonpredictions.github.io/cobra.io/docstring/modules.html>`_
84
-
- A step-by-step `tutorial <https://pythonpredictions.github.io/cobra.io/tutorial.html>`_
68
+
- 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.
69
+
70
+
Contributing to Cobra
71
+
=====================
85
72
86
-
Outreach
87
-
-------------
73
+
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, ...).
74
+
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.
88
75
89
-
- 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)
76
+
For more details, check out our `wiki<https://github.com/PythonPredictions/cobra/wiki/Contributing-guidelines-&-workflows>`_.
0 commit comments