Loading...

vastorbit.machine_learning.memmodel.preprocessing.MinMaxScaler

class vastorbit.machine_learning.memmodel.preprocessing.MinMaxScaler(min_: Annotated[list | ndarray, 'Array Like Structure'], max_: Annotated[list | ndarray, 'Array Like Structure'])

InMemoryModel implementation of MinMax scaler.

Note

The MinMaxScaler is defined entirely by its attributes. For example, minimum, and maximum values of the input features define a MinMaxScaler model.

Attributes

Attributes are identical to Scaler.

Parameters:
  • min_ (ArrayLike) – Model’s features minimums.

  • max_ (ArrayLike) – Model’s features maximums.

Examples

Initalization

Import the required module.

from vastorbit.machine_learning.memmodel.preprocessing import MinMaxScaler

A MinMaxScaler model is defined by minimum and maximum values. In this example, we will use the following:

min = [0.4, 0.1]
max = [0.5, 0.2]

Let’s create a MinMaxScaler model.

model_mms = MinMaxScaler(min, max)

Create a dataset.

data = [[0.45, 0.17]]

Making In-Memory Transformation

Use transform() method to do transformation.

model_mms.transform(data)

Deploy SQL Code

Let’s use the following column names:

cnames = ['col1', 'col2']

Use transform_sql() method to get the SQL code needed to deploy the model using its attributes.

model_mms.transform_sql(cnames)

Hint

This object can be pickled and used in any in-memory environment, just like scikit-learn models.

__init__(min_: Annotated[list | ndarray, 'Array Like Structure'], max_: Annotated[list | ndarray, 'Array Like Structure']) None

Methods

__init__(min_, max_)

get_attributes()

Returns the model attributes.

set_attributes(**kwargs)

Sets the model attributes.

transform(X)

Transforms and applies the Scaler model to the input matrix.

transform_sql(X)

Transforms and returns the SQL needed to deploy the Scaler.

Attributes

object_type

Must be overridden in child class