本文整理汇总了Python中imblearn.under_sampling.RepeatedEditedNearestNeighbours.fit方法的典型用法代码示例。如果您正苦于以下问题:Python RepeatedEditedNearestNeighbours.fit方法的具体用法?Python RepeatedEditedNearestNeighbours.fit怎么用?Python RepeatedEditedNearestNeighbours.fit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imblearn.under_sampling.RepeatedEditedNearestNeighbours
的用法示例。
在下文中一共展示了RepeatedEditedNearestNeighbours.fit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_renn_sample_wrong_X
# 需要导入模块: from imblearn.under_sampling import RepeatedEditedNearestNeighbours [as 别名]
# 或者: from imblearn.under_sampling.RepeatedEditedNearestNeighbours import fit [as 别名]
def test_renn_sample_wrong_X():
"""Test either if an error is raised when X is different at fitting
and sampling"""
# Create the object
renn = RepeatedEditedNearestNeighbours(random_state=RND_SEED)
renn.fit(X, Y)
assert_raises(RuntimeError, renn.sample,
np.random.random((100, 40)), np.array([0] * 50 + [1] * 50))
示例2: test_renn_fit
# 需要导入模块: from imblearn.under_sampling import RepeatedEditedNearestNeighbours [as 别名]
# 或者: from imblearn.under_sampling.RepeatedEditedNearestNeighbours import fit [as 别名]
def test_renn_fit():
"""Test the fitting method"""
# Create the object
renn = RepeatedEditedNearestNeighbours(random_state=RND_SEED)
# Fit the data
renn.fit(X, Y)
# Check if the data information have been computed
assert_equal(renn.min_c_, 0)
assert_equal(renn.maj_c_, 1)
assert_equal(renn.stats_c_[0], 500)
assert_equal(renn.stats_c_[1], 4500)
开发者ID:integrallyclosed,项目名称:imbalanced-learn,代码行数:15,代码来源:test_repeated_edited_nearest_neighbours.py