GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MusaMisto/InstagramInfluencersAnalysis-CS412: This repository contains the implementation and documentation for the CS412 course project, focusing on machine learning tasks for Instagram influencer analysis. It includes code, scripts, and methodologies for multi-class classification of influencer categories and regression analysis of content popularity.

BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
notebooks
notebooks
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Social Media User Classification and Regression

Authors

  • Musa Misto (29996)
  • Neda Mohamed (33016)

Introduction

This project focuses on leveraging social media data to:

  1. Classification Task: Categorize users into predefined labels based on profile information and posts.
  2. Regression Task: Predict like_count from user metadata and content.

The primary objectives include handling imbalanced datasets, extracting meaningful features, and building robust machine learning pipelines for both tasks.


Dataset Overview

The dataset consists of two primary components:

  1. User Profiles: Metadata such as username, biography, follower_count, post_count, and engagement_rate.
  2. Posts: Textual content generated by users.

Dataset Statistics

  • Number of Users:
    • Training: 2741 users.
    • Testing: 2674 users.
  • Target Variables:
    • Classification: Categories such as food, tech, and sports.
    • Regression: Continuous variables like follower_count or engagement_rate.

Methodology

1. Data Preprocessing

  • Text Preprocessing:
    • Tokenization and removal of Turkish stop words.
    • Vectorization using TF-IDF to convert text data into numerical features.
  • Numerical Features:
    • Normalized attributes like follower_count and post_count using MinMaxScaler.
  • Categorical Features:
    • Encoded using LabelEncoder for classification.

2. Feature Engineering

Feature engineering was a critical step in this project, where we transformed raw data into meaningful features to improve model performance for both classification and regression tasks. The following techniques and features were implemented:

Text Features

  1. TF-IDF Vectorization:

    • Text data from user posts and biographies was vectorized using Term Frequency-Inverse Document Frequency (TF-IDF).
    • This technique emphasized unique and important words while down-weighting common words, providing a robust representation of textual data.
    • Separate TF-IDF models were trained for:
      • User biographies: Provided insights into user interests and focus areas.
      • User posts: Captured the content and themes of user-generated content.
  2. Custom Text Features:

    • Extracted word counts and character counts from biographies and posts to represent the text's verbosity and complexity.
    • Calculated the percentage of stop words to identify the overall structure of user content.
  3. Language-Specific Features:

    • Turkish-specific stop words were removed to focus on meaningful content.
    • Tokenization and case normalization were applied to ensure consistency.

Numerical Features

  1. Profile Metadata:

    • Follower Count: Represents a user’s influence.
    • Post Count: Indicates activity level on the platform.
    • Engagement Rate: Calculated as the ratio of likes and comments to followers, highlighting interaction levels.
    • These features were normalized using MinMaxScaler to prevent scale-related bias in model training.
  2. Derived Features:

    • Followers-to-Posts Ratio: A proxy for engagement or content impact per post.
    • Log-Transformed Follower Count: Applied logarithmic transformation to handle skewness in follower distribution, improving regression model stability.
    • Biographical Indicators: Identified specific phrases or keywords in biographies (e.g., "influencer," "business") to infer user category.

Categorical Features

  1. User Type Encoding:
    • Features like is_business_account and is_private were one-hot encoded to indicate account type.
  2. Profile Categories:
    • The categorical labels for classification (e.g., food, tech, sports) were encoded using LabelEncoder for model compatibility.

Interaction Features

  1. Text and Numeric Feature Interaction:
    • Integrated text-based features (e.g., TF-IDF vectors) with metadata features like follower_count to identify correlations between content themes and user influence.
    • For instance, users posting about "technology" with high engagement rates were more likely to belong to the tech category.
  2. Cross-Derived Features:
    • Created composite features like follower_growth_rate (using historical data) to predict future engagement trends.

Feature Selection

  1. Correlation Analysis:
    • Assessed feature correlations to avoid redundancy and improve computational efficiency.
    • Retained highly predictive features while discarding those with low information gain.
  2. Feature Importance:
    • Used tree-based models like Random Forest and XGBoost to compute feature importance scores, guiding iterative feature selection and refinement.

By combining text-based, numerical, and interaction features, this feature engineering process significantly enhanced the performance of classification and regression models, enabling them to capture both semantic and quantitative aspects of the data.


3. Handling Data Imbalance

For the classification task:

  • SMOTE: Synthetic Minority Oversampling Technique generated synthetic samples for underrepresented categories.
  • SMOTETomek: Enhanced the dataset by removing overlapping samples.

4. Model Training

Classification Task

Several models were evaluated for user classification:

  1. Baseline Models:
    • Logistic Regression.
    • Naïve Bayes.
  2. Advanced Models:
    • Random Forest.
    • Gradient Boosting.
    • XGBoost.
    • LightGBM.
  3. Voting Classifier:
    • Combined predictions from multiple models for improved accuracy.

Pipeline Setup:

  • Integrated feature preprocessing, data resampling (SMOTE/SMOTETomek), and classification seamlessly.

Regression Task

The regression models aimed to predict numerical targets like follower_count:

  1. Baseline Model:
    • Linear Regression.
  2. Advanced Models:
    • Random Forest Regressor.
    • Gradient Boosting Regressor.
    • XGBoost Regressor.
    • LightGBM Regressor.

Pipeline Setup:

  • Feature scaling, transformation, and model training were combined into a streamlined pipeline.

Hyperparameter Tuning

  • GridSearchCV was used to optimize hyperparameters for all models.

Results and Analysis

Classification Task

  • Evaluation Metrics:
    • Accuracy, Precision, Recall, and F1-Score were used to assess performance.
  • Best Model: LightGBM and XGBoost achieved the highest scores across all metrics.
  • Imbalance Handling: SMOTE and SMOTETomek significantly improved recall for minority classes.
  • Validation Accuracy: 0.683

Regression Task

  • Evaluation Metrics:
    • Mean Absolute Error (MAE).
    • Root Mean Squared Error (RMSE).
    • (R^2)-score.
  • Best Model: LightGBM Regressor consistently outperformed other models, achieving the lowest RMSE and highest (R^2)-score.
  • Insights:
    • Non-linear models like Gradient Boosting and XGBoost performed better than Linear Regression due to their ability to capture complex patterns in the data.
  • Validation Log MSE: 0.1359

Visualizations

  • Classification:
    • Bar charts visualizing category distributions pre- and post-resampling.
    • Confusion matrices to identify common misclassifications.
  • Regression:
    • Scatter plots comparing actual vs. predicted values.
    • Residual plots to assess model fit and variance.

Conclusion

Key Insights

  1. Classification:
    • Advanced tree-based ensemble models excelled in handling imbalanced datasets.
    • SMOTE/SMOTETomek played a crucial role in improving minority class performance.
  2. Regression:
    • Non-linear regression models like LightGBM and XGBoost provided superior performance compared to Linear Regression.
    • Proper feature scaling and transformation significantly impacted results.
  3. Feature Engineering:
    • Text-based features (e.g., TF-IDF vectors) were crucial for both tasks.
    • Metadata attributes enriched predictive power for regression.

About

This repository contains the implementation and documentation for the CS412 course project, focusing on machine learning tasks for Instagram influencer analysis. It includes code, scripts, and methodologies for multi-class classification of influencer categories and regression analysis of content popularity.

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.