Turi Create  4.0
turi::l2_rescaling Class Reference

#include <toolkits/ml_data_2/standardization-inl.hpp>

Public Member Functions

virtual ~l2_rescaling ()
 
 l2_rescaling (const std::shared_ptr< v2::ml_metadata > &ml_metadata, bool _use_reference=true)
 
void transform (DenseVector &point) const
 
void transform (DenseMatrix &points) const
 
void inverse_transform (DenseVector &point) const
 
void inverse_transform (SparseVector &point) const
 
void transform (SparseVector &point) const
 
void save (turi::oarchive &oarc) const
 
void load (turi::iarchive &iarc)
 
size_t get_total_size () const
 

Protected Attributes

DenseVector scale
 
bool use_reference
 
size_t total_size
 

Detailed Description

Rescale columns by L2-norm x >= 0

Definition at line 202 of file standardization-inl.hpp.

Constructor & Destructor Documentation

◆ ~l2_rescaling()

virtual turi::l2_rescaling::~l2_rescaling ( )
inlinevirtual

Default destructor.

Definition at line 215 of file standardization-inl.hpp.

◆ l2_rescaling()

turi::l2_rescaling::l2_rescaling ( const std::shared_ptr< v2::ml_metadata > &  ml_metadata,
bool  _use_reference = true 
)
inline

Default constructor.

Parameters
[in]metadataMetadata object for the features.
[in]index_sizeSizes of each of the features.
[in]use_referenceReference encoding of categorical?
Note
The index_size refers to the size of each of the features. The sizes of each type of features are:

Numeric : 1 String : # categories List : Size Categorical Vector : Total number of categories Dictionary : # keys

Note
Although the metadata keeps a copy of these sizes, they may not be consistent with what was seen during training (because of new categories). Hence, you would need both the metadata for the column stats collected during training and the index_size for feature sizes captured at the end of training.

Definition at line 240 of file standardization-inl.hpp.

Member Function Documentation

◆ get_total_size()

size_t turi::standardization_interface::get_total_size ( ) const
inlineinherited

Return the total size of all the variables in the space.

Parameters
[out]total_sizeSize of all the variables in the space.
Note
This is the sum of the sizes of the individual features that created this object. They are

Numeric : 1 Categorical : # Unique categories Vector : Size of the vector. CategoricalVector : # Unique categories. Dictionary : # Keys

For reference encoding, subtract 1 from the Categorical and Categorical-Vector types.

Returns
Column size.

Definition at line 190 of file standardization-inl.hpp.

◆ inverse_transform() [1/2]

void turi::l2_rescaling::inverse_transform ( DenseVector &  point) const
inlinevirtual

Inverse transform a point from the standardized space to the original space.

Parameters
[in,out]point(DenseVector)Point to be transformed.

Implements turi::standardization_interface.

Definition at line 379 of file standardization-inl.hpp.

◆ inverse_transform() [2/2]

void turi::l2_rescaling::inverse_transform ( SparseVector &  point) const
inlinevirtual

Inverse transform a point from the standardized space to the original space.

Parameters
[in,out]point(SparseVector)Point to be transformed.

Implements turi::standardization_interface.

Definition at line 393 of file standardization-inl.hpp.

◆ load()

void turi::l2_rescaling::load ( turi::iarchive iarc)
inlinevirtual

Serialization – Load object

Load this class from a Turi iarc object.

Parameters
[in]iarcTuri iarc object

Implements turi::standardization_interface.

Definition at line 432 of file standardization-inl.hpp.

◆ save()

void turi::l2_rescaling::save ( turi::oarchive oarc) const
inlinevirtual

Serialization – Save object

Save this class to a Turi oarc object.

Parameters
[in]oarcTuri oarc object

Implements turi::standardization_interface.

Definition at line 420 of file standardization-inl.hpp.

◆ transform() [1/3]

void turi::l2_rescaling::transform ( DenseVector &  point) const
inlinevirtual

Transform a point from the original space to the standardized space.

Parameters
[in,out]point(DenseVector)Point to be transformed.

Implements turi::standardization_interface.

Definition at line 354 of file standardization-inl.hpp.

◆ transform() [2/3]

void turi::l2_rescaling::transform ( DenseMatrix &  points) const
inline

Transform a row of points from the original space to the standardized space.

Parameters
[in,out]point(DenseVector)Point to be transformed.

Definition at line 366 of file standardization-inl.hpp.

◆ transform() [3/3]

void turi::l2_rescaling::transform ( SparseVector &  point) const
inlinevirtual

Transform a point from the original space to the standardized space.

Parameters
[in,out]point(SparseVector)Point to be transformed.

Implements turi::standardization_interface.

Definition at line 407 of file standardization-inl.hpp.

Member Data Documentation

◆ scale

DenseVector turi::l2_rescaling::scale
protected

Scale

Definition at line 206 of file standardization-inl.hpp.

◆ total_size

size_t turi::standardization_interface::total_size
protectedinherited

Total size

Definition at line 98 of file standardization-inl.hpp.

◆ use_reference

bool turi::l2_rescaling::use_reference
protected

Reference encoding

Definition at line 207 of file standardization-inl.hpp.


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