Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhao062 committed Jul 29, 2019
1 parent 3194f85 commit 99271aa
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 60 deletions.
130 changes: 72 additions & 58 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ combo: A Python Toolbox for Machine Learning Model Combination
:alt: Downloads


-----
----


**Build Status & Coverage & Maintainability & License**
Expand Down Expand Up @@ -65,7 +65,7 @@ combo: A Python Toolbox for Machine Learning Model Combination
:alt: License


-----
----


**combo** is a comprehensive Python toolbox for combining machine
Expand Down Expand Up @@ -119,9 +119,9 @@ combo is featured for:
* `Installation <#installation>`_
* `API Cheatsheet & Reference <#api-cheatsheet--reference>`_
* `Proposed Algorithms <#proposed-algorithms>`_
* `An Example of Stacking <#an-example-of-stacking>`_
* `Quick Start for Classifier Combination <#quick-start-for-classifier-combination>`_
* `Quick Start for Clustering Combination <#quick-start-for-clustering-combination>`_
* `An Example of Stacking <#an-example-of-stacking>`_
* `Development Status <#development-status>`_


Expand Down Expand Up @@ -158,6 +158,7 @@ Alternatively, you could clone and run setup.py file:
* matplotlib
* numpy>=1.13
* numba>=0.35
* pyod
* scipy>=0.19.1
* scikit_learn>=0.19.1

Expand Down Expand Up @@ -226,7 +227,58 @@ Some of the methods are tasks specific:
:target: https://raw.githubusercontent.com/yzhao062/combo/master/examples/ALL.png
:alt: Comparison of Selected Models

-----

----


An Example of Stacking
^^^^^^^^^^^^^^^^^^^^^^

`"examples/stacking_example.py" <https://github.com/yzhao062/combo/blob/master/examples/stacking_example.py>`_
demonstrates the basic API of stacking (meta ensembling).


#. Initialize a group of classifiers as base estimators

.. code-block:: python
# initialize a group of classifiers
classifiers = [DecisionTreeClassifier(), LogisticRegression(),
KNeighborsClassifier(), RandomForestClassifier(),
GradientBoostingClassifier()]
#. Initialize, fit, predict, and evaluate with Stacking

.. code-block:: python
from combo.models.stacking import Stacking
clf = Stacking(base_estimators=classifiers, n_folds=4, shuffle_data=False,
keep_original=True, use_proba=False, random_state=random_state)
clf.fit(X_train, y_train)
y_test_predict = clf.predict(X_test)
evaluate_print('Stacking | ', y_test, y_test_predict)
#. See a sample output of stacking_example.py

.. code-block:: python
Decision Tree | Accuracy:0.9386, ROC:0.9383, F1:0.9521
Logistic Regression | Accuracy:0.9649, ROC:0.9615, F1:0.973
K Neighbors | Accuracy:0.9561, ROC:0.9519, F1:0.9662
Gradient Boosting | Accuracy:0.9605, ROC:0.9524, F1:0.9699
Random Forest | Accuracy:0.9605, ROC:0.961, F1:0.9693
Stacking | Accuracy:0.9868, ROC:0.9841, F1:0.9899
----


Quick Start for Classifier Combination
Expand Down Expand Up @@ -278,7 +330,7 @@ demonstrates the basic API of predicting with multiple classifiers. **It is note
Combination by median| Accuracy:0.9693, ROC:0.9677, F1:0.9763
-----
----


Quick Start for Clustering Combination
Expand Down Expand Up @@ -320,57 +372,7 @@ demonstrates the basic API of combining multiple base clustering estimators.
predicted_labels = clf.labels_
-----


An Example of Stacking
^^^^^^^^^^^^^^^^^^^^^^

`"examples/stacking_example.py" <https://github.com/yzhao062/combo/blob/master/examples/stacking_example.py>`_
demonstrates the basic API of stacking (meta ensembling).


#. Initialize a group of classifiers as base estimators

.. code-block:: python
# initialize a group of classifiers
classifiers = [DecisionTreeClassifier(), LogisticRegression(),
KNeighborsClassifier(), RandomForestClassifier(),
GradientBoostingClassifier()]
#. Initialize, fit, predict, and evaluate with Stacking

.. code-block:: python
from combo.models.stacking import Stacking
clf = Stacking(base_estimators=classifiers, n_folds=4, shuffle_data=False,
keep_original=True, use_proba=False, random_state=random_state)
clf.fit(X_train, y_train)
y_test_predict = clf.predict(X_test)
evaluate_print('Stacking | ', y_test, y_test_predict)
#. See a sample output of stacking_example.py

.. code-block:: python
Decision Tree | Accuracy:0.9386, ROC:0.9383, F1:0.9521
Logistic Regression | Accuracy:0.9649, ROC:0.9615, F1:0.973
K Neighbors | Accuracy:0.9561, ROC:0.9519, F1:0.9662
Gradient Boosting | Accuracy:0.9605, ROC:0.9524, F1:0.9699
Random Forest | Accuracy:0.9605, ROC:0.961, F1:0.9693
Stacking | Accuracy:0.9868, ROC:0.9841, F1:0.9899
-----
----


Development Status
Expand All @@ -385,8 +387,20 @@ combo is also targeted to be published in *Journal of Machine Learning Research
`open-source software track <http://www.jmlr.org/mloss/>`_. A demo paper to
*AAAI* or *IJCAI* may be submitted soon for progress update.

**Watch & Star** to get the latest update! Also feel free to send me an email (zhaoy@cmu.edu)
for suggestions and ideas.

----


Inclusion Criteria
^^^^^^^^^^^^^^^^^^

Similarly to `scikit-learn <https://scikit-learn.org/stable/faq.html#what-are-the-inclusion-criteria-for-new-algorithms>`_,
We mainly consider well-established algorithms for inclusion.
A rule of thumb is at least two years since publication, 50+ citations, and usefulness.

However, we encourage the author(s) of newly proposed models to share and add your implementation into combo
for boosting ML accessibility and reproducibility.
This exception only applies if you could commit to the maintenance of your model for at least two year period.


----
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Welcome to combo's documentation!
:alt: Downloads


-----
----


**Build Status & Coverage & Maintainability & License**
Expand Down Expand Up @@ -70,7 +70,7 @@ Welcome to combo's documentation!
:alt: License


-----
----


**combo** is a comprehensive Python toolbox for combining machine
Expand Down
1 change: 1 addition & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ Alternatively, you could clone and run setup.py file:
* matplotlib
* numpy>=1.13
* numba>=0.35
* pyod
* scipy>=0.19.1
* scikit_learn>=0.19.1

0 comments on commit 99271aa

Please sign in to comment.