本文整理匯總了Python中Orange.data.table.Table.from_table方法的典型用法代碼示例。如果您正苦於以下問題:Python Table.from_table方法的具體用法?Python Table.from_table怎麽用?Python Table.from_table使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Orange.data.table.Table
的用法示例。
在下文中一共展示了Table.from_table方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: commit
# 需要導入模塊: from Orange.data.table import Table [as 別名]
# 或者: from Orange.data.table.Table import from_table [as 別名]
def commit(self):
continuizer = self.constructContinuizer()
if self.data is not None:
domain = continuizer(self.data)
data = Table.from_table(domain, self.data)
self.send("Data", data)
else:
self.send("Data", None)
示例2: set_tree
# 需要導入模塊: from Orange.data.table import Table [as 別名]
# 或者: from Orange.data.table.Table import from_table [as 別名]
def set_tree(self, model=None):
"""When a different tree is given."""
self.clear()
self.model = model
if model is not None:
# We need to know what kind of tree we have in order to properly
# show colors and tooltips
if isinstance(model, TreeClassifier):
self.tree_type = self.CLASSIFICATION
elif isinstance(model, TreeRegressor):
self.tree_type = self.REGRESSION
else:
self.tree_type = self.GENERAL
self.instances = model.instances
# this bit is important for the regression classifier
if self.instances is not None and \
self.instances.domain != model.domain:
self.clf_dataset = Table.from_table(
self.model.domain, self.instances)
else:
self.clf_dataset = self.instances
self.tree_adapter = self._get_tree_adapter(self.model)
self.color_palette = self._tree_specific('_get_color_palette')()
self.ptree.clear()
self.ptree.set_tree(self.tree_adapter)
self.ptree.set_tooltip_func(self._tree_specific('_get_tooltip'))
self.ptree.set_node_color_func(
self._tree_specific('_get_node_color')
)
self._tree_specific('_update_legend_colors')()
self._update_legend_visibility()
self._update_info_box()
self._update_depth_slider()
self._tree_specific('_update_target_class_combo')()
self._update_main_area()
# Get meta variables describing pythagoras tree if given from
# forest.
if hasattr(model, 'meta_size_calc_idx'):
self.size_calc_idx = model.meta_size_calc_idx
if hasattr(model, 'meta_size_log_scale'):
self.size_log_scale = model.meta_size_log_scale
# Updating the size calc redraws the whole tree
if hasattr(model, 'meta_size_calc_idx') or \
hasattr(model, 'meta_size_log_scale'):
self.update_size_calc()
# The target class can also be passed from the meta properties
if hasattr(model, 'meta_target_class_index'):
self.target_class_index = model.meta_target_class_index
self.update_colors()
示例3: sendData
# 需要導入模塊: from Orange.data.table import Table [as 別名]
# 或者: from Orange.data.table.Table import from_table [as 別名]
def sendData(self):
continuizer = self.constructContinuizer()
if self.data is not None:
domain = continuizer(self.data)
data = Table.from_table(domain, self.data)
self.send("Data", data)
else:
self.sendData("Data", None)
self.data_changed = False
示例4: from_table
# 需要導入模塊: from Orange.data.table import Table [as 別名]
# 或者: from Orange.data.table.Table import from_table [as 別名]
def from_table(cls, domain, source, row_indices=...):
"""
Create a new table from selected columns and/or rows of an existing
one. The columns are chosen using a domain. The domain may also include
variables that do not appear in the source table; they are computed
from source variables if possible.
The resulting data may be a
- new LazyTable if source is a LazyTable, domain contains only
attributes of the source and row_indices is not specified.
This should ensure that the SelectAttributes widget works.
- a normal Table otherwise, which could apparently be view or a copy
of the existing data. However, what happens with a view of
growing data is unknown.
:param domain: the domain for the new table
:type domain: Orange.data.Domain
:param source: the source table
:type source: Orange.data.Table
:param row_indices: indices of the rows to include
:type row_indices: a slice or a sequence
:return: a new table
:rtype: Orange.data.Table
"""
# TODO: Improve the lazyness support for other cases?
# TODO: Investigate this computing of new variables.
subdomain = all(v in source.domain for v in domain)
if isinstance(source, LazyTable) and subdomain:
table_new = LazyTable.from_domain(domain)
table_new.stop_pulling = True # Should only be done by first LazyTable?
table_new.table_origin = source
# Fill the table with the rows that were already materialized.
# TODO: Do something smarter here?
# Definitely, currently we need the copy.copy to prevent
# RuntimeError: dictionary changed size during iteration
for row_index_full in copy.copy(table_new.table_origin.row_mapping):
for variable in table_new.domain:
# pylint: disable=unused-variable
value = table_new[row_index_full][variable]
else:
table_new = Table.from_table(
domain=domain,
source=source,
row_indices=row_indices,
)
return table_new