Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
mglisse committed Aug 23, 2024
1 parent fc4bae0 commit 8cab8c9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/python/gudhi/sklearn/rips_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..flag_filtration.edge_collapse import reduce_graph
import math
import numpy as np
from typing import Union, Iterable, Literal, Optional
from sklearn.base import BaseEstimator, TransformerMixin
from scipy.sparse import coo_matrix
from scipy.spatial import cKDTree
Expand Down Expand Up @@ -41,12 +42,14 @@ class RipsPersistence(BaseEstimator, TransformerMixin):

def __init__(
self,
homology_dimensions,
threshold=float('inf'),
input_type='point cloud',
num_collapses='auto',
homology_coeff_field=11,
n_jobs=None,
homology_dimensions: Union[int, Iterable[int]],
threshold: float = float('inf'),
input_type: Literal[
"point cloud", "full distance matrix", "lower distance matrix", "distance coo_matrix"
] = 'point cloud',
num_collapses: Union[int, Literal["auto"]] = 'auto',
homology_coeff_field: int = 11,
n_jobs: Optional[int] = None,
):
"""
Constructor for the RipsPersistence class.
Expand All @@ -64,7 +67,7 @@ def __init__(
num_collapses (int|str): Specify the number of iterations of :func:`~gudhi.flag_filtration.edge_collapse.reduce_graph`
(edge collapse) to perform on the graph. Default value is 'auto'.
homology_coeff_field (int): The homology coefficient field. Must be a prime number. Default value is 11.
n_jobs (int): Number of jobs to run in parallel. `None` (default value) means `n_jobs = 1` unless in a
n_jobs (Optional[int]): Number of jobs to run in parallel. `None` (default value) means `n_jobs = 1` unless in a
joblib.parallel_backend context. `-1` means using all processors. cf.
https://joblib.readthedocs.io/en/latest/generated/joblib.Parallel.html for more details.
"""
Expand Down

0 comments on commit 8cab8c9

Please sign in to comment.