Search code examples
pythonmachine-learningscikit-learnwekaarff

.arff files with scikit-learn?


I would like to use an Attribute-Relation File Format with scikit-learn to do some NLP task, is this possible? How can use an .arff file with scikit-learn?


Solution

  • I really recommend liac-arff. It doesn't load directly to numpy, but the conversion is simple:

    import arff, numpy as np
    dataset = arff.load(open('mydataset.arff', 'rb'))
    data = np.array(dataset['data'])