266 references to VectorUtils
Microsoft.ML.Core.Tests (33)
UnitTests\TestVBuffer.cs (33)
57
VectorUtils
.ScaleBy(ref actualDst, c);
77
VectorUtils
.ScaleBy(ref dst, c);
78
VectorUtils
.ScaleBy(a, ref actualDst, c);
103
Assert.True(CompareNumbersWithTolerance(sum,
VectorUtils
.Sum(in a), digitsOfPrecision: tol));
104
Assert.True(CompareNumbersWithTolerance(l1,
VectorUtils
.L1Norm(in a), digitsOfPrecision: tol));
105
Assert.True(CompareNumbersWithTolerance(l2Squared,
VectorUtils
.NormSquared(in a), digitsOfPrecision: tol));
106
Assert.True(CompareNumbersWithTolerance(l2,
VectorUtils
.Norm(in a), digitsOfPrecision: tol));
107
Assert.True(CompareNumbersWithTolerance(infNorm,
VectorUtils
.MaxNorm(in a), digitsOfPrecision: tol));
122
VectorUtils
.ScaleBy(ref a, d);
151
VectorUtils
.MulElementWise(in a, ref a2DenseVbuff);
174
VectorUtils
.MulElementWise(in a2DenseVbuff, ref a);
192
VectorUtils
.MulElementWise(in a, ref a2);
193
VectorUtils
.SparsifyNormalize(ref a2, 2, 2, normalize: false);
212
VectorUtils
.MulElementWise(in a, ref a2);
213
VectorUtils
.SparsifyNormalize(ref a2, 2, 2, normalize: false);
240
VectorUtils
.MulElementWise(in a, ref a2);
241
VectorUtils
.SparsifyNormalize(ref a2, 2, 3, normalize: norm);
266
VectorUtils
.MulElementWise(in a, ref b);
267
VectorUtils
.SparsifyNormalize(ref b, 2, 2, normalize: norm);
287
VectorUtils
.SparsifyNormalize(ref a, 3, 3, normalize);
311
VectorUtils
.SparsifyNormalize(ref a, top, bottom, false);
540
/// Naive version of <see cref="
VectorUtils
.AddMultWithOffset(in VBuffer{float}, float, ref VBuffer{float}, int)"/>,
589
VectorUtils
.AddMult(in a, c, ref actualDst);
595
VectorUtils
.Add(in a, ref actualDst);
618
VectorUtils
.AddMult(in a, c, ref b, ref actualDst);
643
VectorUtils
.AddMultWithOffset(in a, c, ref actualDst, offset);
670
VectorUtils
.ScaleInto(in a, c, ref actualDst);
692
VectorUtils
.AddMultInto(in a, c, in b, ref actualDst);
836
Assert.True(CompareNumbersWithTolerance(l1Dist,
VectorUtils
.L1Distance(in a, in b), digitsOfPrecision: tol));
837
Assert.True(CompareNumbersWithTolerance(l2Dist2,
VectorUtils
.L2DistSquared(in a, in b), digitsOfPrecision: tol));
838
Assert.True(CompareNumbersWithTolerance(l2Dist,
VectorUtils
.Distance(in a, in b), digitsOfPrecision: tol));
839
Assert.True(CompareNumbersWithTolerance(dot,
VectorUtils
.DotProduct(in a, in b), digitsOfPrecision: tol));
1077
/// we see in <see cref="
VectorUtils
"/> and <see cref="VBufferUtils"/>, e.g., various
Microsoft.ML.Data (9)
Evaluators\ClusteringEvaluator.cs (4)
307
Single denom =
VectorUtils
.Distance(in centroidI, in centroidJ);
364
VectorUtils
.ScaleBy(ref _clusterCentroids[i], (Single)(1.0 / _numInstancesOfClstr[i]));
372
var distance =
VectorUtils
.Distance(in _clusterCentroids[assigned], in features);
463
VectorUtils
.Add(in _features, ref _clusterCentroids[_indicesArr[0]]);
Evaluators\MultiOutputRegressionEvaluator.cs (3)
516
dst =
VectorUtils
.L1Distance(in label, in score);
526
dst =
VectorUtils
.L2DistSquared(in label, in score);
536
dst = MathUtils.Sqrt(
VectorUtils
.L2DistSquared(in label, in score));
Scorers\ClusteringScorer.cs (1)
111
int index =
VectorUtils
.ArgMin(in score);
Scorers\MulticlassClassificationScorer.cs (1)
579
int index =
VectorUtils
.ArgMax(in score);
Microsoft.ML.Ensemble (8)
OutputCombiners\BaseMultiAverager.cs (3)
49
VectorUtils
.Add(in src[i], ref dst);
58
VectorUtils
.AddMult(in src[i], w, ref dst);
62
VectorUtils
.ScaleBy(ref dst, 1 / weightTotal);
OutputCombiners\BaseMultiCombiner.cs (2)
89
var sum =
VectorUtils
.L1Norm(in values[i]);
93
VectorUtils
.ScaleBy(ref values[i], 1 / sum);
OutputCombiners\MultiVoting.cs (1)
92
int index =
VectorUtils
.ArgMax(in src[i]);
Selector\DiversityMeasure\MultiDisagreementDiversityMeasure.cs (2)
22
return (
VectorUtils
.ArgMax(in valueX) !=
VectorUtils
.ArgMax(in valueY)) ? 1 : 0;
Microsoft.ML.FastTree (2)
FastTree.cs (1)
2943
Numeric.
VectorUtils
.SparsifyNormalize(ref dst, top, bottom, normalize);
GamModelParameters.cs (1)
433
Numeric.
VectorUtils
.SparsifyNormalize(ref contributions, top, bottom, normalize);
Microsoft.ML.KMeansClustering (29)
KMeansModelParameters.cs (3)
169
float instanceL2 =
VectorUtils
.NormSquared(in src);
173
-2 *
VectorUtils
.DotProduct(in _centroids[i], in src) + _centroidL2s[i] + instanceL2);
270
_centroidL2s[i] =
VectorUtils
.NormSquared(_centroids[i]);
KMeansPlusPlusTrainer.cs (26)
394
l2 =
VectorUtils
.NormSquared(cursor.Features);
399
var distance = -2 *
VectorUtils
.DotProduct(in cursor.Features, in centroids[j])
441
centroidL2s[i] = cachedCandidateL2 ??
VectorUtils
.NormSquared(candidate);
642
MathUtils.Sqrt(newClusterL2 - 2 *
VectorUtils
.DotProduct(in newClusterFeatures, in oldClusterFeatures) + oldClusterL2);
699
float pointNorm =
VectorUtils
.NormSquared(in point);
720
Contracts.Assert(-2 *
VectorUtils
.DotProduct(in point, in clusters[j]) + clustersL2s[j] > bestWeight);
724
float weight = -2 *
VectorUtils
.DotProduct(in point, in clusters[j]) + clustersL2s[j];
860
clustersL2s[clusterCount] =
VectorUtils
.NormSquared(clusters[clusterCount]);
896
clustersL2s[clusterCount] =
VectorUtils
.NormSquared(clusters[clusterCount]);
1116
VectorUtils
.Add(in features, ref CachedSum[cluster]);
1122
VectorUtils
.Add(in features, ref CachedSum[cluster]);
1124
VectorUtils
.AddMult(in features, -1, ref CachedSum[previousCluster]);
1135
VectorUtils
.Add(in features, ref Centroids[cluster]);
1164
VectorUtils
.Add(in workChunkArr[i].CachedSum[j], ref reducedState.CachedSum[j]);
1165
VectorUtils
.Add(in workChunkArr[i].Centroids[j], ref reducedState.Centroids[j]);
1211
VectorUtils
.Add(in CachedSum[i], ref Centroids[i]);
1214
VectorUtils
.ScaleBy(ref Centroids[i], (float)(1.0 / ClusterSizes[i]));
1218
float clusterDelta = MathUtils.Sqrt(
VectorUtils
.L2DistSquared(in Centroids[i], in centroids[i]));
1225
centroidL2s[i] =
VectorUtils
.NormSquared(Centroids[i]);
1305
float instanceNormSquared =
VectorUtils
.NormSquared(in features);
1337
float bestDistance = MathUtils.Sqrt(
VectorUtils
.L2DistSquared(in features, in centroids[_bestCluster[n]]));
1343
float distance = MathUtils.Sqrt(
VectorUtils
.L2DistSquared(in features, in centroids[j]));
1363
centroidL2s[i] =
VectorUtils
.NormSquared(in centroids[i]);
1425
VectorUtils
.Add(in cursor.Features, ref cachedSumCopy[state.GetBestCluster(id)]);
1804
float distance = -2 *
VectorUtils
.DotProduct(in features, in centroids[j]) + centroidL2s[j];
1827
float l2 =
VectorUtils
.NormSquared(in features);
Microsoft.ML.PCA (33)
PcaTrainer.cs (19)
245
VectorUtils
.ScaleBy(v, 1 /
VectorUtils
.Norm(y[i]));
249
VectorUtils
.AddMult(v, y[j], -
VectorUtils
.DotProduct(v, y[j]));
261
b2[i * oversampledRank + j] = b2[j * oversampledRank + i] =
VectorUtils
.DotProduct(b[i], b[j]);
318
VectorUtils
.AddMult(in cursor.Features, cursor.Weight, ref mean);
321
VectorUtils
.AddMult(
324
cursor.Weight *
VectorUtils
.DotProduct(omega[i], in cursor.Features));
337
VectorUtils
.ScaleBy(y[i], invn);
341
VectorUtils
.ScaleBy(ref mean, invn);
343
VectorUtils
.AddMult(in mean, y[i], -
VectorUtils
.DotProduct(omega[i], in mean));
463
_meanProjected[i] =
VectorUtils
.DotProduct(in _eigenVectors[i], in mean);
470
_norm2Mean =
VectorUtils
.NormSquared(mean);
497
_norm2Mean =
VectorUtils
.NormSquared(_mean);
512
_meanProjected[i] =
VectorUtils
.DotProduct(in _eigenVectors[i], in _mean);
637
float norm2X =
VectorUtils
.NormSquared(in src) -
638
2 *
VectorUtils
.DotProduct(in mean, in src) + _norm2Mean;
647
float component =
VectorUtils
.DotProduct(in _eigenVectors[i], in src) - _meanProjected[i];
PcaTransformer.cs (14)
177
MeanProjected[i] =
VectorUtils
.DotProduct(Eigenvectors[i], mean);
357
VectorUtils
.ScaleBy(v, 1 /
VectorUtils
.Norm(y[iinfo][i])); // normalize
361
VectorUtils
.AddMult(v, y[iinfo][j], -
VectorUtils
.DotProduct(v, y[iinfo][j])); //subtract the projection of y[j] on v
376
b2[i * oversampledRank[iinfo] + j] = b2[j * oversampledRank[iinfo] + i] =
VectorUtils
.DotProduct(b[iinfo][i], b[iinfo][j]);
444
VectorUtils
.AddMult(in features, mean[iinfo], weight);
447
VectorUtils
.AddMult(in features, y[iinfo][i], weight *
VectorUtils
.DotProductWithOffset(omega[iinfo][i], 0, in features));
463
VectorUtils
.ScaleBy(y[iinfo][i], invn);
467
VectorUtils
.ScaleBy(mean[iinfo], invn);
469
VectorUtils
.AddMult(mean[iinfo], y[iinfo][i], -
VectorUtils
.DotProduct(omega[iinfo][i], mean[iinfo]));
594
editor.Values[i] =
VectorUtils
.DotProductWithOffset(transformInfo.Eigenvectors[i], 0, in src) -
Microsoft.ML.StandardTrainers (146)
LdSvm\LdSvmModelParameters.cs (5)
254
score += Math.Tanh(_sigma * (
VectorUtils
.DotProduct(in _thetaPrime[current], in src) + _biasThetaPrime[current])) *
255
(
VectorUtils
.DotProduct(in _w[current], in src) + _biasW[current]);
256
childIndicator =
VectorUtils
.DotProduct(in _theta[current], in src) + _biasTheta[current];
259
score += Math.Tanh(_sigma * (
VectorUtils
.DotProduct(in _thetaPrime[current], in src) + _biasThetaPrime[current])) *
260
(
VectorUtils
.DotProduct(in _w[current], in src) + _biasW[current]);
LdSvm\LdSvmTrainer.cs (12)
212
tanhThetaTx[i] = (float)Math.Tanh(gamma * (
VectorUtils
.DotProduct(in feat, in theta[i]) + biasTheta[i]));
216
float tempGrad = pathWt[i] * localWt[i] * (
VectorUtils
.DotProduct(in feat, in w[i]) + biasW[i]);
241
tempSum += Math.Abs(
VectorUtils
.DotProduct(in s, in theta[thetaIdx]) + biasTheta[thetaIdx]);
299
VectorUtils
.ScaleBy(ref tempW[i], coef);
301
VectorUtils
.ScaleBy(ref tempTheta[i], coef);
303
VectorUtils
.ScaleBy(ref tempThetaPrime[i], coef);
324
var tanhDist = (float)Math.Tanh(gamma * (
VectorUtils
.DotProduct(in features, in theta[i]) + biasTheta[i]));
331
localWt[l] = (float)Math.Tanh(_options.Sigma * (
VectorUtils
.DotProduct(in features, in thetaPrime[l]) + biasThetaPrime[l]));
337
wDotX[l] =
VectorUtils
.DotProduct(in features, in w[l]) + biasW[l];
355
VectorUtils
.AddMult(in features, tempGradW, ref tempW[l]);
363
VectorUtils
.AddMult(in features, tempGradThetaPrime, ref tempThetaPrime[l]);
371
VectorUtils
.AddMult(in features, tempGradTheta, ref tempTheta[m]);
Optimizer\DifferentiableFunction.cs (22)
98
VectorUtils
.ScaleBy(ref _tempGrads[chunkIndex], 0);
108
VectorUtils
.Add(in tempGrad, ref _tempGrads[chunkIndex]);
131
VectorUtils
.ScaleBy(ref gradient, 0);
138
VectorUtils
.Add(in _tempGrads[c], ref gradient);
190
float normX =
VectorUtils
.Norm(x);
216
float norm =
VectorUtils
.Norm(dir);
217
VectorUtils
.ScaleBy(ref dir, 1 / norm);
219
VectorUtils
.AddMultInto(in x, Eps, in dir, ref newX);
222
VectorUtils
.AddMultInto(in x, -Eps, in dir, ref newX);
225
float dirDeriv =
VectorUtils
.DotProduct(in grad, in dir);
256
float normX =
VectorUtils
.Norm(x);
266
VectorUtils
.AddMultInto(in x, Eps, in dir, ref newX);
269
VectorUtils
.AddMultInto(in x, -Eps, in dir, ref newX);
272
float dirDeriv =
VectorUtils
.DotProduct(in grad, in dir);
295
float normX =
VectorUtils
.Norm(x);
305
VectorUtils
.AddMultInto(in x, Eps, in dir, ref newX);
308
VectorUtils
.AddMultInto(in x, -Eps, in dir, ref newX);
311
float dirDeriv =
VectorUtils
.DotProduct(in grad, in dir);
333
float normDir =
VectorUtils
.Norm(dir);
336
float dirDeriv =
VectorUtils
.DotProduct(in newGrad, in dir);
340
VectorUtils
.AddMultInto(in x, scaledEps, in dir, ref newX);
343
VectorUtils
.AddMultInto(in x, -scaledEps, in dir, ref newX);
Optimizer\L1Optimizer.cs (9)
166
VectorUtils
.AddMultInto(in _x, alpha, in _dir, ref _newX);
199
float dirDeriv = -
VectorUtils
.DotProduct(in _dir, in _steepestDescDir);
209
float alpha = (Iter == 1 ? (1 /
VectorUtils
.Norm(_dir)) : 1);
211
float unnormCos =
VectorUtils
.DotProduct(in _steepestDescDir, in _newX) -
VectorUtils
.DotProduct(in _steepestDescDir, in _x);
222
unnormCos =
VectorUtils
.DotProduct(in _steepestDescDir, in _newX) -
VectorUtils
.DotProduct(in _steepestDescDir, in _x);
242
unnormCos =
VectorUtils
.DotProduct(in _steepestDescDir, in _newX) -
VectorUtils
.DotProduct(in _steepestDescDir, in _x);
Optimizer\LineSearch.cs (8)
464
float d1 =
VectorUtils
.DotProduct(in x, in _c1);
465
float d2 =
VectorUtils
.DotProduct(in x, in _c2);
466
float d3 =
VectorUtils
.DotProduct(in x, in _c3);
468
VectorUtils
.AddMult(in _c1, d1, ref grad);
469
VectorUtils
.AddMult(in _c2, d2, ref grad);
517
float norm =
VectorUtils
.Norm(grad);
528
Console.WriteLine(
VectorUtils
.Norm(grad));
537
Console.WriteLine(
VectorUtils
.Norm(grad));
Optimizer\OptimizationMonitor.cs (2)
323
float gradientNormSquared =
VectorUtils
.NormSquared(gradient);
380
float norm =
VectorUtils
.Norm(grad);
Optimizer\Optimizer.cs (16)
261
alphas[i] = -
VectorUtils
.DotProduct(in _sList[i], in _dir) / _roList[i];
262
VectorUtils
.AddMult(in _yList[i], alphas[i], ref _dir);
272
float yDotY =
VectorUtils
.DotProduct(in _yList[lastGoodRo], in _yList[lastGoodRo]);
273
VectorUtils
.ScaleBy(ref _dir, _roList[lastGoodRo] / yDotY);
279
float beta =
VectorUtils
.DotProduct(in _yList[i], in _dir) / _roList[i];
280
VectorUtils
.AddMult(in _sList[i], -alphas[i] - beta, ref _dir);
318
VectorUtils
.ScaleInto(in _grad, -1, ref _dir);
357
VectorUtils
.AddMultInto(in _newX, -1, in _x, ref nextS);
358
VectorUtils
.AddMultInto(in _newGrad, -1, in _grad, ref nextY);
359
float ro =
VectorUtils
.DotProduct(in nextS, in nextY);
383
float dirDeriv =
VectorUtils
.DotProduct(in _dir, in _grad);
395
float alpha = (Iter == 1 ? (1 /
VectorUtils
.Norm(_dir)) : 1);
404
VectorUtils
.AddMultInto(in _x, alpha, in _dir, ref _newX);
425
dirDeriv =
VectorUtils
.DotProduct(in _dir, in _newGrad);
485
VectorUtils
.AddMultInto(in _x, alpha, in _dir, ref _newX);
499
dirDeriv =
VectorUtils
.DotProduct(in _dir, in _newGrad);
Optimizer\SgdOptimizer.cs (16)
183
VectorUtils
.ScaleBy(ref step, _momentum);
205
VectorUtils
.AddMult(in grad, scale, ref step);
211
VectorUtils
.ScaleBy(prev, ref avg, (float)n / (n + 1));
212
VectorUtils
.AddMult(in step, -stepSize, ref x);
213
VectorUtils
.AddMult(in x, (float)1 / (n + 1), ref avg);
224
VectorUtils
.AddMult(in step, -stepSize, ref prev, ref x);
314
public float Deriv =>
VectorUtils
.DotProduct(in _dir, in _grad);
324
VectorUtils
.ScaleInto(in _grad, -1, ref _dir);
331
VectorUtils
.AddMultInto(in _point, step, in _dir, ref _newPoint);
333
deriv =
VectorUtils
.DotProduct(in _dir, in _newGrad);
341
float newByNew =
VectorUtils
.NormSquared(_newGrad);
342
float newByOld =
VectorUtils
.DotProduct(in _newGrad, in _grad);
343
float oldByOld =
VectorUtils
.NormSquared(_grad);
346
VectorUtils
.ScaleBy(ref _dir, beta);
347
VectorUtils
.AddMult(in _newGrad, -1, ref _dir);
350
VectorUtils
.ScaleInto(in _newGrad, -1, ref _dir);
Standard\LinearModelParameters.cs (6)
269
return Bias +
VectorUtils
.DotProduct(in weights, in src);
272
return Bias +
VectorUtils
.DotProduct(in _weightsDense, in src);
282
VectorUtils
.MulElementWise(in weights, ref contributions);
283
VectorUtils
.SparsifyNormalize(ref contributions, top, bottom, normalize);
345
VectorUtils
.Add(in subweights, ref weights);
348
VectorUtils
.ScaleBy(ref weights, (float)1 / models.Count);
Standard\LogisticRegression\LbfgsPredictorBase.cs (4)
357
VectorUtils
.AddMult(in x, -1, ref oldWeights);
358
float normDiff =
VectorUtils
.Norm(oldWeights);
788
VectorUtils
.ScaleBy(ref gradient, scaleFactor);
828
VectorUtils
.Add(in _localGradients[i - 1], ref gradient);
Standard\LogisticRegression\LogisticRegression.cs (4)
195
float score = bias +
VectorUtils
.DotProductWithOffset(in x, 1, in feat);
210
VectorUtils
.AddMultWithOffset(in feat, mult, ref grad, 1); // Note that 0th L-BFGS weight is for bias.
241
var regLoss =
VectorUtils
.NormSquared(currentWeightsValues.Slice(1)) * L2Weight;
349
var score = bias +
VectorUtils
.DotProductWithOffset(in CurrentWeights, 1, in cursor.Features);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (4)
254
scores[c] = bias +
VectorUtils
.DotProductWithOffset(in x, start, in feat);
269
VectorUtils
.AddMultWithOffset(in feat, mult, ref grad, start);
327
var regLoss =
VectorUtils
.NormSquared(CurrentWeights.GetValues().Slice(BiasCount)) * L2Weight;
791
editor.Values[i] = Biases[i] +
VectorUtils
.DotProduct(in weights[i], in src);
Standard\Online\AveragedLinear.cs (9)
185
return (TotalBias +
VectorUtils
.DotProduct(in feat, in TotalWeights)) / (float)NumWeightUpdates;
199
VectorUtils
.AddMult(in Weights, NumNoUpdates * WeightsScale, ref TotalWeights);
211
VectorUtils
.ScaleInto(in TotalWeights, 1 / (float)NumWeightUpdates, ref Weights);
236
VectorUtils
.AddMult(in Weights, NumNoUpdates * WeightsScale, ref TotalWeights);
251
VectorUtils
.AddMult(in feat, biasUpdate / WeightsScale, ref Weights);
270
VectorUtils
.ScaleInto(in TotalWeights, 1 / (float)NumWeightUpdates, ref Weights);
284
VectorUtils
.AddMult(in Weights, WeightsScale, ref TotalWeights);
289
VectorUtils
.AddMult(in Weights, Gain * WeightsScale, ref TotalWeights);
300
VectorUtils
.ScaleBy(ref TotalWeights, scale);
Standard\Online\AveragedPerceptron.cs (1)
144
VectorUtils
.ScaleBy(ref weights, 1 / (float)NumWeightUpdates);
Standard\Online\LinearSvm.cs (5)
195
VectorUtils
.ScaleInto(in feat, currentBiasUpdate, ref _weightsUpdate);
199
VectorUtils
.AddMult(in feat, currentBiasUpdate, ref _weightsUpdate);
234
VectorUtils
.AddMult(in weightsUpdate, rate * weightsUpdateScale / (_numBatchExamples * WeightsScale), ref Weights);
243
float normalizer = 1 / (MathUtils.Sqrt(_lambda) *
VectorUtils
.Norm(Weights) * Math.Abs(WeightsScale));
258
=> Bias +
VectorUtils
.DotProduct(in feat, in Weights) * WeightsScale;
Standard\Online\OnlineGradientDescent.cs (1)
121
VectorUtils
.ScaleBy(ref weights, 1 / (float)NumWeightUpdates);
Standard\Online\OnlineLinear.cs (3)
183
VectorUtils
.ScaleBy(ref Weights, WeightsScale);
237
=> Bias +
VectorUtils
.DotProduct(in feat, in Weights) * WeightsScale;
298
float maxNorm = Math.Max(
VectorUtils
.MaxNorm(in state.Weights), Math.Abs(state.Bias));
Standard\PoissonRegression\PoissonRegression.cs (2)
171
float dot =
VectorUtils
.DotProductWithOffset(in x, 1, in feat) + bias;
176
VectorUtils
.AddMultWithOffset(in feat, mult, ref grad, 1);
Standard\SdcaBinary.cs (12)
132
return
VectorUtils
.DotProduct(in weights, in features) + bias;
137
return
VectorUtils
.DotProduct(in weights, in features) * (float)scaling + bias;
319
return
VectorUtils
.DotProduct(in weights, in features) + bias;
583
var normSquared =
VectorUtils
.NormSquared(features);
824
var featuresNormSquared =
VectorUtils
.NormSquared(features);
861
VectorUtils
.AddMult(in features, weightsEditor.Values, primalUpdate);
996
Double l1Regularizer = l1Threshold * l2Const * (
VectorUtils
.L1Norm(in weights[0]) + Math.Abs(biasReg[0]));
997
var l2Regularizer = l2Const * (
VectorUtils
.NormSquared(weights[0]) + biasReg[0] * biasReg[0]) * 0.5;
2094
var newLoss = lossSum.Sum / count + l2Weight *
VectorUtils
.NormSquared(weights) * 0.5;
2136
VectorUtils
.AddMult(in features, weightsEditor.Values, (float)(step / weightScaling));
2155
VectorUtils
.ScaleBy(ref weights, (float)weightScaling); // normalize the weights
2198
VectorUtils
.ScaleBy(ref weights, (float)weightScaling); // restore the true weights
Standard\SdcaMulticlass.cs (5)
218
normSquared =
VectorUtils
.NormSquared(in features);
279
VectorUtils
.AddMult(in features, weightsEditor.Values, -primalUpdate);
314
VectorUtils
.AddMult(in features, weightsEditor.Values, labelPrimalUpdate);
421
weightsL1Norm +=
VectorUtils
.L1Norm(in weights[iClass]) + Math.Abs(biasReg[iClass]);
422
weightsL2NormSquared +=
VectorUtils
.NormSquared(weights[iClass]) + biasReg[iClass] * biasReg[iClass];
Microsoft.ML.Sweeper (4)
Algorithms\NelderMead.cs (4)
328
var dist =
VectorUtils
.Distance(x, y);
386
VectorUtils
.AddMult(_simplexVertices.ElementAt(i).Value, centroid, scale);
393
VectorUtils
.AddMult(centroid, newPoint, 1 + delta);
394
VectorUtils
.AddMult(worst, newPoint, -delta);
Microsoft.ML.Transforms (2)
FourierDistributionSampler.cs (2)
114
return
VectorUtils
.L2DistSquared(in first, in second);
235
return
VectorUtils
.L1Distance(in first, in second);