Advanced User Guide¶
This guide is for developers and scientists who need to leverage the full power of NLSQ: custom optimization pipelines, protocol-based design, orchestration components, and library extension.
Advanced Tutorials
Design custom workflows using NLSQ’s API layer.
Architecture
Package structure and optimization pipeline.
API Levels¶
NLSQ provides multiple API levels for different needs:
# High Level: fit() function
from nlsq import fit
popt, pcov = fit(model, x, y, p0=[...])
# Mid Level: CurveFit class
from nlsq import CurveFit
fitter = CurveFit()
popt, pcov = fitter.curve_fit(model, x, y, p0=[...])
# Low Level: LeastSquares class
from nlsq.core.least_squares import LeastSquares
optimizer = LeastSquares()
result = optimizer.least_squares(fun=residuals, x0=p0)
# Orchestration: Decomposed components (v0.6.4)
from nlsq.core.orchestration import DataPreprocessor, OptimizationSelector
preprocessor = DataPreprocessor()
preprocessed = preprocessor.preprocess(f=model, xdata=x, ydata=y)
Advanced Tutorials
Factories & DI
Performance & Scale
- 6. Performance Optimization
- Large Dataset Tutorial
- Learning Objectives
- Introduction to Large Dataset Challenges
- Automatic Large Dataset Detection
- Manual Configuration with LargeDatasetFitter
- Adaptive Hybrid Streaming for Unlimited Datasets
- Sparse Jacobian Optimization
- Adaptive Hybrid Streaming for Unlimited Data
- Performance Comparison
- Best Practices for Large Datasets
- Troubleshooting Large Dataset Issues
- Interactive Notebooks
- Next Steps
- Further Reading
- Performance Optimization Guide
- Quick Performance Wins
- GPU/TPU Acceleration
- JIT Compilation Optimization
- Batch Processing
- Memory Optimization
- Algorithm and Solver Selection
- Profiling and Benchmarking
- Performance Troubleshooting
- Performance Checklist
- Performance Optimization Flowchart
- Jacobian Automatic Differentiation Configuration
- Related Documentation
- Interactive Notebooks
- Benchmarking Results
- How to Use Streaming Checkpoints
- Large Dataset API Reference
Stability & Extension
Conceptual Deep Dives