本文整理汇总了C#中IContinuousDistribution类的典型用法代码示例。如果您正苦于以下问题:C# IContinuousDistribution类的具体用法?C# IContinuousDistribution怎么用?C# IContinuousDistribution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContinuousDistribution类属于命名空间,在下文中一共展示了IContinuousDistribution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create2DimTeachingVectors
public static List<PatternClass> Create2DimTeachingVectors(double p1, double p2, IContinuousDistribution generatorFirstFeature1, IContinuousDistribution generatorFirstFeature2, IContinuousDistribution generatorSecondFeature1, IContinuousDistribution generatorSecondFeature2, int nrOfTeachingVectors)
{
List<PatternClass> createdTeachingVectors = new List<PatternClass>();
if (probabilityGenerator == null)
{
probabilityGenerator = new ContinuousUniform(0, 1);
probabilityGenerator.RandomSource = new Random(DateTime.Now.Millisecond + 10);
}
for (int i = 0; i < nrOfTeachingVectors; i++)
{
double value = 0;
double value1 = 0;
int classNumber = CreateClass(p1, p2);
if (classNumber == 1)
{
value = generatorFirstFeature1.Sample();
value1 = generatorSecondFeature1.Sample();
}
else if (classNumber == 2)
{
value = generatorFirstFeature2.Sample();
value1 = generatorSecondFeature2.Sample();
}
createdTeachingVectors.Add(new PatternClass(new FeatureVector(value,value1), classNumber));
}
return createdTeachingVectors;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:31,代码来源:Common.cs
示例2: Create2dimSampleObject
public static List<PatternClass> Create2dimSampleObject(IContinuousDistribution generator, IContinuousDistribution generator1, int count, int classNumber)
{
List<PatternClass> sampleObjects = new List<PatternClass>();
probabilityGenerator = new ContinuousUniform(0, 1);
probabilityGenerator.RandomSource = new Random(DateTime.Now.Millisecond + 10);
for (int i = 0; i < count; i++)
{
sampleObjects.Add(new PatternClass(new FeatureVector(generator.Sample(), generator1.Sample()), classNumber));
}
return sampleObjects;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:13,代码来源:Common.cs
示例3: SyntheticFeatureAlignmentData
public static IEnumerable<Tuple<PointF, PointF>> SyntheticFeatureAlignmentData(
int numGoodAlignments,
int numBadAlignments,
IContinuousDistribution featureNoise,
IContinuousDistribution pointDistribution)
{
var rigidTrans = DenseMatrix.CreateRandom(3, 2, pointDistribution);
var sourcePoints = randSourceMatrix(numGoodAlignments, pointDistribution);
var targetPoints = NoisyTransform(sourcePoints, rigidTrans, featureNoise);
return alignedPointsFromRows(sourcePoints.RowEnumerator(), targetPoints.RowEnumerator())
.Concat(alignedPointsFromRows(randSourceMatrix(numBadAlignments, pointDistribution).RowEnumerator(), DenseMatrix.CreateRandom(numBadAlignments, 2, pointDistribution).RowEnumerator()));
}
开发者ID:kamal-kr,项目名称:RGBLocalization,代码行数:14,代码来源:RansacTests.cs
示例4: CalculateBayesRiskUniformDistribution
public static double CalculateBayesRiskUniformDistribution(IContinuousDistribution generator1, IContinuousDistribution generator2, double P1, double P2)
{
double dens1 = generator1.Density(generator1.Mean);
double dens2 = generator2.Density(generator2.Mean);
if (dens1 > dens2)
{
double range = generator1.Maximum - generator2.Minimum;
if (range > 0.0)
{
return range * dens2 * 100;
}
}
else if (dens2 > dens1)
{
double range = generator2.Maximum - generator1.Minimum;
if (range > 0.0)
{
return range * dens1 * 100;
}
}
else
{
double range1 = generator2.Maximum - generator1.Minimum;
double range2 = generator1.Maximum - generator2.Minimum;
if (range1 > 0.0)
{
return range1 * dens1*100;
}
if (range2 > 0.0)
{
return range2 * dens1 * 100;
}
}
return 0.0;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:40,代码来源:NaiveBayes.cs
示例5: CreateRandom
/// <summary>
/// Create a new dense matrix with values sampled from the provided random distribution.
/// </summary>
public static DenseMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
{
var storage = new DenseColumnMajorMatrixStorage<Complex>(rows, columns);
for (var i = 0; i < storage.Data.Length; i++)
{
storage.Data[i] = new Complex(distribution.Sample(), distribution.Sample());
}
return new DenseMatrix(storage);
}
开发者ID:hrapa,项目名称:mathnet-numerics,代码行数:12,代码来源:DenseMatrix.cs
示例6: Random
/// <summary>
/// Generates a vector with random elements
/// </summary>
/// <param name="length">Number of elements in the vector.</param>
/// <param name="randomDistribution">Continuous Random Distribution or Source</param>
/// <returns>
/// A vector with n-random elements distributed according
/// to the specified random distribution.
/// </returns>
/// <exception cref="ArgumentNullException">If the length vector is non poisitive<see langword="null" />.</exception>
public override Vector Random(int length, IContinuousDistribution randomDistribution)
{
if (length < 0)
{
throw new ArgumentException(Resources.ArgumentMustBePositive, "length");
}
var v = (SparseVector)this.CreateVector(length);
for (var index = 0; index < v.Count; index++)
{
v[index] = randomDistribution.Sample();
}
return v;
}
开发者ID:hany-abdelrahman,项目名称:mathnet-numerics,代码行数:25,代码来源:SparseVector.cs
示例7: CreateRandom
/// <summary>
/// Create a new diagonal matrix with diagonal values sampled from the provided random distribution.
/// </summary>
public static DiagonalMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
{
return new DiagonalMatrix(new DiagonalMatrixStorage<double>(rows, columns, Generate.Random(Math.Min(rows, columns), distribution)));
}
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:7,代码来源:DiagonalMatrix.cs
示例8: GeneratorSource
/// <summary>
/// Create a sample source from a continuous generator.
/// </summary>
public GeneratorSource(IContinuousDistribution distribution)
{
_distribution = distribution;
}
开发者ID:Kingefosa,项目名称:mathnet-filtering,代码行数:7,代码来源:GeneratorSource.cs
示例9: CreateDistributionSerie
private Series CreateDistributionSerie(IContinuousDistribution distributionn)
{
Series createdSerie = new Series();
createdSerie.ChartType = SeriesChartType.SplineArea;
for (double i = distributionn.Mean - (8 * distributionn.StdDev); i < distributionn.Mean + (8 * distributionn.StdDev); i += 0.5)
{
if (distributionn is ContinuousUniform)
{
createdSerie.Points.Add(new DataPoint((int)i, distributionn.Density(i)));
}
else
{
createdSerie.Points.Add(new DataPoint(i, distributionn.Density(i)));
}
}
return createdSerie;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:20,代码来源:Form1.cs
示例10: ContinuousVapnikChervonenkisTest
/// <summary>
/// Vapnik Chervonenkis test.
/// </summary>
/// <param name="epsilon">The error we are willing to tolerate.</param>
/// <param name="delta">The error probability we are willing to tolerate.</param>
/// <param name="s">The samples to use for testing.</param>
/// <param name="dist">The distribution we are testing.</param>
public static void ContinuousVapnikChervonenkisTest(double epsilon, double delta, double[] s, IContinuousDistribution dist)
{
// Using VC-dimension, we can bound the probability of making an error when estimating empirical probability
// distributions. We are using Theorem 2.41 in "All Of Nonparametric Statistics".
// http://books.google.com/books?id=MRFlzQfRg7UC&lpg=PP1&dq=all%20of%20nonparametric%20statistics&pg=PA22#v=onepage&q=%22shatter%20coe%EF%AC%83cients%20do%20not%22&f=false .</para>
// For intervals on the real line the VC-dimension is 2.
Assert.Greater(s.Length, Math.Ceiling(32.0 * Math.Log(16.0 / delta) / epsilon / epsilon));
var histogram = new Histogram(s, NumberOfHistogramBuckets);
for (var i = 0; i < NumberOfHistogramBuckets; i++)
{
var p = dist.CumulativeDistribution(histogram[i].UpperBound) - dist.CumulativeDistribution(histogram[i].LowerBound);
var pe = histogram[i].Count/(double)s.Length;
Assert.Less(Math.Abs(p - pe), epsilon, dist.ToString());
}
}
开发者ID:skair39,项目名称:mathnet-numerics,代码行数:23,代码来源:CommonDistributionTests.cs
示例11: CreateRandom
/// <summary>
/// Create a new diagonal matrix with diagonal values sampled from the provided random distribution.
/// </summary>
public static DiagonalMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
{
return new DiagonalMatrix(DiagonalMatrixStorage<Complex>.OfInit(rows, columns,
i => new Complex(distribution.Sample(), distribution.Sample())));
}
开发者ID:smoothdeveloper,项目名称:mathnet-numerics,代码行数:8,代码来源:DiagonalMatrix.cs
示例12: CreateRandom
/// <summary>
/// Create a new dense vector with values sampled from the provided random distribution.
/// </summary>
public static DenseVector CreateRandom(int length, IContinuousDistribution distribution)
{
return new DenseVector(DenseVectorStorage<double>.OfInit(length,
i => distribution.Sample()));
}
开发者ID:Jungwon,项目名称:mathnet-numerics,代码行数:8,代码来源:DenseVector.cs
示例13: CalculateIntegral1
private static double CalculateIntegral1(IContinuousDistribution dist1, IContinuousDistribution dist2, double commonPoint, double p1, double p2)
{
double sum = 0.0;
double sum1 = 0.0;
for (double i = dist1.Mean - (8 * dist1.StdDev); i < dist1.Mean + (8 * dist1.StdDev); i += 0.0001)
{
double d1 = p1*dist1.Density(i);
double d2 = p2*dist2.Density(i);
if (d1 <= d2)
{
sum += 0.0001 * d1;
}
else
{
sum += 0.0001 * d2;
}
}
return sum;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:19,代码来源:NaiveBayes.cs
示例14: CalculateIntegralUniform
private static double CalculateIntegralUniform(IContinuousDistribution dist1, IContinuousDistribution dist2,double p1, double p2)
{
bool found = false;
double zakresDist1 = dist1.Maximum - dist1.Minimum;
double zakresDist2 = dist2.Maximum - dist2.Minimum;
if (dist2.Maximum <= dist1.Maximum && dist1.Maximum < dist2.Maximum )
{
}
double sum = 0.0;
if (p1 > p2)
return p2 * sum;
else
return p1 * sum;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:17,代码来源:NaiveBayes.cs
示例15: FindCommonPointNormalDistribution
/// <summary>
/// Find the common point beetwen 2 distributions
/// </summary>
/// <param name="dist1">First Distribution</param>
/// <param name="dist2">Second Distribution</param>
/// <param name="commonPoint"></param>
/// <returns></returns>
public static bool FindCommonPointNormalDistribution(IContinuousDistribution dist1,IContinuousDistribution dist2,ref double commonPoint)
{
bool found = false;
double step = 0.0;
if (dist2.Mean > dist1.Mean)
step = 0.001;
else
step = -0.001;
for (double i = dist1.Mean; i < dist2.Mean; i += 0.001)
{
if (Math.Abs(dist1.Density(i) - dist2.Density(i)) < 0.00001)
{
commonPoint = i;
found = true;
break;
}
}
return found;
}
开发者ID:michal-franc,项目名称:ImageClassification,代码行数:28,代码来源:NaiveBayes.cs
示例16: Random
/// <summary>
/// Generates a vector with random elements
/// </summary>
/// <param name="length">Number of elements in the vector.</param>
/// <param name="randomDistribution">Continuous Random Distribution or Source</param>
/// <returns>
/// A vector with n-random elements distributed according
/// to the specified random distribution.
/// </returns>
/// <exception cref="ArgumentNullException">If the n vector is non positive<see langword="null" />.</exception>
public override Vector<Complex32> Random(int length, IContinuousDistribution randomDistribution)
{
if (length < 1)
{
throw new ArgumentException(Resources.ArgumentMustBePositive, "length");
}
var v = (DenseVector)CreateVector(length);
for (var index = 0; index < v.Data.Length; index++)
{
v.Data[index] = new Complex32((float)randomDistribution.Sample(), (float)randomDistribution.Sample());
}
return v;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:25,代码来源:DenseVector.cs
示例17: CreateRandom
/// <summary>
/// Create a new dense vector with values sampled from the provided random distribution.
/// </summary>
public static DenseVector CreateRandom(int length, IContinuousDistribution distribution)
{
var samples = Generate.RandomSingle(length, distribution);
return new DenseVector(new DenseVectorStorage<float>(length, samples));
}
开发者ID:jafffy,项目名称:mathnet-numerics,代码行数:8,代码来源:DenseVector.cs
示例18: CreateRandom
/// <summary>
/// Create a new dense matrix with values sampled from the provided random distribution.
/// </summary>
public static DenseMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
{
return new DenseMatrix(DenseColumnMajorMatrixStorage<float>.OfInit(rows, columns, (i, j) => (float) distribution.Sample()));
}
开发者ID:EraYaN,项目名称:EV2020,代码行数:7,代码来源:DenseMatrix.cs
示例19: CreateRandom
/// <summary>
/// Create a new dense vector with values sampled from the provided random distribution.
/// </summary>
public static DenseVector CreateRandom(int length, IContinuousDistribution distribution)
{
return new DenseVector(DenseVectorStorage<Complex32>.OfInit(length,
i => new Complex32((float)distribution.Sample(), (float)distribution.Sample())));
}
开发者ID:EraYaN,项目名称:EV2020,代码行数:8,代码来源:DenseVector.cs
示例20: Random
/// <summary>
/// Generates matrix with random elements.
/// </summary>
/// <param name="numberOfRows">Number of rows.</param>
/// <param name="numberOfColumns">Number of columns.</param>
/// <param name="distribution">Continuous Random Distribution or Source</param>
/// <returns>
/// An <c>numberOfRows</c>-by-<c>numberOfColumns</c> matrix with elements distributed according to the provided distribution.
/// </returns>
/// <exception cref="ArgumentException">If the parameter <paramref name="numberOfRows"/> is not positive.</exception>
/// <exception cref="ArgumentException">If the parameter <paramref name="numberOfColumns"/> is not positive.</exception>
public virtual Matrix Random(int numberOfRows, int numberOfColumns, IContinuousDistribution distribution)
{
if (numberOfRows < 1)
{
throw new ArgumentException(Resources.ArgumentMustBePositive, "numberOfRows");
}
if (numberOfColumns < 1)
{
throw new ArgumentException(Resources.ArgumentMustBePositive, "numberOfColumns");
}
var matrix = CreateMatrix(numberOfRows, numberOfColumns);
CommonParallel.For(
0,
ColumnCount,
j =>
{
for (var i = 0; i < matrix.RowCount; i++)
{
matrix[i, j] = distribution.Sample();
}
});
return matrix;
}
开发者ID:vivektewari,项目名称:mathnet-numerics,代码行数:37,代码来源:Matrix.Arithmetic.cs
注:本文中的IContinuousDistribution类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论