A module for read and write ARFF files in Python.
=========
.. image:: https://travis-ci.org/renatopp/liac-arff.svg :target: https://travis-ci.org/renatopp/liac-arff
The liac-arff module implements functions to read and write ARFF files in Python. It was created in the Connectionist Artificial Intelligence Laboratory (LIAC), which takes place at the Federal University of Rio Grande do Sul (UFRGS), in Brazil.
ARFF (Attribute-Relation File Format) is an file format specially created for describe datasets which are used commonly for machine learning experiments and softwares. This file format was created to be used in Weka, the best representative software for machine learning automated experiments.
You can clone the arff-datasets <https://github.com/renatopp/arff-datasets>
_
repository for a large set of ARFF files.
scipy.sparse.coo <http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html#scipy.sparse.coo_matrix>
_
and lists of dictionaries as used by SVMLightjson
, or
zipfile
;MIT License <http://opensource.org/licenses/MIT>
_Via pip::
$ pip install liac-arff
Via easy_install::
$ easy_install liac-arff
Manually::
$ python setup.py install
For a complete description of the module, consult the official documentation at http://packages.python.org/liac-arff/ with mirror in http://inf.ufrgs.br/~rppereira/docs/liac-arff/index.html
You can read an ARFF file as follows::
>>> import arff
>>> data = arff.load(open('wheater.arff', 'rb'))
Which results in::
>>> data
{
u'attributes': [
(u'outlook', [u'sunny', u'overcast', u'rainy']),
(u'temperature', u'REAL'),
(u'humidity', u'REAL'),
(u'windy', [u'TRUE', u'FALSE']),
(u'play', [u'yes', u'no'])],
u'data': [
[u'sunny', 85.0, 85.0, u'FALSE', u'no'],
[u'sunny', 80.0, 90.0, u'TRUE', u'no'],
[u'overcast', 83.0, 86.0, u'FALSE', u'yes'],
[u'rainy', 70.0, 96.0, u'FALSE', u'yes'],
[u'rainy', 68.0, 80.0, u'FALSE', u'yes'],
[u'rainy', 65.0, 70.0, u'TRUE', u'no'],
[u'overcast', 64.0, 65.0, u'TRUE', u'yes'],
[u'sunny', 72.0, 95.0, u'FALSE', u'no'],
[u'sunny', 69.0, 70.0, u'FALSE', u'yes'],
[u'rainy', 75.0, 80.0, u'FALSE', u'yes'],
[u'sunny', 75.0, 70.0, u'TRUE', u'yes'],
[u'overcast', 72.0, 90.0, u'TRUE', u'yes'],
[u'overcast', 81.0, 75.0, u'FALSE', u'yes'],
[u'rainy', 71.0, 91.0, u'TRUE', u'no']
],
u'description': u'',
u'relation': u'weather'
}
You can write an ARFF file with this structure::
>>> print arff.dumps(data)
@RELATION weather
@ATTRIBUTE outlook {sunny, overcast, rainy}
@ATTRIBUTE temperature REAL
@ATTRIBUTE humidity REAL
@ATTRIBUTE windy {TRUE, FALSE}
@ATTRIBUTE play {yes, no}
@DATA
sunny,85.0,85.0,FALSE,no
sunny,80.0,90.0,TRUE,no
overcast,83.0,86.0,FALSE,yes
rainy,70.0,96.0,FALSE,yes
rainy,68.0,80.0,FALSE,yes
rainy,65.0,70.0,TRUE,no
overcast,64.0,65.0,TRUE,yes
sunny,72.0,95.0,FALSE,no
sunny,69.0,70.0,FALSE,yes
rainy,75.0,80.0,FALSE,yes
sunny,75.0,70.0,TRUE,yes
overcast,72.0,90.0,TRUE,yes
overcast,81.0,75.0,FALSE,yes
rainy,71.0,91.0,TRUE,no
%
%
%
Nate Moseley (FinalDoom) <https://github.com/FinalDoom>
_Tarek Amr (gr33ndata) <https://github.com/gr33ndata>
_Simon (M3t0r) <https://github.com/M3t0r>
_Gonzalo Almeida (flecox) <https://github.com/flecox>
_André Nordbø (AndyNor) <http://andynor.net>
_Niedakh <https://github.com/niedakh>
_Zichen Wang (wangz10) <https://github.com/wangz10>
_Matthias Feurer (mfeurer) <https://github.com/mfeurer>
_Hongjoo Lee (midnightradio) <https://github.com/midnightradio>
_Calvin Jeong (calvin) <http://ty.pe.kr/>
_Joel Nothman (jnothman) <https://github.com/jnothman>
_https://github.com/renatopp/liac-arff