Skip to content

v2.13.0

Latest

Choose a tag to compare

@jkitchin jkitchin released this 24 Oct 19:28

New

  • pycse.sklearn.mip: export trained piecewise-linear models as mixed-integer linear
    constraints in Pyomo, to use them as surrogates inside an optimization problem.
    to_pyomo(input_bounds=..., block=..., inputs=...) is available on DPOSE,
    LLPRRegressor, NNBR, JAXICNNRegressor and JAXMonotonicRegressor (with the ReLU
    activation), KAN and KANLLPR (with spline_order=1, base_activation="linear"),
    LeafModelRegressor (with a linear leaf model) and LinearRegressionUQ. Models with
    uncertainty also export the predictive variance as a second-order cone, so mean + k * std
    can be optimized with a MISOCP solver. to_pyomo(formulation="convex") exports an
    input-convex network (ICNN, or JAXMonotonicRegressor(convexity="convex")) as an LP
    without binaries, for minimization. Install with pip install "pycse[mip]".
    • include_std=True adds block.std as a second-order cone (exact when the objective
      penalizes the std, e.g. robust design); include_std="exact" makes it an equality for
      objectives that reward it (e.g. exploration).
    • JAXPeriodicRegressor(activation="relu") exports approximately: its sin/cos features
      are interpolated (to_pyomo(points_per_period=...)), with a bound on the error
      (mip_network().max_feature_error(bounds)).
    • SISSO and SISSOEnsemble export their equations as exact nonlinear Pyomo
      expressions, for a global MINLP solver.
    • LeafModelRegressor.to_pyomo(split_gap=...) keeps points on a split in the left leaf.
    • A new page in the documentation, "Optimizing over machine-learned models with MIP",
      walks through all of these.
  • KfoldNN(activation=...) chooses the hidden activation ("swish", the default,
    "relu" or "tanh").
  • LLPRRegressor has new options: calibration ("auto", "holdout" or "cv") with cv
    folds, standardize, warm_start for refitting in an active learning loop, and verbose.
    ReLU and tanh networks export the mean prediction with get_dense_layers(), to_onnx()
    and to_omlt() (these need onnx and omlt, which are not installed by any extra).

Changed

  • LLPRRegressor gives different results with the same code:

    • It standardizes X and y internally (standardize=True); predictions, uncertainties and
      alpha_squared_ are in the original units of y.
    • The last-layer features include a constant, so the output bias contributes to the
      uncertainty and the std is never zero (before, a point where every last-layer ReLU was
      off got σ = 0).
    • With fewer than 100 samples, calibration="auto" calibrates on K-fold out-of-fold
      residuals and trains the final model on all the data, so a fit trains cv + 1 networks.
      α² is the NLL-optimal value in closed form, and ζ² is searched relative to
      trace(FᵀF) / n_features.
    • The last partial batch is used, so datasets smaller than batch_size train.
    • It no longer prints during fit() unless verbose=True.
    • The predictive variance is no longer recompiled on every call, so predict() is faster.
  • Dependency updates in uv.lock: certifi, filelock, mcp, nbconvert, pillow 13 and
    setuptools.

  • KAN.to_pyomo() uses the shared MIP module. The exported model is exact outside the spline
    grid (the grid clipping was not represented before), needs one set of segment binaries per
    input instead of per edge, and supports n_ensemble > 1 (the ensemble mean, with its std).
    Without input_bounds, the inputs are bounded by the range the spline grid covers in data
    units instead of by grid_range itself.