Git Product home page Git Product logo

Comments (4)

zhumingpassional avatar zhumingpassional commented on September 27, 2024

the plot function should be revised. now that the result has been obtained, plotting fig is easy.

from finrl.

VishnuRaghavan avatar VishnuRaghavan commented on September 27, 2024

"""
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.

zhumingpassional avatar zhumingpassional commented on September 27, 2024

@VishnuRaghavan
can your code successfully plot the figure? if yes, pls submit a PR

from finrl.

VishnuRaghavan avatar VishnuRaghavan commented on September 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.