[ top | up ]

Continuous XOR Benchmark Problem

Usage

mlbench.xor(n, d=2)

Arguments

n number of patterns to create
d dimension of the XOR problem

Description

The inputs of the XOR problem are uniformly distributed on the d-dimensional cube with corners {+-1}. Each pair of opposite corners form one class, hence the total number of classes is 2^(d-1)

Value

Returns a list with components
x input values
class factor vector of length n with target classes

Examples

# 2d example
p<-mlbench.xor(300,2)
plot(p$x,col=as.numeric(p$class))
#
# 3d example
p<-mlbench.xor(300,3)
pairs(p$x,col=as.numeric(p$class))