2

I am trying to open an Arff in Weka but getting two errors.

First is, file is not recognized as an "Arff data files". Reason: premature end of file read Token[EOL], line 3267.

Further if I click on "Use Convertor" with missing value "?",

the second error is, csvloader failed to load. Reason:wrong number of values, read 2, expected 1, read Token[EOF],3267

The file is:

https://www.dropbox.com/s/xs0ssnvs42bik5c/sg.arff

user3458385
  • 21
  • 1
  • 6

1 Answers1

0

Any arff file should include comma between values whereas your file has none. Are you sure this is a valid arff file?

You have invalid arff file. Your attributes are repeated. You have to declare them only once. For example if you have following attributes

set CLASSPATH=.;d:\tools\Weka-3-7\weka.jar
d:\atilla\downloads>java weka.core.Instances sg.arff
java.io.IOException: Unable to determine structure as arff (Reason: java.lang.Il
legalArgumentException: Attribute names are not unique! Causes: 'campus' 'friend' 'homework' 'people' 'people' 'do' 'work' 'work' 'study' 'campus' 'people' 'people' 'life' 'learn' 'study' 'learn' 'put' 'study' 'learn' 'institute' 'get' 'put

Below is a valid arff file constructed by your file.

@relation sg-test
@attribute campus real
@attribute utilitarian real
@attribute put real
@attribute much real
@attribute make real
@attribute look real
@attribute nice real
@attribute people real
@attribute busy real
@attribute have real
@attribute real real
@attribute friendship real
@attribute institute real
@attribute end real
@attribute pick real
@attribute homework real
@attribute friend real
@attribute lose real
@attribute way real
@attribute crushed real
@attribute lie real
@attribute say real
@attribute do real
@attribute work real
@attribute time real
@attribute type real
@attribute study real
@attribute room real
@attribute many real
@attribute great real
@attribute place real
@attribute go real
@attribute city real
@attribute dull real
@attribute Class {term,score}
@data 
0.0,0.041666666666666664,-0.019185326611942655,0.005523215037172114,0.0,0.012052341597796145,0.02062568512992925,0.0,-0.030000000000000006,0.708941605839416,0.0,0.12317518248175183,0.05020802460556254,-0.019147145462196667,0.125,0.0,0.0,-0.06617570128224504,0.0,0.10948905109489052,0.10948905109489052,0.0,-0.3490625485300618,0.00402808616500622,0.0,-0.125,0.0,-0.028925619834710748,0.006898734933282365,-0.019185326611942655,0.015740237951508994,0.015740237951508994,0.12091857471887278,0.0,term

When I execute same command. I get following information from Weka.

Relation Name:  sg-test
Num Instances:  1
Num Attributes: 35

     Name                      Type  Nom  Int Real     Missing      Unique  Dist
   1 campus                     Num   0% 100%   0%     0 /  0%     1 /100%     1 
   2 utilitarian                Num   0%   0% 100%     0 /  0%     1 /100%     1 
   3 put                        Num   0%   0% 100%     0 /  0%     1 /100%     1 
   4 much                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
   5 make                       Num   0% 100%   0%     0 /  0%     1 /100%     1 
   6 look                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
   7 nice                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
   8 people                     Num   0% 100%   0%     0 /  0%     1 /100%     1 
   9 busy                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  10 have                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  11 real                       Num   0% 100%   0%     0 /  0%     1 /100%     1 
  12 friendship                 Num   0%   0% 100%     0 /  0%     1 /100%     1 
  13 institute                  Num   0%   0% 100%     0 /  0%     1 /100%     1 
  14 end                        Num   0%   0% 100%     0 /  0%     1 /100%     1 
  15 pick                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  16 homework                   Num   0% 100%   0%     0 /  0%     1 /100%     1 
  17 friend                     Num   0% 100%   0%     0 /  0%     1 /100%     1 
  18 lose                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  19 way                        Num   0% 100%   0%     0 /  0%     1 /100%     1 
  20 crushed                    Num   0%   0% 100%     0 /  0%     1 /100%     1 
  21 lie                        Num   0%   0% 100%     0 /  0%     1 /100%     1 
  22 say                        Num   0% 100%   0%     0 /  0%     1 /100%     1 
  23 do                         Num   0%   0% 100%     0 /  0%     1 /100%     1 
  24 work                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  25 time                       Num   0% 100%   0%     0 /  0%     1 /100%     1 
  26 type                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  27 study                      Num   0% 100%   0%     0 /  0%     1 /100%     1 
  28 room                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  29 many                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  30 great                      Num   0%   0% 100%     0 /  0%     1 /100%     1 
  31 place                      Num   0%   0% 100%     0 /  0%     1 /100%     1 
  32 go                         Num   0%   0% 100%     0 /  0%     1 /100%     1 
  33 city                       Num   0%   0% 100%     0 /  0%     1 /100%     1 
  34 dull                       Num   0% 100%   0%     0 /  0%     1 /100%     1 
  35 Class                      Nom 100%   0%   0%     0 /  0%     1 /100%     1 
Atilla Ozgur
  • 14,339
  • 3
  • 49
  • 69
  • sorry, by mistake have placed old file. here is the Arff file https://www.dropbox.com/s/xs0ssnvs42bik5c/sg.arff – user3458385 Apr 03 '14 at 08:59
  • hi atilla can you please comeout with any solution. It is emergency for me to continue my project. – user3458385 Apr 03 '14 at 14:01
  • Thanku you very much for the response. Now the number of attributes are less in number na compared to file which have sent. Is this can be used for classification in weka ? Can i use Naive bayes or SVM ? Can you help me how to proceed with this. – user3458385 Apr 04 '14 at 06:08
  • I suggest try basic weka tutorials first, then come back to your problem – Atilla Ozgur Apr 04 '14 at 06:32
  • Sure..vl go through that n if my problm wasnt solvd vl contact u again. thank u.. – user3458385 Apr 05 '14 at 15:16
  • hii can anyone tell me how to assign the class for the document for the arff file above?? – user3458385 Apr 15 '14 at 16:25