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


C# Vector.Transform方法代码示例

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


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

示例1: Normalization

        Vector stds; // standart derivation

        #endregion Fields

        #region Constructors

        public Normalization(int size)
        {
            avgs = new Vector(size);
            avgs.Transform(x => 1.0d);
            stds = new Vector(size);
            stds.Transform(x => 1.0d);
        }
开发者ID:pxqr,项目名称:nanon,代码行数:13,代码来源:Normalization.cs

示例2: Minimize

        public void Minimize(IHypothesis hypothesis, Vector[] inputs, double[] outputs)
        {
            if (inputs.Length == 0)
                return;

            var inputCount   = inputs.Length;
            var inputSize    = inputs[0].Size;

            //  calculate invert avg multiplier
            var contribution  = 1.0d / (double)inputSize;
            //  prevent to passing small inputs away without weigths have been changed
            var currentRefreshRate = System.Math.Min(refreshRate, inputCount);

            for (var dummy = 0; dummy < iterationCount; ++dummy)
            {
                var gradAcc = new Vector(inputSize);

                for (var i = 0; i < inputCount; ++i)
                {
                    // find gradient of cost(loss) function
                    gradAcc += hypothesis.Gradient(inputs[i], outputs[i]);

                    if ((i % currentRefreshRate) == 0)
                    {
                        // do gradient step
                        hypothesis.Weights = hypothesis.Weights - learningRate * contribution * gradAcc;
                        // reset accumulator
                        gradAcc.Transform(x => 0.0d);
                    }
                }
                hypothesis.Weights = hypothesis.Weights - learningRate * contribution * gradAcc;
            }
        }
开发者ID:pxqr,项目名称:nanon,代码行数:33,代码来源:OnlineGradientDescent.cs

示例3: ZeroVectorZeroTransformationTest

            public void ZeroVectorZeroTransformationTest()
            {
                Vector a = new Vector (0.0, 0, 0);
                Vector t = new Vector (0, 0, 0);

                Vector c = a.Transform (t);

                Assert.AreEqual (0, c.X, 0.01);
                Assert.AreEqual (0, c.Y, 0.01);
                Assert.AreEqual (0, c.Z, 0.01);
            }
开发者ID:stefanhoelzl,项目名称:DynamicSimulationFramework,代码行数:11,代码来源:MathObjectsTest.cs

示例4: VectorNegativeTransformationTest

            public void VectorNegativeTransformationTest()
            {
                Vector a = new Vector (0, 1, 0);
                Vector t = new Vector (0, 0, Math.PI / 2);

                Vector c = a.Transform (-1 * t);

                Assert.AreEqual (-1, c.X, 0.01);
                Assert.AreEqual (0, c.Y, 0.01);
                Assert.AreEqual (0, c.Z, 0.01);
            }
开发者ID:stefanhoelzl,项目名称:DynamicSimulationFramework,代码行数:11,代码来源:MathObjectsTest.cs


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