-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carlos Becker
committed
May 29, 2017
1 parent
3abff37
commit 1a8e807
Showing
10 changed files
with
285 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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 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 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,34 @@ | ||
#ifndef LIGHTGBM_PREDICTION_EARLY_STOP_H_ | ||
#define LIGHTGBM_PREDICTION_EARLY_STOP_H_ | ||
|
||
#include <functional> | ||
#include <string> | ||
|
||
#include <LightGBM/export.h> | ||
|
||
namespace LightGBM | ||
{ | ||
struct PredictionEarlyStopInstance | ||
{ | ||
/// Callback function type for early stopping. | ||
/// Takes current prediction and number of elements in prediction | ||
/// @returns true if prediction should stop according to criterion | ||
using FunctionType = std::function<bool(const double*, int)>; | ||
|
||
FunctionType callbackFunction; // callback function itself | ||
int roundPeriod; // call callbackFunction every `runPeriod` iterations | ||
}; | ||
|
||
struct PredictionEarlyStopConfig | ||
{ | ||
int roundPeriod; | ||
double marginThreshold; | ||
}; | ||
|
||
/// Create an early stopping algorithm of type `type`, with given roundPeriod and margin threshold | ||
LIGHTGBM_EXPORT PredictionEarlyStopInstance createPredictionEarlyStopInstance(const std::string& type, | ||
const PredictionEarlyStopConfig& config); | ||
|
||
} // namespace LightGBM | ||
|
||
#endif // LIGHTGBM_PREDICTION_EARLY_STOP_H_ |
This file contains 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 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 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 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
Oops, something went wrong.