This commit is contained in:
Guolin Ke 2016-11-08 21:24:05 +08:00
Родитель 044f79aab5
Коммит 55cd60968d
4 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -21,6 +21,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fopenmp -O2 -std=c++11")
SET(LightGBM_HEADER_DIR ${PROJECT_SOURCE_DIR}/include)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
ADD_SUBDIRECTORY(src)

Просмотреть файл

@ -67,10 +67,10 @@ DllExport int LGBM_CreateDatasetFromBinaryFile(const char* filename,
/*!
* \brief create a dataset from CSR format
* \param indptr pointer to row headers
* \param indptr_type 0:int_32 1:int_64
* \param indptr_type
* \param indices findex
* \param data fvalue
* \param data_type 0 for float_32 1 for float_64
* \param data_type
* \param nindptr number of rows in the matix + 1
* \param nelem number of nonzero elements in the matrix
* \param num_col number of columns; when it's set to 0, then guess from data
@ -94,10 +94,10 @@ DllExport int LGBM_CreateDatasetFromCSR(const void* indptr,
/*!
* \brief create a dataset from CSC format
* \param col_ptr pointer to col headers
* \param col_ptr_type 0:int_32 1:int_64
* \param col_ptr_type
* \param indices findex
* \param data fvalue
* \param data_type 0 for float_32 1 for float_64
* \param data_type
* \param ncol_ptr number of rows in the matix + 1
* \param nelem number of nonzero elements in the matrix
* \param num_row number of rows; when it's set to 0, then guess from data
@ -121,7 +121,7 @@ DllExport int LGBM_CreateDatasetFromCSC(const void* col_ptr,
/*!
* \brief create dataset from dense matrix
* \param data pointer to the data space
* \param data_type 0 for float_32 1 for float_64
* \param data_type 0
* \param nrow number of rows
* \param ncol number columns
* \param is_row_major 1 for row major, 0 for column major
@ -302,10 +302,10 @@ DllExport int LGBM_BoosterGetPredict(BoosterHandle handle,
* \brief make prediction for an new data set
* \param handle handle
* \param indptr pointer to row headers
* \param indptr_type 0:int_32 1:int_64
* \param indptr_type
* \param indices findex
* \param data fvalue
* \param data_type 0:float_32 1:float64
* \param data_type
* \param nindptr number of rows in the matix + 1
* \param nelem number of nonzero elements in the matrix
* \param num_col number of columns; when it's set to 0, then guess from data
@ -334,7 +334,7 @@ DllExport int LGBM_BoosterPredictForCSR(BoosterHandle handle,
* \brief make prediction for an new data set
* \param handle handle
* \param data pointer to the data space
* \param data_type 0:float_32 1:float64
* \param data_type
* \param nrow number of rows
* \param ncol number columns
* \param is_row_major 1 for row major, 0 for column major
@ -369,6 +369,8 @@ DllExport int LGBM_BoosterSaveModel(BoosterHandle handle,
// some help functions used to convert data
std::function<std::vector<double>(int row_idx)>
RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major);

Просмотреть файл

@ -14,6 +14,8 @@ AUX_SOURCE_DIRECTORY(./treelearner/ TREELEARNER_SRC)
add_executable(lightgbm main.cpp ${APPLICATION_SRC} ${BOOSTING_SRC} ${IO_SRC} ${METRIC_SRC} ${OBJECTIVE_SRC} ${NETWORK_SRC} ${TREELEARNER_SRC})
add_library(_lightgbm SHARED c_api.cpp ${APPLICATION_SRC} ${BOOSTING_SRC} ${IO_SRC} ${METRIC_SRC} ${OBJECTIVE_SRC} ${NETWORK_SRC} ${TREELEARNER_SRC})
if(USE_MPI)
TARGET_LINK_LIBRARIES(lightgbm ${MPI_CXX_LIBRARIES})
endif(USE_MPI)

Просмотреть файл

@ -558,7 +558,7 @@ DllExport int LGBM_BoosterSaveModel(BoosterHandle handle,
return 0;
}
// ---- start of some help functions
std::function<std::vector<double>(int row_idx)>
RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_type, int is_row_major) {
@ -609,6 +609,7 @@ RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_
} else {
Log::Fatal("unknown data type in RowFunctionFromDenseMatric");
}
return nullptr;
}
std::function<std::vector<std::pair<int, double>>(int row_idx)>
@ -660,6 +661,7 @@ RowPairFunctionFromDenseMatric(const void* data, int num_row, int num_col, int d
} else {
Log::Fatal("unknown data type in RowPairFunctionFromDenseMatric");
}
return nullptr;
}
std::function<std::vector<std::pair<int, double>>(int idx)>
@ -729,6 +731,7 @@ RowFunctionFromCSR(const void* indptr, int indptr_type, const int32_t* indices,
} else {
Log::Fatal("unknown data type in RowFunctionFromCSR");
}
return nullptr;
}
std::function<std::vector<std::pair<int, double>>(int idx)>
@ -798,6 +801,7 @@ ColumnFunctionFromCSC(const void* col_ptr, int col_ptr_type, const int32_t* indi
} else {
Log::Fatal("unknown data type in ColumnFunctionFromCSC");
}
return nullptr;
}
std::vector<double> SampleFromOneColumn(const std::vector<std::pair<int, double>>& data, const std::vector<size_t>& indices) {