Here's the code from the playground I'm using:
let home_wins_A = Bundle.main.url(forResource: "home_wins_A", withExtension: "csv")
var dataTable_A = try MLDataTable(contentsOf: home_wins_A!)
let home_wins_B = Bundle.main.url(forResource: "home_wins_B", withExtension: "csv")
var dataTable_B = try MLDataTable(contentsOf: home_wins_B!)
// Regression
let (evaluationTable_A, trainingTable_A) = dataTable_A.randomSplit(by: 0.2, seed: 5)
let regressor = try MLRegressor(trainingData: trainingTable_A, targetColumn: "result")
let regressorEvaluation = regressor.evaluation(on: evaluationTable_A)
regressorEvaluation.maximumError
regressorEvaluation.rootMeanSquaredError
// Classification
let (evaluationTable_B, trainingTable_B) = dataTable_B.randomSplit(by: 0.2, seed: 5)
let classifier = try MLClassifier(trainingData: trainingTable_B, targetColumn: "result")
let classifierEvaluation = classifier.evaluation(on: evaluationTable_B)
classifierEvaluation.classificationError
The file home_wins_A has three integer fields: home, away, and result. The first two are the id numbers of the teams. The last field is 1 if the home team won, and 0 otherwise. The file home_wins_B has three string fields with the same names. The first two are three-letter abbreviations of the team names (e.g. "MTL" for Montreal). The last field is "W" if the home team won, and "L" otherwise.
Both files were generated from the same data set, which lists the 11,434 games played in the NHL since 2010. Unfortunately, I don't see any way to attach the CSV files to this post.
Here are the results I'm now getting:
regressorEvaluation.maximumError = 0.852
regressorEvaluation.rootMeanSquaredError = 0.496
classifierEvaluation.classificationError = 0.45
Many thanks for your explanations: they've been very helpful!