【Weka】ARFF 形式から CSV 形式に簡単に変換する方法。
フリーのデータマイニングツールである WEKA では、ARFF 形式と CSV 形式のデータを読み込むことができます。
今回は、ブラウザ上で、Weka 専用の ARFF形式 から CSV形式に簡単に変換する方法を紹介します。
ARFF形式の「labor.arff」ファイルを変換してみます。
内容は、以下のようになっています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
@relation 'labor-neg-data' @attribute 'duration' real @attribute 'wage-increase-first-year' real @attribute 'wage-increase-second-year' real @attribute 'wage-increase-third-year' real @attribute 'cost-of-living-adjustment' {'none','tcf','tc'} @attribute 'working-hours' real @attribute 'pension' {'none','ret_allw','empl_contr'} @attribute 'standby-pay' real @attribute 'shift-differential' real @attribute 'education-allowance' {'yes','no'} @attribute 'statutory-holidays' real @attribute 'vacation' {'below_average','average','generous'} @attribute 'longterm-disability-assistance' {'yes','no'} @attribute 'contribution-to-dental-plan' {'none','half','full'} @attribute 'bereavement-assistance' {'yes','no'} @attribute 'contribution-to-health-plan' {'none','half','full'} @attribute 'class' {'bad','good'} @data 1,5,?,?,?,40,?,?,2,?,11,'average',?,?,'yes',?,'good' 2,4.5,5.8,?,?,35,'ret_allw',?,?,'yes',11,'below_average',?,'full',?,'full','good' ?,?,?,?,?,38,'empl_contr',?,5,?,11,'generous','yes','half','yes','half','good' 3,3.7,4,5,'tc',?,?,?,?,'yes',?,?,?,?,'yes',?,'good' 3,4.5,4.5,5,?,40,?,?,?,?,12,'average',?,'half','yes','half','good' 2,2,2.5,?,?,35,?,?,6,'yes',12,'average',?,?,?,?,'good' 3,4,5,5,'tc',?,'empl_contr',?,?,?,12,'generous','yes','none','yes','half','good' 3,6.9,4.8,2.3,?,40,?,?,3,?,12,'below_average',?,?,?,?,'good' 2,3,7,?,?,38,?,12,25,'yes',11,'below_average','yes','half','yes',?,'good' 1,5.7,?,?,'none',40,'empl_contr',?,4,?,11,'generous','yes','full',?,?,'good' 3,3.5,4,4.6,'none',36,?,?,3,?,13,'generous',?,?,'yes','full','good' |
これを、1行目に属性(attribute)、2行目以降に値をカンマ区切りにする CSV形式に変換します。
以下のリンクの「Weka ARFF to CSV」というサイトにアクセスします。
https://pulipulichen.github.io/jieba-js/weka/arff2csv/
Input 領域で、「labor.arff」ファイルを指定します。すると右側の領域にデータの内容が表示されます。
「Result File Name:」でファイル名を指定して、「DOWNLOAD」ボタンを押すと、以下のような CSV ファイルがダウンロードできます。
関連記事
-
機械学習の手法のまとめ。
機械学習は、「与えられた入出力事例をモデル化する行為」のことで、ディープラーニングなどで注目を集めて
-
【機械学習】 scikit-learn で精度・再現率・F値を算出する方法【Python】
今回は、2クラス分類で Python の scikit-learn を使った評価指標である、精度(P
-
【TensorFlow】GPUを認識しない時の対処方法【Python】
TensorFlow で GPU を認識させようとしたときにハマってしまったので、その対処方法のメモ
-
【探索】ダイクストラ法・最良優先探索・Aアルゴリズムの比較。
縦型探索や横型探索では、機械的に順序を付け、最小ステップでゴールを目指します。 つまり、
-
【探索】縦型・横型・反復深化法の探索手法の比較。
探索とは、チェスや将棋や囲碁などのゲームをコンピュータがプレイするときに、どの手を指すかを決定するの
-
【Fashion-MNIST】ファッションアイテムのデータセットを使ってみた【TensorFlow】
今回は、機械学習用に公開されているデータセットの1つである「Fashion-MNIST」について紹介
-
【転移学習】学習済みVGG16 による転移学習を行う方法【PyTorch】
今回は、PyTorch を使って、学習済みのモデル VGG16 を用いて転移学習をしてみました。
-
【Weka】CSVファイルを読み込んで決定木を実行。
フリーの機械学習ソフト Weka を使って、CSVファイルを読み込んで決定木(Decision Tr
-
【機械学習】パーセプトロン(Perceptron)について。
パーセプトロンは、教師あり学習の中でも、入出力モデルベース(eager learning:働き者の学
-
【機械学習】モンテカルロ法(Monte Carlo method)について。
モンテカルロ法(Monte Carlo method)とは、シュミレーションや数値計算を乱数を用いて