SHOGUN  v3.0.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Parameter.h
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2010 Soeren Sonnenburg
8  * Written (W) 2011-2013 Heiko Strathmann
9  * Copyright (C) 2010 Berlin Institute of Technology
10  */
11 #ifndef __PARAMETER_H__
12 #define __PARAMETER_H__
13 
14 #include <shogun/lib/common.h>
15 #include <shogun/io/SGIO.h>
16 #include <shogun/lib/DataType.h>
17 #include <shogun/lib/SGVector.h>
18 #include <shogun/lib/SGMatrix.h>
21 #include <shogun/base/DynArray.h>
22 
23 namespace shogun
24 {
26 struct TParameter
27 {
34  explicit TParameter(const TSGDataType* datatype, void* parameter,
35  const char* name, const char* description);
36 
38  ~TParameter();
39 
43  void print(const char* prefix);
44 
49  bool save(CSerializableFile* file, const char* prefix="");
50 
55  bool load(CSerializableFile* file, const char* prefix="");
56 
70  void allocate_data_from_scratch(SGVector<index_t> dims, bool new_cont_call=true);
71 
78  void copy_data(const TParameter* source);
79 
87  bool equals(TParameter* other, float64_t accuracy=0.0);
88 
101  static bool compare_ptype(EPrimitiveType ptype, void* data1, void* data2,
102  floatmax_t accuracy=0.0);
103 
117  static bool compare_stype(EStructType stype, EPrimitiveType ptype,
118  void* data1, void* data2, floatmax_t accuracy=0.0);
119 
126  static bool copy_ptype(EPrimitiveType ptype, void* source, void* target);
127 
135  static bool copy_stype(EStructType stype, EPrimitiveType ptype,
136  void* source, void* target);
137 
142  bool copy(TParameter* target);
143 
144 
145 
147  bool operator==(const TParameter& other) const;
148 
150  bool operator<(const TParameter& other) const;
151 
153  bool operator>(const TParameter& other) const;
154 
158  void* m_parameter;
160  char* m_name;
163 
172 
176 
186  uint32_t& hash, uint32_t& carry, uint32_t& total_length);
187 
191  bool is_valid();
192 
193 private:
194  char* new_prefix(const char* s1, const char* s2);
195  void delete_cont();
196  void new_cont(SGVector<index_t> dims);
197  bool new_sgserial(CSGObject** param, EPrimitiveType generic,
198  const char* sgserializable_name,
199  const char* prefix);
200  bool save_ptype(CSerializableFile* file, const void* param,
201  const char* prefix);
202  bool load_ptype(CSerializableFile* file, void* param,
203  const char* prefix);
204  bool save_stype(CSerializableFile* file, const void* param,
205  const char* prefix);
206  bool load_stype(CSerializableFile* file, void* param,
207  const char* prefix);
208 
209 };
210 
217 {
218 public:
220  explicit Parameter();
222  virtual ~Parameter();
223 
227  virtual void print(const char* prefix="");
228 
233  virtual bool save(CSerializableFile* file, const char* prefix="");
234 
235  /* load from serializable file
236  * @param file source file
237  * @param prefix prefix
238  virtual bool load(CSerializableFile* file, const char* prefix="");
239  */
240 
244  virtual int32_t get_num_parameters()
245  {
246  return m_params.get_num_elements();
247  }
248 
257  void set_from_parameters(Parameter* params);
258 
264  void add_parameters(Parameter* params);
265 
270  bool contains_parameter(const char* name);
271 
277  inline TParameter* get_parameter(int32_t idx)
278  {
279  return m_params.get_element(idx);
280  }
281 
287  inline TParameter* get_parameter(const char* name)
288  {
289  TParameter* result=NULL;
290 
291  for (index_t i=0; i<m_params.get_num_elements(); ++i)
292  {
293  result=m_params.get_element(i);
294  if (!strcmp(name, result->m_name))
295  break;
296  else
297  result=NULL;
298  }
299 
300  return result;
301  }
302 
303  /* ************************************************************ */
304  /* Scalar wrappers */
305 
311  void add(bool* param, const char* name,
312  const char* description="");
318  void add(char* param, const char* name,
319  const char* description="");
325  void add(int8_t* param, const char* name,
326  const char* description="");
332  void add(uint8_t* param, const char* name,
333  const char* description="");
339  void add(int16_t* param, const char* name,
340  const char* description="");
346  void add(uint16_t* param, const char* name,
347  const char* description="");
353  void add(int32_t* param, const char* name,
354  const char* description="");
360  void add(uint32_t* param, const char* name,
361  const char* description="");
367  void add(int64_t* param, const char* name,
368  const char* description="");
374  void add(uint64_t* param, const char* name,
375  const char* description="");
381  void add(float32_t* param, const char* name,
382  const char* description="");
388  void add(float64_t* param, const char* name,
389  const char* description="");
395  void add(floatmax_t* param, const char* name,
396  const char* description="");
402  void add(complex128_t* param, const char* name,
403  const char* description="");
409  void add(CSGObject** param,
410  const char* name, const char* description="");
416  void add(SGString<bool>* param, const char* name,
417  const char* description="");
423  void add(SGString<char>* param, const char* name,
424  const char* description="");
430  void add(SGString<int8_t>* param, const char* name,
431  const char* description="");
437  void add(SGString<uint8_t>* param, const char* name,
438  const char* description="");
444  void add(SGString<int16_t>* param, const char* name,
445  const char* description="");
451  void add(SGString<uint16_t>* param, const char* name,
452  const char* description="");
458  void add(SGString<int32_t>* param, const char* name,
459  const char* description="");
465  void add(SGString<uint32_t>* param, const char* name,
466  const char* description="");
472  void add(SGString<int64_t>* param, const char* name,
473  const char* description="");
479  void add(SGString<uint64_t>* param, const char* name,
480  const char* description="");
486  void add(SGString<float32_t>* param, const char* name,
487  const char* description="");
493  void add(SGString<float64_t>* param, const char* name,
494  const char* description="");
500  void add(SGString<floatmax_t>* param, const char* name,
501  const char* description="");
507  void add(SGSparseVector<bool>* param, const char* name,
508  const char* description="");
514  void add(SGSparseVector<char>* param, const char* name,
515  const char* description="");
521  void add(SGSparseVector<int8_t>* param, const char* name,
522  const char* description="");
528  void add(SGSparseVector<uint8_t>* param, const char* name,
529  const char* description="");
535  void add(SGSparseVector<int16_t>* param, const char* name,
536  const char* description="");
542  void add(SGSparseVector<uint16_t>* param, const char* name,
543  const char* description="");
549  void add(SGSparseVector<int32_t>* param, const char* name,
550  const char* description="");
556  void add(SGSparseVector<uint32_t>* param, const char* name,
557  const char* description="");
563  void add(SGSparseVector<int64_t>* param, const char* name,
564  const char* description="");
570  void add(SGSparseVector<uint64_t>* param, const char* name,
571  const char* description="");
577  void add(SGSparseVector<float32_t>* param, const char* name,
578  const char* description="");
584  void add(SGSparseVector<float64_t>* param, const char* name,
585  const char* description="");
591  void add(SGSparseVector<floatmax_t>* param, const char* name,
592  const char* description="");
598  void add(SGSparseVector<complex128_t>* param, const char* name,
599  const char* description="");
600 
601  /* ************************************************************ */
602  /* Vector wrappers */
603 
610  void add_vector(bool** param, index_t* length,
611  const char* name, const char* description="");
618  void add_vector(char** param, index_t* length,
619  const char* name, const char* description="");
626  void add_vector(int8_t** param, index_t* length,
627  const char* name, const char* description="");
634  void add_vector(uint8_t** param, index_t* length,
635  const char* name, const char* description="");
642  void add_vector(int16_t** param, index_t* length,
643  const char* name, const char* description="");
650  void add_vector(uint16_t** param, index_t* length,
651  const char* name, const char* description="");
658  void add_vector(int32_t** param, index_t* length,
659  const char* name, const char* description="");
666  void add_vector(uint32_t** param, index_t* length,
667  const char* name, const char* description="");
674  void add_vector(int64_t** param, index_t* length,
675  const char* name, const char* description="");
682  void add_vector(uint64_t** param, index_t* length,
683  const char* name, const char* description="");
690  void add_vector(float32_t** param, index_t* length,
691  const char* name, const char* description="");
698  void add_vector(float64_t** param, index_t* length,
699  const char* name, const char* description="");
706  void add_vector(floatmax_t** param, index_t* length,
707  const char* name, const char* description="");
714  void add_vector(complex128_t** param, index_t* length,
715  const char* name, const char* description="");
722  void add_vector(CSGObject*** param, index_t* length,
723  const char* name, const char* description="");
730  void add_vector(SGString<bool>** param, index_t* length,
731  const char* name, const char* description="");
738  void add_vector(SGString<char>** param, index_t* length,
739  const char* name, const char* description="");
746  void add_vector(SGString<int8_t>** param, index_t* length,
747  const char* name, const char* description="");
754  void add_vector(SGString<uint8_t>** param, index_t* length,
755  const char* name, const char* description="");
762  void add_vector(SGString<int16_t>** param, index_t* length,
763  const char* name, const char* description="");
770  void add_vector(SGString<uint16_t>** param, index_t* length,
771  const char* name, const char* description="");
778  void add_vector(SGString<int32_t>** param, index_t* length,
779  const char* name, const char* description="");
786  void add_vector(SGString<uint32_t>** param, index_t* length,
787  const char* name, const char* description="");
794  void add_vector(SGString<int64_t>** param, index_t* length,
795  const char* name, const char* description="");
802  void add_vector(SGString<uint64_t>** param, index_t* length,
803  const char* name, const char* description="");
810  void add_vector(SGString<float32_t>** param, index_t* length,
811  const char* name, const char* description="");
818  void add_vector(SGString<float64_t>** param, index_t* length,
819  const char* name, const char* description="");
826  void add_vector(SGString<floatmax_t>** param, index_t* length,
827  const char* name, const char* description="");
834  void add_vector(SGSparseVector<bool>** param, index_t* length,
835  const char* name, const char* description="");
842  void add_vector(SGSparseVector<char>** param, index_t* length,
843  const char* name, const char* description="");
850  void add_vector(SGSparseVector<int8_t>** param, index_t* length,
851  const char* name, const char* description="");
858  void add_vector(SGSparseVector<uint8_t>** param, index_t* length,
859  const char* name, const char* description="");
866  void add_vector(SGSparseVector<int16_t>** param, index_t* length,
867  const char* name, const char* description="");
874  void add_vector(SGSparseVector<uint16_t>** param, index_t* length,
875  const char* name, const char* description="");
882  void add_vector(SGSparseVector<int32_t>** param, index_t* length,
883  const char* name, const char* description="");
890  void add_vector(SGSparseVector<uint32_t>** param, index_t* length,
891  const char* name, const char* description="");
898  void add_vector(SGSparseVector<int64_t>** param, index_t* length,
899  const char* name, const char* description="");
906  void add_vector(SGSparseVector<uint64_t>** param, index_t* length,
907  const char* name, const char* description="");
914  void add_vector(SGSparseVector<float32_t>** param, index_t* length,
915  const char* name, const char* description="");
922  void add_vector(SGSparseVector<float64_t>** param, index_t* length,
923  const char* name, const char* description="");
930  void add_vector(SGSparseVector<floatmax_t>** param, index_t* length,
931  const char* name, const char* description="");
938  void add_vector(SGSparseVector<complex128_t>** param, index_t* length,
939  const char* name, const char* description="");
940 
941 
947  void add(SGVector<bool>* param, const char* name,
948  const char* description="");
954  void add(SGVector<char>* param, const char* name,
955  const char* description="");
961  void add(SGVector<int8_t>* param, const char* name,
962  const char* description="");
968  void add(SGVector<uint8_t>* param, const char* name,
969  const char* description="");
975  void add(SGVector<int16_t>* param, const char* name,
976  const char* description="");
982  void add(SGVector<uint16_t>* param, const char* name,
983  const char* description="");
989  void add(SGVector<int32_t>* param, const char* name,
990  const char* description="");
996  void add(SGVector<uint32_t>* param, const char* name,
997  const char* description="");
1003  void add(SGVector<int64_t>* param, const char* name,
1004  const char* description="");
1010  void add(SGVector<uint64_t>* param, const char* name,
1011  const char* description="");
1017  void add(SGVector<float32_t>* param, const char* name,
1018  const char* description="");
1024  void add(SGVector<float64_t>* param, const char* name,
1025  const char* description="");
1031  void add(SGVector<floatmax_t>* param, const char* name,
1032  const char* description="");
1038  void add(SGVector<complex128_t>* param, const char* name,
1039  const char* description="");
1045  void add(SGVector<CSGObject*>* param, const char* name,
1046  const char* description="");
1052  void add(SGVector<SGString<bool> >* param, const char* name,
1053  const char* description="");
1059  void add(SGVector<SGString<char> >* param, const char* name,
1060  const char* description="");
1066  void add(SGVector<SGString<int8_t> >* param, const char* name,
1067  const char* description="");
1073  void add(SGVector<SGString<uint8_t> >* param, const char* name,
1074  const char* description="");
1080  void add(SGVector<SGString<int16_t> >* param, const char* name,
1081  const char* description="");
1087  void add(SGVector<SGString<uint16_t> >* param, const char* name,
1088  const char* description="");
1094  void add(SGVector<SGString<int32_t> >* param, const char* name,
1095  const char* description="");
1101  void add(SGVector<SGString<uint32_t> >* param, const char* name,
1102  const char* description="");
1108  void add(SGVector<SGString<int64_t> >* param, const char* name,
1109  const char* description="");
1115  void add(SGVector<SGString<uint64_t> >* param, const char* name,
1116  const char* description="");
1122  void add(SGVector<SGString<float32_t> >* param, const char* name,
1123  const char* description="");
1129  void add(SGVector<SGString<float64_t> >* param, const char* name,
1130  const char* description="");
1136  void add(SGVector<SGString<floatmax_t> >* param, const char* name,
1137  const char* description="");
1143  void add(SGVector<SGSparseVector<bool> >* param, const char* name,
1144  const char* description="");
1150  void add(SGVector<SGSparseVector<char> >* param, const char* name,
1151  const char* description="");
1157  void add(SGVector<SGSparseVector<int8_t> >* param, const char* name,
1158  const char* description="");
1164  void add(SGVector<SGSparseVector<uint8_t> >* param,const char* name,
1165  const char* description="");
1171  void add(SGVector<SGSparseVector<int16_t> >* param, const char* name,
1172  const char* description="");
1178  void add(SGVector<SGSparseVector<uint16_t> >* param,
1179  const char* name, const char* description="");
1185  void add(SGVector<SGSparseVector<int32_t> >* param, const char* name,
1186  const char* description="");
1192  void add(SGVector<SGSparseVector<uint32_t> >* param,const char* name,
1193  const char* description="");
1199  void add(SGVector<SGSparseVector<int64_t> >* param, const char* name,
1200  const char* description="");
1206  void add(SGVector<SGSparseVector<uint64_t> >* param,
1207  const char* name, const char* description="");
1213  void add(SGVector<SGSparseVector<float32_t> >* param,
1214  const char* name, const char* description="");
1220  void add(SGVector<SGSparseVector<float64_t> >* param,
1221  const char* name, const char* description="");
1227  void add(SGVector<SGSparseVector<floatmax_t> >* param,
1228  const char* name, const char* description="");
1235  const char* name, const char* description="");
1236 
1237  /* ************************************************************ */
1238  /* Matrix wrappers */
1239 
1247  void add_matrix(bool** param,
1248  index_t* length_y, index_t* length_x,
1249  const char* name, const char* description="");
1257  void add_matrix(char** param,
1258  index_t* length_y, index_t* length_x,
1259  const char* name, const char* description="");
1267  void add_matrix(int8_t** param,
1268  index_t* length_y, index_t* length_x,
1269  const char* name, const char* description="");
1277  void add_matrix(uint8_t** param,
1278  index_t* length_y, index_t* length_x,
1279  const char* name, const char* description="");
1287  void add_matrix(int16_t** param,
1288  index_t* length_y, index_t* length_x,
1289  const char* name, const char* description="");
1297  void add_matrix(uint16_t** param,
1298  index_t* length_y, index_t* length_x,
1299  const char* name, const char* description="");
1307  void add_matrix(int32_t** param,
1308  index_t* length_y, index_t* length_x,
1309  const char* name, const char* description="");
1317  void add_matrix(uint32_t** param,
1318  index_t* length_y, index_t* length_x,
1319  const char* name, const char* description="");
1327  void add_matrix(int64_t** param,
1328  index_t* length_y, index_t* length_x,
1329  const char* name, const char* description="");
1337  void add_matrix(uint64_t** param,
1338  index_t* length_y, index_t* length_x,
1339  const char* name, const char* description="");
1347  void add_matrix(float32_t** param,
1348  index_t* length_y, index_t* length_x,
1349  const char* name, const char* description="");
1357  void add_matrix(float64_t** param,
1358  index_t* length_y, index_t* length_x,
1359  const char* name, const char* description="");
1367  void add_matrix(floatmax_t** param,
1368  index_t* length_y, index_t* length_x,
1369  const char* name, const char* description="");
1377  void add_matrix(complex128_t** param,
1378  index_t* length_y, index_t* length_x,
1379  const char* name, const char* description="");
1387  void add_matrix(CSGObject*** param,
1388  index_t* length_y, index_t* length_x,
1389  const char* name, const char* description="");
1397  void add_matrix(SGString<bool>** param,
1398  index_t* length_y, index_t* length_x,
1399  const char* name, const char* description="");
1407  void add_matrix(SGString<char>** param,
1408  index_t* length_y, index_t* length_x,
1409  const char* name, const char* description="");
1417  void add_matrix(SGString<int8_t>** param,
1418  index_t* length_y, index_t* length_x,
1419  const char* name, const char* description="");
1427  void add_matrix(SGString<uint8_t>** param,
1428  index_t* length_y, index_t* length_x,
1429  const char* name, const char* description="");
1437  void add_matrix(SGString<int16_t>** param,
1438  index_t* length_y, index_t* length_x,
1439  const char* name, const char* description="");
1447  void add_matrix(SGString<uint16_t>** param,
1448  index_t* length_y, index_t* length_x,
1449  const char* name, const char* description="");
1457  void add_matrix(SGString<int32_t>** param,
1458  index_t* length_y, index_t* length_x,
1459  const char* name, const char* description="");
1467  void add_matrix(SGString<uint32_t>** param,
1468  index_t* length_y, index_t* length_x,
1469  const char* name, const char* description="");
1477  void add_matrix(SGString<int64_t>** param,
1478  index_t* length_y, index_t* length_x,
1479  const char* name, const char* description="");
1487  void add_matrix(SGString<uint64_t>** param,
1488  index_t* length_y, index_t* length_x,
1489  const char* name, const char* description="");
1497  void add_matrix(SGString<float32_t>** param,
1498  index_t* length_y, index_t* length_x,
1499  const char* name, const char* description="");
1507  void add_matrix(SGString<float64_t>** param,
1508  index_t* length_y, index_t* length_x,
1509  const char* name, const char* description="");
1517  void add_matrix(SGString<floatmax_t>** param,
1518  index_t* length_y, index_t* length_x,
1519  const char* name, const char* description="");
1527  void add_matrix(SGSparseVector<bool>** param,
1528  index_t* length_y, index_t* length_x,
1529  const char* name, const char* description="");
1537  void add_matrix(SGSparseVector<char>** param,
1538  index_t* length_y, index_t* length_x,
1539  const char* name, const char* description="");
1547  void add_matrix(SGSparseVector<int8_t>** param,
1548  index_t* length_y, index_t* length_x,
1549  const char* name, const char* description="");
1557  void add_matrix(SGSparseVector<uint8_t>** param,
1558  index_t* length_y, index_t* length_x,
1559  const char* name, const char* description="");
1567  void add_matrix(SGSparseVector<int16_t>** param,
1568  index_t* length_y, index_t* length_x,
1569  const char* name, const char* description="");
1577  void add_matrix(SGSparseVector<uint16_t>** param,
1578  index_t* length_y, index_t* length_x,
1579  const char* name, const char* description="");
1587  void add_matrix(SGSparseVector<int32_t>** param,
1588  index_t* length_y, index_t* length_x,
1589  const char* name, const char* description="");
1597  void add_matrix(SGSparseVector<uint32_t>** param,
1598  index_t* length_y, index_t* length_x,
1599  const char* name, const char* description="");
1607  void add_matrix(SGSparseVector<int64_t>** param,
1608  index_t* length_y, index_t* length_x,
1609  const char* name, const char* description="");
1617  void add_matrix(SGSparseVector<uint64_t>** param,
1618  index_t* length_y, index_t* length_x,
1619  const char* name, const char* description="");
1628  index_t* length_y, index_t* length_x,
1629  const char* name, const char* description="");
1638  index_t* length_y, index_t* length_x,
1639  const char* name, const char* description="");
1648  index_t* length_y, index_t* length_x,
1649  const char* name, const char* description="");
1658  index_t* length_y, index_t* length_x,
1659  const char* name, const char* description="");
1665  void add(SGMatrix<bool>* param, const char* name,
1666  const char* description="");
1672  void add(SGMatrix<char>* param, const char* name,
1673  const char* description="");
1679  void add(SGMatrix<int8_t>* param, const char* name,
1680  const char* description="");
1686  void add(SGMatrix<uint8_t>* param, const char* name,
1687  const char* description="");
1693  void add(SGMatrix<int16_t>* param, const char* name,
1694  const char* description="");
1700  void add(SGMatrix<uint16_t>* param, const char* name,
1701  const char* description="");
1707  void add(SGMatrix<int32_t>* param, const char* name,
1708  const char* description="");
1714  void add(SGMatrix<uint32_t>* param, const char* name,
1715  const char* description="");
1721  void add(SGMatrix<int64_t>* param, const char* name,
1722  const char* description="");
1728  void add(SGMatrix<uint64_t>* param, const char* name,
1729  const char* description="");
1735  void add(SGMatrix<float32_t>* param, const char* name,
1736  const char* description="");
1742  void add(SGMatrix<float64_t>* param, const char* name,
1743  const char* description="");
1749  void add(SGMatrix<floatmax_t>* param, const char* name,
1750  const char* description="");
1756  void add(SGMatrix<complex128_t>* param, const char* name,
1757  const char* description="");
1763  void add(SGMatrix<CSGObject*>* param, const char* name,
1764  const char* description="");
1770  void add(SGMatrix<SGString<bool> >* param, const char* name,
1771  const char* description="");
1777  void add(SGMatrix<SGString<char> >* param, const char* name,
1778  const char* description="");
1784  void add(SGMatrix<SGString<int8_t> >* param, const char* name,
1785  const char* description="");
1791  void add(SGMatrix<SGString<uint8_t> >* param, const char* name,
1792  const char* description="");
1798  void add(SGMatrix<SGString<int16_t> >* param, const char* name,
1799  const char* description="");
1805  void add(SGMatrix<SGString<uint16_t> >* param, const char* name,
1806  const char* description="");
1812  void add(SGMatrix<SGString<int32_t> >* param, const char* name,
1813  const char* description="");
1819  void add(SGMatrix<SGString<uint32_t> >* param, const char* name,
1820  const char* description="");
1826  void add(SGMatrix<SGString<int64_t> >* param, const char* name,
1827  const char* description="");
1833  void add(SGMatrix<SGString<uint64_t> >* param, const char* name,
1834  const char* description="");
1840  void add(SGMatrix<SGString<float32_t> >* param, const char* name,
1841  const char* description="");
1847  void add(SGMatrix<SGString<float64_t> >* param, const char* name,
1848  const char* description="");
1854  void add(SGMatrix<SGString<floatmax_t> >* param, const char* name,
1855  const char* description="");
1861  void add(SGMatrix<SGSparseVector<bool> >* param, const char* name,
1862  const char* description="");
1868  void add(SGMatrix<SGSparseVector<char> >* param, const char* name,
1869  const char* description="");
1875  void add(SGMatrix<SGSparseVector<int8_t> >* param, const char* name,
1876  const char* description="");
1882  void add(SGMatrix<SGSparseVector<uint8_t> >* param,const char* name,
1883  const char* description="");
1889  void add(SGMatrix<SGSparseVector<int16_t> >* param, const char* name,
1890  const char* description="");
1896  void add(SGMatrix<SGSparseVector<uint16_t> >* param,
1897  const char* name, const char* description="");
1903  void add(SGMatrix<SGSparseVector<int32_t> >* param, const char* name,
1904  const char* description="");
1910  void add(SGMatrix<SGSparseVector<uint32_t> >* param,const char* name,
1911  const char* description="");
1917  void add(SGMatrix<SGSparseVector<int64_t> >* param, const char* name,
1918  const char* description="");
1924  void add(SGMatrix<SGSparseVector<uint64_t> >* param,
1925  const char* name, const char* description="");
1931  void add(SGMatrix<SGSparseVector<float32_t> >* param,
1932  const char* name, const char* description="");
1938  void add(SGMatrix<SGSparseVector<float64_t> >* param,
1939  const char* name, const char* description="");
1945  void add(SGMatrix<SGSparseVector<floatmax_t> >* param,
1946  const char* name, const char* description="");
1953  const char* name, const char* description="");
1954 
1960  void add(SGSparseMatrix<bool>* param,
1961  const char* name, const char* description="");
1967  void add(SGSparseMatrix<char>* param,
1968  const char* name, const char* description="");
1974  void add(SGSparseMatrix<int8_t>* param,
1975  const char* name, const char* description="");
1981  void add(SGSparseMatrix<uint8_t>* param,
1982  const char* name, const char* description="");
1988  void add(SGSparseMatrix<int16_t>* param,
1989  const char* name, const char* description="");
1995  void add(SGSparseMatrix<uint16_t>* param,
1996  const char* name, const char* description="");
2002  void add(SGSparseMatrix<int32_t>* param,
2003  const char* name, const char* description="");
2009  void add(SGSparseMatrix<uint32_t>* param,
2010  const char* name, const char* description="");
2016  void add(SGSparseMatrix<int64_t>* param,
2017  const char* name, const char* description="");
2023  void add(SGSparseMatrix<uint64_t>* param,
2024  const char* name, const char* description="");
2030  void add(SGSparseMatrix<float32_t>* param,
2031  const char* name, const char* description="");
2037  void add(SGSparseMatrix<float64_t>* param,
2038  const char* name, const char* description="");
2044  void add(SGSparseMatrix<floatmax_t>* param,
2045  const char* name, const char* description="");
2051  void add(SGSparseMatrix<complex128_t>* param,
2052  const char* name, const char* description="");
2058  void add(SGSparseMatrix<CSGObject*>* param,
2059  const char* name, const char* description="");
2060 protected:
2061 
2064 
2071  virtual void add_type(const TSGDataType* type, void* param,
2072  const char* name,
2073  const char* description);
2074 };
2075 }
2076 #endif //__PARAMETER_H__
template class SGSparseMatrix
TParameter * get_parameter(const char *name)
Definition: Parameter.h:287
std::complex< float64_t > complex128_t
Definition: common.h:65
int32_t index_t
Definition: common.h:60
virtual int32_t get_num_parameters()
Definition: Parameter.h:244
bool operator==(const TParameter &other) const
Definition: Parameter.cpp:2966
TParameter * get_parameter(int32_t idx)
Definition: Parameter.h:277
parameter struct
Definition: Parameter.h:26
static bool compare_stype(EStructType stype, EPrimitiveType ptype, void *data1, void *data2, floatmax_t accuracy=0.0)
Definition: Parameter.cpp:3669
virtual void print(const char *prefix="")
Definition: Parameter.cpp:2783
static bool compare_ptype(EPrimitiveType ptype, void *data1, void *data2, floatmax_t accuracy=0.0)
Definition: Parameter.cpp:3275
Datatypes that shogun supports.
Definition: DataType.h:67
bool operator<(const TParameter &other) const
Definition: Parameter.cpp:2973
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry&lt;T&gt;* vector is orde...
shogun string
virtual void add_type(const TSGDataType *type, void *param, const char *name, const char *description)
Definition: Parameter.cpp:2756
bool save(CSerializableFile *file, const char *prefix="")
Definition: Parameter.cpp:2540
TParameter(const TSGDataType *datatype, void *parameter, const char *name, const char *description)
Definition: Parameter.cpp:1772
void add(bool *param, const char *name, const char *description="")
Definition: Parameter.cpp:27
TSGDataType m_datatype
Definition: Parameter.h:156
DynArray< TParameter * > m_params
Definition: Parameter.h:2063
Parameter class.
Definition: Parameter.h:216
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:114
Template Dynamic array class that creates an array that can be used like a list or an array...
Definition: DynArray.h:30
double float64_t
Definition: common.h:48
bool m_was_allocated_from_scratch
Definition: Parameter.h:175
long double floatmax_t
Definition: common.h:49
virtual bool save(CSerializableFile *file, const char *prefix="")
Definition: Parameter.cpp:2790
void print(const char *prefix)
Definition: Parameter.cpp:1835
static bool copy_ptype(EPrimitiveType ptype, void *source, void *target)
Definition: Parameter.cpp:3525
void get_incremental_hash(uint32_t &hash, uint32_t &carry, uint32_t &total_length)
Definition: Parameter.cpp:2450
void set_from_parameters(Parameter *params)
Definition: Parameter.cpp:2811
float float32_t
Definition: common.h:47
shogun matrix
Definition: DenseFeatures.h:27
bool contains_parameter(const char *name)
Definition: Parameter.cpp:2955
void add_vector(bool **param, index_t *length, const char *name, const char *description="")
Definition: Parameter.cpp:324
virtual ~Parameter()
Definition: Parameter.cpp:2747
bool load(CSerializableFile *file, const char *prefix="")
Definition: Parameter.cpp:2639
bool equals(TParameter *other, float64_t accuracy=0.0)
Definition: Parameter.cpp:3132
void add_parameters(Parameter *params)
Definition: Parameter.cpp:2945
bool copy(TParameter *target)
Definition: Parameter.cpp:3943
void copy_data(const TParameter *source)
Definition: Parameter.cpp:3072
char * m_description
Definition: Parameter.h:162
void add_matrix(bool **param, index_t *length_y, index_t *length_x, const char *name, const char *description="")
Definition: Parameter.cpp:933
void allocate_data_from_scratch(SGVector< index_t > dims, bool new_cont_call=true)
Definition: Parameter.cpp:2983
static bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
Definition: Parameter.cpp:3797
bool operator>(const TParameter &other) const
Definition: Parameter.cpp:2978

SHOGUN Machine Learning Toolbox - Documentation