Skip to content

Make learnerND datastructures immutable where possible #54

Closed

Description

@basnijholt

(original issue on GitLab)

opened by Joseph Weston (@jbweston) at 2018-07-10T13:16:25.518Z

At the moment there are a few datastructures that are described as "sets". where possible we should make these frozenset to remove the possibility of them being modified.

Activity

  1. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Jorn Hoofwijk (@Jorn) at 2018-07-13T11:46:10.397Z on GitLab

    Wauw, according to this thread , a frozenset is hashable and can therefore be used as a dictionary key. Maybe this is a clean way to store simplices (rather than having a sorted tuple) in the triangulation/learner.

    any opinions?

  2. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Joseph Weston (@jbweston) at 2018-07-13T11:49:40.261Z on GitLab

    In [1]: import sys
    
    In [2]: sys.getsizeof((1, 2, 3))
    Out[2]: 72
    
    In [3]: sys.getsizeof(frozenset((1, 2, 3)))
    Out[3]: 224
    

    just saying

  3. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Jorn Hoofwijk (@Jorn) at 2018-07-13T11:50:33.059Z on GitLab

    ohw, that is a shame

  4. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Joseph Weston (@jbweston) at 2018-07-13T11:50:41.004Z on GitLab

    because a frozenset is a hashmap, whereas a tuple is an array

  5. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Bas Nijholt (@basnijholt) at 2018-12-07T20:00:10.457Z on GitLab

    Will this ever be implemented? If not, can we close it?

  6. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-12-07T20:10:46.447Z on GitLab

    It's ~"priority: low", so please let's not close it. @jbweston's illustration shows clearly that there's a clear benefit in implementing this issue.

  7. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Joseph Weston (@jbweston) at 2018-12-08T09:53:44.558Z on GitLab

    @jbweston's illustration shows clearly that there's a clear benefit in implementing this issue.

    No, I was just saying that we should prefer tuples over sets where possible, but that some of the structures that currently are sets should be frozenset if they can be

  8. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-12-08T20:25:06.809Z on GitLab

    Indeed, I misunderstood.

    Looking at the documentation of LearnerND I'm not sure what data structures would benefit from conversion.

    On the other hand, it does seem like we could make a bunch of methods private and therefore make the API simpler.

  9. basnijholt commented on Dec 19, 2018

    @basnijholt
    MemberAuthor

    originally posted by Bas Nijholt (@basnijholt) at 2018-12-11T11:56:04.313Z on GitLab

    Like this @anton-akhmerov? https://gitlab.kwant-project.org/qt/adaptive/merge_requests/142

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

      Issue actions