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


C# Vector.PointwiseMultiply方法代码示例

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


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

示例1: Cost

        //public Vector<double> Delta(Vector<double> activation, )
        public double Cost(Vector<double> input, Vector<double> expected, Vector<double> output)
        {
            var m = (double)input.Count;
            var logHTheta = output.Map(SpecialFunctions.Logistic);
            var term1 = expected.PointwiseMultiply(logHTheta);

            var term2 = expected.Map(d => 1 - d).PointwiseMultiply(output.Map(d => SpecialFunctions.Logistic(1 - d)));

            return (-1.0d/m)*(term1 + term2).Sum();
        }
开发者ID:stprior,项目名称:fdgvectors,代码行数:11,代码来源:NeuralNetwork.cs

示例2: CalibrateWavelengthForPosition

 public static void CalibrateWavelengthForPosition(Vector<double> z, Vector<double> w)
 {
     double[] fit = Fit.Polynomial(z.ToArray(), w.ToArray(), 2);
     var model = z.PointwiseMultiply(z)*fit[2] + z * fit[1] + fit[0];
     var dif = model - w;
     double rms = Math.Sqrt(dif.DotProduct(dif) / (calibration_points + 1));
     WebApiApplication.calibration.K0 = fit[0];
     WebApiApplication.calibration.K1 = fit[1];
     WebApiApplication.calibration.K2 = fit[2];
     WebApiApplication.calibration.State = MbrCalibration.Calibrated;
     WebApiApplication.calibration.RmsError = rms;
 }
开发者ID:willtalmadge,项目名称:MbrControl,代码行数:12,代码来源:WavelengthController.cs

示例3: BackPropogate

 private Vector<double> BackPropogate(Matrix<double> thetaL, Vector<double> activationL,
     Vector<double> deltaLPlus1)
 {
     return
         thetaL.TransposeThisAndMultiply(deltaLPlus1)
             .PointwiseMultiply(activationL.PointwiseMultiply(1 - activationL));
 }
开发者ID:stprior,项目名称:fdgvectors,代码行数:7,代码来源:NeuralNetwork.cs

示例4: PointwiseMultiply

        /// <summary>
        /// Pointwise multiplies this vector with another vector and stores the result into the result vector.
        /// </summary>
        /// <param name="other">The vector to pointwise multiply with this one.</param>
        /// <param name="result">The vector to store the result of the pointwise multiplication.</param>
        /// <exception cref="ArgumentNullException">If the other vector is <see langword="null" />.</exception> 
        /// <exception cref="ArgumentNullException">If the result vector is <see langword="null" />.</exception> 
        /// <exception cref="ArgumentException">If this vector and <paramref name="other"/> are not the same size.</exception>
        /// <exception cref="ArgumentException">If this vector and <paramref name="result"/> are not the same size.</exception>
        public override void PointwiseMultiply(Vector other, Vector result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            if (Count != other.Count)
            {
                throw new ArgumentException(Resources.ArgumentVectorsSameLength, "other");
            }

            if (Count != result.Count)
            {
                throw new ArgumentException(Resources.ArgumentVectorsSameLength, "result");
            }

            if (ReferenceEquals(this, result) || ReferenceEquals(other, result))
            {
                var tmp = result.CreateVector(result.Count);
                PointwiseMultiply(other, tmp);
                tmp.CopyTo(result);
            }
            else
            {
                CopyTo(result);
                result.PointwiseMultiply(other);
            }
        }
开发者ID:rafaortega,项目名称:mathnet-numerics,代码行数:43,代码来源:DenseVector.cs


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