fix: restore compatibility with modern Python/pandas/TensorFlow#1
Merged
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>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74c63ec887
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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>
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.
Summary
The project no longer installed or ran on a fresh environment because dependencies and several call sites were 5+ years old. This PR fixes the breaking changes so
pip install -r requirements.txt && python -c "import iq, training, testing"works again on Python 3.10+ with modern pandas/TF.git://(deprecated by GitHub in 2022) tohttps://, relax pins tonumpy>=1.23,<2.0,pandas>=2.0,<3.0,tensorflow>=2.13,<3.0,scikit-learn>=1.3,<2.0DataFrame.append()(removed in pandas 2.0) withpd.concat()inget_all_candlesandfast_datadrop("future", 1)→drop("future", axis=1)(positional axis no longer accepted)Adam(lr=LEARNING_RATE, decay=5e-5)→Adam(learning_rate=LEARNING_RATE)(lrkwarg removed,decayis no longer a constructor arg in Keras 3 — equivalent behavior now requires a learning-rate schedule)monitor='val_acc'→monitor='val_accuracy'soModelCheckpointactually saves the best epoch instead of silently keeping nothingTest plan
Validated end-to-end in a clean Python 3.12.3 venv with the new requirements (tensorflow-cpu 2.16.2):
uv pip install --dry-run -r requirements.txtresolves 49 packages with no conflictspip install -r requirements.txtsucceeds (numpy 1.26.4, pandas 2.3.3, scikit-learn 1.8.0, TF 2.16.2)import iqworks;fast_data/get_all_candlesinner loop produces correct DataFrame with synthetic candlesimport trainingworks;classify()returns expected valuesimport testingreaches the livewhile(1):loop with stubbed login/load_model (defaultsbet_money=1 ratio='EURUSD' martingale=2)preprocess_dfreturns balancedX.shape=(28,5,9)from synthetic OHLCVtrain_data()compiles (339 554 params) withAdam(learning_rate=)and trains 1 epoch end-to-end (val_accuracymetric available)Not validated (requires real credentials / IQ Option network):
🤖 Generated with Claude Code