ml_preprocessing 1.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

Build Status pub package Gitter Chat

ml_preprocessing #

Implementation of popular data preprocessing algorithms for Machine learning

The library contains:

  • A data container Float32x4CsvMlData. This entity makes work with csv data easier: you just need to point, where your dataset resides and then get features and labels in convenient data science friendly format. As you see, the data container converts data into sequence of numbers of Float32x4 type, which makes machine learning process faster;

  • Intercept preprocessor Float32x4nterceptPreprocessor This preprocessor adds an intercept to a given matrix. Intercept is a kind of 'bias' for hyperline equation.

Changelog #

1.1.0 #

  • Float32x4InterceptPreprocessor added
  • readme updated

1.0.0 #

  • Package published

example/main.dart

import 'dart:async';

import 'package:ml_preprocessing/categorical_data_encoder_type.dart';
import 'package:ml_preprocessing/float32x4_csv_ml_data.dart';
import 'package:tuple/tuple.dart';

Future main() async {
  // Let's create data container from the csv file,
  // `labelIdx: 3` means that the label (dependent variable in terms of Machine Learning) column of the dataset is its
  // third column
  // `headerExists: true` means, that our csv-file has a header row
  // `categoryNameToEncoder: {...}` means, that we want to encode values of `position`-column with one-hot encoder
  // and column `country` will be encoded with Ordinal encoder
  // `rows: [Tuple2<int, int>(0, 6)]` means, that we want to read range of the csv's rows from 0 to 6th line
  // `columns: [Tuple2<int, int>(0, 3)]` means, that we want to read range of the csv's columns from 0 to third columns
  final data = Float32x4CsvMLData.fromFile('example/dataset.csv', labelIdx: 3,
    headerExists: true,
    categoryNameToEncoder: {
      'position': CategoricalDataEncoderType.oneHot,
      'country': CategoricalDataEncoderType.ordinal,
    },
    rows: [Tuple2<int, int>(0, 6)],
    columns: [Tuple2<int, int>(0, 3)],
  );

  // Let's read the header of the dataset, preprocessed features and labels
  final header = await data.header;
  final features = await data.features;
  final labels = await data.labels;

  // And print the result
  print(header);
  print(features);
  print(labels);

  // That's, actually, all you have to do to use data further in different applications (e.g., in Machine Learning)
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ml_preprocessing: ^1.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ml_preprocessing/categorical_data_encoder_type.dart';
import 'package:ml_preprocessing/encode_unknown_value_strategy.dart';
import 'package:ml_preprocessing/float32x4_csv_ml_data.dart';
import 'package:ml_preprocessing/float32x4_intercept_preprocessor.dart';
  
Version Uploaded Documentation Archive
1.1.0 Jan 25, 2019 Go to the documentation of ml_preprocessing 1.1.0 Download ml_preprocessing 1.1.0 archive
1.0.0 Jan 25, 2019 Go to the documentation of ml_preprocessing 1.0.0 Download ml_preprocessing 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Health suggestions

Format lib/float32x4_csv_ml_data.dart.

Run dartfmt to format lib/float32x4_csv_ml_data.dart.

Format lib/float32x4_intercept_preprocessor.dart.

Run dartfmt to format lib/float32x4_intercept_preprocessor.dart.

Format lib/src/categorical_encoder/encode_unknown_strategy_type.dart.

Run dartfmt to format lib/src/categorical_encoder/encode_unknown_strategy_type.dart.

Fix additional 28 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/categorical_encoder/encoder.dart (Run dartfmt to format lib/src/categorical_encoder/encoder.dart.)
  • lib/src/categorical_encoder/encoder_factory.dart (Run dartfmt to format lib/src/categorical_encoder/encoder_factory.dart.)
  • lib/src/categorical_encoder/encoder_type.dart (Run dartfmt to format lib/src/categorical_encoder/encoder_type.dart.)
  • lib/src/categorical_encoder/one_hot_encoder.dart (Run dartfmt to format lib/src/categorical_encoder/one_hot_encoder.dart.)
  • lib/src/categorical_encoder/ordinal_encoder.dart (Run dartfmt to format lib/src/categorical_encoder/ordinal_encoder.dart.)
  • lib/src/common/error_logger_mixin.dart (Run dartfmt to format lib/src/common/error_logger_mixin.dart.)
  • lib/src/intercept_preprocessor/float32x4_intercept_preprocessor.dart (Run dartfmt to format lib/src/intercept_preprocessor/float32x4_intercept_preprocessor.dart.)
  • lib/src/ml_data/encoders_processor/encoders_processor.dart (Run dartfmt to format lib/src/ml_data/encoders_processor/encoders_processor.dart.)
  • lib/src/ml_data/encoders_processor/encoders_processor_factory.dart (Run dartfmt to format lib/src/ml_data/encoders_processor/encoders_processor_factory.dart.)
  • lib/src/ml_data/encoders_processor/encoders_processor_factory_impl.dart (Run dartfmt to format lib/src/ml_data/encoders_processor/encoders_processor_factory_impl.dart.)
  • lib/src/ml_data/encoders_processor/encoders_processor_impl.dart (Run dartfmt to format lib/src/ml_data/encoders_processor/encoders_processor_impl.dart.)
  • lib/src/ml_data/features_extractor/features_extractor_factory.dart (Run dartfmt to format lib/src/ml_data/features_extractor/features_extractor_factory.dart.)
  • lib/src/ml_data/features_extractor/features_extractor_factory_impl.dart (Run dartfmt to format lib/src/ml_data/features_extractor/features_extractor_factory_impl.dart.)
  • lib/src/ml_data/features_extractor/features_extractor_impl.dart (Run dartfmt to format lib/src/ml_data/features_extractor/features_extractor_impl.dart.)
  • lib/src/ml_data/float32x4_csv_ml_data.dart (Run dartfmt to format lib/src/ml_data/float32x4_csv_ml_data.dart.)
  • lib/src/ml_data/header_extractor/header_extractor.dart (Run dartfmt to format lib/src/ml_data/header_extractor/header_extractor.dart.)
  • lib/src/ml_data/header_extractor/header_extractor_factory.dart (Run dartfmt to format lib/src/ml_data/header_extractor/header_extractor_factory.dart.)
  • lib/src/ml_data/header_extractor/header_extractor_factory_impl.dart (Run dartfmt to format lib/src/ml_data/header_extractor/header_extractor_factory_impl.dart.)
  • lib/src/ml_data/header_extractor/header_extractor_impl.dart (Run dartfmt to format lib/src/ml_data/header_extractor/header_extractor_impl.dart.)
  • lib/src/ml_data/labels_extractor/labels_extractor_factory.dart (Run dartfmt to format lib/src/ml_data/labels_extractor/labels_extractor_factory.dart.)
  • lib/src/ml_data/labels_extractor/labels_extractor_factory_impl.dart (Run dartfmt to format lib/src/ml_data/labels_extractor/labels_extractor_factory_impl.dart.)
  • lib/src/ml_data/labels_extractor/labels_extractor_impl.dart (Run dartfmt to format lib/src/ml_data/labels_extractor/labels_extractor_impl.dart.)
  • lib/src/ml_data/ml_data.dart (Run dartfmt to format lib/src/ml_data/ml_data.dart.)
  • lib/src/ml_data/read_mask_creator/read_mask_creator_factory.dart (Run dartfmt to format lib/src/ml_data/read_mask_creator/read_mask_creator_factory.dart.)
  • lib/src/ml_data/read_mask_creator/read_mask_creator_factory_impl.dart (Run dartfmt to format lib/src/ml_data/read_mask_creator/read_mask_creator_factory_impl.dart.)
  • lib/src/ml_data/read_mask_creator/read_mask_creator_impl.dart (Run dartfmt to format lib/src/ml_data/read_mask_creator/read_mask_creator_impl.dart.)
  • lib/src/ml_data/validator/error_messages.dart (Run dartfmt to format lib/src/ml_data/validator/error_messages.dart.)
  • lib/src/ml_data/validator/ml_data_params_validator_impl.dart (Run dartfmt to format lib/src/ml_data/validator/ml_data_params_validator_impl.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
csv ^4.0.0 4.0.1
logging ^0.11.3+2 0.11.3+2
ml_linalg ^4.0.0 4.2.0 5.3.0
tuple ^1.0.2 1.0.2
Transitive dependencies
matcher 0.12.4
meta 1.1.7
path 1.6.2
quiver 2.0.1
stack_trace 1.9.3
Dev dependencies
benchmark_harness >=1.0.0 <2.0.0
build_runner ^1.1.2
build_test ^0.10.2
mockito ^3.0.0
test ^1.2.0