Repository navigation
Fix the NN code for Keras 3 and scikit-learn 1.4+ - #8
Merged
Merged
Conversation
RMSprop no longer accepts lr, decay or epsilon=None, so every NN fit raised before training started. Use learning_rate and Keras' default epsilon, which is what epsilon=None used to select.
tf.keras.backend.function does not exist in Keras 3. Compute the layer outputs by calling the layers directly, through a helper that keeps the list-of-outputs shape the callers index into.
scikit-learn 1.4 removed the sparse argument of OneHotEncoder, which made the evaluation of every NN epoch raise TypeError.
test_kwargs compared the optimizer and callback to classes living in tensorflow.python, a private path that Keras 3 removed. Compare with the classes the test imports from tensorflow.keras instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second stream. Stacked on #7 (base is
fix/correctness-bugs); retarget tomasteronce #7 is merged.With current TensorFlow (Keras 3) and scikit-learn, every NN fit raised before
training: 24 tests of
tests/tests_NNfailed on master. This makes them runagain, one fix per commit:
RMSpropoptimizer is built withlearning_rateand Keras'default epsilon (
lr,decayandepsilon=Noneare gone);tf.keras.backend.functionno longer exists, so layer outputs are computedby calling the layers through a small
_layer_outputhelper that keeps thelist shape the callers index into;
OneHotEncoder(sparse=False)becomessparse_output=False;test_kwargscompares against the public Keras classes instead oftensorflow.python.Tests: 93 pass, including all NN tests (about 3 minutes, the NN tests train).