aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-02 19:01:22 -0500
committerBobby <[email protected]>2022-12-02 19:01:22 -0500
commit00a75681361ff8cca861f9c9616cb095ba425d32 (patch)
treeb058ec3fb081a11e07f86ce3e46c4fffa39dd9a7
parentfec7417c4b78fa86aa53e7768e93c0e1d33b5eba (diff)
downloadRedditEngagementPrediction-00a75681361ff8cca861f9c9616cb095ba425d32.tar.xz
RedditEngagementPrediction-00a75681361ff8cca861f9c9616cb095ba425d32.zip
Requirements Added
-rw-r--r--src/requirements.txt10
-rw-r--r--src/windows/plotviewer.py6
-rw-r--r--src/windows/predict.py8
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))