Python sklearn.utils.tosequence() Examples
The following are 5
code examples of sklearn.utils.tosequence().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sklearn.utils
, or try the search function
.
Example #1
Source File: pipeline.py From skutil with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #2
Source File: pipeline.py From scikit-multiflow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, steps): # Default values super().__init__() self.steps = tosequence(steps) self.active = False self.__configure()
Example #3
Source File: test_gradient_boosting.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
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_))
Example #4
Source File: stacking.py From civisml-extensions with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #5
Source File: test_gradient_boosting.py From twitter-stock-recommendation with MIT License | 5 votes |
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_))