!7 lib 1010869 // decision trees import dt.DecisionTree; p { DecisionTree tree = makeOutlookTree(); } static DecisionTree makeOutlookTree() { try { // example data from http://www.cise.ufl.edu/~ddd/cap6635/Fall-97/Short-papers/2.htm return new DecisionTree().setAttributes(new String[]{"Outlook", "Temperature", "Humidity", "Wind"}) .addExample( new String[]{"Sunny", "Hot", "High", "Weak"}, false) .addExample( new String[]{"Sunny", "Hot", "High", "Strong"}, false) .addExample( new String[]{"Overcast", "Hot", "High", "Weak"}, true) .addExample( new String[]{"Rain", "Mild", "High", "Weak"}, true) .addExample( new String[]{"Rain", "Cool", "Normal", "Weak"}, true) .addExample( new String[]{"Rain", "Cool", "Normal", "Strong"}, false) .addExample( new String[]{"Overcast", "Cool", "Normal", "Strong"}, true) .addExample( new String[]{"Sunny", "Mild", "High", "Weak"}, false) .addExample( new String[]{"Sunny", "Cool", "Normal", "Weak"}, true) .addExample( new String[]{"Rain", "Mild", "Normal", "Weak"}, true) .addExample( new String[]{"Sunny", "Mild", "Normal", "Strong"}, true) .addExample( new String[]{"Overcast", "Mild", "High", "Strong"}, true) .addExample( new String[]{"Overcast", "Hot", "Normal", "Weak"}, true) .addExample( new String[]{"Rain", "Mild", "High", "Strong"}, false); } catch (UnknownDecisionException e) { throw rethrow(e); } }