0
votes

I am working on a school project for data mining, where we were given CSV data from kaggle (this is how the data looks (2 lines out of 6970)):

4,1970,Female,150,DomesticPartnersKids,Bachelor's Degree,Democrat,,Yes,No,No,No,Yes,Public,No,Yes,No,Yes,No,No,Yes,Science,Study first,Yes,Yes,No,No,Receiving,No,No,Pragmatist,No,No,Cool headed,Standard hours,No,Happy,Yes,Yes,Yes,No,A.M.,No,End,Yes,No,Me,Yes,Yes,No,Yes,No,Mysterious,No,No,,,,,,,,,,Mac,Yes,Cautious,No,Umm...,No,Space,Yes,In-person,No,Yes,Yes,No,Yay people!,Yes,Yes,Yes,Yes,Yes,No,Yes,,,,,,,,,,,,,,,,,No,No,No,Only-child,Yes,No,No
5,1997,Male,75,Single,High School Diploma,Republican,,Yes,Yes,No,,Yes,Private,No,No,No,Yes,No,No,Yes,Science,Study first,,Yes,No,Yes,Receiving,No,Yes,Pragmatist,No,Yes,Cool headed,Odd hours,No,Right,Yes,No,No,Yes,A.M.,Yes,Start,Yes,Yes,Circumstances,No,Yes,No,Yes,Yes,Mysterious,No,No,Tunes,Technology,Yes,Yes,Yes,Yes,No,Supportive,No,PC,No,Cautious,No,Umm...,No,Space,No,In-person,No,No,Yes,Yes,Grrr people,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,Own,Pessimist,Mom,No,No,No,No,Nope,Yes,No,No,No,Yes,No,Yes,No,Yes,No

and we have to get this to an .arff format for use in weka. I manualy typed the header(107 attributes)

@ATTRIBUTE  user_id  NUMERIC
@ATTRIBUTE  yob      NUMERIC
@ATTRIBUTE  gender   {Male,Female}
@ATTRIBUTE  income   {150,100,75,50,25,10}
@ATTRIBUTE  householdstatus {MarriedKids,Married,DomesticPartnersKids,DomesticPartners,Single,SingleKids}
@ATTRIBUTE  educationlevel {Bachelor's Degree,High School Diploma,Current K-12,Current Undergraduate,Master's Degree,Associate's Degree,Doctoral Degree}
@ATTRIBUTE  party {Democrat,Republican}
@ATTRIBUTE  Q124742 {Yes,No}
@ATTRIBUTE  Q124122 {Yes,No}

and I get this error :

} expected at end of enumeration read token eol

Then I tried to use the weka converter but it gave me an error

Wrong number of values.Read 2,expected 1,read Token[EOL],line 4 Problem encountered at line:3

1
What Kaggle project? I'll give it a try if I can get the data file. - zbicyclist

1 Answers

1
votes

Here's what I did: From Kaggle, I downloaded train.csv (5568 instances, highest ID numbeer 6960).

I didn't use the converter -- just loaded it into the Weka Explorer as a CSV file. Some problems and their solution:

  1. Line 3: First instance of "Bachelor's Degree". It did NOT like that single quote ("line 3, read 7, expected 108"). Got rid of all single quotes (using a global replace in a text editor). Then I tried to load it into Weka again.
  2. The file doesn't have a CR (the Enter key on the keyboard) at the end of the last line, which caused an error ("null on line 5569"). I added one, again in a text editor. Then I loaded it into Weka, and took a look at the variables.
  3. YOB (Year of Birth) is missing for about 300 instances, with "NA" filled in. So, it didn't evaluate as either string or numeric. Edited these to be empty cells instead. Then I loaded it into Weka.
  4. And, of course, moved Party to be the class variable (at the end). I did this in Weka.
  5. Saved this as train.arff

  6. Loaded it back in, and it seems to work OK. I generated 51% accuracy with a OneR classifier, but you wouldn't expect a OneR classifier to work well here. I'm sure you can do better.

Note I didn't do any manual typing of headers. That must have taken a while!

Good luck!