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

Graphs created as part of a CspPerspectiveTable do not memoize #263

Open
AdamGlustein opened this issue Jun 1, 2024 · 0 comments
Open
Labels
adapter:perspective Issues and PRs related to our Perspective adapter type: bug Concrete, reproducible bugs

Comments

@AdamGlustein
Copy link
Collaborator

AdamGlustein commented Jun 1, 2024

Describe the bug

When you create a graph as part of a CspPerspectiveTable it does not memoize nodes.

To Reproduce

Minimal repro

import csp
from datetime import datetime, timedelta
from PIL import Image

import perspective
from csp.impl.pandas_ext_type import TsDtype
from csp.impl.pandas_perspective import CspPerspectiveTable
import pandas as pd

df = pd.DataFrame()
df.insert(0, 'one1', pd.Series(csp.const(1.0), dtype=TsDtype(float)), True)
df.insert(1, 'one2', pd.Series(csp.const(1.0), dtype=TsDtype(float)), True)

table = CspPerspectiveTable(df, index_col='timestamp', keep_history=False, localize=True)
g = table.graph

# Note I use a roundabout to call show_graph since I'm in Jupyterlab
# You can replace the code below with a simple show_graph call
buffer = csp.showgraph.generate_graph(g)
image = Image.open(buffer)
display(image)

This gives an image clearly showing the const adapter is not memoized:

image

However, if I "manually" memoize the const nodes by only creating one and providing it both index 0 and 1 of the CspPerspectiveTable like:

df = pd.DataFrame()
u = csp.const(1.0)
df.insert(0, 'one1', pd.Series(u, dtype=TsDtype(float)), True)
df.insert(1, 'one2', pd.Series(u, dtype=TsDtype(float)), True)

We get what we expect:

image

Expected behavior

Memoization should work like it does for any other graph

Error Message

Runtime Environment

0.0.3
3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
linux

Additional context

@AdamGlustein AdamGlustein added type: bug Concrete, reproducible bugs adapter:perspective Issues and PRs related to our Perspective adapter labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter:perspective Issues and PRs related to our Perspective adapter type: bug Concrete, reproducible bugs
Projects
None yet
Development

No branches or pull requests

1 participant