1414"""
1515
1616import doctest
17- from typing import Tuple
18-
1917import numpy as np
2018from numpy import ndarray
2119from sklearn .datasets import load_iris
2220
2321
24- def collect_dataset () -> Tuple [ndarray , ndarray ]:
22+ def collect_dataset () -> tuple [ndarray , ndarray ]:
2523 """
2624 Load Iris dataset and return features and labels.
2725
2826 Returns:
29- Tuple [ndarray, ndarray]: feature matrix and target labels
27+ tuple [ndarray, ndarray]: feature matrix and target labels
3028
3129 Example:
3230 >>> x, y = collect_dataset()
@@ -39,9 +37,7 @@ def collect_dataset() -> Tuple[ndarray, ndarray]:
3937 return np .array (data .data ), np .array (data .target )
4038
4139
42- def compute_pairwise_affinities (
43- data_x : ndarray , sigma : float = 1.0
44- ) -> ndarray :
40+ def compute_pairwise_affinities (data_x : ndarray , sigma : float = 1.0 ) -> ndarray :
4541 """
4642 Compute high-dimensional affinities (P matrix) using Gaussian kernel.
4743
@@ -67,17 +63,15 @@ def compute_pairwise_affinities(
6763 return (p + p .T ) / (2 * n_samples )
6864
6965
70- def compute_low_dim_affinities (
71- low_dim_embedding : ndarray ,
72- ) -> Tuple [ndarray , ndarray ]:
66+ def compute_low_dim_affinities (low_dim_embedding : ndarray ) -> tuple [ndarray , ndarray ]:
7367 """
7468 Compute low-dimensional affinities (Q matrix) using Student-t distribution.
7569
7670 Args:
7771 low_dim_embedding: shape (n_samples, n_components)
7872
7973 Returns:
80- Tuple [ndarray, ndarray]: Q probability matrix and numerator
74+ tuple [ndarray, ndarray]: Q probability matrix and numerator
8175
8276 Example:
8377 >>> y = np.array([[0.0, 0.0], [1.0, 0.0]])
0 commit comments