Skip to content

Commit

Permalink
update SimplePPT
Browse files Browse the repository at this point in the history
  • Loading branch information
Yao-14 committed Aug 19, 2023
1 parent 4d20faa commit 409e81e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions spateo/tdr/widgets/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def ElPiGraph_tree(
def SimplePPT_tree(
X: np.ndarray,
NumNodes: int = 50,
sigma: Optional[Union[float, int]] = 0.1,
lam: Optional[Union[float, int]] = 1,
metric: str = "euclidean",
nsteps: int = 50,
err_cut: float = 5e-3,
seed: Optional[int] = 1,
**kwargs,
) -> Tuple[np.ndarray, np.ndarray]:
"""
Expand All @@ -162,6 +168,13 @@ def SimplePPT_tree(
Args:
X: DxN, data matrix list.
NumNodes: The number of nodes of the principal graph. Use a range of 100 to 2000 for PPT approach.
sigma: Regularization parameter.
lam: Penalty for the tree length.
metric: The metric to use to compute distances in high dimensional space. For compatible metrics, check the
documentation of sklearn.metrics.pairwise_distances.
nsteps: Number of steps for the optimisation process.
err_cut: Stop algorithm if proximity of principal points between iterations less than defined value.
seed: A numpy random seed.
**kwargs: Other parameters used in simpleppt.ppt. For details, please see:
https://github.com/LouisFaure/simpleppt/blob/main/simpleppt/ppt.py
Expand All @@ -180,8 +193,12 @@ def SimplePPT_tree(
)

SimplePPT_kwargs = {
"seed": 1,
"lam": 10,
"seed": seed,
"lam": lam,
"sigma": sigma,
"metric": metric,
"nsteps": nsteps,
"err_cut": err_cut,
}
SimplePPT_kwargs.update(kwargs)

Expand Down

0 comments on commit 409e81e

Please sign in to comment.