Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port LightGBM provider #26

Merged
merged 9 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openml-lightgbm-provider/lightgbmlib_build/__commit_id__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
471d0aaaaa8574b9a1da2302e992f61b01e3d155
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions openml-lightgbm-provider/lightgbmlib_build/__timestamp__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20/05/13 10:45:24
1 change: 1 addition & 0 deletions openml-lightgbm-provider/lightgbmlib_build/__version__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.3.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env

mvn install:install-file -Dfile=lightgbmlib.jar \
-DpomFile=pom.xml \
-DgeneratePom=false
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions openml-lightgbm-provider/lightgbmlib_build/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.feedzai.openml.lightgbmlib</groupId>
<artifactId>lightgbmlib</artifactId>
<version>2.3.1</version>
<packaging>jar</packaging>
<url>[email protected]:data-science/make-lightgbm.git</url>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<description>
LightGBM build for Java generated with make-lightgbm.

Build created with command: `bash make.sh v2.3.1 2.3.1`

---

Build info:

LIGHTGBM_VERSION=v2.3.1
LIGHTGBM_COMMIT=471d0aaaaa8574b9a1da2302e992f61b01e3d155
PACKAGE_TIMESTAMP=20/05/13 10:45:24
</description>
</project>
195 changes: 195 additions & 0 deletions openml-lightgbm-provider/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ The copyright of this file belongs to Feedzai. The file cannot be
~ reproduced in whole or in part, stored in a retrieval system,
~ transmitted in any form, or by any means electronic, mechanical,
~ photocopying, or otherwise, without the prior permission of the owner.
~
~ (c) 2020 Feedzai, Strictly Confidential
-->

<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">
<parent>
<artifactId>openml-java</artifactId>
<groupId>com.feedzai</groupId>
<version>0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>openml-lightgbm-provider</artifactId>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved

<name>Feedzai OpenML LGBM Provider</name>
<description>Contains an example for the implementation of a LGBM Machine Learning Model and CLassifier
</description>

<properties>
<openml.version>1.0.3</openml.version>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<lightgbmlib.version>2.3.150</lightgbmlib.version>
</properties>


<dependencies>
<dependency>
<groupId>com.feedzai</groupId>
<artifactId>openml-api</artifactId>
<version>${openml.version}</version>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>com.feedzai</groupId>
<artifactId>openml-utils</artifactId>
<version>${openml.version}</version>
</dependency>

<dependency>
<groupId>com.microsoft.ml.lightgbm</groupId>
<artifactId>lightgbmlib</artifactId>
<version>${lightgbmlib.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- For testing only -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.feedzai</groupId>
<artifactId>openml-utils</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.8</version>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<scope>test</scope>
</dependency>

</dependencies>

<build>

<resources>
<resource>
<directory>${project.basedir}/target/resources</directory>
</resource>
</resources>

<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- set locale otherwise the LightGBM core implementation spits wrong results -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<LC_ALL>C</LC_ALL>
</environmentVariables>
</configuration>
</plugin>

<!-- Install the local copy of the custom build of LightGBM to Maven -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<executions>
<execution>
<id>install-custom-lightgbmlib_build</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.basedir}/lightgbmlib_build/lightgbmlib.jar</file>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<pomFile>${project.basedir}/lightgbmlib_build/pom.xml</pomFile>
<generatePom>false</generatePom>
</configuration>
</execution>
</executions>
</plugin>
<!-- Copy the shared libraries to the resources folder -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
<executions>
<execution>
<id>copy-shared-libs-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/resources</outputDirectory>
<resources>
<resource>
<directory>lightgbmlib_build</directory>
<include>*.so</include>
<include>*.so.1.0.0</include>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-licences</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/resources</outputDirectory>
<resources>
<resource>
<directory>${maven.multiModuleProjectDirectory}/LICENCES</directory>
shengwangsw marked this conversation as resolved.
Show resolved Hide resolved
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2020 Feedzai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.feedzai.openml.provider.lightgbm;

import com.feedzai.openml.provider.descriptor.MLAlgorithmDescriptor;
import com.feedzai.openml.provider.descriptor.MachineLearningAlgorithmType;
import com.feedzai.openml.util.algorithm.MLAlgorithmEnum;

import static com.feedzai.openml.util.algorithm.MLAlgorithmEnum.createDescriptor;

/**
* Specifies the LightGBM algorithms that can be imported.
*
* @author Alberto Ferreira ([email protected])
*/
public enum LightGBMAlgorithms implements MLAlgorithmEnum {

/**
* LightGBM binary classifier algorithm.
*/
LIGHTGBM_BINARY_CLASSIFIER(createDescriptor(
"LightGBM Binary Classifier",
LightGBMDescriptorUtil.PARAMS,
MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION,
"https://lightgbm.readthedocs.io/"
)),
;

/**
* {@link MLAlgorithmDescriptor} for this algorithm.
*/
private final MLAlgorithmDescriptor descriptor;

/**
* Constructor.
*
* @param descriptor {@link MLAlgorithmDescriptor} for this algorithm.
*/
LightGBMAlgorithms(final MLAlgorithmDescriptor descriptor) {
this.descriptor = descriptor;
}

@Override
public MLAlgorithmDescriptor getAlgorithmDescriptor() {
return this.descriptor;
}
}
Loading