本文整理匯總了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