{"id":16275786,"url":"https://github.com/dicook/isugg_2020","last_synced_at":"2026-01-21T19:35:33.377Z","repository":{"id":145753068,"uuid":"246740622","full_name":"dicook/ISUGG_2020","owner":"dicook","description":"Material for an informal talk with the ISU Graphics Group 2020","archived":false,"fork":false,"pushed_at":"2020-03-12T05:45:32.000Z","size":16816,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T13:17:47.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dicook.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-12T04:06:57.000Z","updated_at":"2020-03-12T05:45:36.000Z","dependencies_parsed_at":"2023-04-08T10:48:30.060Z","dependency_job_id":null,"html_url":"https://github.com/dicook/ISUGG_2020","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dicook%2FISUGG_2020","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dicook%2FISUGG_2020/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dicook%2FISUGG_2020/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dicook%2FISUGG_2020/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dicook","download_url":"https://codeload.github.com/dicook/ISUGG_2020/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247886384,"owners_count":21012832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T18:36:23.958Z","updated_at":"2026-01-21T19:35:33.372Z","avatar_url":"https://github.com/dicook.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"A slice tour for finding hollowness in high-dimensional data\"\nauthor: \"Ursula Laa, **Di Cook**, German Valencia, Andreas Buja\"\ndate: \"`r format(Sys.time(), '%B %d, %Y')`\"\noutput: github_document\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  echo = TRUE,\n  eval = FALSE\n)\n```\n\n## Tour review\n\nA tour provides a continuous sequence of $d$-dimensional (typically $d=1$ or $2$) projections from $p$-dimensional Euclidean space. It is constructed by combining a method for basis selection with geodesic interpolation between pairs of bases. In a grand tour, the basis selection is random, each new basis is chosen from all possible projections. In a guided tour, the bases are chosen based on an index of interestingness. Different basis selection methods as well as the geodesic interpolation are implemented in the `tourr` package, which also provides several display functions for viewing the tour.\n\n*Let's try it*\n\n```{r}\nlibrary(tidyverse)\nlibrary(tourr)\nlibrary(MASS)\ndata(flea)\nflea_pca \u003c- prcomp(flea[,1:6], scale = TRUE)\nflea_pca$x %\u003e% \n  as_tibble() %\u003e% \n  ggplot(aes(x=PC1, y=PC2)) +\n     geom_point() +\n     theme(aspect.ratio = 1)\nflea_pca$rotation[,1:2]\nbiplot(flea_pca)\nflea_lda \u003c- lda(species~., data=flea)\nflea_ld \u003c- predict(flea_lda, flea)$x %\u003e%\n  as_tibble() %\u003e%\n  mutate(species = flea$species)\nggplot(flea_ld, aes(x=LD1, y=LD2, colour=species)) + \n  geom_point() +\n     theme(aspect.ratio = 1)\nflea_lda$scaling\n# This requires dynamic plotting\nquartz() # on the mac, but on Windows you can either use X11() or nothing, I think\nanimate_xy(flea[, 1:6], axes = \"bottomleft\")\nlibrary(RColorBrewer)\nclrs \u003c- brewer.pal(3, \"Dark2\")\ncol \u003c- clrs[as.numeric(flea$species)]\nanimate_xy(flea[, 1:6], axes = \"bottomleft\", col=col)\n```\n\n## A slice tour\n\n### Some high-dimensional geometric shapes\n\nLet's go for a walk into deep space\n\n- Spheres in 4D\n\n```{r}\nnPt \u003c- 5000\nlibrary(geozoo)\nd1 \u003c- data.frame(sphere.solid.random(4, nPt)$points)\nanimate_xy(d1, axes = \"bottomleft\")\n\nd2 \u003c- data.frame(sphere.hollow(4, nPt)$points)\nanimate_xy(d2, axes = \"bottomleft\")\n```\n\n- Cubes\n\n```{r}\n\nd3 \u003c- cube.solid.random(4)$points[1:nPt,] %\u003e% \n  data.frame() %\u003e%\n  mutate_all(function(x) x-0.5)\nanimate_xy(d3, axes = \"bottomleft\")\n\nd4 \u003c- cube.face(4)$points[1:nPt,] %\u003e% scale(scale = FALSE) %\u003e% \n  data.frame() %\u003e%\n  mutate_all(function(x) x-0.5)\nanimate_xy(d4, axes = \"bottomleft\")\n\n```\n\n- Roman surface\n\n```{r}\nrms \u003c- roman.surface()$points %\u003e%\n  scale() %\u003e% data.frame()\nanimate_xy(rms, axes = \"bottomleft\")\n```\n\n- Torus\n\n```{r}\ntorus3 \u003c- torus(p=3)$points %\u003e%\n  scale() %\u003e% data.frame()\nanimate_xy(torus3, axes = \"bottomleft\")\n\ntorus4 \u003c- torus(p=4)$points %\u003e%\n  scale() %\u003e% data.frame()\nanimate_xy(torus4, axes = \"bottomleft\")\n```\n\n### When projections are not enough\n\n- Is this hollow or solid?\n\n```{r}\nload(\"mystery1.rda\")\nanimate_xy(mystery1, axes = \"bottomleft\")\n```\n\n- Is there anything special about this data?\n\n```{r}\nlibrary(animation)\ndata(pollen)\npollen \u003c- as.matrix(pollen) %\u003e% scale()\nanimate_xy(pollen, axes = \"bottomleft\")\n```\n\n### Slicing procedures\n\n![](slice_illustration.png)\n\n*Let's look at the previous examples using the slice tour*\n\n```{r}\nanimate_slice(mystery1, axes = \"bottomleft\")\nanimate_slice(pollen, axes = \"bottomleft\", half_range=0.5, eps=0.0005)\nanimate_slice(pollen, axes = \"bottomleft\", half_range=0.15, eps=0.0005)\n```\n\n## How can we use this?\n\nLooking at the boundaries induced by a classification model\n\n```{r}\nwine_radial \u003c- read_csv(\"wine-svm-radial.csv\")\nwine_radial \u003c- wine_radial %\u003e% \n  group_by(type) %\u003e%\n  sample_frac(0.5)\n\ncol \u003c- clrs[as.numeric(as.factor(wine_radial$type))]\nwine_radial_scaled \u003c- data.frame(scale(as.matrix(wine_radial[,1:3])))\nanimate_xy(wine_radial_scaled, axes = \"bottomleft\", col=col)\nanimate_slice(wine_radial_scaled, axes = \"bottomleft\", col=col, eps=0.05)\n\nwine_poly \u003c- read_csv(\"wine-svm-poly.csv\")\ncol \u003c- clrs[as.numeric(as.factor(wine_poly$type))]\nwine_poly_scaled \u003c- data.frame(scale(as.matrix(wine_poly[,1:5])))\nanimate_xy(wine_poly_scaled, axes = \"bottomleft\", col=col)\nanimate_slice(wine_poly_scaled, axes = \"bottomleft\", col=col, eps=0.01)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdicook%2Fisugg_2020","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdicook%2Fisugg_2020","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdicook%2Fisugg_2020/lists"}