0

我正在尝试从 csv 文件中读取以进行 ML 表格分类并得到以下错误:

Playground execution terminated: An error was thrown and was not caught:
▿ MLCreateError
  ▿ generic : 1 element
    - reason : "Cannot open /Users/.../Desktop/HouseData.csv for read. Cannot open /Users/.../Desktop/HouseData.csv for reading"

这是我在操场上使用的代码:

import CreateML
import Foundation

let houseData = try MLDataTable(contentsOf: URL(fileURLWithPath: "/Users/.../Desktop/HouseData.csv"))
let (trainingCSVData, testCSVData) = houseData.randomSplit(by: 0.8, seed: 0)
let pricer = try MLRegressor(trainingData: houseData, targetColumn: "MEDV")
let csvMetadata = MLModelMetadata(author: "aaa bbb", shortDescription: "A model used to determine the price of a house based on some features.", version: "1.0")
try pricer.write(to: URL(fileURLWithPath: "/Users/.../Desktop/HousePricer.mlmodel"), metadata: csvMetadata)

请帮忙!谢谢

4

1 回答 1

0

将 csv 文件移动到 Documents 而不是 Desktop 工作。

于 2019-11-27T14:20:30.290 回答