grizzly_distuv 1.0.0

  • Readme
  • Changelog
  • Installing
  • 54

DistUV #

Dart library to sample univariate random distributions and calculate its statistics.

  • [X] Beta
  • [X] Binomial
  • [X] Cauchy
  • [X] Chi-Square
  • [X] Exponential
  • [X] Gamma
  • [X] Geometric
  • [X] Normal
  • [ ] Pareto
  • [X] Student's T
  • [X] Uniform
  • [ ] Weibull
  • [ ] Beta
  • [ ] Logistic
  • [ ] Log-Normal
  • [ ] F
  • [ ] Laplace

Usage #

Statistics of a distribution #

  final beta = Beta(2.31, 0.627);
  print(beta.ppf(0.0));

Sample random number from normal distribution #

  for (int i = 0; i < 100; i++) print(randn);

Sample random number from custom normal distribution #

  final randnCust = normal(loc: 0.5);
  for (int i = 0; i < 100; i++) print(randnCust);

References #

  • Porting from Golang library prob

Changelog #

1.0.0 #

  • Package name change
  • Dart 2.0 improvements

0.0.1 #

  • Distributions incomplete
  • Uniform, standard normal, normal, exponential and standard exponential samplers

Use this package as a library

1. Depend on it

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


dependencies:
  grizzly_distuv: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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_distuv/grizzly_distuv.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
80
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
88
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14

Health suggestions

Fix lib/src/dists/dists.dart. (-7.71 points)

Analysis of lib/src/dists/dists.dart reported 16 hints, including:

line 69 col 41: Use = to separate a named parameter from its default value.

line 69 col 60: Use = to separate a named parameter from its default value.

line 74 col 44: Use = to separate a named parameter from its default value.

line 74 col 63: Use = to separate a named parameter from its default value.

line 79 col 41: Use = to separate a named parameter from its default value.

Fix lib/src/math/normal.dart. (-3.93 points)

Analysis of lib/src/math/normal.dart reported 8 hints, including:

line 22 col 28: Avoid const keyword.

line 30 col 28: Avoid const keyword.

line 45 col 28: Avoid const keyword.

line 57 col 28: Avoid const keyword.

line 73 col 28: Avoid const keyword.

Fix lib/src/math/lgamma.dart. (-3.45 points)

Analysis of lib/src/math/lgamma.dart reported 7 hints, including:

line 298 col 29: Avoid const keyword.

line 313 col 29: Avoid const keyword.

line 323 col 29: Avoid const keyword.

line 333 col 29: Avoid const keyword.

line 351 col 29: Avoid const keyword.

Fix additional 9 files with analysis or formatting issues. (-6.94 points)

Additional issues in the following files:

  • lib/src/sampler/sampler.dart (6 hints)
  • lib/src/math/beta.dart (4 hints)
  • lib/src/math/gamma.dart (3 hints)
  • lib/src/dists/student_t.dart (1 hint)
  • lib/src/dists/binomial.dart (Run dartfmt to format lib/src/dists/binomial.dart.)
  • lib/src/dists/cauchy.dart (Run dartfmt to format lib/src/dists/cauchy.dart.)
  • lib/src/dists/exponential.dart (Run dartfmt to format lib/src/dists/exponential.dart.)
  • lib/src/dists/gamma.dart (Run dartfmt to format lib/src/dists/gamma.dart.)
  • lib/src/dists/normal.dart (Run dartfmt to format lib/src/dists/normal.dart.)

Maintenance suggestions

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and grizzly_distuv.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
grizzly_array
grizzly_range ^2.0.6
test any