Skip to content

Instantly share code, notes, and snippets.

@kevin-m-kent
kevin-m-kent / latent_semantic_analysis_svd.R
Created August 9, 2024 16:28
Latent Semantic Analysis with SVD
# Goal: to explore document and term loadings with SVD, Latent Semantic Analysis
# Following the procedures outlined in
# https://sites.socsci.uci.edu/~lpearl/courses/readings/Evangelopoulos2013_LatentSemAnalysis.pdf
library(janeaustenr)
library(dplyr)
library(tidyr)
library(tidytext)
library(stringr)
library(httr2)
library(purrr)
endpoint <- "https://models.inference.ai.azure.com"
token <- Sys.getenv("github_token")
model <- "gpt-4o-mini"
system <- list(
"role" = "system",
"content" = "You are a helpful assistant."
library(tibble)
library(dplyr)
events_tb <- tibble(
id = 1:5,
val1 = rnorm(5)
)
another_info_tb <- tibble(
FROM ubuntu:18.04
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install --yes \
build-essential \
openjdk-8-jdk \
iproute2 \
bash \
sudo \