'Swift // MLDataTable error: Couldn't lookup symbols:

import Cocoa
import CreateML

let data = try MLDataTable(contentsOf: URL(fileURLWithPath: "/Users/allan/Downloads/twitter-sanders-apple3.csv"))

I got this error even though I wrote exactly same code in apple documentation

Also I can import CSV file

    error: Couldn't lookup symbols:
  CreateML.MLDataTable.init(contentsOf: Foundation.URL, options: CreateML.MLDataTable.ParsingOptions) throws -> CreateML.MLDataTable
  CreateML.MLDataTable.init(contentsOf: Foundation.URL, options: CreateML.MLDataTable.ParsingOptions) throws -> CreateML.MLDataTable

How can I fix this error ?

I Use Xcode Version 13.2 (13C90) and M1 macBook air



Solution 1:[1]

I have confronted the same issue in the dataset that you used, so I solved the problem by using COREML tool.

  1. Create your training .csv file, change feature column name as "label"
  2. Create your testing data set by create folders named exactly the same names of the labels. Put each row of the csv test file as a separate txt files. To illustrate you have 5 rows, this means you have to put 5 txt files including row contents. If you find application of the procedure to hard there is a training and test data, I prepared ready in https://github.com/memetcircus/textClassifierDataForCoreML
  3. Open CoreML, create text Classifier
  4. Upload training data and test data. Don't forget!, training data is one csv file but testing data is a folder containing subfolders(like below). So according the example above you upload "testing data FINAL" directory whole to the COREML tool.

testing data structure

  1. hit train

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1