org.apache.ignite.ml.xgboost.parser

## Class XGModelParser

- java.lang.Object
- - org.apache.ignite.ml.xgboost.parser.XGModelParser

- All Implemented Interfaces:
    Serializable, ModelParser<NamedVector,Double,XGModelComposition>

      public class XGModelParser
      extends Object
      implements ModelParser<NamedVector,Double,XGModelComposition>

  XGBoost model parser. Uses the following ANTLR grammar to parse file:

       grammar XGBoostModel;

       YES : 'yes' ;
       NO : 'no' ;
       MISSING : 'missing' ;
       EQ : '=' ;
       COMMA : ',' ;
       PLUS : '+' ;
       MINUS : '-' ;
       DOT : '.' ;
       EXP : 'E' | 'e' ;
       BOOSTER : 'booster' ;
       LBRACK : '[' ;
       RBRACK : ']' ;
       COLON : ':' ;
       LEAF : 'leaf' ;
       INT : (PLUS | MINUS)? [0-9]+ ;
       DOUBLE : INT DOT [0-9]* (EXP INT)?;
       STRING : [A-Za-z_][0-9A-Za-z_]+ ;
       NEWLINE : '\r' '\n' | '\n' | '\r' ;
       LT : '<' ;
       WS : ( ' ' | '\t' )+ -> skip ;

       xgValue : DOUBLE | INT ;
       xgHeader : BOOSTER LBRACK INT RBRACK COLON? ;
       xgNode : INT COLON LBRACK STRING LT xgValue RBRACK YES EQ INT COMMA NO EQ INT COMMA MISSING EQ INT ;
       xgLeaf : INT COLON LEAF EQ xgValue ;
       xgTree : xgHeader NEWLINE (
           ((xgLeaf | xgNode) NEWLINE)+ ((xgLeaf | xgNode) EOF)?
           | ((xgLeaf | xgNode) NEWLINE)* (xgLeaf | xgNode) EOF
       ) ;
       xgModel : xgTree+ ;

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XGModelParser()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `XGModelComposition` | `parse(byte[] mdl)` Accepts serialized model represented by byte array, parses it and returns `Model`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XGModelParser

          public XGModelParser()

  - ### Method Detail

    - #### parse

          public XGModelComposition parse(byte[] mdl)

      Accepts serialized model represented by byte array, parses it and returns `Model`.
      Specified by:
        `parse` in interface `ModelParser<NamedVector,Double,XGModelComposition>`
      Parameters:
        `mdl` - Serialized model represented by byte array.
      Returns:
        Inference model.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021