Skip to content

Commit

Permalink
enably apply() w/o arguments to work with custom kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Jul 5, 2012
1 parent 2cf3002 commit 463293d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/shogun/machine/KernelMachine.cpp
Expand Up @@ -250,14 +250,9 @@ CBinaryLabels* CKernelMachine::apply_binary(CFeatures* data)

SGVector<float64_t> CKernelMachine::apply_get_outputs(CFeatures* data)
{
if (!kernel)
SG_ERROR("No kernel assigned!\n");

CFeatures* lhs=kernel->get_lhs();
if (!lhs)
SG_ERROR("%s: No left hand side specified\n", get_name());
REQUIRE(kernel, "No kernel assigned!\n");

if (!lhs->get_num_vectors())
if (!kernel->get_num_vec_lhs())
{
SG_ERROR("%s: No vectors on left hand side (%s). This is probably due to"
" an implementation error in %s, where it was forgotten to set "
Expand All @@ -266,9 +261,13 @@ SGVector<float64_t> CKernelMachine::apply_get_outputs(CFeatures* data)
}

if (data)
{
CFeatures* lhs=kernel->get_lhs();
REQUIRE(lhs, "%s: No left hand side specified\n", get_name());
kernel->init(lhs, data);
SG_UNREF(lhs);
}

SG_UNREF(lhs);

int32_t num_vectors=kernel->get_num_vec_rhs();

Expand Down

0 comments on commit 463293d

Please sign in to comment.