本文整理汇总了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);
}
示例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;
}
}
示例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);
}
示例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);
}