Numeric Transformers
Transform and mask numeric values
Numeric Transformers
Transform numeric values while preserving statistical properties or adding privacy protection.
add_noise_percentage
Add random noise as a percentage of the original value.
Category: Numeric
Type: Transformer
Data Types: integer, decimal, float
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
noise_percent | float | 10 | Percentage of noise (±%) |
Examples
10% noise (default):
columns:
- name: salary
function: add_noise_percentage
Small noise (5%):
columns:
- name: price
function: add_noise_percentage
parameters:
noise_percent: 5
Large noise (25%):
columns:
- name: revenue
function: add_noise_percentage
parameters:
noise_percent: 25
Behavior
- Input:
100 - With
noise_percent: 10 - Output: Random value between
90and110
Use Cases
- Protect exact financial figures
- Maintain statistical distributions
- Allow trend analysis while obscuring specifics
round_to_range
Round numbers to ranges for privacy.
Category: Numeric
Type: Transformer
Data Types: integer, decimal, float, string
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
range_size | float | 10 | Size of range buckets |
Examples
Age ranges (10-year buckets):
columns:
- name: age
function: round_to_range
parameters:
range_size: 10
Salary bands ($10,000):
columns:
- name: salary
function: round_to_range
parameters:
range_size: 10000
Behavior
-
Input:
47 -
With
range_size: 10 -
Output:
"40-50" -
Input:
85000 -
With
range_size: 10000 -
Output:
"80000-90000"
Use Cases
- Age bracketing for analysis
- Salary band reporting
- Privacy-preserving analytics
Comparison
| Function | Output Type | Preserves | Use Case |
|---|---|---|---|
add_noise_percentage | Number | Statistical distribution | Financial analysis |
round_to_range | String (range) | General magnitude | Demographic data |
Common Patterns
Financial Data
columns:
- name: account_balance
function: add_noise_percentage
parameters:
noise_percent: 5
- name: transaction_amount
function: add_noise_percentage
parameters:
noise_percent: 10
Demographics
columns:
- name: age
function: round_to_range
parameters:
range_size: 5 # 5-year age groups
- name: income
function: round_to_range
parameters:
range_size: 25000 # Income brackets
Healthcare
columns:
- name: weight_kg
function: add_noise_percentage
parameters:
noise_percent: 3
- name: height_cm
function: add_noise_percentage
parameters:
noise_percent: 2
Tips
Choosing Noise Level
| Data Type | Suggested Noise |
|---|---|
| Precise measurements | 2-5% |
| Financial amounts | 5-15% |
| Sensitive personal data | 15-25% |
Preserving Aggregates
Low noise percentages (3-5%) maintain aggregate statistics while obscuring individual values.
Range Size Selection
- Age: 5 or 10 years
- Salary: $10,000 or $25,000
- Revenue: Based on business scale
Related Functions
- Number Generators - Generate new numbers
- Date Transformers - Transform dates
- Masking Functions - General masking