2016-05-17 67 views
1

我有一個由liac-weka包生成的ARFF文件。ARFF文件的佈局無效

% Finger-tapped_dataset 
    @RELATION Feature_onsets 
    @ATTRIBUTE file STRING 
    @ATTRIBUTE nOnset INTEGER 
    @ATTRIBUTE Duration REAL 
    @ATTRIBUTE RMS.mean REAL 
    @ATTRIBUTE RMS.var REAL 
    @ATTRIBUTE spectralCentroid.mean REAL 
    @ATTRIBUTE spectralCentroid.var REAL 

    @DATA 
    sound_1,1,0.859138309956,0.00811793841422,0.000330115522956,0.0686389952898,8.52151861181e-05 
    sound_1,2,0.719818592072,0.0209680441767,0.00351395853795,0.0674178153276,0.000161568881595 
    sound_1,3,0.661768734455,0.021980991587,0.00362967769615,0.0664032921195,0.000200695401873 
    sound_1,4,0.441179126501,0.0213470663875,0.0032624185551,0.0699469298124,0.00039628680679 
    sound_1,5,0.9287981987,0.0224026963115,0.00370181445032,0.0690619647503,0.000339957477991 
    sound_1,6,0.917188227177,0.0215289667249,0.00351273571141,0.0691223442554,0.000326170702465 
    sound_1,7,0.441179126501,0.0240413267165,0.00402954593301,0.0688840150833,0.000323307351209 
    sound_1,8,0.243809521198,0.0253500081599,0.00412592897192,0.0682555362582,0.000328328402247 
    sound_1,9,0.673378705978,0.0244132820517,0.00386085407808,0.0677450224757,0.000302833941532 
    sound_1,10,0.487619042397,0.025617858395,0.004043656867,0.06802662462,0.000307480600895 
    sound_1,11,1.61451244354,0.0236539077014,0.00386097631417,0.0858256071806,0.00764736300334 
    % 
    % 
    % 

當試圖閱讀:

import arff 
arff.loads('result.arff') 

我得到以下錯誤:

arff.BadLayout: Invalid layout of the ARFF file, at line 1

我無法找到prblem。 Weka打開文件,但不打開python軟件包...任何想法?提前致謝!

回答

0

查看https://pythonhosted.org/liac-arff/處的ARFF模塊文檔,load()將一個文件對象作爲輸入。它看起來像你在result.arff文件上面的數據,所以你應該載入它:

​​

這應該解決有關arff.BadLayout上述錯誤。