grizzly_regress 0.0.2-dev

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

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

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: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

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
31 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
82 / 100
Overall score:
Weighted score of the above. [more]
26
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:grizzly_regress/grizzly_regress.dart.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 31 errors 14 hints.

    Strong-mode analysis of lib/src/core/model.dart failed with the following error:

    line: 62 col: 2
    Undefined class 'Numeric2DView'.

    Strong-mode analysis of lib/src/core/result.dart failed with the following error:

    line: 16 col: 8
    Undefined class 'Numeric2DView'.

    Similar analysis of the following files failed:

    • lib/src/grizzly_regress_base.dart (error)
    • lib/src/linear/multivariate_ols.dart (error)
    • lib/src/linear/ols.dart (error)
    • lib/src/linear/ols_gd.dart (error)
  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
grizzly_linalg ^0.0.1-dev 0.0.2-dev 0.4.2
grizzly_series ^0.0.10-dev 0.0.23-dev 0.4.2
Transitive dependencies
grizzly_primitives 0.0.9 0.4.6
grizzly_scales 0.0.4-dev 0.0.6
meta 1.1.5