log – Natural logarithm: ln(y).#

Back to op axis | Back to L3 | Browse all options

Operational op under axis op, sub-layer L3_A_step_op, layer l3. Standalone callable: mf.functions.log_transform.

Function signature#

mf.functions.log_transform(
    panel: pd.DataFrame,
) -> pd.DataFrame

Parameters#

name

type

default

constraint

description

panel

pd.DataFrame

Input panel. Each column is a variable; rows are time periods. Series is promoted to a single-column DataFrame internally.

Returns#

pd.DataFrame — scalar result.

Behavior#

Element-wise natural log. Strictly positive series only; raises if any input is non-positive. Often paired with diff to produce log-changes (which are approximately equal to percentage changes for small movements).

When to use

Strictly-positive macro series (price levels, employment counts, GDP) before differencing.

When NOT to use

Series that can be negative or zero (rates, growth rates, balances).

In recipe context#

Set params.op = "log" in the relevant layer to activate this op within a recipe:

# Layer L3 recipe fragment
params:
  op: log

References#

  • macroforecast design Part 2, L3: ‘feature engineering is a DAG of typed transforms; cascade-depth bounds the longest chain at cascade_max_depth.’