Ejemplo n.º 1
0
        /// <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(Accord.Range range, int seed)
        {
            rand = new UniformOneGenerator(seed);

            min    = range.Min;
            length = range.Length;
        }
Ejemplo n.º 2
0
        private void btnStartLearning_Click(object sender, EventArgs e)
        {
            network = new NeuralNetwork(0, nodeCounts,
                                        rbBernoulli.Checked ? FunctionType.BERNOULLI : FunctionType.GAUSSIAN,
                                        (double)nudSigmoidValue.Value);
            network.initData(weatherModelData.ToList());

            pbLearning.Minimum = 0;
            pbLearning.Maximum = (int)nudIterations.Value + 1;
            for (int i = 0; i < weatherModelData.Count; i++)
            {
                realTemparatures[i, 1] = network.outputs[i][0].Scale(-1, 1, -100, 100);
                realTemparatures[i, 0] = i;
            }
            Accord.Range rn = new Accord.Range(-100, 100);
            chart.RangeY = new Accord.Range(rn.Min, rn.Max);
            chart.RangeX = new Accord.Range(0, realTemparatures.Length / 2);
            network.Train((int)nudIterations.Value, epochEvent, FinishLearning);
        }
Ejemplo n.º 3
0
 public static float[] Scale(Range from, Range to, float[] x)
 {
     return(Accord.Math.Vector.Scale(x, (IRange <float>)from, (IRange <float>)to));
 }
 public static float[] Interval(this Range range, double stepSize)
 {
     return(Interval(range.Min, range.Max, stepSize));
 }
 /// <summary>
 ///   Creates an interval vector (like NumPy's linspace function).
 /// </summary>
 ///
 /// <remarks>
 /// <para>
 ///   The Range methods should be equivalent to NumPy's np.linspace function. For
 ///   a similar method that accepts a step size instead of a number of steps, see
 ///   <see cref="Vector.Range(int, int)"/>.</para>
 /// </remarks>
 ///
 /// <seealso cref="Vector.Range(int, int)"/>
 ///
 public static float[] Interval(this Range range, int steps)
 {
     return(Interval(range.Min, range.Max, steps));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UniformGenerator"/> class.
 /// </summary>
 ///
 /// <param name="range">Random numbers range.</param>
 ///
 /// <remarks>Initializes random numbers generator with zero seed.</remarks>
 ///
 public UniformGenerator(Accord.Range range)
     : this(range, 0)
 {
 }