Skip to content

Commit 216f1f8

Browse files
author
Aleksandr
committed
wip
1 parent a6d8346 commit 216f1f8

7 files changed

Lines changed: 49 additions & 1556 deletions

File tree

modules/ml-ext/ml/xgboost-model-parser/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@
7070
<skip>false</skip>
7171
</configuration>
7272
</plugin>
73+
74+
<plugin>
75+
<groupId>org.antlr</groupId>
76+
<artifactId>antlr4-maven-plugin</artifactId>
77+
<version>${antlr.version}</version>
78+
<executions>
79+
<execution>
80+
<goals>
81+
<goal>antlr4</goal>
82+
</goals>
83+
<configuration>
84+
<visitor>true</visitor>
85+
<listener>true</listener>
86+
</configuration>
87+
</execution>
88+
</executions>
89+
</plugin>
7390
</plugins>
7491
</build>
7592

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
grammar XGBoostModel;
2+
3+
YES : 'yes' ;
4+
NO : 'no' ;
5+
MISSING : 'missing' ;
6+
EQ : '=' ;
7+
COMMA : ',' ;
8+
PLUS : '+' ;
9+
MINUS : '-' ;
10+
DOT : '.' ;
11+
EXP : 'E' | 'e' ;
12+
BOOSTER : 'booster' ;
13+
LBRACK : '[' ;
14+
RBRACK : ']' ;
15+
COLON : ':' ;
16+
LEAF : 'leaf' ;
17+
INT : (PLUS | MINUS)? [0-9]+ ;
18+
DOUBLE : INT DOT [0-9]* (EXP INT)?;
19+
STRING : [A-Za-z_][0-9A-Za-z_]+ ;
20+
NEWLINE : '\r' '\n' | '\n' | '\r' ;
21+
LT : '<' ;
22+
WS : ( ' ' | '\t' )+ -> skip ;
23+
24+
xgValue : DOUBLE | INT ;
25+
xgHeader : BOOSTER LBRACK INT RBRACK COLON? ;
26+
xgNode : INT COLON LBRACK STRING LT xgValue RBRACK YES EQ INT COMMA NO EQ INT COMMA MISSING EQ INT ;
27+
xgLeaf : INT COLON LEAF EQ xgValue ;
28+
xgTree : xgHeader NEWLINE (
29+
((xgLeaf | xgNode) NEWLINE)+ ((xgLeaf | xgNode) EOF)?
30+
| ((xgLeaf | xgNode) NEWLINE)* (xgLeaf | xgNode) EOF
31+
) ;
32+
xgModel : xgTree+ ;

modules/ml-ext/ml/xgboost-model-parser/src/main/java/org/apache/ignite/ml/xgboost/parser/XGBoostModelBaseVisitor.java

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)