SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
features
streaming
StreamingDotFeatures.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) 2011 Shashwat Lal Das
8
* Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9
*/
10
#include <
shogun/features/streaming/StreamingDotFeatures.h
>
11
12
using namespace
shogun;
13
14
CStreamingDotFeatures::CStreamingDotFeatures
() :
CStreamingFeatures
()
15
{
16
set_property
(
FP_STREAMING_DOT
);
17
}
18
19
CStreamingDotFeatures::CStreamingDotFeatures
(
CDotFeatures
* dot_features,
20
float64_t
* lab)
21
{
22
SG_NOTIMPLEMENTED
23
return
;
24
}
25
26
CStreamingDotFeatures::~CStreamingDotFeatures
()
27
{
28
}
29
30
void
CStreamingDotFeatures::dense_dot_range
(
float32_t
* output,
float32_t
* alphas,
31
float32_t
* vec, int32_t dim,
float32_t
b, int32_t num_vec)
32
{
33
ASSERT
(num_vec>=0)
34
35
int32_t counter=0;
36
start_parser
();
37
while
(
get_next_example
())
38
{
39
if
(alphas)
40
output[counter]=alphas[counter]*
dense_dot
(vec, dim)+b;
41
else
42
output[counter]=
dense_dot
(vec, dim)+b;
43
44
release_example
();
45
46
counter++;
47
if
((counter>=num_vec) && (num_vec>0))
48
break
;
49
}
50
end_parser
();
51
}
52
53
void
CStreamingDotFeatures::expand_if_required
(
float32_t
*& vec, int32_t &len)
54
{
55
int32_t dim =
get_dim_feature_space
();
56
if
(dim > len)
57
{
58
vec = SG_REALLOC(
float32_t
, vec, len, dim);
59
memset(&vec[len], 0, (dim-len) *
sizeof
(
float32_t
));
60
len = dim;
61
}
62
}
63
64
void
CStreamingDotFeatures::expand_if_required
(
float64_t
*& vec, int32_t &len)
65
{
66
int32_t dim =
get_dim_feature_space
();
67
if
(dim > len)
68
{
69
vec = SG_REALLOC(
float64_t
, vec, len, dim);
70
memset(&vec[len], 0, (dim-len) *
sizeof
(
float64_t
));
71
len = dim;
72
}
73
}
74
75
void
*
CStreamingDotFeatures::get_feature_iterator
()
76
{
77
SG_NOTIMPLEMENTED
78
return
NULL;
79
}
80
81
int32_t
CStreamingDotFeatures::get_nnz_features_for_vector
()
82
{
83
SG_NOTIMPLEMENTED
84
return
-1;
85
}
86
87
bool
CStreamingDotFeatures::get_next_feature
(int32_t& index,
float32_t
& value,
void
* iterator)
88
{
89
SG_NOTIMPLEMENTED
90
return
false
;
91
}
92
93
void
CStreamingDotFeatures::free_feature_iterator
(
void
* iterator)
94
{
95
SG_NOTIMPLEMENTED
96
return
;
97
}
SHOGUN
Machine Learning Toolbox - Documentation