Turi Create
4.0
|
#include <toolkits/ml_data_2/indexing/column_unique_indexer.hpp>
Public Member Functions | |
column_unique_indexer () | |
void | initialize () |
size_t | map_value_to_index (size_t thread_idx, const flexible_type &feature) GL_HOT |
size_t | immutable_map_value_to_index (const flexible_type &feature) const |
void | insert_values_into_index (const std::vector< flexible_type > &features) |
void | register_real_value (const flexible_type &feature) |
void | finalize () |
flexible_type | map_index_to_value (size_t idx) const |
std::set< flex_type_enum > | extract_key_types () const |
size_t | indexed_column_size () const |
size_t | get_version () const |
void | save_impl (turi::oarchive &oarc) const |
void | load_version (turi::iarchive &iarc, size_t version) |
void | set_values (std::vector< flexible_type > &&values) |
std::shared_ptr< column_indexer > | create_cleared_copy () const |
std::function< flexible_type(const flexible_type &)> | deindexing_lambda () const |
std::function< flexible_type(const flexible_type &)> | indexing_lambda () const |
Static Public Member Functions | |
static std::shared_ptr< column_indexer > | factory_create (const std::map< std::string, variant_type > &creation_options) |
Public Attributes | |
std::string | column_name |
ml_column_mode | mode |
flex_type_enum | original_column_type |
std::map< std::string, flexible_type > | options |
column_metadata contains "meta data" concerning indexing of a single column of an SFrame. A collection of meta_data column objects is "all" the metadata required in the ml_data container.
Definition at line 34 of file column_unique_indexer.hpp.
turi::v2::ml_data_internal::column_unique_indexer::column_unique_indexer | ( | ) |
Default constructor; does nothing; Initialize from a serialization stream
|
virtual |
Create a copy with the index cleared.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Returns a lambda function that can be used as a lambda function for deindexing a column.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Calculates the type of the values held in the index. This may be different from original_column_type – if the original_column_type is a DICT or LIST, this will return a set of the actual types present. If the values are inconsistent, then an error is raised.
This method is useful when a metadata built with a dictionary is also used to map simple categorical variables.
Reimplemented from turi::v2::ml_data_internal::column_indexer.
|
staticinherited |
The factory method for loading and instantiating the proper class
|
virtual |
Call this when all calls to map_value_to_index are completed.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Returns the current version used for the serialization.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Returns the index associated with the "feature" value.
If the value in the feature column was already seen, then the index already associated with that value is returned. If not, size_t(-1) is returned.
[in] | feature | The value in the feature column to map to the index. |
Implements turi::v2::ml_data_internal::column_indexer.
|
inlinevirtual |
Returns the size of the column.
Numeric : 1 Categorical : # Unique categories Vector : Size of the vector.
Implements turi::v2::ml_data_internal::column_indexer.
Definition at line 138 of file column_unique_indexer.hpp.
|
virtual |
Returns a lambda function that can be used as a lambda function for indexing a column.
Does not add any new index values.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Initialize the index mapping and setup. There are certain internal parallel things that need to be set up before map_value_to_index works. Call this before looping over map_value_to_index, then call finalize() when done.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Some of the ml_data tests currently depend on the order of insertion into the index, which is now done in parallel and thus not deterministic. This function allows the user to remove that randomness by inserting all indices in a specified order.
NOTE: This function is not thread safe; only call it from one thread.
Reimplemented from turi::v2::ml_data_internal::column_indexer.
|
virtual |
Load the object.
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Returns the feature "value" associated an index.
Reimplemented from turi::v2::ml_data_internal::column_indexer.
|
virtual |
Returns the index associated with the "feature" value.
If the value in the feature column was already seen, then the index already associated with that value is returned. If not, a new unique index is added and associated with this feature value.
This method is completely threadsafe and is meant to be called by multiple threads in contention.
[in] | feature | The value in the feature column to map to the index. |
Implements turi::v2::ml_data_internal::column_indexer.
void turi::v2::ml_data_internal::column_unique_indexer::register_real_value | ( | const flexible_type & | feature | ) |
When a new value is encountered in translating the data, it should be dealt with through map_value_to_index above if it is categorical, or through register_real_value below if it is numeric. This function handles things like checking the size of the numeric vectors (all must be the same) and setting the column size.
Note that the statistics collection functions below are not always called; hence the error checks in register_real_value can't go there.
|
virtual |
Serialize the object (save).
Implements turi::v2::ml_data_internal::column_indexer.
|
virtual |
Set data directly.
Implements turi::v2::ml_data_internal::column_indexer.
|
inherited |
The name of the column.
Definition at line 174 of file column_indexer.hpp.
|
inherited |
The mode of the column;
Definition at line 178 of file column_indexer.hpp.
|
inherited |
A map of the options passed in to ml_data. May include options for the indexers.
Definition at line 187 of file column_indexer.hpp.
|
inherited |
Original column type
Definition at line 182 of file column_indexer.hpp.