Learn R Programming

⚠️There's a newer version (0.2.2) of this package.Take me there.

TestFunctions

Why should I use it?

This R package provides functions for various surfaces that can be used for testing of models, algorithms, etc. For example, if you want to compare how well a neural network does compared to a random forest, you can take data from one of these test functions to train and test them.

How do I use it?

Each of the test functions is called like any other function. The first argument, x, should be a vector representing one point or a matrix that has points in its rows. This can cause problems if you are using a 1-dimensional function and pass in a vector of values. Instead you should pass them in as a matrix with a single column, or vectorize the function.

set.seed(0)
library(TestFunctions)
branin(runif(2))
#> [1] 9.476405
branin(matrix(runif(20), ncol=2))
#>  [1]  24.119600  71.180268  18.374071   9.839029  36.607437  72.884496
#>  [7] 196.302169  25.185022  13.059216  27.129463
ContourFunctions::cf(banana)

How do I get it?

Install it like any other package with install.packages.

install.packages("TestFunctions")

# Or the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("CollinErickson/TestFunctions")

Copy Link

Version

Install

install.packages('TestFunctions')

Monthly Downloads

298

Version

0.2.1

License

GPL-3

Maintainer

Collin Erickson

Last Published

January 21st, 2024

Functions in TestFunctions (0.2.1)

TF_hartmann

TF_hartmann: hartmann function for evaluating a single point.
TF_steelcolumnstress

TF_steelcolumnstress: steelcolumnstress function for evaluating a single point.
TF_bananatimesgramacy2Dexp

TF_bananatimesgramacy2Dexp: bananatimesgramacy2Dexp function for evaluating a single point.
add_null_dims

add_null_dims: Add null dimensions to another function. Allows you to pass in input data with any number of dimensions and it will only keep the first nactive.
TF_moon_high

TF_moon_high: Moon (2010) high-dimensional function for evaluating a single point.
TF_rastrigin

TF_rastrigin: Rastrigin function for evaluating a single point.
add_zoom

add_zoom: Zoom in on region of another function. Allows you to easily change an existing function so that [0,1]^n refers to a subregion of the original function
TF_robotarm

TF_robotarm: Robot arm function for evaluating a single point.
TF_linkletter_nosignal

TF_linkletter_nosignal: Linkletter (2006) no signal function for evaluating a single point.
TF_michalewicz

TF_michalewicz: Michalewicz function for evaluating a single point.
TF_gramacy2Dexp3hole

TF_gramacy2Dexp3hole: gramacy2Dexp3hole function for evaluating a single point.
TF_logistic

TF_logistic: logistic function for evaluating a single point.
add_noise

add_noise: Adds noise to any function
add_linear_terms

add_linear_terms: Add linear terms to another function. Allows you to easily change an existing function to include linear terms.
TF_beale

TF_beale: Beale function for evaluating a single point.
TF_logistic15

TF_logistic15: logistic15 function for evaluating a single point. Same as logistic except adjusted to be reasonable from 0 to 1.
TF_morris

TF_morris: morris function for evaluating a single point.
TF_logistic_plateau

TF_logistic_plateau: logistic_plateau function for evaluating a single point.
funcprofile

Profile a function
TF_welch

TF_welch: Welch function for evaluating a single point.
TF_vertigrad_grad

TF_vertigrad_grad: vertigrad_grad function for evaluating a single point.
TF_levytilt

TF_levytilt: Levy function with a tilt for evaluating a single point.
nsin

Wave functions
standard_test_func

Create a standard test function.
TF_levy

TF_levy: Levy function for evaluating a single point.
subtractlm

Subtract linear model from a function
TF_vertigrad

TF_vertigrad: vertigrad function for evaluating a single point.
TF_quad_peaks

TF_quad_peaks: quad_peaks function for evaluating a single point.
TF_quad_peaks_slant

TF_quad_peaks_slant: quad_peaks_slant function for evaluating a single point.
TF_piston

TF_piston: Piston simulation function for evaluating a single point.
bananagramacy2Dexp

bananagramacy2Dexp: bananagramacy2Dexp function 6 dimensional function. First two dimensions are banana function, next two are the gramacy2Dexp function, last two are null dimensions
TF_winkel

TF_winkel: winkel function for evaluating a single point.
test_func_applyMO

General function for evaluating a test function with multivariate output
TF_wingweight

TF_wingweight: Wing weight function for evaluating a single point.
numGrad

Create function calculating the numerical gradient
numHessian

Create function calculating the numerical hessian
TF_GoldsteinPriceLog

TF_GoldsteinPrice: Goldstein Price function for evaluating a single point on a log scale, normalized to have mean 0 and variance 1.
TF_branin

Base test function.
TF_gramacy6D

TF_gramacy6D: gramacy6D function for evaluating a single point.
TF_RoosArnold

TF_RoosArnold: Roos & Arnold (1963) function for evaluating a single point.
TF_griewank

TF_griewank: Griewank function for evaluating a single point.
TF_hump

TF_hump: Hump function for evaluating a single point.
TF_Gfunction

TF_Gfunction: G-function for evaluating a single point.
TF_SWNExpCos

TF_SWNExpCos: SWNExpCos function for evaluating a single point.
TF_ackley

TF_ackley: Ackley function for evaluating a single point.
TF_bananagramacy2Dexp

TF_bananagramacy2Dexp: bananagramacy2Dexp function for evaluating a single point.
TF_GoldsteinPrice

TF_GoldsteinPrice: Goldstein Price function for evaluating a single point
RFF

Evaluate an RFF (random wave function) at given input
TF_gramacy2Dexp

TF_gramacy2Dexp: gramacy2Dexp function for evaluating a single point.
RFF_get

Create a new RFF function
TF_detpep8d

TF_detpep8d: detpep8d function for evaluating a single point.
TF_easom

TF_easom: Easom function for evaluating a single point.
TF_chengsandu

TF_chengsandu: chengsandu function for evaluating a single point.
TF_beambending

TF_beambending: beambending function for evaluating a single point.