Frame Scaling

Note that scaling will break .save unless the data is denormalized manually!

Normalize

Normalize everything on the last axis using sklearn.preprocessing.normalize.

Min Max Scaling

Scales everything on the last axis using sklearn.preprocessing.minmax_scale.

Custom Scaling

In case you have a custom scaler, you can scale it by passing the scale Callable as an argument

from sklearn.preprocessing import robust_scale

f = Frame2D.from_image("../rsc/imgs/test_kmeans/test_chestnut.png", scale=SCALE)
fc = f.get_all_chns()
fcs = fc.scale(robust_scale)

Module Info

class frmodel.base.D2.frame._frame_scaling._Frame2DScaling

Bases: abc.ABC

scale_values(from_min=None, from_max=None, to_min=0, to_max=255)Frame2D

Linearly Scales data to another range. Modifies itself.

Parameters
  • from_min – The minimum, if none, data minimum will be used

  • from_max – The maximum, if none, data maximum will be used

  • to_min – The minimum to scale to (default 0)

  • to_max – The maximum to scale to (default 255)

Returns

self, the data will be modified internally regardless

scale_values_independent(from_min=None, from_max=None, to_min=0, to_max=255)Frame2D

Min Max Scales each channel to another range

Parameters
  • from_min – The minimum of each channel, if none, data minimum will be used

  • from_max – The maximum of each channel, if none, data maximum will be used

  • to_min – The minimum to scale to (default 0)

  • to_max – The maximum to scale to (default 255)

Returns

self, the data will be modified internally regardless