Giter VIP home page Giter VIP logo

Comments (3)

tyarkoni avatar tyarkoni commented on May 31, 2024

Yes, good idea. Tweaking the Graph API is actually the straightforward part (we can add a batch argument in the Graph initializer, which, when True, passes all Stims to each node in the graph as a single list, and when False, loops over Stims). The real question is how to handle looping in the Transformer and Stim classes. I can think of two reasonable approaches:

A) Create an IterableTransformer class that can be mixed into any Transformer, and simply overrides the base Transformer class's transform method to loop over elements and return the resulting dict as a list (or, with an optional merge_results argument, perhaps a merged DF). Transformers that require custom handling of batch requests (which is probably all of the API Extractors), will need to be updated on a case-by-case basis.

B) In the base Transformer, add an _iterate method or some such, which gets called from the base Transformer class's transform method in the event that the passed stim argument is a list or tuple. Then the logic is roughly the same as in (A), in that the base class's method can just loop over all elements one at a time, whereas individual Transformers can override _iterate and do whatever they need to there.

The main benefit of (A) is it avoids imposing constraints on how each API Transformer implements the handling of lists (no need to break up code into multiple methods, which could get messy in some cases). The benefit of (B) is it avoids complicating the hierarchy and doesn't require most Transformers to inherit from an extra class. I guess I lean towards (B) slightly, on the assumption that the vast majority of Transformers will never need to do anything other than naive looping. What do you think?

from pliers.

qmac avatar qmac commented on May 31, 2024

I would lean towards (B) more as well, as I generally side with a simpler hierarchy. I would also assume that every Transformer will fall into one of two (naive looping, grouping into call) types.

from pliers.

tyarkoni avatar tyarkoni commented on May 31, 2024

Addressed in #69.

from pliers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.