Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A few doc improvements for malsar based multitask algorithms
  • Loading branch information
lisitsyn committed Aug 9, 2012
1 parent 443f89f commit 10a0961
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 22 deletions.
Expand Up @@ -14,7 +14,12 @@

namespace shogun
{
/** @brief */
/** @brief class MultitaskClusteredLogisticRegression, a classifier for multitask problems.
* Supports only task group relations. Based on solver ported from the MALSAR library.
* Assumes task in group are related with a clustered structure.
*
* @see CTaskGroup
*/
class CMultitaskClusteredLogisticRegression : public CMultitaskLogisticRegression
{

Expand All @@ -41,39 +46,58 @@ class CMultitaskClusteredLogisticRegression : public CMultitaskLogisticRegressio
/** destructor */
virtual ~CMultitaskClusteredLogisticRegression();

/** get rho1
/** get rho1 regularization coefficient
*
* @return rho1 value
*/
int32_t get_rho1() const;

/** set rho1
* @param rho1 value
*/
void set_rho1(float64_t rho1);

/** get rho1
*/
int32_t get_rho2() const;

/** set rho1
* @param rho2 value
*/
void set_rho2(float64_t rho2);
/** get num clusters */

/** get number of clusters
*
* @return number of clusters
*/
int32_t get_num_clusters() const;
/** set num clusters

/** set number of clusters
* @param num_clusters number of clusters
*/
void set_num_clusters(int32_t num_clusters);

/** get name */
/** get name
*
* @return name of the object
*/
virtual const char* get_name() const
{
return "MultitaskClusteredLogisticRegression";
}

protected:

/** train machine */
/** train machine
*
* @param data features to use for training
*/
virtual bool train_machine(CFeatures* data=NULL);

/** train locked implementation */
/** train locked implementation
*
* @param tasks array of tasks indices
*/
virtual bool train_locked_implementation(SGVector<index_t>* tasks);

protected:
Expand All @@ -84,7 +108,7 @@ class CMultitaskClusteredLogisticRegression : public CMultitaskLogisticRegressio
/** rho2 */
float64_t m_rho2;

/** num clusters */
/** number of clusters */
int32_t m_num_clusters;
};
}
Expand Down
10 changes: 10 additions & 0 deletions src/shogun/transfer/multitask/MultitaskL1L2LogisticRegression.cpp
Expand Up @@ -47,6 +47,16 @@ void CMultitaskL1L2LogisticRegression::set_rho2(float64_t rho2)
m_rho2 = rho2;
}

float64_t CMultitaskL1L2LogisticRegression::get_rho1() const
{
return m_rho1;
}

float64_t CMultitaskL1L2LogisticRegression::get_rho2() const
{
return m_rho2;
}

CMultitaskL1L2LogisticRegression::~CMultitaskL1L2LogisticRegression()
{
}
Expand Down
46 changes: 35 additions & 11 deletions src/shogun/transfer/multitask/MultitaskL1L2LogisticRegression.h
Expand Up @@ -14,7 +14,11 @@

namespace shogun
{
/** @brief */
/** @brief class MultitaskL1L2LogisticRegression, a classifier for multitask problems.
* Supports only task group relations. Based on solver ported from the MALSAR library.
*
* @see CTaskGroup
* */
class CMultitaskL1L2LogisticRegression : public CMultitaskLogisticRegression
{

Expand All @@ -26,8 +30,8 @@ class CMultitaskL1L2LogisticRegression : public CMultitaskLogisticRegression

/** constructor
*
* @param rho1 rho1 regularization coefficient
* @param rho2 rho2 regularization coefficient
* @param rho1 rho1 regularization coefficient of L1/L2 term
* @param rho2 rho2 regularization coefficient of L2 term
* @param training_data training features
* @param training_labels training labels
* @param task_relation task relation
Expand All @@ -39,40 +43,60 @@ class CMultitaskL1L2LogisticRegression : public CMultitaskLogisticRegression
/** destructor */
virtual ~CMultitaskL1L2LogisticRegression();

/** set rho1
/** set rho1 regularization coefficient
* @param rho1 value
*/
void set_rho1(float64_t rho1);

/** set rho1

/** get rho1 regularization coefficient
* @param rho1 value
*/
float64_t get_rho1() const;

/** set rho2 regularization coefficient
* @param rho2 value
*/
void set_rho2(float64_t rho2);

/** get name */
/** get rho2 regularization coefficient
* @return rho2 value
*/
float64_t get_rho2() const;

/** get name
*
* @return name of the object
*/
virtual const char* get_name() const
{
return "MultitaskL1L2LogisticRegression";
}

private:

/** init */
void init();

protected:

/** train machine */
/** train machine
*
* @param data features to use for training
*/
virtual bool train_machine(CFeatures* data=NULL);

/** train locked implementation */
/** train locked implementation
*
* @param tasks array of tasks indices
*/
virtual bool train_locked_implementation(SGVector<index_t>* tasks);

protected:

/** rho1 */
/** rho1, regularization coefficient of L1/L2 term */
float64_t m_rho1;

/** rho2 */
/** rho2, regularization coefficient of L2 term */
float64_t m_rho2;

};
Expand Down
Expand Up @@ -41,6 +41,11 @@ void CMultitaskTraceLogisticRegression::set_rho(float64_t rho)
m_rho = rho;
}

float64_t CMultitaskTraceLogisticRegression::get_rho() const
{
return m_rho;
}

CMultitaskTraceLogisticRegression::~CMultitaskTraceLogisticRegression()
{
}
Expand Down
19 changes: 16 additions & 3 deletions src/shogun/transfer/multitask/MultitaskTraceLogisticRegression.h
Expand Up @@ -14,7 +14,11 @@

namespace shogun
{
/** @brief */
/** @brief class MultitaskTraceLogisticRegression, a classifier for multitask problems.
* Supports only task group relations. Based on solver ported from the MALSAR library.
*
* @see CTaskGroup
*/
class CMultitaskTraceLogisticRegression : public CMultitaskLogisticRegression
{

Expand All @@ -41,16 +45,25 @@ class CMultitaskTraceLogisticRegression : public CMultitaskLogisticRegression
/** set rho
* @param rho value
*/
void set_rho(float64_t rho);
void set_rho(float64_t rho);

/** get rho
* @return rho value
*/
float64_t get_rho() const;

/** get name */
/** get name
*
* @return name of the object
*/
virtual const char* get_name() const
{
return "MultitaskTraceLogisticRegression";
}

private:

/** init */
void init();

protected:
Expand Down

0 comments on commit 10a0961

Please sign in to comment.