Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MathNet.Numerics, embed the one class we actually used from it #211

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
| CsvHelper | [GitHub](https://github.com/JoshClose/CsvHelper) | MS-PL / Apache 2.0 | Enables reading/writing CSV files |
| [Equ](https://github.com/thedmi/Equ) | [GitHub](https://github.com/thedmi/Equ) | [MIT](https://opensource.org/licenses/MIT) | Simplifies object comparators |
| HIC.FAnsiSql | [GitHub](https://github.com/HicServices/FAnsiSql) | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.html) | DBMS abstraction layer |
| MathNet.Numerics | [GitHub](https://github.com/mathnet/mathnet-numerics)| [MIT](https://opensource.org/licenses/MIT) | Generate statistical distributions (e.g. Gaussian) for random data | |
| Microsoft.SourceLink.GitHub | [GitHub](https://github.com/dotnet/sourcelink) | [1.1.1](https://www.nuget.org/packages/Microsoft.SourceLink.GitHub/1.1.1) | [Apache License 2.0](https://github.com/dotnet/sourcelink/blob/master/License.txt) | Enables source debugging of project nuget package| |
| YamlDotNet | [GitHub](https://github.com/aaubry/YamlDotNet) | [MIT](https://opensource.org/licenses/MIT) | Loading configuration files |

2 changes: 1 addition & 1 deletion SynthEHR.Core/Datasets/BiochemistryRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Data;
using System.Globalization;
using System.Linq;
using MathNet.Numerics.Distributions;
using Normal = SynthEHR.Statistics.Distributions.Normal;

namespace SynthEHR.Datasets;

Expand Down
2 changes: 1 addition & 1 deletion SynthEHR.Core/Datasets/DataGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System.Text;
using CsvHelper;
using CsvHelper.Configuration;
using MathNet.Numerics.Distributions;
using Normal = SynthEHR.Statistics.Distributions.Normal;

namespace SynthEHR.Datasets;

Expand Down
57 changes: 57 additions & 0 deletions SynthEHR.Core/Statistics/Distributions/IContinuousDistribution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// <copyright file="IContinuousDistribution.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
jas88 marked this conversation as resolved.
Show resolved Hide resolved
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>

namespace SynthEHR.Statistics.Distributions;

/// <summary>
/// Continuous Univariate Probability Distribution.
/// </summary>
internal interface IContinuousDistribution : IUnivariateDistribution
{
/// <summary>
/// Gets the mode of the distribution.
/// </summary>
double Mode { get; }

/// <summary>
/// Gets the smallest element in the domain of the distribution which can be represented by a double.
/// </summary>
double Minimum { get; }

/// <summary>
/// Gets the largest element in the domain of the distribution which can be represented by a double.
/// </summary>
double Maximum { get; }

/// <summary>
/// Draws a random sample from the distribution.
/// </summary>
/// <returns>a sample from the distribution.</returns>
double Sample();
}
41 changes: 41 additions & 0 deletions SynthEHR.Core/Statistics/Distributions/IDistribution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// <copyright file="IUnivariateDistribution.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>

namespace SynthEHR.Statistics.Distributions;

/// <summary>
/// Probability Distribution.
/// </summary>
internal interface IDistribution
{
/// <summary>
/// Gets or sets the random number generator which is used to draw random samples.
/// </summary>
System.Random RandomSource { get; set; }
}
66 changes: 66 additions & 0 deletions SynthEHR.Core/Statistics/Distributions/IUnivariateDistribution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// <copyright file="IUnivariateDistribution.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>

namespace SynthEHR.Statistics.Distributions;

/// <summary>
/// Univariate Probability Distribution.
/// </summary>
internal interface IUnivariateDistribution:IDistribution
{
/// <summary>
/// Gets the mean of the distribution.
/// </summary>
double Mean { get; }

/// <summary>
/// Gets the variance of the distribution.
/// </summary>
double Variance { get; }

/// <summary>
/// Gets the standard deviation of the distribution.
/// </summary>
double StdDev { get; }

/// <summary>
/// Gets the entropy of the distribution.
/// </summary>
double Entropy { get; }

/// <summary>
/// Gets the skewness of the distribution.
/// </summary>
double Skewness { get; }

/// <summary>
/// Gets the median of the distribution.
/// </summary>
double Median { get; }
}
Loading