Recently Published

custom annotations to describe the clusters
# Add custom annotations to describe the clusters ggplot(hclust.project2D, aes(x = PC1, y = PC2)) + geom_point(aes(shape = cluster_label, color = cluster_label), size = 3) + geom_text(aes(label = country, color = cluster_label), hjust = 0, vjust = 1, size = 3) + geom_polygon(data = hclust.hull, aes(group = cluster, fill = as.factor(cluster)), alpha = 0.4, linetype = 0) + theme_minimal() + labs(title = "Geopolitical Decisions Based on AI Capabilities", x = "Principal Component 1 (AI Capability)", y = "Principal Component 2 (Government Strategy)", color = "Cluster", shape = "Cluster") + scale_fill_manual(values = c("#FF9999", "#99CCFF", "#66CC66"), labels = c("AI Leaders", "Emerging AI Players", "Tech Adopters")) + theme(text = element_text(size = 16)) + annotate("text", x = 5, y = -2, label = "AI Leaders: Advanced AI capabilities, \nForm AI alliances, Lead AI standards", color = "#FF9999", size = 5, hjust = 0) + annotate("text", x = -4, y = 3, label = "Emerging AI Players: Focus on AI regulation, \nBuild partnerships for growth", color = "#99CCFF", size = 5, hjust = 0) + annotate("text", x = -6, y = -5, label = "Tech Adopters: Focus on cybersecurity, \nEnsure digital sovereignty", color = "#66CC66", size = 5, hjust = 0)
clusters with meaningful labels
library(ggplot2) # Plot the clusters with meaningful labels ggplot(hclust.project2D, aes(x = PC1, y = PC2)) + geom_point(aes(shape = cluster_label, color = cluster_label), size = 3) + geom_text(aes(label = country, color = cluster_label), hjust = 0, vjust = 1, size = 3) + geom_polygon(data = hclust.hull, aes(group = cluster, fill = as.factor(cluster)), alpha = 0.4, linetype = 0) + theme_minimal() + labs(title = "Geopolitical Decisions Based on AI Capabilities", x = "Principal Component 1 (AI Capability)", y = "Principal Component 2 (Government Strategy)", color = "Cluster", shape = "Cluster") + scale_fill_manual(values = c("#FF9999", "#99CCFF", "#66CC66"), labels = c("AI Leaders", "Emerging AI Players", "Tech Adopters")) + theme(text = element_text(size = 16))
Project2d
# data prepare for clustering visualization princ <- prcomp(scaled_data) nComp <- 2 project2D <- as.data.frame(predict(princ, newdata=scaled_data)[,1:nComp]) hclust.project2D <- cbind(project2D, cluster=as.factor(groups), country=df$Country) head(hclust.project2D) library('grDevices') find_convex_hull <-function(proj2Ddf,groups) { do.call(rbind, lapply(unique(groups), FUN= function(c){ f<-subset(proj2Ddf,cluster==c); f[chull(f),] } ) ) } hclust.hull <-find_convex_hull(hclust.project2D,groups) library(ggplot2) ggplot(hclust.project2D, aes(x=PC1,y=PC2)) + geom_point(aes(shape=cluster,color=cluster)) + geom_text(aes(label=country,color=cluster),hjust=0,vjust=1, size=3) + geom_polygon(data=hclust.hull, aes(group=cluster,fill=as.factor(cluster)), alpha=0.4, linetype=0) + theme(text=element_text(size=20))
DukeEnergy
TampaElectric
week 5
DOI Test
This is a test to produce DOI coverage statistics of JUOJS
BoxPlot
# Add cluster information to the dataset df$Cluster <- groups # Plot the boxplot ggplot(df, aes(x = as.factor(Cluster), y = AI_Capability_Index, fill = as.factor(Cluster))) + geom_boxplot() + labs(title = "Distribution of AI Capability Index by Cluster", x = "Cluster", y = "AI Capability Index") + theme_minimal()
BarPlot
# Calculate the mean AI_Capability_Index for each cluster and region library(dplyr) cluster_summary <- df %>% mutate(cluster = groups) %>% group_by(cluster, Region) %>% summarise(mean_AICapability = mean(AI_Capability_Index, na.rm = TRUE)) # Plot the bar plot library(ggplot2) ggplot(cluster_summary, aes(x = Region, y = mean_AICapability, fill = as.factor(cluster))) + geom_bar(stat = "identity", position = "dodge") + labs(title = "AI Capability Index by Region and Cluster", x = "Region", y = "Mean AI Capability Index", fill = "Cluster") + theme_minimal()
Assignment 5
Intro to notebook.
Basics.