diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/requirements.txt | 10 | ||||
| -rw-r--r-- | src/windows/plotviewer.py | 6 | ||||
| -rw-r--r-- | src/windows/predict.py | 8 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..966093b --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,10 @@ +customtkinter==5.0.1 +matplotlib==3.5.3 +nltk==3.7 +numpy==1.23.1 +pandas==1.4.4 +requests==2.28.1 +scikit_learn==1.1.3 +scipy==1.9.1 +seaborn==0.12.1 +tk==0.1.0 diff --git a/src/windows/plotviewer.py b/src/windows/plotviewer.py index 8fd8d98..40af100 100644 --- a/src/windows/plotviewer.py +++ b/src/windows/plotviewer.py @@ -50,6 +50,7 @@ class PlotViewer(customtkinter.CTk): def create_tabs(self): self.tabview = customtkinter.CTkTabview(self) + self.tabview.add("View Data / Predictions") self.tabview.add("Posts") self.tabview.add("Subscribers") self.tabview.add("Author Activity") @@ -59,7 +60,6 @@ class PlotViewer(customtkinter.CTk): self.tabview.add("Best Time Analysis") self.tabview.add("Scores Boxplot") self.tabview.add("Scores vs Comments") - self.tabview.add("View Data / Predictions") fig = Figure(figsize=(12, 8), dpi=72) self.posts_plot = fig.add_subplot(111) @@ -267,6 +267,10 @@ class PlotViewer(customtkinter.CTk): 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 model plots + self.model_plots_button = customtkinter.CTkButton(self.tabview.tab("View Data / Predictions"), text="Model Plots") + self.model_plots_button.pack(pady=10, padx=10, side=tkinter.RIGHT) + # 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) diff --git a/src/windows/predict.py b/src/windows/predict.py index 3bc2591..374ee09 100644 --- a/src/windows/predict.py +++ b/src/windows/predict.py @@ -1,3 +1,5 @@ +import random +import math import customtkinter import tkinter import pandas as pd @@ -111,6 +113,8 @@ class Predict(customtkinter.CTkToplevel): ups = int(ups_model.predict(postX)[0]) num_comments = int(num_comments_model.predict(postX)[0]) - tkinter.messagebox.showinfo('Predictions', 'Predicted ups: {}\nPredicted num_comments: {}'.format(ups, num_comments)) - + # random bias from the prediction + ups = int(ups // math.log(ups + 1)) + num_comments = int(num_comments // math.log(num_comments + 1)) + tkinter.messagebox.showinfo('Predictions', 'Predicted ups: {}\nPredicted num_comments: {}'.format(ups, num_comments)) |
