Skip to content

Commit

Permalink
all defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbkoch committed Dec 26, 2024
1 parent 8277bb0 commit 19f41ef
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions shared/libebm/tests/boosting_unusual_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2127,42 +2127,44 @@ static double RandomizedTesting(const AccelerationFlags acceleration) {
double validationMetricIteration = 0.0;
for(size_t iRound = 0; iRound < cRounds; ++iRound) {
for(IntEbm iTerm = 0; iTerm < static_cast<IntEbm>(terms.size()); ++iTerm) {
const IntEbm cRealBins = features[terms[iTerm][0]].CountRealBins();
const IntEbm cDimensions = terms[iTerm].size();

const TermBoostFlags boostFlags =
static_cast<TermBoostFlags>(ChooseAny(rng, boostFlagsAny) | ChooseFrom(rng, boostFlagsChoose));

const double learningRate = 0.015625;
const IntEbm minSamplesLeaf = TestRand(rng, 5) + 1;
const double minHessian = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
const double regAlpha = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
const double regLambda = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
const double maxDeltaStep = 0 == TestRand(rng, 5) ? 1.0 : 0.0;
const double categoricalSmoothing = 10.0;
const IntEbm maxCategoricalThreshold = 1 + TestRand(rng, cRealBins + 1);
const double categoricalInclusionPercent = 0 == TestRand(rng, 2) ? 0.75 : 1.0;

// we allow 1 cut more than the number of bins to test excessive leaves.
const IntEbm cLeaves = 1 + TestRand(rng, cRealBins + 1);
const std::vector<IntEbm> leaves(cDimensions, cLeaves);
const MonotoneDirection direction =
0 == TestRand(rng, 5) ? static_cast<MonotoneDirection>(TestRand(rng, 2) * 2 - 1) : 0;
const std::vector<MonotoneDirection> monotonicity(cDimensions, direction);

validationMetricIteration = test.Boost(iTerm,
boostFlags,
learningRate,
minSamplesLeaf,
minHessian,
regAlpha,
regLambda,
maxDeltaStep,
categoricalSmoothing,
maxCategoricalThreshold,
categoricalInclusionPercent,
leaves,
monotonicity)
//const IntEbm cRealBins = features[terms[iTerm][0]].CountRealBins();
//const IntEbm cDimensions = terms[iTerm].size();

//const TermBoostFlags boostFlags =
// static_cast<TermBoostFlags>(ChooseAny(rng, boostFlagsAny) | ChooseFrom(rng, boostFlagsChoose));

//const double learningRate = 0.015625;
//const IntEbm minSamplesLeaf = TestRand(rng, 5) + 1;
//const double minHessian = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
//const double regAlpha = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
//const double regLambda = 0 == TestRand(rng, 5) ? 0.015625 : 0.0;
//const double maxDeltaStep = 0 == TestRand(rng, 5) ? 1.0 : 0.0;
//const double categoricalSmoothing = 10.0;
//const IntEbm maxCategoricalThreshold = 1 + TestRand(rng, cRealBins + 1);
//const double categoricalInclusionPercent = 0 == TestRand(rng, 2) ? 0.75 : 1.0;

//// we allow 1 cut more than the number of bins to test excessive leaves.
//const IntEbm cLeaves = 1 + TestRand(rng, cRealBins + 1);
//const std::vector<IntEbm> leaves(cDimensions, cLeaves);
//const MonotoneDirection direction =
// 0 == TestRand(rng, 5) ? static_cast<MonotoneDirection>(TestRand(rng, 2) * 2 - 1) : 0;
//const std::vector<MonotoneDirection> monotonicity(cDimensions, direction);

validationMetricIteration = test.Boost(iTerm
// ,
//boostFlags,
//learningRate,
//minSamplesLeaf,
//minHessian,
//regAlpha,
//regLambda,
//maxDeltaStep,
//categoricalSmoothing,
//maxCategoricalThreshold,
//categoricalInclusionPercent,
//leaves,
//monotonicity
)
.validationMetric;
}
}
Expand All @@ -2179,10 +2181,8 @@ static double RandomizedTesting(const AccelerationFlags acceleration) {
}

TEST_CASE("stress test, boosting") {
const double expected = 26746562197367.172;

double validationMetricExact = RandomizedTesting(AccelerationFlags_NONE);
CHECK(validationMetricExact < 1e300);

double validationMetricSIMD = RandomizedTesting(AccelerationFlags_ALL);
RandomizedTesting(AccelerationFlags_ALL);
}

0 comments on commit 19f41ef

Please sign in to comment.