Skip to content

Commit

Permalink
Updates ModelEvaluator for increase robustness against exceptions dur…
Browse files Browse the repository at this point in the history
…ing model evaluation.
  • Loading branch information
gaizkan committed Jul 14, 2016
1 parent 4bffff4 commit 72bee39
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Examples/Evaluation/CSEvalClient/ModelEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ public static void DisposeAll()
public static bool Evaluate(string record)
{
var model = Models.Take();
var outcome = model.EvaluateRecord(record);
Models.Add(model);
return outcome;
try
{
var outcome = model.EvaluateRecord(record);
return outcome;
}
finally
{
Models.Add(model);
}
}

/// <summary>
Expand All @@ -123,9 +129,15 @@ public static bool Evaluate(string record)
public static List<float> Evaluate(List<float> inputs)
{
var model = Models.Take();
var outcome = model.EvaluateInput(inputs);
Models.Add(model);
return outcome;
try
{
var outcome = model.EvaluateInput(inputs);
return outcome;
}
finally
{
Models.Add(model);
}
}

/// <summary>
Expand Down

0 comments on commit 72bee39

Please sign in to comment.