Skip to content

Commit

Permalink
Cross validator entity: evaluate method now returns Future<Vector> in…
Browse files Browse the repository at this point in the history
…stead of double
  • Loading branch information
gyrdym committed Jun 21, 2020
1 parent bf0e5aa commit 5e06b60
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 14.0.0
- Breaking change:
- `CrossValidator`: `evalute` method's api changed, it returns a Future resolving with scores Vector now

## 13.10.0
- `LinearRegressor`:
- `Default constructor`: `collectLearningData` parameter added
Expand Down
26 changes: 13 additions & 13 deletions lib/src/model_selection/cross_validator/cross_validator.dart
Expand Up @@ -23,8 +23,8 @@ abstract class CrossValidator {
///
/// Parameters:
///
/// [samples] The whole training dataset to be split into parts to iteratively
/// evaluate given predictor on the each particular part
/// [samples] A dataset to be split into parts to iteratively evaluate given
/// predictor's performance
///
/// [targetColumnNames] Names of columns from [samples] that contain outcomes
///
Expand Down Expand Up @@ -57,8 +57,8 @@ abstract class CrossValidator {
///
/// Parameters:
///
/// [samples] The whole training dataset to be split into parts to iteratively
/// evaluate given model on the each particular part.
/// [samples] A dataset to be split into parts to iteratively
/// evaluate given predictor's performance
///
/// [targetColumnNames] Names of columns from [samples] that contain outcomes.
///
Expand All @@ -83,21 +83,21 @@ abstract class CrossValidator {
);
}

/// Returns a score of quality of passed predictor depending on given
/// [metricType]
/// Returns a future resolving with a vector of scores of quality of passed
/// predictor depending on given [metricType]
///
/// Parameters:
///
/// [predictorFactory] A factory function that returns a testing predictor
/// [predictorFactory] A factory function that returns an evaluating predictor
///
/// [metricType] Metric to assess a predictor, that is being created by
/// [metricType] Metric using to assess a predictor creating by
/// [predictorFactory]
///
/// [onDataSplit] A callback that is called when a new train-test split is
/// ready to be passed into evaluating predictor. One may place some
/// additional data-dependent logic here, e.g., data preprocessing. The
/// callback accepts train and test data from a new split and returns
/// transformed split as list, where the first element is training data and
/// transformed split as list, where the first element is train data and
/// the second one - test data, both of [DataFrame] type. This new transformed
/// split will be passed into the predictor.
///
Expand All @@ -115,24 +115,24 @@ abstract class CrossValidator {
/// header: header,
/// headerExists: false,
/// );
///
/// final predictorFactory = (trainData, _) =>
/// KnnRegressor(trainData, 'col_3', k: 4);
///
/// final onDataSplit = (trainData, testData) {
/// final standardizer = Standardizer(trainData);
/// return [
/// standardizer.process(trainData),
/// standardizer.process(testData),
/// ];
/// }
///
/// final validator = CrossValidator.kFold(data, ['col_3']);
/// final score = validator.evaluate(
/// final scores = await validator.evaluate(
/// predictorFactory,
/// MetricType.mape,
/// onDataSplit: onDataSplit,
/// );
/// final averageScore = scores.mean();
///
/// print(averageScore);
/// ````
Future<Vector> evaluate(
PredictorFactory predictorFactory,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: ml_algo
description: Machine learning algorithms written in native dart
version: 13.10.0
version: 14.0.0
homepage: https://github.com/gyrdym/ml_algo

environment:
Expand Down

0 comments on commit 5e06b60

Please sign in to comment.