• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Specific.BiPolarMLData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Encog.ML.Data.Specific.BiPolarMLData的典型用法代码示例。如果您正苦于以下问题:C# BiPolarMLData类的具体用法?C# BiPolarMLData怎么用?C# BiPolarMLData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BiPolarMLData类属于Encog.ML.Data.Specific命名空间,在下文中一共展示了BiPolarMLData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        public void Execute(IExampleInterface app)
        {
            this.app = app;

            // Create the neural network.
            BasicLayer hopfield;
            var network = new HopfieldNetwork(4);

            // This pattern will be trained
            bool[] pattern1 = {true, true, false, false};
            // This pattern will be presented
            bool[] pattern2 = {true, false, false, false};
            IMLData result;

            var data1 = new BiPolarMLData(pattern1);
            var data2 = new BiPolarMLData(pattern2);
            var set = new BasicMLDataSet();
            set.Add(data1);

            // train the neural network with pattern1
            app.WriteLine("Training Hopfield network with: "
                          + FormatBoolean(data1));

            network.AddPattern(data1);
            // present pattern1 and see it recognized
            result = network.Compute(data1);
            app.WriteLine("Presenting pattern:" + FormatBoolean(data1)
                          + ", and got " + FormatBoolean(result));
            // Present pattern2, which is similar to pattern 1. Pattern 1
            // should be recalled.
            result = network.Compute(data2);
            app.WriteLine("Presenting pattern:" + FormatBoolean(data2)
                          + ", and got " + FormatBoolean(result));
        }
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:34,代码来源:HopfieldSimple.cs


示例2: ART1

 public ART1(int theF1Count, int theF2Count)
 {
     if ((((uint) theF2Count) + ((uint) theF2Count)) <= uint.MaxValue)
     {
         goto Label_00FE;
     }
     goto Label_00F2;
     Label_0026:
     this.Reset();
     if (-2 != 0)
     {
         if (0 == 0)
         {
             return;
         }
         goto Label_00FE;
     }
     goto Label_00F2;
     Label_0031:
     this._noWinner = this._f2Count;
     if (((uint) theF1Count) <= uint.MaxValue)
     {
         goto Label_0026;
     }
     goto Label_00D2;
     Label_0071:
     this._weightsF2ToF1 = new Matrix(this._f2Count, this._f1Count);
     this._inhibitF2 = new bool[this._f2Count];
     this._outputF1 = new BiPolarMLData(this._f1Count);
     this._outputF2 = new BiPolarMLData(this._f2Count);
     goto Label_0031;
     Label_00D2:
     if (0 != 0)
     {
         goto Label_0071;
     }
     if (0 == 0)
     {
         this._weightsF1ToF2 = new Matrix(this._f1Count, this._f2Count);
         if ((((uint) theF1Count) | 0xff) == 0)
         {
             goto Label_0031;
         }
         goto Label_0071;
     }
     goto Label_0026;
     Label_00F2:
     this._f1Count = theF1Count;
     this._f2Count = theF2Count;
     goto Label_00D2;
     Label_00FE:
     this._a1 = 1.0;
     this._b1 = 1.5;
     this._c1 = 5.0;
     this._d1 = 0.9;
     this._l = 3.0;
     this._vigilance = 0.9;
     goto Label_00F2;
 }
开发者ID:neismit,项目名称:emds,代码行数:59,代码来源:ART1.cs


示例3: Compute

 public override sealed IMLData Compute(IMLData input)
 {
     int num;
     BiPolarMLData data = new BiPolarMLData(input.Count);
     if (0 == 0)
     {
         if (((uint) num) <= uint.MaxValue)
         {
             if (3 == 0)
             {
                 return data;
             }
             goto Label_0053;
         }
     }
     else
     {
         goto Label_0053;
     }
     Label_003B:
     EngineArray.ArrayCopy(base.CurrentState.Data, data.Data);
     return data;
     Label_0053:
     EngineArray.ArrayCopy(input.Data, base.CurrentState.Data);
     this.Run();
     for (num = 0; num < base.CurrentState.Count; num++)
     {
         data.SetBoolean(num, BiPolarUtil.Double2bipolar(base.CurrentState[num]));
     }
     goto Label_003B;
 }
开发者ID:neismit,项目名称:emds,代码行数:31,代码来源:HopfieldNetwork.cs


示例4: Display

        public void Display(BiPolarMLData pattern1, BiPolarMLData pattern2)
        {
            int index1 = 0;
            int index2 = 0;

            for (int row = 0; row < HEIGHT; row++)
            {
                var line = new StringBuilder();

                for (int col = 0; col < WIDTH; col++)
                {
                    if (pattern1.GetBoolean(index1++))
                        line.Append('O');
                    else
                        line.Append(' ');
                }

                line.Append("   ->   ");

                for (int col = 0; col < WIDTH; col++)
                {
                    if (pattern2.GetBoolean(index2++))
                        line.Append('O');
                    else
                        line.Append(' ');
                }

                Console.WriteLine(line.ToString());
            }
        }
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:30,代码来源:HopfieldAssociate.cs


示例5: Compute

        /// <summary>
        /// Note: for Hopfield networks, you will usually want to call the "run"
        /// method to compute the output.
        /// This method can be used to copy the input data to the current state. A
        /// single iteration is then run, and the new current state is returned.
        /// </summary>
        ///
        /// <param name="input">The input pattern.</param>
        /// <returns>The new current state.</returns>
        public override sealed IMLData Compute(IMLData input)
        {
            var result = new BiPolarMLData(input.Count);
            EngineArray.ArrayCopy(input.Data, CurrentState.Data);
            Run();

            for (int i = 0; i < CurrentState.Count; i++)
            {
                result.SetBoolean(i,
                                  BiPolarUtil.Double2bipolar(CurrentState[i]));
            }
            EngineArray.ArrayCopy(CurrentState.Data, result.Data);
            return result;
        }
开发者ID:neismit,项目名称:emds,代码行数:23,代码来源:HopfieldNetwork.cs


示例6: ComputeF1

 /// <summary>
 /// Compute the output from the F1 layer.
 /// </summary>
 ///
 /// <param name="input">The input to the F1 layer.</param>
 private void ComputeF1(BiPolarMLData input)
 {
     for (int i = 0; i < _f1Count; i++)
     {
         double sum = _weightsF1ToF2[i, Winner]
                      *((_outputF2.GetBoolean(Winner)) ? 1 : 0);
         double activation = (((input.GetBoolean(i)) ? 1 : 0) + _d1*sum - _b1)
                             /(1 + _a1
                                   *(((input.GetBoolean(i)) ? 1 : 0) + _d1*sum) + _c1);
         _outputF1.SetBoolean(i, activation > 0);
     }
 }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:17,代码来源:ART1.cs


示例7: Compute

        /// <summary>
        /// Compute the output for the BasicNetwork class.
        /// </summary>
        ///
        /// <param name="input">The input to the network.</param>
        /// <returns>The output from the network.</returns>
        public IMLData Compute(IMLData input)
        {
            if (!(input is BiPolarMLData))
            {
                throw new NeuralNetworkError(
                    "Input to ART1 logic network must be BiPolarNeuralData.");
            }

            var output = new BiPolarMLData(_f1Count);
            Compute((BiPolarMLData) input, output);
            return output;
        }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:18,代码来源:ART1.cs


示例8: Classify

        /// <summary>
        /// Classify the input data to a class number.
        /// </summary>
        ///
        /// <param name="input">The input data.</param>
        /// <returns>The class that the data belongs to.</returns>
        public int Classify(IMLData input)
        {
            var input2 = new BiPolarMLData(_f1Count);
            var output = new BiPolarMLData(_f2Count);

            if (input.Count != input2.Count)
            {
                throw new NeuralNetworkError("Input array size does not match.");
            }

            for (int i = 0; i < input2.Count; i++)
            {
                input2.SetBoolean(i, input[i] > 0);
            }

            Compute(input2, output);

            return HasWinner ? Winner : -1;
        }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:25,代码来源:ART1.cs


示例9: ThermalNetwork

 /// <summary>
 /// Construct the network with the specicified neuron count.
 /// </summary>
 ///
 /// <param name="neuronCount">The number of neurons.</param>
 protected ThermalNetwork(int neuronCount)
 {
     _neuronCount = neuronCount;
     _weights = new double[neuronCount*neuronCount];
     _currentState = new BiPolarMLData(neuronCount);
 }
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:11,代码来源:ThermalNetwork.cs


示例10: StringToBipolar

        public BiPolarMLData StringToBipolar(String str)
        {
            var result = new BiPolarMLData(str.Length*BITS_PER_CHAR);
            int currentIndex = 0;
            for (int i = 0; i < str.Length; i++)
            {
                char ch = char.ToUpper(str[i]);
                int idx = ch - FIRST_CHAR;

                int place = 1;
                for (int j = 0; j < BITS_PER_CHAR; j++)
                {
                    bool value = (idx & place) > 0;
                    result.SetBoolean(currentIndex++, value);
                    place *= 2;
                }
            }
            return result;
        }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:19,代码来源:BidirectionalAssociativeMemory.cs


示例11: Compute

 public override sealed IMLData Compute(IMLData input)
 {
     BiPolarMLData data = new BiPolarMLData(input.Count);
     EngineArray.ArrayCopy(input.Data, base.CurrentState.Data);
     this.Run();
     EngineArray.ArrayCopy(base.CurrentState.Data, data.Data);
     return data;
 }
开发者ID:neismit,项目名称:emds,代码行数:8,代码来源:BoltzmannMachine.cs


示例12: DisplayTour

        private String DisplayTour(BiPolarMLData data)
        {
            var result = new StringBuilder();

            int n1, n2;
            bool first;

            for (n1 = 0; n1 < NUM_CITIES; n1++)
            {
                first = true;
                result.Append("[");
                for (n2 = 0; n2 < NUM_CITIES; n2++)
                {
                    if (data.GetBoolean(n1*NUM_CITIES + n2))
                    {
                        if (first)
                        {
                            first = false;
                            result.Append(n2);
                        }
                        else
                        {
                            result.Append(", " + n2);
                        }
                    }
                }
                result.Append("]");
                if (n1 != NUM_CITIES - 1)
                {
                    result.Append(" -> ");
                }
            }
            return result.ToString();
        }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:34,代码来源:BoltzTSP.cs


示例13: LengthOfTour

        public double LengthOfTour(BiPolarMLData data)
        {
            double result;
            int n1, n2, n3;

            result = 0;
            for (n1 = 0; n1 < NUM_CITIES; n1++)
            {
                for (n2 = 0; n2 < NUM_CITIES; n2++)
                {
                    if (data.GetBoolean(((n1)%NUM_CITIES)*NUM_CITIES + n2))
                        break;
                }
                for (n3 = 0; n3 < NUM_CITIES; n3++)
                {
                    if (data.GetBoolean(((n1 + 1)%NUM_CITIES)*NUM_CITIES + n3))
                        break;
                }
                result += distance[n2][n3];
            }
            return result;
        }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:22,代码来源:BoltzTSP.cs


示例14: IsValidTour

        public bool IsValidTour(BiPolarMLData data)
        {
            int cities, stops;

            for (int n1 = 0; n1 < NUM_CITIES; n1++)
            {
                cities = 0;
                stops = 0;
                for (int n2 = 0; n2 < NUM_CITIES; n2++)
                {
                    if (data.GetBoolean(n1*NUM_CITIES + n2))
                    {
                        if (++cities > 1)
                            return false;
                    }
                    if (data.GetBoolean(n2*NUM_CITIES + n1))
                    {
                        if (++stops > 1)
                            return false;
                    }
                }
                if ((cities != 1) || (stops != 1))
                    return false;
            }
            return true;
        }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:26,代码来源:BoltzTSP.cs


示例15: Execute

        public void Execute(IExampleInterface app)
        {
            this.app = app;
            SetupInput();
            var pattern = new ART1Pattern();
            pattern.InputNeurons = INPUT_NEURONS;
            pattern.OutputNeurons = OUTPUT_NEURONS;
            var network = (ART1) pattern.Generate();


            for (int i = 0; i < PATTERN.Length; i++)
            {
                var dataIn = new BiPolarMLData(input[i]);
                var dataOut = new BiPolarMLData(OUTPUT_NEURONS);
                network.Compute(dataIn, dataOut);
                if (network.HasWinner)
                {
                    app.WriteLine(PATTERN[i] + " - " + network.Winner);
                }
                else
                {
                    app.WriteLine(PATTERN[i] + " - new Input and all Classes exhausted");
                }
            }
        }
开发者ID:jongh0,项目名称:MTree,代码行数:25,代码来源:ClassifyART1.cs


示例16: Init

        /// <summary>
        /// Init the network.
        /// </summary>
        ///
        /// <param name="neuronCount">The neuron count.</param>
        /// <param name="weights">The weights.</param>
        /// <param name="output">The toutpu</param>
        public void Init(int neuronCount, double[] weights,
            double[] output)
        {
            if (neuronCount != output.Length)
            {
                throw new NeuralNetworkError("Neuron count(" + neuronCount
                                             + ") must match output count(" + output.Length + ").");
            }

            if ((neuronCount*neuronCount) != weights.Length)
            {
                throw new NeuralNetworkError("Weight count(" + weights.Length
                                             + ") must be the square of the neuron count(" + neuronCount
                                             + ").");
            }

            _neuronCount = neuronCount;
            _weights = weights;
            _currentState = new BiPolarMLData(neuronCount) {Data = output};
        }
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:27,代码来源:ThermalNetwork.cs


示例17: SetCurrentState

 /// <summary>
 /// Set the current state.
 /// </summary>
 /// <param name="s">The new current state.</param>
 public void SetCurrentState(double[] s)
 {
     _currentState = new BiPolarMLData(s.Length);
     EngineArray.ArrayCopy(s, _currentState.Data);
 }
开发者ID:CreativelyMe,项目名称:encog-dotnet-core,代码行数:9,代码来源:ThermalNetwork.cs


示例18: BipolalToString

        public String BipolalToString(BiPolarMLData data)
        {
            var result = new StringBuilder();

            int j, a, p;

            for (int i = 0; i < (data.Count/BITS_PER_CHAR); i++)
            {
                a = 0;
                p = 1;
                for (j = 0; j < BITS_PER_CHAR; j++)
                {
                    if (data.GetBoolean(i*BITS_PER_CHAR + j))
                        a += p;

                    p *= 2;
                }
                result.Append((char) (a + FIRST_CHAR));
            }


            return result.ToString();
        }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:23,代码来源:BidirectionalAssociativeMemory.cs


示例19: ART1

        /// <summary>
        /// Construct the ART1 network.
        /// </summary>
        ///
        /// <param name="theF1Count">The neuron count for the f1 layer.</param>
        /// <param name="theF2Count">The neuron count for the f2 layer.</param>
        public ART1(int theF1Count, int theF2Count)
        {
            _a1 = 1;
            _b1 = 1.5d;
            _c1 = 5;
            _d1 = 0.9d;
            _l = 3;
            _vigilance = 0.9d;
            _f1Count = theF1Count;
            _f2Count = theF2Count;

            _weightsF1ToF2 = new Matrix(_f1Count, _f2Count);
            _weightsF2ToF1 = new Matrix(_f2Count, _f1Count);

            _inhibitF2 = new bool[_f2Count];

            _outputF1 = new BiPolarMLData(_f1Count);
            _outputF2 = new BiPolarMLData(_f2Count);

            _noWinner = _f2Count;
            Reset();
        }
开发者ID:kedrzu,项目名称:encog-dotnet-core,代码行数:28,代码来源:ART1.cs


示例20: RandomBiPolar

 public BiPolarMLData RandomBiPolar(int size)
 {
     var result = new BiPolarMLData(size);
     for (int i = 0; i < size; i++)
     {
         if (ThreadSafeRandom.NextDouble() > 0.5)
             result[i] = -1;
         else
             result[i] = 1;
     }
     return result;
 }
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:12,代码来源:BidirectionalAssociativeMemory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LIBSVM.svm_parameter类代码示例发布时间:2022-05-24
下一篇:
C# Basic.BasicMLData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap