Library: | xclust |
See also: | cartsplitclass cartsplitregr |
Quantlet: | cartpredict | |
Description: | classifies the data in accordance with constructed Tree. |
Usage: | ClassVector = cartpredict(Tree,Data) | |
Input: | ||
Tree | Complex tree structure, list of different parameters Tree can be generated using CartClassificationSplit or CartRegressionSplit commands | |
Data | new observations to classify [f x k], should meet dimensions of Learning Sample | |
Output: | ||
ClassVector | vector of classes / response value with dimensions [f x 1]. |
library("xclust"); x1 = #(0.898473738, 0.852630806, 0.539114276, 0.241251175, 0.476125641, 0.284315731, 0.0181318590) x2 = #(0.255756912, 0.303028656, 0.146633917, 0.121365982, 0.4111506, 0.97609203, 0.514180304) x = x1~x2; y = #(1, 1, 1, 0, 1, 2, 1) tr = cartsplitclass(x,y,0,1); newdata = #(1, -2)~#(2, -3) classvector = cartpredict(tr, newdata) classvector
Contents of classvector [1,] 2 [2,] 0