Code Monkey home page Code Monkey logo

pyper's Introduction

pyper

Pipeline structure for concatenating functions with different parameters for analysis. Time and time again the same pipeline needs to be applied to similar datasets but with slightly different parameters. The main goal of this module is to be able to easily concatenate the desired functions into a pipeline and save the parameters used for each function.

Usage

The Pipe class contains the different functions that are to be concatenated. When adding functions, it automatically converts them into AdaptedFunction class. Functions can be converted into AdaptedFunctions and parameters set or directly added to them. Another possibility is to add function to Pipe and later on set each of the parameters, as in the example below:

my_pipe = Pipe()
my_pipe + my_func_0
my_pipe + my_func_1
my_pipe.change_func_id('first_function', 'my_func_0')
my_pipe.change_func_id('second_function', 'my_func_1')
my_pipe.make_connection('first_function', 'second_function',provider_func_result=0, subscriber_func_parameter=1)
print(my_pipe)

In this example, a Pipeline is created and then two functions are added. The function identifier are renamed with the change_func_id method (new_name, old_name). Finally, the make_connection method is used to connect the first result of the first function with the second parameter of the second function.

If you previously create the AdaptedFunction object, setting it's id and parameters, you can use the >> operator to add a new AdaptedFunction to the pipeline connecting the first result with the first parameter of the new function.

adapted_2 = AdaptedFunction(my_func_2, func_id='third_function')
adapted_2['b'] = 2
my_pipe >> adapted_2 

print(my_pipe)

pyper's People

Watchers

 avatar  avatar

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.