Update news_category_similar_news_prediction.py
Browse files
news_category_similar_news_prediction.py
CHANGED
@@ -87,7 +87,7 @@ def process_prediction_df(df, df_type: str="production"):
|
|
87 |
df.drop_duplicates(subset='url', keep='first', inplace=True)
|
88 |
df.reset_index(drop=True, inplace=True)
|
89 |
|
90 |
-
|
91 |
df.loc[(df['title'].str.contains('Pakistan')) & (df['category'] == 'NATION'), 'category'] = 'WORLD'
|
92 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
93 |
df.loc[(df['title'].str.contains('Zodiac Sign', case=False)) | (df['title'].str.contains('Horoscope', case=False)), 'category'] = 'ASTROLOGY'
|
|
|
87 |
df.drop_duplicates(subset='url', keep='first', inplace=True)
|
88 |
df.reset_index(drop=True, inplace=True)
|
89 |
|
90 |
+
df.loc[df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'NATION'
|
91 |
df.loc[(df['title'].str.contains('Pakistan')) & (df['category'] == 'NATION'), 'category'] = 'WORLD'
|
92 |
logger.warning('Updated category of articles having Pakistan in title and category=NATION to WORLD')
|
93 |
df.loc[(df['title'].str.contains('Zodiac Sign', case=False)) | (df['title'].str.contains('Horoscope', case=False)), 'category'] = 'ASTROLOGY'
|