Spaces:
Runtime error
Runtime error
improved tables
Browse files- WTI.py +37 -28
- __pycache__/WTI.cpython-38.pyc +0 -0
- bakwti.py +286 -0
WTI.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from enum import auto
|
2 |
import streamlit as st
|
3 |
import pandas as pd
|
@@ -125,39 +126,47 @@ def displayWTI():
|
|
125 |
AgGrid(file, key='dailyMetric', width='100%', fit_columns_on_grid_load=True,
|
126 |
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
127 |
|
128 |
-
#
|
129 |
-
# sss = pd.read_csv('WTI/CopBook1.csv')
|
130 |
-
# sss = sss.replace(np.nan, '', regex=True)
|
131 |
-
# sss.rename(columns={'Unnamed: 0': ' '}, inplace=True)
|
132 |
-
|
133 |
-
# def highlight_max(x):
|
134 |
-
# return ['font-weight: bold' if v == x.loc[0] else ''
|
135 |
-
# for v in x]
|
136 |
-
# sss = sss.style.apply(highlight_max)
|
137 |
-
# st.table(sss)
|
138 |
-
|
139 |
# BRENT WTI
|
140 |
-
st.header("Brent vs. WTI
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
# MODEL OUTPUT TABLE
|
157 |
st.header("Model Output (Close Prices vs. Predicted Prices)")
|
158 |
|
159 |
interval = st.selectbox("Select Interval:", ('Daily', 'Weekly',
|
160 |
-
|
161 |
|
162 |
if interval == 'Weekly':
|
163 |
file = pd.read_csv('WTI/BestWTI/bestWeekly.csv')
|
@@ -179,7 +188,7 @@ def displayWTI():
|
|
179 |
# Visualization
|
180 |
st.header("Visualization")
|
181 |
fig = px.line(file, x=file["Date"], y=["Close Prices", "ARIMA_50.0_(0, 1, 0)_Predictions",
|
182 |
-
|
183 |
st.plotly_chart(fig, use_container_width=True)
|
184 |
|
185 |
elif interval == 'Daily':
|
|
|
1 |
+
import matplotlib as mpl
|
2 |
from enum import auto
|
3 |
import streamlit as st
|
4 |
import pandas as pd
|
|
|
126 |
AgGrid(file, key='dailyMetric', width='100%', fit_columns_on_grid_load=True,
|
127 |
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
128 |
|
129 |
+
# TABLES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
# BRENT WTI
|
131 |
+
st.header("Brent vs. WTI Comparison")
|
132 |
+
st.subheader('ARIMA Accuracy Metrics & Best Models')
|
133 |
+
df2 = pd.DataFrame([[0.8, (0, 1, 0), 2.427, 0.017, 0.8, (0, 1, 0), 5.211, 0.023], [np.nan, np.nan, np.nan, np.nan, 0.5, (0, 1, 0), 9.498, 0.042], [0.5, (1, 0, 0), 9.366, 0.039, 0.500000, (1, 0, 0), 9.530000, 0.042000], [np.nan, np.nan, np.nan, np.nan, 0.500000, (0, 1, 0), 41.668000, 0.097000], [0.600000, (0, 1, 1), 46.308000, 0.091000, 0.600000, (0, 1, 1), 45.242000, 0.099000]], index=pd.Index(
|
134 |
+
['Daily', 'Weekly*', 'Weekly', 'Monthly*', "Monthly"], name='Actual Label:'),
|
135 |
+
columns=(["Brent Train Split", "Brent Order", "Brent MSE", "Brent MAPE", "WTI Train Split", "WTI Order", "WTI MSE", "WTI MAPE"]))
|
136 |
+
|
137 |
+
cell_hover = { # for row hover use <tr> instead of <td>
|
138 |
+
'selector': 'tr:hover',
|
139 |
+
'props': [('background-color', '#ff4c4c')]
|
140 |
+
}
|
141 |
+
|
142 |
+
index_names = {
|
143 |
+
'selector': '.index_name',
|
144 |
+
'props': 'font-style: italic; color: darkgrey; font-weight:normal;'
|
145 |
+
}
|
146 |
+
headers = {
|
147 |
+
'selector': 'th:not(.index_name)',
|
148 |
+
'props': 'background-color: #f0f2f6; color: black;'
|
149 |
+
}
|
150 |
+
df2 = df2.style
|
151 |
+
df2 = df2.set_table_styles(
|
152 |
+
[cell_hover, index_names, headers]).highlight_null(props="color: transparent;")
|
153 |
+
st.table(df2)
|
154 |
+
|
155 |
+
# LSTM
|
156 |
+
st.subheader('LSTM Accuracy Metrics & Best Models')
|
157 |
+
df3 = pd.DataFrame([[0.6, 4.152, 0.021, 0.8, 5.904, 0.02], [0.8, 21.62, 0.037, 0.8, 25.012, 0.039], [0.8, 56.275, 0.075, 0.8, 80.147, 0.096]], index=pd.Index(
|
158 |
+
['Daily', 'Weekly', "Monthly"], name='Actual Label:'),
|
159 |
+
columns=(["Brent Train Split", "Brent MSE", "Brent MAPE", "WTI Train Split", "WTI MSE", "WTI MAPE"]))
|
160 |
+
df3 = df3.style
|
161 |
+
df3 = df3.set_table_styles(
|
162 |
+
[cell_hover, index_names, headers])
|
163 |
+
st.table(df3)
|
164 |
|
165 |
# MODEL OUTPUT TABLE
|
166 |
st.header("Model Output (Close Prices vs. Predicted Prices)")
|
167 |
|
168 |
interval = st.selectbox("Select Interval:", ('Daily', 'Weekly',
|
169 |
+
'Monthly'), key='bestmodels')
|
170 |
|
171 |
if interval == 'Weekly':
|
172 |
file = pd.read_csv('WTI/BestWTI/bestWeekly.csv')
|
|
|
188 |
# Visualization
|
189 |
st.header("Visualization")
|
190 |
fig = px.line(file, x=file["Date"], y=["Close Prices", "ARIMA_50.0_(0, 1, 0)_Predictions",
|
191 |
+
"ARIMA_60.0_(0, 1, 1)_Predictions", "LSTM_80.0_Predictions"], title="BOTH PREDICTED WTI CRUDE OIL PRICES", width=1000)
|
192 |
st.plotly_chart(fig, use_container_width=True)
|
193 |
|
194 |
elif interval == 'Daily':
|
__pycache__/WTI.cpython-38.pyc
CHANGED
Binary files a/__pycache__/WTI.cpython-38.pyc and b/__pycache__/WTI.cpython-38.pyc differ
|
|
bakwti.py
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import matplotlib as mpl
|
2 |
+
from enum import auto
|
3 |
+
import streamlit as st
|
4 |
+
import pandas as pd
|
5 |
+
import yfinance as yf
|
6 |
+
import matplotlib.pyplot as plt
|
7 |
+
# import numpy as np
|
8 |
+
import plotly.express as px
|
9 |
+
from st_aggrid import GridOptionsBuilder, AgGrid
|
10 |
+
import plotly.graph_objects as go
|
11 |
+
from PIL import Image
|
12 |
+
import numpy as np
|
13 |
+
|
14 |
+
|
15 |
+
def displayWTI():
|
16 |
+
st.header("Raw Data")
|
17 |
+
# select time interval
|
18 |
+
interv = st.select_slider('Select Time Series Data Interval for Prediction', options=[
|
19 |
+
'Daily', 'Weekly', 'Monthly'], value='Weekly')
|
20 |
+
# st.write(interv[0])
|
21 |
+
# Function to convert time series to interval
|
22 |
+
|
23 |
+
@st.cache(persist=True, allow_output_mutation=True)
|
24 |
+
def getInterval(argument):
|
25 |
+
switcher = {
|
26 |
+
"W": "WTI/Weekly-WTI.csv",
|
27 |
+
"M": "WTI/Monthly-WTI.csv",
|
28 |
+
"D": "WTI/Daily-WTI.csv"
|
29 |
+
}
|
30 |
+
return switcher.get(argument, "WTI/Weekly-WTI.csv")
|
31 |
+
|
32 |
+
df = pd.read_csv(getInterval(interv[0]))
|
33 |
+
|
34 |
+
def pagination(df):
|
35 |
+
gb = GridOptionsBuilder.from_dataframe(df)
|
36 |
+
gb.configure_pagination(paginationAutoPageSize=True)
|
37 |
+
return gb.build()
|
38 |
+
|
39 |
+
page = pagination(df)
|
40 |
+
st.table(df.head())
|
41 |
+
# download full data
|
42 |
+
|
43 |
+
@st.cache
|
44 |
+
def convert_df(df):
|
45 |
+
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
46 |
+
return df.to_csv().encode('utf-8')
|
47 |
+
|
48 |
+
csv = convert_df(df)
|
49 |
+
|
50 |
+
st.download_button(
|
51 |
+
label="Download data as CSV",
|
52 |
+
data=csv,
|
53 |
+
file_name='WTI Oil Prices.csv',
|
54 |
+
mime='text/csv',
|
55 |
+
)
|
56 |
+
|
57 |
+
# st.header("Standard Deviation of Raw Data")
|
58 |
+
# sd = pd.read_csv('StandardDeviation.csv')
|
59 |
+
# sd.drop("Unnamed: 0", axis=1, inplace=True)
|
60 |
+
# # sd = sd.reset_index()
|
61 |
+
# AgGrid(sd, key='SD1', enable_enterprise_modules=True,
|
62 |
+
# fit_columns_on_grid_load=True, theme='streamlit')
|
63 |
+
# st.write("Note: All entries end on 2022-06-30.")
|
64 |
+
|
65 |
+
# sd = sd.pivot(index='Start Date', columns='Interval',
|
66 |
+
# values='Standard Deviation')
|
67 |
+
# sd = sd.reset_index()
|
68 |
+
# # visualization
|
69 |
+
# fig = px.line(sd, x=sd.index, y=['1d', '1wk', '1mo', '3mo'],
|
70 |
+
# title="STANDARD DEVIATION OF BRENT CRUDE OIL PRICES", width=1000)
|
71 |
+
# st.plotly_chart(fig, use_container_width=True)
|
72 |
+
|
73 |
+
# accuracy metrics
|
74 |
+
st.header("Accuracy Metric Comparison")
|
75 |
+
intervals = st.selectbox(
|
76 |
+
"Select Interval:", ('Daily', 'Weekly', 'Monthly'), key='metricKey')
|
77 |
+
with st.container():
|
78 |
+
col1, col2 = st.columns(2)
|
79 |
+
|
80 |
+
# LSTM METRICS
|
81 |
+
# st.write("LSTM Metrics")
|
82 |
+
|
83 |
+
readfile = pd.read_csv('WTI/LSTM.csv')
|
84 |
+
# readfile = readfile[readfile['Interval'] == intervals.upper()]
|
85 |
+
readfile = readfile[readfile['Interval']
|
86 |
+
== st.session_state.metricKey.upper()]
|
87 |
+
# readfile[readfile['Interval'] == intervals.upper()]
|
88 |
+
# readfile = updatefile(readfile)
|
89 |
+
readfile.drop("Unnamed: 0", axis=1, inplace=True)
|
90 |
+
with col1:
|
91 |
+
st.write("LSTM Metrics")
|
92 |
+
AgGrid(readfile, key=st.session_state.metricKey, fit_columns_on_grid_load=True,
|
93 |
+
enable_enterprise_modules=True, theme='streamlit')
|
94 |
+
|
95 |
+
# st.write(st.session_state.metricKey)
|
96 |
+
|
97 |
+
# ARIMA METRICS
|
98 |
+
# st.write("ARIMA Metrics")
|
99 |
+
# intervals = st.selectbox(
|
100 |
+
# "Select Interval:", ('Weekly', 'Monthly', 'Quarterly', 'Daily'))
|
101 |
+
|
102 |
+
if intervals == 'Weekly':
|
103 |
+
file = pd.read_csv('WTI/ARIMAMetrics/ARIMA-WEEKLY.csv')
|
104 |
+
file.drop("Unnamed: 0", axis=1, inplace=True)
|
105 |
+
page = pagination(file)
|
106 |
+
with col2:
|
107 |
+
st.write("ARIMA Metrics")
|
108 |
+
AgGrid(file, width='100%', theme='streamlit', enable_enterprise_modules=True,
|
109 |
+
fit_columns_on_grid_load=True, key='weeklyMetric', gridOptions=page)
|
110 |
+
|
111 |
+
elif intervals == 'Monthly':
|
112 |
+
file = pd.read_csv('WTI/ARIMAMetrics/ARIMA-MONTHLY.csv')
|
113 |
+
file.drop("Unnamed: 0", axis=1, inplace=True)
|
114 |
+
page = pagination(file)
|
115 |
+
with col2:
|
116 |
+
st.write("ARIMA Metrics")
|
117 |
+
AgGrid(file, key='monthlyMetric', fit_columns_on_grid_load=True,
|
118 |
+
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
119 |
+
|
120 |
+
elif intervals == 'Daily':
|
121 |
+
file = pd.read_csv('WTI/ARIMAMetrics/ARIMA-DAILY.csv')
|
122 |
+
file.drop("Unnamed: 0", axis=1, inplace=True)
|
123 |
+
page = pagination(file)
|
124 |
+
with col2:
|
125 |
+
st.write("ARIMA Metrics")
|
126 |
+
AgGrid(file, key='dailyMetric', width='100%', fit_columns_on_grid_load=True,
|
127 |
+
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
128 |
+
|
129 |
+
# TABLES
|
130 |
+
df2 = pd.DataFrame([[0.8, (0, 1, 0), 2.427, 0.017, 0.8, (0, 1, 0), 5.211, 0.023], [np.nan, np.nan, np.nan, np.nan, 0.5, (0, 1, 0), 9.498, 0.042], [0.5, (1, 0, 0), 9.366, 0.039, 0.500000, (1, 0, 0), 9.530000, 0.042000], [np.nan, np.nan, np.nan, np.nan, 0.500000, (0, 1, 0), 41.668000, 0.097000], [0.600000, (0, 1, 1), 46.308000, 0.091000, 0.600000, (0, 1, 1), 45.242000, 0.099000]], index=pd.Index(
|
131 |
+
['Daily', 'Weekly*', 'Weekly', 'Monthly*', "Monthly"], name='Actual Label:'),
|
132 |
+
# columns=pd.MultiIndex.from_product([['Brent', 'WTI'], ['Train Split', 'Order', 'MSE', 'MAPE']], names=['Model:', 'Predicted:']))
|
133 |
+
# columns=pd.MultiIndex.from_tuples([("Brent", "Train Split"), ("Brent", "Order"), ("Brent", "MSE"), ("Brent", "MAPE"),
|
134 |
+
# ("WTI ", "Train Split"), ("WTI", "Order"), ("WTI", "MSE"), ("WTI", "MAPE")]))
|
135 |
+
columns=(["Brent Train Split", "Brent Order", "Brent MSE", "Brent MAPE", "WTI Train Split", "WTI Order", "WTI MSE", "WTI MAPE"]))
|
136 |
+
|
137 |
+
# df2 = pd.DataFrame([[0.8, (0, 1, 0), 2.427, 0.017, 0.8, (0, 1, 0), 5.211, 0.023], [0.5, (1, 0, 0), 9.366, 0.039, 0.5, (0, 1, 0), 9.498, 0.042], [np.nan, np.nan, np.nan, np.nan, 0.5, (0, 1, 0), 9.498, 0.042], [0.5, (1, 0, 0), 9.366, 0.039, 0.5, (0, 1, 0), 9.498, 0.042]], index=pd.Index(
|
138 |
+
# ['Daily', 'Weekly', '', 'Monthly'], name='Actual Label:'),
|
139 |
+
# columns=pd.MultiIndex.from_product([['', '1'], ['Train Split', 'Order', 'MSE', 'MAPE']], names=['Model:', 'Predicted:']))
|
140 |
+
st.table(df2)
|
141 |
+
# multi_index = pd.MultiIndex.from_tuples(
|
142 |
+
# [('Daily'), ('Weekly'), ('Hello World'), ('Monthly')], names=['Courses', 'Courses1', 'Courses2', 'Courses3'])
|
143 |
+
# col = pd.MultiIndex.from_tuples([("Brent", "Train Split"), ("Brent", "Order"), ("Brent", "MSE"), (
|
144 |
+
# "Brent", "MAPE"), ("WTI ", "Train Split"), ("WTI", "Order"), ("WTI", "MSE"), ("WTI", "MAPE")])
|
145 |
+
# data = [[0.8, (0, 1, 0), 2.427, 0.017, 0.8, (0, 1, 0), 5.211, 0.023], [0.5, (1, 0, 0), 9.366, 0.039, 0.5, (0, 1, 0), 9.498, 0.042], [
|
146 |
+
# 0, 0, 0, 0, 0.5, (0, 1, 0), 9.498, 0.042], [0.5, (1, 0, 0), 9.366, 0.039, 0.5, (0, 1, 0), 9.498, 0.042]]
|
147 |
+
# df2 = pd.DataFrame(data, columns=col, index=multi_index)
|
148 |
+
|
149 |
+
# multi_index = pd.MultiIndex.from_tuples([("r0", "rA"),
|
150 |
+
# ("r1", "rB")],
|
151 |
+
# names=['Courses', 'Fee'])
|
152 |
+
# cols = pd.MultiIndex.from_tuples([("Gasoline", "Toyoto"),
|
153 |
+
# ("Gasoline", "Ford"),
|
154 |
+
# ("Electric", "Tesla"),
|
155 |
+
# ("Electric", "Nio")])
|
156 |
+
# data = [[100, 300, 900, 400], [200, 500, 300, 600]]
|
157 |
+
|
158 |
+
# df2 = pd.DataFrame(data, columns=cols, index=multi_index)
|
159 |
+
|
160 |
+
cell_hover = { # for row hover use <tr> instead of <td>
|
161 |
+
'selector': 'tr:hover',
|
162 |
+
'props': [('background-color', '#ff4c4c')]
|
163 |
+
}
|
164 |
+
|
165 |
+
index_names = {
|
166 |
+
'selector': '.index_name',
|
167 |
+
'props': 'font-style: italic; color: darkgrey; font-weight:normal;'
|
168 |
+
}
|
169 |
+
headers = {
|
170 |
+
# 'selector': 'th:not(.index_name)',
|
171 |
+
'selector': 'th:not(.index_name)',
|
172 |
+
'props': 'background-color: #f0f2f6; color: black;'
|
173 |
+
}
|
174 |
+
df2 = df2.style
|
175 |
+
df2 = df2.set_table_styles(
|
176 |
+
[cell_hover, index_names, headers]).highlight_null(props="color: transparent;")
|
177 |
+
df2 = df2.set_table_styles([
|
178 |
+
{'selector': 'th.col_heading', 'props': 'text-align: center;'},
|
179 |
+
{'selector': 'th.col_heading.level0', 'props': 'font-size: 1em;'},
|
180 |
+
{'selector': 'td', 'props': 'text-align: center; font-weight: bold;'},
|
181 |
+
], overwrite=False)
|
182 |
+
# df2 = df2.replace(np.nan, '', regex=True)
|
183 |
+
st.table(df2)
|
184 |
+
|
185 |
+
# st.table(sss)
|
186 |
+
sss = pd.read_csv('WTI/CopBook1.csv')
|
187 |
+
# sss = sss.replace(np.nan, '', regex=True)
|
188 |
+
sss.rename(columns={'Unnamed: 0': ' '}, inplace=True)
|
189 |
+
sss.fillna("")
|
190 |
+
# sss = sss.style
|
191 |
+
|
192 |
+
# AgGrid(sss, key='WTI/CopBook1.csv', fit_columns_on_grid_load=True,
|
193 |
+
# enable_enterprise_modules=True, theme='streamlit')
|
194 |
+
cell_hover = { # for row hover use <tr> instead of <td>
|
195 |
+
'selector': 'td:hover',
|
196 |
+
'props': [('background-color', '#ffffb3')]
|
197 |
+
}
|
198 |
+
|
199 |
+
# sss = sss.style.set_properties(**{'background-color': 'black',
|
200 |
+
# 'color': 'green'})
|
201 |
+
# sss = sss.style.set_properties(**{'background-color': 'yellow' if v ==
|
202 |
+
# sss.loc[0] else "" for v in sss}, axis=1).highlight_null(props="color: transparent;")
|
203 |
+
|
204 |
+
# sss = sss.style.apply(lambda x: ["background: red" if v ==
|
205 |
+
# (x.iloc[1,3]) else "" for v in x], axis=1).highlight_null(props="color: transparent;")
|
206 |
+
|
207 |
+
# sss = sss.style.apply(lambda x: ["background: red"(
|
208 |
+
# (x.iloc[1:3]))]).highlight_null(props="color: transparent;")
|
209 |
+
|
210 |
+
# sss.style.apply(lambda x: ["background: red" if v ==
|
211 |
+
# x.loc[0] else "" for v in x], axis=1)
|
212 |
+
sss = sss.style
|
213 |
+
sss = sss.set_table_styles(
|
214 |
+
[cell_hover, index_names, headers]).highlight_null(props="color: transparent;")
|
215 |
+
sss = sss.set_table_styles([
|
216 |
+
{'selector': 'th.col_heading', 'props': 'text-align: center;'},
|
217 |
+
{'selector': 'th.col_heading.level0', 'props': 'font-size: 1em;'},
|
218 |
+
{'selector': 'td', 'props': 'text-align: center; font-weight: bold;'},
|
219 |
+
], overwrite=False)
|
220 |
+
|
221 |
+
# sss = sss.style.highlight_null(props="color: transparent;")
|
222 |
+
# sss = sss.set_table_styles([cell_hover])
|
223 |
+
|
224 |
+
# def highlight_max(x):
|
225 |
+
# return ['font-weight: bold' if v == x.loc[0] else ''
|
226 |
+
# for v in x]
|
227 |
+
# sss = sss.style.apply(highlight_max)
|
228 |
+
|
229 |
+
st.table(sss)
|
230 |
+
|
231 |
+
# BRENT WTI
|
232 |
+
st.header("Brent vs. WTI Accuracy Metrics & Best Models")
|
233 |
+
|
234 |
+
# arima = Image.open('assets/images/ARIMA23.png')
|
235 |
+
# st.image(arima, caption='Table of Comparisons: ARIMA',
|
236 |
+
# use_column_width='auto')
|
237 |
+
|
238 |
+
col1, col2, col3 = st.columns([1, 6, 1])
|
239 |
+
|
240 |
+
with col2:
|
241 |
+
arima = Image.open('assets/images/ARIMA3111.png')
|
242 |
+
st.image(arima, caption='Table of Comparisons: ARIMA',
|
243 |
+
use_column_width='auto')
|
244 |
+
lstm = Image.open('assets/images/LSTM2.png')
|
245 |
+
st.image(lstm, caption='Table of Comparisons: LSTM',
|
246 |
+
use_column_width='auto')
|
247 |
+
|
248 |
+
# MODEL OUTPUT TABLE
|
249 |
+
st.header("Model Output (Close Prices vs. Predicted Prices)")
|
250 |
+
|
251 |
+
interval = st.selectbox("Select Interval:", ('Daily', 'Weekly',
|
252 |
+
'Monthly'), key='bestmodels')
|
253 |
+
|
254 |
+
if interval == 'Weekly':
|
255 |
+
file = pd.read_csv('WTI/BestWTI/bestWeekly.csv')
|
256 |
+
page = pagination(file)
|
257 |
+
AgGrid(file, key='weeklycombined', fit_columns_on_grid_load=True,
|
258 |
+
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
259 |
+
|
260 |
+
# Visualization
|
261 |
+
st.header("Visualization")
|
262 |
+
fig = px.line(file, x=file["Date"], y=["Close Prices", "ARIMA_50.0_(0, 1, 0)_Predictions",
|
263 |
+
"ARIMA_50.0_(1, 0, 0)_Predictions", "LSTM_80.0_Predictions"], title="BOTH PREDICTED WTI CRUDE OIL PRICES", width=1000)
|
264 |
+
st.plotly_chart(fig, use_container_width=True)
|
265 |
+
|
266 |
+
elif interval == 'Monthly':
|
267 |
+
file = pd.read_csv('WTI/BestWTI/bestMonthly.csv')
|
268 |
+
page = pagination(file)
|
269 |
+
AgGrid(file, key='monthlyCombined', fit_columns_on_grid_load=True,
|
270 |
+
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
271 |
+
# Visualization
|
272 |
+
st.header("Visualization")
|
273 |
+
fig = px.line(file, x=file["Date"], y=["Close Prices", "ARIMA_50.0_(0, 1, 0)_Predictions",
|
274 |
+
"ARIMA_60.0_(0, 1, 1)_Predictions", "LSTM_80.0_Predictions"], title="BOTH PREDICTED WTI CRUDE OIL PRICES", width=1000)
|
275 |
+
st.plotly_chart(fig, use_container_width=True)
|
276 |
+
|
277 |
+
elif interval == 'Daily':
|
278 |
+
file = pd.read_csv('WTI/BestWTI/bestDaily.csv')
|
279 |
+
page = pagination(file)
|
280 |
+
AgGrid(file, key='dailyCombined', fit_columns_on_grid_load=True,
|
281 |
+
enable_enterprise_modules=True, theme='streamlit', gridOptions=page)
|
282 |
+
# Visualization
|
283 |
+
st.header("Visualization")
|
284 |
+
fig = px.line(file, x=file["Date"], y=["Close Prices", "ARIMA_80.0_(0, 1, 0)_Predictions", # find file
|
285 |
+
"LSTM_60.0_DAILY", "LSTM_80.0_DAILY", ], title="BOTH PREDICTED WTI CRUDE OIL PRICES", width=1000)
|
286 |
+
st.plotly_chart(fig, use_container_width=True)
|