SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
io
streaming
StreamingVwFile.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) 2011 Shashwat Lal Das
8
* Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9
*/
10
#ifndef __STREAMING_VWFILE_H__
11
#define __STREAMING_VWFILE_H__
12
13
#include <
shogun/io/streaming/StreamingFile.h
>
14
#include <
shogun/classifier/vw/vw_common.h
>
15
#include <
shogun/classifier/vw/VwParser.h
>
16
17
namespace
shogun
18
{
20
typedef
int32_t (
CVwParser
::*
parse_func
)(
CIOBuffer
*,
VwExample
*&);
21
26
class
CStreamingVwFile
:
public
CStreamingFile
27
{
28
public
:
33
CStreamingVwFile
();
34
41
CStreamingVwFile
(
const
char
* fname,
char
rw=
'r'
);
42
46
virtual
~CStreamingVwFile
();
47
54
void
set_parser_type
(
E_VW_PARSER_TYPE
type =
T_VW
);
55
66
virtual
void
get_vector
(
VwExample
* &ex, int32_t &len);
67
77
virtual
void
get_vector_and_label
(
VwExample
* &ex, int32_t &len,
float64_t
&label);
78
84
void
set_env
(
CVwEnvironment
* env_to_use)
85
{
86
parser
->
set_env
(env_to_use);
87
}
88
94
CVwEnvironment
*
get_env
()
95
{
96
SG_REF
(
env
);
97
return
env
;
98
}
99
105
void
set_write_to_cache
(
bool
write_cache)
106
{
107
write_to_cache
= write_cache;
108
parser
->
set_write_cache
(write_cache);
109
}
110
116
bool
get_write_to_cache
() {
return
write_to_cache
; }
117
118
virtual
bool
is_seekable
() {
return
false
; }
119
121
virtual
const
char
*
get_name
()
const
122
{
123
return
"StreamingVwFile"
;
124
}
125
126
public
:
128
parse_func
parse_example
;
129
130
private
:
134
virtual
void
init();
135
136
protected
:
138
CVwParser
*
parser
;
139
141
E_VW_PARSER_TYPE
parser_type
;
142
144
CVwEnvironment
*
env
;
145
147
bool
write_to_cache
;
148
};
149
}
150
#endif //__STREAMING_VWFILE_H__
SHOGUN
机器学习工具包 - 项目文档