Skip to main content

Cuber is an ensemble learning frame tool.

Project description

Cuber

shields_version shields_license shields_author shiedls_python

cuber_avatar

介绍

  • 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

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shihua-cuber-0.1.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shihua_cuber-0.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file shihua-cuber-0.1.tar.gz.

File metadata

  • Download URL: shihua-cuber-0.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for shihua-cuber-0.1.tar.gz
Algorithm Hash digest
SHA256 63c94120b8d55587110bb8c26061aec4793aaa4851ba2241c13e98fcb0c24174
MD5 1f07fb853f969f65dfad82fad1449ee3
BLAKE2b-256 edf208315d28ca5146b6d2bd5c0e18677f4fd1a60c001d961b31fc2debe1806b

See more details on using hashes here.

File details

Details for the file shihua_cuber-0.1-py3-none-any.whl.

File metadata

  • Download URL: shihua_cuber-0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for shihua_cuber-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3515d7fb59abaf8f581ec71c772f158ca4c9ddea11edbf5a0bb07a34e7d299
MD5 c3c4c77a67ca1bede13bd14da8ad3443
BLAKE2b-256 a64bfaeddbadd74e990f53817bbec0eec98f98029423511c1357524595ce61c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page