Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Numpy, regression and PyML: an example

2006-04-30
2013-04-24
  • Since I've spent some time on this (I'm newbie in PyML), this tip can help someone else.

    If you are trying to build a dataset from a numpy array and you need to use numeric labels (i.e. for regression), remember to add always 'patternID=...' to you labels constructor. Example:
    * X is a numpy matrix (note that you always need a matrix, numpy 1D vector are not allowed!)
    * Y is a numpy vector of label values, related to X
    * build you dataset in this way:
    L = datafunc.Labels(Y,numericLabels=True,patternID=range(len(Y)))
    data = datafunc.SparseCDataSet(X = X)
    data.attachLabels(Labels)

    Now you can play with svm.SVR()...

    Cheers,

    Emanuele