xvalSpec            package:MLInterfaces            R Documentation

_c_o_n_t_a_i_n_e_r _f_o_r _i_n_f_o_r_m_a_t_i_o_n _s_p_e_c_i_f_y_i_n_g _a _c_r_o_s_s-_v_a_l_i_d_a_t_e_d
_m_a_c_h_i_n_e _l_e_a_r_n_i_n_g _e_x_e_r_c_i_s_e

_D_e_s_c_r_i_p_t_i_o_n:

     container for information specifying a cross-validated machine
     learning exercise

_U_s_a_g_e:

     xvalSpec( type, niter=0, partitionFunc= function(data, classLab, iternum ) {
                                     (1:nrow(data))[-iternum] },
                              fsFun = function(formula, data) formula )

_A_r_g_u_m_e_n_t_s:

    type: a string, "LOO" indicating leave-one-out cross-validation, or
          "LOG" indicating leave-out-group, or "NOTEST", indicating the
          entire dataset is used in a single training run.

   niter: numeric specification of the number of cross-validation
          iterations to use.  Ignored if 'type' is '"LOO"'.

partitionFunc: function, with parameters data (bound to data.frame),
          clab (bound to character string), iternum (bound to numeric
          index into sequence of 1:'niter').  This function's job is to
          provide the indices of training cases for each
          cross-validation step.  An example is 'balKfold.xvspec',
          which computes a series of indices that are approximately
          balanced with respect to frequency of outcome types.

   fsFun: function, with parameters formula, data.  The function must
          return a formula suitable for defining a model on the basis
          of the main input data.  A candidate fsFun  is given in
          example for fsHistory function.

_D_e_t_a_i_l_s:

     If 'type == "LOO"', no other parameters are inspected. If 'type ==
     "LOG"' a value for 'partitionFunc' must be supplied.  We recommend
     using 'balKfold.xvspec(K)'.  The values of 'niter' and 'K' in this
     usage must be the same. This redundancy will be removed in a
     future upgrade.

_V_a_l_u_e:

     An instance of 'classifierOutput', with a special structure.  The
     'RObject' return slot is populated with a list of 'niter'
     cross-validation results.  Each element of this list is itself a
     list with two elements: 'test.idx' (the indices of the test set
     for the associated cross-validation  iteration, and 'mlans', the
     'classifierOutput' generated at each iteration.  Thus there are
     'classifierOutput' instances nested within the main
     'classifierOutput' returned when a 'xvalSpec' is used.

_A_u_t_h_o_r(_s):

     Vince Carey <stvjc@channing.harvard.edu>

_E_x_a_m_p_l_e_s:

     data(crabs)
     set.seed(1234)
     #
     # demonstrate cross validation
     #
     nn1cv = MLearn(sp~CW+RW, data=crabs, nnetI, xvalSpec("LOG",
        5, balKfold.xvspec(5)), size=3, decay=.01 )
     nn1cv
     confuMat(nn1cv)
     names(RObject(nn1cv)[[1]])
     RObject(RObject(nn1cv)[[1]]$mlans)

