本文整理汇总了C#中AForge.DoubleRange类的典型用法代码示例。如果您正苦于以下问题:C# DoubleRange类的具体用法?C# DoubleRange怎么用?C# DoubleRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoubleRange类属于AForge命名空间,在下文中一共展示了DoubleRange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UniformGenerator
/// <summary>
/// Initializes a new instance of the <see cref="UniformGenerator"/> class
/// </summary>
///
/// <param name="range">Random numbers range</param>
/// <param name="seed">Seed value to initialize random numbers generator</param>
///
public UniformGenerator( DoubleRange range, int seed )
{
rand = new UniformOneGenerator( seed );
min = range.Min;
length = range.Length;
}
示例2: ActivationFunctionView
public ActivationFunctionView()
{
this.plotSteps = 1;
this.plotDomain = new DoubleRange(-1, 1);
InitializeComponent();
CreateGraph(zedGraphControl);
}
示例3: ScaleTest2
public void ScaleTest2()
{
DoubleRange from = new DoubleRange(-100, 100);
DoubleRange to = new DoubleRange(0, 50);
double x = 0;
double expected = 25;
double actual = Tools.Scale(from, to, x);
Assert.AreEqual(expected, actual);
}
示例4: AddColor
public void AddColor(HSL selectedColor,IntRange Hue_range, DoubleRange Saturation_range, DoubleRange Luminance_range)
{
TreeNode node = new TreeNode(new String(' ',100));
node.Tag = new LayerColor(selectedColor, Hue_range, Saturation_range, Luminance_range);
node.Checked = true;
new_color_parent.Nodes.Add(node);
new_color_parent.ExpandAll();
treeLayers.SelectedNode = node;
UpdateFilter();
}
示例5: LayerColor
public LayerColor(HSL _color, IntRange _hue_range, DoubleRange _sat_range, DoubleRange _lum_range)
{
color = _color;
hue_range = _hue_range;
sat_range = _sat_range;
lum_range = _lum_range;
RGB rgb = new RGB();
AForge.Imaging.ColorConverter.HSL2RGB(color, rgb);
RGBColor = rgb.Color;
}
示例6: GeneralContinuousDistribution
/// <summary>
/// Creates a new <see cref="GeneralContinuousDistribution"/> with the given PDF and CDF functions.
/// </summary>
///
/// <param name="support">The distribution's support over the real line.</param>
/// <param name="density">A probability density function.</param>
/// <param name="distribution">A cumulative distribution function.</param>
///
public GeneralContinuousDistribution(DoubleRange support,
Func<double, double> density, Func<double, double> distribution)
{
if (density == null)
throw new ArgumentNullException("density");
if (distribution == null)
throw new ArgumentNullException("distribution");
this.pdf = density;
this.cdf = distribution;
this.support = support;
}
示例7: Estimate
/// <summary>
/// Estimates suitable values for the sigmoid kernel
/// by exploring the response area of the tanh function.
/// </summary>
///
/// <param name="inputs">An input data set.</param>
/// <param name="samples">The size of the subset to use in the estimation.</param>
/// <param name="range">The interquartile range for the data.</param>
///
/// <returns>A Sigmoid kernel initialized with appropriate values.</returns>
///
public static Sigmoid Estimate(double[][] inputs, int samples, out DoubleRange range)
{
if (samples > inputs.Length)
throw new ArgumentOutOfRangeException("samples");
double[] distances = Products(inputs, samples);
double q1 = Math.Sqrt(distances[(int)Math.Ceiling(0.15 * distances.Length)] / 2.0);
double q9 = Math.Sqrt(distances[(int)Math.Ceiling(0.85 * distances.Length)] / 2.0);
double qm = Math.Sqrt(Accord.Statistics.Tools.Median(distances, alreadySorted: true) / 2.0);
range = new DoubleRange(q1, q9);
double max = qm;
double r = -Math.E;
double a = -r / max;
return new Sigmoid(a, r);
}
示例8: LinearFunction
/// <summary>
/// Initializes a new instance of the <see cref="LinearFunction"/> class.
/// </summary>
///
public LinearFunction(DoubleRange range)
{
this.Range = range;
}
示例9: OnPaint
/// <summary>
/// Paints the control.
/// </summary>
///
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
int clientWidth = ClientRectangle.Width;
int clientHeight = ClientRectangle.Height;
// fill with background
g.FillRectangle(backgroundBrush, 0, 0, clientWidth - 1, clientHeight - 1);
// draw borders
g.DrawRectangle(bordersPen, 0, 0, clientWidth - 1, clientHeight - 1);
if (DesignMode)
return;
DoubleRange rangeClientX = new DoubleRange(0, clientWidth);
DoubleRange rangeClientY = new DoubleRange(clientHeight, 0);
// walk through all data series
foreach (Waveform waveform in waveTable.Values)
{
// get data of the waveform
float[] data = waveform.data;
// check for available data
if (data == null) continue;
using (Pen pen = new Pen(waveform.color, waveform.width))
{
if (SimpleMode)
{
int blockSize = waveform.samples / clientWidth;
for (int x = 0; x < clientWidth; x++)
{
double max = data.RootMeanSquare(x * blockSize, blockSize);
int y = clientHeight / 2 + (int)(max * clientHeight);
g.DrawLine(pen, x, clientHeight - y, x, y);
}
}
else
{
int xPrev = 0;
int yPrev = (int)rangeY.Scale(rangeClientY, data[0]);
for (int x = 0; x < clientWidth; x++)
{
int index = (int)rangeClientX.Scale(rangeX, x);
if (index < 0 || index >= data.Length)
index = data.Length - 1;
int y = (int)rangeY.Scale(rangeClientY, data[index]);
g.DrawLine(pen, xPrev, yPrev, x, y);
xPrev = x;
yPrev = y;
}
}
}
}
}
示例10: GetConfidenceInterval
/// <summary>
/// Gets the 95% confidence interval for the
/// Hazard Ratio for a given coefficient.
/// </summary>
///
/// <param name="index">
/// The coefficient's index.
/// </param>
///
public DoubleRange GetConfidenceInterval(int index)
{
double coeff = Coefficients[index];
double error = StandardErrors[index];
double upper = coeff + 1.9599 * error;
double lower = coeff - 1.9599 * error;
DoubleRange ci = new DoubleRange(Math.Exp(lower), Math.Exp(upper));
return ci;
}
示例11: Estimate
/// <summary>
/// Estimate appropriate values for sigma given a data set.
/// </summary>
///
/// <remarks>
/// This method uses a simple heuristic to obtain appropriate values
/// for sigma in a radial basis function kernel. The heuristic is shown
/// by Caputo, Sim, Furesjo and Smola, "Appearance-based object
/// recognition using SVMs: which kernel should I use?", 2002.
/// </remarks>
///
/// <param name="inputs">The data set.</param>
/// <param name="range">The range of suitable values for sigma.</param>
///
/// <returns>A Gaussian kernel initialized with an appropriate sigma value.</returns>
///
public static Gaussian Estimate(double[][] inputs, out DoubleRange range)
{
return Estimate(inputs, inputs.Length, out range);
}
示例12: FromDistributionFunction
/// <summary>
/// Creates a new <see cref="GeneralContinuousDistribution"/>
/// using only a cumulative distribution function definition.
/// </summary>
///
/// <param name="support">The distribution's support over the real line.</param>
/// <param name="cdf">A cumulative distribution function.</param>
/// <param name="method">The integration method to use for numerical computations.</param>
///
/// <returns>A <see cref="GeneralContinuousDistribution"/> created from the
/// <paramref name="cdf"/> whose measures and functions are computed using
/// numerical integration and differentiation.</returns>
///
public static GeneralContinuousDistribution FromDistributionFunction(
DoubleRange support, Func<double, double> cdf, IUnivariateIntegration method)
{
GeneralContinuousDistribution dist = new GeneralContinuousDistribution();
dist.support = support;
dist.cdf = cdf;
dist.method = method;
return dist;
}
示例13: UpdateYRange
/// <summary>
/// Update Y range.
/// </summary>
private void UpdateYRange( )
{
double minY = double.MaxValue;
double maxY = double.MinValue;
// walk through all data series
IDictionaryEnumerator en = seriesTable.GetEnumerator( );
while ( en.MoveNext( ) )
{
DataSeries series = (DataSeries) en.Value;
// get data of the series
double[,] data = series.data;
if ( ( series.updateYRange ) && ( data != null ) )
{
for ( int i = 0, n = data.GetLength( 0 ); i < n; i++ )
{
double v = data[i, 1];
// check for max
if ( v > maxY )
maxY = v;
// check for min
if ( v < minY )
minY = v;
}
}
}
// update Y range, if there are any data
if ( ( minY != double.MaxValue ) || ( maxY != double.MinValue ) )
{
rangeY = new DoubleRange( minY, maxY );
}
}
示例14: Quartiles
/// <summary>
/// Computes the circular quartiles of the given circular angles.
/// </summary>
///
/// <param name="angles">A double array containing the angles in radians.</param>
/// <param name="range">The sample quartiles, as an out parameter.</param>
/// <param name="median">The angular median, if already known.</param>
/// <param name="wrap">
/// Whether range values should be wrapped to be contained in the circle. If
/// set to false, range values could be returned outside the [+pi;-pi] range.
/// </param>
///
/// <returns>The median of the given angles.</returns>
///
public static double Quartiles(double[] angles, out DoubleRange range, double median, bool wrap = true)
{
double q1, q3;
double q2 = Quartiles(angles, out q1, out q3, median, wrap);
System.Diagnostics.Debug.Assert(q2 == median);
range = new DoubleRange(q1, q3);
return median;
}
示例15: MeshTest
public void MeshTest()
{
DoubleRange rowRange = new DoubleRange(-1, 1);
DoubleRange colRange = new DoubleRange(-1, 1);
double rowSteps = 0.5f;
double colSteps = 0.5f;
double[][] expected =
{
new double[] { -1.0, -1.0 },
new double[] { -1.0, -0.5 },
new double[] { -1.0, 0.0 },
new double[] { -1.0, 0.5 },
new double[] { -1.0, 1.0 },
new double[] { -0.5, -1.0 },
new double[] { -0.5, -0.5 },
new double[] { -0.5, 0.0 },
new double[] { -0.5, 0.5 },
new double[] { -0.5, 1.0 },
new double[] { 0.0, -1.0 },
new double[] { 0.0, -0.5 },
new double[] { 0.0, 0.0 },
new double[] { 0.0, 0.5 },
new double[] { 0.0, 1.0 },
new double[] { 0.5, -1.0 },
new double[] { 0.5, -0.5 },
new double[] { 0.5, 0.0 },
new double[] { 0.5, 0.5 },
new double[] { 0.5, 1.0 },
new double[] { 1.0, -1.0 },
new double[] { 1.0, -0.5 },
new double[] { 1.0, 0.0 },
new double[] { 1.0, 0.5 },
new double[] { 1.0, 1.0 },
};
double[][] actual = Matrix.Mesh(rowRange, colRange, rowSteps, colSteps);
Assert.IsTrue(expected.IsEqual(actual));
}