Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pl plotting #55

Merged
merged 16 commits into from
Feb 11, 2024
Merged
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
version: 3.7
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
4 changes: 4 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.3.3
- Fix plotting methods of Persistence Landscapes, add doc strings.
- Update to notebooks.

0.3.2
- Update codebase to support python 3.7 - 3.12.
- Change `PersistenceLandscaper` API for sklearn compatibility.
Expand Down
6 changes: 3 additions & 3 deletions docs/notebooks/Classification with persistence images.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "persimenv",
"display_name": "Python 3",
"language": "python",
"name": "persimenv"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -375,7 +375,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
22 changes: 11 additions & 11 deletions docs/notebooks/Differentiation with Persistence Landscapes.ipynb

Large diffs are not rendered by default.

91 changes: 44 additions & 47 deletions docs/notebooks/Persistence Landscapes and Machine Learning.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion persim/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.2"
__version__ = "0.3.3"
8 changes: 2 additions & 6 deletions persim/landscapes/approximate.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def __init__(
self.start = start
self.stop = stop
self.values = values
self.max_depth = len(self.values)
self.num_steps = num_steps
if compute:
self.compute_landscape()
Expand All @@ -178,7 +179,6 @@ def compute_landscape(self, verbose: bool = False) -> list:
if self.values.size:
verboseprint("values was stored, exiting")
return

verboseprint("values was empty, computing values")
# make grid
grid_values, step = np.linspace(
Expand Down Expand Up @@ -214,17 +214,14 @@ def compute_landscape(self, verbose: bool = False) -> list:
j += 1
# j*step: adding points from a line with slope 1
W[ind_in_Wb + j].append(j * step)

j = 0
# j in (b+d/2, d)
for _ in range(mid_pt + 1, ind_in_Wd):
j += 1
W[ind_in_Wd - j].append(j * step)

# sort each list in W
for i in range(len(W)):
W[i] = sorted(W[i], reverse=True)

# calculate k: max length of lists in W
K = max([len(_) for _ in W])

Expand All @@ -235,13 +232,12 @@ def compute_landscape(self, verbose: bool = False) -> list:
for i in range(self.num_steps):
for k in range(len(W[i])):
L[k][i] = W[i][k]

# check if L is empty
if not L.size:
L = np.array(["empty"])
print("Bad choice of grid, values is empty")

self.values = L
self.max_depth = len(L)
return

def values_to_pairs(self):
Expand Down
Loading
Loading