Skip to content

Commit

Permalink
Fixed regularization in LLE null-space routine, added posdef option
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jul 30, 2011
1 parent 5f40ecc commit cbb8d24
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/shogun/preprocessor/LocallyLinearEmbedding.cpp
Expand Up @@ -22,7 +22,7 @@
using namespace shogun;

CLocallyLinearEmbedding::CLocallyLinearEmbedding() :
CDimensionReductionPreprocessor(), m_k(3)
CDimensionReductionPreprocessor(), m_k(3), m_posdef(true)
{
}

Expand Down Expand Up @@ -207,7 +207,7 @@ SGMatrix<float64_t> CLocallyLinearEmbedding::find_null_space(SGMatrix<float64_t>
// using ARPACK (faster)
eigenvalues_vector = SG_MALLOC(float64_t, dimension+1);
#ifdef HAVE_ARPACK
arpack_dsaupd(matrix.matrix,N,dimension+1,"LA",3,-1e-3,false,eigenvalues_vector,matrix.matrix,eigenproblem_status);
arpack_dsaupd(matrix.matrix,N,dimension+1,"LA",3,m_posdef,-1e-6,eigenvalues_vector,matrix.matrix,eigenproblem_status);
#endif
}
else
Expand Down
21 changes: 20 additions & 1 deletion src/shogun/preprocessor/LocallyLinearEmbedding.h
Expand Up @@ -75,6 +75,22 @@ class CLocallyLinearEmbedding: public CDimensionReductionPreprocessor
return m_k;
}

/** setter for posdef parameter
* @param posdef posdef value
*/
void inline set_posdef(bool posdef)
{
m_posdef = posdef;
}

/** getter for posdef parameter
* @return posdef value
*/
bool inline get_posdef()
{
return m_posdef;
}

/** get name */
virtual inline const char* get_name() const { return "LocallyLinearEmbedding"; };

Expand All @@ -92,9 +108,12 @@ class CLocallyLinearEmbedding: public CDimensionReductionPreprocessor

protected:

/* number of neighbors */
/** number of neighbors */
int32_t m_k;

/** boolean indicating if matrix should be considered as positive-definite */
bool m_posdef;

};
}

Expand Down

0 comments on commit cbb8d24

Please sign in to comment.