SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Distribution.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) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
13 
14 using namespace shogun;
15 
17 : CSGObject(), features(NULL), pseudo_count(1e-10)
18 {
19 }
20 
21 
23 {
24 }
25 
27 {
29 
30  float64_t sum=0;
31  for (int32_t i=0; i<features->get_num_vectors(); i++)
33 
34  return sum/features->get_num_vectors();
35 }
36 
38 {
40 
41  int32_t num=features->get_num_vectors();
42  float64_t* vec=SG_MALLOC(float64_t, num);
43 
44  for (int32_t i=0; i<num; i++)
46 
47  return SGVector<float64_t>(vec,num);
48 }
49 
51 {
52  int32_t total_num=get_num_model_parameters();
53  int32_t num=0;
54 
55  for (int32_t i=0; i<total_num; i++)
56  {
58  num++;
59  }
60  return num;
61 }
62 
64 {
66  int32_t num=features->get_num_vectors();
67  ASSERT(num>0);
68 
70  for (int32_t i=0; i<num; i++)
71  result[i]=get_likelihood_example(i);
72 
73  return result;
74 }

SHOGUN Machine Learning Toolbox - Documentation