104 |
105 |
106 |
107 |
108 |
109 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | Parameters
138 |
139 |
140 |
141 |
142 |
options (object)
143 | Same parameters described
144 |
here
145 | , Default parameters below.
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | Name |
157 | Description |
158 |
159 |
160 |
161 |
162 |
163 | options.booster string
164 |
165 | (default 'gbtree' )
166 | |
167 | |
168 |
169 |
170 |
171 |
172 |
173 | options.objective string
174 |
175 | (default 'reg:linear' )
176 | |
177 | |
178 |
179 |
180 |
181 |
182 |
183 | options.max_depth number
184 |
185 | (default 5 )
186 | |
187 | |
188 |
189 |
190 |
191 |
192 |
193 | options.eta number
194 |
195 | (default 0.1 )
196 | |
197 | |
198 |
199 |
200 |
201 |
202 |
203 | options.min_child_weight number
204 |
205 | (default 1 )
206 | |
207 | |
208 |
209 |
210 |
211 |
212 |
213 | options.subsample number
214 |
215 | (default 0.5 )
216 | |
217 | |
218 |
219 |
220 |
221 |
222 |
223 | options.colsample_bytree number
224 |
225 | (default 1 )
226 | |
227 | |
228 |
229 |
230 |
231 |
232 |
233 | options.silent number
234 |
235 | (default 1 )
236 | |
237 | |
238 |
239 |
240 |
241 |
242 |
243 | options.iterations number
244 |
245 | (default 200 )
246 | |
247 | |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
model (object)
260 | for load purposes.
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
302 |
303 |
304 | Free the memory allocated for the model. Since this memory is stored in the memory model of emscripten,
305 | it is allocated within an ArrayBuffer and WILL NOT BE GARBARGE COLLECTED, you have to explicitly free it.
306 | So not calling this will result in memory leaks. As of today in the browser, there is no way to hook the
307 | garbage collection of the XGBoost object to free it automatically. Free the memory that was created by the
308 | compiled XGBoost library to. store the model. This model is reused every time the predict method is called.
309 |
310 |
311 | free()
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
357 |
358 |
359 | Predicts the output given the matrix to predict.
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 | Parameters
375 |
386 |
387 |
388 |
389 |
390 |
391 |
392 | Returns
393 | Array<number>
:
394 | predictions
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
429 |
430 |
431 | Export the current model to JSON.
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 | Returns
452 | object
:
453 | Current model.
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
488 |
489 |
490 | Train the decision tree with the given training set and labels.
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 | Parameters
506 |
507 |
508 |
515 |
516 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
560 |
561 |
562 | Load a Decision tree classifier with the given model.
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 | Parameters
578 |
579 |
580 |
581 |
582 |
model (object)
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 | Returns
596 | XGBoost
:
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
632 |
633 |
634 | Load a model trained from other programming language
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 | Parameters
650 |
651 |
652 |
653 |
654 |
filepath (string)
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
options (object
663 | = {}
)
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 | Name |
675 | Description |
676 |
677 |
678 |
679 |
680 |
681 | options.labels Array?
682 | |
683 | Some classifiers are trained with a one-hot encoder (Ex: Python API) so the
684 | current classifier returns the probability of each class, if you want the single predictions, you should provide
685 | an array with the corresponding labels, if you are doing regression you should ignore this option
686 | |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 | Returns
704 | XGBoost
:
705 | model
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |