Class Learner
Primary class for running model generators. It is designed to abstract the separation of training and test sets as well as best model selection.
Inheritance
Inherited Members
Namespace:numl
Assembly:numl.dll
Syntax
public static class Learner
Methods
View SourceBest(IEnumerable<LearningModel>, ScoringMetric)
Retrieve best model (or model with the highest accuracy)
Declaration
public static LearningModel Best(this IEnumerable<LearningModel> models, ScoringMetric metric = ScoringMetric.Accuracy)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<LearningModel> | models | List of models. |
ScoringMetric | metric | Scoring metric to use for model selection. |
Returns
Type | Description |
---|---|
LearningModel | Best Model. |
Learn(IEnumerable<Object>, Double, Int32, IGenerator)
Trains a single model based on a generator a predefined number of times with the provided examples and data split and selects the best (or most accurate) model.
Declaration
public static LearningModel Learn(IEnumerable<object> examples, double trainingPercentage, int repeat, IGenerator generator)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Object> | examples | Source data. |
System.Double | trainingPercentage | Data split percentage. |
System.Int32 | repeat | Number of repetitions per generator. |
IGenerator | generator | Model generator used. |
Returns
Type | Description |
---|---|
LearningModel | Best model for provided generator. |
Learn(IEnumerable<Object>, Double, Int32, IGenerator[])
Trains an arbitrary number of models on the provided examples by creating a separation of data based on training percentage. Each generator is rerun a predetermined amount of times.
Declaration
public static LearningModel[] Learn(IEnumerable<object> examples, double trainingPercentage, int repeat, params IGenerator[] generators)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Object> | examples | Source data. |
System.Double | trainingPercentage | Data split percentage. |
System.Int32 | repeat | Number of repetitions per generator. |
IGenerator[] | generators | Model generators used. |
Returns
Type | Description |
---|---|
LearningModel[] | Best models for each generator. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the requested operation is invalid. |