Skip to main content
edited tags
Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 206
  • 365
Tweeted twitter.com/StackMma/status/1318159997407268864
Source Link
holistic
  • 3k
  • 15
  • 38

How to use classify to separate lines and circles

I generated lines and circles:

lines = Table[
   Graphics[
    Line[{{RandomInteger[{0, 10}], 
       RandomInteger[{0, 10}]}, {RandomInteger[{0, 10}], 
       RandomInteger[{0, 10}]}}], ImageSize -> 10], {x, 1, 20}];
circles = 
  Table[Graphics[
    Circle[{RandomInteger[{0, 10}], RandomInteger[{0, 10}]}, 
     RandomInteger[{0, 20}]], ImageSize -> 10], {x, 1, 20}];

and put them into a classifier

c = Classify[{lines -> "lines", circles -> "circles"}]

the training was successful with no errors, but when trying to test the classifier with:

test = Graphics[Line[{{0, 1}, {0, 2}}], ImageSize -> 10]
c[test]

I get the error:

ClassifierFunction::mlbddataev: The data being evaluated is not formatted correctly.

And I do not understand what the problem is. Can somebody tell me, how to correctly format the data?