Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement of Deep Momentum Network with GPU handling, logging improvements, and result analysis notebook #4

Merged
merged 9 commits into from
Dec 17, 2023

Conversation

donlelef
Copy link
Member

@donlelef donlelef commented Dec 17, 2023

Type

Enhancement


Description

This PR introduces several enhancements to the Deep Momentum Network:

  • GPU handling: The GPU is now disabled for faster run as the batch size is too small.
  • Logging improvements: Additional logging has been added for better tracking of the model's performance and hyperparameters.
  • Result analysis notebook: A new Jupyter notebook has been added to analyze the results of a single run of the model.
  • Other changes: The number of random search iterations has been decreased for faster execution, and the validation data has been removed from the model.

PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
4 files
run_dmn_experiment.py                                                                             
    examples/run_dmn_experiment.py

    Added GPU handling and logging for GPU availability. The GPU
    is now disabled for faster run as the batch size is too
    small.
+3/-0
deep_momentum_network.py                                                                       
    mom_trans/deep_momentum_network.py

    Improved logging for better tracking of the model's
    performance and hyperparameters. The validation data has
    been removed from the model.
+6/-14
momentum_transformer.py                                                                         
    mom_trans/momentum_transformer.py

    Removed the weighted metrics from the model compilation.
+1/-1
EF01 Result Analysis.ipynb                                                                   
    notebooks/EF01 Result Analysis.ipynb

    Added a new Jupyter notebook to analyze the results of a
    single run of the model.
+93/-0
Configuration changes
1 files
fixed_params.py                                                                                         
    settings/fixed_params.py

    Decreased the number of random search iterations for faster
    execution.
+1/-1
Dependencies
1 files
requirements.txt                                                                                       
    requirements.txt

    Added new dependencies for JupyterLab, QuantStats, and
    TensorFlow Metal.
+3/-0

@donlelef donlelef self-assigned this Dec 17, 2023
Copy link

PR Analysis

  • 🎯 Main theme: Enhancements and optimizations in a machine learning project
  • 📝 PR summary: This PR introduces several changes to a machine learning project. It includes the addition of logging for GPU availability, disabling GPU for faster run, decreasing the number of random search iterations, and changing the loss metrics. It also adds a Jupyter notebook for result analysis and includes new dependencies in the requirements file.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 4, because the PR involves changes in multiple files and includes modifications in the machine learning model which require a good understanding of the project and the model.
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The PR includes several enhancements and optimizations which seem to be well thought out. However, it would be beneficial to include tests to ensure that these changes do not break existing functionality. Also, it would be helpful to include comments in the code explaining the reasoning behind certain changes, such as disabling the GPU and changing the loss metrics.

  • 🤖 Code feedback:
    relevant filemom_trans/deep_momentum_network.py
    suggestion      It's a good practice to avoid hardcoding values directly in the code. The line where GPU is disabled could be made more flexible by introducing a configuration parameter to control this behavior. [medium]
    relevant linetf.config.set_visible_devices([], 'GPU') # disable GPU as the batch size is too small

    relevant filesettings/fixed_params.py
    suggestion      The comment added to the 'random_search_iterations' parameter is helpful, but it would be better to include this information in the commit message or PR description instead of leaving it in the code. [medium]
    relevant line"random_search_iterations": 25, # EF: original was 50, but it takes too long

    relevant filemom_trans/deep_momentum_network.py
    suggestion      It's a good practice to log the reason for early stopping in machine learning models. Consider adding a log message explaining why the model stopped training early. [medium]
    relevant lineself.model.stop_training = True

    relevant filemom_trans/momentum_transformer.py
    suggestion      The 'weighted_metrics' parameter was removed from the model.compile() method. If this was intentional, consider adding a comment or explanation in the PR description. If it was unintentional, consider adding it back. [important]
    relevant linemodel.compile(loss=sharpe_loss, optimizer=adam, sample_weight_mode="temporal")

How to use

Instructions

To invoke the PR-Agent, add a comment using one of the following commands:
/review: Request a review of your Pull Request.
/describe: Update the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
/ask <QUESTION>: Ask a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.
/add_docs: Generate docstring for new components introduced in the PR.
/generate_labels: Generate labels for the PR based on the PR's contents.
see the tools guide for more details.

To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

@github-actions github-actions bot changed the title feat: try with experiments Enhancement of Deep Momentum Network with GPU handling, logging improvements, and result analysis notebook Dec 17, 2023
@github-actions github-actions bot added the enhancement New feature or request label Dec 17, 2023
Copy link

PR Description updated to latest commit (73a9b3d)

@donlelef donlelef merged commit e2929ff into master Dec 17, 2023
1 check passed
@donlelef donlelef deleted the feat/try-with-experiments branch December 17, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant