2
$\begingroup$

I want to convert excel data into Classifier acceptable data. For Eg, the inbuilt Titanic data for Classifier is structured as below:

{"1st", 29., "female"} -> "survived"

I have 4 columns in Excel "Product","Design","Color","Sold/NorSold" . I can't figure out how I can convert this data to Classifier acceptable data. Any help would be appreciated. I tried using 'Rule' but the results weren't what I wanted.

$\endgroup$
  • $\begingroup$ Have a look at Menu/Help/Wolfram Documentation/Import and get your data imported into Mma. It is straightforward. Then you can apply Classify . $\endgroup$ – Alexei Boulbitch Jan 12 '16 at 10:27
1
$\begingroup$

Use SemanticImport to import your data. This code is based on my data in csv file:

innovate1 = SemanticImport["C:\\Users\\MCS\\Documents\\innovate.csv"]

then you can associate the data using

inno1 = Normal@innovate1[All, Sequence[Most@# -> Last@#] &]

You will get output of form:

    {{0, "male", "AboveAvg", 46, "PrivateBank"} -> 
  "Innovate", {0, "male", "BelowAvg", 45, "PrivateBank"} -> 
  "NotInnovate", {1, "male", "BelowAvg", 45, "PrivateBank"} -> 
  "Innovate"......
$\endgroup$
  • $\begingroup$ Thank you that works! I was using Import instead of SemanticImport $\endgroup$ – Trier Jan 14 '16 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.