diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d50467e..2d6aeb29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- `tc.simulate_hierarchy(..., factors="shared")`: one set of module series + `f` for every subject (the noise `z` stays private), so nodes of one module + are correlated across subjects, by `e_i e_j sqrt(g_a g_b)` for nodes `i`, + `j` of subjects `a`, `b`. `truth["factors"]` holds each subject's module + series. The default (`"private"`) output is unchanged. +- Subject weights per feature: `tc.wisfc(subject_weights=W)` accepts `W` of + shape (subjects, subjects, features), the weight of each subject in each + subject's reference at each feature; in `tc.timecorr` and `tc.features` as + `cfun=functools.partial(tc.wisfc, subject_weights=W)`, also with + `causal=True` and in streamed steps. A feature of a subject where no + subject has weight has no reference: its entries with the other features + are the correlations of the subject's series there with the references of + those features, its diagonal entry and its entries with other such + features are 0, and one `UserWarning` counts the (subject, feature) pairs. + Matrix weights are unchanged. +- `tc.distinct_subject_weights(labels)`: the weights per feature that leave + out of each subject's reference the subjects holding one of its own series + (labels of shape (subjects, features)), for subjects that can hold the same + series; with two or more subjects and no repeated label the result is + `tc.isfc`. New section in the + "Several subjects" tutorial. + +### Fixed + +- Docstrings of `tc.wcorr`, `tc.isfc`, `tc.wisfc` and `tc.autofc` still said + that causal rows are unchanged "to 1e-9" when later samples are replaced or + removed; since 0.4.0 they are unchanged bit for bit (removal: with the + built-in kernel functions). No change in behavior. + ## [0.4.0] - 2026-11-24 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 5d074399..a514ce19 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,7 @@ python setup.py sdist bdist_wheel - **`timecorr/helpers.py`**: - Kernel functions (`gaussian_weights`, `laplace_weights`, `eye_weights`, `mexican_hat_weights`, `t_weights`, `uniform_weights`, `boxcar_weights`) and `one_sided` - The estimator `wcorr` and correlation functions (`isfc`, `wisfc`, `autofc`), each with keyword-only `causal=False, min_samples=None`; the causal branch is `_causal_setup` / `_causal_block` (see "Causal mode" under Key Concepts) + - Subject weights of `wisfc`: a matrix (S, S), or per feature (S, S, K) (`_subject_weight_matrix` checks the shape; `_subject_reference` gives a subject's reference and the mask of its features without reference, `_node_weighted_mean` the mean per feature, a column of zeros where no subject has weight; `_no_reference_entries` sets the entries of such a feature before the symmetrization, in `wisfc` and in the streamed blocks of `summaries._unit_row_blocks`: the defined orientation `C[k, i]` for both, 0 between two such features; `_no_reference_message` is the warning, issued by `wisfc` and by the streamed step in `higher_order`); `distinct_subject_weights(labels)` (exported) builds the per-feature weights that leave out subjects holding one of a subject's own series (`tests/test_node_subject_weights.py`) - Frozen hypertools models of causal mode: `_model_reduce(..., return_model=True)` gives a `_FittedModel` (the model, its padding and its frozen constant columns); `_COMPONENT_MODELS` names the models with `components_`; `_FitUnusable` is raised for a fit a refit cannot use - Combine functions (`null_combine`, `corrmean_combine`, `mean_combine`, `tstat_combine`) - `reduce` (dimensionality reduction), `format_data` (input formatting via pydata-wrangler), `mat2vec`/`vec2mat`, `smooth`, `plot_weights` @@ -66,7 +67,7 @@ python setup.py sdist bdist_wheel - **`timecorr/datasets.py`** (used as `tc.datasets`; its functions are not top-level names): `fetch(url, path, sha256=None, member=None)` (cached download through uniquely named `.part` files next to the target and an atomic replace, so concurrent calls for one target are safe; a relative path is under the cache root `cache_dir()`: `$TIMECORR_DATA`, default `~/timecorr_data`; a cached file is checked against `sha256` on every call), `story_listening(n_nodes=100, return_nodes=False)` (HTFA node weights of the story-listening data, `pieman/pieman_posterior_K700.mat`; intact participants, nodes varying in every participant, farthest-point selection; `n_nodes` outside 1..679, the nodes that vary in every participant, raises `ValueError`; `return_nodes=True` adds a dict with `centers`, `widths`, `index`, `varying`, `total`) and `industry_returns(start, end)` (log returns of the 49 Industry Portfolios, `french/49_Industry_Portfolios_daily_CSV.zip`; `attrs` has the file's first line, `"header"`, and the count of missing returns, `"missing"`). `tests/test_datasets.py` holds the loading code the tutorial notebooks had at commit f9db4af and requires equal arrays. Only runtime dependencies. - **`timecorr/video.py`**: `render_video(draw, n_frames, path, fps=30, crf=23, hold=0, n_jobs=None, chunk_size=25, retries=0)` (`draw(frames, paths)` is called once per run of at most `chunk_size` consecutive frames in joblib worker processes, 3 or the usable cores by default; PNG frames in a temporary folder; `hold` appends copies of the last frame; with `retries`, workers are stopped after an error and new ones draw the frames whose files do not exist, again in runs of consecutive frames; the video is encoded under a temporary name next to the target and replaces it only on success; encoded with imageio-ffmpeg's ffmpeg, `-c:v libx264 -preset slow -crf -pix_fmt yuv420p -movflags +faststart`, byte for byte what the notebooks' own command gave: `tests/test_video.py`), `show_video(path, width=960)` (an HTML `