<commit_before>import 'dart:async';

import 'package:ml_algo/ml_algo.dart';
import 'package:tuple/tuple.dart';

Future main() async {
  final data = MLData.fromCsvFile('datasets/iris.csv',
    labelIdx: 5,
    columns: [const Tuple2<int, int>(1, 5)],
    encoderType: CategoricalDataEncoderType.ordinal,
    categories: {
      'Species': ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'],
    },
  );

  final features = await data.features;
  final labels = await data.labels;

  final validator = CrossValidator.kFold(numberOfFolds: 5);

  final softmaxRegressor = LinearClassifier.softmaxRegressor(
      initialLearningRate: 0.00053,
      iterationsLimit: 500,
      minWeightsUpdate: null,
      randomSeed: 46,
      learningRateType: LearningRateType.constant);

  final accuracy = validator.evaluate(
      softmaxRegressor, features, labels, MetricType.accuracy);

  print('Error is ${(accuracy * 100).toStringAsFixed(2)}%');
}<commit_msg>explaining text corrected in example<commit_after>import 'dart:async';

import 'package:ml_algo/ml_algo.dart';
import 'package:tuple/tuple.dart';

Future main() async {
  final data = MLData.fromCsvFile('datasets/iris.csv',
    labelIdx: 5,
    columns: [const Tuple2<int, int>(1, 5)],
    encoderType: CategoricalDataEncoderType.ordinal,
    categories: {
      'Species': ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'],
    },
  );

  final features = await data.features;
  final labels = await data.labels;

  final validator = CrossValidator.kFold(numberOfFolds: 5);

  final softmaxRegressor = LinearClassifier.softmaxRegressor(
      initialLearningRate: 0.00053,
      iterationsLimit: 500,
      minWeightsUpdate: null,
      randomSeed: 46,
      learningRateType: LearningRateType.constant);

  final accuracy = validator.evaluate(
      softmaxRegressor, features, labels, MetricType.accuracy);

  print('Accuracy is ${(accuracy * 100).toStringAsFixed(2)}%');
}
{'fraction_non_alphanumeric': 0.12525879917184266, 'fraction_numerical': 0.020703933747412008, 'mean_word_length': 4.354570637119114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5441891', 'n_tokens_mistral': 686, 'n_tokens_neox': 623, 'n_words': 128}