Skip to content

Power fitting objective models

pyvoro2.powerfit.model

Objective models for inverse fitting of power weights.

The inverse-fit API is intentionally generic: downstream code specifies which pairs matter, which periodic image is used for each pair, and which scalar separator target should be matched. This module defines the objective pieces used to fit power weights from those constraints.

ExponentialBoundaryPenalty dataclass

Bases: ScalarPenalty

Repulsive penalty near the boundaries of an interval.

The penalty is based on exponentials measured from an inner interval [lower + margin, upper - margin].

FitModel dataclass

Complete objective definition for inverse power-weight fitting.

The objective consists of
  • one required mismatch term,
  • an optional hard feasibility set,
  • zero or more extra penalties,
  • optional L2 regularization on the weights.

FixedValue dataclass

Bases: HardConstraint

Hard equality restriction in the chosen measurement space.

HardConstraint

Base class for hard feasibility restrictions.

HuberLoss dataclass

Bases: ScalarMismatch

Huber mismatch penalty in the chosen measurement space.

The penalty is quadratic near zero and linear for large residuals.

Interval dataclass

Bases: HardConstraint

Hard interval restriction in the chosen measurement space.

L2Regularization dataclass

Optional L2 regularization on the weight vector.

ReciprocalBoundaryPenalty dataclass

Bases: ScalarPenalty

Reciprocal repulsion near interval boundaries.

This penalty is intended to be used together with a hard interval or a strong outside penalty. It penalizes separator positions that enter the boundary layers [lower, lower + margin] and [upper - margin, upper].

ScalarMismatch

Base class for mismatch terms applied to predicted separator positions.

ScalarPenalty

Base class for additional scalar penalties.

SoftIntervalPenalty dataclass

Bases: ScalarPenalty

Quadratic penalty for leaving a preferred interval.

The penalty is zero within [lower, upper] and quadratic outside.

SquaredLoss dataclass

Bases: ScalarMismatch

Quadratic mismatch penalty: (predicted - target)^2.

:::