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


C# IActivationFunction.GetType方法代码示例

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


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

示例1: SaveActivationFunction

 /// <summary>
 /// Save the activation function.
 /// </summary>
 /// <param name="activationFunction">The activation function.</param>
 /// <param name="xmlOut">The XML.</param>
 public static void SaveActivationFunction(
     IActivationFunction activationFunction, WriteXML xmlOut)
 {
     if (activationFunction != null)
     {
         xmlOut.BeginTag(BasicLayerPersistor.TAG_ACTIVATION);
         xmlOut.BeginTag(activationFunction.GetType().Name);
         String[] names = activationFunction.ParamNames;
         for (int i = 0; i < names.Length; i++)
         {
             String str = names[i];
             double d = activationFunction.Params[i];
             xmlOut.AddAttribute(str, "" + CSVFormat.EG_FORMAT.Format(d, 10));
         }
         xmlOut.EndTag();
         xmlOut.EndTag();
     }
 }
开发者ID:encog,项目名称:encog-silverlight-core,代码行数:23,代码来源:BasicLayerPersistor.cs

示例2: MakeActivationFunctionString

        private String MakeActivationFunctionString(IActivationFunction act)
        {
            StringBuilder result = new StringBuilder();
            result.Append(act.GetType().Name);

            for (int i = 0; i < act.Params.Length; i++)
            {
                result.Append('|');
                result.Append(CSVFormat.EgFormat.Format(act.Params[i],
                        EncogFramework.DefaultPrecision));
            }
            return result.ToString();
        }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:13,代码来源:EncogWriteHelper.cs

示例3: CanItLearnRulesWith

        private void CanItLearnRulesWith(IList<IMLDataPair> inputData, IList<IMLDataPair> verfData, int hiddenLayerCount, int neuronCount, IActivationFunction actFunc, double learnRate, double momentum, int batchSize, int maxEpochs)
        {
            var model = new DbModel();
            var funcName = actFunc.GetType().Name;
            var tdCount = inputData.Count();
            if (model.TicTacToeResult.Any(r => r.HiddenLayerCount == hiddenLayerCount &&
                r.NeuronPerLayercount == neuronCount &&
                r.ActivationFunction == funcName &&
                r.LearningRate == learnRate &&
                r.BatchSize == batchSize &&
                r.Momentum == momentum &&
                r.Name == Name &&
                r.Epochs == maxEpochs &&
                r.TrainingDataCount == tdCount))
                return;

            var nn = CreateNetwork(inputData, hiddenLayerCount, neuronCount, actFunc);
            var train = new Backpropagation(nn, new BasicMLDataSet(inputData), learnRate, momentum);
            train.BatchSize = batchSize;
            int epoch = 1;
            do
            {
                train.Iteration();
                epoch++;
            } while (epoch < maxEpochs);

            int good = verfData.Count(verf => { var output = nn.Compute(verf.Input); return Enumerable.Range(0, 9).All(i => Math.Round(output[i]) == Math.Round(verf.Ideal[i])); });
            int bad = VerfDataCount - good;

            var result = new TicTacToeResult()
            {
                HiddenLayerCount = hiddenLayerCount,
                NeuronPerLayercount = neuronCount,
                ActivationFunction = funcName,
                Bad = bad,
                Good = good,
                TrainingDataCount = tdCount,
                Momentum = momentum,
                LearningRate = learnRate,
                BatchSize = batchSize,
                Epochs = epoch,
                Error = train.Error,
                Name = Name,
            };

            model.TicTacToeResult.Add(result);
            model.SaveChanges();
        }
开发者ID:Tirinst,项目名称:NeuralNetworksAndMachineLearning,代码行数:48,代码来源:TicTacToeBrain.cs

示例4: WriteProperty

        /// <summary>
        /// Write a property as an activation function.
        /// </summary>
        ///
        /// <param name="name">The name of the property.</param>
        /// <param name="act">The activation function.</param>
        public void WriteProperty(String name,
            IActivationFunction act)
        {
            var result = new StringBuilder();
            result.Append(act.GetType().Name);

            for (int i = 0; i < act.Params.Length; i++)
            {
                result.Append('|');
                result.Append(CSVFormat.EgFormat.Format(act.Params[i],
                                                         EncogFramework.DefaultPrecision));
            }
            WriteProperty(name, result.ToString());
        }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:20,代码来源:EncogWriteHelper.cs

示例5: WriteProperty

 public void WriteProperty(string name, IActivationFunction act)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(act.GetType().Name);
     int index = 0;
     goto Label_0030;
     Label_0011:
     builder.Append(CSVFormat.EgFormat.Format(act.Params[index], 10));
     index++;
     Label_0030:
     if (index < act.Params.Length)
     {
         builder.Append('|');
         goto Label_0011;
     }
     if ((((uint) index) | 3) == 0)
     {
         goto Label_0011;
     }
     this.WriteProperty(name, builder.ToString());
 }
开发者ID:neismit,项目名称:emds,代码行数:21,代码来源:EncogWriteHelper.cs


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