grizzly_regress 0.0.2-dev

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

grizzly_regress

Regression models for Dart

TODO

  • [ ] Linear regression
    • [ ] OLS
      • [ ] Closed form
      • [ ] Gradient descent
    • [ ] WLS
    • [ ] GLS
    • [ ] Others
  • [ ] Linear regression result
    • [ ] R^2
    • [ ] R^2 adjusted
    • [ ] F-value
    • [ ] MSE
  • [ ] Logistic regression

Extra

  • [ ] Ensemble
  • [ ] Model selection
  • [ ] Plots

Changelog

0.0.2-dev

  • Separated linear algebra into its own package

0.0.1-dev

  • OLS implementation
  • RegressionResult implementation

example/grizzly_regress_example.dart

// Copyright (c) 2017, SERAGUD. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:grizzly_series/grizzly_series.dart';
import 'package:grizzly_regress/grizzly_regress.dart';
import 'package:grizzly_linalg/grizzly_linalg.dart';

main() {
  final a = array2D([
    [1, 0, 1],
    [-1, -2, 0],
    [0, 1, -1]
  ]);

  /*
  final a = array2D([
    [1, 2],
    [3, 4],
    [5, 6],
    [7, 8]
  ]);
  */

  final svd = new SVD(a);
  print(svd.u);
  print(svd.s);
  print(svd.v);
  print(svd.u *
      new Double2D.diagonal(svd.s) *
      svd.v.transpose);

  /* TODO
  final u = array2D([
    [-0.1525, -0.8226],
    [-0.3499, -0.4214],
    [-0.5474, -0.0201],
    [-0.7448, 0.3812]
  ]);
  final s = array2D([[14.2691, 0], [0, 0.6268]]);
  final v = array2D([[-0.6414, 0.7672], [-0.7672, -0.6414]]);
  print(u * s * v.transpose);
  */

  /*
  final x = new Int2D.columns([
    new List<int>.generate(100, (i) => i + 1),
  ]).toDouble;
  print(x);
  final y = (x * [5]).row.sum;
  print(y);
  */

  /*
  final res1 = new OLSGD().fitMultipleX(x, y);
  print(res1.coeff);
  print(res1.predict(x[0].toInt()));
  */

  /*
  final lst =
      new StochasticLeastSquareGradientDescent(x, y, maxIterations: 100);
  lst.learn();
  print(lst.params);
  */

  /*
  final x = array2D([
    [1, 2],
    [2, 3],
    [3, 4],
    [4, 5],
    [5, 6],
  ]);
  final y = (x * [5, 2]).row.sum + 7;
  print(y);
  final RegressionResult res = ols.fitMultipleX(x, y, fitIntercept: true);
  print(res.coeff);
  print(res.predict(x[0].toInt()));
  */

  /* TODO
  final xQR = qr(x);
  print(xQR.q);
  print(xQR.r);

  final LU xLU = lu(x);

  print(xLU.pivotMatrix);

  print(xLU.lowerFactor);

  print(xLU.upperFactor);

  print(xLU.pivotMatrix * xLU.lowerFactor * xLU.upperFactor);

  final b = solve(xQR.r, xQR.q.transpose * y.transpose);

  print(b);

  print(x * b);
  */

  /*
  final x = array2D([
    [1, 2],
    [2, 3],
    [3, 4],
    [4, 5],
    [5, 6],
  ]);

  final y = (x * [5, 2]).sumCol;
  print(y);

  final xQR = qr(x);
  print(xQR.q);
  print(xQR.r);
  print(xQR.rDiag);

  print(xQR.q.dot(xQR.r));

  print((xQR.q.transpose * y).transpose);

  final b = xQR.solve(y.transpose);
  print(b);
  print(x * b);
  */

  /*
  final x = new Double2DArray.fromNum([
    [1],
    [2],
    [3],
    [4],
    [5],
  ]);

  final y = x.col[0] * 5;
  print(y);

  final xQR = qr(x);
  print(xQR.q);
  print(xQR.r);

  print(xQR.q.dot(xQR.r));

  print(xQR.solve(y.transpose()));
  */

  /*
  print(array2D([
        [3.0, 1.0],
        [1.0, 2.0]
      ]) *
      array2D([
        [2.0],
        [3.0]
      ]));
      */
}

Use this package as a library

1. Depend on it

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


dependencies:
  grizzly_regress: ^0.0.2-dev

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:grizzly_regress/grizzly_regress.dart';
  
Version Uploaded Documentation Archive
0.0.2-dev Oct 21, 2017 Go to the documentation of grizzly_regress 0.0.2-dev Download grizzly_regress 0.0.2-dev archive
0.0.1-dev Oct 19, 2017 Go to the documentation of grizzly_regress 0.0.1-dev Download grizzly_regress 0.0.1-dev archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0