Skip to content

[TMVA] Pythonizations for TMVA#11069

Merged
lmoneta merged 4 commits into
root-project:masterfrom
harshal0815:tmva-python-tutorials
Sep 7, 2022
Merged

[TMVA] Pythonizations for TMVA#11069
lmoneta merged 4 commits into
root-project:masterfrom
harshal0815:tmva-python-tutorials

Conversation

@harshal0815

Copy link
Copy Markdown
Contributor

This Pull request:

  • TMVA Pythonizations
  • Translations of TMVA tutorial files into Python.

Changes or fixes:

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

@phsft-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@lgtm-com

lgtm-com Bot commented Jul 28, 2022

Copy link
Copy Markdown

This pull request introduces 15 alerts when merging 747d015 into 5c8008d - view on LGTM.com

new alerts:

  • 6 for Unreachable code
  • 4 for Module is imported with 'import' and 'import from'
  • 2 for Except block handles 'BaseException'
  • 1 for Unused import
  • 1 for Variable defined multiple times
  • 1 for `__init__` method returns a value

@etejedor

Copy link
Copy Markdown
Contributor

Hi @Harshalzzzzzzz , I have a couple of quick general comments:

  • If you are creating a dedicated subdirectory for TMVA pythonizations, the TMVA pythonization files that are now in the general _pythonization directory should be moved to the _tmva subdirectory (i.e. _rbdt.py, _rtensor.py and _tree_inference.py).
  • You need to make sure the pythonizations are actually picked up and registered at import ROOT time (since those pythonizations are not in the general _pythonization directory, they won't be picked). See how _roofit handles a similar case.
  • For every new pythonization you add, please add a new unit test file. Please see the test directory in pyroot/pythonizations. There are some conventions on the name of the file to be followed (class_pythonization-name.py, see examples). If you also create a tmva subdirectory for your tests there, like it's done for roofit, please move the current tmva pythonization test files that are in the general directory to your subdirectory.

@harshal0815

Copy link
Copy Markdown
Contributor Author

@etejedor Hello sir, Thank you for the inputs, I will make these changes and update the PR

Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py Outdated
@lgtm-com

lgtm-com Bot commented Aug 5, 2022

Copy link
Copy Markdown

This pull request introduces 15 alerts when merging 3a27644 into 08ab7e0 - view on LGTM.com

new alerts:

  • 6 for Unreachable code
  • 4 for Module is imported with 'import' and 'import from'
  • 2 for Except block handles 'BaseException'
  • 1 for Unused import
  • 1 for Variable defined multiple times
  • 1 for `__init__` method returns a value

@lmoneta

lmoneta commented Aug 5, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-08-05T07:13:15.169Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T07:13:15.169Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T07:13:20.429Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T07:13:21.980Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]

Failing tests:

And 10 more

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some corrections for the TMVA_CNN_Classification.py tutorial.
For the RNN tutorial there are many corrections.
You can get the file directly from my repo:
https://github.com/lmoneta/root/blob/harshal_tmva_pythonization/tutorials/tmva/TMVA_RNN_Classification.py

and you can see all teh diffs in this commit:

lmoneta@4aec9b3

Comment thread tutorials/tmva/TMVA_CNN_Classification.py Outdated
Comment thread tutorials/tmva/TMVA_CNN_Classification.py Outdated
Comment thread tutorials/tmva/TMVA_CNN_Classification.py
Comment thread tutorials/tmva/TMVA_CNN_Classification.py Outdated
@lmoneta

lmoneta commented Aug 5, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@lgtm-com

lgtm-com Bot commented Aug 5, 2022

Copy link
Copy Markdown

This pull request introduces 14 alerts when merging 02cbe17 into f25e7e5 - view on LGTM.com

new alerts:

  • 6 for Unreachable code
  • 4 for Module is imported with 'import' and 'import from'
  • 1 for Except block handles 'BaseException'
  • 1 for Unused import
  • 1 for Variable defined multiple times
  • 1 for `__init__` method returns a value

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-08-05T13:09:40.822Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T13:09:45.527Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T13:09:49.970Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-05T13:10:00.901Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]

Failing tests:

And 2 more

@lmoneta

lmoneta commented Aug 10, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-08-10T12:54:11.200Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-10T12:54:11.200Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-10T12:54:21.065Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-10T12:54:22.412Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]

Failing tests:

And 2 more

@lgtm-com

lgtm-com Bot commented Aug 17, 2022

Copy link
Copy Markdown

This pull request introduces 16 alerts when merging 62c6fcb into bec44f8 - view on LGTM.com

new alerts:

  • 6 for Unreachable code
  • 3 for 'import *' may pollute namespace
  • 3 for Module is imported with 'import' and 'import from'
  • 1 for Except block handles 'BaseException'
  • 1 for Unused import
  • 1 for Variable defined multiple times
  • 1 for `__init__` method returns a value

@lmoneta

lmoneta commented Aug 17, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-08-17T12:50:03.456Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-17T12:50:04.243Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-17T12:50:09.937Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-17T12:50:11.751Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]

Failing tests:

-Fix some issues happening by moving previous TMVA pythonizations in .tmva directory
-Adapt some Python tutorials to new versions of external software (xgboost, scikit)
- Remove tmva003_RReader tutorial since it requres to have first RReader pythonizations or RTensor-> numpy conversion
@lgtm-com

lgtm-com Bot commented Aug 26, 2022

Copy link
Copy Markdown

This pull request introduces 6 alerts when merging e293793 into 0b49293 - view on LGTM.com

new alerts:

  • 5 for Unreachable code
  • 1 for `__init__` method returns a value

@lmoneta

lmoneta commented Aug 26, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@lmoneta

lmoneta commented Aug 26, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-08-26T11:19:33.874Z] /home/sftnight/build/workspace/root-pullrequests-build/root/core/metacling/src/TClingCallFunc.cxx:1539:20: warning: ‘this’ pointer is null [-Wnonnull]
  • [2022-08-26T11:25:16.550Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-26T11:25:20.122Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-26T11:25:23.957Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
  • [2022-08-26T11:25:28.521Z] /usr/include/python3.10/numpy/__multiarray_api.h:1464:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Harshal for this contribution.
Just please include the small fix that was reported by LGTM

@lgtm-com

lgtm-com Bot commented Aug 26, 2022

Copy link
Copy Markdown

This pull request introduces 5 alerts when merging 4970a8c into 0b49293 - view on LGTM.com

new alerts:

  • 5 for Unreachable code

@lmoneta

lmoneta commented Sep 7, 2022

Copy link
Copy Markdown
Member

@phsft-bot build just on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On

@phsft-bot

Copy link
Copy Markdown

Starting build on ROOT-ubuntu2204/default with flags -Dtmva-sofie=On -DCTEST_TEST_EXCLUDE_NONE=On
How to customize builds

@phsft-bot

Copy link
Copy Markdown

Build failed on ROOT-ubuntu2204/default.
Running on root-ubuntu-2204-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants