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

SMTorg / smt / 43230585075
93%

Build:
DEFAULT BRANCH: master
Ran 12 Nov 2026 02:10PM 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 01:46PM UTC coverage: 91.567% (+0.002%) from 91.565%
43230585075

push

github

web-flow
Fixes #832 (reported by @vincentdrouet) (#854)

### Linked Issue
Fixes #832 (reported by @vincentdrouet)

---

## 1. Context & Motivation

In issue #832, @vincentdrouet reported a systematic sampling imbalance
when sampling `OrdinalVariable` (and non-continuous variables in
general). Specifically, the boundary levels (the lowest and highest
discrete levels) were under-represented by approximately a factor of 2
compared to the interior levels.

### Scientific Root Cause
When continuous DOEs (e.g., Latin Hypercube Sampling or uniform random
sampling) draw points $u \in [0, K]$ for a variable with integer limits
$\{0, 1, \dots, K\}$, discretization was performed in
`BaseDesignSpace.correct_get_acting()` using a nearest-integer round:
```python
x[:, indi] = np.int64(np.round(x[:, indi], 0))
```
Geometrically, this partitions the continuous domain $[0, K]$ into cells
/ bins:
* **Lower boundary ($0$):** $[0, 0.5)$ $\rightarrow$ bin width =
**$0.5$**
* **Interior levels ($i \in \{1, \dots, K-1\}$):** $[i - 0.5, i + 0.5)$
$\rightarrow$ bin width = **$1.0$**
* **Upper boundary ($K$):** $[K - 0.5, K]$ $\rightarrow$ bin width =
**$0.5$**

Because the probability measure of a uniform distribution is
proportional to bin width, boundary levels had half the probability of
being selected:
$$\mathbb{P}(X = 0) = \mathbb{P}(X = K) = \frac{1}{2K}, \quad
\mathbb{P}(X = i) = \frac{1}{K} \quad (0 < i < K)$$

For example, with $K=3$ (4 levels: low, medium, high, very high), the
theoretical probability distribution was:

$$
\{0: 16.7\\%,\\; 1: 33.3\\%,\\; 2: 33.3\\%,\\; 3: 16.7\\%\}
$$

instead of the expected uniform $25\\%$ per level.

---

## 2. Summary of Changes

### 1. Equal-Measure Discretization (`smt/design_space/design_space.py`)
Replaced naive `np.round()` in `BaseDesignSpace.correct_get_acting()`
with `self._round_equally_distributed()`:
```python
# Before:
x[:, indi] = np.int64(np.round(x[:, indi], 0))

# After:
x[:, indi] = self._round_equally_distributed(x[:, i... (continued)

3 of 4 new or added lines in 1 file covered. (75.0%)

8784 of 9593 relevant lines covered (91.57%)

0.92 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
86.28
0.07% smt/design_space/design_space.py
Jobs
ID Job ID Ran Files Coverage
1 Test - 43230585075.1 12 Nov 2026 02:10PM UTC 85
91.57
Source Files on build 43230585075
  • Tree
  • List 85
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 10fbb14b on github
  • Prev Build on master (#41676368755)
  • Next Build on master (#43242863578)
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