Class RatingMatrix
Represents a matrix of values for predicted ratings versus true ratings. Usages include a confusion matrix and a loss matrix.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Learners
Assembly: Microsoft.ML.Probabilistic.Learners.Recommender.dll
Syntax
public class RatingMatrix
Constructors
RatingMatrix(Int32, Int32)
Initializes a new instance of the RatingMatrix class.
Declaration
public RatingMatrix(int minRating, int maxRating)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minRating | The minimum rating. |
Int32 | maxRating | The maximum rating. |
Properties
Item[Int32, Int32]
Gets or sets the value of a specified rating pair.
Declaration
public double this[int predictedRating, int trueRating] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | predictedRating | The predicted rating value. |
Int32 | trueRating | The true rating value. |
Property Value
Type | Description |
---|---|
Double | The value at the specified pair of indices. |
Remarks
The specified rating indices should be in the interval [min rating; max rating].
MaxRating
Gets the maximum rating.
Declaration
public int MaxRating { get; }
Property Value
Type | Description |
---|---|
Int32 |
MinRating
Gets the minimum rating.
Declaration
public int MinRating { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AbsoluteErrorLossMatrix(Int32, Int32)
Generates an absolute error loss matrix. That is, the value of each element is equal to the absolute difference of the indices of the element.
Declaration
public static RatingMatrix AbsoluteErrorLossMatrix(int minRating, int maxRating)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minRating | The minimum rating. |
Int32 | maxRating | The maximum rating. |
Returns
Type | Description |
---|---|
RatingMatrix | The generated absolute error loss matrix. |
ComponentwiseProduct(RatingMatrix, RatingMatrix)
Computes the component-wise products of two rating matrices.
Declaration
public static double ComponentwiseProduct(RatingMatrix lhs, RatingMatrix rhs)
Parameters
Type | Name | Description |
---|---|---|
RatingMatrix | lhs | The left-hand side matrix. |
RatingMatrix | rhs | The right-hand side matrix. |
Returns
Type | Description |
---|---|
Double | The sum of the products of the corresponding elements of the two matrices. |
SquaredErrorLossMatrix(Int32, Int32)
Generates a squared error loss matrix. That is, the value of each element is equal to the squared difference of the indices of the element.
Declaration
public static RatingMatrix SquaredErrorLossMatrix(int minRating, int maxRating)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minRating | The minimum rating. |
Int32 | maxRating | The maximum rating. |
Returns
Type | Description |
---|---|
RatingMatrix | The generated squared error loss matrix. |
ZeroOneErrorLossMatrix(Int32, Int32)
Generates a zero-one error loss matrix. That is, the value of each element is equal to zero if its indices are equal, or one otherwise.
Declaration
public static RatingMatrix ZeroOneErrorLossMatrix(int minRating, int maxRating)
Parameters
Type | Name | Description |
---|---|---|
Int32 | minRating | The minimum rating. |
Int32 | maxRating | The maximum rating. |
Returns
Type | Description |
---|---|
RatingMatrix | The generated squared error loss matrix. |