0

I understand it is vague but I am still in the learning process. I am trying to create a MLRecommender. I am inputting the datable, user column and item column but when I run the application to create a .ml file I get this error:

let recommender = try MLRecommender(trainingData: dataTable, userColumn: "id", itemColumn: "priority")

▿ Item IDs in the recommender model must be numbered 0, 1, ..., num_items - 1. ▿ generic : 1 element - reason : "Item IDs in the recommender model must be numbered 0, 1, ..., num_items - 1."

I have been changing the bolded values and I even added an id section to my datable and have not yet found anything to fix it. Thank you for your time. here is my datable |MoviesTitles-(String)|Genre-(String)|FeaturedIn-(String)|id(Int)|

  • 1
    What does your `dataTable` looks like, is the **priority** column of the correct type? As per [official docs](https://developer.apple.com/documentation/createml/mlrecommender/3152799-init): **itemColumn**: _The name of the column in trainingData that contains the recommendation items. The underlying type of this column must be an integer or a string._ – Igor Nov 20 '19 at 21:07
  • I did a new edit – Anthony Titus Nov 21 '19 at 00:12
  • You don't seem to have **priority** column in your `dataTable`, hence the error. And it appears that the **id** column, that you've defined as user ID (`userColumn: "id"`), is actually the Movie ID i.e. the **itemColumn**. Take a look at the intro video [here](https://developer.apple.com/videos/play/wwdc2019/427/), might give you an idea how your training data should look like, and how to use it. – Igor Nov 21 '19 at 01:24
  • Thank you that video solved it – Anthony Titus Nov 21 '19 at 17:48
  • Glad it helped. Could you post an answer to your question, what have you changed to make it work, and accept the answer so that the question is marked as resolved. – Igor Nov 21 '19 at 19:29
  • @AnthonyTitus I seem to be having the same issue but I'm not able to get past it. Can you post more details about how you solved your problem? – Hunter Feb 09 '20 at 17:45
  • see also this for details why this error happens: https://www.pawelmadej.com/post/mlrecommender-in-practice/ – Paweł Madej Jul 10 '20 at 09:40

0 Answers0