public static void CreateXORExample(out DecisionTree tree, out int[][] inputs, out int[] outputs)
{
inputs = new int[][]
{
new int[] { 1, 0, 0, 1 },
new int[] { 0, 1, 0, 0 },
new int[] { 0, 0, 0, 0 },
new int[] { 1, 1, 0, 0 },
new int[] { 0, 1, 1, 1 },
new int[] { 0, 0, 1, 1 },
new int[] { 1, 0, 1, 1 }
};
outputs = new int[]
{
1, 1, 0, 0, 1, 0, 1
};
DecisionVariable[] attributes =
{
new DecisionVariable("a1", 2),
new DecisionVariable("a2", 2),
new DecisionVariable("a3", 2),
new DecisionVariable("a4", 2)
};
int classCount = 2;
tree = new DecisionTree(attributes, classCount);
ID3Learning id3 = new ID3Learning(tree);
double error = id3.Run(inputs, outputs);
Assert.AreEqual(0, error);
}