Commit 462612b4 authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

fixed modifiers indent (#1997)

parent 8e286b38
...@@ -23,7 +23,7 @@ namespace LightGBM { ...@@ -23,7 +23,7 @@ namespace LightGBM {
* \brief Used to predict data with input model * \brief Used to predict data with input model
*/ */
class Predictor { class Predictor {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
* \param boosting Input boosting model * \param boosting Input boosting model
...@@ -207,7 +207,7 @@ public: ...@@ -207,7 +207,7 @@ public:
predict_data_reader.ReadAllAndProcessParallel(process_fun); predict_data_reader.ReadAllAndProcessParallel(process_fun);
} }
private: private:
void CopyToPredictBuffer(double* pred_buf, const std::vector<std::pair<int, double>>& features) { void CopyToPredictBuffer(double* pred_buf, const std::vector<std::pair<int, double>>& features) {
int loop_size = static_cast<int>(features.size()); int loop_size = static_cast<int>(features.size());
for (int i = 0; i < loop_size; ++i) { for (int i = 0; i < loop_size; ++i) {
......
...@@ -15,7 +15,7 @@ namespace LightGBM { ...@@ -15,7 +15,7 @@ namespace LightGBM {
* \brief DART algorithm implementation. including Training, prediction, bagging. * \brief DART algorithm implementation. including Training, prediction, bagging.
*/ */
class DART: public GBDT { class DART: public GBDT {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
return false; return false;
} }
private: private:
/*! /*!
* \brief drop trees based on drop_rate * \brief drop trees based on drop_rate
*/ */
......
...@@ -24,7 +24,7 @@ namespace LightGBM { ...@@ -24,7 +24,7 @@ namespace LightGBM {
* \brief GBDT algorithm implementation. including Training, prediction, bagging. * \brief GBDT algorithm implementation. including Training, prediction, bagging.
*/ */
class GBDT : public GBDTBase { class GBDT : public GBDTBase {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
*/ */
virtual const char* SubModelName() const override { return "tree"; } virtual const char* SubModelName() const override { return "tree"; }
protected: protected:
/*! /*!
* \brief Print eval result and check early stopping * \brief Print eval result and check early stopping
*/ */
......
...@@ -24,7 +24,7 @@ std::chrono::duration<double, std::milli> re_init_tree_time; ...@@ -24,7 +24,7 @@ std::chrono::duration<double, std::milli> re_init_tree_time;
#endif #endif
class GOSS: public GBDT { class GOSS: public GBDT {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
...@@ -208,7 +208,7 @@ public: ...@@ -208,7 +208,7 @@ public:
} }
} }
private: private:
std::vector<data_size_t> tmp_indice_right_; std::vector<data_size_t> tmp_indice_right_;
}; };
......
...@@ -16,7 +16,7 @@ namespace LightGBM { ...@@ -16,7 +16,7 @@ namespace LightGBM {
* \brief Rondom Forest implementation * \brief Rondom Forest implementation
*/ */
class RF : public GBDT { class RF : public GBDT {
public: public:
RF() : GBDT() { RF() : GBDT() {
average_output_ = true; average_output_ = true;
} }
...@@ -199,7 +199,7 @@ public: ...@@ -199,7 +199,7 @@ public:
return true; return true;
}; };
private: private:
std::vector<score_t> tmp_grad_; std::vector<score_t> tmp_grad_;
std::vector<score_t> tmp_hess_; std::vector<score_t> tmp_hess_;
std::vector<double> init_scores_; std::vector<double> init_scores_;
......
...@@ -15,7 +15,7 @@ namespace LightGBM { ...@@ -15,7 +15,7 @@ namespace LightGBM {
* \brief Used to store and update score for data * \brief Used to store and update score for data
*/ */
class ScoreUpdater { class ScoreUpdater {
public: public:
/*! /*!
* \brief Constructor, will pass a const pointer of dataset * \brief Constructor, will pass a const pointer of dataset
* \param data This class will bind with this data set * \param data This class will bind with this data set
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
/*! \brief Disable copy */ /*! \brief Disable copy */
ScoreUpdater(const ScoreUpdater&) = delete; ScoreUpdater(const ScoreUpdater&) = delete;
private: private:
/*! \brief Number of total data */ /*! \brief Number of total data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of data set */ /*! \brief Pointer of data set */
......
...@@ -44,7 +44,7 @@ catch(...) { return LGBM_APIHandleException("unknown exception"); } \ ...@@ -44,7 +44,7 @@ catch(...) { return LGBM_APIHandleException("unknown exception"); } \
return 0; return 0;
class Booster { class Booster {
public: public:
explicit Booster(const char* filename) { explicit Booster(const char* filename) {
boosting_.reset(Boosting::CreateBoosting("gbdt", filename)); boosting_.reset(Boosting::CreateBoosting("gbdt", filename));
} }
...@@ -323,7 +323,7 @@ public: ...@@ -323,7 +323,7 @@ public:
const Boosting* GetBoosting() const { return boosting_.get(); } const Boosting* GetBoosting() const { return boosting_.get(); }
private: private:
const Dataset* train_data_; const Dataset* train_data_;
std::unique_ptr<Boosting> boosting_; std::unique_ptr<Boosting> boosting_;
/*! \brief All configs */ /*! \brief All configs */
...@@ -356,7 +356,7 @@ RowFunctionFromCSR(const void* indptr, int indptr_type, const int32_t* indices, ...@@ -356,7 +356,7 @@ RowFunctionFromCSR(const void* indptr, int indptr_type, const int32_t* indices,
// Row iterator of on column for CSC matrix // Row iterator of on column for CSC matrix
class CSC_RowIterator { class CSC_RowIterator {
public: public:
CSC_RowIterator(const void* col_ptr, int col_ptr_type, const int32_t* indices, CSC_RowIterator(const void* col_ptr, int col_ptr_type, const int32_t* indices,
const void* data, int data_type, int64_t ncol_ptr, int64_t nelem, int col_idx); const void* data, int data_type, int64_t ncol_ptr, int64_t nelem, int col_idx);
~CSC_RowIterator() {} ~CSC_RowIterator() {}
...@@ -364,7 +364,8 @@ public: ...@@ -364,7 +364,8 @@ public:
double Get(int idx); double Get(int idx);
// return next non-zero pair, if index < 0, means no more data // return next non-zero pair, if index < 0, means no more data
std::pair<int, double> NextNonZero(); std::pair<int, double> NextNonZero();
private:
private:
int nonzero_idx_ = 0; int nonzero_idx_ = 0;
int cur_idx_ = -1; int cur_idx_ = -1;
double cur_val_ = 0.0f; double cur_val_ = 0.0f;
......
...@@ -14,7 +14,7 @@ class DenseBin; ...@@ -14,7 +14,7 @@ class DenseBin;
template <typename VAL_T> template <typename VAL_T>
class DenseBinIterator: public BinIterator { class DenseBinIterator: public BinIterator {
public: public:
explicit DenseBinIterator(const DenseBin<VAL_T>* bin_data, uint32_t min_bin, uint32_t max_bin, uint32_t default_bin) explicit DenseBinIterator(const DenseBin<VAL_T>* bin_data, uint32_t min_bin, uint32_t max_bin, uint32_t default_bin)
: bin_data_(bin_data), min_bin_(static_cast<VAL_T>(min_bin)), : bin_data_(bin_data), min_bin_(static_cast<VAL_T>(min_bin)),
max_bin_(static_cast<VAL_T>(max_bin)), max_bin_(static_cast<VAL_T>(max_bin)),
...@@ -28,7 +28,8 @@ public: ...@@ -28,7 +28,8 @@ public:
inline uint32_t RawGet(data_size_t idx) override; inline uint32_t RawGet(data_size_t idx) override;
inline uint32_t Get(data_size_t idx) override; inline uint32_t Get(data_size_t idx) override;
inline void Reset(data_size_t) override { } inline void Reset(data_size_t) override { }
private:
private:
const DenseBin<VAL_T>* bin_data_; const DenseBin<VAL_T>* bin_data_;
VAL_T min_bin_; VAL_T min_bin_;
VAL_T max_bin_; VAL_T max_bin_;
...@@ -41,7 +42,7 @@ private: ...@@ -41,7 +42,7 @@ private:
*/ */
template <typename VAL_T> template <typename VAL_T>
class DenseBin: public Bin { class DenseBin: public Bin {
public: public:
friend DenseBinIterator<VAL_T>; friend DenseBinIterator<VAL_T>;
DenseBin(data_size_t num_data) DenseBin(data_size_t num_data)
: num_data_(num_data), data_(num_data_, static_cast<VAL_T>(0)) { : num_data_(num_data), data_(num_data_, static_cast<VAL_T>(0)) {
...@@ -310,7 +311,7 @@ public: ...@@ -310,7 +311,7 @@ public:
return sizeof(VAL_T) * num_data_; return sizeof(VAL_T) * num_data_;
} }
protected: protected:
data_size_t num_data_; data_size_t num_data_;
std::vector<VAL_T> data_; std::vector<VAL_T> data_;
}; };
......
...@@ -12,7 +12,7 @@ namespace LightGBM { ...@@ -12,7 +12,7 @@ namespace LightGBM {
class Dense4bitsBin; class Dense4bitsBin;
class Dense4bitsBinIterator : public BinIterator { class Dense4bitsBinIterator : public BinIterator {
public: public:
explicit Dense4bitsBinIterator(const Dense4bitsBin* bin_data, uint32_t min_bin, uint32_t max_bin, uint32_t default_bin) explicit Dense4bitsBinIterator(const Dense4bitsBin* bin_data, uint32_t min_bin, uint32_t max_bin, uint32_t default_bin)
: bin_data_(bin_data), min_bin_(static_cast<uint8_t>(min_bin)), : bin_data_(bin_data), min_bin_(static_cast<uint8_t>(min_bin)),
max_bin_(static_cast<uint8_t>(max_bin)), max_bin_(static_cast<uint8_t>(max_bin)),
...@@ -26,7 +26,8 @@ public: ...@@ -26,7 +26,8 @@ public:
inline uint32_t RawGet(data_size_t idx) override; inline uint32_t RawGet(data_size_t idx) override;
inline uint32_t Get(data_size_t idx) override; inline uint32_t Get(data_size_t idx) override;
inline void Reset(data_size_t) override {} inline void Reset(data_size_t) override {}
private:
private:
const Dense4bitsBin* bin_data_; const Dense4bitsBin* bin_data_;
uint8_t min_bin_; uint8_t min_bin_;
uint8_t max_bin_; uint8_t max_bin_;
...@@ -35,7 +36,7 @@ private: ...@@ -35,7 +36,7 @@ private:
}; };
class Dense4bitsBin : public Bin { class Dense4bitsBin : public Bin {
public: public:
friend Dense4bitsBinIterator; friend Dense4bitsBinIterator;
Dense4bitsBin(data_size_t num_data) Dense4bitsBin(data_size_t num_data)
: num_data_(num_data) { : num_data_(num_data) {
...@@ -362,7 +363,7 @@ public: ...@@ -362,7 +363,7 @@ public:
return sizeof(uint8_t) * data_.size(); return sizeof(uint8_t) * data_.size();
} }
protected: protected:
data_size_t num_data_; data_size_t num_data_;
std::vector<uint8_t> data_; std::vector<uint8_t> data_;
std::vector<uint8_t> buf_; std::vector<uint8_t> buf_;
......
...@@ -42,7 +42,7 @@ struct LocalFile : VirtualFileReader, VirtualFileWriter { ...@@ -42,7 +42,7 @@ struct LocalFile : VirtualFileReader, VirtualFileWriter {
return fwrite(buffer, bytes, 1, file_) == 1 ? bytes : 0; return fwrite(buffer, bytes, 1, file_) == 1 ? bytes : 0;
} }
private: private:
FILE* file_ = NULL; FILE* file_ = NULL;
const std::string filename_; const std::string filename_;
const std::string mode_; const std::string mode_;
...@@ -86,7 +86,7 @@ struct HDFSFile : VirtualFileReader, VirtualFileWriter { ...@@ -86,7 +86,7 @@ struct HDFSFile : VirtualFileReader, VirtualFileWriter {
return FileOperation<const void*>(data, bytes, &hdfsWrite); return FileOperation<const void*>(data, bytes, &hdfsWrite);
} }
private: private:
template <typename BufferType> template <typename BufferType>
using fileOp = tSize(*)(hdfsFS, hdfsFile, BufferType, tSize); using fileOp = tSize(*)(hdfsFS, hdfsFile, BufferType, tSize);
......
...@@ -147,7 +147,7 @@ void Json::dump(string &out) const { ...@@ -147,7 +147,7 @@ void Json::dump(string &out) const {
template <Json::Type tag, typename T> template <Json::Type tag, typename T>
class Value : public JsonValue { class Value : public JsonValue {
protected: protected:
// Constructors // Constructors
explicit Value(const T &value) : m_value(value) {} explicit Value(const T &value) : m_value(value) {}
explicit Value(T &&value) : m_value(move(value)) {} explicit Value(T &&value) : m_value(move(value)) {}
...@@ -174,7 +174,7 @@ class JsonDouble final : public Value<Json::NUMBER, double> { ...@@ -174,7 +174,7 @@ class JsonDouble final : public Value<Json::NUMBER, double> {
int int_value() const override { return static_cast<int>(m_value); } int int_value() const override { return static_cast<int>(m_value); }
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
bool less(const JsonValue * other) const override { return m_value < other->number_value(); } bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
public: public:
explicit JsonDouble(double value) : Value(value) {} explicit JsonDouble(double value) : Value(value) {}
}; };
...@@ -183,19 +183,19 @@ class JsonInt final : public Value<Json::NUMBER, int> { ...@@ -183,19 +183,19 @@ class JsonInt final : public Value<Json::NUMBER, int> {
int int_value() const override { return m_value; } int int_value() const override { return m_value; }
bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } bool equals(const JsonValue * other) const override { return m_value == other->number_value(); }
bool less(const JsonValue * other) const override { return m_value < other->number_value(); } bool less(const JsonValue * other) const override { return m_value < other->number_value(); }
public: public:
explicit JsonInt(int value) : Value(value) {} explicit JsonInt(int value) : Value(value) {}
}; };
class JsonBoolean final : public Value<Json::BOOL, bool> { class JsonBoolean final : public Value<Json::BOOL, bool> {
bool bool_value() const override { return m_value; } bool bool_value() const override { return m_value; }
public: public:
explicit JsonBoolean(bool value) : Value(value) {} explicit JsonBoolean(bool value) : Value(value) {}
}; };
class JsonString final : public Value<Json::STRING, string> { class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; } const string &string_value() const override { return m_value; }
public: public:
explicit JsonString(const string &value) : Value(value) {} explicit JsonString(const string &value) : Value(value) {}
explicit JsonString(string &&value) : Value(move(value)) {} explicit JsonString(string &&value) : Value(move(value)) {}
}; };
...@@ -203,7 +203,7 @@ public: ...@@ -203,7 +203,7 @@ public:
class JsonArray final : public Value<Json::ARRAY, Json::array> { class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json::array &array_items() const override { return m_value; } const Json::array &array_items() const override { return m_value; }
const Json & operator[](size_t i) const override; const Json & operator[](size_t i) const override;
public: public:
explicit JsonArray(const Json::array &value) : Value(value) {} explicit JsonArray(const Json::array &value) : Value(value) {}
explicit JsonArray(Json::array &&value) : Value(move(value)) {} explicit JsonArray(Json::array &&value) : Value(move(value)) {}
}; };
...@@ -211,13 +211,13 @@ public: ...@@ -211,13 +211,13 @@ public:
class JsonObject final : public Value<Json::OBJECT, Json::object> { class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json::object &object_items() const override { return m_value; } const Json::object &object_items() const override { return m_value; }
const Json & operator[](const string &key) const override; const Json & operator[](const string &key) const override;
public: public:
explicit JsonObject(const Json::object &value) : Value(value) {} explicit JsonObject(const Json::object &value) : Value(value) {}
explicit JsonObject(Json::object &&value) : Value(move(value)) {} explicit JsonObject(Json::object &&value) : Value(move(value)) {}
}; };
class JsonNull final : public Value<Json::NUL, NullStruct> { class JsonNull final : public Value<Json::NUL, NullStruct> {
public: public:
JsonNull() : Value({}) {} JsonNull() : Value({}) {}
}; };
......
...@@ -24,7 +24,7 @@ namespace LightGBM { ...@@ -24,7 +24,7 @@ namespace LightGBM {
*/ */
template <typename VAL_T> template <typename VAL_T>
class OrderedSparseBin: public OrderedBin { class OrderedSparseBin: public OrderedBin {
public: public:
/*! \brief Pair to store one bin entry */ /*! \brief Pair to store one bin entry */
struct SparsePair { struct SparsePair {
data_size_t ridx; // data(row) index data_size_t ridx; // data(row) index
...@@ -192,7 +192,7 @@ public: ...@@ -192,7 +192,7 @@ public:
/*! \brief Disable copy */ /*! \brief Disable copy */
OrderedSparseBin<VAL_T>(const OrderedSparseBin<VAL_T>&) = delete; OrderedSparseBin<VAL_T>(const OrderedSparseBin<VAL_T>&) = delete;
private: private:
const SparseBin<VAL_T>* bin_data_; const SparseBin<VAL_T>* bin_data_;
/*! \brief Store non-zero pair , group by leaf */ /*! \brief Store non-zero pair , group by leaf */
std::vector<SparsePair> ordered_pair_; std::vector<SparsePair> ordered_pair_;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace LightGBM { namespace LightGBM {
class CSVParser: public Parser { class CSVParser: public Parser {
public: public:
explicit CSVParser(int label_idx, int total_columns) explicit CSVParser(int label_idx, int total_columns)
:label_idx_(label_idx), total_columns_(total_columns) { :label_idx_(label_idx), total_columns_(total_columns) {
} }
...@@ -45,13 +45,13 @@ public: ...@@ -45,13 +45,13 @@ public:
return total_columns_; return total_columns_;
} }
private: private:
int label_idx_ = 0; int label_idx_ = 0;
int total_columns_ = -1; int total_columns_ = -1;
}; };
class TSVParser: public Parser { class TSVParser: public Parser {
public: public:
explicit TSVParser(int label_idx, int total_columns) explicit TSVParser(int label_idx, int total_columns)
:label_idx_(label_idx), total_columns_(total_columns) { :label_idx_(label_idx), total_columns_(total_columns) {
} }
...@@ -81,13 +81,13 @@ public: ...@@ -81,13 +81,13 @@ public:
return total_columns_; return total_columns_;
} }
private: private:
int label_idx_ = 0; int label_idx_ = 0;
int total_columns_ = -1; int total_columns_ = -1;
}; };
class LibSVMParser: public Parser { class LibSVMParser: public Parser {
public: public:
explicit LibSVMParser(int label_idx) explicit LibSVMParser(int label_idx)
:label_idx_(label_idx) { :label_idx_(label_idx) {
if (label_idx > 0) { if (label_idx > 0) {
...@@ -121,7 +121,7 @@ public: ...@@ -121,7 +121,7 @@ public:
return -1; return -1;
} }
private: private:
int label_idx_ = 0; int label_idx_ = 0;
}; };
......
...@@ -20,7 +20,7 @@ const size_t kNumFastIndex = 64; ...@@ -20,7 +20,7 @@ const size_t kNumFastIndex = 64;
template <typename VAL_T> template <typename VAL_T>
class SparseBinIterator: public BinIterator { class SparseBinIterator: public BinIterator {
public: public:
SparseBinIterator(const SparseBin<VAL_T>* bin_data, SparseBinIterator(const SparseBin<VAL_T>* bin_data,
uint32_t min_bin, uint32_t max_bin, uint32_t default_bin) uint32_t min_bin, uint32_t max_bin, uint32_t default_bin)
: bin_data_(bin_data), min_bin_(static_cast<VAL_T>(min_bin)), : bin_data_(bin_data), min_bin_(static_cast<VAL_T>(min_bin)),
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
inline void Reset(data_size_t idx) override; inline void Reset(data_size_t idx) override;
private: private:
const SparseBin<VAL_T>* bin_data_; const SparseBin<VAL_T>* bin_data_;
data_size_t cur_pos_; data_size_t cur_pos_;
data_size_t i_delta_; data_size_t i_delta_;
...@@ -67,7 +67,7 @@ class OrderedSparseBin; ...@@ -67,7 +67,7 @@ class OrderedSparseBin;
template <typename VAL_T> template <typename VAL_T>
class SparseBin: public Bin { class SparseBin: public Bin {
public: public:
friend class SparseBinIterator<VAL_T>; friend class SparseBinIterator<VAL_T>;
friend class OrderedSparseBin<VAL_T>; friend class OrderedSparseBin<VAL_T>;
...@@ -407,7 +407,7 @@ public: ...@@ -407,7 +407,7 @@ public:
GetFastIndex(); GetFastIndex();
} }
protected: protected:
data_size_t num_data_; data_size_t num_data_;
std::vector<uint8_t> deltas_; std::vector<uint8_t> deltas_;
std::vector<VAL_T> vals_; std::vector<VAL_T> vals_;
......
...@@ -18,7 +18,7 @@ namespace LightGBM { ...@@ -18,7 +18,7 @@ namespace LightGBM {
*/ */
template<typename PointWiseLossCalculator> template<typename PointWiseLossCalculator>
class BinaryMetric: public Metric { class BinaryMetric: public Metric {
public: public:
explicit BinaryMetric(const Config&) { explicit BinaryMetric(const Config&) {
} }
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
return std::vector<double>(1, loss); return std::vector<double>(1, loss);
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
...@@ -109,7 +109,7 @@ private: ...@@ -109,7 +109,7 @@ private:
* \brief Log loss metric for binary classification task. * \brief Log loss metric for binary classification task.
*/ */
class BinaryLoglossMetric: public BinaryMetric<BinaryLoglossMetric> { class BinaryLoglossMetric: public BinaryMetric<BinaryLoglossMetric> {
public: public:
explicit BinaryLoglossMetric(const Config& config) :BinaryMetric<BinaryLoglossMetric>(config) {} explicit BinaryLoglossMetric(const Config& config) :BinaryMetric<BinaryLoglossMetric>(config) {}
inline static double LossOnPoint(label_t label, double prob) { inline static double LossOnPoint(label_t label, double prob) {
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
* \brief Error rate metric for binary classification task. * \brief Error rate metric for binary classification task.
*/ */
class BinaryErrorMetric: public BinaryMetric<BinaryErrorMetric> { class BinaryErrorMetric: public BinaryMetric<BinaryErrorMetric> {
public: public:
explicit BinaryErrorMetric(const Config& config) :BinaryMetric<BinaryErrorMetric>(config) {} explicit BinaryErrorMetric(const Config& config) :BinaryMetric<BinaryErrorMetric>(config) {}
inline static double LossOnPoint(label_t label, double prob) { inline static double LossOnPoint(label_t label, double prob) {
...@@ -153,7 +153,7 @@ public: ...@@ -153,7 +153,7 @@ public:
* \brief Auc Metric for binary classification task. * \brief Auc Metric for binary classification task.
*/ */
class AUCMetric: public Metric { class AUCMetric: public Metric {
public: public:
explicit AUCMetric(const Config&) { explicit AUCMetric(const Config&) {
} }
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
return std::vector<double>(1, auc); return std::vector<double>(1, auc);
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace LightGBM { namespace LightGBM {
class MapMetric:public Metric { class MapMetric:public Metric {
public: public:
explicit MapMetric(const Config& config) { explicit MapMetric(const Config& config) {
// get eval position // get eval position
eval_at_ = config.eval_at; eval_at_ = config.eval_at;
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
return result; return result;
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
......
...@@ -14,7 +14,7 @@ namespace LightGBM { ...@@ -14,7 +14,7 @@ namespace LightGBM {
*/ */
template<typename PointWiseLossCalculator> template<typename PointWiseLossCalculator>
class MulticlassMetric: public Metric { class MulticlassMetric: public Metric {
public: public:
explicit MulticlassMetric(const Config& config) { explicit MulticlassMetric(const Config& config) {
num_class_ = config.num_class; num_class_ = config.num_class;
} }
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
return std::vector<double>(1, loss); return std::vector<double>(1, loss);
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
...@@ -128,7 +128,7 @@ private: ...@@ -128,7 +128,7 @@ private:
/*! \brief L2 loss for multiclass task */ /*! \brief L2 loss for multiclass task */
class MultiErrorMetric: public MulticlassMetric<MultiErrorMetric> { class MultiErrorMetric: public MulticlassMetric<MultiErrorMetric> {
public: public:
explicit MultiErrorMetric(const Config& config) :MulticlassMetric<MultiErrorMetric>(config) {} explicit MultiErrorMetric(const Config& config) :MulticlassMetric<MultiErrorMetric>(config) {}
inline static double LossOnPoint(label_t label, std::vector<double>& score) { inline static double LossOnPoint(label_t label, std::vector<double>& score) {
...@@ -148,7 +148,7 @@ public: ...@@ -148,7 +148,7 @@ public:
/*! \brief Logloss for multiclass task */ /*! \brief Logloss for multiclass task */
class MultiSoftmaxLoglossMetric: public MulticlassMetric<MultiSoftmaxLoglossMetric> { class MultiSoftmaxLoglossMetric: public MulticlassMetric<MultiSoftmaxLoglossMetric> {
public: public:
explicit MultiSoftmaxLoglossMetric(const Config& config) :MulticlassMetric<MultiSoftmaxLoglossMetric>(config) {} explicit MultiSoftmaxLoglossMetric(const Config& config) :MulticlassMetric<MultiSoftmaxLoglossMetric>(config) {}
inline static double LossOnPoint(label_t label, std::vector<double>& score) { inline static double LossOnPoint(label_t label, std::vector<double>& score) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace LightGBM { namespace LightGBM {
class NDCGMetric:public Metric { class NDCGMetric:public Metric {
public: public:
explicit NDCGMetric(const Config& config) { explicit NDCGMetric(const Config& config) {
// get eval position // get eval position
eval_at_ = config.eval_at; eval_at_ = config.eval_at;
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
return result; return result;
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
......
...@@ -14,7 +14,7 @@ namespace LightGBM { ...@@ -14,7 +14,7 @@ namespace LightGBM {
*/ */
template<typename PointWiseLossCalculator> template<typename PointWiseLossCalculator>
class RegressionMetric: public Metric { class RegressionMetric: public Metric {
public: public:
explicit RegressionMetric(const Config& config) :config_(config) { explicit RegressionMetric(const Config& config) :config_(config) {
} }
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
inline static void CheckLabel(label_t) { inline static void CheckLabel(label_t) {
} }
private: private:
/*! \brief Number of data */ /*! \brief Number of data */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer of label */ /*! \brief Pointer of label */
...@@ -111,7 +111,7 @@ private: ...@@ -111,7 +111,7 @@ private:
/*! \brief RMSE loss for regression task */ /*! \brief RMSE loss for regression task */
class RMSEMetric: public RegressionMetric<RMSEMetric> { class RMSEMetric: public RegressionMetric<RMSEMetric> {
public: public:
explicit RMSEMetric(const Config& config) :RegressionMetric<RMSEMetric>(config) {} explicit RMSEMetric(const Config& config) :RegressionMetric<RMSEMetric>(config) {}
inline static double LossOnPoint(label_t label, double score, const Config&) { inline static double LossOnPoint(label_t label, double score, const Config&) {
...@@ -130,7 +130,7 @@ public: ...@@ -130,7 +130,7 @@ public:
/*! \brief L2 loss for regression task */ /*! \brief L2 loss for regression task */
class L2Metric: public RegressionMetric<L2Metric> { class L2Metric: public RegressionMetric<L2Metric> {
public: public:
explicit L2Metric(const Config& config) :RegressionMetric<L2Metric>(config) {} explicit L2Metric(const Config& config) :RegressionMetric<L2Metric>(config) {}
inline static double LossOnPoint(label_t label, double score, const Config&) { inline static double LossOnPoint(label_t label, double score, const Config&) {
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
/*! \brief L2 loss for regression task */ /*! \brief L2 loss for regression task */
class QuantileMetric : public RegressionMetric<QuantileMetric> { class QuantileMetric : public RegressionMetric<QuantileMetric> {
public: public:
explicit QuantileMetric(const Config& config) :RegressionMetric<QuantileMetric>(config) { explicit QuantileMetric(const Config& config) :RegressionMetric<QuantileMetric>(config) {
} }
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
/*! \brief L1 loss for regression task */ /*! \brief L1 loss for regression task */
class L1Metric: public RegressionMetric<L1Metric> { class L1Metric: public RegressionMetric<L1Metric> {
public: public:
explicit L1Metric(const Config& config) :RegressionMetric<L1Metric>(config) {} explicit L1Metric(const Config& config) :RegressionMetric<L1Metric>(config) {}
inline static double LossOnPoint(label_t label, double score, const Config&) { inline static double LossOnPoint(label_t label, double score, const Config&) {
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
/*! \brief Huber loss for regression task */ /*! \brief Huber loss for regression task */
class HuberLossMetric: public RegressionMetric<HuberLossMetric> { class HuberLossMetric: public RegressionMetric<HuberLossMetric> {
public: public:
explicit HuberLossMetric(const Config& config) :RegressionMetric<HuberLossMetric>(config) { explicit HuberLossMetric(const Config& config) :RegressionMetric<HuberLossMetric>(config) {
} }
...@@ -199,7 +199,7 @@ public: ...@@ -199,7 +199,7 @@ public:
/*! \brief Fair loss for regression task */ /*! \brief Fair loss for regression task */
// http://research.microsoft.com/en-us/um/people/zhang/INRIA/Publis/Tutorial-Estim/node24.html // http://research.microsoft.com/en-us/um/people/zhang/INRIA/Publis/Tutorial-Estim/node24.html
class FairLossMetric: public RegressionMetric<FairLossMetric> { class FairLossMetric: public RegressionMetric<FairLossMetric> {
public: public:
explicit FairLossMetric(const Config& config) :RegressionMetric<FairLossMetric>(config) { explicit FairLossMetric(const Config& config) :RegressionMetric<FairLossMetric>(config) {
} }
...@@ -216,7 +216,7 @@ public: ...@@ -216,7 +216,7 @@ public:
/*! \brief Poisson regression loss for regression task */ /*! \brief Poisson regression loss for regression task */
class PoissonMetric: public RegressionMetric<PoissonMetric> { class PoissonMetric: public RegressionMetric<PoissonMetric> {
public: public:
explicit PoissonMetric(const Config& config) :RegressionMetric<PoissonMetric>(config) { explicit PoissonMetric(const Config& config) :RegressionMetric<PoissonMetric>(config) {
} }
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
/*! \brief Mape regression loss for regression task */ /*! \brief Mape regression loss for regression task */
class MAPEMetric : public RegressionMetric<MAPEMetric> { class MAPEMetric : public RegressionMetric<MAPEMetric> {
public: public:
explicit MAPEMetric(const Config& config) :RegressionMetric<MAPEMetric>(config) { explicit MAPEMetric(const Config& config) :RegressionMetric<MAPEMetric>(config) {
} }
...@@ -248,7 +248,7 @@ public: ...@@ -248,7 +248,7 @@ public:
}; };
class GammaMetric : public RegressionMetric<GammaMetric> { class GammaMetric : public RegressionMetric<GammaMetric> {
public: public:
explicit GammaMetric(const Config& config) :RegressionMetric<GammaMetric>(config) { explicit GammaMetric(const Config& config) :RegressionMetric<GammaMetric>(config) {
} }
...@@ -271,7 +271,7 @@ public: ...@@ -271,7 +271,7 @@ public:
class GammaDevianceMetric : public RegressionMetric<GammaDevianceMetric> { class GammaDevianceMetric : public RegressionMetric<GammaDevianceMetric> {
public: public:
explicit GammaDevianceMetric(const Config& config) :RegressionMetric<GammaDevianceMetric>(config) { explicit GammaDevianceMetric(const Config& config) :RegressionMetric<GammaDevianceMetric>(config) {
} }
...@@ -292,7 +292,7 @@ public: ...@@ -292,7 +292,7 @@ public:
}; };
class TweedieMetric : public RegressionMetric<TweedieMetric> { class TweedieMetric : public RegressionMetric<TweedieMetric> {
public: public:
explicit TweedieMetric(const Config& config) :RegressionMetric<TweedieMetric>(config) { explicit TweedieMetric(const Config& config) :RegressionMetric<TweedieMetric>(config) {
} }
......
...@@ -65,7 +65,7 @@ namespace LightGBM { ...@@ -65,7 +65,7 @@ namespace LightGBM {
// CrossEntropyMetric : "xentropy" : (optional) weights are used linearly // CrossEntropyMetric : "xentropy" : (optional) weights are used linearly
// //
class CrossEntropyMetric : public Metric { class CrossEntropyMetric : public Metric {
public: public:
explicit CrossEntropyMetric(const Config&) {} explicit CrossEntropyMetric(const Config&) {}
virtual ~CrossEntropyMetric() {} virtual ~CrossEntropyMetric() {}
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
return -1.0f; // negative means smaller loss is better, positive means larger loss is better return -1.0f; // negative means smaller loss is better, positive means larger loss is better
} }
private: private:
/*! \brief Number of data points */ /*! \brief Number of data points */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer to label */ /*! \brief Pointer to label */
...@@ -160,7 +160,7 @@ private: ...@@ -160,7 +160,7 @@ private:
// ATTENTION: Supposed to be used when the objective also is "xentlambda" // ATTENTION: Supposed to be used when the objective also is "xentlambda"
// //
class CrossEntropyLambdaMetric : public Metric { class CrossEntropyLambdaMetric : public Metric {
public: public:
explicit CrossEntropyLambdaMetric(const Config&) {} explicit CrossEntropyLambdaMetric(const Config&) {}
virtual ~CrossEntropyLambdaMetric() {} virtual ~CrossEntropyLambdaMetric() {}
...@@ -228,7 +228,7 @@ public: ...@@ -228,7 +228,7 @@ public:
return -1.0f; return -1.0f;
} }
private: private:
/*! \brief Number of data points */ /*! \brief Number of data points */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer to label */ /*! \brief Pointer to label */
...@@ -243,7 +243,7 @@ private: ...@@ -243,7 +243,7 @@ private:
// KullbackLeiblerDivergence : "kldiv" : (optional) weights are used linearly // KullbackLeiblerDivergence : "kldiv" : (optional) weights are used linearly
// //
class KullbackLeiblerDivergence : public Metric { class KullbackLeiblerDivergence : public Metric {
public: public:
explicit KullbackLeiblerDivergence(const Config&) {} explicit KullbackLeiblerDivergence(const Config&) {}
virtual ~KullbackLeiblerDivergence() {} virtual ~KullbackLeiblerDivergence() {}
...@@ -336,7 +336,7 @@ public: ...@@ -336,7 +336,7 @@ public:
return -1.0f; return -1.0f;
} }
private: private:
/*! \brief Number of data points */ /*! \brief Number of data points */
data_size_t num_data_; data_size_t num_data_;
/*! \brief Pointer to label */ /*! \brief Pointer to label */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment