本文整理汇总了Python中sklearn.utils.tosequence方法的典型用法代码示例。如果您正苦于以下问题:Python utils.tosequence方法的具体用法?Python utils.tosequence怎么用?Python utils.tosequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.utils
的用法示例。
在下文中一共展示了utils.tosequence方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sklearn import utils [as 别名]
# 或者: from sklearn.utils import tosequence [as 别名]
def __init__(self, steps, feature_names=None, target_feature=None,
exclude_from_ppc=None, exclude_from_fit=None):
super(H2OPipeline, self).__init__(target_feature=target_feature,
min_version=self._min_version,
max_version=self._max_version)
# assign to attribute
self.feature_names = feature_names
# if we have any to exclude...
self.exclude_from_ppc = validate_x(exclude_from_ppc)
self.exclude_from_fit = validate_x(exclude_from_fit)
names, estimators = zip(*steps)
if len(dict(steps)) != len(steps):
raise ValueError("Provided step names are not unique: %s"
% (names,))
# shallow copy of steps
self.steps = tosequence(steps)
transforms = estimators[:-1]
estimator = estimators[-1]
for t in transforms:
if not isinstance(t, BaseH2OTransformer):
raise TypeError("All intermediate steps of the chain should "
"be instances of BaseH2OTransformer"
" '%s' (type %s) isn't)" % (t, type(t)))
if not isinstance(estimator, (H2OEstimator, BaseH2OTransformer)):
raise TypeError("Last step of chain should be an H2OEstimator or BaseH2OTransformer, "
"not of type %s" % type(estimator))
示例2: __init__
# 需要导入模块: from sklearn import utils [as 别名]
# 或者: from sklearn.utils import tosequence [as 别名]
def __init__(self, steps):
# Default values
super().__init__()
self.steps = tosequence(steps)
self.active = False
self.__configure()
示例3: test_symbol_labels
# 需要导入模块: from sklearn import utils [as 别名]
# 或者: from sklearn.utils import tosequence [as 别名]
def test_symbol_labels():
# Test with non-integer class labels.
clf = GradientBoostingClassifier(n_estimators=100, random_state=1)
symbol_y = tosequence(map(str, y))
clf.fit(X, symbol_y)
assert_array_equal(clf.predict(T), tosequence(map(str, true_result)))
assert_equal(100, len(clf.estimators_))
示例4: __init__
# 需要导入模块: from sklearn import utils [as 别名]
# 或者: from sklearn.utils import tosequence [as 别名]
def __init__(self,
estimator_list,
cv=3,
n_jobs=1,
pre_dispatch='2*n_jobs',
verbose=0):
self.estimator_list = tosequence(estimator_list)
self.cv = cv
self.n_jobs = n_jobs
self.pre_dispatch = pre_dispatch
self.verbose = verbose