This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Meuse universal kriging for a large grid | |
| # The grid is enriched with osm data | |
| # CC-BY @vankesteren | |
| # load packages ---- | |
| library(tidyverse) | |
| library(sf) | |
| library(ggspatial) | |
| library(osmdata) | |
| library(gstat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Gierzwaluw (common swift) analysis using osmenrich | |
| # Last edited 2021-02-09 by @vankesteren | |
| # CC-BY ODISSEI SoDa team | |
| # Packages | |
| # Data | |
| library(tidyverse) | |
| library(sf) | |
| library(osmenrich) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rtrunc <- function(rdist, min, max) { | |
| # deal with pipe and also with normal evaluation | |
| # https://github.com/tidyverse/magrittr/issues/115#issuecomment-173894787 | |
| parents <- lapply(sys.frames(), parent.env) | |
| is_magrittr_env <- vapply(parents, identical, logical(1), y = environment(`%>%`)) | |
| if (any(is_magrittr_env)) { | |
| distcall <- get("lhs", sys.frames()[[base::max(which(is_magrittr_env))]]) | |
| } else { | |
| distcall <- substitute(rdist) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(sf) | |
| library(osmdata) | |
| library(osmenrich) | |
| library(patchwork) | |
| # conditional IDW functions | |
| conditional_idw <- function(formula, data, p = 1, max.iter = 100, tol = 1e-10) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(sf) | |
| library(httr) | |
| library(tidyverse) | |
| url <- parse_url("https://geodata.nationaalgeoregister.nl/bag/wfs/v1_1") | |
| postcode_filter <- function(postcode, gebruiksdoel = "woonfunctie") { | |
| sprintf( | |
| "<Filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(deldir) | |
| library(ggplot2) | |
| library(firatheme) | |
| N <- 40 | |
| dat <- matrix(rnorm(N*2), N) | |
| dat <- dat %*% chol(matrix(c(1, 0, 0, 1.5), 2)) %*% chol(solve(cov(dat))) | |
| dat2 <- deldir(dat[,1], dat[,2]) | |
| dat1 <- data.frame(dat) | |
| colnames(dat1) <- c("x1", "y1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # script that outputs a graph | |
| library(tidyverse) | |
| library(firatheme) | |
| wine <- read_delim("https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data", | |
| delim = ",", | |
| col_names = c( | |
| "Cultivar", "Alcohol", "Malic acid", "Ash", "Alcalinity of ash", "Magnesium", | |
| "Total phenols", "Flavanoids", "Nonflavanoid phenols", "Proanthocyanins", | |
| "Color intensity", "Hue", "OD280/OD315", "Proline" | |
| ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Adamopt | |
| # This is a module implementing vanilla Adam (https://arxiv.org/abs/1412.6980). | |
| export Adam, step! | |
| # Struct containing all necessary info | |
| mutable struct Adam | |
| theta::AbstractArray{Float64} # Parameter array | |
| loss::Function # Loss function | |
| grad::Function # Gradient function |