-
-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3305b34
commit 3062103
Showing
84 changed files
with
1,086 additions
and
1,068 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
using BenchmarkDotNet.Mathematics; | ||
using Perfolizer; | ||
using Perfolizer.Mathematics.Common; | ||
using Perfolizer.Mathematics.GenericEstimators; | ||
using Perfolizer.Mathematics.SignificanceTesting; | ||
using Perfolizer.Mathematics.Thresholds; | ||
using Perfolizer.Mathematics.SignificanceTesting.MannWhitney; | ||
using Perfolizer.Metrology; | ||
|
||
namespace BenchmarkDotNet.Analysers | ||
{ | ||
public static class ZeroMeasurementHelper | ||
internal static class ZeroMeasurementHelper | ||
{ | ||
/// <summary> | ||
/// Checks distribution against Zero Measurement hypothesis in case of known threshold | ||
/// </summary> | ||
/// <returns>True if measurement is ZeroMeasurement</returns> | ||
public static bool CheckZeroMeasurementOneSample(double[] results, double threshold) | ||
{ | ||
if (results.Length < 3) | ||
return false; | ||
return !StudentTest.Instance.IsGreater(results, threshold).NullHypothesisIsRejected; | ||
} | ||
public static bool IsNegligible(Sample results, double threshold) => HodgesLehmannEstimator.Instance.Median(results) < threshold; | ||
public static bool IsNoticeable(Sample results, double threshold) => !IsNegligible(results, threshold); | ||
|
||
/// <summary> | ||
/// Checks distribution against Zero Measurement hypothesis in case of two samples | ||
/// </summary> | ||
/// <returns>True if measurement is ZeroMeasurement</returns> | ||
public static bool CheckZeroMeasurementTwoSamples(double[] workload, double[] overhead, Threshold? threshold = null) | ||
public static bool AreIndistinguishable(double[] workload, double[] overhead, Threshold? threshold = null) => | ||
AreIndistinguishable(new Sample(workload), new Sample(overhead), threshold); | ||
|
||
public static bool AreIndistinguishable(Sample workload, Sample overhead, Threshold? threshold = null) | ||
{ | ||
if (workload.Length < 3 || overhead.Length < 3) | ||
threshold ??= MathHelper.DefaultThreshold; | ||
var tost = new SimpleEquivalenceTest(MannWhitneyTest.Instance); | ||
if (workload.Size == 1 || overhead.Size == 1) | ||
return false; | ||
return !WelchTest.Instance.IsGreater(workload, overhead, threshold).NullHypothesisIsRejected; | ||
return tost.Perform(workload, overhead, threshold, SignificanceLevel.P1E5) == ComparisonResult.Indistinguishable; | ||
} | ||
|
||
public static bool AreDistinguishable(double[] workload, double[] overhead, Threshold? threshold = null) => | ||
!AreIndistinguishable(workload, overhead, threshold); | ||
|
||
public static bool AreDistinguishable(Sample workload, Sample overhead, Threshold? threshold = null) => | ||
!AreIndistinguishable(workload, overhead, threshold); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 5 additions & 12 deletions
17
src/BenchmarkDotNet/Attributes/Columns/WelchTTestPValueColumnAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
using System; | ||
using BenchmarkDotNet.Columns; | ||
using JetBrains.Annotations; | ||
using Perfolizer.Mathematics.SignificanceTesting; | ||
using Perfolizer.Mathematics.Thresholds; | ||
using Perfolizer.Mathematics.Common; | ||
|
||
namespace BenchmarkDotNet.Attributes | ||
{ | ||
[PublicAPI] | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] | ||
public class StatisticalTestColumnAttribute : ColumnConfigBaseAttribute | ||
{ | ||
public StatisticalTestColumnAttribute(StatisticalTestKind testKind, ThresholdUnit thresholdUnit, double value, bool showPValues = false) | ||
: base(StatisticalTestColumn.Create(testKind, Threshold.Create(thresholdUnit, value), showPValues)) { } | ||
public StatisticalTestColumnAttribute() : base(StatisticalTestColumn.Create("10%", null)) { } | ||
|
||
public StatisticalTestColumnAttribute(StatisticalTestKind testKind, bool showPValues = false) : this(testKind, ThresholdUnit.Ratio, 0.1, showPValues) { } | ||
public StatisticalTestColumnAttribute(string threshold) : base(StatisticalTestColumn.Create(threshold, null)) { } | ||
|
||
public StatisticalTestColumnAttribute(bool showPValues = false) : this(StatisticalTestKind.MannWhitney, showPValues) {} | ||
} | ||
|
||
[Obsolete("Use StatisticalTestAttribute")] | ||
public class WelchTTestPValueColumnAttribute : StatisticalTestColumnAttribute | ||
{ | ||
public WelchTTestPValueColumnAttribute() : base(StatisticalTestKind.Welch) { } | ||
public StatisticalTestColumnAttribute(string threshold, SignificanceLevel significanceLevel) | ||
: base(StatisticalTestColumn.Create(threshold, significanceLevel)) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.