StarForm is a Python library to quickly develop clean modular models/pipelines.
Project description
Star Formation
Star Formation is a Python library to quickly develop clean modular models/pipelines. Geared towards usage with sklearn and keras.
Installation
Use the package manager pip to install foobar.
pip install starformation
Usage
import starformation as sf
#Create pipeline
bf = sf.Formation()
#star() return the input
s = sf.star()
#Add star
bf.add(s)
#returns [4]
bf.run(4)
add(s:star)
Add first star in formation or chain stars to the last added star.
Example: (x+1) * 3
import starformation as sf
from starformation.classic import CStar
bf = sf.Formation()
s = sf.star()
bf.add(CStar(lambda x: x+1))
bf.add(CStar(lambda x: x*3))
#returns [15]
bf.run(4)
link(s:star)
Add first star in formation or chain stars to the last added star.
Example: (x+1) * 3
import starformation as sf
from starformation.classic import CStar
bf = sf.Formation()
s = sf.star()
bf.add(CStar(lambda x: x+1))
bf.add(CStar(lambda x: x*3))
#returns [15]
bf.run(4)
Run(input, cores = none)
Input is fed into the first star. Cores specify how many processes.
Chain stars. Execution star.action() -> star2.action()
import starformation as sf
bf = sf.Formation()
s = sf.star()
bf.add(s)
bf.link(sf.star())
bf.link(sf.star())
bf.link(sf.star())
bf.link(sf.star())
#return [4,4,4,4]
bf.run("example",2)
#also return [4,4,4,4] but not multicore
bf.run("example")
CStar
Makes a custom function.
import starformation as sf
from starformation.classic import CStar
def add(x):
return x+1
bf = sf.Formation()
bf.add(CStar(add))
#returns [5]
bf.run(4)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.