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

292

Version

0.2.0

License

GPL-3

Maintainer

Collin Erickson

Last Published

May 9th, 2017

Functions in TestFunctions (0.2.0)

TF_beale

TF_beale: Beale function for evaluating a single point.
TF_detpep8d

TF_detpep8d: detpep8d function for evaluating a single point.
TF_welch

TF_welch: Welch function for evaluating a single point.
TF_wingweight

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

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

TF_ackley: Ackley function for evaluating a single point.
TF_hartmann

TF_hartmann: hartmann function for evaluating a single point.
TF_hump

TF_hump: Hump function for evaluating a single point.
TF_rastrigin

TF_rastrigin: Rastrigin function for evaluating a single point.
TF_robotarm

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

TF_morris: morris function for evaluating a single point.
TF_piston

TF_piston: Piston simulation 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.
branin

Test function.
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_michalewicz

TF_michalewicz: Michalewicz function for evaluating a single point.
TF_Gfunction

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

TF_GoldsteinPrice: Goldstein Price function for evaluating a single point
TF_easom

TF_easom: Easom function for evaluating a single point.
TF_griewank

TF_griewank: Griewank function for evaluating a single point.
RFF

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

Create a new RFF function
TF_levy

TF_levy: Levy function for evaluating a single point.
TF_linkletter_nosignal

TF_linkletter_nosignal: Linkletter (2006) no signal 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.
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
nsin

Wave functions
add_linear_terms

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

add_noise: Adds noise to any function
numHessian

Create function calculating the numerical hessian
standard_test_func

Create a standard test function.
numGrad

Create function calculating the numerical gradient
TF_moon_high

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