13 #ifndef _LIBLINEARMTL_H___
14 #define _LIBLINEARMTL_H___
49 std::map<index_t, float64_t>::const_iterator it =
data[i_row].find(i_col);
51 if (it !=
data[i_row].end())
72 data.push_back(std::map<index_t, float64_t>());
85 std::vector< std::map<index_t, float64_t> >
data;
162 virtual const char*
get_name()
const {
return "LibLinearMTL"; }
186 SG_ERROR(
"Please assign labels first!\n")
190 if (num_labels!=linear_term.
vlen)
192 SG_ERROR(
"Number of labels (%d) does not match number"
193 " of entries (%d) in linear term \n", num_labels,
243 for(int32_t k=0; k<w_size*
num_tasks; k++)
254 for(int32_t i=0; i<w_size; i++)
256 W.
matrix[t*w_size + i] += sim_ts * v_s[i];
307 void solve_l2r_l1l2_svc(
308 const liblinear_problem *prob,
double eps,
double Cp,
double Cn);
358 #endif //_LIBLINEARMTL_H___
void set_bias_enabled(bool enable_bias)
const float64_t operator()(index_t i_row, index_t i_col) const
void set_task_indicator_lhs(SGVector< int32_t > ti)
void set_C(float64_t c_neg, float64_t c_pos)
class to implement LibLinear
void set_task_similarity_matrix(SGSparseMatrix< float64_t > tsm)
SGMatrix< float64_t > get_V()
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
virtual float64_t compute_dual_obj()
virtual float64_t compute_primal_obj()
virtual EMachineType get_classifier_type()
SGVector< float64_t > get_alphas()
Features that support dot products among other operations.
int32_t get_max_iterations()
mapped sparse matrix for representing graph relations of tasks
std::vector< std::map< index_t, float64_t > > data
void set_linear_term(SGVector< float64_t > linear_term)
SGVector< float64_t > m_linear_term
virtual bool train_machine(CFeatures *data=NULL)
void set_graph_laplacian(SGMatrix< float64_t > lap)
T * get_column_vector(index_t col) const
SGSparseVector< T > * sparse_matrix
array of sparse vectors of size num_vectors
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
SGSparseVectorEntry< T > * features
virtual float64_t compute_duality_gap()
void set_task_indicator_rhs(SGVector< int32_t > ti)
SGVector< int32_t > task_indicator_rhs
all of classes and functions are contained in the shogun namespace
SGMatrix< float64_t > get_W()
The class Features is the base class of all feature objects.
SGVector< int32_t > task_indicator_lhs
MappedSparseMatrix task_similarity_matrix
void set_num_tasks(int32_t nt)
SGMatrix< float64_t > graph_laplacian
void set_max_iterations(int32_t max_iter=1000)
index_t num_vectors
total number of vectors
virtual const char * get_name() const
void set_from_sparse(const SGSparseMatrix< float64_t > &sgm)
void set_epsilon(float64_t eps)
SGVector< float64_t > alphas