Multivariate Pattern Analysis in Python

# mvpa2.datasets.formats.to_lightsvm_format

`mvpa2.datasets.formats.``to_lightsvm_format`(dataset, out, targets_attr='targets', domain=None, am=None)

  Export dataset into LightSVM format

  Parameters:

  dataset : Dataset

  out

  > Anything understanding .write(string), such as `File`

  targets_attr : string, optional

  > Name of the samples attribute to be output

  domain : {None, ‘regression’, ‘binary’, ‘multiclass’}, optional

  > What domain dataset belongs to. If `None`, it would be deduced depending on the datatype (‘regression’ if float, classification in case of int or string, with ‘binary’/’multiclass’ depending on the number of unique targets)

  am : `AttributeMap` or None, optional

  > Which mapping to use for storing the non-conformant targets. If None was provided, new one would be automagically generated depending on the given/deduced domain.

  Returns:

  am

  LightSVM format is an ASCII representation with a single sample per

  each line:

      output featureIndex:featureValue ... featureIndex:featureValue

  where `output` is specific for a given domain:

  regression

  > float number

  binary

  > integer labels from {-1, 1}

  multiclass

  > integer labels from {1..ds.targets_attr.nunique}