From 6d6709fec160b87cdec6469a8c277df37d6d1642 Mon Sep 17 00:00:00 2001 From: maxine Date: Sun, 24 May 2026 11:25:44 -0700 Subject: [PATCH] docs: fix all intra-doc warnings + gate CI on -D warnings (#347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes 44 cargo-doc warnings across the workspace (50 with --document-private-items) so the CI doc job can run with RUSTDOCFLAGS=-D warnings without spurious failures. Fix categories: - Unresolved intra-doc links to FerroError variants — qualify as crate::FerroError::* in ferrolearn-core/backend.rs (12 sites). - Redundant explicit link targets where the label already resolves — drop the (target) suffix in core, linear, cluster, kernel. - Public docs linking to private items — convert to plain backticks with prose context (ferrolearn-io ModelEnvelope/SCHEMA_VERSION, ferrolearn-bayes MIN_OBS_VAR, ferrolearn-neighbors kneighbors_impl + compute_lof). - Feature-gated module references — drop intra-doc links for the feature-gated onnx/pmml/backend_blas modules (use backticks). - Macro vs module name collisions — disambiguate with macro@ prefix (model-sel param_grid). - Function vs module name collisions — disambiguate with fn@ prefix (covariance graphical_lasso) and trailing parens (model-sel learning_curve/validation_curve). - HTML-tag-like generics in private doc strings — wrap in backticks (ferrolearn-python conversions Array2 etc., ferrolearn-metrics E[MI] formula). - Self-relative references — Self::pairwise, Self::max_features_per_split. CI: - ci.yml doc job: add `RUSTDOCFLAGS: -D warnings`, drop the follow-up-PR comment that now no longer applies. Verified locally with: RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps \ --document-private-items Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 11 ++++--- ferrolearn-bayes/src/conjugate.rs | 4 +-- ferrolearn-cluster/src/spectral.rs | 4 +-- ferrolearn-core/src/backend.rs | 30 +++++++++---------- ferrolearn-core/src/backend_faer.rs | 4 +-- ferrolearn-core/src/lib.rs | 4 +-- ferrolearn-core/src/streaming.rs | 4 +-- ferrolearn-covariance/src/lib.rs | 2 +- ferrolearn-datasets/src/svmlight.rs | 4 +-- ferrolearn-io/src/lib.rs | 12 ++++---- ferrolearn-kernel/src/lib.rs | 2 +- ferrolearn-linear/src/lib.rs | 2 +- ferrolearn-linear/src/nu_svm.rs | 8 ++--- ferrolearn-metrics/src/clustering.rs | 2 +- ferrolearn-metrics/src/pairwise.rs | 2 +- ferrolearn-model-sel/src/grid_search.rs | 3 +- ferrolearn-model-sel/src/lib.rs | 6 ++-- ferrolearn-model-sel/src/param_grid.rs | 8 ++--- ferrolearn-model-sel/src/random_search.rs | 2 +- ferrolearn-model-sel/src/self_training.rs | 2 +- ferrolearn-neighbors/src/knn.rs | 2 +- .../src/local_outlier_factor.rs | 4 +-- ferrolearn-python/src/conversions.rs | 12 ++++---- ferrolearn-tree/src/decision_tree.rs | 2 +- 24 files changed, 69 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80df3bc3..633a7b53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,9 @@ # for the math-heavy paths) # - `cargo doc --no-deps` — `RUSTDOCFLAGS=-D warnings` catches # broken doc links + missing docs -# errors before they ship to docs.rs +# errors before they ship to docs.rs. +# Runs with `--document-private-items` +# so private docs are also gated. # # Jobs are independent so a failure in one (e.g. fmt drift) doesn't gate # the others — you see all the breakages in one CI run instead of @@ -94,6 +96,8 @@ jobs: doc: name: cargo doc --no-deps runs-on: ubuntu-latest + env: + RUSTDOCFLAGS: -D warnings steps: - uses: actions/checkout@v4 - name: Install Rust stable @@ -102,9 +106,4 @@ jobs: uses: Swatinem/rust-cache@v2 with: shared-key: doc - # Builds docs without strict warnings — the workspace currently has - # several broken intra-doc links (`FerroError::*` variants, etc.) - # that should be cleaned up as a follow-up PR. Tighten to - # `RUSTDOCFLAGS: -D warnings` once those land. For now, this catches - # syntax-level doc errors that would break the docs.rs build. - run: cargo doc --workspace --no-deps --document-private-items diff --git a/ferrolearn-bayes/src/conjugate.rs b/ferrolearn-bayes/src/conjugate.rs index 70d6866b..863f3efa 100644 --- a/ferrolearn-bayes/src/conjugate.rs +++ b/ferrolearn-bayes/src/conjugate.rs @@ -57,10 +57,10 @@ const MIN_OBS_VAR: f64 = 1e-12; /// /// # Edge cases /// -/// - `prior_var ≤ 0` is clipped to [`MIN_OBS_VAR`] (the prior is effectively +/// - `prior_var ≤ 0` is clipped to an internal `MIN_OBS_VAR` floor (the prior is effectively /// improper but the math still produces a defined posterior dominated by /// the data). -/// - Any `obs_var_i ≤ 0` is clipped to [`MIN_OBS_VAR`] (degenerate +/// - Any `obs_var_i ≤ 0` is clipped to an internal `MIN_OBS_VAR` floor (degenerate /// observations get extremely high weight but do not produce NaN). /// - Empty `observations` returns the prior unchanged. /// diff --git a/ferrolearn-cluster/src/spectral.rs b/ferrolearn-cluster/src/spectral.rs index 1c1ae14f..b23d61c7 100644 --- a/ferrolearn-cluster/src/spectral.rs +++ b/ferrolearn-cluster/src/spectral.rs @@ -17,7 +17,7 @@ //! 4. **Row-normalize** the embedding matrix so each row has unit L2 norm. //! 5. **K-Means** clustering on the embedded points with `n_init` restarts. //! -//! Spectral Clustering does **not** implement [`Predict`](ferrolearn_core::Predict) +//! Spectral Clustering does **not** implement [`ferrolearn_core::Predict`] //! because there is no simple way to embed new points into the learned eigenspace //! without refitting. //! @@ -123,7 +123,7 @@ impl SpectralClustering { /// /// Stores the cluster labels for the training data. /// -/// Spectral Clustering does **not** implement [`Predict`](ferrolearn_core::Predict). +/// Spectral Clustering does **not** implement [`ferrolearn_core::Predict`]. #[derive(Debug, Clone)] pub struct FittedSpectralClustering { /// Cluster label for each training sample (0-indexed). diff --git a/ferrolearn-core/src/backend.rs b/ferrolearn-core/src/backend.rs index aa477e45..c296363c 100644 --- a/ferrolearn-core/src/backend.rs +++ b/ferrolearn-core/src/backend.rs @@ -39,8 +39,8 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::ShapeMismatch`] if the inner dimensions of `A` - /// and `B` do not match (i.e., `A.ncols() != B.nrows()`). + /// Returns [`crate::FerroError::ShapeMismatch`] if the inner dimensions + /// of `A` and `B` do not match (i.e., `A.ncols() != B.nrows()`). fn gemm(a: &Array2, b: &Array2) -> FerroResult>; /// Singular Value Decomposition: `A = U * diag(S) * Vt`. @@ -53,7 +53,7 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::NumericalInstability`] if the SVD fails to converge. + /// Returns [`crate::FerroError::NumericalInstability`] if the SVD fails to converge. fn svd(a: &Array2) -> FerroResult<(Array2, Array1, Array2)>; /// QR decomposition: `A = Q * R`. @@ -64,7 +64,7 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::NumericalInstability`] if the decomposition fails. + /// Returns [`crate::FerroError::NumericalInstability`] if the decomposition fails. fn qr(a: &Array2) -> FerroResult<(Array2, Array2)>; /// Cholesky decomposition: `A = L * L^T` (lower triangular). @@ -73,8 +73,8 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::NumericalInstability`] if the matrix is not - /// positive definite. + /// Returns [`crate::FerroError::NumericalInstability`] if the matrix is + /// not positive definite. fn cholesky(a: &Array2) -> FerroResult>; /// Solve linear system: `A * x = b`. @@ -83,9 +83,9 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::ShapeMismatch`] if `A` is not square or if - /// `b.len() != A.nrows()`. - /// Returns [`FerroError::NumericalInstability`] if `A` is singular. + /// Returns [`crate::FerroError::ShapeMismatch`] if `A` is not square or + /// if `b.len() != A.nrows()`. + /// Returns [`crate::FerroError::NumericalInstability`] if `A` is singular. fn solve(a: &Array2, b: &Array1) -> FerroResult>; /// Symmetric eigendecomposition: `A = V * diag(eigenvalues) * V^T`. @@ -97,9 +97,9 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::ShapeMismatch`] if `A` is not square. - /// Returns [`FerroError::NumericalInstability`] if the decomposition fails - /// to converge. + /// Returns [`crate::FerroError::ShapeMismatch`] if `A` is not square. + /// Returns [`crate::FerroError::NumericalInstability`] if the + /// decomposition fails to converge. fn eigh(a: &Array2) -> FerroResult<(Array1, Array2)>; /// Matrix determinant. @@ -108,7 +108,7 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::ShapeMismatch`] if `A` is not square. + /// Returns [`crate::FerroError::ShapeMismatch`] if `A` is not square. fn det(a: &Array2) -> FerroResult; /// Matrix inverse. @@ -117,7 +117,7 @@ pub trait Backend: Send + Sync + 'static { /// /// # Errors /// - /// Returns [`FerroError::ShapeMismatch`] if `A` is not square. - /// Returns [`FerroError::NumericalInstability`] if `A` is singular. + /// Returns [`crate::FerroError::ShapeMismatch`] if `A` is not square. + /// Returns [`crate::FerroError::NumericalInstability`] if `A` is singular. fn inv(a: &Array2) -> FerroResult>; } diff --git a/ferrolearn-core/src/backend_faer.rs b/ferrolearn-core/src/backend_faer.rs index 3ba50394..eacc8a24 100644 --- a/ferrolearn-core/src/backend_faer.rs +++ b/ferrolearn-core/src/backend_faer.rs @@ -1,7 +1,7 @@ //! Default backend implementation using `faer` for linear algebra. //! -//! [`NdarrayFaerBackend`] implements the [`Backend`](crate::backend::Backend) -//! trait by converting between `ndarray::Array2` and `faer::Mat`, +//! [`NdarrayFaerBackend`] implements the [`crate::backend::Backend`] trait by +//! converting between `ndarray::Array2` and `faer::Mat`, //! then delegating to `faer`'s high-performance decomposition routines. //! //! - **gemm**: uses `ndarray`'s `dot` (which may use optimized BLAS internally). diff --git a/ferrolearn-core/src/lib.rs b/ferrolearn-core/src/lib.rs index a15ca5f6..652d0b5d 100644 --- a/ferrolearn-core/src/lib.rs +++ b/ferrolearn-core/src/lib.rs @@ -23,8 +23,8 @@ //! pipelines, `std::error::Error` impls). //! - `faer` (default) -- Enables the [`NdarrayFaerBackend`] using the `faer` //! crate for pure-Rust linear algebra. -//! - `blas` -- Enables the [`BLASBackend`](backend_blas::BLASBackend) using -//! system BLAS/LAPACK via `ndarray-linalg`. +//! - `blas` -- Enables the `BLASBackend` (feature-gated) using system +//! BLAS/LAPACK via `ndarray-linalg`. //! //! # Design Principles //! diff --git a/ferrolearn-core/src/streaming.rs b/ferrolearn-core/src/streaming.rs index 751b850b..3fe2dc7f 100644 --- a/ferrolearn-core/src/streaming.rs +++ b/ferrolearn-core/src/streaming.rs @@ -1,8 +1,8 @@ //! Streaming data adapter for incremental learning. //! //! The [`StreamingFitter`] feeds batches from an iterator to a -//! [`PartialFit`](crate::PartialFit) model, enabling online/streaming -//! learning workflows where the full dataset does not fit in memory. +//! [`crate::PartialFit`] model, enabling online/streaming learning workflows +//! where the full dataset does not fit in memory. //! //! # Example //! diff --git a/ferrolearn-covariance/src/lib.rs b/ferrolearn-covariance/src/lib.rs index f8a98e3f..7b2a8677 100644 --- a/ferrolearn-covariance/src/lib.rs +++ b/ferrolearn-covariance/src/lib.rs @@ -27,7 +27,7 @@ //! - [`ledoit_wolf_shrinkage`] — return only the shrinkage coefficient. //! - [`oas`] — return `(cov, shrinkage)`. //! - [`log_likelihood`] — Gaussian log-likelihood under a covariance. -//! - [`graphical_lasso`] — one-shot graphical-lasso fit. +//! - [`fn@graphical_lasso`] — one-shot graphical-lasso fit. //! - [`fast_mcd`] — robust MCD location/cov estimate. pub mod covariance; diff --git a/ferrolearn-datasets/src/svmlight.rs b/ferrolearn-datasets/src/svmlight.rs index ecd3fb36..416cd60f 100644 --- a/ferrolearn-datasets/src/svmlight.rs +++ b/ferrolearn-datasets/src/svmlight.rs @@ -12,8 +12,8 @@ //! //! For simplicity this module returns dense [`ndarray::Array2`] feature //! matrices, which is adequate for small/medium datasets. For very large -//! sparse data, prefer streaming directly into a [`ferrolearn_sparse`] -//! matrix (out of scope here). +//! sparse data, prefer streaming directly into a `ferrolearn_sparse` matrix +//! (out of scope here). use ferrolearn_core::FerroError; use ndarray::{Array1, Array2}; diff --git a/ferrolearn-io/src/lib.rs b/ferrolearn-io/src/lib.rs index cdff8058..6b869eca 100644 --- a/ferrolearn-io/src/lib.rs +++ b/ferrolearn-io/src/lib.rs @@ -11,8 +11,10 @@ //! //! ## Feature Flags //! -//! - **`onnx`** — Enables ONNX protobuf model export via the [`onnx`] module. -//! - **`pmml`** — Enables PMML 4.4 XML model export via the [`pmml`] module. +//! - **`onnx`** — Enables ONNX protobuf model export via the `onnx` module +//! (feature-gated). +//! - **`pmml`** — Enables PMML 4.4 XML model export via the `pmml` module +//! (feature-gated). //! //! # Example //! @@ -69,8 +71,8 @@ struct ModelEnvelope { checksum: u32, } -/// Serialize `model` to MessagePack bytes, wrap in a [`ModelEnvelope`], and -/// write the envelope to `path`. +/// Serialize `model` to MessagePack bytes, wrap in a private `ModelEnvelope`, +/// and write the envelope to `path`. /// /// # Errors /// @@ -85,7 +87,7 @@ pub fn save_model(model: &T, path: impl AsRef) -> Result<(), /// /// Validation checks: /// - Magic bytes must equal `FLRN`. -/// - Schema version must equal [`SCHEMA_VERSION`]. +/// - Schema version must equal the internal `SCHEMA_VERSION` constant. /// - CRC32 of the payload must match the stored checksum. /// /// # Errors diff --git a/ferrolearn-kernel/src/lib.rs b/ferrolearn-kernel/src/lib.rs index f368eb6e..4dbc00c7 100644 --- a/ferrolearn-kernel/src/lib.rs +++ b/ferrolearn-kernel/src/lib.rs @@ -23,7 +23,7 @@ //! Williams Algorithm 3.2 predictions and `log_marginal_likelihood()` for //! hyperparameter selection. //! - **GP Kernels** — RBF, Matern (0.5/1.5/2.5), Constant, White, DotProduct, -//! plus Sum and Product kernel composition via the [`GPKernel`](gp_kernels::GPKernel) trait. +//! plus Sum and Product kernel composition via the [`gp_kernels::GPKernel`] trait. //! - **[`KernelRidge`]** — Kernel ridge regression in dual form //! `(K + αI) c = y` with RBF / Polynomial / Linear / Sigmoid / Laplacian //! / Cosine kernels. diff --git a/ferrolearn-linear/src/lib.rs b/ferrolearn-linear/src/lib.rs index f9bb6072..6f0de217 100644 --- a/ferrolearn-linear/src/lib.rs +++ b/ferrolearn-linear/src/lib.rs @@ -26,7 +26,7 @@ //! - The unfitted struct (e.g., `LinearRegression`) holds hyperparameters //! and implements [`Fit`](ferrolearn_core::Fit). //! - Calling `fit()` produces a new fitted type (e.g., `FittedLinearRegression`) -//! that implements [`Predict`](ferrolearn_core::Predict). +//! that implements [`ferrolearn_core::Predict`]. //! - Calling `predict()` on an unfitted model is a compile-time error. //! //! # Pipeline Integration diff --git a/ferrolearn-linear/src/nu_svm.rs b/ferrolearn-linear/src/nu_svm.rs index 9f7ae3ed..c355fa63 100644 --- a/ferrolearn-linear/src/nu_svm.rs +++ b/ferrolearn-linear/src/nu_svm.rs @@ -1,8 +1,8 @@ //! Nu-parameterized Support Vector Machines. //! //! This module provides [`NuSVC`] (classification) and [`NuSVR`] (regression), -//! which are nu-parameterized variants of [`SVC`](super::svm::SVC) and -//! [`SVR`](super::svm::SVR). Instead of setting the penalty parameter `C` +//! which are nu-parameterized variants of [`super::svm::SVC`] and +//! [`super::svm::SVR`]. Instead of setting the penalty parameter `C` //! directly, the user specifies `nu` in `(0, 1]`, which is an upper bound on //! the fraction of training errors and a lower bound on the fraction of //! support vectors. @@ -10,9 +10,9 @@ //! # Internals //! //! `NuSVC` converts `nu` to an equivalent `C = 1 / (nu * n_samples)` and -//! delegates to [`SVC`](super::svm::SVC). `NuSVR` converts `nu` to +//! delegates to [`super::svm::SVC`]. `NuSVR` converts `nu` to //! `epsilon = 0` and `C = 1 / (nu * n_samples)`, delegating to -//! [`SVR`](super::svm::SVR). +//! [`super::svm::SVR`]. //! //! # Examples //! diff --git a/ferrolearn-metrics/src/clustering.rs b/ferrolearn-metrics/src/clustering.rs index 25ee50c1..b2cd4f8d 100644 --- a/ferrolearn-metrics/src/clustering.rs +++ b/ferrolearn-metrics/src/clustering.rs @@ -580,7 +580,7 @@ fn entropy_from_counts(counts: &[u64], n: f64) -> f64 { /// Expected Mutual Information under random permutations. /// /// Uses the exact combinatorial formula: -/// E[MI] = sum_{i,j} sum_{n_ij} p(n_ij) * (n_ij/n) * log((n * n_ij) / (a_i * b_j)) +/// `E[MI] = sum_{i,j} sum_{n_ij} p(n_ij) * (n_ij/n) * log((n * n_ij) / (a_i * b_j))` /// /// where the sum over n_ij runs from max(1, a_i + b_j - n) to min(a_i, b_j). fn expected_mutual_info(a: &[u64], b: &[u64], n: u64) -> f64 { diff --git a/ferrolearn-metrics/src/pairwise.rs b/ferrolearn-metrics/src/pairwise.rs index eef9492f..df147807 100644 --- a/ferrolearn-metrics/src/pairwise.rs +++ b/ferrolearn-metrics/src/pairwise.rs @@ -44,7 +44,7 @@ where fn pairwise(&self, x: &Array2, y: &Array2) -> Result, FerroError>; /// Convenience: compute the distance from a single point `a` to a single - /// point `b`. Default implementation calls [`pairwise`] on `1 × d` + /// point `b`. Default implementation calls [`Self::pairwise`] on `1 × d` /// matrices and returns the single entry. fn distance(&self, a: &ndarray::Array1, b: &ndarray::Array1) -> Result { let mut x = Array2::::zeros((1, a.len())); diff --git a/ferrolearn-model-sel/src/grid_search.rs b/ferrolearn-model-sel/src/grid_search.rs index bdb59294..96a8acd8 100644 --- a/ferrolearn-model-sel/src/grid_search.rs +++ b/ferrolearn-model-sel/src/grid_search.rs @@ -35,7 +35,8 @@ use crate::param_grid::ParamSet; // CvResults // --------------------------------------------------------------------------- -/// Results collected during a [`GridSearchCV`] or [`RandomizedSearchCV`] run. +/// Results collected during a [`GridSearchCV`] or +/// [`crate::RandomizedSearchCV`] run. /// /// Each entry corresponds to one parameter combination that was evaluated. #[derive(Debug, Clone)] diff --git a/ferrolearn-model-sel/src/lib.rs b/ferrolearn-model-sel/src/lib.rs index 614589e3..91856665 100644 --- a/ferrolearn-model-sel/src/lib.rs +++ b/ferrolearn-model-sel/src/lib.rs @@ -12,14 +12,14 @@ //! - [`cross_validate`] — like `cross_val_score` but with timing and optional //! training scores. //! - [`cross_val_predict`] — generate out-of-fold predictions for every sample. -//! - [`learning_curve`] — train/test scores for varying training set sizes. -//! - [`validation_curve`] — train/test scores for varying hyperparameter values. +//! - [`learning_curve()`] — train/test scores for varying training set sizes. +//! - [`validation_curve()`] — train/test scores for varying hyperparameter values. //! - [`GridSearchCV`] — exhaustive hyperparameter search over a parameter grid. //! - [`RandomizedSearchCV`] — randomized hyperparameter search over distributions. //! - [`TimeSeriesSplit`] — time-series aware cross-validation splitter. //! - [`HalvingGridSearchCV`] — successive-halving hyperparameter search. //! - [`HalvingRandomSearchCV`] — successive-halving search with random sampling. -//! - [`param_grid!`] — macro for building Cartesian-product parameter grids. +//! - [`macro@param_grid`] — macro for building Cartesian-product parameter grids. //! - [`ParamValue`] / [`ParamSet`] — hyperparameter value and set types. //! - [`distributions`] — sampling distributions for [`RandomizedSearchCV`]. //! - [`CalibratedClassifierCV`] — probability calibration via cross-validation. diff --git a/ferrolearn-model-sel/src/param_grid.rs b/ferrolearn-model-sel/src/param_grid.rs index 5e2811db..d577e98b 100644 --- a/ferrolearn-model-sel/src/param_grid.rs +++ b/ferrolearn-model-sel/src/param_grid.rs @@ -1,11 +1,11 @@ -//! Parameter grid types and the [`param_grid!`] macro. +//! Parameter grid types and the [`macro@crate::param_grid`] macro. //! //! This module defines: //! //! - [`ParamValue`] — a dynamically-typed hyperparameter value. //! - [`ParamSet`] — a single parameter configuration (`HashMap`). -//! - [`param_grid!`] — a macro that builds the Cartesian product of parameter -//! lists as `Vec`. +//! - [`macro@crate::param_grid`] — a macro that builds the Cartesian product +//! of parameter lists as `Vec`. //! //! # Example //! @@ -50,7 +50,7 @@ impl std::fmt::Display for ParamValue { /// A single set of hyperparameter name–value pairs. /// -/// Created by [`param_grid!`] or built manually. +/// Created by [`macro@crate::param_grid`] or built manually. pub type ParamSet = HashMap; // --------------------------------------------------------------------------- diff --git a/ferrolearn-model-sel/src/random_search.rs b/ferrolearn-model-sel/src/random_search.rs index 568c048f..5410bd4b 100644 --- a/ferrolearn-model-sel/src/random_search.rs +++ b/ferrolearn-model-sel/src/random_search.rs @@ -3,7 +3,7 @@ //! [`RandomizedSearchCV`] samples `n_iter` random parameter combinations from //! the supplied distributions, evaluates each using cross-validation, and //! records the results in a [`CvResults`] struct (re-exported from -//! [`grid_search`]). +//! [`crate::grid_search`]). //! //! # Example //! diff --git a/ferrolearn-model-sel/src/self_training.rs b/ferrolearn-model-sel/src/self_training.rs index 664bbaf9..91b5cb29 100644 --- a/ferrolearn-model-sel/src/self_training.rs +++ b/ferrolearn-model-sel/src/self_training.rs @@ -2,7 +2,7 @@ //! //! [`SelfTrainingClassifier`] is a meta-estimator that wraps a supervised //! classifier and iteratively assigns pseudo-labels to unlabeled samples -//! whose predicted probabilities exceed a confidence [`threshold`]. +//! whose predicted probabilities exceed a confidence `threshold`. //! //! # Algorithm //! diff --git a/ferrolearn-neighbors/src/knn.rs b/ferrolearn-neighbors/src/knn.rs index 1b85aad9..b3d2d0ec 100644 --- a/ferrolearn-neighbors/src/knn.rs +++ b/ferrolearn-neighbors/src/knn.rs @@ -925,7 +925,7 @@ impl FittedKNeighborsClassifier { /// /// # Errors /// - /// As [`kneighbors_impl`]. + /// As the internal `kneighbors_impl`. pub fn kneighbors( &self, x: &Array2, diff --git a/ferrolearn-neighbors/src/local_outlier_factor.rs b/ferrolearn-neighbors/src/local_outlier_factor.rs index d95a89be..d1c821e0 100644 --- a/ferrolearn-neighbors/src/local_outlier_factor.rs +++ b/ferrolearn-neighbors/src/local_outlier_factor.rs @@ -470,7 +470,7 @@ impl FittedLocalOutlierFactor { /// /// # Errors /// - /// As [`compute_lof`](Self::compute_lof). + /// As the internal `compute_lof`. pub fn score_samples(&self, x: &Array2) -> Result, FerroError> { let lof = self.compute_lof(x)?; Ok(Array1::from_iter(lof.into_iter().map(|v| -v))) @@ -483,7 +483,7 @@ impl FittedLocalOutlierFactor { /// /// # Errors /// - /// As [`compute_lof`](Self::compute_lof). + /// As the internal `compute_lof`. pub fn decision_function(&self, x: &Array2) -> Result, FerroError> { let lof = self.compute_lof(x)?; Ok(Array1::from_iter( diff --git a/ferrolearn-python/src/conversions.rs b/ferrolearn-python/src/conversions.rs index 798e816d..6f5ac31d 100644 --- a/ferrolearn-python/src/conversions.rs +++ b/ferrolearn-python/src/conversions.rs @@ -4,32 +4,32 @@ use ndarray::{Array1, Array2}; use numpy::{PyArray1, PyArray2, PyReadonlyArray1, PyReadonlyArray2}; use pyo3::prelude::*; -/// Convert a numpy 2D array (read-only) to an ndarray Array2. +/// Convert a numpy 2D array (read-only) to an ndarray `Array2`. pub fn numpy2_to_ndarray(x: PyReadonlyArray2<'_, f64>) -> Array2 { x.as_array().to_owned() } -/// Convert a numpy 1D array (read-only) to an ndarray Array1. +/// Convert a numpy 1D array (read-only) to an ndarray `Array1`. pub fn numpy1_to_ndarray(x: PyReadonlyArray1<'_, f64>) -> Array1 { x.as_array().to_owned() } -/// Convert a numpy 1D array of i64 to an ndarray Array1 (for class labels). +/// Convert a numpy 1D array of i64 to an ndarray `Array1` (for class labels). pub fn numpy1_to_ndarray_usize(y: PyReadonlyArray1<'_, i64>) -> Array1 { y.as_array().mapv(|v| v as usize) } -/// Convert an ndarray Array1 to a numpy 1D array. +/// Convert an ndarray `Array1` to a numpy 1D array. pub fn ndarray1_to_numpy<'py>(py: Python<'py>, a: &Array1) -> Bound<'py, PyArray1> { PyArray1::from_array(py, a) } -/// Convert an ndarray Array2 to a numpy 2D array. +/// Convert an ndarray `Array2` to a numpy 2D array. pub fn ndarray2_to_numpy<'py>(py: Python<'py>, a: &Array2) -> Bound<'py, PyArray2> { PyArray2::from_array(py, a) } -/// Convert an ndarray Array1 to a numpy 1D array of i64. +/// Convert an ndarray `Array1` to a numpy 1D array of i64. pub fn ndarray1_usize_to_numpy<'py>( py: Python<'py>, a: &Array1, diff --git a/ferrolearn-tree/src/decision_tree.rs b/ferrolearn-tree/src/decision_tree.rs index 7a47a75b..cfa3954c 100644 --- a/ferrolearn-tree/src/decision_tree.rs +++ b/ferrolearn-tree/src/decision_tree.rs @@ -108,7 +108,7 @@ struct ClassificationData<'a, F> { n_classes: usize, /// Fixed feature subset for the entire tree (used by Bagging-style /// per-tree feature subsampling). Mutually exclusive with - /// [`max_features_per_split`]. + /// [`Self::max_features_per_split`]. feature_indices: Option<&'a [usize]>, /// When set, every split samples a fresh random subset of this many /// features (per-split feature sampling, the Breiman 2001 RandomForest