Ignore:
Timestamp:
07/01/13 16:24:25 (10 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Changed TSVMClassifier constructor interface.

It no longer requires "examples" table unless using a custom kernel
and no longer keeps the training "x_space" array (the passed svm_model
needs to 'own' the *(model->SV) array).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/lib_learner.cpp

    r10968 r11606  
    15341534    PyErr_Clear(); 
    15351535     
    1536     if (!PyArg_ParseTuple(args, "O&O&O&s|O&:__new__", cc_Variable, &classVar, cc_ExampleTable, &examples, cc_ExampleTable, &supportVectors, &model_string, cc_KernelFunc, &kernel)) 
     1536    if (!PyArg_ParseTuple(args, "O&O&O&s|O&:__new__", cc_Variable, &classVar, ccn_ExampleTable, &examples, cc_ExampleTable, &supportVectors, &model_string, cc_KernelFunc, &kernel)) 
    15371537        return NULL; 
    15381538 
     
    15411541    if (!model) 
    15421542        raiseError("Error building LibSVM Model"); 
    1543 //  model->param.learner = NULL; 
    1544     PSVMClassifier svm = mlnew TSVMClassifier(classVar, examples, model, NULL, kernel); 
    1545 //  svm->kernelFunc = kernel; 
    1546     svm->supportVectors = supportVectors; 
     1543 
     1544    PSVMClassifier svm = mlnew TSVMClassifier(classVar, examples, supportVectors, model, kernel); 
     1545 
    15471546    return WrapOrange(svm); 
    15481547PyCATCH 
    15491548} 
     1549 
     1550 
    15501551 
    15511552PyObject * SVMClassifierSparse_new(PyTypeObject* type, PyObject* args, PyObject* kwargs) BASED_ON(SVMClassifier, "(Variable, Examples, Examples, string, [useNonMeta, kernelFunc]) -> SVMClassifierSparse") 
     
    15611562    PyErr_Clear(); 
    15621563     
    1563     if (!PyArg_ParseTuple(args, "O&O&O&s|bO&:__new__", cc_Variable, &classVar, cc_ExampleTable, &examples, cc_ExampleTable, &supportVectors, &model_string, &useNonMeta, cc_KernelFunc, &kernel)) 
     1564    if (!PyArg_ParseTuple(args, "O&O&O&s|bO&:__new__", cc_Variable, &classVar, ccn_ExampleTable, &examples, cc_ExampleTable, &supportVectors, &model_string, &useNonMeta, cc_KernelFunc, &kernel)) 
    15641565        return NULL; 
    15651566     
     
    15681569    if (!model) 
    15691570        raiseError("Error building LibSVM Model"); 
    1570 //  model->param.learner = NULL; 
    1571     PSVMClassifier svm = mlnew TSVMClassifierSparse(classVar, examples, model, NULL, useNonMeta != 0, kernel); 
    1572 //  svm->kernelFunc = kernel; 
    1573     svm->supportVectors = supportVectors; 
     1571 
     1572    PSVMClassifier svm = mlnew TSVMClassifierSparse(classVar, examples, supportVectors, model, useNonMeta != 0, kernel); 
     1573 
    15741574    return WrapOrange(svm); 
    1575     PyCATCH 
     1575PyCATCH 
    15761576} 
    15771577 
Note: See TracChangeset for help on using the changeset viewer.