public void SamplesDistributionTest() { var source = Normal.Samples(MathTool.GetRandomFactory()(), 0.0, 1.0).AsParallel().Take(99999).ToList(); var histogram = new Histogram(source, 50); DisplayDistribution("Normal", histogram); }
public Categorical(Histogram histogram, Func <Random> randomFactory = null) { histogram.ShouldNotBeNull("histogram"); var p = histogram.GetCounts(); SetParameters(p); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public void SamplesDistributionTest() { var source = DiscreteUniform.Samples(MathTool.GetRandomFactory()(), 0, 10).AsParallel().Take(99999).Select(x => (double)x).ToList(); var histogram = new Histogram(source, 11, 0, 11); DisplayDistribution("DiscreteUniform", histogram); }
/// <summary> /// Initializes a new instance of the Weibull class. /// </summary> /// <param name="shape">The shape of the Weibull distribution.</param> /// <param name="scale">The scale of the Weibull distribution.</param> /// <param name="randomFactory">난수발생기 Factory</param> public Weibull(double shape, double scale, Func <Random> randomFactory = null) { randomFactory.ShouldNotBeNull("randomFactory"); if (IsDebugEnabled) { log.Debug(@"Weibull 분포를 표현하는 인스턴스를 생성했습니다. shape=[{0}], scale=[{1}]", shape, scale); } SetParameters(shape, scale); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public Cauchy(double location = 0, double scale = 1, Func <Random> randomFactory = null) { SetParameters(location, scale); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public Categorical(double[] p, Func <Random> randomFactory = null) { SetParameters(p); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public DiscreteUniform(int lower, int upper, Func <Random> randomFactory = null) { SetParameters(lower, upper); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public Laplace(double location = 0.0, double scale = 1.0, Func <Random> randomFactory = null) { SetParameters(location, scale); RandomSource = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory()(); }
/// <summary> /// 베타분포 생성자 /// </summary> /// <param name="a">Beta 함수 계수 a</param> /// <param name="b">Beta 함수 계수 b</param> /// <param name="randomFactory">Random 인스턴스 생성자</param> public Beta(double a, double b, Func <Random> randomFactory = null) { SetParameters(a, b); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public Exponential(double lambda = 1.0, Func <Random> randomFactory = null) { SetParameters(lambda); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public ContinuousUniform(double lower, double upper, Func <Random> randomFactory = null) { SetParameters(lower, upper); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public ChiSquare(double dof, Func <Random> randomFactory = null) { SetParameters(dof); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
public FisherSnedecor(double d1, double d2, Func <Random> randomFactory = null) { SetParameters(d1, d2); RandomSource = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory()(); }
public InverseGamma(double shape, double scale, Func <Random> randomFactory = null) { SetParameters(shape, scale); RandomSource = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory()(); }
public Chi(double dof) : this(dof, MathTool.GetRandomFactory()) { }
public Erlang(int shape, double invScale, Func <Random> randomFactory = null) { SetParameters(shape, invScale); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }
/// <summary> /// 정규분포 생성자 /// </summary> /// <param name="mean">평균</param> /// <param name="stDev">표준편차</param> /// <param name="randomFactory">난수발생기 Factory</param> public Normal(double mean = 0.0, double stDev = 1.0, Func <Random> randomFactory = null) { SetParameters(mean, stDev); _random = (randomFactory != null) ? randomFactory() : MathTool.GetRandomFactory().Invoke(); }