diff --git a/CHANGELOG.md b/CHANGELOG.md index e6879ec6a..380106e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 1.1.1 (2026-11-21) +## 1.1.1 (2026-11-22) A patch release: three fixes for noise and side effects met when `hyp.plot` draws into a figure the caller built, found by executing notebooks with @@ -75,12 +75,31 @@ draws into a figure the caller built, found by executing notebooks with same glyphs are still reached through 'Hiragino Sans'); a font named with `font=`, and a font found to be the only one covering the text, are kept regardless. - - **A Yahoo Finance rate limit is reported as one.** When Yahoo throttles an address it answers HTTP 429 with a plain-text body, which `hyp.load('yahoo:')` reported as "returned a non-JSON response (HTTP 429) ... JSONDecodeError". The error now says that Yahoo is rate-limiting the address and to try again later. +- **A seeded UMAP no longer warns about `n_jobs`.** umap-learn runs + single-threaded whenever it is seeded and says so with "n_jobs value 1 + overridden to 1 by setting random_state". hypertools already kept that + warning away for the top-level `random_state=`; a seed passed in the + `reduce` dict (`reduce={'model': 'UMAP', 'kwargs': {'random_state': + 0}}`, as several gallery examples do) still drew it. Both forms are now + quiet and give the same embedding. A call that sets `n_jobs` itself + still gets umap's warning. + +### Documentation + +- **Two gallery examples are now seeded.** The k-means panel of + `plot_colorbar.py` and the UMAP panel of `plot_digits.py` came out + different on every docs build (cluster colors permuted; a different UMAP + layout). Both now pass `random_state=0`, so every gallery figure that + does not read live data is the same from build to build. +- **`plot_shapes_zoo.py`: no stray axis labels.** The biplane is the one + shape that loads as a DataFrame (columns `x`, `y`, `z`), so its panel + alone carried axis labels, one of them out in the grid's empty cell. The + example now passes empty labels. ### Documented limitations diff --git a/docs/prebuilt_gallery.json b/docs/prebuilt_gallery.json index 5e9b85333..ac65d5ae4 100644 --- a/docs/prebuilt_gallery.json +++ b/docs/prebuilt_gallery.json @@ -1,5 +1,5 @@ { - "commit": "c90dd87e32e545ad17d12f2568993fbd0fc55f24", - "source_commit": "514a12cb72269baca147a12d8c4cd8a783e4dd54", + "commit": "598c4d87cd56c0e02d45b7282716381458673ab9", + "source_commit": "12e98347ace2fedd241a1d1623799eeee03ae648", "version": "1.1.1" } diff --git a/examples/plot_colorbar.py b/examples/plot_colorbar.py index e87ffd770..80cee79c5 100644 --- a/examples/plot_colorbar.py +++ b/examples/plot_colorbar.py @@ -30,6 +30,8 @@ # Discrete groups (here, k-means clusters) get a segmented colorbar with # one tick/block per group instead of a continuous gradient. A dict lets # you set a label or move the colorbar to another side of the figure. +# (k-means starts from random centers; ``random_state`` keeps the cluster +# numbering, and so the colors, the same from run to run.) -hyp.plot(data, '.', n_clusters=4, +hyp.plot(data, '.', n_clusters=4, random_state=0, colorbar={'label': 'cluster', 'location': 'right'}) diff --git a/examples/plot_digits.py b/examples/plot_digits.py index b34ceaa82..e29f6585f 100644 --- a/examples/plot_digits.py +++ b/examples/plot_digits.py @@ -38,4 +38,7 @@ # %% # ... and with UMAP, which is faster and keeps more of the global layout. -hyp.plot(data, '.', reduce='UMAP', hue=hue, ndims=2, legend=True) +# UMAP's layout is random unless it is seeded; ``random_state`` makes the +# figure the same on every run. +hyp.plot(data, '.', reduce='UMAP', random_state=0, hue=hue, ndims=2, + legend=True) diff --git a/examples/plot_shapes_zoo.py b/examples/plot_shapes_zoo.py index e63c241fb..8d060b2ba 100644 --- a/examples/plot_shapes_zoo.py +++ b/examples/plot_shapes_zoo.py @@ -25,6 +25,10 @@ # fits each panel's own reduction separately, exactly as the equivalent # per-panel hyp.plot(shape, ax=ax) loop did, since these clouds differ # enough in scale that one shared fit would be dominated by the largest. +# The biplane loads as a DataFrame with columns x, y and z, which hypertools +# would write beside that one panel as axis labels; the empty labels keep +# all seven panels alike. hyp.plot([hyp.load(shape) for shape in shapes], ',', color='k', panels=(2, 4), panel_fit='independent', - title=[shape.capitalize() for shape in shapes], size=(12, 6)) + title=[shape.capitalize() for shape in shapes], size=(12, 6), + xlabel='', ylabel='', zlabel='') diff --git a/hypertools/reduce/reduce.py b/hypertools/reduce/reduce.py index 09d735504..df4af78e7 100644 --- a/hypertools/reduce/reduce.py +++ b/hypertools/reduce/reduce.py @@ -328,6 +328,17 @@ def reduce(x, reduce='IncrementalPCA', ndims=None, return_model=False, and inspect.isclass(c_model) and 'random_state' in inspect.signature(c_model).parameters): c_kwargs['random_state'] = random_state + # a seeded UMAP runs single-threaded and warns "n_jobs value + # ... overridden to 1"; whoever set the seed (the user in + # 'kwargs', or the top-level random_state just injected) did + # not choose n_jobs, so pass the value umap will use anyway + # (see the same step for the bare-name form below) + if (inspect.isclass(c_model) + and getattr(c_model, '__name__', '') == 'UMAP' + and c_kwargs.get('random_state') is not None + and 'n_jobs' not in c_kwargs and len(c_args) == 0 + and 'n_jobs' in inspect.signature(c_model).parameters): + c_kwargs['n_jobs'] = 1 # construct immediately; the resulting instance flows through # the same already-constructed-instance handling below as a # bare instance passed directly as `reduce=`. An ALREADY- @@ -484,14 +495,19 @@ def reduce(x, reduce='IncrementalPCA', ndims=None, return_model=False, and 'random_state' not in model_params and 'random_state' in inspect.signature(model).parameters): model_params['random_state'] = random_state - # umap-learn forces n_jobs=1 whenever a random_state is set and - # warns that it did ("n_jobs value -1 overridden to 1 ..."), which - # would blame the user for a seed hypertools injected. Pass the - # n_jobs umap is going to use anyway, unless the user chose one. - if (getattr(model, '__name__', '') == 'UMAP' - and 'n_jobs' not in model_params - and 'n_jobs' in inspect.signature(model).parameters): - model_params['n_jobs'] = 1 + + # umap-learn forces n_jobs=1 whenever a random_state is set and warns + # that it did ("n_jobs value -1 overridden to 1 ..."). The user asked + # for a seed (top-level `random_state=`, or in the `reduce` dict's + # kwargs), not for a number of jobs, so the warning tells them nothing + # they chose: pass the n_jobs umap is going to use anyway. A user who + # set n_jobs themselves still gets umap's warning about it. + if (not model_is_instance + and getattr(model, '__name__', '') == 'UMAP' + and model_params.get('random_state') is not None + and 'n_jobs' not in model_params + and 'n_jobs' in inspect.signature(model).parameters): + model_params['n_jobs'] = 1 # sklearn TSNE's default perplexity (30) requires n_samples > 30, so # small datasets crashed on a parameter the user never set diff --git a/notes/release_notes_v1.1.1_draft.md b/notes/release_notes_v1.1.1_draft.md new file mode 100644 index 000000000..24897412d --- /dev/null +++ b/notes/release_notes_v1.1.1_draft.md @@ -0,0 +1,42 @@ +# HyperTools 1.1.1 + +A patch release with no API changes. It fixes noise and side effects met when `hyp.plot` draws into a figure the caller built (`ax=`), found by executing notebooks with `jupyter nbconvert` under matplotlib 3.11, and one misleading error message from the Yahoo Finance loader. + +Every change is listed in the [changelog](https://github.com/ContextLab/hypertools/blob/v1.1.1/CHANGELOG.md); these notes summarize it. + +## Install + +```bash +pip install --upgrade hypertools +``` + +Python 3.10 through 3.13. Extras are unchanged from 1.1.0. + +## Fixed + +- **The backend warning is issued once, and only when it applies ([#290](https://github.com/ContextLab/hypertools/issues/290)).** When hypertools cannot set up an interactive matplotlib backend at import (for example in a notebook kernel without `ipympl`), `hyp.plot` repeated the warning on every call, including static plots and calls that show no live figure. It is now issued only by a call that displays an animated or interactive plot that matplotlib renders, and once per session per message. +- **`hyp.plot(..., ax=ax)` leaves the layout of the caller's figure alone ([#291](https://github.com/ContextLab/hypertools/issues/291)).** Static plots ended with `plt.tight_layout()` even when the caller passed its own axes, which moved every axes of the figure, discarded `subplots_adjust` margins, replaced a `layout='constrained'` engine, and acted on pyplot's current figure rather than the one that owns `ax`. A figure the caller built is now left as the caller arranged it. Figures hypertools makes itself (its own figure, a `panels=` grid, a `hyp.subplots` grid) are laid out as before. +- **A legend or title added to the caller's axes is fitted automatically, inside that axes' own room.** Through 1.1.0 a `legend=` beside a caller's axes was fitted by widening the caller's figure, which stretched its other axes and switched off its layout engine. Now, when the figure is drawn, only the axes passed as `ax=` is narrowed just far enough that its legend ends before the canvas edge or the next panel, and lowered just far enough that its title stays on the canvas. No call is needed, and the fit follows a later `fig.tight_layout()`, `fig.subplots_adjust(...)`, resize or save. A legend with no room beside the axes is drawn inside it; one too large for its panel either way is left in place with a `UserWarning` naming the remedies. +- **No `findfont` log lines for ordinary text under matplotlib 3.11 ([#292](https://github.com/ContextLab/hypertools/issues/292)).** matplotlib 3.11 logs a line each time a family in the font list has no face at a text's exact weight; one of the fallback families hypertools listed has no regular face on macOS, so every figure logged the line several times. Fallback families with no regular-weight face are now left out of the list. +- **A Yahoo Finance rate limit is reported as one.** `hyp.load('yahoo:')` reported an HTTP 429 from Yahoo as a JSON decoding failure. The error now says that Yahoo is rate-limiting the address and to try again later. +- **A seeded UMAP no longer warns about `n_jobs`.** A seed passed in the `reduce` dict (`reduce={'model': 'UMAP', 'kwargs': {'random_state': 0}}`) drew umap-learn's "n_jobs value 1 overridden to 1" warning; it is now quiet, like the top-level `random_state=`. + +## Documentation + +- Two gallery examples (`plot_colorbar.py`, `plot_digits.py`) are now seeded, so their figures are the same on every docs build, and `plot_shapes_zoo.py` no longer shows stray axis labels beside one panel. + +## Upgrading from 1.1.0 + +- **If you relied on the automatic `tight_layout`** of a figure made with `plt.subplots`, call `fig.tight_layout()` after plotting, create the figure with `layout='constrained'`, or build the grid with `hyp.subplots`. +- On an axes whose legend or title was fitted, `ax.get_position()` reports the position of the last draw (the fit is an axes locator, recomputed on each draw). + +## Known limitations + +- The automatic fit does not detect an inset or other axes placed by hand where the legend goes, or a legend over the tick labels of its own axes' twin. +- Bold or other non-regular text can still log `findfont` lines under matplotlib 3.11 when an installed fallback family ships a regular face only; see "Documented limitations" in the changelog. + +## Links + +- Documentation: https://hypertools.readthedocs.io/en/stable/ +- Changelog: https://github.com/ContextLab/hypertools/blob/v1.1.1/CHANGELOG.md +- PyPI: https://pypi.org/project/hypertools/1.1.1/ diff --git a/notes/session_2026-11-21_release-1.1.1.md b/notes/session_2026-11-21_release-1.1.1.md index f52c6f9c5..05f388f62 100644 --- a/notes/session_2026-11-21_release-1.1.1.md +++ b/notes/session_2026-11-21_release-1.1.1.md @@ -305,3 +305,118 @@ pass on matplotlib 3.10.8 and 3.11.2. - Sphinx `-b html -W -E -a` with every gallery example re-executed, at 49165c09: build succeeded. - `ruff check`: all checks passed. + +## Gallery rebuild and before/after review (2026-11-21, late evening) + +Request: rebuild the gallery, review before/after for ALL figures (own review +plus an independent one, ideally Codex), and build a draft release. Working +unattended; the user is on a phone. + +- PR #294 (automatic legend/title fit) merged as e3abb840 with all CI green. +- Built the gallery in release form from e3abb840 (51 of 51 examples + executed, sphinx exit 0, 32 min). Compared it with two baselines using + a scratch script (pixel statistics on every PNG, every GIF frame, every + MP4 frame, plotly payload hashes): the published 1.1.0 gallery + (`docs-gallery-v1.1.0`, 519b4af2) and the pre-fit 1.1.1 gallery (built + from 514a12cb). +- Result: 89 figures + 51 thumbnails. 87 of 89 byte-identical to the + pre-fit build; 85 of 89 to 1.1.0. The differences: + - `plot_colorbar_002.png`: k-means unseeded, cluster colors permuted on + every build (same points). Not from the code change. + - `plot_digits_003.png`: UMAP unseeded, new layout every build. + - `animate_market_sectors_001.gif/.mp4` (vs 1.1.0 only): live Yahoo data, + one more month (ends October 31, 2026 instead of September 30, 2026). +- No gallery example puts a legend on an axes the example made itself (five + use `ax=`, with titles only, which already fit), so the fit changing no + gallery figure is expected. My earlier guess that four examples would + render differently was wrong. +- Fix: both examples now pass `random_state=0` (the library's own argument; + passing UMAP's `random_state` through the `reduce` dict works too but + prints umap's n_jobs warning). Verified: two runs each give identical + figures, no warnings with `-W error::UserWarning`. +- Release form: README images flipped to `v1.1.1` (13 URLs), tutorial + install cells already correct (migrator: 76 of 76). NOTE: the migrator + must run on the `master` branch; on any other branch it retargets the + tutorials to that branch. +- Plan: commit on local `master` (not pushed to `master`; pushed as + `release/1.1.1` so nothing on `master` changes before the user's go), + rebuild the gallery from that commit, repeat the comparison, independent + review (Codex + fresh subagent), publish the pre-built gallery (keeping + the old commit c90dd87e reachable on a `docs-gallery-v1.1.1-prev` branch + because `master`'s docs build fetches it by id), record it, publish the + notebooks, build wheel + sdist, create a DRAFT GitHub release (no tag). + Tag, PyPI and the `master` push wait for the user's go. +- Found while running the examples gate: `animate_painting_embeddings.py` + and `animate_conversation.py` seed UMAP through the `reduce` dict, which + drew umap's "n_jobs value 1 overridden to 1 by setting random_state" + warning (not shown on the docs pages, but shown to anyone running the + example). Fixed in `hypertools/reduce/reduce.py`: the dict form now passes + `n_jobs=1` when the model is seeded and the caller named no `n_jobs` + (same as the bare-name form already did). Regression test in + `tests/test_reduce_third_party_warnings.py`; changelog entry. The first + gallery build from the release commit was stopped for this and restarted. +- Own review of all 89 figures (contact sheets, 117 tiles: every still, + middle and last frame of every animation): everything matches 1.1.0 + apart from the three explained cases. One defect that 1.1.0 has too: + `plot_shapes_zoo_001.png` showed stray x/y/z axis labels beside the + Biplane panel (the biplane loads as a DataFrame, the other six shapes as + arrays; column names become axis labels by design). Example now passes + `xlabel='', ylabel='', zlabel=''`. Second gallery build stopped and + restarted for this. +- Observed, left as is (faithful rendering of raw data, same as 1.1.0): + in `plot_datasets_tour_001.png` the penguins and Kaggle-iris panels are + near-lines because one unnormalized column dominates. + +### 2026-11-22 (after midnight) + +- Independent reviews of all 117 tiles (fresh subagent; Codex CLI with the + ten contact sheets attached): no regression from 1.1.0; the three + differing figures judged harmless; both flagged the shapes-zoo labels + (fixed). Minor points they raised that are IDENTICAL in the released + 1.1.0 and were left for the user to decide: conversation clip's box + touches the left canvas edge; teapot is faint under the one-pixel + marker; two label boxes overlap in `plot_labels`; market-sectors legend + sits close to the box in the GIF thumbnail; weather clip's last marker is + half clipped at the right edge. +- Third build (from a7dfad3a, 51 of 51 executed): 136 of 140 media files + byte-identical to the reviewed e3abb840 build; the four that differ are + the three changed examples (colorbar_002, digits_003, shapes_zoo_001 and + its thumbnail). Viewed all three: correct. +- Page-text diff against 1.1.0 (versions and timings normalized) found one + environment artifact: `plot_datasets_tour` printed kagglehub's "outdated + version (installed: 1.0.2)" notice. Upgraded kagglehub in the build venv + to 1.0.3. +- The date rolled over during the build. The release gate requires the + CHANGELOG heading not to be earlier than the release commit, and the + gallery record commit would be dated 2026-11-22, so the heading is now + 2026-11-22 and the gallery is rebuilt once more from this commit (the + gate allows only the record commit after the build). +- Issue #295 (animate= with panels=, per-frame caption, +faststart) was + filed 2026-11-22 from the timecorr work. It is a feature request, not in + this build; whether it goes into 1.1.1 is the user's decision. + +### Release commit, first cut (d743ff5d) and its CI + +- Fourth build (from 46c3bb39): all 140 media files byte-identical to the + third, no kagglehub notice. Full suite on 46c3bb39: 6910 passed, 24 + skipped, 0 failed. Rehearsal: REHEARSAL PASSED (full). +- Published `docs-gallery-v1.1.1` (2cf4fd0d), recorded it (d743ff5d), + pushed as `release/1.1.1` (PR #296), published `docs-notebooks/v1.1.1/`. + All 25 release gates passed locally and in a depth-1 clone with only + pytest, nbformat and nbclient installed. Built wheel + sdist, smoke + tested, created the DRAFT GitHub release (no tag). +- The user looked at the review page + (https://claude.ai/artifact/W1YfFGsWHoKsxh3ofWgmuj): "Updated gallery + looks good; changes all go in the right direction". +- CI on d743ff5d: 14 jobs green, `test (windows-latest, 3.11)` failed in + `tests/plot/test_predict_animation.py::test_the_plotly_backend_DRAWS_the_same_case_the_same_way`: + it asserts no warnings at all, and on that runner two Kalman fits took + 0.5 s, so hypertools' own "needs 8 forecast fits ... roughly 12.8 s" + notice fired. Machine-speed dependent, nothing to do with this change. + Fix: that test and its matplotlib twin pass `slow_warning_seconds=None`, + as `tests/plot/test_forecast_schedule.py` does. +- A new commit invalidates everything pinned to d743ff5d, so the gallery is + rebuilt from the new commit and both galleries, the dist files and the + draft release's assets are redone. +- Gap in the automatic "work in flight" check: it did not see the running + `wait-for-ci.py` waiter and asked for another. diff --git a/readme.md b/readme.md index e6b110f5f..c0bea7f7c 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -![Hypertools logo](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/hypercube.png) +![Hypertools logo](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/hypercube.png) [![Tests](https://img.shields.io/github/actions/workflow/status/ContextLab/hypertools/test.yml?label=tests)](https://github.com/ContextLab/hypertools/actions/workflows/test.yml) [![Documentation Status](https://readthedocs.org/projects/hypertools/badge/?version=latest)](https://hypertools.readthedocs.io/en/latest/?badge=latest) @@ -7,7 +7,7 @@ "_To deal with hyper-planes in a 14 dimensional space, visualize a 3D space and say 'fourteen' very loudly. Everyone does it._" - Geoff Hinton -![Hypertools example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/story_trajectories.gif) +![Hypertools example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/story_trajectories.gif) ## Overview @@ -52,7 +52,7 @@ the link under a clip for the full code and the full-length animation. Six stock-market sectors, each reduced to 3-D on its own and then hyperaligned into a shared space, with a heavier path for the market as a whole. -![Market sectors example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/tour_market_sectors.gif) +![Market sectors example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/tour_market_sectors.gif) [Tutorial: market sectors](https://hypertools.readthedocs.io/en/latest/tutorials/market_sectors.html) @@ -62,7 +62,7 @@ Give `hyp.plot` a list of strings and it embeds them, projects them into 2-D or 3-D, and plots the result. Here a paragraph about each of five paintings becomes its own cloud, drawn in a color pulled from the canvas itself. -![Painting embeddings example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/tour_painting_embeddings.gif) +![Painting embeddings example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/tour_painting_embeddings.gif) [Tutorial: painting embeddings](https://hypertools.readthedocs.io/en/latest/tutorials/painting_embeddings.html) @@ -72,7 +72,7 @@ becomes its own cloud, drawn in a color pulled from the canvas itself. Tea-Party from *Alice's Adventures in Wonderland*: each segment is one turn of the conversation, colored by speaker and placed by what is being said. -![Conversation example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/tour_conversation_shape.gif) +![Conversation example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/tour_conversation_shape.gif) [Tutorial: the shape of a conversation](https://hypertools.readthedocs.io/en/latest/tutorials/conversation_shape.html) @@ -81,7 +81,7 @@ the conversation, colored by speaker and placed by what is being said. Monthly temperatures in 20 cities around the globe, from 1875 to 2013, drawn as a single path and colored by the average temperature that month. -![Weather example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/tour_weather_decades.gif) +![Weather example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/tour_weather_decades.gif) [Tutorial: weather across the decades](https://hypertools.readthedocs.io/en/latest/tutorials/weather_decades.html) @@ -97,7 +97,7 @@ shapes = [hyp.load(n) for n in names] hyp.plot(shapes, '.', color='k', animate='morph', title=names) ``` -![Morph example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/tour_morph_shapes_zoo.gif) +![Morph example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/tour_morph_shapes_zoo.gif) [Tutorial: morphing the shapes zoo](https://hypertools.readthedocs.io/en/latest/tutorials/morph_shapes_zoo.html) @@ -256,7 +256,7 @@ list_of_labels = ['A'] * 300 + ['B'] * 300 # one label per observation hyp.plot(list_of_arrays, animate=True, hue=list_of_labels) ``` -![Plot example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/plot.gif) +![Plot example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/plot.gif) ## Align @@ -275,11 +275,11 @@ hyp.plot(list_of_arrays, align='hyper') ### BEFORE -![Align before example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/align_before.gif) +![Align before example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/align_before.gif) ### AFTER -![Align after example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/align_after.gif) +![Align after example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/align_after.gif) ## Cluster @@ -299,7 +299,7 @@ array = np.vstack([rng.standard_normal((100, 3)) + offset hyp.plot(array, 'o', cluster='GaussianMixture', n_clusters=3) ``` -![Cluster Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/cluster_example.png) +![Cluster Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/cluster_example.png) ## Surfaces @@ -317,7 +317,7 @@ blob_b = rng.standard_normal((100, 3)) + [4, 0, 0] hyp.plot([blob_a, blob_b], '.', surface=True) ``` -![Surface Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/surface_example.png) +![Surface Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/surface_example.png) ## Describe @@ -332,4 +332,4 @@ list_of_arrays = [np.cumsum(rng.standard_normal((200, 20)), axis=0) hyp.describe(list_of_arrays, reduce='PCA', max_dims=14) ``` -![Describe Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.0/images/describe_example.png) +![Describe Example](https://raw.githubusercontent.com/ContextLab/hypertools/v1.1.1/images/describe_example.png) diff --git a/tests/plot/test_predict_animation.py b/tests/plot/test_predict_animation.py index c558e7f69..71fbb9f82 100644 --- a/tests/plot/test_predict_animation.py +++ b/tests/plot/test_predict_animation.py @@ -401,9 +401,12 @@ def test_hue_regrouping_now_ANIMATES_its_forecasts_like_the_static_plot(): labels = np.array(['a', 'a', 'b', 'b'] * 15) with warnings.catch_warnings(record=True) as caught: warnings.simplefilter('always') + # slow_warning_seconds=None: the "these forecast fits will take + # N s" notice depends on how fast the machine is (it fired on a + # slow Windows CI runner) and is not what this test is about fig, ani = hyp.plot(data, '-', predict='Kalman', t=3, hue=labels, animate=True, duration=2, frame_rate=4, - show=False) + show=False, slow_warning_seconds=None) assert not caught, [str(w.message) for w in caught] ax = _ax(fig) ani._func(6, *ani._args) # must not raise @@ -433,9 +436,10 @@ def test_the_plotly_backend_DRAWS_the_same_case_the_same_way(): with hyp.set_interactive_backend('plotly'): with warnings.catch_warnings(record=True) as caught: warnings.simplefilter('always') + # slow_warning_seconds=None: see the matplotlib twin above fig = hyp.plot(data, '-', predict='Kalman', t=3, hue=labels, animate=True, duration=2, frame_rate=4, - show=False) + show=False, slow_warning_seconds=None) assert not caught, [str(w.message) for w in caught] roles = [(tr.meta or {}).get('hyp_forecast_role') for tr in fig.data] assert 'live' in [r for r in roles if r is not None], roles diff --git a/tests/test_reduce_third_party_warnings.py b/tests/test_reduce_third_party_warnings.py index 8124317bd..d1d1c6c3f 100644 --- a/tests/test_reduce_third_party_warnings.py +++ b/tests/test_reduce_third_party_warnings.py @@ -23,6 +23,30 @@ def test_seeded_umap_does_not_warn_about_n_jobs(): assert not [m for m in w if 'n_jobs' in str(m.message)] +def test_umap_seeded_through_the_reduce_dict_does_not_warn_about_n_jobs(): + """A seed passed as ``reduce={'model': 'UMAP', 'kwargs': + {'random_state': ...}}`` (the form several gallery examples use) is the + same request as the top-level ``random_state=``: neither names n_jobs, + so neither should draw umap's n_jobs warning, and both give the same + embedding.""" + pytest.importorskip('umap') + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + out = hyp.reduce( + _digits400(), + reduce={'model': 'UMAP', 'kwargs': {'random_state': 0}}, ndims=3) + plotted = hyp.plot( + _digits400(), '.', + reduce={'model': 'UMAP', 'kwargs': {'random_state': 0}}, ndims=3, + show=False) + assert not [m for m in w if 'n_jobs' in str(m.message)] + assert plotted is not None + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + top = hyp.reduce(_digits400(), reduce='UMAP', ndims=3, random_state=0) + np.testing.assert_allclose(np.asarray(out), np.asarray(top)) + + def test_seeded_umap_honours_an_explicit_n_jobs(): pytest.importorskip('umap') from hypertools.reduce.common import resolve_reducer