aboutsummaryrefslogtreecommitdiff
path: root/src/windows/plotviewer.py
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-02 18:46:26 -0500
committerBobby <[email protected]>2022-12-02 18:46:26 -0500
commitfec7417c4b78fa86aa53e7768e93c0e1d33b5eba (patch)
treec77f4db6c38ca1725e231d54cf976bf246e1d76b /src/windows/plotviewer.py
parentaf2ada7022d75411f2d74a4a4d2c95dfe3eb2e3a (diff)
downloadRedditEngagementPrediction-fec7417c4b78fa86aa53e7768e93c0e1d33b5eba.tar.xz
RedditEngagementPrediction-fec7417c4b78fa86aa53e7768e93c0e1d33b5eba.zip
Predictions Added
Diffstat (limited to 'src/windows/plotviewer.py')
-rw-r--r--src/windows/plotviewer.py43
1 files changed, 35 insertions, 8 deletions
diff --git a/src/windows/plotviewer.py b/src/windows/plotviewer.py
index da3886e..8fd8d98 100644
--- a/src/windows/plotviewer.py
+++ b/src/windows/plotviewer.py
@@ -14,6 +14,7 @@ from matplotlib.figure import Figure
from helpers.subreddits import SUBREDDITS
from .modeltrainer import ModelTrainer
+from .predict import Predict
import numpy as np
@@ -242,13 +243,42 @@ class PlotViewer(customtkinter.CTk):
self.models_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Train Models", command=self.train_models)
self.models_button.pack()
else:
- self.models_label = customtkinter.CTkLabel(self.tabview.tab("View Data / Predictions"), text="Models found. Predict by entering data on the next screen.", pady= 10)
- self.models_label.pack()
- self.models_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Predict")
- self.models_button.pack()
+ self.show_model_options()
self.tabview.pack(expand=True, fill='both')
+ def show_model_options(self):
+ models = [
+ 'DummyRegressor',
+ 'LinearRegression',
+ 'RidgeCV',
+ 'KNeighborsRegressor',
+ 'DecisionTreeRegressor',
+ 'RandomForestRegressor',
+ 'GradientBoostingRegressor',
+ ]
+ self.model = customtkinter.CTkComboBox(self.tabview.tab("View Data / Predictions"), values=models)
+ self.model.pack(pady=10, padx=10, side=tkinter.LEFT)
+
+ # metrics buttons
+ self.ups_metrics_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Ups Metrics")
+ self.ups_metrics_button.pack(pady=10, padx=10, side=tkinter.LEFT)
+
+ self.num_comments_metrics_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Num Comments Metrics")
+ self.num_comments_metrics_button.pack(pady=10, padx=10, side=tkinter.LEFT)
+
+ # button for predicting
+ self.predict_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Predict a new post", command=self.predict)
+ self.predict_button.pack(pady=10, padx=10, side=tkinter.RIGHT)
+
+
+ def predict(self):
+ # child window to take input of the post - title, selftext, subreddit, day, hour, distinguished
+ pred_win = Predict(self)
+ self.wait_window(pred_win)
+
+
+
def train_models(self):
# open model training child window
mt = ModelTrainer(self, self.posts)
@@ -258,9 +288,6 @@ class PlotViewer(customtkinter.CTk):
self.models_label.destroy()
self.models_button.destroy()
- self.models_label = customtkinter.CTkLabel(self.tabview.tab("View Data / Predictions"), text="Models found. Predict by entering data on the next screen.", pady= 10)
- self.models_label.pack()
- self.models_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Predict")
- self.models_button.pack()
+ self.show_model_options()