Skip to content

Commit b029ae9

Browse files
committed
Added 'pmml-sklearn-evaluator' module
1 parent d690db9 commit b029ae9

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

pmml-sklearn-evaluator/pom.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" ?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.jpmml</groupId>
7+
<artifactId>jpmml-sklearn</artifactId>
8+
<version>1.9-SNAPSHOT</version>
9+
</parent>
10+
11+
<groupId>org.jpmml</groupId>
12+
<artifactId>pmml-sklearn-evaluator</artifactId>
13+
<packaging>jar</packaging>
14+
15+
<name>JPMML SkLearn JPMML-Evaluator integration</name>
16+
<description>JPMML Scikit-Learn JPMML-Evaluator integration</description>
17+
18+
<licenses>
19+
<license>
20+
<name>GNU Affero General Public License (AGPL) version 3.0</name>
21+
<url>http://www.gnu.org/licenses/agpl-3.0.html</url>
22+
<distribution>repo</distribution>
23+
</license>
24+
</licenses>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>org.jpmml</groupId>
29+
<artifactId>pmml-evaluator</artifactId>
30+
<scope>provided</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.jpmml</groupId>
34+
<artifactId>pmml-evaluator-testing</artifactId>
35+
<scope>provided</scope>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.junit.jupiter</groupId>
40+
<artifactId>junit-jupiter-api</artifactId>
41+
</dependency>
42+
</dependencies>
43+
</project>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2025 Villu Ruusmann
3+
*
4+
* This file is part of JPMML-SkLearn
5+
*
6+
* JPMML-SkLearn is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* JPMML-SkLearn is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with JPMML-SkLearn. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
package org.jpmml.sklearn.evaluator;
20+
21+
import java.util.Collections;
22+
import java.util.Map;
23+
import java.util.Objects;
24+
import java.util.function.Predicate;
25+
26+
import org.jpmml.evaluator.Function;
27+
import org.jpmml.evaluator.FunctionRegistry;
28+
29+
/**
30+
* @see FunctionRegistry
31+
*/
32+
public class SkLearnFunctionRegistry {
33+
34+
private SkLearnFunctionRegistry(){
35+
}
36+
37+
static
38+
public void publish(String name){
39+
publish(key -> Objects.equals(name, key));
40+
}
41+
42+
static
43+
public void publishAll(){
44+
publish(key -> true);
45+
}
46+
47+
static
48+
private void publish(Predicate<String> predicate){
49+
(SkLearnFunctionRegistry.rexpFunctions.entrySet()).stream()
50+
.filter(entry -> predicate.test(entry.getKey()))
51+
.forEach(entry -> FunctionRegistry.putFunction(entry.getKey(), entry.getValue()));
52+
53+
(SkLearnFunctionRegistry.rexpFunctionClazzes.entrySet()).stream()
54+
.filter(entry -> predicate.test(entry.getKey()))
55+
.forEach(entry -> FunctionRegistry.putFunction(entry.getKey(), entry.getValue()));
56+
}
57+
58+
private static final Map<String, Function> rexpFunctions = Collections.emptyMap();
59+
private static final Map<String, Class<? extends Function>> rexpFunctionClazzes = Collections.emptyMap();
60+
}

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
<modules>
3636
<module>pmml-sklearn</module>
37+
<module>pmml-sklearn-evaluator</module>
3738
<module>pmml-sklearn-example</module>
3839
<module>pmml-sklearn-extension</module>
3940
<module>pmml-sklearn-h2o</module>
@@ -71,6 +72,11 @@
7172
<artifactId>pmml-sklearn</artifactId>
7273
<version>1.9-SNAPSHOT</version>
7374
</dependency>
75+
<dependency>
76+
<groupId>org.jpmml</groupId>
77+
<artifactId>pmml-sklearn-evaluator</artifactId>
78+
<version>1.9-SNAPSHOT</version>
79+
</dependency>
7480
<dependency>
7581
<groupId>org.jpmml</groupId>
7682
<artifactId>pmml-sklearn-example</artifactId>
@@ -102,6 +108,11 @@
102108
<version>1.9-SNAPSHOT</version>
103109
</dependency>
104110

111+
<dependency>
112+
<groupId>org.jpmml</groupId>
113+
<artifactId>pmml-evaluator</artifactId>
114+
<version>${jpmml-evaluator.version}</version>
115+
</dependency>
105116
<dependency>
106117
<groupId>org.jpmml</groupId>
107118
<artifactId>pmml-evaluator-testing</artifactId>

0 commit comments

Comments
 (0)