Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::src::columns_info Class Reference

#include <columns_info.h>

Classes

class  column_info
 Information about a single column of the dataset. More...

Public Types

using const_iterator = std::vector<column_info>::const_iterator
using iterator = std::vector<column_info>::iterator
using size_type = std::size_t
using value_type = column_info

Public Member Functions

 columns_info (const columns_info &)
 columns_info (const std::vector< std::pair< std::string, domain_t > > &)
columns_info & operator= (const columns_info &)
const column_info & operator[] (size_type) const
column_info & operator[] (size_type)
const column_info & operator[] (const std::string &) const
const column_info & front () const
column_info & front ()
const column_info & back () const
column_info & back ()
size_type size () const noexcept
bool empty () const noexcept
const_iterator begin () const noexcept
iterator begin () noexcept
const_iterator end () const noexcept
iterator end () noexcept
const_iterator cbegin () const noexcept
const_iterator cend () const noexcept
void pop_back ()
void push_back (const column_info &)
void push_front (const column_info &)
void data_typing (typing) noexcept
template<DataframeMatrix R>
void build (const R &, std::optional< std::size_t >)
std::set< symbol::category_t > used_categories () const
domain_t domain_of_category (symbol::category_t) const
task_t task () const noexcept
bool is_valid () const
template<DataframeMatrix R>
void build (const R &exs, std::optional< std::size_t > output_index)

Detailed Description

Metadata container describing the columns of a dataframe.

This class stores and manages column-level information such as:

  • column names;
  • inferred domains;
  • input/output roles;
  • typing constraints.

It also provides facilities to infer such metadata from a dataframe-like range and to query the resulting schema.

Constructor & Destructor Documentation

◆ columns_info() [1/2]

ultra::src::columns_info::columns_info ( const columns_info & other)

Copy constructor.

Parameters
[in]otheranother container to be used as source to initialize the elements of the container with

Constructs the container with the copy of the contents of other.

◆ columns_info() [2/2]

ultra::src::columns_info::columns_info ( const std::vector< std::pair< std::string, domain_t > > & schema)

Constructs the object from a user provided-schema.

Parameters
[in]schemauser-provided schema for the dataframe

Member Function Documentation

◆ back()

const columns_info::column_info & ultra::src::columns_info::back ( ) const
nodiscard

Returns a reference to the last element in the container.

Warning
Calling back on an empty container causes undefined behavior.

◆ build() [1/2]

template<DataframeMatrix R>
void ultra::src::columns_info::build ( const R & exs,
std::optional< std::size_t > output_index )

Infer column metadata from a dataframe-like range.

Template Parameters
Ra DataframeMatrix type
Parameters
[in]exsa non-empty range of rows representing the dataset. The first row must contain column headers
[in]output_indexoptional index of the output column. If not provided, a surrogate output column may be inserted
Precondition
The range must not be empty
Rows must have non-zero size.

The first row of exs is interpreted as the header row. An optional output column may be designated via output_index; when present, the corresponding column is treated as the output and is normalised to appear first during analysis.

Domain inference is performed on a bounded reservoir sample of valid input rows.

Remarks
Rows whose normalised width differs from the header are ignored during domain inference.

◆ build() [2/2]

template<DataframeMatrix R>
void ultra::src::columns_info::build ( const R & exs,
std::optional< std::size_t > output_index )

Infer column metadata from a dataframe-like range.

Template Parameters
Ra DataframeMatrix type
Parameters
[in]exsa non-empty range of rows representing the dataset. The first row must contain column headers
[in]output_indexoptional index of the output column. If not provided, a surrogate output column may be inserted
Precondition
The range must not be empty
Rows must have non-zero size.

The first row of exs is interpreted as the header row. An optional output column may be designated via output_index; when present, the corresponding column is treated as the output and is normalised to appear first during analysis.

Domain inference is performed on a bounded reservoir sample of valid input rows.

Remarks
Rows whose normalised width differs from the header are ignored during domain inference.

◆ data_typing()

void ultra::src::columns_info::data_typing ( typing t)
noexcept

Set the data typing system used for category identification.

Parameters
[in]ttype of data typing (see typing for details)

◆ domain_of_category()

domain_t ultra::src::columns_info::domain_of_category ( symbol::category_t target) const
nodiscard

Return the domain associated with a symbol category.

Parameters
[in]targetcategory of interest
Returns
domain corresponding to the given category

◆ front()

const columns_info::column_info & ultra::src::columns_info::front ( ) const
nodiscard

Returns a reference to the first element in the container.

Warning
Calling front on an empty container causes undefined behavior.

◆ is_valid()

bool ultra::src::columns_info::is_valid ( ) const
nodiscard
Returns
true if all columns have valid domains and consistent categories

◆ operator=()

columns_info & ultra::src::columns_info::operator= ( const columns_info & other)

Copy assignment operator.

Parameters
[in]otheranother container to use as the data source
Returns
*this

Replaces the contents with a copy of the contents of other.

◆ operator[]() [1/3]

const columns_info::column_info & ultra::src::columns_info::operator[] ( const std::string & name) const
nodiscard

Returns a reference to column_info with specified column header.

Parameters
[in]namethe name of the column_info to find
Returns
a reference to the column_info with the given column header
Exceptions
`std::out_of_range`if the container does not contain a column with the specified name

◆ operator[]() [2/3]

columns_info::column_info & ultra::src::columns_info::operator[] ( size_type i)
nodiscard

Access column metadata by index.

Parameters
[in]icolumn index
Returns
reference to the corresponding column_info

◆ operator[]() [3/3]

const columns_info::column_info & ultra::src::columns_info::operator[] ( size_type i) const
nodiscard

Access column metadata by index.

Parameters
[in]icolumn index
Returns
constant reference to the corresponding column_info

◆ pop_back()

void ultra::src::columns_info::pop_back ( )

Removes the last column from the container.

Warning
Ensure the container is not empty before calling (possible undefined behavior).

◆ push_back()

void ultra::src::columns_info::push_back ( const column_info & v)

Adds a new column at the end of the column list.

Parameters
[in]vinformation about the new column

◆ push_front()

void ultra::src::columns_info::push_front ( const column_info & v)

Inserts a new column at the beginning of the list, moving existing columns forward.

Parameters
[in]vinformation about the new column

◆ size()

columns_info::size_type ultra::src::columns_info::size ( ) const
nodiscardnoexcept
Returns
the number of columns in the container

◆ task()

task_t ultra::src::columns_info::task ( ) const
nodiscardnoexcept

Return the learning task inferred for the columns.

Returns
current task type

◆ used_categories()

std::set< symbol::category_t > ultra::src::columns_info::used_categories ( ) const
Returns
a set of all categories used across columns

The documentation for this class was generated from the following files: