-
Notifications
You must be signed in to change notification settings - Fork 10
Port LightGBM provider #26
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
Merged
shengwangsw
merged 9 commits into
master
from
ft-sw-PULSEDEV-31197-add-openml-lightgbm-provider
Jul 10, 2020
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5656020
Port lightgbm provider
shengwangsw 0bfe0b0
Refactor the code
shengwangsw e5f9884
Refactor the code
shengwangsw 88eed34
Update based on comments
shengwangsw 559df19
Add since tag
shengwangsw 48faba9
Update javadoc
shengwangsw 1bb467c
Add lightgbm licences
shengwangsw dc205d9
Add git submodule and bash script
shengwangsw 60902db
Ignore build folder
shengwangsw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,3 +38,4 @@ target | |
| .gnupg/private-keys-v1.d | ||
|
|
||
| openml-h2o/dependency-reduced-pom.xml | ||
| openml-lightgbm/lightgbmlib_build | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "openml-lightgbm/make-lightgbm"] | ||
| path = openml-lightgbm/make-lightgbm | ||
| url = https://github.com/feedzai/make-lightgbm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. | ||
| Contributed by Richard Henderson <rth@redhat.com>. | ||
|
|
||
| This file is part of the GNU OpenMP Library (libgomp). | ||
|
|
||
| Libgomp is free software; you can redistribute it and/or modify it | ||
| under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation; either version 3, or (at your option) | ||
| any later version. | ||
|
|
||
| Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| more details. | ||
|
|
||
| Under Section 7 of GPL version 3, you are granted additional | ||
| permissions described in the GCC Runtime Library Exception, version | ||
| 3.1, as published by the Free Software Foundation. | ||
|
|
||
| You should have received a copy of the GNU General Public License and | ||
| a copy of the GCC Runtime Library Exception along with this program; | ||
| see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
| <http://www.gnu.org/licenses/>. | ||
|
|
Submodule make-lightgbm
added at
c5bd94
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Copyright (c) 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. | ||
| # | ||
| # @author Sheng Wang (sheng.wang@feedzai.com) | ||
|
|
||
| FILE=lightgbmlib_build | ||
| if [ ! -d "$FILE" ]; then | ||
| echo "entering the folder." | ||
| cd make-lightgbm || return | ||
| echo "starting run the script" | ||
| bash make.sh v2.3.0 || return | ||
| echo "exiting the folder." | ||
| cd .. || return | ||
| echo "move the folder." | ||
| mv make-lightgbm/build lightgbmlib_build || return | ||
| echo "finished!" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,208 @@ | ||
| <?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</artifactId> | ||
|
|
||
| <description>Contains an example for the implementation of a LGBM Machine Learning Model and Classifier</description> | ||
|
|
||
| <properties> | ||
| <lightgbmlib.version>2.3.150</lightgbmlib.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.feedzai</groupId> | ||
| <artifactId>openml-api</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.feedzai</groupId> | ||
| <artifactId>openml-utils</artifactId> | ||
| <scope>provided</scope> | ||
| </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> | ||
| <scope>provided</scope> | ||
| </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> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| </dependencies> | ||
|
|
||
| <build> | ||
|
|
||
| <resources> | ||
| <resource> | ||
| <directory>${project.basedir}/target/resources</directory> | ||
| </resource> | ||
| </resources> | ||
|
|
||
| <plugins> | ||
|
|
||
| <plugin> | ||
| <artifactId>exec-maven-plugin</artifactId> | ||
| <groupId>org.codehaus.mojo</groupId> | ||
| <executions> | ||
| <execution> | ||
| <id>Generate LightGBM Build</id> | ||
| <phase>initialize</phase> | ||
| <goals> | ||
| <goal>exec</goal> | ||
| </goals> | ||
| <configuration> | ||
| <executable>${project.basedir}/make.sh</executable> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
|
|
||
| <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> | ||
| <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> | ||
| <pomFile>${project.basedir}/lightgbmlib_build/pom.xml</pomFile> | ||
| <generatePom>false</generatePom> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <!-- Copy the shared libraries to the resources folder --> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-resources-plugin</artifactId> | ||
| <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>LICENCES</directory> | ||
| </resource> | ||
| </resources> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
63 changes: 63 additions & 0 deletions
63
openml-lightgbm/src/main/java/com/feedzai/openml/provider/lightgbm/LightGBMAlgorithms.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * 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 (alberto.ferreira@feedzai.com) | ||
| * @since 1.0.10 | ||
| */ | ||
| 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; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.