Skip to content

Commit

Permalink
Update MCLDA.cpp
Browse files Browse the repository at this point in the history
fixed tabbing in MCLDA.cpp
  • Loading branch information
kevinhughes27 committed Apr 23, 2013
1 parent cdb25fe commit ca4051a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/shogun/multiclass/MCLDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CMulticlassLabels* CMCLDA::apply_multiclass(CFeatures* data)
ASSERT(num_vecs > 0)
ASSERT( m_dim == m_features->get_dim_feature_space() )

// collect features into a matrix
// collect features into a matrix
CDenseFeatures< float64_t >* rf = (CDenseFeatures< float64_t >*) m_features;

SGMatrix< float64_t > X = SGMatrix< float64_t >(num_vecs, m_dim);
Expand All @@ -93,19 +93,19 @@ CMulticlassLabels* CMCLDA::apply_multiclass(CFeatures* data)
bool vfree;
float64_t* vec;
for ( i = 0 ; i < num_vecs ; ++i )
for ( j = 0 ; j < m_dim ; ++j )
{
vec = rf->get_feature_vector(i, vlen, vfree);
X(i,j) = vec[j] - m_xbar[j];
}
for ( j = 0 ; j < m_dim ; ++j )
{
vec = rf->get_feature_vector(i, vlen, vfree);
X(i,j) = vec[j] - m_xbar[j];
}

#ifdef DEBUG_MCLDA
SG_PRINT("\n>>> Displaying X ...\n");
SGMatrix< float64_t >::display_matrix(X.matrix, num_vecs, m_dim);
#endif

// center and scale data
SGMatrix< float64_t > Xs = SGMatrix< float64_t >(num_vecs, m_rank);
SGMatrix< float64_t > Xs = SGMatrix< float64_t >(num_vecs, m_rank);
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans,
num_vecs, m_rank, m_dim, 1.0,
X.matrix, num_vecs,
Expand All @@ -114,7 +114,6 @@ CMulticlassLabels* CMCLDA::apply_multiclass(CFeatures* data)

#ifdef DEBUG_MCLDA
SG_PRINT("\n>>> Displaying Xs ...\n");
//SGVector< float64_t >::display_vector(Xs.vector, num_vecs);
SGMatrix< float64_t >::display_matrix(Xs.matrix, num_vecs, m_rank);
#endif

Expand All @@ -132,7 +131,7 @@ CMulticlassLabels* CMCLDA::apply_multiclass(CFeatures* data)
// argmax to apply labels
CMulticlassLabels* out = new CMulticlassLabels(num_vecs);
for ( i = 0 ; i < num_vecs ; ++i )
out->set_label(i, SGVector<float64_t>::arg_max(d.matrix+i, num_vecs, m_num_classes));
out->set_label(i, SGVector<float64_t>::arg_max(d.matrix+i, num_vecs, m_num_classes));

#ifdef DEBUG_MCLDA
SG_PRINT("\n>>> Displaying labels ...\n");
Expand Down

0 comments on commit ca4051a

Please sign in to comment.