diff --git a/doc/tutorial/auto_examples/auto_examples_jupyter.zip b/doc/tutorial/auto_examples/auto_examples_jupyter.zip index 71cae011e4df6bcb56b719d0678e194a7fb1fbb0..406a6bbfecc33827931c4bf3d2a95aea32d71c28 100644 Binary files a/doc/tutorial/auto_examples/auto_examples_jupyter.zip and b/doc/tutorial/auto_examples/auto_examples_jupyter.zip differ diff --git a/doc/tutorial/auto_examples/auto_examples_python.zip b/doc/tutorial/auto_examples/auto_examples_python.zip index e13a39541dfa82aba880d1fdda529b9a231ae61b..f97869f58a3c70107f1a8109c4f872df94909a07 100644 Binary files a/doc/tutorial/auto_examples/auto_examples_python.zip and b/doc/tutorial/auto_examples/auto_examples_python.zip differ diff --git a/doc/tutorial/auto_examples/cumbo/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png b/doc/tutorial/auto_examples/cumbo/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/cumbo/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes.rst b/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes.rst index fd2ac2716148c6a47372b996801a4edc209fcdd7..8863d1d7bf973b7736d7751ab4b29145a7b3a487 100644 --- a/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes.rst +++ b/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes.rst @@ -175,7 +175,7 @@ rightly classify the points. .. rst-class:: sphx-glr-timing - **Total running time of the script:** ( 0 minutes 0.926 seconds) + **Total running time of the script:** ( 0 minutes 0.603 seconds) .. _sphx_glr_download_tutorial_auto_examples_cumbo_plot_cumbo_2_views_2_classes.py: diff --git a/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes_codeobj.pickle b/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes_codeobj.pickle index 46f31f8bc0410beb38b60cce658754762051120c..45d9bbcf64b3fbbf2c4dba2a5ff0572d76554a74 100644 Binary files a/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes_codeobj.pickle and b/doc/tutorial/auto_examples/cumbo/plot_cumbo_2_views_2_classes_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes.rst b/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes.rst index 07d466987c9d5cfa3106642357ea4de904421aaf..7e4e0e723fb01c87257356ec39b15b57b6d513f6 100644 --- a/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes.rst +++ b/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes.rst @@ -51,6 +51,8 @@ the views to rightly classify the points. The second figure displays the classification results for the sub-classifiers on the learning sample data. + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/cumbo/plot_cumbo_3_views_3_classes.py:121: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() @@ -170,7 +172,7 @@ the views to rightly classify the points. .. rst-class:: sphx-glr-timing - **Total running time of the script:** ( 0 minutes 0.497 seconds) + **Total running time of the script:** ( 0 minutes 0.499 seconds) .. _sphx_glr_download_tutorial_auto_examples_cumbo_plot_cumbo_3_views_3_classes.py: diff --git a/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes_codeobj.pickle b/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes_codeobj.pickle index 746fbf9ac929cb3135a4802a315dfa4898275a83..ed66ef929d9a0c1d0569d35db829cbcbebebbfe5 100644 Binary files a/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes_codeobj.pickle and b/doc/tutorial/auto_examples/cumbo/plot_cumbo_3_views_3_classes_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/cumbo/sg_execution_times.rst b/doc/tutorial/auto_examples/cumbo/sg_execution_times.rst index 8a8e3b008ff87c834e1add9029f44a4729a5b9df..70b3c32a0a0c84ad2aee34a5093e2e355779e190 100644 --- a/doc/tutorial/auto_examples/cumbo/sg_execution_times.rst +++ b/doc/tutorial/auto_examples/cumbo/sg_execution_times.rst @@ -5,10 +5,10 @@ Computation times ================= -**00:00.926** total execution time for **tutorial_auto_examples_cumbo** files: +**00:01.102** total execution time for **tutorial_auto_examples_cumbo** files: +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_tutorial_auto_examples_cumbo_plot_cumbo_2_views_2_classes.py` (``plot_cumbo_2_views_2_classes.py``) | 00:00.926 | 0.0 MB | +| :ref:`sphx_glr_tutorial_auto_examples_cumbo_plot_cumbo_2_views_2_classes.py` (``plot_cumbo_2_views_2_classes.py``) | 00:00.603 | 0.0 MB | +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_tutorial_auto_examples_cumbo_plot_cumbo_3_views_3_classes.py` (``plot_cumbo_3_views_3_classes.py``) | 00:00.000 | 0.0 MB | +| :ref:`sphx_glr_tutorial_auto_examples_cumbo_plot_cumbo_3_views_3_classes.py` (``plot_cumbo_3_views_3_classes.py``) | 00:00.499 | 0.0 MB | +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ diff --git a/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_001.png b/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_001.png deleted file mode 100644 index 6c10bfca50d38ffb88d84b3bd7603ff549a6f5e2..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_001.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_002.png b/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_002.png deleted file mode 100644 index 0a7b2d55a07522b45d671a4a5135e0a96d1c6727..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/sphx_glr_plot_2_views_2_classes_002.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_001.png b/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_001.png deleted file mode 100644 index 34d20dc6f92a4bfed33da87d308a7e6ecb2aaa0a..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_001.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_002.png b/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_002.png deleted file mode 100644 index c17cb7816691a1c00401885d938ec50f7afd366f..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/sphx_glr_plot_3_views_3_classes_002.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_2_views_2_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_2_views_2_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_2_views_2_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_cumbo_plot_3_views_3_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mvml_plot__thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_mvml_plot__thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_mvml_plot__thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_2_views_2_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_2_views_2_classes_thumb.png deleted file mode 100644 index 5387f6d37a91d3136168809c420c760dbb86cb43..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_2_views_2_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_3_views_3_classes_thumb.png b/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_3_views_3_classes_thumb.png deleted file mode 100644 index 5f94c4d01baf9fd165269e47b7a85b55cde225a7..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/images/thumb/sphx_glr_plot_3_views_3_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/index.rst b/doc/tutorial/auto_examples/index.rst index c3430b3dc68497c33a8e8b9173b0e91c4fbd85ee..9faaee6ac2a401ff41f1c5f965aeafae4654aea1 100644 --- a/doc/tutorial/auto_examples/index.rst +++ b/doc/tutorial/auto_examples/index.rst @@ -169,6 +169,122 @@ The following toy examples illustrate how the MVML algorithm +.. _sphx_glr_tutorial_auto_examples_usecase: + + +Use Case Examples +----------------- + +The following toy examples illustrate how the multimodal as usecase on digit dataset of sklearn + + + + +.. raw:: html + + <div class="sphx-glr-thumbcontainer" tooltip="Function plot_subplot"> + +.. only:: html + + .. figure:: /tutorial/auto_examples/usecase/images/thumb/sphx_glr_usecase_function_thumb.png + + :ref:`sphx_glr_tutorial_auto_examples_usecase_usecase_function.py` + +.. raw:: html + + </div> + + +.. toctree:: + :hidden: + + /tutorial/auto_examples/usecase/usecase_function + +.. raw:: html + + <div class="sphx-glr-thumbcontainer" tooltip="multi class digit from sklearn, multivue - vue 0 digit data (color of sklearn) - vue 1 gradia..."> + +.. only:: html + + .. figure:: /tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMVML_thumb.png + + :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMVML.py` + +.. raw:: html + + </div> + + +.. toctree:: + :hidden: + + /tutorial/auto_examples/usecase/plot_usecase_exampleMVML + +.. raw:: html + + <div class="sphx-glr-thumbcontainer" tooltip="multi class digit from sklearn, multivue - vue 0 digit data (color of sklearn) - vue 1 gradia..."> + +.. only:: html + + .. figure:: /tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMumBo_thumb.png + + :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMumBo.py` + +.. raw:: html + + </div> + + +.. toctree:: + :hidden: + + /tutorial/auto_examples/usecase/plot_usecase_exampleMumBo + +.. raw:: html + + <div class="sphx-glr-thumbcontainer" tooltip="multi class digit from sklearn, multivue - vue 0 digit data (color of sklearn) - vue 1 gradia..."> + +.. only:: html + + .. figure:: /tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMuCuBo_thumb.png + + :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMuCuBo.py` + +.. raw:: html + + </div> + + +.. toctree:: + :hidden: + + /tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo + +.. raw:: html + + <div class="sphx-glr-thumbcontainer" tooltip="Use Case MKL"> + +.. only:: html + + .. figure:: /tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMKL_thumb.png + + :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMKL.py` + +.. raw:: html + + </div> + + +.. toctree:: + :hidden: + + /tutorial/auto_examples/usecase/plot_usecase_exampleMKL +.. raw:: html + + <div class="sphx-glr-clear"></div> + + + .. only :: html .. container:: sphx-glr-footer diff --git a/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png b/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_2_views_2_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png b/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/mumbo/images/thumb/sphx_glr_mumbo_plot_3_views_3_classes_thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes.rst b/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes.rst index 1904945a162e0e24b61a5fd4ebb3536fded11abe..1531b31ca19e3a3878a219af7fea551b88857cbf 100644 --- a/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes.rst +++ b/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes.rst @@ -71,6 +71,8 @@ rightly classify the points. The second figure displays the classification results for the sub-classifiers on the learning sample data. + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/mumbo/plot_mumbo_2_views_2_classes.py:127: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() @@ -190,7 +192,7 @@ rightly classify the points. .. rst-class:: sphx-glr-timing - **Total running time of the script:** ( 0 minutes 0.706 seconds) + **Total running time of the script:** ( 0 minutes 0.700 seconds) .. _sphx_glr_download_tutorial_auto_examples_mumbo_plot_mumbo_2_views_2_classes.py: diff --git a/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes_codeobj.pickle b/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes_codeobj.pickle index 494ce44a2d361a6834c25cba16217907e86cbc4e..04146ae02e2205354a137dc0cb50fb524f4c765a 100644 Binary files a/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes_codeobj.pickle and b/doc/tutorial/auto_examples/mumbo/plot_mumbo_2_views_2_classes_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes.rst b/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes.rst index 0f550994855a5b918f3017a90284085c8730cac3..7f2dd1e36e11edb8d478ae65170066b71d5fc4db 100644 --- a/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes.rst +++ b/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes.rst @@ -67,6 +67,8 @@ the views to rightly classify the points. The second figure displays the classification results for the sub-classifiers on the learning sample data. + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/mumbo/plot_mumbo_3_views_3_classes.py:121: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() @@ -186,7 +188,7 @@ the views to rightly classify the points. .. rst-class:: sphx-glr-timing - **Total running time of the script:** ( 0 minutes 1.321 seconds) + **Total running time of the script:** ( 0 minutes 1.313 seconds) .. _sphx_glr_download_tutorial_auto_examples_mumbo_plot_mumbo_3_views_3_classes.py: diff --git a/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes_codeobj.pickle b/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes_codeobj.pickle index 4edaaa01c2f44f97afa2e921cb7f86a946c9b4d0..b7a0a5eb70f9782e23414861462d35d407eb5560 100644 Binary files a/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes_codeobj.pickle and b/doc/tutorial/auto_examples/mumbo/plot_mumbo_3_views_3_classes_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/mumbo/sg_execution_times.rst b/doc/tutorial/auto_examples/mumbo/sg_execution_times.rst index 008474c57d0d563ca527e0846207527079c56d98..7265f516e33b881ff71bdfa435fb9fb80cfb9afe 100644 --- a/doc/tutorial/auto_examples/mumbo/sg_execution_times.rst +++ b/doc/tutorial/auto_examples/mumbo/sg_execution_times.rst @@ -5,10 +5,10 @@ Computation times ================= -**00:02.027** total execution time for **tutorial_auto_examples_mumbo** files: +**00:02.013** total execution time for **tutorial_auto_examples_mumbo** files: +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_tutorial_auto_examples_mumbo_plot_mumbo_3_views_3_classes.py` (``plot_mumbo_3_views_3_classes.py``) | 00:01.321 | 0.0 MB | +| :ref:`sphx_glr_tutorial_auto_examples_mumbo_plot_mumbo_3_views_3_classes.py` (``plot_mumbo_3_views_3_classes.py``) | 00:01.313 | 0.0 MB | +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_tutorial_auto_examples_mumbo_plot_mumbo_2_views_2_classes.py` (``plot_mumbo_2_views_2_classes.py``) | 00:00.706 | 0.0 MB | +| :ref:`sphx_glr_tutorial_auto_examples_mumbo_plot_mumbo_2_views_2_classes.py` (``plot_mumbo_2_views_2_classes.py``) | 00:00.700 | 0.0 MB | +--------------------------------------------------------------------------------------------------------------------+-----------+--------+ diff --git a/doc/tutorial/auto_examples/mvml/images/thumb/sphx_glr_mvml_plot__thumb.png b/doc/tutorial/auto_examples/mvml/images/thumb/sphx_glr_mvml_plot__thumb.png deleted file mode 100644 index 233f8e605efca4bef384a7c603d53fdc385428bc..0000000000000000000000000000000000000000 Binary files a/doc/tutorial/auto_examples/mvml/images/thumb/sphx_glr_mvml_plot__thumb.png and /dev/null differ diff --git a/doc/tutorial/auto_examples/mvml/plot_mvml_.rst b/doc/tutorial/auto_examples/mvml/plot_mvml_.rst index 88f46af91d889766322e73b638c0f443cae4ad49..61b03342950e9fb1e1d53a37cb9994e8e45bae1e 100644 --- a/doc/tutorial/auto_examples/mvml/plot_mvml_.rst +++ b/doc/tutorial/auto_examples/mvml/plot_mvml_.rst @@ -268,7 +268,7 @@ make kernel dictionaries .. rst-class:: sphx-glr-timing - **Total running time of the script:** ( 0 minutes 4.803 seconds) + **Total running time of the script:** ( 0 minutes 3.630 seconds) .. _sphx_glr_download_tutorial_auto_examples_mvml_plot_mvml_.py: diff --git a/doc/tutorial/auto_examples/mvml/plot_mvml__codeobj.pickle b/doc/tutorial/auto_examples/mvml/plot_mvml__codeobj.pickle index 951ac413d82c84bd33834d8ac8a159f8d182c9d4..e79c778b099abcd053129c5d97ac5fc841f67f30 100644 Binary files a/doc/tutorial/auto_examples/mvml/plot_mvml__codeobj.pickle and b/doc/tutorial/auto_examples/mvml/plot_mvml__codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/mvml/sg_execution_times.rst b/doc/tutorial/auto_examples/mvml/sg_execution_times.rst index 7b21dbef0e31716d78621d1c7f9284f713a2e4e0..8e1881205111d00d1af5490c16c12c1f031d0806 100644 --- a/doc/tutorial/auto_examples/mvml/sg_execution_times.rst +++ b/doc/tutorial/auto_examples/mvml/sg_execution_times.rst @@ -5,8 +5,8 @@ Computation times ================= -**00:04.803** total execution time for **tutorial_auto_examples_mvml** files: +**00:03.630** total execution time for **tutorial_auto_examples_mvml** files: +-------------------------------------------------------------------------------+-----------+--------+ -| :ref:`sphx_glr_tutorial_auto_examples_mvml_plot_mvml_.py` (``plot_mvml_.py``) | 00:04.803 | 0.0 MB | +| :ref:`sphx_glr_tutorial_auto_examples_mvml_plot_mvml_.py` (``plot_mvml_.py``) | 00:03.630 | 0.0 MB | +-------------------------------------------------------------------------------+-----------+--------+ diff --git a/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMKL_001.png b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMKL_001.png new file mode 100644 index 0000000000000000000000000000000000000000..8bd981e23ea21bfb199466d3e5c38026085be418 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMKL_001.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMVML_001.png b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMVML_001.png new file mode 100644 index 0000000000000000000000000000000000000000..d09ae25fafd53d988038e519f2279c06bba29604 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMVML_001.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMuCuBo_001.png b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMuCuBo_001.png new file mode 100644 index 0000000000000000000000000000000000000000..f1cc7838da9a363efee549196cca618f2d3053b6 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMuCuBo_001.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMumBo_001.png b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMumBo_001.png new file mode 100644 index 0000000000000000000000000000000000000000..3d12ae79d5b7ef4dd0edae3f9c18681f2a54483d Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMumBo_001.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMKL_thumb.png b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMKL_thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..263e55b4eb23246c463c2c136c48add3d89f7415 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMKL_thumb.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMVML_thumb.png b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMVML_thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..d97815a1e507bb0d37767c4760cf5c9cead64db9 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMVML_thumb.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMuCuBo_thumb.png b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMuCuBo_thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..50f786f3d3d3fe9d31f6fe08871304f10d21a31f Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMuCuBo_thumb.png differ diff --git a/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMumBo_thumb.png b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMumBo_thumb.png new file mode 100644 index 0000000000000000000000000000000000000000..8bb42fc8451ce7220a8096162028acb6bcb564c3 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_plot_usecase_exampleMumBo_thumb.png differ diff --git a/doc/tutorial/auto_examples/cumbo/images/thumb/sphx_glr_cumbo_plot_2_views_2_classes_thumb.png b/doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_usecase_function_thumb.png similarity index 100% rename from doc/tutorial/auto_examples/cumbo/images/thumb/sphx_glr_cumbo_plot_2_views_2_classes_thumb.png rename to doc/tutorial/auto_examples/usecase/images/thumb/sphx_glr_usecase_function_thumb.png diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.ipynb b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..474b7854727ecc6c252333d1bd2e52ef88ae7502 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Use Case MKL\n\nUse case for all classifier of multimodallearn MKL\nmulti class digit from sklearn, multivue\n - vue 0 digit data (color of sklearn)\n - vue 1 gradiant of image in first direction\n - vue 2 gradiant of image in second direction\n\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "from __future__ import absolute_import\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.multiclass import OneVsOneClassifier\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeClassifier\nfrom multimodal.datasets.base import load_dict, save_dict\nfrom multimodal.tests.data.get_dataset_path import get_dataset_path\nfrom multimodal.datasets.data_sample import MultiModalArray\nfrom multimodal.kernels.mvml import MVML\nfrom multimodal.kernels.lpMKL import MKL\n\nfrom usecase_function import plot_subplot\n\nif __name__ == '__main__':\n # file = get_dataset_path(\"digit_histogram.npy\")\n file = get_dataset_path(\"digit_col_grad.npy\")\n y = np.load(get_dataset_path(\"digit_y.npy\"))\n base_estimator = DecisionTreeClassifier(max_depth=4)\n dic_digit = load_dict(file)\n XX =MultiModalArray(dic_digit)\n X_train, X_test, y_train, y_test = train_test_split(XX, y)\n\n est4 = OneVsOneClassifier(MKL(lmbda=0.1, nystrom_param=0.2)).fit(X_train, y_train)\n y_pred4 = est4.predict(X_test)\n y_pred44 = est4.predict(X_train)\n print(\"result of MKL on digit with oneversone\")\n result4 = np.mean(y_pred4.ravel() == y_test.ravel()) * 100\n print(result4)\n\n fig = plt.figure(figsize=(12., 11.))\n fig.suptitle(\"MKL : result\" + str(result4), fontsize=16)\n plot_subplot(X_train, y_train, y_pred44 ,0, (4, 1, 1), \"train vue 0\" )\n plot_subplot(X_test, y_test,y_pred4 , 0, (4, 1, 2), \"test vue 0\" )\n plot_subplot(X_test, y_test, y_pred4,1, (4, 1, 3), \"test vue 1\" )\n plot_subplot(X_test, y_test,y_pred4, 2, (4, 1, 4), \"test vue 2\" )\n # plt.legend()\n plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py new file mode 100644 index 0000000000000000000000000000000000000000..77ecb7653b892481c80cd28373ccc7cf8bb9d009 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +============ +Use Case MKL +============ +Use case for all classifier of multimodallearn MKL +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.multiclass import OneVsOneClassifier +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray +from multimodal.kernels.mvml import MVML +from multimodal.kernels.lpMKL import MKL + +from usecase_function import plot_subplot + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est4 = OneVsOneClassifier(MKL(lmbda=0.1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred4 = est4.predict(X_test) + y_pred44 = est4.predict(X_train) + print("result of MKL on digit with oneversone") + result4 = np.mean(y_pred4.ravel() == y_test.ravel()) * 100 + print(result4) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MKL : result" + str(result4), fontsize=16) + plot_subplot(X_train, y_train, y_pred44 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred4 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred4,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred4, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() + diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py.md5 b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py.md5 new file mode 100644 index 0000000000000000000000000000000000000000..ebe72a235c6cada59357299814b8f422fe5dbfc3 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.py.md5 @@ -0,0 +1 @@ +4f807359096f5f5b3a7ee6b3ea540b91 \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.rst b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.rst new file mode 100644 index 0000000000000000000000000000000000000000..f21e3d77caf22a3a5548c048f40a97b8fbf3d71c --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL.rst @@ -0,0 +1,118 @@ +.. note:: + :class: sphx-glr-download-link-note + + Click :ref:`here <sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMKL.py>` to download the full example code +.. rst-class:: sphx-glr-example-title + +.. _sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMKL.py: + + +============ +Use Case MKL +============ +Use case for all classifier of multimodallearn MKL +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + + + + +.. image:: /tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMKL_001.png + :class: sphx-glr-single-img + + +.. rst-class:: sphx-glr-script-out + + Out: + + .. code-block:: none + + result of MKL on digit with oneversone + 98.44444444444444 + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/usecase/plot_usecase_exampleMKL.py:50: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() + + + + + + +| + + +.. code-block:: default + + from __future__ import absolute_import + import numpy as np + import matplotlib.pyplot as plt + from sklearn.multiclass import OneVsOneClassifier + from sklearn.model_selection import train_test_split + from sklearn.tree import DecisionTreeClassifier + from multimodal.datasets.base import load_dict, save_dict + from multimodal.tests.data.get_dataset_path import get_dataset_path + from multimodal.datasets.data_sample import MultiModalArray + from multimodal.kernels.mvml import MVML + from multimodal.kernels.lpMKL import MKL + + from usecase_function import plot_subplot + + if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est4 = OneVsOneClassifier(MKL(lmbda=0.1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred4 = est4.predict(X_test) + y_pred44 = est4.predict(X_train) + print("result of MKL on digit with oneversone") + result4 = np.mean(y_pred4.ravel() == y_test.ravel()) * 100 + print(result4) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MKL : result" + str(result4), fontsize=16) + plot_subplot(X_train, y_train, y_pred44 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred4 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred4,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred4, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() + + + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 12.697 seconds) + + +.. _sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMKL.py: + + +.. only :: html + + .. container:: sphx-glr-footer + :class: sphx-glr-footer-example + + + + .. container:: sphx-glr-download + + :download:`Download Python source code: plot_usecase_exampleMKL.py <plot_usecase_exampleMKL.py>` + + + + .. container:: sphx-glr-download + + :download:`Download Jupyter notebook: plot_usecase_exampleMKL.ipynb <plot_usecase_exampleMKL.ipynb>` + + +.. only:: html + + .. rst-class:: sphx-glr-signature + + `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL_codeobj.pickle b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL_codeobj.pickle new file mode 100644 index 0000000000000000000000000000000000000000..7d88fc9a5cfd32c1e3c34ae26b6fe0d4c51a39e0 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMKL_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.ipynb b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..c8fcc01848df8fb831dc15d428dc29a45242aeb2 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Use Case of MVML\n\nUse case for all classifier of multimodallearn MVML\n\nmulti class digit from sklearn, multivue\n - vue 0 digit data (color of sklearn)\n - vue 1 gradiant of image in first direction\n - vue 2 gradiant of image in second direction\n\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "from __future__ import absolute_import\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.multiclass import OneVsOneClassifier\nfrom sklearn.model_selection import train_test_split\nfrom multimodal.datasets.base import load_dict, save_dict\nfrom multimodal.tests.data.get_dataset_path import get_dataset_path\nfrom multimodal.datasets.data_sample import MultiModalArray\nfrom multimodal.kernels.mvml import MVML\nfrom usecase_function import plot_subplot\n\n\nif __name__ == '__main__':\n # file = get_dataset_path(\"digit_histogram.npy\")\n file = get_dataset_path(\"digit_col_grad.npy\")\n y = np.load(get_dataset_path(\"digit_y.npy\"))\n dic_digit = load_dict(file)\n XX =MultiModalArray(dic_digit)\n X_train, X_test, y_train, y_test = train_test_split(XX, y)\n est1 = OneVsOneClassifier(MVML(lmbda=0.1, eta=1, nystrom_param=0.2)).fit(X_train, y_train)\n y_pred1 = est1.predict(X_test)\n y_pred11 = est1.predict(X_train)\n print(\"result of MVML on digit with oneversone\")\n result1 = np.mean(y_pred1.ravel() == y_test.ravel()) * 100\n print(result1)\n\n fig = plt.figure(figsize=(12., 11.))\n fig.suptitle(\"MVML: result\" + str(result1), fontsize=16)\n plot_subplot(X_train, y_train, y_pred11\n , 0, (4, 1, 1), \"train vue 0\" )\n plot_subplot(X_test, y_test,y_pred1, 0, (4, 1, 2), \"test vue 0\" )\n plot_subplot(X_test, y_test, y_pred1, 1, (4, 1, 3), \"test vue 1\" )\n plot_subplot(X_test, y_test,y_pred1, 2, (4, 1, 4), \"test vue 2\" )\n #plt.legend()\n plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py new file mode 100644 index 0000000000000000000000000000000000000000..8f86a8bc16b69427b32cbaef4c028d3db3b813ac --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +================ +Use Case of MVML +================ +Use case for all classifier of multimodallearn MVML + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.multiclass import OneVsOneClassifier +from sklearn.model_selection import train_test_split +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray +from multimodal.kernels.mvml import MVML +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est1 = OneVsOneClassifier(MVML(lmbda=0.1, eta=1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred1 = est1.predict(X_test) + y_pred11 = est1.predict(X_train) + print("result of MVML on digit with oneversone") + result1 = np.mean(y_pred1.ravel() == y_test.ravel()) * 100 + print(result1) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MVML: result" + str(result1), fontsize=16) + plot_subplot(X_train, y_train, y_pred11 + , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred1, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred1, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred1, 2, (4, 1, 4), "test vue 2" ) + #plt.legend() + plt.show() + diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py.md5 b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py.md5 new file mode 100644 index 0000000000000000000000000000000000000000..e39917a4ca1ab661c8575934a47b6493e22245c6 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.py.md5 @@ -0,0 +1 @@ +b4b4bb03418027ba62ce77c251085cf5 \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.rst b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.rst new file mode 100644 index 0000000000000000000000000000000000000000..a843b90af0ffa20f0f03a5d549701f2a9801f0c8 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML.rst @@ -0,0 +1,116 @@ +.. note:: + :class: sphx-glr-download-link-note + + Click :ref:`here <sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMVML.py>` to download the full example code +.. rst-class:: sphx-glr-example-title + +.. _sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMVML.py: + + +================ +Use Case of MVML +================ +Use case for all classifier of multimodallearn MVML + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + + + + +.. image:: /tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMVML_001.png + :class: sphx-glr-single-img + + +.. rst-class:: sphx-glr-script-out + + Out: + + .. code-block:: none + + result of MVML on digit with oneversone + 98.88888888888889 + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/usecase/plot_usecase_exampleMVML.py:48: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() + + + + + + +| + + +.. code-block:: default + + from __future__ import absolute_import + import numpy as np + import matplotlib.pyplot as plt + from sklearn.multiclass import OneVsOneClassifier + from sklearn.model_selection import train_test_split + from multimodal.datasets.base import load_dict, save_dict + from multimodal.tests.data.get_dataset_path import get_dataset_path + from multimodal.datasets.data_sample import MultiModalArray + from multimodal.kernels.mvml import MVML + from usecase_function import plot_subplot + + + if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est1 = OneVsOneClassifier(MVML(lmbda=0.1, eta=1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred1 = est1.predict(X_test) + y_pred11 = est1.predict(X_train) + print("result of MVML on digit with oneversone") + result1 = np.mean(y_pred1.ravel() == y_test.ravel()) * 100 + print(result1) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MVML: result" + str(result1), fontsize=16) + plot_subplot(X_train, y_train, y_pred11 + , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred1, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred1, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred1, 2, (4, 1, 4), "test vue 2" ) + #plt.legend() + plt.show() + + + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 39.921 seconds) + + +.. _sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMVML.py: + + +.. only :: html + + .. container:: sphx-glr-footer + :class: sphx-glr-footer-example + + + + .. container:: sphx-glr-download + + :download:`Download Python source code: plot_usecase_exampleMVML.py <plot_usecase_exampleMVML.py>` + + + + .. container:: sphx-glr-download + + :download:`Download Jupyter notebook: plot_usecase_exampleMVML.ipynb <plot_usecase_exampleMVML.ipynb>` + + +.. only:: html + + .. rst-class:: sphx-glr-signature + + `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML_codeobj.pickle b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML_codeobj.pickle new file mode 100644 index 0000000000000000000000000000000000000000..4dd76ec965cb59222faf72499944a67476d843c4 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMVML_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.ipynb b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..fdd32ebf31a3a9ec1e48aa58507a47f5e2e39aef --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Use Case MuCumBo\n\nUse case for all classifier of multimodallearn MuCumBo\n\nmulti class digit from sklearn, multivue\n - vue 0 digit data (color of sklearn)\n - vue 1 gradiant of image in first direction\n - vue 2 gradiant of image in second direction\n\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "from __future__ import absolute_import\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeClassifier\nfrom multimodal.datasets.base import load_dict, save_dict\nfrom multimodal.tests.data.get_dataset_path import get_dataset_path\nfrom multimodal.datasets.data_sample import MultiModalArray\n\nfrom multimodal.boosting.cumbo import MuCumboClassifier\nfrom usecase_function import plot_subplot\n\n\nif __name__ == '__main__':\n # file = get_dataset_path(\"digit_histogram.npy\")\n file = get_dataset_path(\"digit_col_grad.npy\")\n y = np.load(get_dataset_path(\"digit_y.npy\"))\n base_estimator = DecisionTreeClassifier(max_depth=4)\n dic_digit = load_dict(file)\n XX =MultiModalArray(dic_digit)\n X_train, X_test, y_train, y_test = train_test_split(XX, y)\n est3 = MuCumboClassifier(base_estimator=base_estimator).fit(X_train, y_train)\n y_pred3 = est3.predict(X_test)\n y_pred33 = est3.predict(X_train)\n print(\"result of MuCumboClassifier on digit \")\n result3 = np.mean(y_pred3.ravel() == y_test.ravel()) * 100\n print(result3)\n\n fig = plt.figure(figsize=(12., 11.))\n fig.suptitle(\"MuCumbo: result\" + str(result3), fontsize=16)\n plot_subplot(X_train, y_train, y_pred33 ,0, (4, 1, 1), \"train vue 0\" )\n plot_subplot(X_test, y_test,y_pred3 , 0, (4, 1, 2), \"test vue 0\" )\n plot_subplot(X_test, y_test, y_pred3,1, (4, 1, 3), \"test vue 1\" )\n plot_subplot(X_test, y_test,y_pred3, 2, (4, 1, 4), \"test vue 2\" )\n # plt.legend()\n plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py new file mode 100644 index 0000000000000000000000000000000000000000..fa7490a51c1e3410b91e7a4cbcdb85557277fe15 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +================ +Use Case MuCumBo +================ +Use case for all classifier of multimodallearn MuCumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray + +from multimodal.boosting.cumbo import MuCumboClassifier +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est3 = MuCumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred3 = est3.predict(X_test) + y_pred33 = est3.predict(X_train) + print("result of MuCumboClassifier on digit ") + result3 = np.mean(y_pred3.ravel() == y_test.ravel()) * 100 + print(result3) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MuCumbo: result" + str(result3), fontsize=16) + plot_subplot(X_train, y_train, y_pred33 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred3 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred3,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred3, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py.md5 b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py.md5 new file mode 100644 index 0000000000000000000000000000000000000000..72e532bf080371b7c41474a7b291d5f17dc3bd72 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.py.md5 @@ -0,0 +1 @@ +41656262e29b2bcd048fa6cd8a96eaf4 \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.rst b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.rst new file mode 100644 index 0000000000000000000000000000000000000000..f67674fc284e7454cd759cb58970c7a033565953 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo.rst @@ -0,0 +1,115 @@ +.. note:: + :class: sphx-glr-download-link-note + + Click :ref:`here <sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMuCuBo.py>` to download the full example code +.. rst-class:: sphx-glr-example-title + +.. _sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMuCuBo.py: + + +================ +Use Case MuCumBo +================ +Use case for all classifier of multimodallearn MuCumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + + + + +.. image:: /tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMuCuBo_001.png + :class: sphx-glr-single-img + + +.. rst-class:: sphx-glr-script-out + + Out: + + .. code-block:: none + + result of MuCumboClassifier on digit + 85.33333333333334 + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/usecase/plot_usecase_exampleMuCuBo.py:49: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() + + + + + + +| + + +.. code-block:: default + + from __future__ import absolute_import + import numpy as np + import matplotlib.pyplot as plt + from sklearn.model_selection import train_test_split + from sklearn.tree import DecisionTreeClassifier + from multimodal.datasets.base import load_dict, save_dict + from multimodal.tests.data.get_dataset_path import get_dataset_path + from multimodal.datasets.data_sample import MultiModalArray + + from multimodal.boosting.cumbo import MuCumboClassifier + from usecase_function import plot_subplot + + + if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est3 = MuCumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred3 = est3.predict(X_test) + y_pred33 = est3.predict(X_train) + print("result of MuCumboClassifier on digit ") + result3 = np.mean(y_pred3.ravel() == y_test.ravel()) * 100 + print(result3) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MuCumbo: result" + str(result3), fontsize=16) + plot_subplot(X_train, y_train, y_pred33 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred3 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred3,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred3, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 11.436 seconds) + + +.. _sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMuCuBo.py: + + +.. only :: html + + .. container:: sphx-glr-footer + :class: sphx-glr-footer-example + + + + .. container:: sphx-glr-download + + :download:`Download Python source code: plot_usecase_exampleMuCuBo.py <plot_usecase_exampleMuCuBo.py>` + + + + .. container:: sphx-glr-download + + :download:`Download Jupyter notebook: plot_usecase_exampleMuCuBo.ipynb <plot_usecase_exampleMuCuBo.ipynb>` + + +.. only:: html + + .. rst-class:: sphx-glr-signature + + `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo_codeobj.pickle b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo_codeobj.pickle new file mode 100644 index 0000000000000000000000000000000000000000..17bb32a3b64f9f8683437434f73b239f034f8fbf Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMuCuBo_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.ipynb b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..b7b3d45d0a03305b3aac3169ca4812d1ceee02fd --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Use Case MumBo\n\nUse case for all classifier of multimodallearn MumBo\n\nmulti class digit from sklearn, multivue\n - vue 0 digit data (color of sklearn)\n - vue 1 gradiant of image in first direction\n - vue 2 gradiant of image in second direction\n\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "from __future__ import absolute_import\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeClassifier\nfrom multimodal.datasets.base import load_dict, save_dict\nfrom multimodal.tests.data.get_dataset_path import get_dataset_path\nfrom multimodal.datasets.data_sample import MultiModalArray\n\nfrom multimodal.boosting.mumbo import MumboClassifier\n\nfrom usecase_function import plot_subplot\n\n\nif __name__ == '__main__':\n # file = get_dataset_path(\"digit_histogram.npy\")\n file = get_dataset_path(\"digit_col_grad.npy\")\n y = np.load(get_dataset_path(\"digit_y.npy\"))\n base_estimator = DecisionTreeClassifier(max_depth=4)\n dic_digit = load_dict(file)\n XX =MultiModalArray(dic_digit)\n X_train, X_test, y_train, y_test = train_test_split(XX, y)\n\n est2 = MumboClassifier(base_estimator=base_estimator).fit(X_train, y_train)\n y_pred2 = est2.predict(X_test)\n y_pred22 = est2.predict(X_train)\n print(\"result of MumboClassifier on digit \")\n result2 = np.mean(y_pred2.ravel() == y_test.ravel()) * 100\n print(result2)\n\n fig = plt.figure(figsize=(12., 11.))\n fig.suptitle(\"Mumbo: result\" + str(result2), fontsize=16)\n plot_subplot(X_train, y_train, y_pred22 , 0, (4, 1, 1), \"train vue 0\" )\n plot_subplot(X_test, y_test,y_pred2, 0, (4, 1, 2), \"test vue 0\" )\n plot_subplot(X_test, y_test, y_pred2, 1, (4, 1, 3), \"test vue 1\" )\n plot_subplot(X_test, y_test,y_pred2, 2, (4, 1, 4), \"test vue 2\" )\n # plt.legend()\n plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py new file mode 100644 index 0000000000000000000000000000000000000000..76e4020e88fb204c8715668dd200bc447ac5297c --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +============== +Use Case MumBo +============== +Use case for all classifier of multimodallearn MumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray + +from multimodal.boosting.mumbo import MumboClassifier + +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est2 = MumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred2 = est2.predict(X_test) + y_pred22 = est2.predict(X_train) + print("result of MumboClassifier on digit ") + result2 = np.mean(y_pred2.ravel() == y_test.ravel()) * 100 + print(result2) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("Mumbo: result" + str(result2), fontsize=16) + plot_subplot(X_train, y_train, y_pred22 , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred2, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred2, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred2, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py.md5 b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py.md5 new file mode 100644 index 0000000000000000000000000000000000000000..17c46a09d474ecc1fe897c03793a97d9928f3f2d --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.py.md5 @@ -0,0 +1 @@ +2135145bcc76c1c0354a13e5fff1666c \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.rst b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.rst new file mode 100644 index 0000000000000000000000000000000000000000..08314501ac44488591661763dc83bd1386f19e0d --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo.rst @@ -0,0 +1,118 @@ +.. note:: + :class: sphx-glr-download-link-note + + Click :ref:`here <sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMumBo.py>` to download the full example code +.. rst-class:: sphx-glr-example-title + +.. _sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMumBo.py: + + +============== +Use Case MumBo +============== +Use case for all classifier of multimodallearn MumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + + + + +.. image:: /tutorial/auto_examples/usecase/images/sphx_glr_plot_usecase_exampleMumBo_001.png + :class: sphx-glr-single-img + + +.. rst-class:: sphx-glr-script-out + + Out: + + .. code-block:: none + + result of MumboClassifier on digit + 96.0 + /home/dominique/projets/ANR-Lives/scikit-multimodallearn/examples/usecase/plot_usecase_exampleMumBo.py:51: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. + plt.show() + + + + + + +| + + +.. code-block:: default + + from __future__ import absolute_import + import numpy as np + import matplotlib.pyplot as plt + from sklearn.model_selection import train_test_split + from sklearn.tree import DecisionTreeClassifier + from multimodal.datasets.base import load_dict, save_dict + from multimodal.tests.data.get_dataset_path import get_dataset_path + from multimodal.datasets.data_sample import MultiModalArray + + from multimodal.boosting.mumbo import MumboClassifier + + from usecase_function import plot_subplot + + + if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est2 = MumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred2 = est2.predict(X_test) + y_pred22 = est2.predict(X_train) + print("result of MumboClassifier on digit ") + result2 = np.mean(y_pred2.ravel() == y_test.ravel()) * 100 + print(result2) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("Mumbo: result" + str(result2), fontsize=16) + plot_subplot(X_train, y_train, y_pred22 , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred2, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred2, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred2, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() + + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 5.520 seconds) + + +.. _sphx_glr_download_tutorial_auto_examples_usecase_plot_usecase_exampleMumBo.py: + + +.. only :: html + + .. container:: sphx-glr-footer + :class: sphx-glr-footer-example + + + + .. container:: sphx-glr-download + + :download:`Download Python source code: plot_usecase_exampleMumBo.py <plot_usecase_exampleMumBo.py>` + + + + .. container:: sphx-glr-download + + :download:`Download Jupyter notebook: plot_usecase_exampleMumBo.ipynb <plot_usecase_exampleMumBo.ipynb>` + + +.. only:: html + + .. rst-class:: sphx-glr-signature + + `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ diff --git a/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo_codeobj.pickle b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo_codeobj.pickle new file mode 100644 index 0000000000000000000000000000000000000000..2518b269c03ea056b7851ca059c0df264c1ac823 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/plot_usecase_exampleMumBo_codeobj.pickle differ diff --git a/doc/tutorial/auto_examples/usecase/sg_execution_times.rst b/doc/tutorial/auto_examples/usecase/sg_execution_times.rst new file mode 100644 index 0000000000000000000000000000000000000000..223ae1fc7d7d472e3a2466ade64b4707085dc797 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/sg_execution_times.rst @@ -0,0 +1,20 @@ + +:orphan: + +.. _sphx_glr_tutorial_auto_examples_usecase_sg_execution_times: + +Computation times +================= +**01:09.574** total execution time for **tutorial_auto_examples_usecase** files: + ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ +| :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMVML.py` (``plot_usecase_exampleMVML.py``) | 00:39.921 | 0.0 MB | ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ +| :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMKL.py` (``plot_usecase_exampleMKL.py``) | 00:12.697 | 0.0 MB | ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ +| :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMuCuBo.py` (``plot_usecase_exampleMuCuBo.py``) | 00:11.436 | 0.0 MB | ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ +| :ref:`sphx_glr_tutorial_auto_examples_usecase_plot_usecase_exampleMumBo.py` (``plot_usecase_exampleMumBo.py``) | 00:05.520 | 0.0 MB | ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ +| :ref:`sphx_glr_tutorial_auto_examples_usecase_usecase_function.py` (``usecase_function.py``) | 00:00.000 | 0.0 MB | ++------------------------------------------------------------------------------------------------------------------+-----------+--------+ diff --git a/doc/tutorial/auto_examples/usecase/usecase_function.ipynb b/doc/tutorial/auto_examples/usecase/usecase_function.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..43f3d5747509aa97c14dac986076569a3757427d --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/usecase_function.ipynb @@ -0,0 +1,54 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%matplotlib inline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Use Case Function module\n\n\nFunction plot_subplot\n\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib._color_data as mcd\n\n\ndef plot_subplot(X, Y, Y_pred, vue, subplot, title):\n cn = mcd.CSS4_COLORS\n classes = np.unique(Y)\n n_classes = len(np.unique(Y))\n axs = plt.subplot(subplot[0],subplot[1],subplot[2])\n axs.set_title(title)\n #plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray',\n # edgecolors=(0, 0, 0))\n for index, k in zip(range(n_classes), cn.keys()):\n Y_class, = np.where(Y==classes[index])\n Y_class_pred = np.intersect1d(np.where(Y_pred==classes[index])[0], np.where(Y_pred==Y)[0])\n plt.scatter(X._extract_view(vue)[Y_class],\n X._extract_view(vue)[Y_class],\n s=40, c=cn[k], edgecolors='blue', linewidths=2, label=\"class real class: \"+str(index)) #\n plt.scatter(X._extract_view(vue)[Y_class_pred],\n X._extract_view(vue)[Y_class_pred],\n s=160, edgecolors='orange', linewidths=2, label=\"class prediction: \"+str(index))\n\n\nif __name__ == '__main__':\n pass" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/usecase_function.py b/doc/tutorial/auto_examples/usecase/usecase_function.py new file mode 100644 index 0000000000000000000000000000000000000000..a6878b8c2535ba8c483aca107ca63e601412918b --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/usecase_function.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" +======================== +Use Case Function module +======================== + +Function plot_subplot + +""" + +import numpy as np +import matplotlib.pyplot as plt +import matplotlib._color_data as mcd + + +def plot_subplot(X, Y, Y_pred, vue, subplot, title): + cn = mcd.CSS4_COLORS + classes = np.unique(Y) + n_classes = len(np.unique(Y)) + axs = plt.subplot(subplot[0],subplot[1],subplot[2]) + axs.set_title(title) + #plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray', + # edgecolors=(0, 0, 0)) + for index, k in zip(range(n_classes), cn.keys()): + Y_class, = np.where(Y==classes[index]) + Y_class_pred = np.intersect1d(np.where(Y_pred==classes[index])[0], np.where(Y_pred==Y)[0]) + plt.scatter(X._extract_view(vue)[Y_class], + X._extract_view(vue)[Y_class], + s=40, c=cn[k], edgecolors='blue', linewidths=2, label="class real class: "+str(index)) # + plt.scatter(X._extract_view(vue)[Y_class_pred], + X._extract_view(vue)[Y_class_pred], + s=160, edgecolors='orange', linewidths=2, label="class prediction: "+str(index)) + + +if __name__ == '__main__': + pass \ No newline at end of file diff --git a/doc/tutorial/auto_examples/usecase/usecase_function.rst b/doc/tutorial/auto_examples/usecase/usecase_function.rst new file mode 100644 index 0000000000000000000000000000000000000000..41f67ddd4465c6217a093f1e73cb22b5a7a7ae54 --- /dev/null +++ b/doc/tutorial/auto_examples/usecase/usecase_function.rst @@ -0,0 +1,78 @@ +.. note:: + :class: sphx-glr-download-link-note + + Click :ref:`here <sphx_glr_download_tutorial_auto_examples_usecase_usecase_function.py>` to download the full example code +.. rst-class:: sphx-glr-example-title + +.. _sphx_glr_tutorial_auto_examples_usecase_usecase_function.py: + + +======================== +Use Case Function module +======================== + +Function plot_subplot + + + +.. code-block:: default + + + import numpy as np + import matplotlib.pyplot as plt + import matplotlib._color_data as mcd + + + def plot_subplot(X, Y, Y_pred, vue, subplot, title): + cn = mcd.CSS4_COLORS + classes = np.unique(Y) + n_classes = len(np.unique(Y)) + axs = plt.subplot(subplot[0],subplot[1],subplot[2]) + axs.set_title(title) + #plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray', + # edgecolors=(0, 0, 0)) + for index, k in zip(range(n_classes), cn.keys()): + Y_class, = np.where(Y==classes[index]) + Y_class_pred = np.intersect1d(np.where(Y_pred==classes[index])[0], np.where(Y_pred==Y)[0]) + plt.scatter(X._extract_view(vue)[Y_class], + X._extract_view(vue)[Y_class], + s=40, c=cn[k], edgecolors='blue', linewidths=2, label="class real class: "+str(index)) # + plt.scatter(X._extract_view(vue)[Y_class_pred], + X._extract_view(vue)[Y_class_pred], + s=160, edgecolors='orange', linewidths=2, label="class prediction: "+str(index)) + + + if __name__ == '__main__': + pass + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 0.000 seconds) + + +.. _sphx_glr_download_tutorial_auto_examples_usecase_usecase_function.py: + + +.. only :: html + + .. container:: sphx-glr-footer + :class: sphx-glr-footer-example + + + + .. container:: sphx-glr-download + + :download:`Download Python source code: usecase_function.py <usecase_function.py>` + + + + .. container:: sphx-glr-download + + :download:`Download Jupyter notebook: usecase_function.ipynb <usecase_function.ipynb>` + + +.. only:: html + + .. rst-class:: sphx-glr-signature + + `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ diff --git a/doc/tutorial/auto_examples/usecase/usecase_function_codeobj.pickle b/doc/tutorial/auto_examples/usecase/usecase_function_codeobj.pickle new file mode 100644 index 0000000000000000000000000000000000000000..11a5d97962739de44a38fb53598691ab2a7bbee1 Binary files /dev/null and b/doc/tutorial/auto_examples/usecase/usecase_function_codeobj.pickle differ diff --git a/doc/tutorial/backreferences/multimodal.kernels.lpMKL.MKL.decision_function.examples b/doc/tutorial/backreferences/multimodal.kernels.lpMKL.MKL.decision_function.examples new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/tutorial/backreferences/multimodal.kernels.mvml.MVML.decision_function.examples b/doc/tutorial/backreferences/multimodal.kernels.mvml.MVML.decision_function.examples new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/tutorial/times.rst b/doc/tutorial/times.rst index 8350bcbb5d852571ce6624325b655fae5fe923c7..1c70dd62db09d7041fcadc22cab036e5c071f29e 100644 --- a/doc/tutorial/times.rst +++ b/doc/tutorial/times.rst @@ -14,3 +14,4 @@ total execution time for **tutorial_auto_examples** files: auto_examples/mumbo/sg_execution_times auto_examples/cumbo/sg_execution_times auto_examples/mvml/sg_execution_times + auto_examples/usecase/sg_execution_times diff --git a/examples/usecase/__init__.py b/examples/usecase/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..139597f9cb07c5d48bed18984ec4747f4b4f3438 --- /dev/null +++ b/examples/usecase/__init__.py @@ -0,0 +1,2 @@ + + diff --git a/examples/usecase/plot_usecase_exampleMKL.py b/examples/usecase/plot_usecase_exampleMKL.py new file mode 100644 index 0000000000000000000000000000000000000000..77ecb7653b892481c80cd28373ccc7cf8bb9d009 --- /dev/null +++ b/examples/usecase/plot_usecase_exampleMKL.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +============ +Use Case MKL +============ +Use case for all classifier of multimodallearn MKL +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.multiclass import OneVsOneClassifier +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray +from multimodal.kernels.mvml import MVML +from multimodal.kernels.lpMKL import MKL + +from usecase_function import plot_subplot + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est4 = OneVsOneClassifier(MKL(lmbda=0.1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred4 = est4.predict(X_test) + y_pred44 = est4.predict(X_train) + print("result of MKL on digit with oneversone") + result4 = np.mean(y_pred4.ravel() == y_test.ravel()) * 100 + print(result4) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MKL : result" + str(result4), fontsize=16) + plot_subplot(X_train, y_train, y_pred44 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred4 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred4,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred4, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() + diff --git a/examples/usecase/plot_usecase_exampleMVML.py b/examples/usecase/plot_usecase_exampleMVML.py new file mode 100644 index 0000000000000000000000000000000000000000..8f86a8bc16b69427b32cbaef4c028d3db3b813ac --- /dev/null +++ b/examples/usecase/plot_usecase_exampleMVML.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +================ +Use Case of MVML +================ +Use case for all classifier of multimodallearn MVML + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.multiclass import OneVsOneClassifier +from sklearn.model_selection import train_test_split +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray +from multimodal.kernels.mvml import MVML +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est1 = OneVsOneClassifier(MVML(lmbda=0.1, eta=1, nystrom_param=0.2)).fit(X_train, y_train) + y_pred1 = est1.predict(X_test) + y_pred11 = est1.predict(X_train) + print("result of MVML on digit with oneversone") + result1 = np.mean(y_pred1.ravel() == y_test.ravel()) * 100 + print(result1) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MVML: result" + str(result1), fontsize=16) + plot_subplot(X_train, y_train, y_pred11 + , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred1, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred1, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred1, 2, (4, 1, 4), "test vue 2" ) + #plt.legend() + plt.show() + diff --git a/examples/usecase/plot_usecase_exampleMuCuBo.py b/examples/usecase/plot_usecase_exampleMuCuBo.py new file mode 100644 index 0000000000000000000000000000000000000000..fa7490a51c1e3410b91e7a4cbcdb85557277fe15 --- /dev/null +++ b/examples/usecase/plot_usecase_exampleMuCuBo.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +================ +Use Case MuCumBo +================ +Use case for all classifier of multimodallearn MuCumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray + +from multimodal.boosting.cumbo import MuCumboClassifier +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + est3 = MuCumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred3 = est3.predict(X_test) + y_pred33 = est3.predict(X_train) + print("result of MuCumboClassifier on digit ") + result3 = np.mean(y_pred3.ravel() == y_test.ravel()) * 100 + print(result3) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("MuCumbo: result" + str(result3), fontsize=16) + plot_subplot(X_train, y_train, y_pred33 ,0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred3 , 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred3,1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred3, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() \ No newline at end of file diff --git a/examples/usecase/plot_usecase_exampleMumBo.py b/examples/usecase/plot_usecase_exampleMumBo.py new file mode 100644 index 0000000000000000000000000000000000000000..76e4020e88fb204c8715668dd200bc447ac5297c --- /dev/null +++ b/examples/usecase/plot_usecase_exampleMumBo.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +============== +Use Case MumBo +============== +Use case for all classifier of multimodallearn MumBo + +multi class digit from sklearn, multivue + - vue 0 digit data (color of sklearn) + - vue 1 gradiant of image in first direction + - vue 2 gradiant of image in second direction + +""" +from __future__ import absolute_import +import numpy as np +import matplotlib.pyplot as plt +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from multimodal.datasets.base import load_dict, save_dict +from multimodal.tests.data.get_dataset_path import get_dataset_path +from multimodal.datasets.data_sample import MultiModalArray + +from multimodal.boosting.mumbo import MumboClassifier + +from usecase_function import plot_subplot + + +if __name__ == '__main__': + # file = get_dataset_path("digit_histogram.npy") + file = get_dataset_path("digit_col_grad.npy") + y = np.load(get_dataset_path("digit_y.npy")) + base_estimator = DecisionTreeClassifier(max_depth=4) + dic_digit = load_dict(file) + XX =MultiModalArray(dic_digit) + X_train, X_test, y_train, y_test = train_test_split(XX, y) + + est2 = MumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) + y_pred2 = est2.predict(X_test) + y_pred22 = est2.predict(X_train) + print("result of MumboClassifier on digit ") + result2 = np.mean(y_pred2.ravel() == y_test.ravel()) * 100 + print(result2) + + fig = plt.figure(figsize=(12., 11.)) + fig.suptitle("Mumbo: result" + str(result2), fontsize=16) + plot_subplot(X_train, y_train, y_pred22 , 0, (4, 1, 1), "train vue 0" ) + plot_subplot(X_test, y_test,y_pred2, 0, (4, 1, 2), "test vue 0" ) + plot_subplot(X_test, y_test, y_pred2, 1, (4, 1, 3), "test vue 1" ) + plot_subplot(X_test, y_test,y_pred2, 2, (4, 1, 4), "test vue 2" ) + # plt.legend() + plt.show() diff --git a/examples/usecase/usecase_example.py b/examples/usecase/usecase_example.py deleted file mode 100644 index e29936a074fd23a16da61ac9bb8dea2175e57041..0000000000000000000000000000000000000000 --- a/examples/usecase/usecase_example.py +++ /dev/null @@ -1,119 +0,0 @@ -# -*- coding: utf-8 -*- -""" -======== -Use Case -======== -Use case for all classifier of multimodallearn (in file mvml.py) is intended to be used with very simple simulated dataset - -multi class digit from sklearn, multivue - - vue 0 digit data (color of sklearn) - - vue 1 gradiant of image in first direction - - vue 2 gradiant of image in second direction - -""" - -import numpy as np -import matplotlib.pyplot as plt -import matplotlib._color_data as mcd -from sklearn import datasets -from sklearn.multiclass import OneVsRestClassifier -from sklearn.multiclass import OneVsOneClassifier -from sklearn.model_selection import train_test_split -from sklearn.tree import DecisionTreeClassifier -from multimodal.datasets.base import load_dict, save_dict -from multimodal.tests.data.get_dataset_path import get_dataset_path -from multimodal.datasets.data_sample import MultiModalArray -from multimodal.kernels.mvml import MVML -from multimodal.kernels.lpMKL import MKL -from multimodal.boosting.mumbo import MumboClassifier -from multimodal.boosting.cumbo import MuCumboClassifier - -def plot_subplot(X, Y, Y_pred, vue, subplot, title): - cn = mcd.CSS4_COLORS - classes = np.unique(Y) - n_classes = len(np.unique(Y)) - axs = plt.subplot(subplot[0],subplot[1],subplot[2]) - axs.set_title(title) - #plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray', - # edgecolors=(0, 0, 0)) - for index, k in zip(range(n_classes), cn.keys()): - Y_class, = np.where(Y==classes[index]) - Y_class_pred = np.intersect1d(np.where(Y_pred==classes[index])[0], np.where(Y_pred==Y)[0]) - plt.scatter(X._extract_view(vue)[Y_class], - X._extract_view(vue)[Y_class], - s=40, c=cn[k], edgecolors='blue', linewidths=2, label="class real class: "+str(index)) # - plt.scatter(X._extract_view(vue)[Y_class_pred], - X._extract_view(vue)[Y_class_pred], - s=160, edgecolors='orange', linewidths=2, label="class prediction: "+str(index)) - - -if __name__ == '__main__': - # file = get_dataset_path("digit_histogram.npy") - file = get_dataset_path("digit_col_grad.npy") - y = np.load(get_dataset_path("digit_y.npy")) - base_estimator = DecisionTreeClassifier(max_depth=4) - dic_digit = load_dict(file) - XX =MultiModalArray(dic_digit) - X_train, X_test, y_train, y_test = train_test_split(XX, y) - est1 = OneVsOneClassifier(MVML(lmbda=0.1, eta=1, nystrom_param=0.2)).fit(X_train, y_train) - y_pred1 = est1.predict(X_test) - y_pred11 = est1.predict(X_train) - print("result of MVML on digit with oneversone") - result1 = np.mean(y_pred1.ravel() == y_test.ravel()) * 100 - print(result1) - est2 = MumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) - y_pred2 = est2.predict(X_test) - y_pred22 = est2.predict(X_train) - print("result of MumboClassifier on digit ") - result2 = np.mean(y_pred2.ravel() == y_test.ravel()) * 100 - print(result2) - - est3 = MuCumboClassifier(base_estimator=base_estimator).fit(X_train, y_train) - y_pred3 = est3.predict(X_test) - y_pred33 = est3.predict(X_train) - print("result of MuCumboClassifier on digit ") - result3 = np.mean(y_pred3.ravel() == y_test.ravel()) * 100 - print(result3) - - est4 = OneVsOneClassifier(MKL(lmbda=0.1, nystrom_param=0.2)).fit(X_train, y_train) - y_pred4 = est4.predict(X_test) - y_pred44 = est4.predict(X_train) - print("result of MKL on digit with oneversone") - result4 = np.mean(y_pred4.ravel() == y_test.ravel()) * 100 - print(result4) - - fig = plt.figure(figsize=(12., 11.)) - fig.suptitle("MKL : result" + str(result4), fontsize=16) - plot_subplot(X_train, y_train, y_pred44 ,0, (4, 1, 1), "train vue 0" ) - plot_subplot(X_test, y_test,y_pred4 , 0, (4, 1, 2), "test vue 0" ) - plot_subplot(X_test, y_test, y_pred4,1, (4, 1, 3), "test vue 1" ) - plot_subplot(X_test, y_test,y_pred4, 2, (4, 1, 4), "test vue 2" ) - # plt.legend() - plt.show() - fig = plt.figure(figsize=(12., 11.)) - fig.suptitle("MuCumbo: result" + str(result3), fontsize=16) - plot_subplot(X_train, y_train, y_pred33 ,0, (4, 1, 1), "train vue 0" ) - plot_subplot(X_test, y_test,y_pred3 , 0, (4, 1, 2), "test vue 0" ) - plot_subplot(X_test, y_test, y_pred3,1, (4, 1, 3), "test vue 1" ) - plot_subplot(X_test, y_test,y_pred3, 2, (4, 1, 4), "test vue 2" ) - # plt.legend() - plt.show() - fig = plt.figure(figsize=(12., 11.)) - fig.suptitle("Mumbo: result" + str(result2), fontsize=16) - plot_subplot(X_train, y_train, y_pred22 , 0, (4, 1, 1), "train vue 0" ) - plot_subplot(X_test, y_test,y_pred2, 0, (4, 1, 2), "test vue 0" ) - plot_subplot(X_test, y_test, y_pred2, 1, (4, 1, 3), "test vue 1" ) - plot_subplot(X_test, y_test,y_pred2, 2, (4, 1, 4), "test vue 2" ) - # plt.legend() - plt.show() - fig = plt.figure(figsize=(12., 11.)) - fig.suptitle("MVML: result" + str(result1), fontsize=16) - plot_subplot(X_train, y_train, y_pred11 - , 0, (4, 1, 1), "train vue 0" ) - plot_subplot(X_test, y_test,y_pred1, 0, (4, 1, 2), "test vue 0" ) - plot_subplot(X_test, y_test, y_pred1, 1, (4, 1, 3), "test vue 1" ) - plot_subplot(X_test, y_test,y_pred1, 2, (4, 1, 4), "test vue 2" ) - #plt.legend() - plt.show() - #mvml = MVML(lmbda=0.1, eta=1, nystrom_param=0.2) - #mvml.fit(dic_digit_histo, y) diff --git a/examples/usecase/usecase_function.py b/examples/usecase/usecase_function.py new file mode 100644 index 0000000000000000000000000000000000000000..a6878b8c2535ba8c483aca107ca63e601412918b --- /dev/null +++ b/examples/usecase/usecase_function.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" +======================== +Use Case Function module +======================== + +Function plot_subplot + +""" + +import numpy as np +import matplotlib.pyplot as plt +import matplotlib._color_data as mcd + + +def plot_subplot(X, Y, Y_pred, vue, subplot, title): + cn = mcd.CSS4_COLORS + classes = np.unique(Y) + n_classes = len(np.unique(Y)) + axs = plt.subplot(subplot[0],subplot[1],subplot[2]) + axs.set_title(title) + #plt.scatter(X._extract_view(vue), X._extract_view(vue), s=40, c='gray', + # edgecolors=(0, 0, 0)) + for index, k in zip(range(n_classes), cn.keys()): + Y_class, = np.where(Y==classes[index]) + Y_class_pred = np.intersect1d(np.where(Y_pred==classes[index])[0], np.where(Y_pred==Y)[0]) + plt.scatter(X._extract_view(vue)[Y_class], + X._extract_view(vue)[Y_class], + s=40, c=cn[k], edgecolors='blue', linewidths=2, label="class real class: "+str(index)) # + plt.scatter(X._extract_view(vue)[Y_class_pred], + X._extract_view(vue)[Y_class_pred], + s=160, edgecolors='orange', linewidths=2, label="class prediction: "+str(index)) + + +if __name__ == '__main__': + pass \ No newline at end of file