diff --git a/CMakeLists.txt b/CMakeLists.txt index e67d424e..538d3ed6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ endforeach() list(APPEND NNS_R14_CORE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nns/_r14_central_tendencies.cpp") list(APPEND NNS_R14_CORE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nns/_r14_mreg_predict.cpp") list(APPEND NNS_R14_CORE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nns/_r14_seas.cpp") +list(APPEND NNS_R14_CORE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/nns/_r14_partial_moments.cpp") set_property(TARGET nnscore PROPERTY SOURCES "${NNS_R14_CORE_SOURCES}") # The Python extension is a shared object. The vendored NNS-core target builds diff --git a/docs/conventions.md b/docs/conventions.md index 9672f779..1d1984d9 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -69,12 +69,11 @@ check the same rules. ## PM Matrix Target Defaults -R `PM.matrix` uses column means when `target` is `NULL` or any non-numeric value. -NNS Python accepts `None` and `"mean"` for this behavior, with Rcpp's `colMeans` -arithmetic (a row-by-row double sum divided by the row count). NNS Python also broadcasts a -scalar numeric target across all variables; R requires callers to pass an -explicit vector such as `rep(0, ncol(variable))`. Target vectors whose length -does not match the number of variables raise `ValueError`. +Use `None`, `"mean"` or `"means"` for column means. Python and R sum each column +row by row in double precision and divide by the row count. Numeric vectors and +matrices supply one target per variable column. R reads matrix targets in column +order, and Python does the same. Python also broadcasts a numeric scalar across +columns. In R, pass an explicit vector such as `rep(0, ncol(variable))`. ## Mode Default Divergence From R @@ -94,6 +93,8 @@ multiplication, fractional degrees by libm `pow`, double sums accumulated observation by observation and scaled by `1 / n`. `pm_matrix` fills the upper triangle and mirrors it (CUPM, CLPM and the covariance plainly, DUPM and DLPM crossed), normalising each cell by `CUPM + DUPM + DLPM + CLPM` in that order. +A normalised n-dimensional moment or matrix cell with an exactly zero total takes +its degree-zero value. In a joint survival calculation, ties are excluded. `nns_moments` is R 14's `NNS.moments`: deviations from R's `mean()`, `mean(z^3)` and `mean(z^4)` with R's `^`, and the variance raised by `^1.5`. @@ -139,10 +140,9 @@ unrecognised `type` warns (and `fsd` then runs its continuous branch, while returns the column names), and a vector is one column, as with R's `as.matrix`. Inputs are checked in R's order and with R's messages: missing values raise "You have some missing values, please address.", empty samples "Each sample -needs at least one observation.". Like R, the `.uni` tests, `sd_efficient_set` -and `nns_sd_cluster` accept infinite values and compare them as R's C++ test -does, while `fsd`, `ssd` and `tsd` reject them (R first evaluates the plotted -partial-moment curves, which check `x` and then the threshold grid). +needs at least one observation.". Only discrete first-order comparisons accept infinite values in +the `.uni` tests, efficient sets and clustering. The top-level `fsd`, `ssd` and +`tsd` check the partial-moment curves first and reject infinite values. `nns_sd_cluster` validates its data in the first efficient-set search, as R does, so a matrix with no more than `min_cluster` columns comes back as one cluster unchecked, and `min_cluster` is compared as a real number (`1.5` merges diff --git a/src/nns/_helpers.py b/src/nns/_helpers.py index 3e43979b..44409a6b 100644 --- a/src/nns/_helpers.py +++ b/src/nns/_helpers.py @@ -8,6 +8,27 @@ from nns._native import external_stacklevel, native_fn +def _is_factor(value: object) -> bool: + return getattr(getattr(value, "dtype", None), "name", None) == "category" + + +def _has_factor_column(value: object) -> bool: + return hasattr(value, "columns") and any( + dtype == "category" for dtype in getattr(value, "dtypes", ()) + ) + + +def _numeric_matrix(data: object) -> NDArray[np.float64]: + if _has_factor_column(data): + raise ValueError("Not compatible with requested type: [type=character; target=double].") + return np.asarray(data, dtype=np.float64) + + +def _reject_factor(value: object, name: str) -> None: + if _is_factor(value): + raise ValueError(f"{name} must be numeric, not a factor.") + + def _warn_unsupported(**was_set: bool) -> None: """Warn about R-compatibility parameters that have no effect in NNS Python. diff --git a/src/nns/_nnscore.pyi b/src/nns/_nnscore.pyi index 8f7d997a..81ca26ff 100644 --- a/src/nns/_nnscore.pyi +++ b/src/nns/_nnscore.pyi @@ -167,6 +167,7 @@ def clpm_nd_batch( n_targets: int, degree: float, norm: bool, + strict: bool = False, ) -> Sequence[float]: ... def pm_matrix( degree_lpm: float, diff --git a/src/nns/_nnscore_bindings.cpp b/src/nns/_nnscore_bindings.cpp index 5c605650..d49304f6 100644 --- a/src/nns/_nnscore_bindings.cpp +++ b/src/nns/_nnscore_bindings.cpp @@ -18,6 +18,7 @@ #include "nns/nns.hpp" #include "_r14_dependence.hpp" +#include "_r14_partial_moments.hpp" #include "_r14_seas.hpp" namespace nb = nanobind; @@ -180,7 +181,7 @@ nb::dict pm_matrix_dict(double degree_lpm, nns::PMMatrixResult result; { nb::gil_scoped_release release; - result = nns::pm_matrix(degree_lpm, degree_upm, target.data(), variable.data(), n, d, pop_adj, + result = nns_r14::pm_matrix(degree_lpm, degree_upm, target.data(), variable.data(), n, d, pop_adj, norm, call_threads()); } nb::dict out; @@ -623,34 +624,39 @@ NB_MODULE(_nnscore, m) { checked_flat_matrix_size(data, n, d, "data"); if (target.shape(0) != d) throw std::invalid_argument("target length must equal d."); nb::gil_scoped_release release; - return nns::clpm_nd(data.data(), n, d, target.data(), degree, norm, call_threads()); + return nns_r14::nd_moment(nns::clpm_nd, data.data(), n, d, target.data(), degree, norm, + call_threads()); }); m.def("cupm_nd", [](const Vector& data, std::size_t n, std::size_t d, const Vector& target, double degree, bool norm) { checked_flat_matrix_size(data, n, d, "data"); if (target.shape(0) != d) throw std::invalid_argument("target length must equal d."); nb::gil_scoped_release release; - return nns::cupm_nd(data.data(), n, d, target.data(), degree, norm, call_threads()); + return nns_r14::nd_moment(nns::cupm_nd, data.data(), n, d, target.data(), degree, norm, + call_threads()); }); m.def("dpm_nd", [](const Vector& data, std::size_t n, std::size_t d, const Vector& target, double degree, bool norm) { checked_flat_matrix_size(data, n, d, "data"); if (target.shape(0) != d) throw std::invalid_argument("target length must equal d."); nb::gil_scoped_release release; - return nns::dpm_nd(data.data(), n, d, target.data(), degree, norm, call_threads()); + return nns_r14::nd_moment(nns::dpm_nd, data.data(), n, d, target.data(), degree, norm, + call_threads()); }); m.def("clpm_nd_batch", [](const Vector& data, std::size_t n, std::size_t d, - const Vector& targets, std::size_t n_targets, double degree, bool norm) { + const Vector& targets, std::size_t n_targets, double degree, bool norm, + bool strict) { checked_flat_matrix_size(data, n, d, "data"); if (targets.shape(0) != n_targets * d) { throw std::invalid_argument("targets length must equal n_targets * d."); } std::vector out(n_targets, 0.0); nb::gil_scoped_release release; - nns::clpm_nd_batch(data.data(), n, d, targets.data(), n_targets, degree, norm, out.data(), - call_threads()); + nns_r14::clpm_nd_batch(data.data(), n, d, targets.data(), n_targets, degree, norm, strict, + out.data(), call_threads()); return out; - }); + }, nb::arg("data"), nb::arg("n"), nb::arg("d"), nb::arg("targets"), nb::arg("n_targets"), + nb::arg("degree"), nb::arg("norm"), nb::arg("strict") = false); m.def("pm_matrix", &pm_matrix_dict); m.def( diff --git a/src/nns/_r14_partial_moments.cpp b/src/nns/_r14_partial_moments.cpp new file mode 100644 index 00000000..b07a62a7 --- /dev/null +++ b/src/nns/_r14_partial_moments.cpp @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-3.0-only +#include "_r14_partial_moments.hpp" + +#include +#include +#include + +#include "nns/parallel.hpp" + +namespace nns_r14 { + +double nd_moment(NDMethod moment, const double* data, std::size_t n, std::size_t d, + const double* target, double degree, bool norm, int threads) { + if (!norm || degree == 0.0) return moment(data, n, d, target, degree, false, threads); + const double lower = nns::clpm_nd(data, n, d, target, degree, false, threads); + const double upper = nns::cupm_nd(data, n, d, target, degree, false, threads); + const double div = nns::dpm_nd(data, n, d, target, degree, false, threads); + const double total = lower + upper + div; + if (total == 0.0) return moment(data, n, d, target, 0.0, false, threads); + const double raw = moment == nns::clpm_nd ? lower : (moment == nns::cupm_nd ? upper : div); + return total > 0.0 ? raw / total : 0.0; +} + +static double power(double value, double degree) { + if (std::trunc(degree) != degree || degree > INT_MAX) return std::pow(value, degree); + double term = 1.0; + for (int k = 0; k < static_cast(degree); ++k) term *= value; + return term; +} + +void clpm_nd_batch(const double* data, std::size_t n, std::size_t d, const double* targets, + std::size_t m, double degree, bool norm, bool strict, double* out, int threads) { + if (!(degree >= 0.0)) throw std::invalid_argument("`degree` must be a non-negative number"); + if (n == 0) throw std::invalid_argument("`data` must have at least one row"); + const double inv_n = 1.0 / static_cast(n); + nns::parallel_for(0, m, [&](std::size_t begin, std::size_t end) { + for (std::size_t r = begin; r < end; ++r) { + auto lower_share = [&] { + std::size_t count = 0; + for (std::size_t i = 0; i < n; ++i) { + std::size_t j = 0; + for (; j < d; ++j) { + const double x = data[j * n + i], t = targets[j * m + r]; + if (strict ? x >= t : x > t) break; + } + if (j == d) ++count; + } + return static_cast(count) / static_cast(n); + }; + if (degree == 0.0) { + out[r] = lower_share(); + continue; + } + double lower = 0.0, upper = 0.0, div = 0.0; + for (std::size_t i = 0; i < n; ++i) { + double lo = 1.0, hi = 1.0, abs_prod = 1.0; + bool below = true, above = true; + for (std::size_t j = 0; j < d; ++j) { + const double diff = data[j * n + i] - targets[j * m + r]; + const double term = power(std::abs(diff), degree); + lo *= diff > 0.0 ? 0.0 : term; + hi *= diff < 0.0 ? 0.0 : term; + abs_prod *= term; + if (diff >= 0.0) below = false; + if (diff <= 0.0) above = false; + } + lower += lo; + upper += hi; + if (!below && !above) div += abs_prod; + } + lower *= inv_n; + if (!norm) { + out[r] = lower; + continue; + } + const double total = lower + upper * inv_n + div * inv_n; + if (total == 0.0) out[r] = lower_share(); + else out[r] = total > 0.0 ? lower / total : 0.0; + } + }, threads, n * d); +} + +nns::PMMatrixResult pm_matrix(double lower, double upper, const double* target, const double* data, + std::size_t n, std::size_t d, bool pop_adj, bool norm, int threads) { + auto result = nns::pm_matrix(lower, upper, target, data, n, d, pop_adj, false, threads); + if (!norm) return result; + nns::PMMatrixResult pm0; + for (std::size_t i = 0; i < result.dim; ++i) { + for (std::size_t j = i; j < result.dim; ++j) { + const auto k = j * d + i, mirror = i * d + j; + double cu = result.cupm[k], du = result.dupm[k], dl = result.dlpm[k], cl = result.clpm[k]; + const double total = cu + du + dl + cl; + if (total > 0.0) { + cu /= total; + du /= total; + dl /= total; + cl /= total; + } else if (total == 0.0) { + if (pm0.clpm.empty()) pm0 = nns::pm_matrix(0, 0, target, data, n, d, false, true, threads); + cu = pm0.cupm[k]; + du = pm0.dupm[k]; + dl = pm0.dlpm[k]; + cl = pm0.clpm[k]; + } else { + cu = du = dl = cl = 0.0; + } + result.cupm[k] = result.cupm[mirror] = cu; + result.clpm[k] = result.clpm[mirror] = cl; + result.dupm[k] = result.dlpm[mirror] = du; + result.dlpm[k] = result.dupm[mirror] = dl; + result.cov[k] = result.cov[mirror] = cu + cl - du - dl; + } + } + return result; +} + +} // namespace nns_r14 diff --git a/src/nns/_r14_partial_moments.hpp b/src/nns/_r14_partial_moments.hpp new file mode 100644 index 00000000..49ec1cf4 --- /dev/null +++ b/src/nns/_r14_partial_moments.hpp @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-3.0-only +#pragma once + +#include "nns/partial_moments.hpp" + +namespace nns_r14 { + +using NDMethod = decltype(&nns::clpm_nd); +double nd_moment(NDMethod moment, const double* data, std::size_t n, std::size_t d, + const double* target, double degree, bool norm, int threads); +void clpm_nd_batch(const double* data, std::size_t n, std::size_t d, const double* targets, + std::size_t m, double degree, bool norm, bool strict, double* out, int threads); +nns::PMMatrixResult pm_matrix(double lower, double upper, const double* target, const double* data, + std::size_t n, std::size_t d, bool pop_adj, bool norm, int threads); + +} // namespace nns_r14 diff --git a/src/nns/cdf.py b/src/nns/cdf.py index 53944641..7ec5a154 100644 --- a/src/nns/cdf.py +++ b/src/nns/cdf.py @@ -8,11 +8,12 @@ import numpy as np from numpy.typing import NDArray +from nns._helpers import _has_factor_column, _reject_factor from nns._native import native_fn from nns._rmean import r_row_sums from nns._rnmath import libm_log from nns.core import lpm_ratio -from nns.dependence import _r_pm_terms, co_lpm_nd +from nns.dependence import _nd_degree, _r_pm_terms, co_lpm_nd from nns.regression import RegResult, nns_reg if TYPE_CHECKING: @@ -28,10 +29,12 @@ def nns_cdf( names: Sequence[str] | None = None, ) -> dict[str, object]: """Partial-moment CDF wrapper matching R's non-plotting NNS.CDF paths.""" - type_value = type.lower() - if type_value not in {"cdf", "survival", "hazard", "cumulative hazard"}: - raise ValueError("invalid type") - + _reject_factor(variable, "`variable`") + if _has_factor_column(variable): + _cdf_type(type) + if variable.shape[1] == 1: + raise ValueError("cannot xtfrm data frames") + raise ValueError("`data` must be finite.") if names is None: columns = getattr(variable, "columns", None) if columns is not None: @@ -46,13 +49,13 @@ def nns_cdf( elif values.ndim == 2: values = values[~np.isnan(values).any(axis=1)] if values.ndim == 1 or (values.ndim == 2 and values.shape[1] == 1): - result = _univariate_cdf(values.reshape(-1), float(degree), target, type_value) + result = _univariate_cdf(values.reshape(-1), float(degree), target, type) if plot: _render_cdf(result, target) return result if values.ndim == 2: # Multivariate CDF has no faithful single-Axes plot; plot is a no-op here. - return _multivariate_cdf(values, float(degree), target, type_value, names) + return _multivariate_cdf(values, float(degree), target, type, names) raise ValueError("variable must be a vector or 2D matrix.") @@ -68,6 +71,13 @@ def _render_cdf(result: dict[str, object], target: float | NDArray[np.float64] | plot_nns_cdf(result, target=plot_target) +def _cdf_type(value: str) -> str: + type_value = value.lower() + if type_value not in {"cdf", "survival", "hazard", "cumulative hazard"}: + raise ValueError("invalid type") + return type_value + + def _univariate_cdf( values: NDArray[np.float64], degree: float, @@ -76,9 +86,10 @@ def _univariate_cdf( ) -> dict[str, object]: if values.size == 0: raise ValueError("variable must contain at least one non-missing value.") + target_value = _univariate_target(target, values) + type_value = _cdf_type(type_value) if not np.all(np.isfinite(values)): raise ValueError("variable must contain only finite values.") - target_value = _univariate_target(target, values) x = np.sort(values) pval = _r_lpm_ratio(degree, x, values) column_name = { @@ -138,6 +149,8 @@ def _multivariate_cdf( ) -> dict[str, object]: if values.shape[0] == 0 or values.shape[1] == 0: raise ValueError("variable must have at least one complete row and one column.") + target_values = _multivariate_target(target, values) + type_value = _cdf_type(type_value) if not np.all(np.isfinite(values)): raise ValueError("variable must contain only finite values.") # R14 explicitly rejects the joint hazard without a defined multivariate @@ -153,7 +166,6 @@ def _multivariate_cdf( raise ValueError( "type = 'cumulative hazard' needs degree = 0 for multivariate variable" ) - target_values = _multivariate_target(target, values) column_names = _matrix_names(values.shape[1], names) cdf = _co_lpm_nd_rows(values, degree) @@ -286,9 +298,10 @@ def _co_lpm_nd_rows(values: NDArray[np.float64], degree: float) -> NDArray[np.fl def _co_lpm_nd_batch( - values: NDArray[np.float64], points: NDArray[np.float64], degree: float + values: NDArray[np.float64], points: NDArray[np.float64], degree: float, *, strict: bool = False ) -> NDArray[np.float64]: """R's ``Co.LPM_nD.batch(values, points, degree, norm = TRUE)``: one value per point row.""" + degree = _nd_degree(degree) n, d = values.shape m = points.shape[0] native = native_fn("clpm_nd_batch") @@ -296,7 +309,7 @@ def _co_lpm_nd_batch( flat = np.ascontiguousarray(values.ravel(order="F")) flat_points = np.ascontiguousarray(points.ravel(order="F")) return np.asarray( - native(flat, n, d, flat_points, m, float(degree), True), dtype=np.float64 + native(flat, n, d, flat_points, m, float(degree), True, strict), dtype=np.float64 ) # NumPy fallback reproducing R's CoLPMnDBatchWorker: per-row products of # R's lower/upper components (repeated multiplication or libm pow), double @@ -304,11 +317,12 @@ def _co_lpm_nd_batch( out = np.empty(m, dtype=np.float64) chunk = max(1, 2_000_000 // max(1, n * d)) inv_n = 1.0 / float(n) + below_target = np.less if strict else np.less_equal for start in range(0, m, chunk): rows = points[start : start + chunk] diff = values[np.newaxis, :, :] - rows[:, np.newaxis, :] if degree == 0.0: - below = np.all(diff <= 0.0, axis=2) + below = np.all(below_target(diff, 0.0), axis=2) out[start : start + chunk] = np.count_nonzero(below, axis=1) / float(n) continue lower_terms = _r_pm_terms(np.maximum(-diff, 0.0), degree) @@ -316,15 +330,20 @@ def _co_lpm_nd_batch( lower_prod = _r_axis2_products(np.where(-diff < 0.0, 0.0, lower_terms)) upper_prod = _r_axis2_products(np.where(diff < 0.0, 0.0, upper_terms)) dpm_prod = _r_axis2_products(_r_pm_terms(np.abs(diff), degree)) - strict = np.all(diff < 0.0, axis=2) | np.all(diff > 0.0, axis=2) + same_side = np.all(diff < 0.0, axis=2) | np.all(diff > 0.0, axis=2) clpm = np.cumsum(lower_prod, axis=1)[:, -1] * inv_n cupm = np.cumsum(upper_prod, axis=1)[:, -1] * inv_n - dpm = np.cumsum(np.where(strict, 0.0, dpm_prod), axis=1)[:, -1] * inv_n + dpm = np.cumsum(np.where(same_side, 0.0, dpm_prod), axis=1)[:, -1] * inv_n total = clpm + cupm + dpm positive = total > 0.0 - out[start : start + chunk] = np.where( + block = np.where( positive, clpm / np.where(positive, total, 1.0), 0.0 ) + zero = total == 0.0 + if np.any(zero): + below = np.all(below_target(diff[zero], 0.0), axis=2) + block[zero] = np.count_nonzero(below, axis=1) / float(n) + out[start : start + chunk] = block return out @@ -353,7 +372,7 @@ def _joint_survival( computed as ``Co.LPM_nD(-X, -t)``. Mirrors R NNS.CDF's ``joint.survival``. """ if degree > 0: - return _co_lpm_nd_batch(-values, -points, degree) + return _co_lpm_nd_batch(-values, -points, degree, strict=True) d = values.shape[1] if d > 3: # Beyond 3 columns the 2^d terms are slow and cancel; count the rows above t. diff --git a/src/nns/classical.py b/src/nns/classical.py index 35ba086d..0b620d12 100644 --- a/src/nns/classical.py +++ b/src/nns/classical.py @@ -3,6 +3,7 @@ import numpy as np from numpy.typing import NDArray +from nns._helpers import _reject_factor from nns._rmean import r_mean from nns._rnmath import libm_pow, r_pow_scalar from nns.core import _as_1d_values, lpm, upm @@ -59,6 +60,7 @@ def nns_moments(x: NDArray[np.float64], population: bool = True) -> dict[str, fl series has NaN skewness and kurtosis, and the sample (``population=False``) estimators need n > 2 (skewness) and n > 3 (kurtosis). """ + _reject_factor(x, "`x`") values = _as_1d_values(x) # R 14 NNS.moments: central moments with R's mean() (long double), z^2 as # z * z and z^3, z^4 through R's ^ (libm pow). float64 scalars give R's IEEE diff --git a/src/nns/co_moments.py b/src/nns/co_moments.py index c5d73e4f..8ad39647 100644 --- a/src/nns/co_moments.py +++ b/src/nns/co_moments.py @@ -5,8 +5,9 @@ import numpy as np from numpy.typing import NDArray +from nns._helpers import _reject_factor from nns._native import native_fn -from nns.core import _as_degree, _as_targets, _is_scalar, _require_finite +from nns.core import _as_degree, _as_targets, _check_numeric_target, _is_scalar, _require_finite def co_lpm( @@ -95,21 +96,33 @@ def _co_moment( target_x: float | NDArray[np.float64] | None, target_y: float | NDArray[np.float64] | None, ) -> float | NDArray[np.float64]: - x_values, y_values = _as_pair(x, y) + degree_x = _as_degree(degree_x) + degree_y = _as_degree(degree_y) + _reject_factor(x, "`x`") + _reject_factor(y, "`y`") + x_values = np.asarray(x, dtype=np.float64) + y_values = np.asarray(y, dtype=np.float64) + if x_values.ndim != 1 or y_values.ndim != 1: + raise ValueError("x and y must be 1D.") + _check_numeric_target(target_x) + _check_numeric_target(target_y) # ``None`` targets default to the variable means, as in R's Co.LPM/D.LPM wrappers. x_targets = _as_targets(target_x, x_values) y_targets = _as_targets(target_y, y_values) + if x_values.size != y_values.size: + raise ValueError("x and y must have the same length.") + if x_values.size == 0: + raise ValueError("x and y must be non-empty.") if x_targets.size == 0 or y_targets.size == 0: raise ValueError("target_x and target_y must be non-empty.") if x_targets.size != y_targets.size and 1 not in (x_targets.size, y_targets.size): raise ValueError( "target_x and target_y must have the same length, or one of them length 1." ) - # As R's Co.LPM/Co.UPM/D.LPM/D.UPM: NaN would be counted in n but in no quadrant. + _require_finite(x_values, "x") + _require_finite(y_values, "y") _require_finite(x_targets, "target_x") _require_finite(y_targets, "target_y") - degree_x = _as_degree(degree_x) - degree_y = _as_degree(degree_y) native, swap_degrees = _native_co_moment(x_side, y_side) if native is not None: @@ -155,23 +168,6 @@ def _native_co_moment(x_side: object, y_side: object) -> tuple[Any | None, bool] return native_fn("d_upm_v"), False -def _as_pair( - x: NDArray[np.float64], - y: NDArray[np.float64], -) -> tuple[NDArray[np.float64], NDArray[np.float64]]: - x_values = np.asarray(x, dtype=np.float64) - y_values = np.asarray(y, dtype=np.float64) - if x_values.ndim != 1 or y_values.ndim != 1: - raise ValueError("x and y must be 1D.") - if x_values.size != y_values.size: - raise ValueError("x and y must have the same length.") - if x_values.size == 0: - raise ValueError("x and y must be non-empty.") - _require_finite(x_values, "x") - _require_finite(y_values, "y") - return x_values, y_values - - def _deviation( side: object, degree: float, diff --git a/src/nns/core.py b/src/nns/core.py index 5693ffb1..1d20b0a6 100644 --- a/src/nns/core.py +++ b/src/nns/core.py @@ -1,10 +1,14 @@ from __future__ import annotations import math +from datetime import date +from decimal import Decimal +from numbers import Real import numpy as np from numpy.typing import NDArray +from nns._helpers import _is_factor, _reject_factor from nns._native import native_fn from nns._rmean import r_mean @@ -28,6 +32,8 @@ def lpm( ``target`` has length 1 or ``len(x)`` and the result is the single value ``mean(max(target_i - x_i, 0) ** degree)`` (degree 0 counts ``x_i <= target_i``). """ + _reject_factor(target, "`target`") + _reject_factor(x, "`variable`") if excess_ret: return _excess_moment(degree, target, x, lower=True) return _moment(degree, target, x, lower=True) @@ -47,6 +53,8 @@ def upm( With ``excess_ret=True`` the target is element-wise (length 1 or ``len(x)``) and the result is ``mean(max(x_i - target_i, 0) ** degree)``. """ + _reject_factor(target, "`target`") + _reject_factor(x, "`variable`") if excess_ret: return _excess_moment(degree, target, x, lower=False) return _moment(degree, target, x, lower=False) @@ -64,14 +72,12 @@ def _excess_moment( At degree 0 the lower moment counts ties (``x_i <= target_i``) as the non-excess path does, so ``LPM0 + UPM0 = 1``. """ - values = _as_1d_values(x) + values = _as_1d_values(x, "variable") targets = _as_targets(target, values) - degree = _as_degree(degree) _require_finite(targets, "target") + degree = _as_degree(degree) if targets.size not in (1, values.size): - raise ValueError( - "When excess_ret=True, target must be length 1 or same length as x." - ) + raise ValueError("When excess_ret=True, target must be length 1 or same length as x.") diff = targets - values if lower else values - targets # R's C++ excess path: one term per element (degree 0 counts ties as # lower), then Rcpp's mean(), which is R's two-pass long-double mean. @@ -111,11 +117,10 @@ def _moment( *, lower: bool, ) -> float | NDArray[np.float64]: - values = _as_1d_values(x) + values = _as_1d_values(x, "variable") targets = _as_targets(target, values) + _require_finite(targets, "target") degree = _as_degree(degree) - if not np.all(np.isfinite(targets)): - raise ValueError("`target` must be finite.") native = native_fn("lpm" if lower else "upm") if native is not None and targets.size > 0 and _native_safe(values, targets): @@ -260,10 +265,12 @@ def _ratio( *, lower: bool, ) -> float | NDArray[np.float64]: - values = _as_1d_values(x) - targets = _as_targets(target, values) degree = _as_degree(degree) - # R's LPM.ratio/UPM.ratio reject a non-finite target as LPM() does. + _reject_factor(x, "`variable`") + values = _as_1d_array(x) + _check_numeric_target(target) + targets = _as_targets(target, values) + _require_finite(values, "variable") _require_finite(targets, "target") native = native_fn("lpm_ratio_v" if lower else "upm_ratio_v") @@ -323,35 +330,73 @@ def _native_safe( return bool(np.all(np.isfinite(values)) and np.all(np.isfinite(targets))) -def _as_1d_values(x: NDArray[np.float64]) -> NDArray[np.float64]: +def _as_1d_array(x: NDArray[np.float64]) -> NDArray[np.float64]: values = np.asarray(x, dtype=np.float64) if values.ndim != 1: raise ValueError("x must be 1D.") if values.size == 0: raise ValueError("x must be non-empty.") - if not np.all(np.isfinite(values)): - # Matches R's LPM/UPM ("`variable` must be finite"); NaN would otherwise be - # counted in n but in neither tail, so degree-0 moments stop summing to 1. - raise ValueError("x must contain only finite values.") + return values + + +def _as_1d_values(x: NDArray[np.float64], name: str = "x") -> NDArray[np.float64]: + values = _as_1d_array(x) + _require_finite(values, name) return values def _require_finite(values: NDArray[np.float64], name: str) -> None: if not np.all(np.isfinite(values)): - raise ValueError(f"{name} must contain only finite values.") + raise ValueError(f"`{name}` must be finite.") def _is_scalar(target: object) -> bool: return target is None or np.asarray(target).ndim == 0 +def _check_numeric_target(target: object) -> None: + if target is None: + return + if not _is_factor(target) and not hasattr(target, "columns"): + values = np.asarray(target) + if values.dtype.kind in "biufM" or ( + values.dtype.kind == "O" + and all( + v is None or isinstance(v, (Real, Decimal, np.bool_, date, np.datetime64)) + for v in values.flat + ) + ): + return + raise ValueError("`target` must be numeric or NULL.") + + +def _target_doubles(target: object) -> NDArray[np.float64]: + values = np.asarray(target) + if values.dtype.kind == "M": + return np.where(np.isnat(values), np.nan, values.astype(np.float64)) + if values.dtype.kind == "O" and any(isinstance(v, (date, np.datetime64)) for v in values.flat): + counts = [] + for v in values.flat: + if isinstance(v, date): + # Timestamp.to_datetime64() preserves the timestamp's resolution. + v = v.to_datetime64() if hasattr(v, "to_datetime64") else np.datetime64(v) + if isinstance(v, np.datetime64): + v = np.nan if np.isnat(v) else v.astype(np.float64) + counts.append(v) + return np.asarray(counts, dtype=np.float64).reshape(values.shape) + return np.asarray(values, dtype=np.float64) + + def _as_targets( target: float | NDArray[np.float64] | None, values: NDArray[np.float64], ) -> NDArray[np.float64]: if target is None: return np.array([r_mean(values)], dtype=np.float64) - targets = np.asarray(target, dtype=np.float64) + try: + targets = _target_doubles(target) + except (TypeError, ValueError) as exc: + raise ValueError("`target` must be finite.") from exc if targets.ndim == 0: targets = targets.reshape(1) if targets.ndim != 1: diff --git a/src/nns/dependence.py b/src/nns/dependence.py index f89bb509..f302a992 100644 --- a/src/nns/dependence.py +++ b/src/nns/dependence.py @@ -7,7 +7,7 @@ import numpy as np from numpy.typing import NDArray -from nns._helpers import _as_pair +from nns._helpers import _as_pair, _has_factor_column from nns._native import native_fn as native_fn from nns._rnmath import libm_pow @@ -402,6 +402,8 @@ def _dpm_nd( clpm = _clpm_nd(data, target, degree) cupm = _cupm_nd(data, target, degree) total = clpm + cupm + dpm + if total == 0.0: + return float(np.mean(discordant)) return dpm / total if total > 0.0 else 0.0 @@ -460,14 +462,15 @@ def co_lpm_nd( degree: float = 0.0, norm: bool = True, ) -> float: - values, target_values = _as_nd_moment_inputs(data, target) - degree = float(degree) + values, target_values, degree = _as_nd_moment_inputs(data, target, degree) clpm = _clpm_nd(values, target_values, degree) if not norm or degree == 0.0: return clpm cupm = _cupm_nd(values, target_values, degree) dpm = _dpm_nd(values, target_values, degree, norm=False) total = clpm + cupm + dpm + if total == 0.0: + return _clpm_nd(values, target_values, 0.0) return clpm / total if total > 0.0 else 0.0 @@ -477,14 +480,15 @@ def co_upm_nd( degree: float = 0.0, norm: bool = True, ) -> float: - values, target_values = _as_nd_moment_inputs(data, target) - degree = float(degree) + values, target_values, degree = _as_nd_moment_inputs(data, target, degree) cupm = _cupm_nd(values, target_values, degree) if not norm or degree == 0.0: return cupm clpm = _clpm_nd(values, target_values, degree) dpm = _dpm_nd(values, target_values, degree, norm=False) total = clpm + cupm + dpm + if total == 0.0: + return _cupm_nd(values, target_values, 0.0) return cupm / total if total > 0.0 else 0.0 @@ -494,27 +498,38 @@ def dpm_nd( degree: float = 0.0, norm: bool = True, ) -> float: - values, target_values = _as_nd_moment_inputs(data, target) - return _dpm_nd(values, target_values, float(degree), norm=bool(norm)) + values, target_values, degree = _as_nd_moment_inputs(data, target, degree) + return _dpm_nd(values, target_values, degree, norm=bool(norm)) + + +def _nd_degree(degree: float) -> float: + degree = float(degree) + if not degree >= 0: + raise ValueError("'degree' must be a non-negative number") + return degree def _as_nd_moment_inputs( data: NDArray[np.float64], target: NDArray[np.float64], -) -> tuple[NDArray[np.float64], NDArray[np.float64]]: + degree: float, +) -> tuple[NDArray[np.float64], NDArray[np.float64], float]: + if _has_factor_column(data): + raise ValueError("`data` must be finite.") values = np.asarray(data, dtype=np.float64) target_values = np.asarray(target, dtype=np.float64).reshape(-1) if values.ndim != 2: raise ValueError("data must be a 2D matrix.") if values.shape[0] == 0: raise ValueError("data must have at least one row.") - if target_values.size != values.shape[1]: - raise ValueError("target length must match number of columns in data.") if not np.all(np.isfinite(values)): - raise ValueError("data must be finite.") + raise ValueError("`data` must be finite.") if not np.all(np.isfinite(target_values)): - raise ValueError("target must be finite.") - return values, target_values + raise ValueError("`target` must be finite.") + degree = _nd_degree(degree) + if target_values.size != values.shape[1]: + raise ValueError("target length must match number of columns in data.") + return values, target_values, degree def _gravity(x: NDArray[np.float64]) -> float: diff --git a/src/nns/pm_matrix.py b/src/nns/pm_matrix.py index 9fb1ed41..701ef8c1 100644 --- a/src/nns/pm_matrix.py +++ b/src/nns/pm_matrix.py @@ -6,11 +6,12 @@ import numpy as np from numpy.typing import NDArray +from nns._helpers import _is_factor, _numeric_matrix from nns._native import native_fn -from nns.core import _as_degree, _require_finite +from nns.core import _as_degree, _check_numeric_target, _require_finite, _target_doubles from nns.dependence import _r_pm_terms -Target: TypeAlias = float | Literal["mean"] | NDArray[np.float64] | None +Target: TypeAlias = float | Literal["mean", "means"] | NDArray[np.float64] | None PMMatrixResult: TypeAlias = dict[str, Any] @@ -39,6 +40,8 @@ def pm_matrix( upm_degree = _as_degree(upm_degree) values = _as_matrix(variable) targets = _as_target(target, values) + _require_finite(values, "variable") + _require_finite(targets, "target") resolved_names = _resolve_names(names, values.shape[1]) observations = values.shape[0] @@ -100,6 +103,12 @@ def pm_matrix( dlpm = np.where(positive, dlpm / safe_total, 0.0) clpm = np.where(positive, clpm / safe_total, 0.0) + zero = total == 0.0 + if np.any(zero): + pm0 = pm_matrix(0, 0, targets, values, False, True) + for key, matrix in (("cupm", cupm), ("dupm", dupm), ("dlpm", dlpm), ("clpm", clpm)): + matrix[zero] = pm0[key][zero] + cov_matrix = cupm + clpm - dupm - dlpm # R fills only the upper triangle and mirrors it: CUPM, CLPM and the # covariance plainly, DUPM and DLPM crossed (each from the other's transpose). @@ -174,27 +183,37 @@ def _upper_deviation( def _as_matrix(variable: NDArray[np.float64]) -> NDArray[np.float64]: - values = np.asarray(variable, dtype=np.float64) + values = _numeric_matrix(variable) if values.ndim != 2: raise ValueError("variable must be 2D.") if values.shape[0] == 0 or values.shape[1] == 0: raise ValueError("variable must be non-empty.") - # As R's PM.matrix: NaN would be counted in n but in no quadrant. - _require_finite(values, "variable") return values def _as_target(target: Target, variable: NDArray[np.float64]) -> NDArray[np.float64]: - if target is None or isinstance(target, str): + supplied = np.asarray(target) + if supplied.ndim <= 1 and supplied.size == 1 and not _is_factor(target): + alias = supplied.item() + index = getattr(target, "index", None) + if ( + isinstance(alias, str) + and alias in ("mean", "means") + and (index is None or callable(index) or list(index) == [0]) + ): + target = None + if target is None: # Rcpp sugar colMeans: a sequential double sum divided by the row count. return cast(NDArray[np.float64], np.cumsum(variable, axis=0)[-1] / variable.shape[0]) - targets = np.asarray(target, dtype=np.float64) + _check_numeric_target(target) + targets = _target_doubles(target) if targets.ndim == 0: - targets = np.full(variable.shape[1], float(targets), dtype=np.float64) - if targets.ndim != 1: - raise ValueError("target must be 1D.") + targets = np.full(variable.shape[1], targets.item(), dtype=np.float64) + elif targets.ndim == 2: + targets = targets.ravel(order="F") + elif targets.ndim != 1: + raise ValueError("target must be a scalar, vector or matrix.") if targets.size != variable.shape[1]: - raise ValueError("variable matrix cols != target vector length.") - _require_finite(targets, "target") + raise ValueError("variable matrix cols != target vector length") return targets diff --git a/src/nns/stochastic_dominance.py b/src/nns/stochastic_dominance.py index a5e00e3c..ec36664b 100644 --- a/src/nns/stochastic_dominance.py +++ b/src/nns/stochastic_dominance.py @@ -37,12 +37,15 @@ from scipy.sparse.csgraph import connected_components # type: ignore[import-untyped] from scipy.spatial.distance import squareform # type: ignore[import-untyped] +from nns._helpers import _numeric_matrix, _reject_factor + _SD_ORDER_STAT_TARGET_BLOCK_COLUMNS = 64 # R's native SD test ignores excesses up to 64 * DBL_EPSILON (relative to the data scale). _SD_EPS = float(np.finfo(np.float64).eps) _SD_EPS64 = 64.0 * _SD_EPS # R's own messages: the NA check in every R wrapper and the C++ empty-sample check. _MISSING_VALUES = "You have some missing values, please address." +_INFINITE_VALUES = "You have some infinite values, please address." _EMPTY_SAMPLE = "Each sample needs at least one observation." _P = ParamSpec("_P") @@ -111,9 +114,9 @@ def fsd_uni(x: NDArray[np.float64], y: NDArray[np.float64], type: str = "discret """Unidirectional first-order stochastic dominance: 1 if x dominates y, else 0. Like R's ``NNS.FSD.uni``, an unrecognised ``type`` warns and runs the discrete - test, and infinite values are compared as R's C++ test compares them. + test. Only the discrete test accepts infinite values. """ - x_values, y_values = _sd_pair(x, y, finite=False) + x_values, y_values = _sd_pair(x, y, finite=False, allow_inf=type.lower() != "continuous") discrete = _checked_fsd_type(type) != "continuous" return int(_dominates_uni(x_values, y_values, 1, discrete=discrete)) @@ -197,7 +200,7 @@ def _nns_sd_cluster( names: Sequence[str] | None, ) -> dict[str, object]: column_labels = getattr(data, "columns", None) - values = np.asarray(data, dtype=np.float64) + values = np.asarray(data) if values.ndim != 2: raise ValueError("data must be a 2D array.") min_cluster = float(min_cluster) @@ -226,6 +229,7 @@ def _nns_sd_cluster( break # R's efficient set of no columns is empty if order_stat_dominance_matrix is None and prefix_precomputed is None: # R validates in the first NNS.SD.efficient.set call, on every column. + values = _numeric_matrix(data) degree_int, discrete = _validated_sd_matrix(values, degree, type) if degree_int == 1 and discrete: order_stat_dominance_matrix = _dominance_matrix_from_order_stats( @@ -387,7 +391,7 @@ def sd_efficient_set( ``as.integer``: 1.5 runs first-order (FSD) and ``"2"`` runs second-order; anything that does not truncate to 1, 2 or 3 raises. Validation follows R's C++ order (no columns, empty columns, degree, missing values), and infinite - values are compared as R's C++ test compares them. + values are accepted only for discrete first-order dominance. """ values = _sd_matrix(returns, "returns") if values.shape[1] == 0: @@ -416,7 +420,7 @@ def sd_efficient_set( def _sd_matrix(data: object, name: str) -> NDArray[np.float64]: - values = np.asarray(data, dtype=np.float64) + values = _numeric_matrix(data) if values.ndim < 2: values = values.reshape(-1, 1) if values.ndim != 2: @@ -434,6 +438,8 @@ def _validated_sd_matrix( if np.isnan(values).any(): raise ValueError(_MISSING_VALUES) type_value = _sd_type_value(degree_int, type) + if (degree_int != 1 or type_value == "continuous") and np.isinf(values).any(): + raise ValueError(_INFINITE_VALUES) return degree_int, degree_int != 1 or type_value != "continuous" @@ -669,6 +675,8 @@ def _dominates_uni( *, discrete: bool, ) -> bool: + if x.size == 0 or y.size == 0: + raise ValueError(_EMPTY_SAMPLE) x_sorted = np.sort(x) y_sorted = np.sort(y) return _dominates_sorted( @@ -1094,6 +1102,7 @@ def _lpm_at_target( def _as_sd_values(x: NDArray[np.float64], name: str) -> NDArray[np.float64]: """R's ``to_numeric_vector``: single-column objects and any vector shape flatten.""" + _reject_factor(x, name) values = np.asarray(x, dtype=np.float64) if values.ndim == 2: # R accepts single-column matrices and data frames. @@ -1104,14 +1113,14 @@ def _as_sd_values(x: NDArray[np.float64], name: str) -> NDArray[np.float64]: def _sd_pair( - x: NDArray[np.float64], y: NDArray[np.float64], *, finite: bool + x: NDArray[np.float64], y: NDArray[np.float64], *, finite: bool, allow_inf: bool = False ) -> tuple[NDArray[np.float64], NDArray[np.float64]]: """Both samples, checked in R's order: shape, missing values, finiteness, size. ``finite`` is for ``NNS.FSD``/``NNS.SSD``/``NNS.TSD``, which evaluate ``LPM(.ratio)(degree, sort(c(x, y)), x)`` first: that checks the variable ``x`` and then the target grid. The ``.uni`` tests go straight to R's C++ test, - which accepts infinite values. + which accepts infinite values only for discrete first-order dominance. """ x_values = _as_sd_values(x, "x") y_values = _as_sd_values(y, "y") @@ -1122,6 +1131,6 @@ def _sd_pair( raise ValueError("`variable` must be finite.") if not np.all(np.isfinite(y_values)): raise ValueError("`target` must be finite.") - if x_values.size == 0 or y_values.size == 0: - raise ValueError(_EMPTY_SAMPLE) + elif not allow_inf and (np.isinf(x_values).any() or np.isinf(y_values).any()): + raise ValueError(_INFINITE_VALUES) return x_values, y_values diff --git a/src/nns/var.py b/src/nns/var.py index fc73d759..20f3ed96 100644 --- a/src/nns/var.py +++ b/src/nns/var.py @@ -15,7 +15,7 @@ import numpy as np from numpy.typing import NDArray -from nns._helpers import _warn_unsupported +from nns._helpers import _has_factor_column, _reject_factor, _warn_unsupported from nns._native import honours_ncores from nns._rmean import ( r_cor_matrix, @@ -1030,6 +1030,9 @@ def _partial_moment_var( *, lower: bool, ) -> float | NDArray[np.float64]: + _reject_factor(x, "`x`") + if _has_factor_column(x): + raise ValueError("`x` must be numeric, not a factor.") values = _finite_values(x) requested = np.asarray(percentile, dtype=np.float64) pcts = np.clip(requested.reshape(-1), 0.0, 1.0) diff --git a/sync/nns_source.json b/sync/nns_source.json index feacd961..54254d1f 100644 --- a/sync/nns_source.json +++ b/sync/nns_source.json @@ -1,7 +1,7 @@ { "r_repo": "OVVO-Financial/NNS", - "r_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e", - "r_version": "14.0", + "r_commit": "31291970b57cbc2e0791e0d504503111b54d0078", + "r_version": "14.2", "r_src_tree_hash": "1c82fa36a4af3ce6359cc34b3d841afa6bdd1815", "core_repo": "OVVO-Financial/NNS-core", "core_commit": "a0d3b93b6ac451bd38e5e9375ef06e6d0d314b9d", @@ -11,11 +11,11 @@ "vendored_r_path": "tools/NNS", "vendored_r_tarball": "tools/NNS_13.0.tar.gz", "r_cache_path": "tests/_r_cache", - "notes": "Behavioral oracle: the exact R14 archive and commit recorded above. The cumulative Python implementation through PR #189 is preserved under draft #192. Native R14 overlays are explicit and hashed separately; extern/NNS-core remains byte-for-byte at the recorded accepted vendor revision. The vendored tools/NNS snapshot, r_src_tree_hash, and tools/NNS_13.0.tar.gz retain their historical lineage and do not identify the live R14 behavioral oracle. Local verification results are recorded in docs/R14_LOCAL_PARITY_REPAIR.md; remote CI/release approval is separate. The R 14.0 update at 9c8bd21 (compiled speed paths; the same archive through de5d4fe) returns the same values as 7b07a837 on every cached input, so overlays ported from 7b07a837 keep that source and record the oracle they were verified against in verified_r_commit.", + "notes": "The R oracle is the Git tree at r_commit, archived with git archive --prefix=NNS/ --format=tar.gz. The NNS_14.2.tar.gz stored upstream predates the VaR check for factor columns in plain data frames. The vendored tools/NNS tree, r_src_tree_hash and tools/NNS_13.0.tar.gz identify the historical snapshot. Native overlays are tracked separately from the accepted NNS-core snapshot.", "r_source_archive": { - "filename": "NNS_14.0.tar.gz", - "sha256": "754dad65629b95bf3ddca9bf9018ef197f5c346dd12dcfb49e505835920bc5cb", - "repository_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e" + "filename": "NNS-31291970.tar.gz", + "sha256": "cdb5dfafff603f1fee2f317211f17aff73209565c869d5f48efecf3f59dd968f", + "repository_commit": "31291970b57cbc2e0791e0d504503111b54d0078" }, "r14_native_overlays": [ { @@ -25,7 +25,7 @@ "r_source_sha256": "f50530afc3f94e8c7faef14f59bd44bacf64e7a21bd5c2e8b9421404a82bd61d", "r_source_commit": "7b07a837c130ba7220dbe16c584221508757d5ae", "adaptation": "R14 gravity/mode port with std::vector marshalling. CMake replaces only the old central-tendency translation unit; vendor rescale behavior is retained.", - "verified_r_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e" + "verified_r_commit": "31291970b57cbc2e0791e0d504503111b54d0078" }, { "path": "src/nns/_r14_dependence.hpp", @@ -34,7 +34,7 @@ "r_source_sha256": "2e577f57165fd38d779dcde369eabf4800135eb50e07079069c11be2fedaa115", "r_source_commit": "7b07a837c130ba7220dbe16c584221508757d5ae", "adaptation": "R14 multilevel/null-corrected dependence with vector marshalling. R::dhyper and R::pnorm are the ports of R's own nmath routines in src/nns/_rnmath.hpp, so the null expectations match R's bit for bit. Bound explicitly instead of the untouched vendor dependence estimator.", - "verified_r_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e" + "verified_r_commit": "31291970b57cbc2e0791e0d504503111b54d0078" }, { "path": "src/nns/_r14_mreg_predict.cpp", @@ -43,7 +43,7 @@ "r_source_sha256": "e0fac52e99f33cd29fbb07b51711ded56c016d9e1a4b4a8eac8a9b4b9ed98571", "r_source_commit": "7b07a837c130ba7220dbe16c584221508757d5ae", "adaptation": "The vendored NNS-core multivariate prediction kernel (src/mreg_predict.cpp, sha256 c98d3fbb93c3165109870cb3d2cc1a55c8cb0fa35770b3ff0204441fd20e1e04) with its Student-t and normal ensemble weights evaluated by R's own nmath dt and dnorm4 (src/nns/_rnmath.hpp) instead of the vendor's lgamma-based closed form, so the weights and predictions match R's NNS_mreg_predict_v2_cpp bit for bit. CMake replaces only the vendor translation unit.", - "verified_r_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e" + "verified_r_commit": "31291970b57cbc2e0791e0d504503111b54d0078" }, { "path": "src/nns/_r14_seas.cpp", @@ -52,14 +52,23 @@ "r_source_sha256": "cf950b8e1b92bc942c132135dfb6a4909ca9f77c60da186e23eac0d30b2ed23e", "r_source_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e", "adaptation": "R14 NNS.seas lag scan: SeasComponent and seas_score copied verbatim, scored across lags with nns::parallel_for in place of RcppParallel (each lag writes its own slot, so results never depend on the thread count). Built into the NNS-core library target for its Release optimisation; bound as seas_scores_r14.", - "verified_r_commit": "9c8bd21a77b377cb49d43fececc662d62b00a94e" + "verified_r_commit": "31291970b57cbc2e0791e0d504503111b54d0078" + }, + { + "path": "src/nns/_r14_partial_moments.cpp", + "sha256": "6fce096f792f8787afa93a3bc51628769862b7ddb43f6c8c92d1da24d2dfbd35", + "r_source_path": "src/partial_moments.cpp", + "r_source_sha256": "a7042f715fccea769d1a49416133ee9c258b42e1ff8d3193ece051095853c44d", + "r_source_commit": "4a136836dc7a59069829e63ed3f4a721685664f1", + "adaptation": "R 14.2 zero-total normalisation for scalar and batched nD moments and PM.matrix. Uses the vendored raw moment and matrix kernels.", + "verified_r_commit": "31291970b57cbc2e0791e0d504503111b54d0078" } ], "r_cache_summary": { - "nns_version": "14.0", - "shards": 149, - "entries": 2999, - "generation": "Pinned live R NNS 14.0 under R 4.5.0 (x86-64 Linux, reference BLAS/LAPACK) only; no Python-authored expected values." + "nns_version": "14.2", + "shards": 150, + "entries": 3119, + "generation": "R NNS 14.2. The cache refresh at b184171c supplies the base entries. R 4.5.0 at NNS 4a136836 supplies the new dominance cases. The pm142 shard was regenerated with R 4.5.0 at NNS 31291970." }, "r_nmath_ports": [ { diff --git a/tests/_r.py b/tests/_r.py index 3a80984a..0bc69e0e 100644 --- a/tests/_r.py +++ b/tests/_r.py @@ -20,7 +20,7 @@ _CACHE_DIR = Path(__file__).with_name("_r_cache") _LOCK_PATH = Path(__file__).with_name("_r_cache.lock") _SCHEMA_VERSION = 2 -_NNS_VERSION = '14.0' +_NNS_VERSION = '14.2' _KEY_SEPARATOR = "|" JsonValue: TypeAlias = str | float | list["JsonValue"] | dict[str, "JsonValue"] | None RValue: TypeAlias = ( diff --git a/tests/_r_cache/Co.LPM.json b/tests/_r_cache/Co.LPM.json index 8cf15edd..211a1387 100644 --- a/tests/_r_cache/Co.LPM.json +++ b/tests/_r_cache/Co.LPM.json @@ -453,6 +453,6 @@ ] }, "label": "Co.LPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/Co.LPM_nD.json b/tests/_r_cache/Co.LPM_nD.json index b05623e7..9764e85f 100644 --- a/tests/_r_cache/Co.LPM_nD.json +++ b/tests/_r_cache/Co.LPM_nD.json @@ -8,6 +8,6 @@ "fbe22519fbef8dc14d50a2d009eeab90f05578a9a1dc07776bcd9d5b4049688d": 0.0 }, "label": "Co.LPM_nD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/Co.UPM.json b/tests/_r_cache/Co.UPM.json index b0688f7f..241d7862 100644 --- a/tests/_r_cache/Co.UPM.json +++ b/tests/_r_cache/Co.UPM.json @@ -452,6 +452,6 @@ "ff8d524c04bb5925e64e3fe01fbb80bd759829d169513aa91acdfaffc58f5c6f": 0.000145142434074642 }, "label": "Co.UPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/Co.UPM_nD.json b/tests/_r_cache/Co.UPM_nD.json index bae96c7e..5987ee4a 100644 --- a/tests/_r_cache/Co.UPM_nD.json +++ b/tests/_r_cache/Co.UPM_nD.json @@ -8,6 +8,6 @@ "c0ac419ad0fe799b23d812bd0ca345492b1a6d16c3223edd72b81531b8dd52b2": 0.0 }, "label": "Co.UPM_nD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/D.LPM.json b/tests/_r_cache/D.LPM.json index a9a01175..fc41f5ce 100644 --- a/tests/_r_cache/D.LPM.json +++ b/tests/_r_cache/D.LPM.json @@ -452,6 +452,6 @@ ] }, "label": "D.LPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/D.UPM.json b/tests/_r_cache/D.UPM.json index e6abd81d..5d46a4eb 100644 --- a/tests/_r_cache/D.UPM.json +++ b/tests/_r_cache/D.UPM.json @@ -452,6 +452,6 @@ "ffc8042119588eb3c4b9209b2ed041b458e066721560bd6c1acca9326ae16b52": 0.257590690270338 }, "label": "D.UPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/DPM_nD.json b/tests/_r_cache/DPM_nD.json index 53b0db05..d732d8ac 100644 --- a/tests/_r_cache/DPM_nD.json +++ b/tests/_r_cache/DPM_nD.json @@ -8,6 +8,6 @@ "f2b741a47a49d58b4ffa5057c358ee379ce52fc8a2d238c3d741fd28d7030ddd": 0.63125 }, "label": "DPM_nD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/LPM.VaR.json b/tests/_r_cache/LPM.VaR.json index 648032b3..1df717c9 100644 --- a/tests/_r_cache/LPM.VaR.json +++ b/tests/_r_cache/LPM.VaR.json @@ -86,6 +86,6 @@ "f7d4f8c6a450740c796d8edfbacd8893d8f4fa44fccb1aad0f8472a3b5c3b932": 1.95580575957306 }, "label": "LPM.VaR", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/LPM.json b/tests/_r_cache/LPM.json index 4ce93535..f2914751 100644 --- a/tests/_r_cache/LPM.json +++ b/tests/_r_cache/LPM.json @@ -205,6 +205,6 @@ "fce5a16e5c947faa2d5e278548c38081349d9a036a852d21043e8ff58cefc593": 0.0 }, "label": "LPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/LPM.ratio.json b/tests/_r_cache/LPM.ratio.json index 7ba9cd9a..6bc367a5 100644 --- a/tests/_r_cache/LPM.ratio.json +++ b/tests/_r_cache/LPM.ratio.json @@ -216,6 +216,6 @@ "ffdd15c7d14d0ec71a23f55abac1b72ecc09209ae0db30aecb4cd4a4118055f2": 1.0 }, "label": "LPM.ratio", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.ANOVA.custom.json b/tests/_r_cache/NNS.ANOVA.custom.json index c2464ca4..1f6f7225 100644 --- a/tests/_r_cache/NNS.ANOVA.custom.json +++ b/tests/_r_cache/NNS.ANOVA.custom.json @@ -492,6 +492,6 @@ } }, "label": "NNS.ANOVA.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.ARMA.json b/tests/_r_cache/NNS.ARMA.json index bc102501..09d382ab 100644 --- a/tests/_r_cache/NNS.ARMA.json +++ b/tests/_r_cache/NNS.ARMA.json @@ -292,6 +292,6 @@ ] }, "label": "NNS.ARMA", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.ARMA.optim.custom.json b/tests/_r_cache/NNS.ARMA.optim.custom.json index 7eb9e4f4..a59ccc65 100644 --- a/tests/_r_cache/NNS.ARMA.optim.custom.json +++ b/tests/_r_cache/NNS.ARMA.optim.custom.json @@ -1090,6 +1090,6 @@ } }, "label": "NNS.ARMA.optim.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.ARMA.pred_int.json b/tests/_r_cache/NNS.ARMA.pred_int.json index 9bf42d23..e94aa231 100644 --- a/tests/_r_cache/NNS.ARMA.pred_int.json +++ b/tests/_r_cache/NNS.ARMA.pred_int.json @@ -118,6 +118,6 @@ } }, "label": "NNS.ARMA.pred_int", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.CDF.custom.json b/tests/_r_cache/NNS.CDF.custom.json index fa7c160e..bd3c7ef8 100644 --- a/tests/_r_cache/NNS.CDF.custom.json +++ b/tests/_r_cache/NNS.CDF.custom.json @@ -1313,6 +1313,6 @@ } }, "label": "NNS.CDF.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.FSD.json b/tests/_r_cache/NNS.FSD.json index 5894c75e..f7e76314 100644 --- a/tests/_r_cache/NNS.FSD.json +++ b/tests/_r_cache/NNS.FSD.json @@ -31,6 +31,6 @@ "f2424dd3de7da5c1d9dc647eba0837d0161bac74f3ec8e73fe13f9c4e487228f": "X FSD Y" }, "label": "NNS.FSD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.FSD.uni.json b/tests/_r_cache/NNS.FSD.uni.json index de5549c7..1ab43421 100644 --- a/tests/_r_cache/NNS.FSD.uni.json +++ b/tests/_r_cache/NNS.FSD.uni.json @@ -56,6 +56,6 @@ "f4ba68b370a12a0fdae74b29eca2624dca27448b6fe7d11f8b40024228f82a7a": 0.0 }, "label": "NNS.FSD.uni", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.M.reg.json b/tests/_r_cache/NNS.M.reg.json index 73d3ce4f..e6dff2e5 100644 --- a/tests/_r_cache/NNS.M.reg.json +++ b/tests/_r_cache/NNS.M.reg.json @@ -10096,6 +10096,6 @@ } }, "label": "NNS.M.reg", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.MC.grid.json b/tests/_r_cache/NNS.MC.grid.json index c08b64a6..3dedeea0 100644 --- a/tests/_r_cache/NNS.MC.grid.json +++ b/tests/_r_cache/NNS.MC.grid.json @@ -124,6 +124,6 @@ } }, "label": "NNS.MC.grid", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.MC.stat_summary.json b/tests/_r_cache/NNS.MC.stat_summary.json index 3d5a7c7e..745ad45f 100644 --- a/tests/_r_cache/NNS.MC.stat_summary.json +++ b/tests/_r_cache/NNS.MC.stat_summary.json @@ -7,6 +7,6 @@ ] }, "label": "NNS.MC.stat_summary", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SD.cluster.dendrogram.json b/tests/_r_cache/NNS.SD.cluster.dendrogram.json index 61b4020b..76c31e6f 100644 --- a/tests/_r_cache/NNS.SD.cluster.dendrogram.json +++ b/tests/_r_cache/NNS.SD.cluster.dendrogram.json @@ -54,6 +54,6 @@ } }, "label": "NNS.SD.cluster.dendrogram", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SD.cluster.json b/tests/_r_cache/NNS.SD.cluster.json index cb29169c..8c0705df 100644 --- a/tests/_r_cache/NNS.SD.cluster.json +++ b/tests/_r_cache/NNS.SD.cluster.json @@ -102,6 +102,6 @@ } }, "label": "NNS.SD.cluster", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SD.efficient.set.json b/tests/_r_cache/NNS.SD.efficient.set.json index 3177691e..d73d694e 100644 --- a/tests/_r_cache/NNS.SD.efficient.set.json +++ b/tests/_r_cache/NNS.SD.efficient.set.json @@ -173,6 +173,6 @@ ] }, "label": "NNS.SD.efficient.set", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SS.json b/tests/_r_cache/NNS.SS.json index 8ec8dcf7..ba8021ae 100644 --- a/tests/_r_cache/NNS.SS.json +++ b/tests/_r_cache/NNS.SS.json @@ -27,6 +27,6 @@ } }, "label": "NNS.SS", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SSD.json b/tests/_r_cache/NNS.SSD.json index caa75e55..4727659f 100644 --- a/tests/_r_cache/NNS.SSD.json +++ b/tests/_r_cache/NNS.SSD.json @@ -29,6 +29,6 @@ "fe538054f364a42614fd9edd6c9a4276f258773dc7222ba697623102e6d7f7d3": "X SSD Y" }, "label": "NNS.SSD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.SSD.uni.json b/tests/_r_cache/NNS.SSD.uni.json index d66c2162..f5dd9e8b 100644 --- a/tests/_r_cache/NNS.SSD.uni.json +++ b/tests/_r_cache/NNS.SSD.uni.json @@ -6,6 +6,6 @@ "92aa617ffdc5696c0535cfece15a93397d4101a4c0312270e1104047c8e11bc7": 0.0 }, "label": "NNS.SSD.uni", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.TSD.json b/tests/_r_cache/NNS.TSD.json index c2836293..4702ccd6 100644 --- a/tests/_r_cache/NNS.TSD.json +++ b/tests/_r_cache/NNS.TSD.json @@ -37,6 +37,6 @@ "f6c9c36338008cfb61d2b4eacc64d0f2322bc270090284ba5511661135f18eae": "Y TSD X" }, "label": "NNS.TSD", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.TSD.uni.json b/tests/_r_cache/NNS.TSD.uni.json index de9480ac..6f297ac0 100644 --- a/tests/_r_cache/NNS.TSD.uni.json +++ b/tests/_r_cache/NNS.TSD.uni.json @@ -6,6 +6,6 @@ "c17bdb01601e34daa0b938864bd722821c7d26e78c6f5c003da0d8f044b46f64": 0.0 }, "label": "NNS.TSD.uni", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.VAR.custom.json b/tests/_r_cache/NNS.VAR.custom.json index f09c2ad7..60bd46cf 100644 --- a/tests/_r_cache/NNS.VAR.custom.json +++ b/tests/_r_cache/NNS.VAR.custom.json @@ -2513,6 +2513,6 @@ } }, "label": "NNS.VAR.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.VAR.json b/tests/_r_cache/NNS.VAR.json index 13fdd0db..844789f4 100644 --- a/tests/_r_cache/NNS.VAR.json +++ b/tests/_r_cache/NNS.VAR.json @@ -1241,6 +1241,6 @@ } }, "label": "NNS.VAR", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.boost.factor_predictor.json b/tests/_r_cache/NNS.boost.factor_predictor.json index a81c6fa3..9111ffd8 100644 --- a/tests/_r_cache/NNS.boost.factor_predictor.json +++ b/tests/_r_cache/NNS.boost.factor_predictor.json @@ -19,6 +19,6 @@ } }, "label": "NNS.boost.factor_predictor", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.boost.multi_factor_predictor.positional.v1.json b/tests/_r_cache/NNS.boost.multi_factor_predictor.positional.v1.json index 254dd247..e8d87e4d 100644 --- a/tests/_r_cache/NNS.boost.multi_factor_predictor.positional.v1.json +++ b/tests/_r_cache/NNS.boost.multi_factor_predictor.positional.v1.json @@ -34,6 +34,6 @@ } }, "label": "NNS.boost.multi_factor_predictor.positional.v1", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.boost.numeric.json b/tests/_r_cache/NNS.boost.numeric.json index 8729e8d5..9dabf6cb 100644 --- a/tests/_r_cache/NNS.boost.numeric.json +++ b/tests/_r_cache/NNS.boost.numeric.json @@ -854,6 +854,6 @@ } }, "label": "NNS.boost.numeric", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.caus.json b/tests/_r_cache/NNS.caus.json index 3f96c4a7..9f0361eb 100644 --- a/tests/_r_cache/NNS.caus.json +++ b/tests/_r_cache/NNS.caus.json @@ -112,6 +112,6 @@ ] }, "label": "NNS.caus", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.copula.json b/tests/_r_cache/NNS.copula.json index a0d4bcbf..cdb2aedb 100644 --- a/tests/_r_cache/NNS.copula.json +++ b/tests/_r_cache/NNS.copula.json @@ -39,6 +39,6 @@ "fd5a06afc3aec37a5fb5f75738a9dde2a333999ed7ddf699dcdfada6356f6f87": 1.0 }, "label": "NNS.copula", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.dep.json b/tests/_r_cache/NNS.dep.json index 761479ee..f801c16d 100644 --- a/tests/_r_cache/NNS.dep.json +++ b/tests/_r_cache/NNS.dep.json @@ -310,6 +310,6 @@ } }, "label": "NNS.dep", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.diff.custom.json b/tests/_r_cache/NNS.diff.custom.json index 13eb82f3..ea1d15b5 100644 --- a/tests/_r_cache/NNS.diff.custom.json +++ b/tests/_r_cache/NNS.diff.custom.json @@ -210,6 +210,6 @@ } }, "label": "NNS.diff.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.distance.bulk.custom.json b/tests/_r_cache/NNS.distance.bulk.custom.json index 8af49976..fd4cfb22 100644 --- a/tests/_r_cache/NNS.distance.bulk.custom.json +++ b/tests/_r_cache/NNS.distance.bulk.custom.json @@ -56,6 +56,6 @@ ] }, "label": "NNS.distance.bulk.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.distance.json b/tests/_r_cache/NNS.distance.json index b9039704..bb3fcfb6 100644 --- a/tests/_r_cache/NNS.distance.json +++ b/tests/_r_cache/NNS.distance.json @@ -23,6 +23,6 @@ "ff899753641936b07b316ef4912f4a9f9b7bc1814c695f75758d626f0950d5c9": 1.092402253406 }, "label": "NNS.distance", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.gravity.json b/tests/_r_cache/NNS.gravity.json index e4e4f748..20c45efc 100644 --- a/tests/_r_cache/NNS.gravity.json +++ b/tests/_r_cache/NNS.gravity.json @@ -9,6 +9,6 @@ "f26a55eecffd61526bddbc5488c38ee3c18c84ad7ed126f07a1ecc4e7c91d1eb": 5.0 }, "label": "NNS.gravity", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.meboot.diagnostics.json b/tests/_r_cache/NNS.meboot.diagnostics.json index 5ebd0309..6d131446 100644 --- a/tests/_r_cache/NNS.meboot.diagnostics.json +++ b/tests/_r_cache/NNS.meboot.diagnostics.json @@ -778,6 +778,6 @@ } }, "label": "NNS.meboot.diagnostics", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.meboot.stat_summary.json b/tests/_r_cache/NNS.meboot.stat_summary.json index 51bd8cc8..44e7dfa3 100644 --- a/tests/_r_cache/NNS.meboot.stat_summary.json +++ b/tests/_r_cache/NNS.meboot.stat_summary.json @@ -20,6 +20,6 @@ ] }, "label": "NNS.meboot.stat_summary", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.mode.json b/tests/_r_cache/NNS.mode.json index 8c24ae74..66fa07aa 100644 --- a/tests/_r_cache/NNS.mode.json +++ b/tests/_r_cache/NNS.mode.json @@ -40,6 +40,6 @@ "fe4997f09b2f756a269ad671ca29d25dcfed0b50508cbbbde6605baac8fca07a": 2.0 }, "label": "NNS.mode", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.moments.json b/tests/_r_cache/NNS.moments.json index 20e2df12..d8b4de59 100644 --- a/tests/_r_cache/NNS.moments.json +++ b/tests/_r_cache/NNS.moments.json @@ -98,6 +98,6 @@ } }, "label": "NNS.moments", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.norm.json b/tests/_r_cache/NNS.norm.json index ca7effbc..fccabb2e 100644 --- a/tests/_r_cache/NNS.norm.json +++ b/tests/_r_cache/NNS.norm.json @@ -14322,6 +14322,6 @@ ] }, "label": "NNS.norm", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.part.json b/tests/_r_cache/NNS.part.json index 1d663da6..475f1628 100644 --- a/tests/_r_cache/NNS.part.json +++ b/tests/_r_cache/NNS.part.json @@ -144677,6 +144677,6 @@ } }, "label": "NNS.part", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.reg.factor_dimred.json b/tests/_r_cache/NNS.reg.factor_dimred.json index ddc1c62d..5e907a0a 100644 --- a/tests/_r_cache/NNS.reg.factor_dimred.json +++ b/tests/_r_cache/NNS.reg.factor_dimred.json @@ -351,6 +351,6 @@ } }, "label": "NNS.reg.factor_dimred", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.reg.factor_predictor.v2.json b/tests/_r_cache/NNS.reg.factor_predictor.v2.json index b07fa8d1..9aefae31 100644 --- a/tests/_r_cache/NNS.reg.factor_predictor.v2.json +++ b/tests/_r_cache/NNS.reg.factor_predictor.v2.json @@ -92,6 +92,6 @@ } }, "label": "NNS.reg.factor_predictor.v2", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.reg.json b/tests/_r_cache/NNS.reg.json index cd8c0f2c..e09b5708 100644 --- a/tests/_r_cache/NNS.reg.json +++ b/tests/_r_cache/NNS.reg.json @@ -448018,6 +448018,6 @@ } }, "label": "NNS.reg", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.rescale.json b/tests/_r_cache/NNS.rescale.json index 2e2eb7f1..fed23e73 100644 --- a/tests/_r_cache/NNS.rescale.json +++ b/tests/_r_cache/NNS.rescale.json @@ -24,6 +24,6 @@ ] }, "label": "NNS.rescale", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.seas.json b/tests/_r_cache/NNS.seas.json index bea7ef26..6ce43c81 100644 --- a/tests/_r_cache/NNS.seas.json +++ b/tests/_r_cache/NNS.seas.json @@ -574,6 +574,6 @@ } }, "label": "NNS.seas", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.stack.factor_predictor.v2.json b/tests/_r_cache/NNS.stack.factor_predictor.v2.json index ef65b0f8..70d3e6dc 100644 --- a/tests/_r_cache/NNS.stack.factor_predictor.v2.json +++ b/tests/_r_cache/NNS.stack.factor_predictor.v2.json @@ -86,6 +86,6 @@ } }, "label": "NNS.stack.factor_predictor.v2", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.stack.mixed_factor_predictor.v1.json b/tests/_r_cache/NNS.stack.mixed_factor_predictor.v1.json index 7054cc60..6190a364 100644 --- a/tests/_r_cache/NNS.stack.mixed_factor_predictor.v1.json +++ b/tests/_r_cache/NNS.stack.mixed_factor_predictor.v1.json @@ -72,6 +72,6 @@ } }, "label": "NNS.stack.mixed_factor_predictor.v1", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS.stack.numeric.json b/tests/_r_cache/NNS.stack.numeric.json index e2095a73..f8bbb11e 100644 --- a/tests/_r_cache/NNS.stack.numeric.json +++ b/tests/_r_cache/NNS.stack.numeric.json @@ -3629,6 +3629,6 @@ } }, "label": "NNS.stack.numeric", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS_mreg_predict_path_v2_cpp.json b/tests/_r_cache/NNS_mreg_predict_path_v2_cpp.json index bc999aea..ed0551d8 100644 --- a/tests/_r_cache/NNS_mreg_predict_path_v2_cpp.json +++ b/tests/_r_cache/NNS_mreg_predict_path_v2_cpp.json @@ -1826,6 +1826,6 @@ ] }, "label": "NNS_mreg_predict_path_v2_cpp", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/NNS_mreg_predict_v2_cpp.json b/tests/_r_cache/NNS_mreg_predict_v2_cpp.json index 9a2e402d..62bb1344 100644 --- a/tests/_r_cache/NNS_mreg_predict_v2_cpp.json +++ b/tests/_r_cache/NNS_mreg_predict_v2_cpp.json @@ -32,6 +32,6 @@ ] }, "label": "NNS_mreg_predict_v2_cpp", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/PM.matrix.json b/tests/_r_cache/PM.matrix.json index e4b38572..cf88ec61 100644 --- a/tests/_r_cache/PM.matrix.json +++ b/tests/_r_cache/PM.matrix.json @@ -75546,6 +75546,6 @@ } }, "label": "PM.matrix", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/UPM.VaR.json b/tests/_r_cache/UPM.VaR.json index 44378ba9..7c811e8c 100644 --- a/tests/_r_cache/UPM.VaR.json +++ b/tests/_r_cache/UPM.VaR.json @@ -86,6 +86,6 @@ "ffc9654a5fafe6518d469f357b7a505fc690288592b0a1289d838cc3dbb08d3b": 2.25 }, "label": "UPM.VaR", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/UPM.json b/tests/_r_cache/UPM.json index c1e3a25a..3f66b232 100644 --- a/tests/_r_cache/UPM.json +++ b/tests/_r_cache/UPM.json @@ -204,6 +204,6 @@ "ff40defdb51d492bc4fa365c18fa5e835303c1688008464d4cb661b6c029fb39": 1.88257398294269 }, "label": "UPM", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/UPM.ratio.json b/tests/_r_cache/UPM.ratio.json index 7fc20738..be82d83d 100644 --- a/tests/_r_cache/UPM.ratio.json +++ b/tests/_r_cache/UPM.ratio.json @@ -31,6 +31,6 @@ ] }, "label": "UPM.ratio", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/anova14.binary.json b/tests/_r_cache/anova14.binary.json index 3867d1cd..623257d2 100644 --- a/tests/_r_cache/anova14.binary.json +++ b/tests/_r_cache/anova14.binary.json @@ -194,6 +194,6 @@ } }, "label": "anova14.binary", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/anova14.multi.json b/tests/_r_cache/anova14.multi.json index 70cb2789..6968c16d 100644 --- a/tests/_r_cache/anova14.multi.json +++ b/tests/_r_cache/anova14.multi.json @@ -40,6 +40,6 @@ ] }, "label": "anova14.multi", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boost14.binary.numeric.json b/tests/_r_cache/boost14.binary.numeric.json index f1453d39..bafd03d2 100644 --- a/tests/_r_cache/boost14.binary.numeric.json +++ b/tests/_r_cache/boost14.binary.numeric.json @@ -42,6 +42,6 @@ } }, "label": "boost14.binary.numeric", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.arma.json b/tests/_r_cache/boot14.arma.json index c6d8ee80..37a20043 100644 --- a/tests/_r_cache/boot14.arma.json +++ b/tests/_r_cache/boot14.arma.json @@ -88,6 +88,6 @@ } }, "label": "boot14.arma", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.labels.json b/tests/_r_cache/boot14.labels.json index 04fbd428..f0e3cccf 100644 --- a/tests/_r_cache/boot14.labels.json +++ b/tests/_r_cache/boot14.labels.json @@ -20,6 +20,6 @@ ] }, "label": "boot14.labels", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.mc.json b/tests/_r_cache/boot14.mc.json index 9dd637df..56480ec9 100644 --- a/tests/_r_cache/boot14.mc.json +++ b/tests/_r_cache/boot14.mc.json @@ -2804,6 +2804,6 @@ } }, "label": "boot14.mc", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.meboot.json b/tests/_r_cache/boot14.meboot.json index 2e4c3b07..b562b87d 100644 --- a/tests/_r_cache/boot14.meboot.json +++ b/tests/_r_cache/boot14.meboot.json @@ -3059,6 +3059,6 @@ ] }, "label": "boot14.meboot", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.seas.json b/tests/_r_cache/boot14.seas.json index 20f433ed..91e61650 100644 --- a/tests/_r_cache/boot14.seas.json +++ b/tests/_r_cache/boot14.seas.json @@ -60,6 +60,6 @@ } }, "label": "boot14.seas", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/boot14.ss.json b/tests/_r_cache/boot14.ss.json index 2e2148a0..28548682 100644 --- a/tests/_r_cache/boot14.ss.json +++ b/tests/_r_cache/boot14.ss.json @@ -95,6 +95,6 @@ } }, "label": "boot14.ss", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/cdf14.copula.json b/tests/_r_cache/cdf14.copula.json index 1950b9af..20c4841c 100644 --- a/tests/_r_cache/cdf14.copula.json +++ b/tests/_r_cache/cdf14.copula.json @@ -8,6 +8,6 @@ "fb1cf6641f328dff726155398a2d53ac15a77df7592e6a5c66ffef256eb04b77": 0.5551536134738801 }, "label": "cdf14.copula", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/cdf14.multivariate.json b/tests/_r_cache/cdf14.multivariate.json index 350a4395..a72bd68c 100644 --- a/tests/_r_cache/cdf14.multivariate.json +++ b/tests/_r_cache/cdf14.multivariate.json @@ -262,6 +262,6 @@ } }, "label": "cdf14.multivariate", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/cdf14.prefix.json b/tests/_r_cache/cdf14.prefix.json index 93dccf1d..513b0f95 100644 --- a/tests/_r_cache/cdf14.prefix.json +++ b/tests/_r_cache/cdf14.prefix.json @@ -1978,6 +1978,6 @@ } }, "label": "cdf14.prefix", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/cdf14.rescale.json b/tests/_r_cache/cdf14.rescale.json index 33706b1a..1981c69c 100644 --- a/tests/_r_cache/cdf14.rescale.json +++ b/tests/_r_cache/cdf14.rescale.json @@ -168,6 +168,6 @@ ] }, "label": "cdf14.rescale", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/cdf14.univariate.json b/tests/_r_cache/cdf14.univariate.json index 5853f8c1..5b3889bc 100644 --- a/tests/_r_cache/cdf14.univariate.json +++ b/tests/_r_cache/cdf14.univariate.json @@ -1856,6 +1856,6 @@ } }, "label": "cdf14.univariate", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/diff14.full.json b/tests/_r_cache/diff14.full.json index 9e556dcb..195358dc 100644 --- a/tests/_r_cache/diff14.full.json +++ b/tests/_r_cache/diff14.full.json @@ -242,6 +242,6 @@ ] }, "label": "diff14.full", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dist14.bulk.json b/tests/_r_cache/dist14.bulk.json index 78ca0a80..22347952 100644 --- a/tests/_r_cache/dist14.bulk.json +++ b/tests/_r_cache/dist14.bulk.json @@ -38,6 +38,6 @@ ] }, "label": "dist14.bulk", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dist14.continuous.json b/tests/_r_cache/dist14.continuous.json index ffeca9f3..c6199933 100644 --- a/tests/_r_cache/dist14.continuous.json +++ b/tests/_r_cache/dist14.continuous.json @@ -6,6 +6,6 @@ ] }, "label": "dist14.continuous", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dist14.scalar.json b/tests/_r_cache/dist14.scalar.json index 79227267..60a324de 100644 --- a/tests/_r_cache/dist14.scalar.json +++ b/tests/_r_cache/dist14.scalar.json @@ -10,6 +10,6 @@ "e953b2cacf1a730d61076c8dd6118e14e2ccae367205c4e9070d9470578e69b4": 0.6373908632966245 }, "label": "dist14.scalar", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dy.d.scalar.json b/tests/_r_cache/dy.d.scalar.json index 5b00ac66..831359d6 100644 --- a/tests/_r_cache/dy.d.scalar.json +++ b/tests/_r_cache/dy.d.scalar.json @@ -122,6 +122,6 @@ } }, "label": "dy.d.scalar", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dy.dx.numeric.json b/tests/_r_cache/dy.dx.numeric.json index 0f8f3881..70df1a82 100644 --- a/tests/_r_cache/dy.dx.numeric.json +++ b/tests/_r_cache/dy.dx.numeric.json @@ -121,6 +121,6 @@ } }, "label": "dy.dx.numeric", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dy.dx.overall.json b/tests/_r_cache/dy.dx.overall.json index f2a4aef6..734b8f60 100644 --- a/tests/_r_cache/dy.dx.overall.json +++ b/tests/_r_cache/dy.dx.overall.json @@ -3,6 +3,6 @@ "bb724984817505b7c4acb183b0a5f2db57ae89cc24a994c192772ee6c0fbb6ac": 1.43593484388262 }, "label": "dy.dx.overall", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dyd14.ties.json b/tests/_r_cache/dyd14.ties.json index fe050a5f..f14fcb72 100644 --- a/tests/_r_cache/dyd14.ties.json +++ b/tests/_r_cache/dyd14.ties.json @@ -814,6 +814,6 @@ } }, "label": "dyd14.ties", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dydx14.binary.json b/tests/_r_cache/dydx14.binary.json index d3f023ac..3df9e3c8 100644 --- a/tests/_r_cache/dydx14.binary.json +++ b/tests/_r_cache/dydx14.binary.json @@ -15,6 +15,6 @@ } }, "label": "dydx14.binary", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/dydx14.character.json b/tests/_r_cache/dydx14.character.json index eb0a7571..63f15e95 100644 --- a/tests/_r_cache/dydx14.character.json +++ b/tests/_r_cache/dydx14.character.json @@ -6,6 +6,6 @@ ] }, "label": "dydx14.character", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/factor_2_dummy.custom.json b/tests/_r_cache/factor_2_dummy.custom.json index b7865ad3..97b60dbd 100644 --- a/tests/_r_cache/factor_2_dummy.custom.json +++ b/tests/_r_cache/factor_2_dummy.custom.json @@ -41,6 +41,6 @@ } }, "label": "factor_2_dummy.custom", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.boost.names.json b/tests/_r_cache/labels.boost.names.json index 3796707f..5055cc75 100644 --- a/tests/_r_cache/labels.boost.names.json +++ b/tests/_r_cache/labels.boost.names.json @@ -28,6 +28,6 @@ } }, "label": "labels.boost.names", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.mreg.factor_y.json b/tests/_r_cache/labels.mreg.factor_y.json index 9b7f9a1c..01c37824 100644 --- a/tests/_r_cache/labels.mreg.factor_y.json +++ b/tests/_r_cache/labels.mreg.factor_y.json @@ -18,6 +18,6 @@ } }, "label": "labels.mreg.factor_y", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.mreg.raw_factor.json b/tests/_r_cache/labels.mreg.raw_factor.json index bb2bfdbb..7de67b29 100644 --- a/tests/_r_cache/labels.mreg.raw_factor.json +++ b/tests/_r_cache/labels.mreg.raw_factor.json @@ -18,6 +18,6 @@ } }, "label": "labels.mreg.raw_factor", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.factor_design.json b/tests/_r_cache/labels.reg.factor_design.json index ab9d5f21..f6ff59c6 100644 --- a/tests/_r_cache/labels.reg.factor_design.json +++ b/tests/_r_cache/labels.reg.factor_design.json @@ -6,6 +6,6 @@ ] }, "label": "labels.reg.factor_design", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.factor_x.json b/tests/_r_cache/labels.reg.factor_x.json index f4ab6d0c..ff357661 100644 --- a/tests/_r_cache/labels.reg.factor_x.json +++ b/tests/_r_cache/labels.reg.factor_x.json @@ -30,6 +30,6 @@ } }, "label": "labels.reg.factor_x", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.factor_y.json b/tests/_r_cache/labels.reg.factor_y.json index f3b1e347..69c037a7 100644 --- a/tests/_r_cache/labels.reg.factor_y.json +++ b/tests/_r_cache/labels.reg.factor_y.json @@ -18,6 +18,6 @@ } }, "label": "labels.reg.factor_y", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.logical_frame.json b/tests/_r_cache/labels.reg.logical_frame.json index 6c53c6f1..51f0c0ba 100644 --- a/tests/_r_cache/labels.reg.logical_frame.json +++ b/tests/_r_cache/labels.reg.logical_frame.json @@ -33,6 +33,6 @@ } }, "label": "labels.reg.logical_frame", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.logical_uni.json b/tests/_r_cache/labels.reg.logical_uni.json index 9d558778..6e4d5d30 100644 --- a/tests/_r_cache/labels.reg.logical_uni.json +++ b/tests/_r_cache/labels.reg.logical_uni.json @@ -14,6 +14,6 @@ } }, "label": "labels.reg.logical_uni", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.numeric_class_levels.json b/tests/_r_cache/labels.reg.numeric_class_levels.json index f7a15a1b..a359d7ec 100644 --- a/tests/_r_cache/labels.reg.numeric_class_levels.json +++ b/tests/_r_cache/labels.reg.numeric_class_levels.json @@ -10,6 +10,6 @@ ] }, "label": "labels.reg.numeric_class_levels", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.numeric_strings.json b/tests/_r_cache/labels.reg.numeric_strings.json index 4b95dea0..ff7dcdb8 100644 --- a/tests/_r_cache/labels.reg.numeric_strings.json +++ b/tests/_r_cache/labels.reg.numeric_strings.json @@ -12,6 +12,6 @@ } }, "label": "labels.reg.numeric_strings", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.point_names.json b/tests/_r_cache/labels.reg.point_names.json index 47f54e76..cd5e8f90 100644 --- a/tests/_r_cache/labels.reg.point_names.json +++ b/tests/_r_cache/labels.reg.point_names.json @@ -8,6 +8,6 @@ ] }, "label": "labels.reg.point_names", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.reg.raw_names.json b/tests/_r_cache/labels.reg.raw_names.json index 0d5b9b09..eea2c7cc 100644 --- a/tests/_r_cache/labels.reg.raw_names.json +++ b/tests/_r_cache/labels.reg.raw_names.json @@ -23,6 +23,6 @@ } }, "label": "labels.reg.raw_names", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.stack.factor_x.json b/tests/_r_cache/labels.stack.factor_x.json index 252d19d3..c2ee636b 100644 --- a/tests/_r_cache/labels.stack.factor_x.json +++ b/tests/_r_cache/labels.stack.factor_x.json @@ -25,6 +25,6 @@ } }, "label": "labels.stack.factor_x", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.stack.factor_y.json b/tests/_r_cache/labels.stack.factor_y.json index 1ae8b2d9..4f6296a1 100644 --- a/tests/_r_cache/labels.stack.factor_y.json +++ b/tests/_r_cache/labels.stack.factor_y.json @@ -43,6 +43,6 @@ } }, "label": "labels.stack.factor_y", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.stack.names.json b/tests/_r_cache/labels.stack.names.json index 7f18fe75..ef543190 100644 --- a/tests/_r_cache/labels.stack.names.json +++ b/tests/_r_cache/labels.stack.names.json @@ -28,6 +28,6 @@ } }, "label": "labels.stack.names", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/labels.stack.nbest_all.json b/tests/_r_cache/labels.stack.nbest_all.json index bfc62a9e..0d00ca0a 100644 --- a/tests/_r_cache/labels.stack.nbest_all.json +++ b/tests/_r_cache/labels.stack.nbest_all.json @@ -47,6 +47,6 @@ } }, "label": "labels.stack.nbest_all", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/mreg14.bits.json b/tests/_r_cache/mreg14.bits.json index 16c3b947..2f706929 100644 --- a/tests/_r_cache/mreg14.bits.json +++ b/tests/_r_cache/mreg14.bits.json @@ -144,6 +144,6 @@ } }, "label": "mreg14.bits", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/mreg14.categorical.json b/tests/_r_cache/mreg14.categorical.json index 255f4bd4..a8699784 100644 --- a/tests/_r_cache/mreg14.categorical.json +++ b/tests/_r_cache/mreg14.categorical.json @@ -16,6 +16,6 @@ ] }, "label": "mreg14.categorical", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/mreg14.class_bits.json b/tests/_r_cache/mreg14.class_bits.json index 06fa70b3..4fe4a2a4 100644 --- a/tests/_r_cache/mreg14.class_bits.json +++ b/tests/_r_cache/mreg14.class_bits.json @@ -624,6 +624,6 @@ } }, "label": "mreg14.class_bits", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pm14.co_moments.json b/tests/_r_cache/pm14.co_moments.json index 9b0e776d..9f4a5d36 100644 --- a/tests/_r_cache/pm14.co_moments.json +++ b/tests/_r_cache/pm14.co_moments.json @@ -80,6 +80,6 @@ } }, "label": "pm14.co_moments", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pm14.moments.json b/tests/_r_cache/pm14.moments.json index b8ce7a87..97691626 100644 --- a/tests/_r_cache/pm14.moments.json +++ b/tests/_r_cache/pm14.moments.json @@ -14,6 +14,6 @@ } }, "label": "pm14.moments", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pm14.nd.json b/tests/_r_cache/pm14.nd.json index 4a82196a..b9c21523 100644 --- a/tests/_r_cache/pm14.nd.json +++ b/tests/_r_cache/pm14.nd.json @@ -17,6 +17,6 @@ } }, "label": "pm14.nd", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pm14.pm_matrix.json b/tests/_r_cache/pm14.pm_matrix.json index 01e9ebb6..3c9e183a 100644 --- a/tests/_r_cache/pm14.pm_matrix.json +++ b/tests/_r_cache/pm14.pm_matrix.json @@ -530,6 +530,6 @@ } }, "label": "pm14.pm_matrix", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pm142.json b/tests/_r_cache/pm142.json new file mode 100644 index 00000000..8121a17c --- /dev/null +++ b/tests/_r_cache/pm142.json @@ -0,0 +1,474 @@ +{ + "entries": { + "017924646d699dac6d78b99c72198e2fe200741e76ee72741f71fd2d2628bef8": "y must be numeric, not a factor.", + "03d1223caae58abb1e35ed94090445a9794f42d21c0f54af7db0815b3bcbf5f8": { + "clpm": [ + [ + 0.03571428571428572, + 0.8, + 0.13579648178933995 + ], + [ + 0.8, + 1.0, + 0.6000000000000001 + ], + [ + 0.13579648178933995, + 0.6000000000000001, + 0.023809523809523805 + ] + ], + "cov.matrix": [ + [ + 1.0, + 0.6000000000000001, + -0.72840703642132 + ], + [ + 0.6000000000000001, + 1.0, + 0.20000000000000007 + ], + [ + -0.72840703642132, + 0.20000000000000007, + 1.0 + ] + ], + "cupm": [ + [ + 0.9642857142857143, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.9761904761904762 + ] + ], + "dlpm": [ + [ + 0.0, + 0.2, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.86420351821066, + 0.4, + 0.0 + ] + ], + "dupm": [ + [ + 0.0, + 0.0, + 0.86420351821066 + ], + [ + 0.2, + 0.0, + 0.4 + ], + [ + 0.0, + 0.0, + 0.0 + ] + ] + }, + "0561847b565da18d1789b3be4a1caca9719af871359193cc5d972fcfba253427": "`x` must be numeric, not a factor.", + "0579d03891ff488ce89950b2de6bf1d4dced82351028950b68043c849aee3c00": "x must be numeric, not a factor.", + "07158cd83e242ea0b6c09c77a7ee895a550344f5cf5485cc95044ae2576cacde": [ + 0.75, + 0.5, + 0.0, + 0.0, + 0.5 + ], + "0a453d83cb70e0a5775b460d1346ecaa1afba011848c18842ce149a49bee4271": "`x` must be numeric, not a factor.", + "0ac2e20e8ccd0b3591307e1181ca473ea097ecfa5a00eb919e82d787df27ecb0": "`target` must be numeric or NULL.", + "1294baca7489094696c9bca9f9aa3bd8e3de7b95381fa7e8377935d9f2ae8453": "Not compatible with requested type: [type=character; target=double].", + "12de60d2000a25f790f804c8ce2d170eeffda3d780c37320cef280f313efb724": "`target` must be numeric or NULL.", + "134fd1b385b8a6521a55eee0bf0f4b4dd213f4a5730358e4c1d2ddf3448df9db": "x must be numeric, not a factor.", + "162ff080ff65d23098201a9597a9098a83603b48685dded1295ddb637f08d2e4": "`x` must be numeric, not a factor.", + "1668cd83c54fdbf26c9b1af6a0187d9df91bf33e3f6a3e062e40ce4d05a4548b": [ + [ + 1.3333333333333333, + 1.3333333333333333 + ], + [ + 1.3333333333333333, + 1.3333333333333333 + ] + ], + "1803723648a8f5ab671173710e44628a39692f7225b475e135e0e086555388b0": "`x` must be numeric, not a factor.", + "19e8d59901b859181e4e22452f0bef7fa805889f1df232dec50d6cc0b42213dc": [ + 0.2, + 0.0 + ], + "1da0c951aab109aa5b3e00e135bbeba46ffe78338f41ba76e30bd585e51ae56b": "cannot xtfrm data frames", + "2410eb3eb04fbb332730d526fd2ed3e923aef9198fc910cc0497c207dcb6d859": "`data` must be finite.", + "245d1222c28e9b31b08745d9c58f1f2d4bf99e77562a91e4dc32d3507fe29cf9": [ + 0.5, + 0.0, + 0.5 + ], + "24b3874f473b04f42d74d7ad2b18de3f320bf9a90e0f4e00191977205eca2070": "`target` must be numeric or NULL.", + "273ad496bb15f2ef4d93cb9a412e366c27c1ff547c773775d7ca0131162fdc46": "`x` must be numeric, not a factor.", + "28bcef2712651320138d5413a98c45f4beaa8756dabd137180418d623faa7185": "`x` must be numeric, not a factor.", + "2b2e8bd3a5fd900c32f69544155f9f1899e71264ff9713b57082cabe8934beb0": "Not compatible with requested type: [type=character; target=double].", + "2e12d11bc4435dc5b255e0599f91538ba9112506582685653e09ca277916a9ed": "`target` must be numeric or NULL.", + "2e593a1aa0b1829ce4ed1e6d95876a4edaa0f3bca3c774ece65a1463e4614522": "'degree' must be a non-negative number", + "34803fc90551ded683daa9975d432478a7932786f19fcbbdb2ba741023bb83b5": "`y` must be numeric, not a factor.", + "3981b141fb9aba39dbc7b05df598d31136a0fa201654d4bd9d83c4e8ea11ae9f": [ + 0.0, + 0.0 + ], + "3ae47cc37d972bba96f4b9ac897fa79a9b6615f9c4dfa001602283467342de1a": "`y` must be numeric, not a factor.", + "3cdb4391e3b65fe5a3da72b8f35121653e1f5acf6f11c0762d6840fc552eef37": "y must be numeric, not a factor.", + "430037f42da21d597bf5e0b84b4526e7f7ea53a9de328310bf711f59f604ea7c": "'degree' must be a non-negative number", + "4366575647eafa3a49b1223b83b3b9c6265fbd604fb888d06fbb383a12cba800": "`target_y` must be finite.", + "4410bce2224899b78273ad6025e09bef8eb50fb9882b10eff8544322d6cb71f3": "'degree' must be a non-negative number", + "4451f24a9f626ff709abb3053a1cba078dd32f9b92d5a17dbeae18034154ab29": "`variable` must be numeric, not a factor.", + "4888e4137d20fa558258799102910e68425c05c4f67741e3047ddfdb22e759f9": "`y` must be numeric, not a factor.", + "4b3a7e1a1f18fb5a3b0257a7f38acd68e292d3822841fe3c63abb08cf707037a": "`x` must be numeric, not a factor.", + "5017823778ea77b7e680371bc1649d84dd051f9b2f3aa729944cc5aaf52c913e": [ + 0.0, + 0.0 + ], + "50e0508c446e768a8d0abfbcc1e436032c75f05c846f28592b2ca5374f1e4be7": "`variable` must be numeric, not a factor.", + "563b20e1c45d11eedea1c25c26b31351a27e5c4b784fee6f958af69a80a4a7e2": "`data` must be finite.", + "5c4e7a8259a4f2c03203b09ed8180cab86d3c53d70732ed2585e56b2a70ffdbb": "`target` must be finite.", + "5d037ac7c28a7a3fb3b33e21c1b5def801b05db402b6df385396ecfe4652f498": "variable matrix cols != target vector length", + "5ed2d7b4c2996cebd58000213d4831325df9012bd9590caa3474662deaeeb4f5": "'degree' must be a non-negative number", + "62212bf4373fdee1f787faee05fa426ac36a35138309eb6a9b231e766472f00e": 0.25, + "62bbe2150ff08b9eb9a71ec754cf074ca0f08b51ea852dd9d5227cd6663eee74": "`variable` must be numeric, not a factor.", + "65c9a49837728ba9452d1d4677383a84994dc742b5550b6da8f045c66be77c0c": 2.25, + "65f0dd9d0ee1c3a02cda778603cf4d3a15712fa630bc017b8e5838f97867ec47": "`target` must be numeric, not a factor.", + "679a64edf532bdb405d7eeaed63badee8f095a38a6c54b178087ff4c7d0d6cef": "`target_y` must be finite.", + "6884d341e66a7eb2712503f385430c5405f3c5f8a783896c5d1bfd951373ffc6": [ + 0.5, + 0.0, + 0.5 + ], + "6b2d9b7525afebc0668b50bf8484772ddea86428092ea65dba1fcdd1292bdd46": "`target_y` must be finite.", + "6c57a0c5b188f734ed60a5e820f47272e4eaf70f6c6b4fd292c4e2899a8d626b": "'degree' must be a non-negative number", + "6d61ad57fcce562e736bd90f39d2df696ca6286d808e4a43654c2dbdd7207580": 1.5, + "6dd1d332d3c34681c888807a313cf72e5ff6d62fe9d76f5f7d3386cb0070815d": "`target` must be finite.", + "6fe86fe859f95fb5e5c50ab4955bb267fef0a855f0692f7635c4dc2ee751ac9b": [ + [ + 0.3333333333333333, + 0.0 + ], + [ + 0.0, + 0.0 + ] + ], + "708e85662b2ee7fe6574f9322c708f2081f27dcafc61516e1198d914498c4c9f": { + "clpm": [ + [ + 0.8333333333333334, + 0.8, + 0.6666666666666666 + ], + [ + 0.8, + 1.0, + 0.6000000000000001 + ], + [ + 0.6666666666666666, + 0.6000000000000001, + 0.5 + ] + ], + "cov.matrix": [ + [ + 1.0, + 0.6000000000000001, + 0.3333333333333333 + ], + [ + 0.6000000000000001, + 1.0, + 0.20000000000000007 + ], + [ + 0.3333333333333333, + 0.20000000000000007, + 1.0 + ] + ], + "cupm": [ + [ + 0.16666666666666669, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.5 + ] + ], + "dlpm": [ + [ + 0.0, + 0.2, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.3333333333333333, + 0.4, + 0.0 + ] + ], + "dupm": [ + [ + 0.0, + 0.0, + 0.3333333333333333 + ], + [ + 0.2, + 0.0, + 0.4 + ], + [ + 0.0, + 0.0, + 0.0 + ] + ] + }, + "711376de4e3fee7db036d2b7fd1777747248895580ea420bd8b0b454cad18cc0": "'degree' must be a non-negative number", + "729fbafc818f1f2d081418b6ce48ee0e4d9221de6ce035f5be5d5f6a287b72ce": 0.25, + "73c5c17159c641a1ffdda65f32574df560f4f7b5029820037f44a6c8315adac7": [ + 0.8, + 0.2 + ], + "7765fe877fee8586712997d2cdc66b0ec373ce77c5c248f6776fe486628f54e1": "`target` must be finite.", + "7c7a0569e369d0e5c8d280fd9e38300205adcd905f162e25f3c0e68a0e37a6fe": "`target` must be numeric, not a factor.", + "7d2a31641a9fe44a263a51201828501804da17c41a56d85d3afeead971fab484": "`target` must be numeric or NULL.", + "80e58f547cf9d5ffc24e289184d395e072469b71ff40d22be757d907fecb04bc": "y must be numeric, not a factor.", + "83c9529ece24444f019bdf58cb68e11b304d56634febd5726ccb27ef0219d6a9": "`target` must be numeric or NULL.", + "87fdb4af06562f9d140fef63c5e19788127a4b1627e5b41866f232207db0a3af": "`x` must be numeric, not a factor.", + "8aa87cf3971a6318a4362a34f91f353dec39f2797b04299c5c61ec738c79b817": "`x` must be numeric, not a factor.", + "8b8d5763fc4d68b455db36d408dadcb7092f8fc9980d11ef271824debc2fdfc0": [ + 0.0, + 0.0 + ], + "92bbdc214b7011e869d2790c858f43eb6f7300e85160f2b2f8216b72b008d02b": "`x` must be numeric, not a factor.", + "9428e5945324fa41c87aa35f6e42692c51748a7c891996f0eb79f4d4305bd546": [ + 0.2, + 0.8 + ], + "9485df3f2cbe340c055cd54663660a5b8fa61d4c2605f54d52360870862ff9a1": "`x` must be numeric, not a factor.", + "9489c5b9ec33d57390014e5de210158115992163b50b041093563fdfe1f1acbd": "`target_y` must be finite.", + "9669199e4366e0b5213f0b482a6426d952da0392ef49b596390f250b916f41d8": "`target` must be numeric or NULL.", + "9c3c80be7078b485be21cb5e3eecbd3fc3f4dcf7a85dab4bb4f0db3b4438f1a7": 1.5, + "9d1717c2732fb22f45136b7a19f2c88fbe4068e89088c5a193cf3c33b0f559ed": [ + 2.0, + 2.6666666666666665 + ], + "9ff4b694b129d3d961c7e4a74c7633b0ba914f4d7dc92556c1f2f3f50692751e": "y must be numeric, not a factor.", + "a761a3090011427c7815b41cd92abeecd63b3f58fa9ceb7f820f9c31261b891c": 2.25, + "a9be9b3c8a1c77f480ba88c5716d1d797e46baca45cfca803179e74ce5ba7051": "`target` must be numeric or NULL.", + "ac7e984343bba17b99a0637e0913b5a5caa32fd7abbad676517863f064a7f061": "`x` must be numeric, not a factor.", + "b234a938bb9ebf53a3cab63bdae8810ea694e1477f183df81ac8155e2c28364b": "`x` must be numeric, not a factor.", + "b5cac0e434ff8ddb8ab1066a50ec75e4588ce99aaec65702de743c75aba1e167": 1.5, + "b684a2a9314172aed49f57e9fd66bbde43df84438e730d8b0ed12ae2d8e3f91b": [ + 0.8, + 1.0 + ], + "b9345db1886f276d26e61f7b6537043b9a5bd92d9e939f6a217de3c2c6715133": [ + 0.6666666666666666, + 2.0 + ], + "bab35b4e4212573deac3600ba72e9b4688b5efac8a314191900ecb850041dba1": "`target` must be numeric or NULL.", + "bbdc80775144788a4dca2b6a767f84086a3eb438dfa7500a3cc23b26fe3047aa": "`target` must be numeric or NULL.", + "bde3309dceb5309cbc681d752da45a1842a546cf3691ab76fce2b895e733b537": [ + [ + 1.3333333333333333, + 1.3333333333333333 + ], + [ + 1.3333333333333333, + 1.3333333333333333 + ] + ], + "bf4cb222fca0e64592bf065532bb034a3bf66604a46551c4fb74f821e381df36": "`target` must be numeric or NULL.", + "bf6938fd3112797f9e91e924988b3fb727322df2a8b6961b5b9dcc8cabf35121": "x must be numeric, not a factor.", + "c1500ea7454ca456c4ad1d0b41085bb7cd2e7c406259a20b493f281b96bd5d1f": "`x` must be numeric, not a factor.", + "c1df859a829ecf6c272385e2fec77aff1e42f0701a695803ac9c9281ec3a5045": "'degree' must be a non-negative number", + "c1e097fc93a3cff60dd597b58044d529e888bd400f19c89901457dc54c6374c8": "`target` must be numeric or NULL.", + "c4175eda067d64795d3bf2a3ce14a4eaf8b124e23dacf461eb1282dce572bb68": [ + [ + 0.3333333333333333, + 1.0 + ], + [ + 1.0, + 3.333333333333333 + ] + ], + "c747582cdf0769f731652bb291825fae997185ccbb4d2dd3393cfc25f18bc93b": "`target` must be finite.", + "c77e89342673d3e609431bb36d9e82d1608c34fbddb6b6aeedd93ce9abefae95": [ + 0.0, + 0.0 + ], + "c93881c8a1741e6c6e7735feb6f2783d13806eca0fc69b3bbdcaacd4dfdca100": "`data` must be finite.", + "ceb440d0140b984ea3da9f47bb441d473e6019999ccb884c857485c3d1238b1d": "`target` must be numeric or NULL.", + "cfc408f45003df33851550a7816ec43b5f0099ce8c4b6b47bc03fb64e84b6821": "x must be numeric, not a factor.", + "d088d9032519cb00917c71e8108cb6c1ff2c674e90e6e582c5c703f4f3881473": [ + 0.6666666666666666, + 0.0 + ], + "d1f53044761e9beb781d921ff564f8b22e8fe2c78ba4ec0dc56c23d98ff05b25": "`y` must be numeric, not a factor.", + "d28ad5a827a2b280a3909c3f8961a7d0eab788da82bb7613eac74d27d1fafd28": "`x` must be numeric, not a factor.", + "d28c8fa3a8165ef9b1fd4595310be2524a4647f673e862f780f0fb7b842eb7cf": "x must be numeric, not a factor.", + "d3bf6090f36f59c5d3c444d1c39e493fac1217956c927b359659424eba2e3230": [ + 0.25, + 0.5, + 0.75, + 1.0, + 0.5 + ], + "d74e4e437abc1e67eca941e8e8da431db188a121502c9498334ae19963a28ed3": "`target` must be numeric or NULL.", + "d7cf922166d9fedebf9b0ac3240036ee9cec95ad88ed86ab8b0a7167f04d97cc": "`target` must be numeric or NULL.", + "dad9074751e3777ec4ebd570e1adbc148aa971a9b89efd0563660843f7f28dff": "`target` must be finite.", + "dafa7dd96ec94e1167dec503c0f042d5e3a94ac33fed6b4057988ce4da38ea27": [ + 2.0, + 0.6666666666666666 + ], + "e05c17f5b19513bce87d898b8948c189995700c637dfd3eae8558753d418dfa6": "`x` must be numeric, not a factor.", + "e10ed023eb5c9582b54feca4e2f35775de09134f4edcbaa51f7e12565b22eab2": "x must be numeric, not a factor.", + "e252d1f9bfa871d0901bbfde3f1972d660a90845c443f7a1592c4f5e8e04d9f1": "`variable` must be numeric, not a factor.", + "e2ca18dcccfeca19b6fc511392fd3080c6d29746c44d00e60508959cbaa8336e": "`target` must be finite.", + "e6efbf135b1a878b4feb8c847e4714b65e8c65094a6cfca052a23036be685f77": "`variable` must be numeric, not a factor.", + "e88318a841068b4c9e76c62b1e5a1506d5e509057c65f85755c5b56df9204cc1": { + "clpm": [ + [ + 0.35714285714285715, + 0.8, + 0.4 + ], + [ + 0.8, + 1.0, + 0.6000000000000001 + ], + [ + 0.4, + 0.6000000000000001, + 0.16666666666666666 + ] + ], + "cov.matrix": [ + [ + 1.0, + 0.6000000000000001, + -0.20000000000000007 + ], + [ + 0.6000000000000001, + 1.0, + 0.20000000000000007 + ], + [ + -0.20000000000000007, + 0.20000000000000007, + 1.0 + ] + ], + "cupm": [ + [ + 0.6428571428571429, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.8333333333333334 + ] + ], + "dlpm": [ + [ + 0.0, + 0.2, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 0.6000000000000001, + 0.4, + 0.0 + ] + ], + "dupm": [ + [ + 0.0, + 0.0, + 0.6000000000000001 + ], + [ + 0.2, + 0.0, + 0.4 + ], + [ + 0.0, + 0.0, + 0.0 + ] + ] + }, + "ee84d590125007c712eb91aaa62f55974b8c711ad8b51734698ecbda0f5db00f": 1.5, + "f2fb98614b7c015002caec1e72fd793cccf77215080d588f4ba9e4480db00584": "`x` must be numeric, not a factor.", + "f86b001958ba0839d97a2448924919e4c6fe95ed050cad847ce5ae02781d8a9e": "`data` must be finite.", + "f88b163bf1ce3a135162f2a596f427934b43cbc0b4b9f368aa4c6cb2aa3f1de8": "y must be numeric, not a factor.", + "f9ceee57418edd06f5c0f70d1d48bd06f27b47bd1616a86cdc84f4a789cbff7f": [ + 0.5, + 0.0, + 0.5 + ], + "fc93541b83a0cc1d4d1701f556bd7a6b47098e31359aae7aaa65c3bb191681c5": "y must be numeric, not a factor.", + "fe9b77cc7b103fa183c3c57a8b9a4cc0702d0661530ea59b667505702aa74f0c": "Not compatible with requested type: [type=character; target=double]." + }, + "label": "pm142", + "nns_version": "14.2", + "schema_version": 2 +} diff --git a/tests/_r_cache/pval14.caus.json b/tests/_r_cache/pval14.caus.json index ed329bfb..64cdcafc 100644 --- a/tests/_r_cache/pval14.caus.json +++ b/tests/_r_cache/pval14.caus.json @@ -147,6 +147,6 @@ } }, "label": "pval14.caus", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pval14.caus_matrix.json b/tests/_r_cache/pval14.caus_matrix.json index 002db650..dac633f7 100644 --- a/tests/_r_cache/pval14.caus_matrix.json +++ b/tests/_r_cache/pval14.caus_matrix.json @@ -212,6 +212,6 @@ } }, "label": "pval14.caus_matrix", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pval14.dep.json b/tests/_r_cache/pval14.dep.json index af529acf..53ee1479 100644 --- a/tests/_r_cache/pval14.dep.json +++ b/tests/_r_cache/pval14.dep.json @@ -30,6 +30,6 @@ } }, "label": "pval14.dep", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/pval14.seas.json b/tests/_r_cache/pval14.seas.json index 79eb4c5e..e80eb3d5 100644 --- a/tests/_r_cache/pval14.seas.json +++ b/tests/_r_cache/pval14.seas.json @@ -44,6 +44,6 @@ } }, "label": "pval14.seas", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.blas.json b/tests/_r_cache/rarith.blas.json index a20a6740..b239efa9 100644 --- a/tests/_r_cache/rarith.blas.json +++ b/tests/_r_cache/rarith.blas.json @@ -68,6 +68,6 @@ ] }, "label": "rarith.blas", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.cor.json b/tests/_r_cache/rarith.cor.json index 53de85c7..834fe6c1 100644 --- a/tests/_r_cache/rarith.cor.json +++ b/tests/_r_cache/rarith.cor.json @@ -38,6 +38,6 @@ ] }, "label": "rarith.cor", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.dep.json b/tests/_r_cache/rarith.dep.json index 77c7a8c6..20e18550 100644 --- a/tests/_r_cache/rarith.dep.json +++ b/tests/_r_cache/rarith.dep.json @@ -58,6 +58,6 @@ ] }, "label": "rarith.dep", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.dhyper.json b/tests/_r_cache/rarith.dhyper.json index 045bd930..7803f948 100644 --- a/tests/_r_cache/rarith.dhyper.json +++ b/tests/_r_cache/rarith.dhyper.json @@ -607,6 +607,6 @@ ] }, "label": "rarith.dhyper", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.dimred.fit.json b/tests/_r_cache/rarith.dimred.fit.json index f670e9c0..a057b597 100644 --- a/tests/_r_cache/rarith.dimred.fit.json +++ b/tests/_r_cache/rarith.dimred.fit.json @@ -604,6 +604,6 @@ ] }, "label": "rarith.dimred.fit", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.dimred.json b/tests/_r_cache/rarith.dimred.json index 0432e283..a3f8ded8 100644 --- a/tests/_r_cache/rarith.dimred.json +++ b/tests/_r_cache/rarith.dimred.json @@ -42,6 +42,6 @@ ] }, "label": "rarith.dimred", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.norm.constant.json b/tests/_r_cache/rarith.norm.constant.json index 8ee53a85..45762dbe 100644 --- a/tests/_r_cache/rarith.norm.constant.json +++ b/tests/_r_cache/rarith.norm.constant.json @@ -20,6 +20,6 @@ ] }, "label": "rarith.norm.constant", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.norm.json b/tests/_r_cache/rarith.norm.json index d5dd1dc2..d53ee94f 100644 --- a/tests/_r_cache/rarith.norm.json +++ b/tests/_r_cache/rarith.norm.json @@ -186,6 +186,6 @@ ] }, "label": "rarith.norm", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.pnorm.json b/tests/_r_cache/rarith.pnorm.json index a6aabab2..5e72d0d0 100644 --- a/tests/_r_cache/rarith.pnorm.json +++ b/tests/_r_cache/rarith.pnorm.json @@ -615,6 +615,6 @@ ] }, "label": "rarith.pnorm", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.quantile7.json b/tests/_r_cache/rarith.quantile7.json index 28784786..c6d974f1 100644 --- a/tests/_r_cache/rarith.quantile7.json +++ b/tests/_r_cache/rarith.quantile7.json @@ -86,6 +86,6 @@ ] }, "label": "rarith.quantile7", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.quantile8.json b/tests/_r_cache/rarith.quantile8.json index eefcd21f..37221a27 100644 --- a/tests/_r_cache/rarith.quantile8.json +++ b/tests/_r_cache/rarith.quantile8.json @@ -86,6 +86,6 @@ ] }, "label": "rarith.quantile8", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round-1.json b/tests/_r_cache/rarith.round-1.json index e956b65a..3b41b46b 100644 --- a/tests/_r_cache/rarith.round-1.json +++ b/tests/_r_cache/rarith.round-1.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round-1", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round1.json b/tests/_r_cache/rarith.round1.json index e6139865..919bacfe 100644 --- a/tests/_r_cache/rarith.round1.json +++ b/tests/_r_cache/rarith.round1.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round1", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round12.json b/tests/_r_cache/rarith.round12.json index 831f6b4d..8968746c 100644 --- a/tests/_r_cache/rarith.round12.json +++ b/tests/_r_cache/rarith.round12.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round12", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round2.json b/tests/_r_cache/rarith.round2.json index 221bc5c9..f61a5f89 100644 --- a/tests/_r_cache/rarith.round2.json +++ b/tests/_r_cache/rarith.round2.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round2", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round3.json b/tests/_r_cache/rarith.round3.json index c2149070..5b34a0e0 100644 --- a/tests/_r_cache/rarith.round3.json +++ b/tests/_r_cache/rarith.round3.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round3", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.round6.json b/tests/_r_cache/rarith.round6.json index 7f56352c..72a22c10 100644 --- a/tests/_r_cache/rarith.round6.json +++ b/tests/_r_cache/rarith.round6.json @@ -1504,6 +1504,6 @@ ] }, "label": "rarith.round6", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.seq.json b/tests/_r_cache/rarith.seq.json index 7ff1d4ee..b5021ee9 100644 --- a/tests/_r_cache/rarith.seq.json +++ b/tests/_r_cache/rarith.seq.json @@ -265,6 +265,6 @@ ] }, "label": "rarith.seq", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/rarith.summaries.json b/tests/_r_cache/rarith.summaries.json index 653069b2..f9a52fc4 100644 --- a/tests/_r_cache/rarith.summaries.json +++ b/tests/_r_cache/rarith.summaries.json @@ -268,6 +268,6 @@ ] }, "label": "rarith.summaries", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/reg14.dimred.class.meta.json b/tests/_r_cache/reg14.dimred.class.meta.json index 42721bca..bd0024c6 100644 --- a/tests/_r_cache/reg14.dimred.class.meta.json +++ b/tests/_r_cache/reg14.dimred.class.meta.json @@ -67,6 +67,6 @@ } }, "label": "reg14.dimred.class.meta", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/reg14.mvcall.class.json b/tests/_r_cache/reg14.mvcall.class.json index 4f437c0e..a699cf46 100644 --- a/tests/_r_cache/reg14.mvcall.class.json +++ b/tests/_r_cache/reg14.mvcall.class.json @@ -36,6 +36,6 @@ } }, "label": "reg14.mvcall.class", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/reg14.nbest.na.json b/tests/_r_cache/reg14.nbest.na.json index 6be66643..64e2af7c 100644 --- a/tests/_r_cache/reg14.nbest.na.json +++ b/tests/_r_cache/reg14.nbest.na.json @@ -9,6 +9,6 @@ ] }, "label": "reg14.nbest.na", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/reg14.threshold.class.json b/tests/_r_cache/reg14.threshold.class.json index b1c6d115..dffca2bf 100644 --- a/tests/_r_cache/reg14.threshold.class.json +++ b/tests/_r_cache/reg14.threshold.class.json @@ -23,6 +23,6 @@ } }, "label": "reg14.threshold.class", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/reg14.threshold.na.json b/tests/_r_cache/reg14.threshold.na.json index 69a54b90..a57e2799 100644 --- a/tests/_r_cache/reg14.threshold.na.json +++ b/tests/_r_cache/reg14.threshold.na.json @@ -30,6 +30,6 @@ ] }, "label": "reg14.threshold.na", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/sd14.cluster_min.json b/tests/_r_cache/sd14.cluster_min.json index 5805161c..81976880 100644 --- a/tests/_r_cache/sd14.cluster_min.json +++ b/tests/_r_cache/sd14.cluster_min.json @@ -24,6 +24,6 @@ } }, "label": "sd14.cluster_min", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/sd14.efficient_order.json b/tests/_r_cache/sd14.efficient_order.json index 4ceec4ac..6cb7da66 100644 --- a/tests/_r_cache/sd14.efficient_order.json +++ b/tests/_r_cache/sd14.efficient_order.json @@ -18,6 +18,6 @@ ] }, "label": "sd14.efficient_order", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/sd14.matrix_infinite.json b/tests/_r_cache/sd14.matrix_infinite.json index 99cf7e08..9440eaa3 100644 --- a/tests/_r_cache/sd14.matrix_infinite.json +++ b/tests/_r_cache/sd14.matrix_infinite.json @@ -1,24 +1,7 @@ { "entries": { - "0a2798877c8efe28b92d79ccc1326014a340a4eeee78af54034f9f5b14b01969": { - "clu": { - "Cluster_1": [ - "X_2", - "X_3", - "X_4" - ], - "Cluster_2": [ - "X_1", - "X_6" - ], - "Cluster_3": "X_5" - }, - "eff": [ - "X_2", - "X_3", - "X_4" - ] - }, + "073b3a71aba0cd7e92ad8c0afff446e96af1a6544aada266957530b222332e8f": "You have some infinite values, please address.", + "44abc70544464932cae7ee30e468bd6b648385b2c001637541eb01e5c1a31b55": "You have some infinite values, please address.", "663342d8ecaac9220f4be8aa03004719513e3d8b43bbb657c6d6ebe96915538a": { "clu": { "Cluster_1": [ @@ -39,28 +22,12 @@ "X_5" ] }, - "ac5b7841c9e5575bc7baacf64274b4645a25286269dfae574514843473079b39": { - "clu": { - "Cluster_1": [ - "X_2", - "X_3", - "X_4", - "X_5" - ], - "Cluster_2": [ - "X_1", - "X_6" - ] - }, - "eff": [ - "X_2", - "X_3", - "X_4", - "X_5" - ] - } + "b735b811e5cdf83a7c9fbf1053d9ab7696dc66ac2487f2cdfd4cf4d776280d1b": "You have some infinite values, please address.", + "c82aea1027609a42ea198d2d6e15cd47888b2ec541d2b7c20974af550963162f": "You have some infinite values, please address.", + "e8c56b6fe24ce8861122de1271803bf964e38c21b0e5c978bd7dc748d2792016": "You have some infinite values, please address.", + "f12c14d5a27580c861fd8eda2ca1daa507146d0dcc6253518e45192043b55da1": "You have some infinite values, please address." }, "label": "sd14.matrix_infinite", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/sd14.uni_infinite.json b/tests/_r_cache/sd14.uni_infinite.json index e590d95f..325b1876 100644 --- a/tests/_r_cache/sd14.uni_infinite.json +++ b/tests/_r_cache/sd14.uni_infinite.json @@ -1,37 +1,22 @@ { "entries": { - "6d6bbd534d527e6ab65a5c1945bafe2d9a2d6818bab8c1b093fa485f50e30343": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, + "318717c01720912e7c06559f883d304593a1b5c80fe0eff332bf3268757f0bf4": [ 0.0, 0.0 ], - "aed46358a9029a961039712b2a96853759ee61d94f212f17d55a3e253f526b13": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, + "3dc2c04267783b0abec1065c7bf40143365dfa0b03c6faaa7d51bb8f06a9712b": "You have some infinite values, please address.", + "6f5a1d5c194947c8d1c6f60895dba46b7b33d29858261e46dd24f8cd7d931a53": [ 0.0, 0.0 ], - "d0642d9cd4e0eff0b6870212762e71b9aff8dbea5795aff8ac30a9dbf0c38509": [ - 0.0, - 0.0, - 1.0, - 0.0, - 0.0, - 0.0, + "7221d6d21b172b9af615576e00cd9273e0bc0578dcafc22c288aa9bda4776e1e": "You have some infinite values, please address.", + "8459a57edd513e4cee56e0666205d1707c33c86cdfbb6a7697b4645e2c0edf72": "You have some infinite values, please address.", + "d14337e05605f26072dd04e358d655fc35586390407801e20069ed436fff4a12": [ 0.0, 0.0 ] }, "label": "sd14.uni_infinite", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/smspl14.dydx.json b/tests/_r_cache/smspl14.dydx.json index 45b51315..e4a93eda 100644 --- a/tests/_r_cache/smspl14.dydx.json +++ b/tests/_r_cache/smspl14.dydx.json @@ -14,6 +14,6 @@ } }, "label": "smspl14.dydx", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/smspl14.fit.json b/tests/_r_cache/smspl14.fit.json index eb057018..8a522e11 100644 --- a/tests/_r_cache/smspl14.fit.json +++ b/tests/_r_cache/smspl14.fit.json @@ -1094,6 +1094,6 @@ } }, "label": "smspl14.fit", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/smspl14.mreg_names.json b/tests/_r_cache/smspl14.mreg_names.json index 0fc951d7..8c361e0b 100644 --- a/tests/_r_cache/smspl14.mreg_names.json +++ b/tests/_r_cache/smspl14.mreg_names.json @@ -25,6 +25,6 @@ } }, "label": "smspl14.mreg_names", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/smspl14.reg.json b/tests/_r_cache/smspl14.reg.json index e6921451..38e9e9b1 100644 --- a/tests/_r_cache/smspl14.reg.json +++ b/tests/_r_cache/smspl14.reg.json @@ -162,6 +162,6 @@ } }, "label": "smspl14.reg", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/solve14.bits.json b/tests/_r_cache/solve14.bits.json index 08ec0811..dc8748f1 100644 --- a/tests/_r_cache/solve14.bits.json +++ b/tests/_r_cache/solve14.bits.json @@ -46,6 +46,6 @@ ] }, "label": "solve14.bits", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/stack14.blend.json b/tests/_r_cache/stack14.blend.json index b40e675c..4570faa4 100644 --- a/tests/_r_cache/stack14.blend.json +++ b/tests/_r_cache/stack14.blend.json @@ -78,6 +78,6 @@ } }, "label": "stack14.blend", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/stack14.class.balanced.json b/tests/_r_cache/stack14.class.balanced.json index 271630ad..3468dc21 100644 --- a/tests/_r_cache/stack14.class.balanced.json +++ b/tests/_r_cache/stack14.class.balanced.json @@ -302,6 +302,6 @@ } }, "label": "stack14.class.balanced", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/var14.bits.json b/tests/_r_cache/var14.bits.json index bbc75387..0bf5b9e3 100644 --- a/tests/_r_cache/var14.bits.json +++ b/tests/_r_cache/var14.bits.json @@ -398,6 +398,6 @@ ] }, "label": "var14.bits", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/_r_cache/var14.validation.json b/tests/_r_cache/var14.validation.json index 2205cd2a..32eedd31 100644 --- a/tests/_r_cache/var14.validation.json +++ b/tests/_r_cache/var14.validation.json @@ -40,6 +40,6 @@ } }, "label": "var14.validation", - "nns_version": "14.0", + "nns_version": "14.2", "schema_version": 2 } diff --git a/tests/invariants/test_co_moments.py b/tests/invariants/test_co_moments.py index 25e483c6..688a8c31 100644 --- a/tests/invariants/test_co_moments.py +++ b/tests/invariants/test_co_moments.py @@ -95,21 +95,21 @@ def test_co_moments_and_pm_matrix_reject_non_finite_input() -> None: x = np.array([1.0, 2.0, 3.0, np.nan, 5.0]) finite = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) for function in (co_lpm, co_upm): - with pytest.raises(ValueError, match="x must contain only finite values"): + with pytest.raises(ValueError, match="`x` must be finite"): function(0, x, finite, 6.0, 6.0) - with pytest.raises(ValueError, match="y must contain only finite values"): + with pytest.raises(ValueError, match="`y` must be finite"): function(0, finite, x, 6.0, 6.0) - with pytest.raises(ValueError, match="target_x must contain only finite values"): + with pytest.raises(ValueError, match="`target_x` must be finite"): function(0, finite, finite, np.nan, 6.0) for function in (d_lpm, d_upm): - with pytest.raises(ValueError, match="x must contain only finite values"): + with pytest.raises(ValueError, match="`x` must be finite"): function(1, 1, x, finite, 0.0, 0.0) - with pytest.raises(ValueError, match="target_y must contain only finite values"): + with pytest.raises(ValueError, match="`target_y` must be finite"): function(1, 1, finite, finite, 0.0, np.inf) - with pytest.raises(ValueError, match="variable must contain only finite values"): + with pytest.raises(ValueError, match="`variable` must be finite"): pm_matrix(1, 1, None, np.column_stack([x, finite]), pop_adj=False) - with pytest.raises(ValueError, match="target must contain only finite values"): - pm_matrix(1, 1, np.nan, np.column_stack([finite, finite]), pop_adj=False) + with pytest.raises(ValueError, match="`target` must be finite"): + pm_matrix(1, 1, [np.nan, np.nan], np.column_stack([finite, finite]), pop_adj=False) @pytest.mark.parametrize("degree", [np.nan, -1.0]) diff --git a/tests/invariants/test_core.py b/tests/invariants/test_core.py index 9f759cc0..c269f608 100644 --- a/tests/invariants/test_core.py +++ b/tests/invariants/test_core.py @@ -169,9 +169,9 @@ def test_partial_moment_ratios_reject_non_finite_targets(function: object) -> No # Patched R: LPM.ratio/UPM.ratio stop on a non-finite target or variable. x = np.array([1.0, 2.0, 3.0]) for target in (np.nan, np.array([1.0, np.inf])): - with pytest.raises(ValueError, match="target must contain only finite values"): + with pytest.raises(ValueError, match="`target` must be finite"): function(1, target, x) # type: ignore[operator] - with pytest.raises(ValueError, match="x must contain only finite values"): + with pytest.raises(ValueError, match="`variable` must be finite"): function(0, 2.0, np.array([1.0, np.nan])) # type: ignore[operator] diff --git a/tests/invariants/test_pm_matrix.py b/tests/invariants/test_pm_matrix.py index 1f6b062e..53bab5bb 100644 --- a/tests/invariants/test_pm_matrix.py +++ b/tests/invariants/test_pm_matrix.py @@ -10,7 +10,7 @@ def test_pm_matrix_reconstructs_cov_matrix() -> None: variable = _variable() - result = pm_matrix(2, 3, 0.0, variable, pop_adj=True) + result = pm_matrix(2, 3, np.zeros(variable.shape[1]), variable, pop_adj=True) np.testing.assert_allclose( result["clpm"] + result["cupm"] - result["dlpm"] - result["dupm"], diff --git a/tests/invariants/test_r14_shared_paths.py b/tests/invariants/test_r14_shared_paths.py index 3b4eee51..58170480 100644 --- a/tests/invariants/test_r14_shared_paths.py +++ b/tests/invariants/test_r14_shared_paths.py @@ -89,8 +89,14 @@ def test_native_r14_overlays_have_separate_source_provenance() -> None: root = Path(__file__).resolve().parents[2] manifest = json.loads((root / "sync/nns_source.json").read_text()) - assert manifest["r_version"] == "14.0" - assert len(manifest["r14_native_overlays"]) == 4 + from _r import _NNS_VERSION + + summary = manifest["r_cache_summary"] + shards = list((root / manifest["r_cache_path"]).glob("*.json")) + assert manifest["r_version"] == summary["nns_version"] == _NNS_VERSION + assert summary["shards"] == len(shards) + assert summary["entries"] == sum(len(json.loads(p.read_text())["entries"]) for p in shards) + assert len(manifest["r14_native_overlays"]) == 5 for overlay in manifest["r14_native_overlays"]: # Each overlay names the R commit its source was ported from and the # pinned oracle it was verified against bit for bit. diff --git a/tests/parity/test_partial_moments_r142.py b/tests/parity/test_partial_moments_r142.py new file mode 100644 index 00000000..be492552 --- /dev/null +++ b/tests/parity/test_partial_moments_r142.py @@ -0,0 +1,367 @@ +from __future__ import annotations + +from datetime import date +from decimal import Decimal +from fractions import Fraction + +import numpy as np +import pandas as pd +import pytest +from _r import nns_frame_call + +import nns +from nns._native import native_fn +from nns.cdf import _co_lpm_nd_batch + +pytestmark = pytest.mark.parity + + +def oracle(expr): + return nns_frame_call("pm142", expr, {}, exact=True) + + +def error(expr): + return oracle(f"tryCatch({expr}, error = conditionMessage)") + + +@pytest.mark.parametrize("name", ["lpm", "upm"]) +def test_scalar_target_coercion(name): + fn = getattr(nns, name) + r = name.upper() + x = [1, 2, 3, 10] + for target, rt in [(None, "NULL"), ("2", "'2'")]: + for excess in (False, True): + assert fn(1, target, x, excess) == oracle( + f"{r}(1, {rt}, c(1,2,3,10), {str(excess).upper()})" + ) + for target, rt in [("bad", "'bad'"), (pd.Categorical([2]), "factor(2)")]: + msg = error(f"{r}(1, {rt}, c(1,2,3,10))") + for excess in (False, True): + with pytest.raises(ValueError) as caught: + fn(1, target, x, excess) + assert str(caught.value) == msg + + +@pytest.mark.parametrize( + ("name", "r"), + [ + ("lpm_ratio", "LPM.ratio"), + ("upm_ratio", "UPM.ratio"), + ("co_lpm", "Co.LPM"), + ("co_upm", "Co.UPM"), + ("d_lpm", "D.LPM"), + ("d_upm", "D.UPM"), + ("pm_matrix", "PM.matrix"), + ], +) +def test_typed_targets(name, r): + fn = getattr(nns, name) + x = [0, 2, 4] + matrix = np.column_stack((x, x)) + + def args(t, rt): + if name == "pm_matrix": + return (1, 1, t, matrix, False), f"1, 1, {rt}, cbind(x,x), FALSE" + if name.endswith("ratio"): + return (1, t, x), f"1, {rt}, x" + degrees = (1, 1) if name.startswith("d_") else (1,) + return (*degrees, x, x, None, t), f"{'1, ' * len(degrees)}x, x, NULL, {rt}" + + for t, rt in [ + ([True, False], "c(TRUE,FALSE)"), + (np.array([1, 3]), "c(1L,3L)"), + ([Decimal("1"), Decimal("3")], "c(1L,3L)"), + (np.array([Fraction(1), Fraction(3)], dtype=object), "c(1L,3L)"), + ([date(1970, 1, 2), date(1970, 1, 4)], "c(1L,3L)"), + ([pd.Timestamp(1, unit="ns"), pd.Timestamp(3, unit="ns")], "c(1L,3L)"), + (np.array(["1970-01-02", "1970-01-04"], dtype="datetime64[D]"), "c(1L,3L)"), + ]: + actual, rexpr = args(t, rt) + result = fn(*actual) + suffix = "$clpm" if name == "pm_matrix" else "" + expected = oracle(f"x <- c(0,2,4); {r}({rexpr}){suffix}") + np.testing.assert_array_equal(result["clpm"] if name == "pm_matrix" else result, expected) + + for t, rt in [("2", "'2'"), (pd.Categorical([2]), "factor(2)"), ([1, np.nan], "c(1,NA)")]: + actual, rexpr = args(t, rt) + expected = error(f"{{x <- c(0,2,4); {r}({rexpr})}}") + with pytest.raises(ValueError) as caught: + fn(*actual) + assert str(caught.value) == expected + if name == "pm_matrix": + with pytest.raises(ValueError) as caught: + fn(1, 1, [True], matrix, False) + assert str(caught.value) == error("PM.matrix(1,1,TRUE,cbind(1:3,1:3),FALSE)") + for alias in ("mean", "means"): + expected = oracle(f"x <- c(0,2,4); PM.matrix(1,1,'{alias}',cbind(x,x),FALSE)$clpm") + np.testing.assert_array_equal(fn(1, 1, alias, matrix, False)["clpm"], expected) + + +@pytest.mark.parametrize( + ("name", "r", "arguments"), + [ + ("lpm", "LPM", (1, 2, "f")), + ("upm", "UPM", (1, 2, "f")), + ("lpm_ratio", "LPM.ratio", (1, 2, "f")), + ("upm_ratio", "UPM.ratio", (1, 2, "f")), + ("nns_moments", "NNS.moments", ("f",)), + ("nns_cdf", "NNS.CDF", ("f",)), + ("lpm_var", "LPM.VaR", (0.5, 1, "f")), + ("upm_var", "UPM.VaR", (0.5, 1, "f")), + ("lpm_var", "LPM.VaR", (0.5, 1, "tbl")), + ("upm_var", "UPM.VaR", (0.5, 1, "tbl")), + *( + (name, r, args) + for name, r, deg in [ + ("co_lpm", "Co.LPM", (1,)), + ("co_upm", "Co.UPM", (1,)), + ("d_lpm", "D.LPM", (1, 1)), + ("d_upm", "D.UPM", (1, 1)), + ] + for args in [(*deg, "f", "x", 2, 2), (*deg, "x", "f", 2, 2)] + ), + *( + (name, r, args) + for name, r in [ + ("fsd", "NNS.FSD"), + ("ssd", "NNS.SSD"), + ("tsd", "NNS.TSD"), + ("fsd_uni", "NNS.FSD.uni"), + ("ssd_uni", "NNS.SSD.uni"), + ("tsd_uni", "NNS.TSD.uni"), + ] + for args in [("x", "f"), ("f", "x")] + ), + ], +) +def test_factor_data(name, r, arguments): + x = [10, 20, 30] + f = pd.Categorical(x) + values = {"x": x, "f": f, "tbl": pd.DataFrame({"a": x, "b": f})} + setup = "x <- c(10,20,30); f <- factor(x)" + if "tbl" in arguments: + setup += "; tbl <- structure(data.frame(a=x,b=f), class=c('data.table','data.frame'))" + expected = error(f"{{{setup}; {r}({','.join(map(str, arguments))})}}") + with pytest.raises(ValueError) as caught: + getattr(nns, name)(*(values.get(a, a) for a in arguments)) + assert str(caught.value) == expected + + +@pytest.mark.parametrize( + ("target", "x"), + [ + ( + np.datetime64("2020-01-02", "ns"), + np.arange("2020-01-01", "2020-01-04", dtype="datetime64[D]").astype("datetime64[ns]"), + ), + (np.datetime64("1970-01-01T00:00:02"), [0, 2, 4]), + (pd.Timestamp(2, unit="ns"), [0, 2, 4]), + (pd.Timestamp(np.datetime64("1970-01-01T00:00:02", "s")), [0, 2, 4]), + (date(1970, 1, 3), [0, 2, 4]), + ], +) +def test_datetime_target_uses_its_own_unit(target, x): + assert nns.lpm_ratio(1, target, x) == 0.5 + + +@pytest.mark.parametrize("target", [[1.0, None], [Decimal("1"), None]]) +def test_missing_numeric_target(target): + expected = error("LPM.ratio(1,c(1,NA),c(0,2,4))") + with pytest.raises(ValueError) as caught: + nns.lpm_ratio(1, target, [0, 2, 4]) + assert str(caught.value) == expected + + +@pytest.mark.parametrize("alias", [["mean"], pd.Series(["mean"]), pd.Series(["mean"], index=[0])]) +def test_matrix_unnamed_mean_alias(alias): + expected = nns.pm_matrix(1, 1, None, np.eye(2), False) + actual = nns.pm_matrix(1, 1, alias, np.eye(2), False) + for key in expected: + np.testing.assert_array_equal(actual[key], expected[key]) + + +def test_numeric_frame_is_not_a_matrix_target(): + with pytest.raises(ValueError) as caught: + nns.pm_matrix(1, 1, pd.DataFrame({"a": [1, 2]}), np.eye(2), False) + assert str(caught.value) == error("PM.matrix(1,1,data.frame(a=1:2),diag(2),FALSE)") + + +@pytest.mark.parametrize( + ("fn", "r", "args"), + [ + (nns.pm_matrix, "PM.matrix(1,1,'mean',f,FALSE)", lambda f: (1, 1, "mean", f, False)), + (nns.nns_cdf, "NNS.CDF(f,0,plot=FALSE)", lambda f: (f,)), + (nns.nns_cdf, "NNS.CDF(f[,2,drop=FALSE],0,plot=FALSE)", lambda f: (f[["b"]],)), + (nns.co_lpm_nd, "Co.LPM_nD(f,c(2,2),1)", lambda f: (f, [2, 2], 1)), + (nns.co_upm_nd, "Co.UPM_nD(f,c(2,2),1)", lambda f: (f, [2, 2], 1)), + (nns.dpm_nd, "DPM_nD(f,c(2,2),1)", lambda f: (f, [2, 2], 1)), + (nns.sd_efficient_set, "NNS.SD.efficient.set(f,1)", lambda f: (f, 1)), + (nns.nns_sd_cluster, "NNS.SD.cluster(f)", lambda f: (f,)), + ], +) +def test_factor_column(fn, r, args): + values = [10, 20, 30] + frame = pd.DataFrame({"a": values, "b": pd.Categorical(values)}) + expected = error(f"{{x <- c(10,20,30); f <- data.frame(a=x,b=factor(x)); {r}}}") + with pytest.raises(ValueError) as caught: + fn(*args(frame)) + assert str(caught.value) == expected + + +def test_cluster_skips_factor_check_without_an_efficient_set_search(): + frame = pd.DataFrame({"a": [1, 2], "b": pd.Categorical(["low", "high"])}) + assert nns.nns_sd_cluster(frame, min_cluster=2)["Clusters"] == {"Cluster_1": ["a", "b"]} + + +@pytest.mark.parametrize( + ("fn", "r"), + [(nns.co_lpm_nd, "Co.LPM_nD"), (nns.co_upm_nd, "Co.UPM_nD"), (nns.dpm_nd, "DPM_nD")], +) +@pytest.mark.parametrize(("degree", "rd"), [(-1, "-1"), (np.nan, "NaN")]) +def test_nd_rejects_invalid_degree(fn, r, degree, rd): + expected = error(f"{r}(diag(2),c(2,2),{rd})") + with pytest.raises(ValueError) as caught: + fn(np.eye(2), [2, 2], degree) + assert str(caught.value) == expected + + +def test_cumulative_hazard_rejects_negative_degree(): + expected = error("NNS.CDF(diag(2),-1,type='cumulative hazard',plot=FALSE)") + with pytest.raises(ValueError) as caught: + nns.nns_cdf(np.eye(2), -1, type="cumulative hazard") + assert str(caught.value) == expected + + +@pytest.mark.parametrize("degree", [0.5, 1, 2]) +def test_zero_total_quadrants(degree): + x = np.column_stack(([-1, 0, 1, 2], [5] * 4)) + t = np.array([0.0, 5.0]) + expected = oracle( + f"X <- cbind(c(-1,0,1,2),5); t <- c(0,5); d <- {degree}; " + "c(Co.LPM_nD(X,t,d), Co.UPM_nD(X,t,d), DPM_nD(X,t,d))" + ) + for name, key, value in zip( + ("co_lpm_nd", "co_upm_nd", "dpm_nd"), + ("clpm_nd", "cupm_nd", "dpm_nd"), + expected, + strict=True, + ): + assert getattr(nns, name)(x, t, degree) == value + assert getattr(nns, name)(x, t, degree, False) == 0 + native = native_fn(key) + if native: + assert native(x.ravel(order="F").astype(float), 4, 2, t, degree, True) == value + + +@pytest.mark.parametrize("kind", ["CDF", "survival"]) +def test_zero_total_cdf_and_survival(kind): + x = np.array([[-1, -1], [0, 0], [1, 1], [2, 1]]) * 1e-200 + expected = oracle( + "X <- cbind(c(-1,0,1,2),c(-1,0,1,1)) * 1e-200; " + f"a <- NNS.CDF(X, 1, c(0,0), '{kind}', FALSE); c(a$Function$CDF, a$target.value)" + ) + upper = kind == "survival" + moment = nns.co_upm_nd if upper else nns.co_lpm_nd + t = np.zeros(2) + assert moment(x, t, 1) == expected[-1] + native = native_fn("cupm_nd" if upper else "clpm_nd") + if native: + assert native(x.ravel(order="F"), 4, 2, t, 1, True) == expected[-1] + actual = nns.nns_cdf(x, 1, [0, 0], type=kind) + np.testing.assert_array_equal( + np.r_[actual["Function"]["CDF"], actual["target.value"]], expected + ) + + +@pytest.mark.parametrize("degrees", [(1, 1), (0.5, 2), (1, 0)]) +def test_zero_total_matrix_cells(degrees): + x = np.column_stack(([1, 2, 5, 0, 2], [2] * 5, [4, 0, 1, 0, 2])) + expected = oracle( + f"PM.matrix({degrees[0]},{degrees[1]},c(2,2,1)," + "cbind(c(1,2,5,0,2),2,c(4,0,1,0,2)),TRUE,TRUE)" + ) + for key, value in nns.pm_matrix(*degrees, [2, 2, 1], x, True, True).items(): + np.testing.assert_array_equal(value, expected[key]) + + +@pytest.mark.parametrize("alias", [pd.Series(["mean"], index=["cutoff"]), pd.Categorical(["mean"])]) +def test_matrix_rejects_named_and_factor_aliases(alias): + with pytest.raises(ValueError, match="must be numeric"): + nns.pm_matrix(1, 1, alias, np.eye(2), False) + + +def test_matrix_target_shape_and_broadcast(): + x = np.arange(12).reshape(3, 4) + for target, expected in [ + (Decimal("2"), [2] * 4), + (np.datetime64("1970-01-03"), [2] * 4), + (np.array([[1, 3], [2, 4]]), [1, 2, 3, 4]), + ]: + actual = nns.pm_matrix(1, 1, target, x, False) + for key, value in nns.pm_matrix(1, 1, expected, x, False).items(): + np.testing.assert_array_equal(actual[key], value) + with pytest.raises(ValueError, match="cols != target vector length"): + nns.pm_matrix(1, 1, np.array([[1]]), x, False) + + +@pytest.mark.parametrize(("fn", "r"), [(nns.lpm_var, "LPM.VaR"), (nns.upm_var, "UPM.VaR")]) +@pytest.mark.parametrize( + ("labels", "r_labels"), + [([], "integer(0)"), ([30], "30"), ([None], "NA"), ([10, 30], "c(10,30)")], +) +def test_var_factor_column(fn, r, labels, r_labels): + factor = pd.Categorical(labels, categories=[10, 30]) + frame = pd.DataFrame({"a": [10] * len(labels), "b": factor}) + expected = error( + f"{r}(0.5,1,data.frame(a=rep(10,{len(labels)}),b=factor({r_labels},levels=c(10,30))))" + ) + with pytest.raises(ValueError) as caught: + fn(0.5, 1, frame) + assert str(caught.value) == expected + + +@pytest.mark.parametrize("excess", [False, True]) +def test_nonfinite_target_before_degree(excess): + with pytest.raises(ValueError, match=r"target.*must be finite"): + nns.lpm(-1, np.inf, [1, 3], excess) + + +def test_validation_order(): + factor = pd.Categorical([1, 3]) + bad = np.array([[1, 1], [3, np.inf]]) + for fn, args, error in [ + (nns.lpm_ratio, (-1, 2, factor), "degree"), + (nns.lpm_ratio, (0, "2", [1, np.inf]), "target.*must be numeric"), + (nns.lpm_ratio, (0, np.datetime64("NaT", "ns"), [1, 3]), "target.*must be finite"), + (nns.co_lpm, (-1, factor, [1, 3], 2, 2), "degree"), + (nns.co_lpm, (0, [1], [1, 3], "2", 2), "target.*must be numeric"), + (nns.co_lpm, (0, [1, np.inf], [1, 3], [], 2), "target.*empty"), + (nns.pm_matrix, (0, 0, [2], bad, False), "cols != target vector length"), + (nns.pm_matrix, (0, 0, "wrong", bad, False), "target.*must be numeric"), + (nns.nns_cdf, (factor, 0, None, "bad"), "factor"), + (nns.nns_cdf, ([1, 3], 0, 7, "bad"), "out of bounds"), + (nns.nns_cdf, (np.eye(2), 0, [7, 7], "hazard"), "out of bounds"), + (nns.nns_cdf, ([1, np.inf], 0, None, "bad"), "invalid type"), + (nns.nns_cdf, (bad, 0, None, "bad"), "invalid type"), + (nns.co_lpm_nd, (bad, [2]), "data.*must be finite"), + (nns.co_lpm_nd, (np.eye(2), [np.inf]), "target.*must be finite"), + ]: + with pytest.raises(ValueError, match=error): + fn(*args) + with pytest.warns(UserWarning, match="type needs"), pytest.raises(ValueError): + nns.fsd_uni([], [1, 3], type="bad") + + +def test_batch_degree_zero_tie(): + x = np.array([[1.0]]) + np.testing.assert_array_equal(_co_lpm_nd_batch(x, x, 0, strict=True), [0]) + np.testing.assert_array_equal(_co_lpm_nd_batch(x, x, 0), [1]) + + +def test_native_batch_raw(): + batch = native_fn("clpm_nd_batch") + if batch is None: + pytest.skip("raw batch requires the native backend") + args = (np.array([0.0, 4.0]), 2, 1, np.array([1.0]), 1, 1.0) + np.testing.assert_array_equal(batch(*args, False), [0.5]) + np.testing.assert_array_equal(batch(*args, True), [0.25]) diff --git a/tests/parity/test_pm_matrix.py b/tests/parity/test_pm_matrix.py index 46172fba..7752651e 100644 --- a/tests/parity/test_pm_matrix.py +++ b/tests/parity/test_pm_matrix.py @@ -73,7 +73,7 @@ def _variable(t_obs: int, n_variables: int) -> np.ndarray: def _target(target_kind: str, variable: np.ndarray) -> tuple[PMTarget, object]: if target_kind == "zero": - return 0.0, [0.0] * variable.shape[1] + return np.zeros(variable.shape[1]), [0.0] * variable.shape[1] if target_kind == "mean": return "mean", None return np.linspace(-0.25, 0.25, variable.shape[1]), np.linspace( diff --git a/tests/parity/test_stochastic_dominance_r14.py b/tests/parity/test_stochastic_dominance_r14.py index fec06c9e..83acd2e3 100644 --- a/tests/parity/test_stochastic_dominance_r14.py +++ b/tests/parity/test_stochastic_dominance_r14.py @@ -1,12 +1,10 @@ -"""R 14.0 parity for the stochastic-dominance contracts beyond the pairwise verdict. +"""R 14 parity for the stochastic-dominance contracts beyond the pairwise verdict. * ``NNS.SD.efficient.set`` lists its columns by ``LPM(degree, max, column)``, which R's C++ forms by repeated multiplication and a row-order sum; columns whose keys tie in exact arithmetic (permutations, duplicates) keep their tie and R's index tie break. -* R's ``.uni`` tests, efficient set and SD clustering accept infinite values - (only ``NNS.FSD``/``NNS.SSD``/``NNS.TSD`` reject them, through the plotted - partial-moment curves), comparing them as R's C++ does. +* Discrete first-order comparisons accept infinite values. * Inputs are validated in R's order and with R's messages, and ``NNS.SD.cluster`` compares ``min_cluster`` as a real number. """ @@ -71,9 +69,7 @@ def test_uni_tests_compare_infinite_values_as_r_does(x_inf: str, y_inf: str) -> ) expected = nns_frame_call( "sd14.uni_infinite", - setup + "c(NNS.FSD.uni(x, y), NNS.FSD.uni(y, x), " - "NNS.FSD.uni(x, y, type = 'continuous'), NNS.FSD.uni(y, x, type = 'continuous'), " - "NNS.SSD.uni(x, y), NNS.SSD.uni(y, x), NNS.TSD.uni(x, y), NNS.TSD.uni(y, x))", + setup + "c(NNS.FSD.uni(x, y), NNS.FSD.uni(y, x))", { "xv": _num(np.where(np.isfinite(x), x, 0.0)), "yv": _num(np.where(np.isfinite(y), y, 0.0)), @@ -81,21 +77,44 @@ def test_uni_tests_compare_infinite_values_as_r_does(x_inf: str, y_inf: str) -> ) with warnings.catch_warnings(): warnings.simplefilter("error", RuntimeWarning) - actual = [ - nns.fsd_uni(x, y), - nns.fsd_uni(y, x), - nns.fsd_uni(x, y, type="continuous"), - nns.fsd_uni(y, x, type="continuous"), - nns.ssd_uni(x, y), - nns.ssd_uni(y, x), - nns.tsd_uni(x, y), - nns.tsd_uni(y, x), - ] + actual = [nns.fsd_uni(x, y), nns.fsd_uni(y, x)] assert actual == [int(v) for v in np.asarray(expected)] -@pytest.mark.parametrize(("degree", "type_"), [(1, "discrete"), (1, "continuous"), (2, "discrete")]) -def test_efficient_set_and_clusters_accept_infinite_values_like_r(degree: int, type_: str) -> None: +@pytest.mark.parametrize(("degree", "type_"), [(1, "continuous"), (2, "discrete"), (3, "discrete")]) +def test_sd_rejects_infinities(degree, type_): + uni = (nns.fsd_uni, nns.ssd_uni, nns.tsd_uni)[degree - 1] + r = ("NNS.FSD.uni", "NNS.SSD.uni", "NNS.TSD.uni")[degree - 1] + extra = ", 'continuous'" if degree == 1 else "" + expected = nns_frame_call( + "sd14.uni_infinite", f"tryCatch({r}(c(0,Inf),1:2{extra}), error=conditionMessage)", {} + ) + y = [0, 1] + for inf in (-np.inf, np.inf): + x = [0, inf] + for args in ((x, y), (y, x)): + with pytest.raises(ValueError) as caught: + uni(*args, **({"type": type_} if degree == 1 else {})) + assert str(caught.value) == expected + + +@pytest.mark.parametrize(("degree", "type_"), [(1, "continuous"), (2, "discrete"), (3, "discrete")]) +@pytest.mark.parametrize(("fn", "r"), [ + (nns.sd_efficient_set, "NNS.SD.efficient.set"), (nns.nns_sd_cluster, "NNS.SD.cluster"), +]) +def test_matrix_search_rejects_infinities(fn, r, degree, type_): + expected = nns_frame_call( + "sd14.matrix_infinite", + f"tryCatch({r}(cbind(c(0,Inf),1:2), {degree}, '{type_}'), error=conditionMessage)", {} + ) + for inf in (-np.inf, np.inf): + with pytest.raises(ValueError) as caught: + fn(np.column_stack(([0, inf], [1, 2])), degree=degree, type=type_) + assert str(caught.value) == expected + + +def test_discrete_efficient_set_and_clusters_accept_infinite_values_like_r() -> None: + degree, type_ = 1, "discrete" rng = np.random.default_rng(93) m = rng.normal(size=(30, 6)) + rng.uniform(-0.5, 0.5, 6) m[3, 1] = np.inf