2023-12-06

Recap Project Proposal

  • Develop a predictive model to forecast the LIKES of Hugging Face API models.
  • Focus on predicting the number of “LIKES” as a measure of model success.
  • Utilize H2O deep learning technique to build a predictive model.
  • Explore and incorporate relevant parameters and attributes affecting model ‘LIKES’.

Peer Comments Summary

  • Overall peer comments were based on incorporating different aspects of why users ‘like’ the content
  • Elaborate on the methodology to determine the significance of model parameters and attributes in influencing user engagement and “LIKES.
  • We have used the deep learning techniques to forecast the number of likes for the Hugging Face API models.

Hugging Face Model Dataset

knitr::kable(head(new_df,10)) 
model_id private downloads created_At pipeline_tag transformers endpoints_compatible pytorch autotrain_compatible license.apache.2.0 bert text.generation.inference tensorboard text.classification en jax generated_from_trainer text.generation text2text.generation gpt2 has_space model.index tf automatic.speech.recognition fill.mask likes
alireza7/ARMAN-SS-100-persian-base-wiki-summary 0 3 2022-03-02 23:29:05 text2text-generation 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1
allenai/t5-small-squad11 0 3 2022-03-02 23:29:05 text2text-generation 1 1 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 0 1
allenai/wmt16-en-de-dist-6-1 0 3 2022-03-02 23:29:05 translation 1 1 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1
amine/bert-base-5lang-cased 0 3 2022-03-02 23:29:05 fill-mask 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 1 1
anegi/autonlp-dialogue-summariztion-583416409 0 3 2022-03-02 23:29:05 text2text-generation 1 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1
arampacha/DialoGPT-medium-simpsons 0 3 2022-03-02 23:29:05 conversational 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1
arampacha/wav2vec2-large-xlsr-ukrainian 0 3 2022-03-02 23:29:05 automatic-speech-recognition 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1
arampacha/wav2vec2-xls-r-1b-hy 0 3 2022-03-02 23:29:05 automatic-speech-recognition 1 1 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1
atkh6673/DialoGPT-small-trump 0 3 2022-03-02 23:29:05 conversational 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1
ayush19/rick-sanchez 0 3 2022-03-02 23:29:05 conversational 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1

Data Summary

  • The Hugging Face API will be the major data source. We will be making an API call to fetch data from the Hugging Face API, process it, and perform some exploratory data analysis.
  • The dataset is structured as a dataframe which consists of more than 20k records.
  • Prepare data for training and testing using recipes and h2o functions.

Results from Data Exploration

Below are some key aspects of the data exploration:

  • Data Cleaning: Filter out rows with zero likes and handle missing values in certain columns.
  • Tag Extraction: Unnests the “tags” column, creating a new dataframe with individual tags as columns.
  • Summary Statistics: Various summary statistics and visualizations are generated, including tag counts and likes distribution.

Example data and Predictors

  • The data includes information about Hugging Face API models, such as model ID, downloads, creation date, pipeline tag, and various tags.
  • The processed data is split into predictors (X) and the target variable (Y), where the goal is to predict the number of likes.
  • Example predictors:
    • modelId
    • private
    • downloads
    • createdAt
    • pipeline_tag
    • Various tags (e.g., transformers, endpoints_compatible, pytorch, etc.)
  • Target variable:
    • likes
  • The model is trained using H2O’s deep learning algorithm on this structured data.

Analytics Plan

  • Conduct exploratory analysis on the cleaned data.
  • Analyze tag counts and visualize the top tags across models.
  • Calculate and visualize the correlation matrix for numerical columns.
  • We have used ggplot2 to visualize the data in R to illustrate the insights.
  • Create bar plots for tag frequencies and pipeline tags. Develop an interactive plot using plotly to explore the relationship between likes and downloads.
  • Train a deep learning model (h2o.deeplearning) to predict the ‘likes’ variable. Save the trained model and evaluate its summary.

Exploratory Data Analysis

# Create a bar plot
ggplot(tags_df, aes(x = reorder(Tag, -Frequency), y = Frequency, fill = Tag)) +
  geom_bar(stat = "identity") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  labs(title = "Top 20 Tags across Models", x = "Tag", y = "Count")

ggplot(top_20_tags, aes(x = reorder(pipeline_tag, -n), y = n)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black") +
  labs(title = "Top 20 Pipeline Tags", x = "Pipeline Tags", y = "Count") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Exploratory Data Analysis (Cont..)

ggplot(access_counts_df, aes(x = "", y = Freq, fill = Var1)) +
  geom_bar(stat = "identity", width = 1, color = "white") +
  geom_text(aes(label = ifelse(percentage >= threshold, paste0(round(percentage, 1), "%"), "")), 
            position = position_stack(vjust = 0.5), color = "black", size = 7) +
  coord_polar("y") +
  labs(title = "Public Vs Private Repository") +
  scale_fill_manual(values = c("Public" = alpha("blue" , 0.5), "Private" = "red")) +
  theme_void()

Exploratory Data Analysis Cntd..

square_width = 5
corrplot(correlation_matrix, method = "number" , tl.cex = 0.7 , col = my_colors , addrect = 2, 
         number.cex = 0.9 )

Exploratory Data Analysis cont

# Print the interactive plot
p

XAI

plot(h2o_exp_pdp_likes, geom = "profiles") +
  ggtitle("Breakdown Plot for New Observation")

ML Procedure Summary

  • We have used H2O model of Random Forest Algorithm which helps in fast processing of likes prediction.
  • The model is evaluated on a validation set, and training progress is monitored. A summary of the trained model’s performance is generated.
  • A new observation is prepared in the same format as the training data. The trained model is then used to predict the number of likes for this new observation.

Key Takeaways

  • Distribution of likes, tag counts, and other summary statistics are visualized.
  • Insights into the relationships between predictors and likes are explored.
  • Various visualization techniques are employed to gain insights into the data and model behavior.
  • The code integrates H2O for machine learning and DALEX for model interpretation.
  • The use of interactive plots with plotly enhances the visual representation of data and model results.
  • Showcases a complete data science pipeline, including data fetching, cleaning, exploratory data analysis, machine learning model training, and explanatory data analysis.