Turi Create  4.0
turi::timeseries::interpolator_value Class Referenceabstract

#include <model_server/extensions/timeseries/interpolate_value.hpp>

Public Member Functions

virtual bool support_type (flex_type_enum type) const =0
 
virtual flex_type_enum set_input_types (const std::vector< flex_type_enum > &types)
 
virtual std::string name () const =0
 
virtual flexible_type interpolate (const flexible_type &t, const flexible_type &t1, const flexible_type &t2, const flexible_type &v1, const flexible_type &v2) const =0
 

Detailed Description

Simple interface for 2-D interpolation required for re-sample. functions.

output = interpolator.emit(1.5, 1, 1, 2, 2)

As an example, consider the following simple function which interpolates values linearly.

Interpolates the value at t, using the values at (t1, v1), (t2, v2)

linear = [](const flexible_type& t,
const flexible_type& t1, const flexible_type& t2,
const flexible_type& v1, const flexible_type& v2) {
return v1 + (v2 - v2) * (t - t1) / (t2 - t1);
}

Definition at line 36 of file interpolate_value.hpp.

Member Function Documentation

◆ interpolate()

virtual flexible_type turi::timeseries::interpolator_value::interpolate ( const flexible_type t,
const flexible_type t1,
const flexible_type t2,
const flexible_type v1,
const flexible_type v2 
) const
pure virtual

Interpolate the value at t, given the (t1, v1) and (t2, v2)

◆ name()

virtual std::string turi::timeseries::interpolator_value::name ( ) const
pure virtual

Returns a printable name of the operation.

◆ set_input_types()

virtual flex_type_enum turi::timeseries::interpolator_value::set_input_types ( const std::vector< flex_type_enum > &  types)
inlinevirtual

Sets the input types and returns the output type.

Default implementation assumes there is ony one input, and output type is the same as input type.

Definition at line 52 of file interpolate_value.hpp.

◆ support_type()

virtual bool turi::timeseries::interpolator_value::support_type ( flex_type_enum  type) const
pure virtual

Returns true if the the aggregate_value can consume a column of this type, and false otherwise. (For instance, a sum aggregator can consume integers and floats, and not anything else).


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