cb-mydomain.py

来自「orange源码 数据挖掘技术」· Python 代码 · 共 21 行

PY
21
字号
# Description: Shows an example of an Orange class that cannot be subtyped in Python
# Category:    callbacks to Python
# Classes:     Domain
# Uses:        lenses
# Referenced:  callbacks.htm

import orange, orngTree, orngMisc
tab = orange.ExampleTable(r"lenses.tab")


class MyDomain(orange.Domain):
	def __call__(self, ex):
		ex2 = orange.Domain.__call__(self, ex)
		ex2.setclass("?")
		return ex2

md = MyDomain(tab.domain)
ce1 = orange.Example(md, tab[0])
ce2 = md(tab[0])
print ce1
print ce2

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?