Save Booster to file. Parameters ---------- filename : string Filename to save Booster. num_iteration : int or None, optional (default=None) Index of the iteration that should be saved. If None, if the best iteration exists, it is
(self, filename, num_iteration=None, start_iteration=0)
| 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. |
| 2230 | |
| 2231 | Parameters |
| 2232 | ---------- |
| 2233 | filename : string |
| 2234 | Filename to save Booster. |
| 2235 | num_iteration : int or None, optional (default=None) |
| 2236 | Index of the iteration that should be saved. |
| 2237 | If None, if the best iteration exists, it is saved; otherwise, all iterations are saved. |
| 2238 | If <= 0, all iterations are saved. |
| 2239 | start_iteration : int, optional (default=0) |
| 2240 | Start index of the iteration that should be saved. |
| 2241 | |
| 2242 | Returns |
| 2243 | ------- |
| 2244 | self : Booster |
| 2245 | Returns self. |
| 2246 | """ |
| 2247 | if num_iteration is None: |
| 2248 | num_iteration = self.best_iteration |
| 2249 | _safe_call(_LIB.LGBM_BoosterSaveModel( |
| 2250 | self.handle, |
| 2251 | ctypes.c_int(start_iteration), |
| 2252 | ctypes.c_int(num_iteration), |
| 2253 | c_str(filename))) |
| 2254 | _dump_pandas_categorical(self.pandas_categorical, filename) |
| 2255 | return self |
| 2256 | |
| 2257 | def save_model2(self, filename, num_iteration=None, start_iteration=0, num_label = 0): |
| 2258 | """Save Booster to file. |