Skip to content

Commit

Permalink
Java Comment Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Helw150 committed Sep 27, 2018
1 parent bc2620b commit 484d6db
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static Booster train(
IEvaluation eval,
int earlyStoppingRound,
Booster booster) throws XGBoostError {
if(eval != null) {
if (eval != null) {
return trainWithMultipleEvals(dtrain, params, round, watches, metrics, obj,
new IEvaluation[]{eval}, earlyStoppingRound, booster);
} else {
Expand All @@ -164,6 +164,13 @@ public static BoosterResults trainWithResults(
List<DMatrix> mats = new ArrayList<DMatrix>();
List<String> logLines = new ArrayList<String>();

if (evals != null && evals.length == 0) {
throw new XGBoostError("Evaluation function array is empty, but not null.");
} else if (earlyStoppingRound != 0 && evals != null && evals.length > 1) {
Rabit.trackerPrint("Multiple evaluation functions provided, disabling early stopping.");
earlyStoppingRound = 0;
}

for (Map.Entry<String, DMatrix> evalEntry : watches.entrySet()) {
names.add(evalEntry.getKey());
mats.add(evalEntry.getValue());
Expand Down Expand Up @@ -209,7 +216,7 @@ public static BoosterResults trainWithResults(
if (evalMats.length > 0) {
float[] metricsOut = new float[evalMats.length];
String evalInfo = "";
if (evals != null && evals.length > 0) {
if (evals != null) {
for (int i = 0; i < evals.length; i++) {
String evalLine = booster.evalSet(evalMats, evalNames, evals[i], metricsOut);
evalInfo = evalInfo + " " + evalLine;
Expand Down

0 comments on commit 484d6db

Please sign in to comment.