Skip to content

Commit

Permalink
* doc fixes and less warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
iglesias committed Aug 15, 2012
1 parent f7116ba commit ccc31d9
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 48 deletions.
10 changes: 5 additions & 5 deletions src/shogun/features/MatrixFeatures.cpp
Expand Up @@ -30,11 +30,11 @@ template< class ST > CMatrixFeatures< ST >::CMatrixFeatures(
}

template< class ST > CMatrixFeatures< ST >::CMatrixFeatures(
SGMatrixList< ST > feats, int32_t num_vecs, int32_t num_feats)
SGMatrixList< ST > feats, int32_t num_feats)
: CFeatures(0)
{
init();
set_features(feats, num_vecs, num_feats);
set_features(feats, num_feats);
}

template< class ST > CMatrixFeatures< ST >::CMatrixFeatures(
Expand All @@ -45,7 +45,7 @@ template< class ST > CMatrixFeatures< ST >::CMatrixFeatures(
"must be equal to feat_length times num_vecs\n");
init();
SGMatrixList< ST > feats_list = SGMatrixList< ST >::split(feats, num_vecs);
set_features(feats_list, num_vecs, feats.num_rows);
set_features(feats_list, feats.num_rows);
}

/* TODO */
Expand Down Expand Up @@ -144,10 +144,10 @@ template< class ST > void CMatrixFeatures< ST >::set_feature_vector(
}

template< class ST > void CMatrixFeatures< ST >::set_features(
SGMatrixList< ST > features, int32_t num_vecs, int32_t num_feats)
SGMatrixList< ST > features, int32_t num_feats)
{
m_features = features;
m_num_vectors = num_vecs;
m_num_vectors = features.num_matrices;
m_num_features = num_feats;
}

Expand Down
21 changes: 11 additions & 10 deletions src/shogun/features/MatrixFeatures.h
Expand Up @@ -35,26 +35,27 @@ template< class ST > class CMatrixFeatures : public CFeatures
/** standard constructor
*
* @param num_vecs number of vectors
* @param num_feat number of features per vector
* @param num_feats number of features per vector
*/
CMatrixFeatures(int32_t num_vecs, int32_t num_feats = 0);

/** constructor
*
* @param features list of feature matrices
* @param feats list of feature matrices
* @param num_feats number of features per vector
*/
CMatrixFeatures(SGMatrixList< ST > feats, int32_t num, int32_t num_feats = 0);
CMatrixFeatures(SGMatrixList< ST > feats, int32_t num_feats = 0);

/**
* constructor using the data of all the features concatenated in a
* matrix. All the features are assumed to have the same length. The number
* of colums of feats must be equal to feat_length times num_vecs. The number
* of features per vector is equal to the number of rows of feats.
* constructor using the data of all the features concatenated
* in a matrix. All the features are assumed to have the same
* length. The number of colums of feats must be equal to
* feat_length times num_vecs. The number of features per vector
* is equal to the number of rows of feats.
*
* @param feats concatenation of the features
* @param feat_length length of each feature
* @param num_vecs number of feature vectors
* @param num_feat number of features per vector
*/
CMatrixFeatures(SGMatrix< ST > feats, int32_t feat_length, int32_t num_vecs);

Expand Down Expand Up @@ -125,9 +126,9 @@ template< class ST > class CMatrixFeatures : public CFeatures
/** set features
*
* @param features to set
* @param num_vecs number of vectors
* @param num_feats number of features per vector
*/
void set_features(SGMatrixList< ST > features, int32_t num_vecs, int32_t num_feats);
void set_features(SGMatrixList< ST > features, int32_t num_feats);

/** @return object name */
virtual const char* get_name() const { return "MatrixFeatures"; }
Expand Down
1 change: 1 addition & 0 deletions src/shogun/structure/HMSVMLabels.h
Expand Up @@ -25,6 +25,7 @@ class CHMSVMLabels;
* (SO) learning to Hidden Markov Support Vector Machines (HM-SVM). */
struct CSequence : public CStructuredData
{
/** data type */
STRUCTURED_DATA_TYPE(SDT_SEQUENCE);

/** constructor
Expand Down
5 changes: 4 additions & 1 deletion src/shogun/structure/HMSVMModel.h
Expand Up @@ -22,7 +22,9 @@ namespace shogun
enum EStateModelType;

/**
* @brief Class CHMSVMModel TODO DOC
* @brief Class CHMSVMModel that represents the application specific model
* and contains the application dependent logic to solve Hidden Markov Support
* Vector Machines (HM-SVM) type of problems within a generic SO framework.
*/
class CHMSVMModel : public CStructuredModel
{
Expand All @@ -34,6 +36,7 @@ class CHMSVMModel : public CStructuredModel
*
* @param features the feature vectors, must be of type MatrixFeatures
* @param labels HMSVM labels
* @param smt internal state representation
* @param num_obs number of observations
*/
CHMSVMModel(CFeatures* features, CStructuredLabels* labels, EStateModelType smt, int32_t num_obs);
Expand Down
6 changes: 5 additions & 1 deletion src/shogun/structure/MulticlassModel.h
Expand Up @@ -16,7 +16,11 @@
namespace shogun
{

/** @brief TODO */
/**
* @brief Class CMulticlassModel that represents the application specific model
* and contains the application dependent logic to solve multiclass
* classification within a generic SO framework.
*/
class CMulticlassModel : public CStructuredModel
{

Expand Down
17 changes: 9 additions & 8 deletions src/shogun/structure/StateModel.h
Expand Up @@ -20,7 +20,10 @@
namespace shogun
{

/** TODO DOC */
/**
* @brief class CStateModel base, abstract class for the internal state
* representation used in the CHMSVMModel.
*/
class CStateModel : public CSGObject
{
public:
Expand Down Expand Up @@ -65,11 +68,10 @@ class CStateModel : public CSGObject
* This vector is suitable to iterate through when constructing the
* emission matrix used in Viterbi decoding
*
* @param emission_weights emission parameters outputted
* @param w the weight vector
* @param num_feats number of features
* @param num_obs number of emission scores per feature and state
*
* @return a vector with the emission parameters
*/
virtual void reshape_emission_params(SGVector< float64_t >& emission_weights,
SGVector< float64_t > w, int32_t num_feats, int32_t num_obs) = 0;
Expand All @@ -79,12 +81,11 @@ class CStateModel : public CSGObject
* adding zero elements for the states whose parameters are not learnt.
* This matrix is suitable to iterate during Viterbi decoding
*
* @param transmission_weights transmission parameters outputted
* @param w the weight vector
*
* @return a matrix with the transmission parameters
*/
virtual void reshape_transmission_params(
SGMatrix< float64_t >& transmission_matrix,
SGMatrix< float64_t >& transmission_weights,
SGVector< float64_t > w) = 0;

/** translates label sequence to state sequence
Expand All @@ -109,15 +110,15 @@ class CStateModel : public CSGObject
* weight vector)
*
* @param psi output vector
* @param transition_weights counts of the state transitions for a state
* @param transmission_weights counts of the state transitions for a state
* sequence
* @param emission_weights counts of the emission scores for a state
* sequence and a feature vector
* @param num_feats number of features
* @param num_obs number of emission scores per feature and state
*/
virtual void weights_to_vector(SGVector< float64_t >& psi,
SGMatrix< float64_t > transiton_weights,
SGMatrix< float64_t > transmission_weights,
SGVector< float64_t > emission_weights,
int32_t num_feats, int32_t num_obs) const = 0;

Expand Down
30 changes: 15 additions & 15 deletions src/shogun/structure/TwoStateModel.cpp
Expand Up @@ -143,9 +143,9 @@ void CTwoStateModel::reshape_emission_params(SGVector< float64_t >& emission_wei
}

void CTwoStateModel::reshape_transmission_params(
SGMatrix< float64_t >& transmission_matrix, SGVector< float64_t > w)
SGMatrix< float64_t >& transmission_weights, SGVector< float64_t > w)
{
transmission_matrix.set_const(-CMath::INFTY);
transmission_weights.set_const(-CMath::INFTY);

// Legend for state indices:
// 0 -> start state
Expand All @@ -154,20 +154,20 @@ void CTwoStateModel::reshape_transmission_params(
// 3 -> positive state (label == 1)

// From start
transmission_matrix(0,2) = 0; // to negative
transmission_matrix(0,3) = 0; // to positive
transmission_weights(0,2) = 0; // to negative
transmission_weights(0,3) = 0; // to positive
// From negative
transmission_matrix(2,1) = 0; // to stop
transmission_matrix(2,2) = w[0]; // to negative
transmission_matrix(2,3) = w[1]; // to positive
transmission_weights(2,1) = 0; // to stop
transmission_weights(2,2) = w[0]; // to negative
transmission_weights(2,3) = w[1]; // to positive
// From positive
transmission_matrix(3,1) = 0; // to stop
transmission_matrix(3,2) = w[3]; // to positive
transmission_matrix(3,3) = w[2]; // to negative
transmission_weights(3,1) = 0; // to stop
transmission_weights(3,2) = w[3]; // to positive
transmission_weights(3,3) = w[2]; // to negative
}

void CTwoStateModel::weights_to_vector(SGVector< float64_t >& psi,
SGMatrix< float64_t > transition_weights,
SGMatrix< float64_t > transmission_weights,
SGVector< float64_t > emission_weights,
int32_t num_feats, int32_t num_obs) const
{
Expand All @@ -176,10 +176,10 @@ void CTwoStateModel::weights_to_vector(SGVector< float64_t >& psi,
// 1 -> stop state
// 2 -> negative state
// 3 -> positive state
psi[0] = transition_weights(2,2);
psi[1] = transition_weights(2,3);
psi[2] = transition_weights(3,3);
psi[3] = transition_weights(3,2);
psi[0] = transmission_weights(2,2);
psi[1] = transmission_weights(2,3);
psi[2] = transmission_weights(3,3);
psi[3] = transmission_weights(3,2);

// start and stop states have no emission scores
index_t obs_idx, psi_idx = m_num_transmission_params;
Expand Down
17 changes: 9 additions & 8 deletions src/shogun/structure/TwoStateModel.h
Expand Up @@ -17,7 +17,10 @@
namespace shogun
{

/** TODO DOC */
/**
* @brief class CTwoStateModel class for the internal two-state representation
* used in the CHMSVMModel.
*/
class CTwoStateModel : public CStateModel
{
public:
Expand Down Expand Up @@ -56,11 +59,10 @@ class CTwoStateModel : public CStateModel
* This vector is suitable to iterate through when constructing the
* emission matrix used in Viterbi decoding
*
* @param emission_weights emission parameters outputted
* @param w the weight vector
* @param num_feats number of features
* @param num_obs number of emission scores per feature and state
*
* @return a vector with the emission parameters
*/
virtual void reshape_emission_params(SGVector< float64_t >& emission_weights,
SGVector< float64_t > w, int32_t num_feats, int32_t num_obs);
Expand All @@ -70,12 +72,11 @@ class CTwoStateModel : public CStateModel
* adding zero elements for the states whose parameters are not learnt.
* This matrix is suitable to iterate during Viterbi decoding
*
* @param transmission_weights transmission parameters outputted
* @param w the weight vector
*
* @return a matrix with the transmission parameters
*/
virtual void reshape_transmission_params(
SGMatrix< float64_t >& transmission_matrix,
SGMatrix< float64_t >& transmission_weights,
SGVector< float64_t > w);

/** translates label sequence to state sequence
Expand All @@ -100,15 +101,15 @@ class CTwoStateModel : public CStateModel
* weight vector)
*
* @param psi output vector
* @param transition_weights counts of the state transitions for a state
* @param transmission_weights counts of the state transitions for a state
* sequence
* @param emission_weights counts of the emission scores for a state
* sequence and a feature vector
* @param num_feats number of features
* @param num_obs number of emission scores per feature and state
*/
virtual void weights_to_vector(SGVector< float64_t >& psi,
SGMatrix< float64_t > transiton_weights,
SGMatrix< float64_t > transmission_weights,
SGVector< float64_t > emission_weights,
int32_t num_feats, int32_t num_obs) const;

Expand Down

0 comments on commit ccc31d9

Please sign in to comment.