Skip to content

Conversation

@guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Dec 1, 2025

The new Keras 3 API broke the existing TMVA PyKeras method.

Re-implementing the method for Keras 3 turned out to be difficult, as it is not possible anymore to disable eager execution and have a decent speed in evaluating the model for single events. So large-scale refactoring would be necessary to implement PyKeras again with good performance (see also #15790).

Nowadays, we also have the RBatchGenerator to train Keras models directly with batches that are provided by ROOT. Therefore, the TMVA PyKeras method is not the only way anymore to train a Keras model with ROOT data without 3rd party libraries for the IO. That means it's not an essential feature anymore, and deprecating it will even make the situation clearer for the user, as there are not two different ways anymore to train Keras models on ROOT data.

Note that it doesn't help us in this case to use the deprecation macros, because tmva-pymva is always disabled anyway. So we would not benefit from the automatic removal-reminder errors that one would get in the next development cycle.

I also opened a separate PR that exercises the eventual removal in the next development cycle, also showing that after PyKeras is gone, we can enable tmva-pymva again, as the other methods it provides work just fine (except for for corner cases like PyTorch on Linux ARM):

The new Keras 3 API broke the existing TMVA `PyKeras` method.

Re-implementing the method for Keras 3 turned out to be difficult, as it
is not possible anymore to disable eager execution and have a decent
speed in evaluating the model for single events. So large-scale
refactoring would be necessary to implement `PyKeras` again with good
performance (see also root-project#15790).

Nowadays, we also have the RBatchGenerator to train Keras models
directly with batches that are provided by ROOT. Therefore, the TMVA
`PyKeras` method is not the only way anymore to train a Keras model with
ROOT data without 3rd party libraries for the IO. That means it's not an
essential feature anymore, and deprecating it will even make the
situation clearer for the user, as there are not two different ways
anymore to train Keras models on ROOT data.
kPyAdaBoost ,
kPyGTB ,
kPyKeras ,
kPyKeras, // deprecated, will be removed in ROOT 6.42
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we mark this with R__DEPRECATED?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think you can mark individual enum elements as deprecated with R__DEPRECATED (it's only for functions and classes).

Copy link
Contributor

@silverweed silverweed Dec 1, 2025

Choose a reason for hiding this comment

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

Actually you can since C++17! (and we're doing it already, see RNTupleTypes.hxx)

@lmoneta
Copy link
Member

lmoneta commented Dec 1, 2025

I would wait to deprecate the PyKeras interface. Once we merge #15790, the work in refactoring is already done there, we can easily support Keras 3.

@guitargeek
Copy link
Contributor Author

guitargeek commented Dec 1, 2025

Hi @lmoneta, thanks for the comment! I have recently tried our #15790 and it didn't work, which is why I thought it might be unreasonably difficult to support Keras 3 in PyMVA. If you update that PR, we can of course re-evaluate the situation!

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Test Results

    22 files      22 suites   3d 20h 28m 48s ⏱️
 3 785 tests  3 783 ✅ 0 💤 2 ❌
81 252 runs  81 250 ✅ 0 💤 2 ❌

For more details on these failures, see this check.

Results for commit c49354f.

@guitargeek
Copy link
Contributor Author

Let's give some more time to @lmoneta to fix PyMVA.

@guitargeek guitargeek closed this Dec 4, 2025
@guitargeek guitargeek deleted the deprecate_pymva_keras_2 branch December 4, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants