Skip to content

Commit

Permalink
Fixed bug in Inference Method initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
puffin444 committed Jul 11, 2012
1 parent 4173e8b commit d5a2772
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
17 changes: 7 additions & 10 deletions src/shogun/regression/gp/ExactInferenceMethod.cpp
Expand Up @@ -26,19 +26,15 @@ using namespace shogun;

CExactInferenceMethod::CExactInferenceMethod() : CInferenceMethod()
{
update_train_kernel();
update_chol();
update_alpha();
update_all();
update_parameter_hash();
}

CExactInferenceMethod::CExactInferenceMethod(CKernel* kern, CFeatures* feat,
CMeanFunction* m, CLabels* lab, CLikelihoodModel* mod) :
CInferenceMethod(kern, feat, m, lab, mod)
{
update_train_kernel();
update_chol();
update_alpha();
update_all();
}

CExactInferenceMethod::~CExactInferenceMethod()
Expand All @@ -47,14 +43,15 @@ CExactInferenceMethod::~CExactInferenceMethod()

void CExactInferenceMethod::update_all()
{
m_label_vector =
((CRegressionLabels*) m_labels)->get_labels().clone();
if (m_labels)
m_label_vector =
((CRegressionLabels*) m_labels)->get_labels().clone();

if(m_features->has_property(FP_DOT))
if (m_features && m_features->has_property(FP_DOT))
m_feature_matrix =
((CDotFeatures*)m_features)->get_computed_dot_feature_matrix();

else if(m_features->get_feature_class() == C_COMBINED)
else if (m_features && m_features->get_feature_class() == C_COMBINED)
{
CDotFeatures* feat =
(CDotFeatures*)((CCombinedFeatures*)m_features)->
Expand Down
7 changes: 5 additions & 2 deletions src/shogun/regression/gp/InferenceMethod.cpp
Expand Up @@ -117,8 +117,11 @@ void CInferenceMethod::set_labels(CLabels* lab)
SG_UNREF(m_labels);
m_labels = lab;

m_label_vector =
((CRegressionLabels*) m_labels)->get_labels().clone();
if (m_labels)
{
m_label_vector =
((CRegressionLabels*) m_labels)->get_labels().clone();
}

update_data_means();
update_alpha();
Expand Down

0 comments on commit d5a2772

Please sign in to comment.