[ML] Train - added a test method for trained model
[platform/core/api/webapi-plugins.git] / src / ml / js / ml_trainer.js
index 4c3a841..f1e0712 100755 (executable)
@@ -430,6 +430,30 @@ Model.prototype.summarize = function() {
     return result.summary
 };
 
+/*
+Private method used for verification of training results.
+It returns true if the results match given values (with tolerance 1.0e-5), false otherwise.
+*/
+Model.prototype._checkMetrics = function (trainLoss, validLoss, validAccuracy) {
+    var callArgs = {
+        trainLoss: trainLoss, validLoss: validLoss, validAccuracy: validAccuracy,
+        id: this._id
+    }
+
+    var result = native_.callSync('MLTrainerModelCheckMetrics', callArgs);
+
+    if (native_.isFailure(result)) {
+        throw native_.getErrorObjectAndValidate(
+            result,
+            ValidBasicExceptions,
+            AbortError
+        );
+    }
+
+    return result.result
+};
+
+
 var ValidModelSaveExceptions = [
     'InvalidValuesError',
     'TypeMismatchError',