music21.features.outputFormats

OutputARFF

class music21.features.outputFormats.OutputARFF(dataSet=None)

An ARFF (Attribute-Relation File Format) file.

See https://web.archive.org/web/20160212022757/http://weka.wikispaces.com/ARFF+%28stable+version%29 for more details

>>> oa = features.outputFormats.OutputARFF()
>>> oa.ext
'.arff'

OutputARFF bases

OutputARFF methods

OutputARFF.getHeaderLines(includeClassLabel=True, includeId=True)

Get the header as a list of lines.

>>> f = [features.jSymbolic.ChangesOfMeterFeature]
>>> ds = features.DataSet(classLabel='Composer')
>>> ds.addFeatureExtractors(f)
>>> of = features.outputFormats.OutputARFF(ds)
>>> for x in of.getHeaderLines(): print(x)
@RELATION Composer
@ATTRIBUTE Identifier STRING
@ATTRIBUTE Changes_of_Meter NUMERIC
@ATTRIBUTE class {}
@DATA
OutputARFF.getString(includeClassLabel=True, includeId=True, lineBreak=None)

Methods inherited from OutputFormat:

OutputCSV

class music21.features.outputFormats.OutputCSV(dataSet=None)

Comma-separated value list.

OutputCSV bases

OutputCSV methods

OutputCSV.getHeaderLines(includeClassLabel=True, includeId=True)

Get the header as a list of lines.

>>> f = [features.jSymbolic.ChangesOfMeterFeature]
>>> ds = features.DataSet(classLabel='Composer')
>>> ds.addFeatureExtractors(f)
>>> of = features.outputFormats.OutputCSV(ds)
>>> of.getHeaderLines()[0]
['Identifier', 'Changes_of_Meter', 'Composer']
OutputCSV.getString(includeClassLabel=True, includeId=True, lineBreak=None)

Methods inherited from OutputFormat:

OutputFormat

class music21.features.outputFormats.OutputFormat(dataSet=None)

Provide output for a DataSet, which is passed in as an initial argument.

OutputFormat methods

OutputFormat.getHeaderLines()

Get the header as a list of lines.

OutputFormat.getString(includeClassLabel=True, includeId=True, lineBreak=None)
OutputFormat.write(fp=None, includeClassLabel=True, includeId=True)

Write the file. If not file path is given, a temporary file will be written.

OutputTabOrange

class music21.features.outputFormats.OutputTabOrange(dataSet=None)

Tab delimited file format used with Orange.

For more information, see:

https://orange3.readthedocs.io/projects/orange-data-mining-library/en/latest/tutorial/data.html#saving-the-data

OutputTabOrange bases

OutputTabOrange methods

OutputTabOrange.getHeaderLines(includeClassLabel=True, includeId=True)

Get the header as a list of lines.

>>> f = [features.jSymbolic.ChangesOfMeterFeature]
>>> ds = features.DataSet()
>>> ds.addFeatureExtractors(f)
>>> of = features.outputFormats.OutputTabOrange(ds)
>>> for x in of.getHeaderLines(): print(x)
['Identifier', 'Changes_of_Meter']
['string', 'discrete']
['meta', '']
>>> ds = features.DataSet(classLabel='Composer')
>>> ds.addFeatureExtractors(f)
>>> of = features.outputFormats.OutputTabOrange(ds)
>>> for x in of.getHeaderLines(): print(x)
['Identifier', 'Changes_of_Meter', 'Composer']
['string', 'discrete', 'discrete']
['meta', '', 'class']
OutputTabOrange.getString(includeClassLabel=True, includeId=True, lineBreak=None)

Get the complete DataSet as a string with the appropriate headers.

Methods inherited from OutputFormat: