Skip to content

Commit b6c5b70

Browse files
authored
Add cancellation checkpoint in logistic regression. (#3032)
* Add cancellation checkpoint in logistic regression. * Add checkpoint in LineSearch.Minimize()
1 parent 45b6c43 commit b6c5b70

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Microsoft.ML.StandardTrainers/Optimizer/Optimizer.cs

+1
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ public void Minimize(DifferentiableFunction function, ref VBuffer<float> initial
624624
state.UpdateDir();
625625
while (!finished)
626626
{
627+
Env.CheckAlive();
627628
bool success = state.LineSearch(ch, false);
628629
if (!success)
629630
{

src/Microsoft.ML.StandardTrainers/Standard/LogisticRegression/LbfgsPredictorBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ private protected virtual void TrainCore(IChannel ch, RoleMappedData data)
482482
e => e.SetProgress(0, exCount, totalCount));
483483
while (cursor.MoveNext())
484484
{
485+
Host.CheckAlive();
485486
WeightSum += cursor.Weight;
486487
if (ShowTrainingStats)
487488
ProcessPriorDistribution(cursor.Label, cursor.Weight);

0 commit comments

Comments
 (0)