Skip to content

Define database for symbolic simplification #639

Open
@ricardoV94

Description

@ricardoV94
Member

Description

As discussed in #637 PyTensor is geared mostly towards computational efficiency, although the same machinery could be easily tuned for symbolic simplification.

We could create a database of rewrites just for that goal

Activity

jessegrabowski

jessegrabowski commented on Feb 8, 2024

@jessegrabowski
Member

This was something on the Theano team's radar, I think at least one of the original devs was interested in piggy-backing on sympy for this purpose. See this blog post, for example.

I also think this is a place where Eggs could really shine. See their symbolic algebra example here, it might be a good place to start?

ricardoV94

ricardoV94 commented on Feb 8, 2024

@ricardoV94
MemberAuthor

I would say easiest place to start is to just curate from the rewrites we already have. After that I'm confident egglog could be nice for better simplifications.

Given how easy it is to write egglog rewrites I would lean to bypass sympy completely.

jessegrabowski

jessegrabowski commented on Feb 8, 2024

@jessegrabowski
Member

Yes, I don't like adding a sympy dependency either. It's non-trivial to switch between representations (sympy and pytensor), mostly because of broadcasting stuff. From my own experience, it would be easier to just start fresh on our side.

This does tie into the discussion we were having on #573 though, because algebraic rewrites might need more information about variables in order to execute. For example, ( x a ) 1 a can be rewritten to x , but only if we know x is non-negative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ricardoV94@jessegrabowski

        Issue actions

          Define database for symbolic simplification · Issue #639 · pymc-devs/pytensor