Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Last active February 25, 2021 00:27
Show Gist options
  • Save MichaelChirico/1aeec416cf09d21e191fd32310ed5271 to your computer and use it in GitHub Desktop.
Save MichaelChirico/1aeec416cf09d21e191fd32310ed5271 to your computer and use it in GitHub Desktop.
Get an R^2 of 1
library(data.table)
DT = fread("~/Downloads/spotifyclass.csv")
# add new columns. they're great predictors!
DT[ , paste0("V", 1:nrow(DT)) := replicate(.N, rnorm(.N), simplify = FALSE)]
summary(lm(DT$target ~ ., data = DT[ , .SD, .SDcols = patterns("^V")]))$r.squared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment