Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
The input samples.
y : Ignored
Not used, present for API consistency by convention.
Returns
-------
self : object
Fitted estimator.
"""
# check detector_list
if len(self.detector_list) < 2:
raise ValueError("The detector list has less than 2 detectors.")
for detector in self.detector_list:
check_detector(detector)
# check random state and input
self.random_state = check_random_state(self.random_state)
X = check_array(X)
self._set_n_classes(y)
self.n_features_ = X.shape[1]
# normalize input data
self.X_train_norm_ = X
train_scores = np.zeros([self.X_train_norm_.shape[0], self.n_clf])
# fit each base detector and calculate standardized train scores
for k, detector in enumerate(self.detector_list):
detector.fit(self.X_train_norm_)
train_scores[:, k] = detector.decision_scores_
self.train_scores_ = train_scores
# validate two lists length
if len(self.estimator_list) != len(self.standardization_flag_list):
raise ValueError(
"estimator_list length ({0}) is not equal "
"to standardization_flag_list length ({1})".format(
len(self.estimator_list),
len(self.standardization_flag_list)))
# validate the estimator list is not empty
check_parameter(len(self.estimator_list), low=1,
param_name='number of estimators',
include_left=True, include_right=True)
for estimator in self.estimator_list:
check_detector(estimator)
return len(self.estimator_list)
if self.n_estimators <= 0:
raise ValueError("n_estimators must be greater than zero, "
"got {0}.".format(self.n_estimators))
if self.base_estimator is not None:
self.base_estimator_ = self.base_estimator
else:
self.base_estimator_ = default
if self.base_estimator_ is None:
raise ValueError("base_estimator cannot be None")
# make sure estimator is consistent with sklearn
if self.check_detector:
check_detector(self.base_estimator_)
self.local_max_features = local_max_features
self.local_min_features = 0.5
self.local_region_iterations = 20
self.local_region_threshold = int(self.local_region_iterations / 2)
self.n_bins = n_bins
self.n_selected = 1
self.random_state = random_state
assert len(estimator_list) > 1, "The estimator list has less than 2 estimators."
if self.n_bins >= self.n_clf:
warnings.warn("Number of histogram bins greater than number of classifiers, reducing n_bins to n_clf.")
self.n_bins = self.n_clf
for estimator in self.estimator_list:
check_detector(estimator)