Today, give a try to Techtonique web app, a tool designed to help you make informed, data-driven decisions using Mathematics, Statistics, Machine Learning, and Data Visualization. Here is a tutorial with audio, video, code, and slides: https://moudiki2.gumroad.com/l/nrhgb
tisthemachinelearner is a (work in progress) lightweight interface to scikit-learn. Here’s an example of use time series forecasting using scikit-learn in conjunction with ahead::dynrmf
.
In [ ]:
%load_ext rpy2.ipython
In [ ]:
%%R
options(repos = c(techtonique = "https://r-packages.techtonique.net",
CRAN = "https://cloud.r-project.org"))
install.packages("ahead")
install.packages("tisthemachinelearner")
install.packages("remotes")
install.packages("doParallel")
install.packages("quantreg")
install.packages("memoise")
install.packages("Mcomp")
install.packages("Tcomp")
install.packages("gam")
install.packages("mboost")
install.packages("https://github.com/carlanetto/M4comp2018/releases/download/0.2.0/M4comp2018_0.2.0.tar.gz",
repos=NULL)
In [81]:
%%R
library(remotes)
library(doParallel)
library(quantreg)
library(memoise)
library(Mcomp)
library(Tcomp)
library(gam)
library(mboost)
library(M4comp2018)
library("ahead")
library("tisthemachinelearner")
In [82]:
%%R
model_list <- tisthemachinelearner::get_model_list()
print(model_list$regressors)
[1] "ARDRegression" "AdaBoostRegressor" [3] "BaggingRegressor" "BayesianRidge" [5] "CCA" "DecisionTreeRegressor" [7] "DummyRegressor" "ElasticNet" [9] "ElasticNetCV" "ExtraTreeRegressor" [11] "ExtraTreesRegressor" "GammaRegressor" [13] "GaussianProcessRegressor" "GradientBoostingRegressor" [15] "HistGradientBoostingRegressor" "HuberRegressor" [17] "IsotonicRegression" "KNeighborsRegressor" [19] "KernelRidge" "Lars" [21] "LarsCV" "Lasso" [23] "LassoCV" "LassoLars" [25] "LassoLarsCV" "LassoLarsIC" [27] "LinearRegression" "LinearSVR" [29] "MLPRegressor" "MultiOutputRegressor" [31] "MultiTaskElasticNet" "MultiTaskElasticNetCV" [33] "MultiTaskLasso" "MultiTaskLassoCV" [35] "NuSVR" "OrthogonalMatchingPursuit" [37] "OrthogonalMatchingPursuitCV" "PLSCanonical" [39] "PLSRegression" "PassiveAggressiveRegressor" [41] "PoissonRegressor" "QuantileRegressor" [43] "RANSACRegressor" "RadiusNeighborsRegressor" [45] "RandomForestRegressor" "RegressorChain" [47] "Ridge" "RidgeCV" [49] "SGDRegressor" "SVR" [51] "StackingRegressor" "TheilSenRegressor" [53] "TransformedTargetRegressor" "TweedieRegressor" [55] "VotingRegressor"
In [ ]:
%%R
i <- 1
j <- 1
results <- list()
n <- length(model_list$regressors)
list_names <- list()
pb <- utils::txtProgressBar(min=1, max=n, style=3)
for (j in 1:n) {
y <- USAccDeaths
h <- 15L
model <- model_list$regressors[[j]]
print(model)
foo <- function(x, y) tisthemachinelearner::regressor(x=x, y=y, model_name=model)
fcastf <- function(y, h) ahead::dynrmf(y=y, h=h, fit_func=foo, predict_func=predict)
fcastf2 <- function(y, h) ahead::conformalize(FUN=fcastf, y=y, h=h)
res <- try(fcastf2(y=y, h=h), silent=TRUE)
if (!inherits(res, "try-error"))
{
print(res)
results[[i]] <- res
list_names[[i]] <- model
i <- i + 1
} else {
next
}
utils::setTxtProgressBar(pb, j)
j <- j + 1
}
close(pb)
names(results) <- list_names
In [79]:
%%R
print(length(results))
[1] 39
In [80]:
%%R
par(mfrow=c(2, 2))
plot(results[[1]])
plot(results[[2]])
plot(results[[3]])
plot(results[[4]])
Comments powered by Talkyard.