Contents

meanSquaredError(_:_:)

Computes the mean squared error between predicted and ground truth values.

Declaration

@backDeployed(before: macOS 15.0, iOS 18.0, tvOS 18.0, visionOS 2.0)
func meanSquaredError<T>(_ predicted: some Collection, _ groundTruth: some Collection) -> T where T : FloatingPoint

Parameters

  • predicted:

    The predicted values.

  • groundTruth:

    The ground truth values. The collection must have same number of elements as the predicted values.

Return Value

The mean squared error.

Discussion

Empty collections of predicted and ground truth values will return a value of NaN.

See Also

Metrics