Update app.py
Browse files
app.py
CHANGED
|
@@ -371,26 +371,5 @@ logging.info(f"Prophet Model - MAE: {mae:.4f}")
|
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
-
# Features for promotion prediction
|
| 375 |
-
features = ['caption_length', 'hashtag_count', 'sentiment', 'content_type_encoded', 'media_type_encoded']
|
| 376 |
-
X = solved_df[features]
|
| 377 |
-
y = solved_df['promote']
|
| 378 |
-
|
| 379 |
-
# Split data into training and testing sets
|
| 380 |
-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
| 381 |
-
|
| 382 |
-
# Train a Logistic Regression Model
|
| 383 |
-
promotion_model = LogisticRegression(random_state=42)
|
| 384 |
-
promotion_model.fit(X_train, y_train)
|
| 385 |
-
|
| 386 |
-
# Evaluate the model
|
| 387 |
-
y_pred = promotion_model.predict(X_test)
|
| 388 |
-
accuracy = accuracy_score(y_test, y_pred)
|
| 389 |
-
logging.info(f"Promotion Prediction Model Accuracy: {accuracy:.4f}")
|
| 390 |
-
|
| 391 |
-
# Analyze content type impact
|
| 392 |
-
content_type_impact = solved_df.groupby('content_type')['promote'].mean().sort_values(ascending=False)
|
| 393 |
-
logging.info("Content Type Impact on Promotion:")
|
| 394 |
-
print(content_type_impact)
|
| 395 |
|
| 396 |
logging.info("Analysis complete!")
|
|
|
|
| 371 |
|
| 372 |
|
| 373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
|
| 375 |
logging.info("Analysis complete!")
|