tidymodels / learntidymodels Goto Github PK
View Code? Open in Web Editor NEWLearn tidymodels with interactive learnr primers
License: Other
Learn tidymodels with interactive learnr primers
License: Other
The master
branch of this repository will soon be renamed to main
, as part of a coordinated change across several GitHub organizations (including, but not limited to: tidyverse, r-lib, tidymodels, and sol-eng). We anticipate this will happen by the end of September 2021.
That will be preceded by a release of the usethis package, which will gain some functionality around detecting and adapting to a renamed default branch. There will also be a blog post at the time of this master
--> main
change.
The purpose of this issue is to:
message id: euphoric_snowdog
I don't believe that the munging we have here in the learntidymodels package to order bars works anymore:
library(learntidymodels)
#> Loading required package: tidyverse
#> Loading required package: tidymodels
#> Registered S3 method overwritten by 'tune':
#> method from
#> required_pkgs.model_spec parsnip
library(tidymodels)
library(ggplot2)
data("cells", package = "modeldata")
cell_pca <-
recipe(class ~ ., data = cells %>% dplyr::select(-case)) %>%
step_center(all_predictors()) %>%
step_scale(all_predictors()) %>%
step_pca(all_predictors())
cell_pca <- prep(cell_pca)
plot_top_loadings(cell_pca, grepl("ch_1", terms) & component_number <= 4, n = 10)
Created on 2021-08-25 by the reprex package (v2.0.1)
I do have different versions of this type of functionality in tidytext, if we want to use that instead, but tidytext seems like a heavy and ridiculous dependency for this.
Hi!
I just wanted to contribute with this simple function to extract explained variance
extract_explained_variace <- function(pca_recipe, n_comp = NULL) {
if (!tune::is_recipe(pca_recipe)) {
stop("Input must be a recipe.")
} else {
pca_result <- pca_recipe %>%
prep() %>%
pluck("steps", 2, "res", "sdev") %>%
tibble(sdev = .) %>%
mutate(var_expl = round((sdev^2 / sum(sdev^2)) * 100, 3), .keep = "unused") %>%
rownames_to_column("PC") %>%
mutate(PC = paste0("PC", row_number()),
PC = factor(PC, levels = unique(PC)))
if (!is.null(n_comp)) {
pca_result <- pca_result %>%
slice(1:n_comp)
}
return(pca_result)
}
}
Thanks a lot for the amazing work done with tidymodels!
Best wishes!
When I run learnr::run_tutorial("pca_recipes", package = "learntidymodels")
, I get the error:
Quitting from lines 13-80 (pca_recipes.Rmd)
Error: package or namespace load failed for 'gradethis':
.onLoad failed in loadNamespace() for 'gradethis', details:
call: (function (exercise.cap = "Code", exercise.eval = FALSE, exercise.timelimit = 30,
error: unused argument (exercise.error.check.code = "gradethis_error_checker()")
R itself is 4.0.4
{learnr} is 0.10.1
{learntidymodels} is 0.0.0.9001
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.