Restore compatibility with modern Python, pandas, and TensorFlow#43
Open
victalejo wants to merge 3 commits into
Open
Restore compatibility with modern Python, pandas, and TensorFlow#43victalejo wants to merge 3 commits into
victalejo wants to merge 3 commits into
Conversation
Pinned versions were ~5 years old and the project no longer installs or
runs on a fresh environment:
- requirements.txt: switch git:// (deprecated by GitHub since 2022) to
https://, relax pins to numpy>=1.23, pandas>=2.0, tensorflow>=2.13,
scikit-learn>=1.3 so installs succeed on Python 3.10+
- iq.py: replace DataFrame.append() (removed in pandas 2.0) with
pd.concat() in get_all_candles and fast_data
- training.py: drop("future", 1) -> drop("future", axis=1) for pandas
2.x; Adam(lr=, decay=) -> Adam(learning_rate=) (lr kwarg removed,
decay no longer a constructor arg in Keras 3); val_acc -> val_accuracy
so the ModelCheckpoint actually saves the best epoch
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ModelCheckpoint in Keras 3 (bundled with TF 2.16+) rejects custom
extensions like .model and requires .keras (whole model) or .weights.h5
(weights only). The previous suffix would have aborted training as soon
as val_accuracy improved.
- training.py:220: "models/{}.model" -> "models/{}.keras"
- testing.py:125, 139: train_data() + '.model' -> + '.keras'
Validated end-to-end with TF 2.16.2: ModelCheckpoint saves on
val_accuracy improvement, load_model() reloads the file, and the
restored model produces valid softmax predictions (339 554 params
preserved).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix: restore compatibility with modern Python/pandas/TensorFlow
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.
This pull request updates data handling and model training code to improve compatibility with recent versions of pandas and TensorFlow/Keras, and standardizes model file naming conventions. The main changes focus on replacing deprecated methods, updating optimizer parameters, and ensuring consistency in model file extensions.
Pandas and Data Handling Updates:
DataFrame.append()method withpd.concat()in both theget_data_neededandfast_datafunctions iniq.py, ensuring compatibility with newer pandas versions. [1] [2]df.drop()call inpreprocess_dfintraining.pyto use theaxis=1keyword argument instead of a positional argument, aligning with current pandas best practices.TensorFlow/Keras and Model Handling Updates:
train_data(intraining.py) to use thelearning_rateparameter instead of the deprecatedlr, and removed the unuseddecayparameter.ModelCheckpointcallback intrain_datato save models with a.kerasextension and monitorval_accuracyinstead of the deprecatedval_acc.testing.pyby replacing.modelwith.keraswhen loading models, ensuring consistency with the new saving convention. [1] [2]