Evaluate for validation data. Parameters ---------- feval : callable or None, optional (default=None) Customized evaluation function. Should accept two parameters: preds, valid_data, and return (eval_name, eval_result, is_higher_better) or
(self, feval=None)
| 2194 | return self.__inner_eval(self._train_data_name, 0, feval) |
| 2195 | |
| 2196 | def eval_valid(self, feval=None): |
| 2197 | """Evaluate for validation data. |
| 2198 | |
| 2199 | Parameters |
| 2200 | ---------- |
| 2201 | feval : callable or None, optional (default=None) |
| 2202 | Customized evaluation function. |
| 2203 | Should accept two parameters: preds, valid_data, |
| 2204 | and return (eval_name, eval_result, is_higher_better) or list of such tuples. |
| 2205 | |
| 2206 | preds : list or numpy 1-D array |
| 2207 | The predicted values. |
| 2208 | valid_data : Dataset |
| 2209 | The validation dataset. |
| 2210 | eval_name : string |
| 2211 | The name of evaluation function (without whitespaces). |
| 2212 | eval_result : float |
| 2213 | The eval result. |
| 2214 | is_higher_better : bool |
| 2215 | Is eval result higher better, e.g. AUC is ``is_higher_better``. |
| 2216 | |
| 2217 | For multi-class task, the preds is group by class_id first, then group by row_id. |
| 2218 | If you want to get i-th row preds in j-th class, the access way is preds[j * num_data + i]. |
| 2219 | |
| 2220 | Returns |
| 2221 | ------- |
| 2222 | result : list |
| 2223 | List with evaluation results. |
| 2224 | """ |
| 2225 | return [item for i in range_(1, self.__num_dataset) |
| 2226 | for item in self.__inner_eval(self.name_valid_sets[i - 1], i, feval)] |
| 2227 | |
| 2228 | def save_model(self, filename, num_iteration=None, start_iteration=0): |
| 2229 | """Save Booster to file. |