i have to discover the many predictive keywords and/or expressions to accurately classify the the dating advice and relationship advice subreddit pages therefore we may use them to ascertain which adverts should populate for each web page. Because this is a category problem, we’ll use Logistic Regression & http://www.online-loan.org/payday-loans-sd/ Bayes models. Misclassifications in this full situation is fairly benign therefore I will make use of the precision rating and set up a baseline of 63.3per cent to price success. Utilizing TFiDfVectorization, I’ll get the function value to ascertain which terms have actually the greatest forecast energy for the prospective factors. If effective, this model is also utilized to a target other pages which have comparable regularity regarding the words that are same expressions.
Data Collection
See dating-advice-scrape and relationship-advice-scrape notebooks with this component.
After switching most of the scrapes into DataFrames, we conserved them as csvs that you can get within the dataset folder of the repo.
Information Cleaning and EDA
- dropped rows with null self text line becuase those rows are worthless for me.
- combined title and selftext column directly into one brand brand new columns that are all_text
- exambined distributions of term counts for titles and selftext column per post and contrasted the 2 subreddit pages.
Preprocessing and Modeling
Found the baseline precision score 0.633 which means that if i select the value that develops frequently, i will be appropriate 63.3% of times.
First attempt: logistic regression model with default CountVectorizer paramaters. train score: 99 | test 75 | cross val 74 Second attempt: tried CountVectorizer with Stemmatizer preprocessing on first group of scraping, pretty bad rating with a high variance. Train 99%, test 72%
- attempted to decrease maximum features and rating got a whole lot worse
- tried with lemmatizer preprocessing instead and test score went as much as 74percent