Turi Create
4.0
ml_data_entry.hpp
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
#ifndef TURI_ML2_DATA_ENTRY_H_
7
#define TURI_ML2_DATA_ENTRY_H_
8
9
#include <cstdlib>
10
#include <core/storage/serialization/serialization_includes.hpp>
11
12
namespace
turi
{
namespace
v2 {
13
14
/**
15
* Information relevant to a single entry of ml_data. The column_index may
16
* refer to a side column.
17
*/
18
struct
ml_data_full_entry
{
19
size_t
column_index
;
/**< Column id .*/
20
size_t
feature_index
;
/**< Local index within the column.*/
21
size_t
global_index
;
/**< Global index, referenced off of the training index sizes. */
22
double
value
;
/**< Value */
23
};
24
25
/**
26
* Information relevant to a single entry of ml_data. The column_index may
27
* refer to a side column.
28
*/
29
struct
ml_data_entry
{
30
size_t
column_index
;
/**< Column id .*/
31
size_t
index
;
/**< Local index within the column.*/
32
double
value
;
/**< Value */
33
34
/// Simple equality test
35
bool
operator==
(
const
ml_data_entry
& other)
const
{
36
return
((column_index == other.
column_index
)
37
&& (index == other.
index
)
38
&& (value == other.
value
));
39
}
40
41
const
ml_data_entry
& operator=(
const
ml_data_full_entry
& fe) {
42
column_index = fe.
column_index
;
43
index = fe.
feature_index
;
44
value = fe.
value
;
45
46
return
*
this
;
47
}
48
};
49
50
51
/**
52
* Information relevant to a single entry of ml_data. The column_index may
53
* refer to a side column.
54
*/
55
struct
ml_data_entry_global_index
{
56
size_t
global_index
;
/**< Global index based on training indices. */
57
double
value
= 1.0;
/**< Value */
58
59
/// Simple equality test
60
bool
operator==
(
const
ml_data_entry_global_index
& other)
const
{
61
return
((global_index == other.
global_index
)
62
&& (value == other.
value
));
63
}
64
65
const
ml_data_entry_global_index
& operator=(
const
ml_data_full_entry
& fe) {
66
global_index = fe.
global_index
;
67
value = fe.
value
;
68
69
return
*
this
;
70
}
71
};
72
73
}}
74
75
SERIALIZABLE_POD(
v2::ml_data_entry
);
76
77
78
#endif
/* TURI_ML2_DATA_ENTRY_H_ */
turi::v2::ml_data_entry
Definition:
ml_data_entry.hpp:29
turi::v2::ml_data_full_entry::column_index
size_t column_index
Definition:
ml_data_entry.hpp:19
turi::v2::ml_data_entry_global_index::value
double value
Definition:
ml_data_entry.hpp:57
turi::v2::ml_data_entry::column_index
size_t column_index
Definition:
ml_data_entry.hpp:30
turi::v2::ml_data_entry_global_index::operator==
bool operator==(const ml_data_entry_global_index &other) const
Simple equality test.
Definition:
ml_data_entry.hpp:60
turi::v2::ml_data_entry::value
double value
Definition:
ml_data_entry.hpp:32
turi
SKD.
Definition:
capi_initialization.hpp:11
turi::v2::ml_data_full_entry::global_index
size_t global_index
Definition:
ml_data_entry.hpp:21
turi::v2::ml_data_full_entry::feature_index
size_t feature_index
Definition:
ml_data_entry.hpp:20
turi::v2::ml_data_entry_global_index::global_index
size_t global_index
Definition:
ml_data_entry.hpp:56
turi::v2::ml_data_full_entry::value
double value
Definition:
ml_data_entry.hpp:22
turi::v2::ml_data_entry::index
size_t index
Definition:
ml_data_entry.hpp:31
turi::v2::ml_data_entry_global_index
Definition:
ml_data_entry.hpp:55
turi::v2::ml_data_entry::operator==
bool operator==(const ml_data_entry &other) const
Simple equality test.
Definition:
ml_data_entry.hpp:35
turi::v2::ml_data_full_entry
Definition:
ml_data_entry.hpp:18
toolkits
ml_data_2
ml_data_entry.hpp
Generated by
1.8.13