Comments (4)
the plot function should be revised. now that the result has been obtained, plotting fig is easy.
from finrl.
"""
Script for comparing results with DJIA.
This script reads data from df_result_ensemble and df_dji, merges them, and visualizes the comparison.
"""
import necessary packages
import pandas as pd
import os
import matplotlib.pyplot as plt
from finrl.config import DATA_SAVE_DIR
Load df_result_ensemble data from the CSV file
df_result_ensemble = pd.read_csv(
os.path.join(DATA_SAVE_DIR, "df_result_ensemble.csv"), index_col="date"
)
load df_dji data from csv
df_dji = pd.read_csv(os.path.join(DATA_SAVE_DIR, "df_dji.csv"), index_col="date")
Merge DataFrames on index
result = pd.merge(df_result_ensemble, df_dji, left_index=True, right_index=True)
Save to CSV
result.to_csv(os.path.join(DATA_SAVE_DIR, "result.csv"))
Rename columns for clarity
result.columns = ["ensemble", "djia"]
Plotting the result
Set the backend to a suitable interactive backend
plt.switch_backend("TkAgg") # Use 'TkAgg' backend for Tkinter-based interactive display
plt.rcParams["figure.figsize"] = (15, 5)
plt.figure()
result.plot()
plt.title("Ensemble and DJIA Comparison")
plt.xlabel("Date")
plt.ylabel("Values")
Display the plot interactively
plt.show()
from finrl.
@VishnuRaghavan
can your code successfully plot the figure? if yes, pls submit a PR
from finrl.
@zhumingpassional I'm running on my local machine I have split the colab file into multiple files the above code is for comparison with DJIA. Also I'm training it on my CUDA NVIDIA GPU. Making a PR would not be the best solution as the file architectures are now different.
And yes for me plotting is working fine with this setup.
from finrl.
Related Issues (20)
- exit code 139 (interrupted by signal 11:SIGSEGV)
- Please help! AssertionError : assert state.shape == (args.state_dim,) HOT 5
- New feature request - support customs indicators and strategies
- Wrong reward at terminal date when training with SB3
- MVO performing better than Porfolio allocation
- Bug when importing HOT 1
- Same reward thought the training in DDPG
- backtest_plot() have internal problem associated with pandas version HOT 1
- YahooFinanceProcessor failure to download the market data HOT 2
- Full dataset normalization biases test set HOT 1
- Some Technical indicators not supported HOT 1
- Proof of RL viability for trading with data leakage HOT 2
- could not import finrl in google colab HOT 2
- SAC model on testing set is allocating same weights to a given TIC on consecutive days HOT 1
- Value error after running 50000 timesteps HOT 1
- how to save the model ? HOT 1
- Is there a way to look at the Expected Rewards of each timestamp in the testing set? HOT 3
- Is there a way to prevent the FinRL model from doing any Short selling HOT 1
- all the input array dimensions except for the concatenation axis must match exactly when running FinRL_PortfolioOptimizationEnv_Demo with CAC40 Data HOT 1
- Do train and test dataframes have to have the same column ordering ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finrl.