1

私はWEKAを使用してテキスト分類作業を行っていますが、Rを試してみたいと思います。

問題は、WEKAの文字列パーサーによって作成されたString toVectorARFFファイルをRattleにロードできないことです。

ログを見ると、次のようになります。

/Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,

: scan() expected 'a real', got '2281}'/

私のARFFデータファイルは次のようになります。

@relation 'reviewData'

@attribute polarity {0,2}
.....
@attribute $$ numeric
@attribute we numeric
@attribute wer numeric
@attribute win numeric
@attribute work numeric

@data
{0 2,63 1,71 1,100 1,112 1,140 1,186 1,228 1}
{14 1,40 1,48 1,52 1,61 1,146 1}
{2 1,41 1,43 1,57 1,71 1,79 1,106 1,108 1,133 1,146 1,149 1,158 1,201 1}
{0 2,6 1,25 1,29 1,42 1,49 1,69 1,82 1,108 1,116 1,138 1,140 1,155 1}
..../

これをRで読み取り可能な形式に変換する方法はありますか?

乾杯!

4

1 に答える 1

0

StringToWordVector属性フィルターの結果を保存すると、スパースARFFファイルとして保存されます。

Rattleがこの形式の読み取りをサポートしているかどうかを確認する必要があります。そうでない場合は、SparseToNonSparseインスタンスフィルターを適用して、密行列形式に変換できます(ファイルサイズははるかに大きくなります)。

例:スパースデータが次のようになっている場合:

sparse.arff

@relation name
@attribute word1 numeric
@attribute word2 numeric
..
@attribute word10 numeric
@data
{0 1,3 3,8 1,9 1}
{2 2,5 1,8 1,9 1}

次のように変換されます。

nonsparse.arff

@relation name
@attribute word1 numeric
@attribute word2 numeric
..
@attribute word10 numeric
@data
1,0,0,3,0,0,0,0,1,1
0,0,2,0,0,1,0,0,1,1
于 2011-08-04T22:16:33.843 に答える