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)

