def test_multiprocessing():
generator = check_random_state(0)
data = genData(n_samples=200, n_features=4, n_redundant=2,strRel=2,
n_repeated=0, class_sep=1, flip_y=0, random_state=generator)
X_orig, y = data
X_orig = StandardScaler().fit(X_orig).transform(X_orig)
X = np.c_[X_orig, generator.normal(size=(len(X_orig), 6))]
y = list(y) # regression test: list should be supported
# Test using the score function
fri = EnsembleFRI(FRIClassification(random_state=generator),n_bootstraps=5,n_jobs=2, random_state=generator)
fri.fit(X, y)
# non-regression test for missing worst feature:
assert len(fri.allrel_prediction_) == X.shape[1]
assert len(fri.interval_) == X.shape[1]
# All strongly relevant features have a lower bound > 0
assert np.all(fri.interval_[0:2,0]>0)
# All weakly relevant features should have a lower bound 0
assert np.any(fri.interval_[2:4,0]>0) == False
评论列表
文章目录