The classic Yin-Yang symbol originates in ancient Chinese philosophy. It shows two complementary opposites, Yin and Yang, entangled with each other.

The Yin-Yang symbol makes a perfect 2-D target function for machine learning because it is simple and complex at the same time. The overall shape is simple, with regular and smooth boundaries. However, the two small disks (fish eyes) are exceptions to the simple target function. By changing the radius of the two disks, we may control the difficulty level of learning such exceptions.

The Yin-Yang symbol can present itself in different orientations. For example, the up left symbol has orientation number 1 (defined in the Code below), and Yin-Yang with orientation 0 Yin-Yang with orientation -4 Yin-Yang with orientation -1 are Yin-Yang symbols with orientation 0, -4, and -1. For machine learning purpose, we do not care about the orientations. Just pick one that looks nice.

Basic Information

Artificial, deterministic.

Input features: X and Y coordinates. We usually pick points randomly within distance 1.1R to the origin.

Output: 1 if the point belongs to the Yang (white) class, and -1 if it belongs to the Yin (black) class. For orientation 1, points out of the big disk belong to the Yang class if they are on the left half-space. Signed margin (minimal distance to the boundries, with the same sign as the class label) can be used for regression problems. On the right is a contour plot of the signed margin for the Yin-Yang symbol with orientation 1.


Matlab code yinyang.m calculates the signed margin of given examples. The parameters about the Yin-Yang target function are the radius ratio of the small disks vs. the big disk, the big disk radius (R), and the orientation number. It requires two utility functions, options.m and assert.m.

Past Usage

Interesting Links