/// <summary> /// Creates an error metric provider from an error metric descriptor /// </summary> /// <param name="type">The type of error metric</param> /// <returns></returns> public static IErrorMetric Create(this ErrorMetricType type) { switch (type) { case ErrorMetricType.OneHot: return(new OneHot()); case ErrorMetricType.RMSE: return(new RMSE()); case ErrorMetricType.BinaryClassification: return(new BinaryClassification()); case ErrorMetricType.CrossEntropy: return(new CrossEntropy()); case ErrorMetricType.Quadratic: return(new Quadratic()); case ErrorMetricType.None: return(null); } throw new NotImplementedException(); }
public ITrainingContext CreateTrainingContext(ErrorMetricType errorMetric, float learningRate, int batchSize) { return(new TrainingContext(learningRate, batchSize, errorMetric.Create())); }