Navigation Menu

Skip to content

Commit

Permalink
Various small fixes for LLE algorithms and dim reduction preprocessor…
Browse files Browse the repository at this point in the history
… base class
  • Loading branch information
lisitsyn committed Oct 3, 2011
1 parent 63ecfe8 commit 2f5de9d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/shogun/preprocessor/DimensionReductionPreprocessor.cpp
Expand Up @@ -9,11 +9,7 @@ CDimensionReductionPreprocessor::CDimensionReductionPreprocessor()
{
m_target_dim = 1;
m_distance = new CEuclidianDistance();
m_distance->parallel = this->parallel;
SG_REF(this->parallel);
m_kernel = new CLinearKernel();
m_kernel->parallel = this->parallel;
SG_REF(this->parallel);

init();
}
Expand Down Expand Up @@ -76,8 +72,6 @@ void CDimensionReductionPreprocessor::set_distance(CDistance* distance)
SG_UNREF(m_distance);
SG_REF(distance);
m_distance = distance;
m_distance->parallel = this->parallel;
SG_REF(this->parallel);
}

CDistance* CDimensionReductionPreprocessor::get_distance() const
Expand All @@ -91,8 +85,6 @@ void CDimensionReductionPreprocessor::set_kernel(CKernel* kernel)
SG_UNREF(m_kernel);
SG_REF(kernel);
m_kernel = kernel;
m_kernel->parallel = this->parallel;
SG_REF(this->parallel);
}

CKernel* CDimensionReductionPreprocessor::get_kernel() const
Expand Down
3 changes: 2 additions & 1 deletion src/shogun/preprocessor/HessianLocallyLinearEmbedding.cpp
Expand Up @@ -107,7 +107,8 @@ SGMatrix<float64_t> CHessianLocallyLinearEmbedding::construct_weight_matrix(CSim
int32_t dim = simple_features->get_num_features();
int32_t target_dim = calculate_effective_target_dim(dim);
int32_t dp = target_dim*(target_dim+1)/2;
ASSERT(m_k>=(1+target_dim+dp));
if (m_k<(1+target_dim+dp))
SG_ERROR("K parameter should have value greater than 1+target dimensionality+dp.\n");
int32_t t;
#ifdef HAVE_PTHREAD
int32_t num_threads = parallel->get_num_threads();
Expand Down
2 changes: 2 additions & 0 deletions src/shogun/preprocessor/KernelLocallyLinearEmbedding.cpp
Expand Up @@ -143,6 +143,8 @@ SGMatrix<float64_t> CKernelLocallyLinearEmbedding::apply_to_feature_matrix(CFeat
{
if (m_target_dim<=0)
SG_ERROR("Cannot decrease dimensionality of given features by %d.\n", -m_target_dim);
else
target_dim = m_target_dim;
}
if (target_dim<=0)
SG_ERROR("Trying to decrease dimensionality to non-positive value, not possible.\n");
Expand Down
1 change: 1 addition & 0 deletions src/shogun/preprocessor/LocallyLinearEmbedding.cpp
Expand Up @@ -177,6 +177,7 @@ SGMatrix<float64_t> CLocallyLinearEmbedding::apply_to_feature_matrix(CFeatures*
ASSERT(m_distance);
m_distance->init(simple_features,simple_features);
SGMatrix<float64_t> distance_matrix = m_distance->get_distance_matrix();
m_distance->remove_lhs_and_rhs();
SG_DEBUG("Calculating neighborhood matrix\n");
SGMatrix<int32_t> neighborhood_matrix = get_neighborhood_matrix(distance_matrix);

Expand Down

0 comments on commit 2f5de9d

Please sign in to comment.