2 writes to ApproximationRank
Microsoft.ML.Recommender (2)
MatrixFactorizationPredictor.cs (2)
101buffer.Get(out NumberOfRows, out NumberOfColumns, out ApproximationRank, out var leftFactorMatrix, out var rightFactorMatrix); 142ApproximationRank = ctx.Reader.ReadInt32();
24 references to ApproximationRank
Microsoft.ML.Recommender (20)
MatrixFactorizationPredictor.cs (20)
68/// This is two dimensional matrix with size of <see cref="NumberOfRows"/> * <see cref="ApproximationRank"/> flattened into one-dimensional matrix. 78/// This is two dimensional matrix with size of <see cref="ApproximationRank"/> * <see cref="NumberOfColumns"/> flattened into one-dimensional matrix. 106_host.Assert(_leftFactorMatrix.Length == NumberOfRows * ApproximationRank); 107_host.Assert(_rightFactorMatrix.Length == ApproximationRank * NumberOfColumns); 143_host.CheckDecode(ApproximationRank > 0); 145_leftFactorMatrix = Utils.ReadSingleArray(ctx.Reader, checked(NumberOfRows * ApproximationRank)); 146_rightFactorMatrix = Utils.ReadSingleArray(ctx.Reader, checked(NumberOfColumns * ApproximationRank)); 180_host.Check(ApproximationRank > 0, "Number of latent factors must be positive"); 183ctx.Writer.Write(ApproximationRank); 184_host.Check(Utils.Size(_leftFactorMatrix) == NumberOfRows * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix P in LIBMF paper)"); 185_host.Check(Utils.Size(_rightFactorMatrix) == NumberOfColumns * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix Q in LIBMF paper)"); 196writer.WriteLine("# P in R^({0} x {1}), rows correspond to Y item", NumberOfRows, ApproximationRank); 200if (i % ApproximationRank == ApproximationRank - 1) 205writer.WriteLine("# Q in R^({0} x {1}), rows correspond to X item", NumberOfColumns, ApproximationRank); 209if (i % ApproximationRank == ApproximationRank - 1) 301int rowOffset = rowIndex * ApproximationRank; 303int columnOffset = columnIndex * ApproximationRank; 304for (int i = 0; i < ApproximationRank; i++)
Microsoft.ML.Tests (4)
TrainerEstimators\MatrixFactorizationTests.cs (4)
90Assert.Equal(model.Model.ApproximationRank, options.ApproximationRank); 93Assert.Equal(leftMatrix.Count, model.Model.NumberOfRows * model.Model.ApproximationRank); 94Assert.Equal(rightMatrix.Count, model.Model.NumberOfColumns * model.Model.ApproximationRank); 820int k = model.Model.ApproximationRank;