本文整理汇总了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();
}
示例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;
}
示例3: BackPropogate
private Vector<double> BackPropogate(Matrix<double> thetaL, Vector<double> activationL,
Vector<double> deltaLPlus1)
{
return
thetaL.TransposeThisAndMultiply(deltaLPlus1)
.PointwiseMultiply(activationL.PointwiseMultiply(1 - activationL));
}
示例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);
}
}