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

openml integration in shogun #4628

Draft
wants to merge 33 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e6d5a20
initial openml code
gf712 May 3, 2019
7cf1d10
basic flow interface working with python
gf712 May 7, 2019
b70398d
moved json dependency to library
gf712 May 7, 2019
0500504
initial ShogunOpenML class
gf712 May 8, 2019
bbb493a
started working datasets
gf712 May 8, 2019
4c988bb
started work on splits
gf712 May 14, 2019
859786b
removed curl from header file
gf712 May 14, 2019
beb0acf
added data getters
gf712 May 15, 2019
86c06b8
get binary classification working [SKIP CI]
gf712 May 17, 2019
d40785a
smart pointer and refcount fixes
gf712 May 17, 2019
7b4a365
split openml classes in different files
gf712 May 18, 2019
40fda20
train and test index getter
gf712 May 18, 2019
677c1e7
added crossvalidation
gf712 May 20, 2019
d06fe2f
some cleanups
gf712 May 21, 2019
b045a8a
fixes for new arff api
gf712 May 24, 2019
753f8ba
added metric evaluation
gf712 May 29, 2019
f190940
initial openml code
gf712 May 3, 2019
9b331a6
basic flow interface working with python
gf712 May 7, 2019
21d2a00
moved json dependency to library
gf712 May 7, 2019
134cf2e
initial ShogunOpenML class
gf712 May 8, 2019
07b07d0
started working datasets
gf712 May 8, 2019
3cd470b
started work on splits
gf712 May 14, 2019
f1546a6
removed curl from header file
gf712 May 14, 2019
d5ac051
added data getters
gf712 May 15, 2019
df1a8d6
get binary classification working [SKIP CI]
gf712 May 17, 2019
c615896
smart pointer and refcount fixes
gf712 May 17, 2019
c5c9d93
split openml classes in different files
gf712 May 18, 2019
f9f9c79
train and test index getter
gf712 May 18, 2019
37e8c63
added crossvalidation
gf712 May 20, 2019
f17bbe1
some cleanups
gf712 May 21, 2019
c2cf37b
fixes for new arff api
gf712 May 24, 2019
6616ecf
added metric evaluation
gf712 May 29, 2019
6d6c254
rebase
gf712 Feb 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 47 additions & 34 deletions cmake/ShogunUtils.cmake
Expand Up @@ -75,31 +75,31 @@ ENDMACRO()
# based on compiz_discover_tests
function (shogun_discover_tests EXECUTABLE)

add_dependencies (${EXECUTABLE} discover_gtest_tests)

add_custom_command (TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -D UNIT_TEST_CMD=${CMAKE_BINARY_DIR}/bin/${EXECUTABLE}
-D DISCOVER_CMD=${CMAKE_BINARY_DIR}/bin/discover_gtest_tests
-D WORKING_DIR=${CMAKE_CURRENT_BINARY_DIR}
-P ${CMAKE_MODULE_PATH}/discover_unit_tests.cmake
COMMENT "Discovering Tests in ${EXECUTABLE}"
DEPENDS
VERBATIM)
add_dependencies (${EXECUTABLE} discover_gtest_tests)

add_custom_command (TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -D UNIT_TEST_CMD=${CMAKE_BINARY_DIR}/bin/${EXECUTABLE}
-D DISCOVER_CMD=${CMAKE_BINARY_DIR}/bin/discover_gtest_tests
-D WORKING_DIR=${CMAKE_CURRENT_BINARY_DIR}
-P ${CMAKE_MODULE_PATH}/discover_unit_tests.cmake
COMMENT "Discovering Tests in ${EXECUTABLE}"
DEPENDS
VERBATIM)
endfunction ()

MACRO(AddMetaIntegrationTest META_TARGET CONDITION)
IF (${CONDITION})
add_test(NAME integration_meta_${META_TARGET}-${NAME_WITH_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND meta_example_integration_tester ${REL_DIR} ${NAME}.dat ${META_TARGET} generated_results reference_results)
set_tests_properties(
integration_meta_${META_TARGET}-${NAME_WITH_DIR}
PROPERTIES
LABELS "integration"
DEPENDS generated_${META_TARGET}-${NAME_WITH_DIR}
)
ENDIF()
IF (${CONDITION})
add_test(NAME integration_meta_${META_TARGET}-${NAME_WITH_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND meta_example_integration_tester ${REL_DIR} ${NAME}.dat ${META_TARGET} generated_results reference_results)
set_tests_properties(
integration_meta_${META_TARGET}-${NAME_WITH_DIR}
PROPERTIES
LABELS "integration"
DEPENDS generated_${META_TARGET}-${NAME_WITH_DIR}
)
ENDIF()
ENDMACRO()

MACRO(AddLibShogunExample EXAMPLE_CPP)
Expand Down Expand Up @@ -144,34 +144,47 @@ macro(ADD_LIBRARY_DEPENDENCY)
set(oneValueArgs LIBRARY CONFIG_FLAG VERSION SCOPE)
set(multiValueArgs TARGETS)
cmake_parse_arguments(ADD_LIBRARY_DEPENDENCY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
STRING(TOUPPER ${ADD_LIBRARY_DEPENDENCY_LIBRARY} LIBRARY_PREFIX)
OPTION(ENABLE_${LIBRARY_PREFIX} "Use ${LIBRARY_PREFIX}" ON)
SET(LIBRARY_PREFIX ${ADD_LIBRARY_DEPENDENCY_LIBRARY})
STRING(TOUPPER ${ADD_LIBRARY_DEPENDENCY_LIBRARY} LIBRARY_PREFIX_UPPER)
OPTION(ENABLE_${LIBRARY_PREFIX_UPPER} "Use ${LIBRARY_PREFIX}" ON)
if (${ADD_LIBRARY_DEPENDENCY_REQUIRED})
find_package(${ADD_LIBRARY_DEPENDENCY_LIBRARY} REQUIRED ${ADD_LIBRARY_DEPENDENCY_VERSION})
else()
find_package(${ADD_LIBRARY_DEPENDENCY_LIBRARY} ${ADD_LIBRARY_DEPENDENCY_VERSION})
endif()
if (${LIBRARY_PREFIX}_FOUND AND ENABLE_${LIBRARY_PREFIX})
if ((${LIBRARY_PREFIX}_FOUND OR ${LIBRARY_PREFIX_UPPER}_FOUND) AND ENABLE_${LIBRARY_PREFIX_UPPER})
if (${LIBRARY_PREFIX}_INCLUDE_DIR)
set(LIBRARY_HEADER ${${LIBRARY_PREFIX}_INCLUDE_DIR})
elseif (${LIBRARY_PREFIX_UPPER}_INCLUDE_DIR)
set(LIBRARY_HEADER ${${LIBRARY_PREFIX_UPPER}_INCLUDE_DIR})
elseif (${LIBRARY_PREFIX}_INCLUDE_DIRS)
set(LIBRARY_HEADER ${${LIBRARY_PREFIX}_INCLUDE_DIRS})
elseif (${LIBRARY_PREFIX_UPPER}_INCLUDE_DIRS)
set(LIBRARY_HEADER ${${LIBRARY_PREFIX_UPPER}_INCLUDE_DIRS})
else ()
message(${${LIBRARY_PREFIX}_INCLUDE_DIR})
message(FATAL_ERROR "Found ${ADD_LIBRARY_DEPENDENCY_LIBRARY}, but not it's headers!")
endif()

set(${ADD_LIBRARY_DEPENDENCY_CONFIG_FLAG} ON CACHE BOOL "Use ${LIBRARY_PREFIX}" FORCE)

if (${LIBRARY_PREFIX}_LIBRARIES)
set(LIBRARY_LIBS ${${LIBRARY_PREFIX}_LIBRARIES})
elseif(${LIBRARY_PREFIX_UPPER}_LIBRARIES)
set(LIBRARY_LIBS ${${LIBRARY_PREFIX_UPPER}_LIBRARIES})
else()
message(FATAL_ERROR "Found ${ADD_LIBRARY_DEPENDENCY_LIBRARY}, but not it's libraries!")
endif()

ForEach (element ${ADD_LIBRARY_DEPENDENCY_TARGETS})
if (TARGET ${element})
get_target_property(TARGET_TYPE ${element} TYPE)
if (${TARGET_TYPE} STREQUAL INTERFACE_LIBRARY)
target_include_directories(${element} INTERFACE ${LIBRARY_HEADER})
target_link_libraries(${element} INTERFACE ${${LIBRARY_PREFIX}_LIBRARIES})
target_link_libraries(${element} INTERFACE ${LIBRARY_LIBS})
else()
if (NOT ${TARGET_TYPE} STREQUAL OBJECT_LIBRARY)
target_link_libraries(${element} ${ADD_LIBRARY_DEPENDENCY_SCOPE} ${${LIBRARY_PREFIX}_LIBRARIES})
target_link_libraries(${element} ${ADD_LIBRARY_DEPENDENCY_SCOPE} ${LIBRARY_LIBS})
endif()
target_include_directories(${element} ${ADD_LIBRARY_DEPENDENCY_SCOPE} ${LIBRARY_HEADER})
endif()
Expand Down Expand Up @@ -225,12 +238,12 @@ endfunction()
function(SET_LINALG_BACKEND COMPONENT FLAG)
OPTION(USE_EIGEN3_${FLAG} "Use ${COMPONENT} Eigen3" ON)
CMAKE_DEPENDENT_OPTION(
USE_VIENNACL_${FLAG} "Use ${COMPONENT} ViennaCL" OFF
"VIENNACL_FOUND;USE_VIENNACL;NOT USE_EIGEN3_${FLAG}" ON)
USE_VIENNACL_${FLAG} "Use ${COMPONENT} ViennaCL" OFF
"VIENNACL_FOUND;USE_VIENNACL;NOT USE_EIGEN3_${FLAG}" ON)
if(NOT ${COMPONENT})
set(${COMPONENT} EIGEN3 CACHE STRING
"Set linear algebra backend ${COMPONENT}: EIGEN3, VIENNACL"
FORCE)
set(${COMPONENT} EIGEN3 CACHE STRING
"Set linear algebra backend ${COMPONENT}: EIGEN3, VIENNACL"
FORCE)
endif()

if (${COMPONENT} STREQUAL "EIGEN3")
Expand Down Expand Up @@ -264,7 +277,7 @@ function(GET_META_EXAMPLE_VARS META_EXAMPLE EX_NAME REL_DIR NAME_WITH_DIR)
endfunction()

function(GET_INTERFACE_VARS INTERFACE DIRECTORY EXTENSION)
string(REGEX MATCH "INTERFACE_([a-zA-Z]+)" _dir ${INTERFACE})
string(REGEX MATCH "INTERFACE_([a-zA-Z]+)" _dir ${INTERFACE})
STRING(TOLOWER "${CMAKE_MATCH_1}" _dir)
SET(${DIRECTORY} ${_dir} PARENT_SCOPE)

Expand Down Expand Up @@ -314,4 +327,4 @@ function(ADD_SHOGUN_BENCHMARK REL_BENCHMARK_NAME)
if(ARGN)
set_tests_properties(${BENCHMARK_NAME} PROPERTIES ${ARGN})
endif()
endfunction()
endfunction()
16 changes: 16 additions & 0 deletions cmake/external/RapidJSON.cmake
@@ -0,0 +1,16 @@
set(RAPIDJSON_PREFIX ${CMAKE_BINARY_DIR}/RapidJSON)
set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_PREFIX}/src/RapidJSON/include")
include(ExternalProject)
ExternalProject_Add(
RapidJSON
PREFIX ${RAPIDJSON_PREFIX}
DOWNLOAD_DIR ${THIRD_PARTY_DIR}/RapidJSON
URL https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
URL_MD5 badd12c511e081fec6c89c43a7027bce
CMAKE_ARGS -DRAPIDJSON_BUILD_DOC:BOOL=OFF
-DRAPIDJSON_BUILD_EXAMPLES:BOOL=OFF
-DRAPIDJSON_BUILD_TESTS:BOOL=OFF
INSTALL_COMMAND ""
)

LIST(APPEND SHOGUN_DEPENDS RapidJSON)
14 changes: 14 additions & 0 deletions cmake/external/bitsery.cmake
@@ -0,0 +1,14 @@
set(BITSERY_PREFIX ${CMAKE_BINARY_DIR}/bitsery)
set(BITSERY_INCLUDE_DIR "${BITSERY_PREFIX}/src/bitsery/include")

include(ExternalProject)
ExternalProject_Add(
bitsery
PREFIX ${BITSERY_PREFIX}
DOWNLOAD_DIR ${THIRD_PARTY_DIR}/bitsery
URL https://github.com/fraillt/bitsery/archive/v4.6.0.tar.gz
URL_MD5 accb462f98a59ed2bc4ffa7de374c24b
INSTALL_COMMAND ""
)

LIST(APPEND SHOGUN_DEPENDS bitsery)
6 changes: 6 additions & 0 deletions src/interfaces/swig/IO.i
Expand Up @@ -25,6 +25,9 @@
%rename(SimpleFile) CSimpleFile;
%rename(MemoryMappedFile) CMemoryMappedFile;

%shared_ptr(shogun::OpenMLFlow)
%shared_ptr(shogun::OpenMLRun)
%shared_ptr(shogun::OpenMLTask)

%include <shogun/io/File.h>
%include <shogun/io/streaming/StreamingFile.h>
Expand Down Expand Up @@ -120,6 +123,9 @@ namespace shogun

%include <shogun/io/BinaryFile.h>
%include <shogun/io/HDF5File.h>
%include <shogun/io/openml/OpenMLFlow.h>
%include <shogun/io/openml/OpenMLRun.h>
%include <shogun/io/openml/ShogunOpenML.h>
%include <shogun/io/SerializableFile.h>
%include <shogun/io/SerializableAsciiFile.h>
%include <shogun/io/SerializableHdf5File.h>
Expand Down
3 changes: 3 additions & 0 deletions src/interfaces/swig/IO_includes.i
Expand Up @@ -13,6 +13,9 @@

#include <shogun/io/BinaryFile.h>
#include <shogun/io/HDF5File.h>
#include <shogun/io/openml/OpenMLFlow.h>
#include <shogun/io/openml/OpenMLRun.h>
#include <shogun/io/openml/ShogunOpenML.h>
#include <shogun/io/SerializableFile.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/io/SerializableHdf5File.h>
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/swig/SGBase.i
Expand Up @@ -8,6 +8,7 @@
%include "stdint.i"
%include "std_string.i"
%include "exception.i"
%include "std_shared_ptr.i"

%feature("ref") shogun::CSGObject "SG_REF($this);"
%feature("unref") shogun::CSGObject "SG_UNREF($this);"
Expand Down