aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
DBRowGenerator4CompleteRows_inl.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40#pragma once
41
42
50
51#ifndef DOXYGEN_SHOULD_SKIP_THIS
52
53namespace gum {
54
55 namespace learning {
56
60 return *_input_row_;
61 }
62
64 INLINE std::size_t
66 // check that all the values are observed
67 const auto& xrow = row.row();
68 for (const auto col: this->columns_of_interest_) {
69 switch (this->column_types_[col]) {
71 if (xrow[col].discr_val == std::numeric_limits< std::size_t >::max()) {
72 _input_row_ = nullptr;
73 return std::size_t(0);
74 }
75 break;
76
78 if (xrow[col].cont_val == std::numeric_limits< float >::max()) {
79 _input_row_ = nullptr;
80 return std::size_t(0);
81 }
82 break;
83
84 default :
85 GUM_ERROR(NotImplementedYet,
86 "DBTranslatedValueType " << int(this->column_types_[col])
87 << " is not supported yet");
88 }
89 }
90 _input_row_ = &row;
91 return std::size_t(1);
92 }
93
94
95 } /* namespace learning */
96
97} /* namespace gum */
98
99#endif /* DOXYGEN_SHOULD_SKIP_THIS */
A DBRowGenerator class that returns the rows that are complete (fully observed) w....
const DBRow< DBTranslatedValue > & generate() final
generates one output DBRow for each DBRow passed to method setInputRow
std::size_t computeRows_(const DBRow< DBTranslatedValue > &row) final
computes the rows it will provide as output
std::vector< std::size_t > columns_of_interest_
the set of columns of interest
std::vector< DBTranslatedValueType > column_types_
the types of the columns in the DatabaseTable
void decreaseRemainingRows()
decrease the number of remaining output rows
The class for storing a record in a database.
Definition DBRow.h:75
#define GUM_ERROR(type, msg)
Definition exceptions.h:72
include the inlined functions if necessary
Definition CSVParser.h:54
gum is the global namespace for all aGrUM entities
Definition agrum.h:46