SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeanShiftDataGenerator.cpp
Go to the documentation of this file.
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) 2012-2013 Heiko Strathmann
8  */
9 
10 #include <shogun/lib/common.h>
12 
13 using namespace shogun;
14 
17 {
18  init();
19 }
20 
22  index_t dimension, index_t dimension_shift) :
24 {
25  init();
26  set_mean_shift_model(mean_shift, dimension, dimension_shift);
27 }
28 
30 {
31 }
32 
34  index_t dimension, index_t dimension_shift)
35 {
36  REQUIRE(dimension_shift<dimension, "%s::set_mean_shift_model(%f,%d,%d): "
37  "Dimension of shift is larger than number of dimensions!\n",
38  mean_shift, dimension, dimension_shift);
39 
40  m_dimension=dimension;
41  m_mean_shift=mean_shift;
42  m_dimension_shift=dimension_shift;
43 }
44 
45 void CMeanShiftDataGenerator::init()
46 {
47  SG_ADD(&m_dimension, "dimension", "Dimension of data", MS_NOT_AVAILABLE);
48  SG_ADD(&m_mean_shift, "mean_shift", "Mean shift in one dimension",
50  SG_ADD(&m_dimension_shift, "m_dimension_shift", "Dimension of mean shift",
52 
53  m_dimension=0;
54  m_mean_shift=0;
56 
57  unset_generic();
58 }
59 
61 {
62  SG_SDEBUG("entering CMeanShiftDataGenerator::get_next_example()\n");
63 
64  /* allocate space */
66 
67  /* fill with std normal data */
68  for (index_t i=0; i<m_dimension; ++i)
69  result[i]=CMath::randn_double();
70 
71  /* mean shift in selected dimension */
73 
74  /* save example back to superclass */
76 
77  SG_SDEBUG("leaving CMeanShiftDataGenerator::get_next_example()\n");
78  return true;
79 }
80 
82 {
85 }

SHOGUN Machine Learning Toolbox - Documentation