• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SMTorg / smt / 43302113856
93%

Build:
DEFAULT BRANCH: master
Ran 12 Nov 2026 09:30PM UTC
Jobs 1
Files 85
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Nov 2026 08:37PM UTC coverage: 92.153% (+0.05%) from 92.102%
43302113856

push

github

web-flow
feat: add general support for JAX arrays and array-like inputs (fixes #827) (#847)

## Summary

Resolves #827 by providing native, first-class support for `jax.Array`
and any object implementing the NumPy array protocol
(`__array__` or `__array_interface__`) across SMT training, prediction,
derivatives, and sampling workflows, without making
JAX a mandatory dependency.

## Key Changes

**Universal Array-Like Support**:
- `ensure_2d_array()` in `smt/utils/checks.py` converts array-like
objects (e.g. `jax.Array`) to contiguous 2D NumPy arrays
for read-only evaluation.
- Exposed `is_arraylike()` utility in `smt/utils/checks.py`.

**JAX Tracer Protection**:
- Intercepts JAX symbolic Tracers inside `ensure_2d_array()` and
`is_arraylike()` when called inside `jax.jit` or
`jax.grad`.
- Raises an informative `TypeError` with guidance to use
`sm.get_jax_predictor()` instead of silently failing or raising
obscure NumPy internal errors.

**OptionsDictionary Safety**:
- Relaxed type checking across `OptionsDictionary` to accept general
array-like objects wherever `np.ndarray` was expected.
- Hardened `_in_values` against multi-element array comparisons to
prevent `"The truth value of an array with more than one
element is ambiguous"`.

**Defensive Copying**:
- Added defensive copying in `SurrogateModel._pre_predict()` so models
cannot mutate input arrays in-place.

**Base Surrogate Model Architecture**:
- Declared `supports["jax"] = False` capability flag by default.
- Declared standard `use_jax` option in `SurrogateModel`.
- Defined base `get_jax_predictor()` method raising a descriptive
`NotImplementedError` for surrogates without native JAX
predictor implementations.

**Multi-Fidelity Kriging (MFK) Compatibility**:
- Fixed index comparison in `MFK._check_list_structure` (`i > 0` instead
of array truth-value check).

**Dependencies & CI**:
- Added optional extra `jax = ["jax>=0.4.30"]` in `pyproject.toml` and
`requirements.txt`.

**Unit Tests**:
- Comprehensive... (continued)

245 of 259 new or added lines in 7 files covered. (94.59%)

1 existing line in 1 file now uncovered.

9207 of 9991 relevant lines covered (92.15%)

0.92 hits per line

Uncovered Changes

Lines Coverage ∆ File
5
91.07
-3.93% smt/utils/checks.py
4
98.06
-0.64% smt/utils/test/test_misc_utils.py
3
91.33
-1.48% smt/surrogate_models/surrogate_model.py
2
96.23
-3.77% smt/utils/options_dictionary.py

Coverage Regressions

Lines Coverage ∆ File
1
95.35
-2.33% smt/applications/mfkplsk.py
Jobs
ID Job ID Ran Files Coverage
1 Test - 43302113856.1 12 Nov 2026 09:31PM UTC 85
92.15
Source Files on build 43302113856
  • Tree
  • List 85
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • dde28bd2 on github
  • Prev Build on master (#43242863578)
  • Next Build on master (#43574273032)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc