aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-02 19:01:40 -0500
committerBobby <[email protected]>2022-12-02 19:01:40 -0500
commit2fbbc2c07f306c6edd1ab543b03b6fc905b9fa3a (patch)
tree2b55c918af459621d2a0d15f3f345171e6721520
parent00a75681361ff8cca861f9c9616cb095ba425d32 (diff)
downloadRedditEngagementPrediction-2fbbc2c07f306c6edd1ab543b03b6fc905b9fa3a.tar.xz
RedditEngagementPrediction-2fbbc2c07f306c6edd1ab543b03b6fc905b9fa3a.zip
Requirements Added
-rw-r--r--project.ipynb49
1 files changed, 0 insertions, 49 deletions
diff --git a/project.ipynb b/project.ipynb
index 7a6f533..8a51212 100644
--- a/project.ipynb
+++ b/project.ipynb
@@ -1846,55 +1846,6 @@
},
{
"cell_type": "code",
- "execution_count": 62,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[50.44444444]\n",
- "[16.69550466]\n"
- ]
- }
- ],
- "source": [
- "# predict for a single post\n",
- "title = 'A good openCV tutorial?'\n",
- "selftext = \"So I'm learning openCV in python, and now I want as a project to develop some score calculator for a scrabble game. I watched this tutorial from codecamp, and i read about of functionalities of opencv module (such as medianblur, gaussianblur, addweighted, Canny, threshold, and so on), but i still can't grasp it together. Like, i know how to blur an image, to reduce noise let's say, but i don't know when to do that, and especially, why and how much, so I'm searching for a good openCV tutorial that explains these situations. \\n As an example, yesterday I did a project where i would've get a sudoku box from an image(by getting the top left, top right, bottom left, bottom right corners of the sudoku box). However, when I tried the same code for the project with the scrabble board, it's a total mess.\"\n",
- "subreddit = 'Python'\n",
- "link_flair_text = 'Tutorial'\n",
- "distinguished = False\n",
- "author_premium = False\n",
- "spoiler = False\n",
- "is_original_content = False\n",
- "day = 'Monday'\n",
- "over_18 = False\n",
- "hour = 10\n",
- "text = title + ' ' + selftext\n",
- "\n",
- "# Create a dataframe with the post\n",
- "post = pd.DataFrame({'title': [title], 'selftext': [selftext], 'subreddit': [subreddit], 'link_flair_text': [link_flair_text], 'distinguished': [distinguished], 'author_premium': [author_premium], 'spoiler': [spoiler], 'is_original_content': [is_original_content], 'day': [day], 'over_18': [over_18], 'hour': [hour], 'text': [text]})\n",
- "\n",
- "\n",
- "# Transform the post\n",
- "post_cat = [label_binarizer.transform(post[col]) for col in categorical_features]\n",
- "post_tfidf = TfIdfVectorizer.transform(post['text'])\n",
- "post_X = hstack([post_tfidf] + post_cat).tocsr()\n",
- "\n",
- "# Load the model\n",
- "with open(model_dir + 'DummyRegressor_ups.pkl', 'rb') as f:\n",
- " model = pickle.load(f)\n",
- " print(model.predict(post_X))\n",
- "\n",
- "# Load the model\n",
- "with open(model_dir + 'DummyRegressor_num_comments.pkl', 'rb') as f:\n",
- " model = pickle.load(f)\n",
- " print(model.predict(post_X))"
- ]
- },
- {
- "cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [