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_DML_DATA_ENTRY_H_
7
#define TURI_DML_DATA_ENTRY_H_
8
9
#include <cstdlib>
10
#include <core/storage/serialization/serialization_includes.hpp>
11
12
namespace
turi
{
13
14
15
/**
16
* \ingroup mldata
17
* \{
18
* Information relevant to a single entry of ml_data.
19
*/
20
struct
ml_data_full_entry
{
21
size_t
column_index
;
/**< Column id .*/
22
size_t
feature_index
;
/**< Local index within the column.*/
23
size_t
global_index
;
/**< Global index, referenced off of the training index sizes. */
24
double
value
;
/**< Value */
25
};
26
27
/**
28
* Information relevant to a single entry of ml_data.
29
*/
30
struct
ml_data_entry
{
31
size_t
column_index
;
/**< Column id .*/
32
size_t
index
;
/**< Local index within the column.*/
33
double
value
;
/**< Value */
34
35
/// Simple equality test
36
bool
operator==
(
const
ml_data_entry
& other)
const
{
37
return
((column_index == other.
column_index
)
38
&& (index == other.
index
)
39
&& (value == other.
value
));
40
}
41
42
const
ml_data_entry
& operator=(
const
ml_data_full_entry
& fe) {
43
column_index = fe.
column_index
;
44
index = fe.
feature_index
;
45
value = fe.
value
;
46
47
return
*
this
;
48
}
49
};
50
51
52
/**
53
* Information relevant to a single entry of ml_data.
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
76
SERIALIZABLE_POD(
ml_data_entry
);
77
78
79
#endif
/* TURI_DML_DATA_ENTRY_H_ */
turi::ml_data_entry_global_index::value
double value
Definition:
ml_data_entry.hpp:57
turi::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::ml_data_entry_global_index
Definition:
ml_data_entry.hpp:55
turi::ml_data_entry::value
double value
Definition:
ml_data_entry.hpp:33
turi::ml_data_entry::operator==
bool operator==(const ml_data_entry &other) const
Simple equality test.
Definition:
ml_data_entry.hpp:36
turi::ml_data_full_entry::global_index
size_t global_index
Definition:
ml_data_entry.hpp:23
turi::ml_data_full_entry::value
double value
Definition:
ml_data_entry.hpp:24
turi
SKD.
Definition:
capi_initialization.hpp:11
turi::ml_data_entry::column_index
size_t column_index
Definition:
ml_data_entry.hpp:31
turi::ml_data_entry::index
size_t index
Definition:
ml_data_entry.hpp:32
turi::ml_data_full_entry
Definition:
ml_data_entry.hpp:20
turi::ml_data_full_entry::feature_index
size_t feature_index
Definition:
ml_data_entry.hpp:22
turi::ml_data_entry_global_index::global_index
size_t global_index
Definition:
ml_data_entry.hpp:56
turi::ml_data_entry
Definition:
ml_data_entry.hpp:30
turi::ml_data_full_entry::column_index
size_t column_index
Definition:
ml_data_entry.hpp:21
ml
ml_data
ml_data_entry.hpp
Generated by
1.8.13