Skip to content

Instantly share code, notes, and snippets.

View thengl's full-sized avatar
😎

Tomislav Hengl thengl

😎
View GitHub Profile
library(mlr)
## Synthetic data ----
set.seed(200)
n = 100
x <- 1:n
y <- x + rnorm(n = 50, mean = 15, sd = 15)
dat <- data.frame(x,y)
## newdata:
newdata <- data.frame(
## Synthetic data ----
set.seed(200)
n = 100
x <- 1:n
y <- x + rnorm(n = 50, mean = 15, sd = 15)
## Synthetic linear model ----
m0 <- lm(y ~ x)
summary(m0)
# Residuals:
@thengl
thengl / extrapolation_ensemble_ML.R
Last active May 22, 2023 12:18
Using Machine Learning to help decrease over-fitting and extrapolation problems in regression modeling
## original script: https://gist.github.com/dylanbeaudette/b386f0008133167f518960a113283a0d#file-help-this-poor-rf-model-r
## discussion: https://twitter.com/DylanBeaudette/status/1410666900581851138
## by: tom.hengl@opengeohub.org
library(rpart)
library(rms)
library(ranger)
library(kernlab)
library(mboost)
library(landmap)
@thengl
thengl / help-this-poor-RF-model.R
Last active July 5, 2021 10:30 — forked from dylanbeaudette/help-this-poor-RF-model.R
Ensemble Machine Learning showing how to combine models with applicable structures and non-linear decision trees, without under-estimating errors / producing artifacts
## orignal script: https://gist.github.com/dylanbeaudette/b386f0008133167f518960a113283a0d#file-help-this-poor-rf-model-r
## discussion: https://twitter.com/DylanBeaudette/status/1410666900581851138
library(randomForest)
library(ranger)
library(rpart)
library(rms)
library(mlr)
library(forestError)
rmse <- function(a, b) {