thisIsTheFoxe
thisIsTheFoxe

Reputation: 1713

Using a sequence in CreateML to record device motion

so I want to train a MLClassifier to identify a specific device motion. So what I did was to record the motion data and very recorded data I labeled accordingly. When that didn't quite worked as I hoped, I started to realize that I have to record the "motion" itself and not only momentarily.

So I packed 5 dataSets (dictionaries) in a row and that was my new training feature. So I thought, but trying to train my new data I watched this error trying to create my Classifier:

Value encountered in column 's' is of type 'dictionary' cannot be mapped to a categorical value. Categorical values must be integer, strings, or None.

Now I'm slowly giving up... Has anyone of you a suggestion or know why I can't use sequences (arrays) as features?

...

Btw, here is some sample data of my JSON:

[{"s":[{"rZ":-1.0,"p":0.2,"aY":-0.0,"rX":1.5,"y":0.1,"r":-1.3,"aZ":0.2,"rY":-2.8,"aX":0.6},{"rZ":-1.9,"p":0.2,"aY":0.0,"rX":2.0,"y":0.2,"r":-1.4,"aZ":0.0,"rY":-3.2,"aX":0.5},{"rZ":-1.8,"p":0.3,"aY":0.0,"rX":2.4,"y":0.2,"r":-1.5,"aZ":0.9,"rY":-4.8,"aX":0.5},{"rZ":-1.6,"p":0.3,"aY":0.0,"rX":2.5,"y":0.3,"r":-1.6,"aZ":0.9,"rY":-3.8,"aX":0.6},{"rZ":-1.8,"p":0.3,"aY":0.1,"rX":2.2,"y":0.3,"r":-1.7,"aZ":0.1,"rY":-3.0,"aX":0.6}],"v":0}]

And the code I use to create my model:

do{
    let a = try MLDataTable(contentsOf: dummyJSONurl)
    let recognizer = try MLClassifier(trainingData: a, targetColumn: "v")
}catch let er{
    er
} 

Upvotes: 0

Views: 249

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7892

You can't use sequences because MLClassifier isn't a classifier that can work on sequences. Perhaps Apple will add this in a future release but for now it appears that you'll have to use a more capable tool.

Upvotes: 2

Related Questions