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):

@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 21h 35m 2s ⏱️
 3 792 tests  3 792 ✅ 0 💤 0 ❌
80 334 runs  80 334 ✅ 0 💤 0 ❌

Results for commit 1853ede.

♻️ This comment has been updated with latest results.

@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
@guitargeek guitargeek restored the deprecate_pymva_keras_2 branch January 4, 2026 10:29
@guitargeek guitargeek reopened this Jan 4, 2026
@guitargeek guitargeek force-pushed the deprecate_pymva_keras_2 branch from c49354f to 1ab86c5 Compare January 4, 2026 11:11
@guitargeek
Copy link
Contributor Author

Reopened for now because I wanted to try out the suggestion by @silverweed to mark enum values as deprecated.

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.
Don't keep tutorials for deprecated functionality around, to make it
explicit to the users that they should not use TMVA PyKeras anymore.

We don't lose any test coverage when removing these tutorials, since
`tmva-pymva` is globally disabled in the CI anyway, as Keras 3 is not
supported by PyMVA.
@guitargeek guitargeek force-pushed the deprecate_pymva_keras_2 branch from 1ab86c5 to 1853ede Compare January 4, 2026 11:13
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