Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gtda.homology as hl | |
# represent data as a point cloud | |
point_cloud = ... | |
# define topological features to track | |
homology_dimensions = [0, 1, 2] | |
# define simplicial complex to construct | |
persistence = hl.VietorisRipsPersistence( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gtda.homology as hl | |
# represent data as a matrix of pairwise distances | |
distance_matrix = ... | |
# define topological features to track | |
homology_dimensions = [0, 1, 2] | |
# define simplicial complex to construct | |
persistence = hl.VietorisRipsPersistence( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gtda.diagrams as diagrams | |
# calculate persistence diagram | |
persistence_diagram = ... | |
# define type of amplitude to calculate | |
amplitude = diagrams.Amplitude(metric="wasserstein") | |
# calculate amplitude of diagram | |
persistence_diagram_amplitude = amplitude.fit_transform(persistence_diagram) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
# define topological features to track | |
homology_dimensions = [0, 1, 2] | |
# calculate persistence diagram | |
persistence_diagram = ... | |
# convert NumPy array of triples to DataFrame | |
persistence_table = pd.DataFrame( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cv_model(X, y, features, n_fold=5, random_state=45245, params=None): | |
"""Evaluate a score by cross validation. | |
Parameters | |
---------- | |
X : pandas.DataFrame | |
The data to fit. | |
y : pandas.DataFrame or pandas.Series |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TemplateTransformer(BaseEstimator, TransformerMixin): | |
""" An example transformer that returns the element-wise square root.""" | |
def __init__(self, demo_param='demo'): | |
self.demo_param = demo_param | |
def fit(self, X, y=None): | |
"""A reference implementation of a fitting function for a transformer.""" | |
X = check_array(X, accept_sparse=True) | |
self.n_features_ = X.shape[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyight 2016 drivendata | |
# Copyright 2019 fast.ai | |
# Copyright 2020 Lewis Tunstall | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 |
OlderNewer