Cuber
介绍
- cuber是一个集成学习框架,主要用于各种集成学习算法的开发,具有灵活动态可配置的特点。cuber主要由三大模块组成,控制引擎、计算引擎和调度引擎。控制引擎依托于networkx的有向无环图技术,需要以计算引擎和调度引擎为基础,运行时加载。计算引擎支持Ray,Dask;调度引擎支持Kahn算法。
安装
- Cuber采用Python开发,得益于Python良好的社区环境,安装支持Pythonic风格的各种管理器。
$ pip install cuber-0.1-xxxxxxxxxxxx.whl
快速指南
-
cuber使用主要分为三大步,首先初始化cuber实例,加载计算引擎和调度引擎,获取cuber控制器实例;然后使用装饰器注册目标节点的函数;最后调用cuber控制器执行
-
以下是cuber主程脚本代码示例:
### 载入程序包
from cuber.interface import Cube
import time
### cuber实例创建
cuber = Cube(cuber_runner='ray',
cuber_runner_address='ray://192.168.1.51:10001',
cuber_scheduler='kahn')
### 创建cuber控制器
cuber_controller = cuber.get_cuber_controller()
### 注册目标函数到指定cuber控制器
@cuber_controller.register(controller_obj=cuber_controller)
def test_a():
time.sleep(10)
print(2)
return 'a'
@cuber_controller.register(controller_obj=cuber_controller)
def test_aa():
time.sleep(10)
print(2)
return 'aa'
@cuber_controller.register(controller_obj=cuber_controller)
def test_b():
time.sleep(10)
print(2)
return 'b'
@cuber_controller.register(controller_obj=cuber_controller)
def test_bb():
time.sleep(10)
print(2)
return 'bb'
@cuber_controller.register(controller_obj=cuber_controller)
def test_c():
time.sleep(10)
print(2)
return 'c'
@cuber_controller.register(controller_obj=cuber_controller)
def test_cc():
time.sleep(10)
print(2)
return 'cc'
@cuber_controller.register(controller_obj=cuber_controller)
def test_d():
time.sleep(10)
return 'd'
### 注册目标函数依赖关系到指定cuber控制器
test_a >> test_b >> test_c >> test_d
test_aa >> test_b >> test_d
test_bb >> test_c >> test_d
test_cc >> test_d
### 展示节点和边情况
print('~~~~~~',cuber_controller.get_graph_obj())
print('------',cuber_controller.show_nodes())
print('======',cuber_controller.show_edges())
### 使用二级统一API
time_start = time.time()
exec_result = cuber_controller.execute()
time_end = time.time()
print('============================== Parallel function running',time_end - time_start)
### 串行函数运行
time_start = time.time()
test_a()
test_aa()
test_bb()
test_cc()
test_b()
test_c()
test_d()
time_end = time.time()
print('============================== Serial function operation',time_end - time_start)
设计
- 大量使用元编程技术,提高代码灵活性、可读性和维护质量
- 设计了控制引擎、计算引擎和调度引擎,实现灵活动态可扩展
- 天然支持分布式
- 三级API设计,使用方便,适应不同程度的使用人员
- 技术列表
- __new__技术
- __init__技术
- __prepare__技术
- __call__技术
- type元类
- 描述符技术
- Mixin
- 装饰器技术
- namedtuple
- Networkx
- FSM-transitions
- 运算符重载
- __slots__技术
- Ray
Metadata
Release files for shihua-cuber 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shihua-cuber-0.1.tar.gz | 19.8 kB | Without provenance | Details for shihua-cuber-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shihua_cuber-0.1-py3-none-any.whl | Python 3 | none | any | Details for shihua_cuber-0.1-py3-none-any.whl |
Total release size: 47.9 kB
Release files / shihua-cuber-0.1.tar.gz
| Download URL | shihua-cuber-0.1.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63c94120b8d55587110bb8c26061aec4793aaa4851ba2241c13e98fcb0c24174
|
|
BLAKE2b-256 checksum How to use checksums |
edf208315d28ca5146b6d2bd5c0e18677f4fd1a60c001d961b31fc2debe1806b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / shihua_cuber-0.1-py3-none-any.whl
| Download URL | shihua_cuber-0.1-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa3515d7fb59abaf8f581ec71c772f158ca4c9ddea11edbf5a0bb07a34e7d299
|
|
BLAKE2b-256 checksum How to use checksums |
a64bfaeddbadd74e990f53817bbec0eec98f98029423511c1357524595ce61c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for shihua-cuber 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.