Skip to content

Commit

Permalink
Hack MKL example to work
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Apr 15, 2018
1 parent ceb83d8 commit afd4359
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Expand Up @@ -56,6 +56,7 @@ MKLClassification machine = fold.get_trained_machine()
#![get_fold_machine]

#![get_weights]
CombinedKernel k = machine.get("kernel")
RealVector w = k.get_subkernel_weights()
SGObject k = machine.get("kernel")
CombinedKernel ck = CombinedKernel:obtain_from_generic(k)
RealVector w = ck.get_subkernel_weights()
#![get_weights]
5 changes: 5 additions & 0 deletions src/shogun/kernel/CombinedKernel.cpp
Expand Up @@ -907,6 +907,11 @@ CCombinedKernel* CCombinedKernel::obtain_from_generic(CKernel* kernel)
return (CCombinedKernel*)kernel;
}

CCombinedKernel* CCombinedKernel::obtain_from_generic(Some<CSGObject> object)
{
return CCombinedKernel::obtain_from_generic((CKernel*)object.get());
}

CList* CCombinedKernel::combine_kernels(CList* kernel_list)
{
CList* return_list = new CList(true);
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/kernel/CombinedKernel.h
Expand Up @@ -366,6 +366,9 @@ class CCombinedKernel : public CKernel
*/
static CCombinedKernel* obtain_from_generic(CKernel* kernel);

// TODO: remove
static CCombinedKernel* obtain_from_generic(Some<CSGObject> object);

/** return derivative with respect to specified parameter
*
* @param param the parameter
Expand Down

0 comments on commit afd4359

Please sign in to comment.