From 8b06c45d0d9d80fe385a033cfaadb51100bc705a Mon Sep 17 00:00:00 2001 From: Adam Li Date: Mon, 19 Jun 2023 21:54:47 -0400 Subject: [PATCH] Fixed docs Signed-off-by: Adam Li --- docs/conf.py | 3 ++- sktree/experimental/mutual_info.py | 20 +++++++++++--------- sktree/experimental/simulate.py | 2 +- sktree/neighbors.py | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ae75c979d..d40c5344a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -216,7 +216,8 @@ "n_features_x", "n_features_y", "n_features_z", - 'n_neighbors', 'one', + "n_neighbors", + "one", } # validation diff --git a/sktree/experimental/mutual_info.py b/sktree/experimental/mutual_info.py index 8c74610a1..a1820e715 100644 --- a/sktree/experimental/mutual_info.py +++ b/sktree/experimental/mutual_info.py @@ -164,8 +164,8 @@ def mutual_info_ksg( The number of neighbors to use in defining the radius, by default 0.2. metric : str Any distance metric accepted by :class:`sklearn.neighbors.NearestNeighbors`. - If 'forest' (default), then uses an :class:`UnsupervisedObliqueRandomForest` - to compute geodesic distances. + If 'forest' (default), then uses an + :class:`sktree.UnsupervisedObliqueRandomForest` to compute geodesic distances. algorithm : str, optional Method to use, by default 'knn'. Can be ('ball_tree', 'kd_tree', 'brute'). n_jobs : int, optional @@ -190,14 +190,16 @@ def mutual_info_ksg( 4. Get the number of NN in Z subspace within radius 'r' 5. Apply analytic solution for KSG estimate - For MI :footcite:`Kraskov_2004`, the analytical solution is:: - .. math:: + For MI, the analytical solution is: + + .. math:: \\psi(k) - E[(\\psi(n_x) + \\psi(n_y))] + \\psi(n) - For CMI :footcite:`Frenzel2007`m the analytical solution is:: - .. math:: - + For CMI, the analytical solution is: + + .. math:: + \\psi(k) - E[(\\psi(n_{xz}) + \\psi(n_{yz}) - \\psi(n_{z}))] where :math:`\\psi` is the DiGamma function, and each expectation term @@ -372,8 +374,8 @@ def _compute_nn( Method to use, by default 'knn'. Can be ('ball_tree', 'kd_tree', 'brute'). metric : str Any distance metric accepted by :class:`sklearn.neighbors.NearestNeighbors`. - If 'forest', then uses an :class:`UnsupervisedObliqueRandomForest` to compute - geodesic distances. + If 'forest', then uses an :class:`sktree.UnsupervisedObliqueRandomForest` + to compute geodesic distances. k : int, optional The number of k-nearest neighbors to query, by default 1. n_jobs : int, diff --git a/sktree/experimental/simulate.py b/sktree/experimental/simulate.py index 33f59c9a5..17b56145f 100644 --- a/sktree/experimental/simulate.py +++ b/sktree/experimental/simulate.py @@ -22,7 +22,7 @@ def simulate_helix( The value of the smallest radius, by default 0.0. radius_b : int, optional The value of the largest radius, by default 1.0 - obs_noise_func : scipy.stats.distribution, optional + obs_noise_func : Callable, optional By default None, which defaults to a Uniform distribution from (-0.005, 0.005). If passed in, then must be a callable that when called returns a random number denoting the noise. diff --git a/sktree/neighbors.py b/sktree/neighbors.py index 4421c6d41..1d6e1ed84 100644 --- a/sktree/neighbors.py +++ b/sktree/neighbors.py @@ -53,7 +53,7 @@ def fit(self, X, y=None): Returns ------- - self : NearestNeighborsMetaEstimator + self : object Fitted estimator. """ X, y = self._validate_data(X, y, accept_sparse="csc")