@@ -9,26 +9,26 @@ import 'package:ml_algo/src/model_selection/split_indices_provider/split_indices
9
9
import 'package:ml_dataframe/ml_dataframe.dart' ;
10
10
import 'package:ml_linalg/linalg.dart' ;
11
11
12
- typedef PredictorFactory = Assessable Function (DataFrame observations);
12
+ typedef ModelFactory = Assessable Function (DataFrame observations);
13
13
14
14
typedef DataPreprocessFn = List <DataFrame > Function (
15
15
DataFrame trainData, DataFrame testData);
16
16
17
17
/// A factory and an interface for all the cross validator types
18
18
abstract class CrossValidator {
19
- /// Creates k-fold validator to evaluate quality of a predictor .
19
+ /// Creates a k-fold validator to evaluate the quality of a ML model .
20
20
///
21
- /// It splits a dataset into [numberOfFolds] test sets and subsequently
22
- /// evaluates given predictor on each produced test set
21
+ /// It splits a dataset into [numberOfFolds] test sets and evaluates a model
22
+ /// on each produced test set
23
23
///
24
24
/// Parameters:
25
25
///
26
- /// [samples] A dataset to be split into parts to iteratively evaluate given
27
- /// predictor 's performance
26
+ /// [samples] A dataset that is going to be split into [numberOfFolds] parts
27
+ /// to iteratively evaluate on them a model 's performance
28
28
///
29
- /// [numberOfFolds] Number of splits of the [samples]
29
+ /// [numberOfFolds] A number of parts of the [samples]
30
30
///
31
- /// [dtype] A type for all the numerical data
31
+ /// [dtype] A type for all numerical data
32
32
factory CrossValidator .kFold (
33
33
DataFrame samples, {
34
34
int numberOfFolds = 5 ,
@@ -49,17 +49,17 @@ abstract class CrossValidator {
49
49
);
50
50
}
51
51
52
- /// Creates LPO validator to evaluate performance of a predictor .
52
+ /// Creates a LPO validator to evaluate the quality of a ML model .
53
53
///
54
- /// It splits a dataset into all possible test sets of size [p] and
55
- /// subsequently evaluates quality of the predictor on each produced test set.
54
+ /// It splits a dataset into all possible test sets of size [p] and evaluates
55
+ /// the quality of a model on each produced test set.
56
56
///
57
57
/// Parameters:
58
58
///
59
- /// [samples] A dataset to be split into parts to iteratively
60
- /// evaluate given predictor 's performance
59
+ /// [samples] A dataset that is going to be split into parts to iteratively
60
+ /// evaluate on them a model 's performance
61
61
///
62
- /// [p] Size of a split of [samples] .
62
+ /// [p] A size of a part of [samples] in rows .
63
63
///
64
64
/// [dtype] A type for all the numerical data.
65
65
factory CrossValidator .lpo (
@@ -81,29 +81,27 @@ abstract class CrossValidator {
81
81
);
82
82
}
83
83
84
- /// Returns a future resolving with a vector of scores of quality of passed
85
- /// predictor depending on given [metricType]
84
+ /// Returns a future that is resolved with a vector of scores of quality of a
85
+ /// model depending on given [metricType]
86
86
///
87
87
/// Parameters:
88
88
///
89
- /// [predictorFactory ] A factory function that returns an evaluating predictor
89
+ /// [createModel ] A function that returns a model to be evaluated
90
90
///
91
- /// [metricType] Metric using to assess a predictor creating by
92
- /// [predictorFactory]
91
+ /// [metricType] A metric used to assess a model created by [createModel]
93
92
///
94
93
/// [onDataSplit] A callback that is called when a new train-test split is
95
- /// ready to be passed into evaluating predictor . One may place some
96
- /// additional data-dependent logic here, e.g., data preprocessing. The
97
- /// callback accepts train and test data from a new split and returns
98
- /// transformed split as list, where the first element is train data and
99
- /// the second one - test data, both of [DataFrame] type. This new transformed
100
- /// split will be passed into the predictor.
94
+ /// ready to be passed into a model . One may place some additional
95
+ /// data-dependent logic here, e.g., data preprocessing. The callback accepts
96
+ /// train and test data from a new split and returns a transformed split as a
97
+ /// list, where the first element is train data and the second one is test
98
+ /// data, both of [DataFrame] type. This new transformed split will be passed
99
+ /// into the model
101
100
///
102
101
/// Example:
103
102
///
104
103
/// ````dart
105
- /// final data = DataFrame(
106
- /// <Iterable<num>>[
104
+ /// final data = DataFrame([
107
105
/// [ 1, 1, 1, 1],
108
106
/// [ 2, 3, 4, 5],
109
107
/// [18, 71, 15, 61],
@@ -113,7 +111,7 @@ abstract class CrossValidator {
113
111
/// header: header,
114
112
/// headerExists: false,
115
113
/// );
116
- /// final predictorFactory = (trainData) =>
114
+ /// final modelFactory = (trainData) =>
117
115
/// KnnRegressor(trainData, 'col_3', k: 4);
118
116
/// final onDataSplit = (trainData, testData) {
119
117
/// final standardizer = Standardizer(trainData);
@@ -124,7 +122,7 @@ abstract class CrossValidator {
124
122
/// }
125
123
/// final validator = CrossValidator.kFold(data);
126
124
/// final scores = await validator.evaluate(
127
- /// predictorFactory ,
125
+ /// modelFactory ,
128
126
/// MetricType.mape,
129
127
/// onDataSplit: onDataSplit,
130
128
/// );
@@ -133,7 +131,7 @@ abstract class CrossValidator {
133
131
/// print(averageScore);
134
132
/// ````
135
133
Future <Vector > evaluate (
136
- PredictorFactory predictorFactory ,
134
+ ModelFactory createModel ,
137
135
MetricType metricType, {
138
136
DataPreprocessFn ? onDataSplit,
139
137
});
0 commit comments