LogoLogo
GitHubSlackDataCebo
  • RDT: Reversible Data Transforms
  • Getting Started
    • Installation
    • Quickstart
  • Usage
    • Basic Concepts
    • HyperTransformer
      • Preparation
      • Configuration
      • Transformation
  • Transformers Glossary
    • Numerical
      • ClusterBasedNormalizer
      • FloatFormatter
      • GaussianNormalizer
      • LogScaler
      • LogitScaler
      • * OutlierEncoder
      • ❖ DPECDFNormalizer
      • ❖ DPLaplaceNoiser
      • ❖ ECDFNormalizer
      • ❖ XGaussianNormalizer
    • Categorical
      • LabelEncoder
      • OrderedLabelEncoder
      • FrequencyEncoder
      • OneHotEncoder
      • OrderedUniformEncoder
      • UniformEncoder
      • BinaryEncoder
      • ❖ DPDiscreteECDFNormalizer
      • ❖ DPResponseRandomizer
      • ❖ DPWeightedResponseRandomizer
    • Datetime
      • OptimizedTimestampEncoder
      • UnixTimestampEncoder
      • ❖ DPTimestampLaplaceNoiser
    • ID
      • AnonymizedFaker
      • IndexGenerator
      • RegexGenerator
      • Treat IDs as categorical labels
    • Generic PII Anonymization
      • AnonymizedFaker
      • PseudoAnonymizedFaker
    • * Deep Data Understanding
      • * Address
        • * RandomLocationGenerator
        • * RegionalAnonymizer
      • * Email
        • * DomainBasedAnonymizer
        • * DomainBasedMapper
        • * DomainExtractor
      • * GPS Coordinates
        • * RandomLocationGenerator
        • * GPSNoiser
        • * MetroAreaAnonymizer
      • * Phone Number
        • * AnonymizedGeoExtractor
        • * NewNumberMapper
        • * GeoExtractor
  • Resources
    • Use Cases
      • Contextual Anonymization
      • Differential Privacy
      • Statistical Preprocessing
    • For Businesses
    • For Developers
Powered by GitBook
On this page
  • Parameters
  • FAQ
  1. Transformers Glossary
  2. Numerical

LogScaler

PreviousGaussianNormalizerNextLogitScaler

Last updated 24 days ago

Compatibility: numerical data

The LogScaler performs a statistical transformation on numerical data. It computes the logarithm to convert the scale and shape of the data. You can optionally choose the 0-value for the log transformation and invert it. This effectively enforces a singular boundary on the data (minimum or maximum value).

from rdt.transformers.numerical import LogScaler

transformer = LogScaler(constant=10.0, invert=False)

Parameters

missing_value_replacement: Add this argument to replace missing values during the transform phase

(default) 'mean'

Replace all missing values with the average value.

'random'

Replace missing values with a random value. The value is chosen uniformly at random from the min/max range.

'mode'

Replace all missing values with the most frequently occurring value

<number>

Replace all missing values with the specified number (0, -1, 0.5, etc.)

None

Do not replace missing values. The transformed data will continue to have missing values.

missing_value_generation: Add this argument to determine how to recreate missing values during the reverse transform phase

(default) 'random'

Randomly assign missing values in roughly the same proportion as the original data.

'from_column'

Create a new column to store whether the value should be missing. Use it to recreate missing values. Note: Adding extra columns uses more memory and increases the RDT processing time.

None

Do not recreate missing values.

constant: The constant to set as the 0-value for the log-based transform.

(default) 0

Do not modify the 0-value of the data

<float>

A floating point value that acts as the 0-value offset for your data. The log of anything less than this value is undefined so this effectively acts as a boundary for your data.

invert: Whether to invert the data (about the constant) when performing the log-based transform

(default) False

Do not invert any values. This means that the constant value will effectively be the minimum value for your data. The log transform is only valid for anything that is greater than the constant.

True

Invert the values. This means that the constant value will effectively be the maximum value for your data. The log transform is only valid for anything that is less than the constant.

learn_rounding_scheme: Add this argument to allow the transformer to learn about rounded values in your dataset.

(default) False

Do not learn or enforce any rounding scheme. When reverse transforming the data, there may be many decimal places present.

True

Learn the rounding rules from the input data. When reverse transforming the data, round the number of digits to match the original.

FAQ

How do I enforce min/max values with this transformer?

This transformer enforces a strict minimum or maximum boundary on your data using the constant and invert parameters. Use the constant parameter to sent the boundary and the invert parameter to determine whether it's the min (False) or max (True).

If you'd like the minimum or maximum value to be allowed, we suggest setting the boundary to something slightly outside the range that you need.

from rdt.transformers.numerical import LogScaler

transformer = LogScaler(
  constant=10.0 - 1e-10, # allow a value of exactly 10
  invert=False)

If you'd like to enforce both a minimum and a maximum value, please use the instead.

LogitScaler