当前位置: 首页>>代码示例>>C#>>正文


C# IMLDataSet.GetRecord方法代码示例

本文整理汇总了C#中IMLDataSet.GetRecord方法的典型用法代码示例。如果您正苦于以下问题:C# IMLDataSet.GetRecord方法的具体用法?C# IMLDataSet.GetRecord怎么用?C# IMLDataSet.GetRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMLDataSet的用法示例。


在下文中一共展示了IMLDataSet.GetRecord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalculateError

        /// <summary>
        /// Calculate the error for this neural network. The error is calculated
        /// using root-mean-square(RMS).
        /// </summary>
        ///
        /// <param name="data">The training set.</param>
        /// <returns>The error percentage.</returns>
        public double CalculateError(IMLDataSet data)
        {
            var errorCalculation = new ErrorCalculation();

            var actual = new double[_outputCount];
            IMLDataPair pair = BasicMLDataPair.CreatePair(data.InputSize,
                                                         data.IdealSize);

            for (int i = 0; i < data.Count; i++)
            {
                data.GetRecord(i, pair);
                Compute(pair.InputArray, actual);
                errorCalculation.UpdateError(actual, pair.IdealArray,pair.Significance);
            }
            return errorCalculation.Calculate();
        }
开发者ID:firestrand,项目名称:encog-dotnet-core,代码行数:23,代码来源:FlatNetwork.cs

示例2: CalculateError

 public double CalculateError(IMLDataSet data)
 {
     double[] numArray;
     IMLDataPair pair;
     int num;
     ErrorCalculation calculation = new ErrorCalculation();
     goto Label_0057;
     Label_0031:
     num++;
     Label_0035:
     if (num < data.Count)
     {
         data.GetRecord((long) num, pair);
         this.Compute(pair.InputArray, numArray);
         calculation.UpdateError(numArray, pair.IdealArray, pair.Significance);
         goto Label_0031;
     }
     if ((((uint) num) | 8) != 0)
     {
         return calculation.Calculate();
     }
     Label_0057:
     numArray = new double[this._outputCount];
     if (0 != 0)
     {
         goto Label_0031;
     }
     pair = BasicMLDataPair.CreatePair(data.InputSize, data.IdealSize);
     num = 0;
     goto Label_0035;
 }
开发者ID:neismit,项目名称:emds,代码行数:31,代码来源:FlatNetwork.cs

示例3: CalculateError

        /// <summary>
        /// Calculate the error for the entire training set.
        /// </summary>
        ///
        /// <param name="training">Training set to use.</param>
        /// <param name="deriv">Should we find the derivative.</param>
        /// <returns>The error.</returns>
        public double CalculateError(IMLDataSet training,
                                     bool deriv)
        {
            double totErr;
            double diff;
            totErr = 0.0d;

            if (deriv)
            {
                int num = (_network.SeparateClass)
                              ? _network.InputCount*_network.OutputCount
                              : _network.InputCount;
                for (int i = 0; i < num; i++)
                {
                    _network.Deriv[i] = 0.0d;
                    _network.Deriv2[i] = 0.0d;
                }
            }

            _network.Exclude = (int) training.Count;

            IMLDataPair pair = BasicMLDataPair.CreatePair(
                training.InputSize, training.IdealSize);

            var xout = new double[_network.OutputCount];

            for (int r = 0; r < training.Count; r++)
            {
                training.GetRecord(r, pair);
                _network.Exclude = _network.Exclude - 1;

                double err = 0.0d;

                IMLData input = pair.Input;
                IMLData target = pair.Ideal;

                if (_network.OutputMode == PNNOutputMode.Unsupervised)
                {
                    if (deriv)
                    {
                        IMLData output = ComputeDeriv(input, target);
                        for (int z = 0; z < _network.OutputCount; z++)
                        {
                            xout[z] = output[z];
                        }
                    }
                    else
                    {
                        IMLData output = _network.Compute(input);
                        for (int z = 0; z < _network.OutputCount; z++)
                        {
                            xout[z] = output[z];
                        }
                    }
                    for (int i = 0; i < _network.OutputCount; i++)
                    {
                        diff = input[i] - xout[i];
                        err += diff*diff;
                    }
                }
                else if (_network.OutputMode == PNNOutputMode.Classification)
                {
                    var tclass = (int) target[0];
                    IMLData output;

                    if (deriv)
                    {
                        output = ComputeDeriv(input, pair.Ideal);
                        //output_4.GetData(0); //**FIX**?
                    }
                    else
                    {
                        output = _network.Compute(input);
                        //output_4.GetData(0); **FIX**?
                    }

                    xout[0] = output[0];

                    for (int i = 0; i < xout.Length; i++)
                    {
                        if (i == tclass)
                        {
                            diff = 1.0d - xout[i];
                            err += diff*diff;
                        }
                        else
                        {
                            err += xout[i]*xout[i];
                        }
                    }
                }

                else if (_network.OutputMode == PNNOutputMode.Regression)
//.........这里部分代码省略.........
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:101,代码来源:TrainBasicPNN.cs


注:本文中的IMLDataSet.GetRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。