Skip to content

Commit 75091e3

Browse files
author
Florian Gardin
committed
fix documentation
1 parent 2d1d29c commit 75091e3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

examples/plot_credit_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
# fit the model
150150

151151
clf = SkopeRules(
152-
similarity_thres=.8, max_depth=3, max_features=0.5,
152+
max_depth_duplication=3, max_depth=3, max_features=0.5,
153153
max_samples_features=0.5, random_state=rng, n_estimators=20,
154154
feature_names=feature_names, recall_min=0.04, precision_min=0.6)
155155
clf.fit(X_train, y_train)

skrules/tests/test_skope_rules.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ def test_skope_rules_works():
141141
assert_array_equal(pred, 6 * [0] + 2 * [1])
142142
assert_array_equal(pred_score_top_rules, 6 * [0] + 2 * [1])
143143

144+
def test_deduplication_works():
145+
# toy sample (the last two samples are outliers)
146+
X = [[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1], [6, 3], [4, -7]]
147+
y = [0] * 6 + [1] * 2
148+
X_test = [[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1],
149+
[10, 5], [5, -7]]
150+
# Test LOF
151+
clf = SkopeRules(random_state=rng, max_samples=1., max_depth_duplication=3)
152+
clf.fit(X, y)
153+
decision_func = clf.decision_function(X_test)
154+
rules_vote = clf.rules_vote(X_test)
155+
score_top_rules = clf.score_top_rules(X_test)
156+
pred = clf.predict(X_test)
157+
pred_score_top_rules = clf.predict_top_rules(X_test,1)
158+
159+
144160
def test_performances():
145161
X, y = make_blobs(n_samples=1000, random_state=0, centers=2)
146162

0 commit comments

Comments
 (0)