Skip to content

.NET Implementation of the T-Digest quantile estimation algorithm. Useful for calculating Quantiles or Percentiles from streaming data, or data-sets that are too large to store in memory and sort, which is required to calculate the true quantile.

License

Notifications You must be signed in to change notification settings

ASolomatin/T-Digest.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T-Digest.NET

NuGet NuGet downloads Tests Publish GitHub


.NET Implementation of the relatively new T-Digest quantile estimation algorithm. Useful for calculating highly accurate Quantiles or Percentiles from on-line streaming data, or data-sets that are too large to store in memory and sort, which is required to calculate the true quantile.

Fully refactored fork of quantumtunneling/T-Digest.NET with next changes:

  • Modern .NET frameworks support
  • Highly improved performance
  • A bit better accuracy

The Nuget package for this Implementation can be found here

The T-Digest white paper can be found here


Example Code:

    using TDigestNet;

    ...

    Random random = new();
    TDigest digest = new();

    for (int i = 0; i < 1000000; i++)
    {
        var n = random.NextDouble() * 100;
        digest.Add(n);
    }

    Console.WriteLine($"Average: {digest.Average}");
    Console.WriteLine($"Percentile 10: {digest.Quantile(10 / 100d)}");
    Console.WriteLine($"Percentile 50: {digest.Quantile(50 / 100d)}");
    Console.WriteLine($"Percentile 80: {digest.Quantile(80 / 100d)}");
    Console.WriteLine($"Percentile 99: {digest.Quantile(99 / 100d)}");

License

MIT

Copyright (C) 2023 Aleksej Solomatin

About

.NET Implementation of the T-Digest quantile estimation algorithm. Useful for calculating Quantiles or Percentiles from streaming data, or data-sets that are too large to store in memory and sort, which is required to calculate the true quantile.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages