def setUp(self): """ Generate X, y datasets and fit a RF """ #Generate datasets self.X, self.y = get_classification_data(10, 5, 2, 1000, random_state=0, sigma=0) # Fit a RF self.clf_base = RandomForestClassifier( n_estimators=1, criterion='entropy', bootstrap=False, class_weight='balanced_subsample') self.bag_clf = BaggingClassifier(base_estimator=self.clf_base, max_features=1.0, n_estimators=100, oob_score=True, random_state=1) self.fit_clf = self.bag_clf.fit(self.X, self.y) self.cv_gen = KFold(n_splits=3, random_state=0)
def setUp(self): """ Set the file path for the sample dollar bars data. """ state = np.random.RandomState(42) self.x = state.normal(size=1000) self.y_1 = self.x ** 2 + state.normal(size=1000) / 5 self.y_2 = abs(self.x) + state.normal(size=1000) / 5 self.X_matrix, _ = get_classification_data(6, 2, 2, 100, sigma=0)
def setUp(self): """ Set the file path for the sample dollar bars data. """ state = np.random.RandomState(42) self.x = state.normal(size=1000) self.y_1 = self.x**2 + state.normal(size=1000) / 5 self.y_2 = abs(self.x) + state.normal(size=1000) / 5 self.y_3 = self.x + state.normal(size=1000) / 5 self.X_matrix, _ = get_classification_data(6, 2, 2, 100, sigma=0) # Setting sample correlation matrices self.corr_A = np.array( [[1, 0.70573243, 0.03085437, 0.6019651, 0.81214341], [0.70573243, 1, 0.03126594, 0.56559443, 0.88961155], [0.03085437, 0.03126594, 1, 0.01760481, 0.02842086], [0.60196510, 0.56559443, 0.01760481, 1, 0.73827921], [0.81214341, 0.88961155, 0.02842086, 0.73827921, 1]]) self.corr_B = np.array( [[1, 0.49805826, 0.00095199, 0.36236198, 0.65957691], [0.49805826, 1, 0.00097755, 0.31989705, 0.79140871], [0.00095199, 0.00097755, 1, 0.00030992, 0.00080774], [0.36236198, 0.31989705, 0.00030992, 1, 0.54505619], [0.65957691, 0.79140871, 0.00080774, 0.54505619, 1]])
def setUp(self): """ Create X, y datasets """ self.X, self.y = get_classification_data(40, 5, 30, 1000, sigma=2)