Python computations in science and engineering (pycse) - helps with scientific computing tasks including nonlinear regression, uncertainty quantification, design of experiments (DOE), Latin hypercube sampling, surface response modeling, and neural network-based UQ with DPOSE. Use when working with numerical optimization, data fitting, experimental design, or uncertainty analysis.
pycse is a comprehensive library for scientific computing, data analysis, and uncertainty quantification in Python.
nlinfit: Nonlinear least squares fitting with uncertainty quantificationregress: Linear regression with statisticsUse this skill when the user asks about:
from pycse import nlinfit
# Fit data to a model with uncertainty quantification
pars, pint, se = nlinfit(model_func, x0, x, y)
from pycse.sklearn.lhc import LatinSquare
# Create a Latin hypercube design
factors = {'Temperature': [20, 40, 60], 'Pressure': [1, 2, 3]}
ls = LatinSquare(factors)
design = ls.design()
from pycse.sklearn.surface_response import SurfaceResponse
# Design and fit a surface response model
sr = SurfaceResponse(
inputs=['red', 'green', 'blue'],
outputs=['intensity'],
bounds=[[0, 1], [0, 1], [0, 1]]
)
design = sr.design()
# ... run experiments ...
sr.set_output(results)
sr.fit()
from pycse.sklearn.dpose import DPOSE
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
# Create DPOSE model with uncertainty estimates
model = Pipeline([
('scaler', StandardScaler()),
('dpose', DPOSE(
layers=(n_features, 50, 32), # (input, hidden, ensemble)
loss_type='crps', # CRPS loss (recommended)
activation='tanh', # Smooth activation
maxiter=500
))
])
model.fit(X_train, y_train)
# Get predictions with uncertainty
y_pred, y_std = model.named_steps['dpose'].predict(
X_test_scaled,
return_std=True
)
pycse provides an MCP server for Claude Desktop with tools for:
To install the MCP server:
pycse mcp install
pycse includes a CLI for launching Jupyter Lab in a Docker container:
pycse launch # Launch Jupyter Lab
pycse pull # Update Docker image
pycse rm # Remove stuck container
For detailed documentation, see the pycse repository at: https://github.com/jkitchin/pycse
predict_ensemble() to get all ensemble membersnlinfit with initial parameter guesses