Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix ldm windows
  • Loading branch information
antoinedemathelin committed Apr 11, 2022
commit 4240e7433187a5311b41d36e7050eb8ee9ab7b49
2 changes: 1 addition & 1 deletion src_docs/examples/tradaboost_experiments.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"metadata": {},
"source": [
"<div class=\"btn btn-notebook\" role=\"button\">\n",
" <img src=\"../_static/images/github_logo_32px.png\"> [View on GitHub](https://github.com/adapt-python/notebooks/blob/d0364973c642ea4880756cef4e9f2ee8bb5e8495/Two_moons.ipynb)\n",
" <img src=\"../_static/images/github_logo_32px.png\"> [View on GitHub](https://github.com/adapt-python/adapt/blob/master/src_docs/examples/tradaboost_experiments.ipynb)\n",
"</div>"
]
},
Expand Down
21 changes: 12 additions & 9 deletions tests/test_ldm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import os

from adapt.instance_based import LDM

Expand All @@ -16,15 +17,17 @@


def test_ldm():
ldm = LDM()
weights = ldm.fit_weights(Xs, Xt)
ldm.fit(Xs, ys, Xt)
yp = ldm.predict(Xt)
assert ldm.score(Xt, yt) > 0.9
assert weights[:25].mean() > 10 * weights[25:].mean()
if os.name != 'nt':
ldm = LDM()
weights = ldm.fit_weights(Xs, Xt)
ldm.fit(Xs, ys, Xt)
yp = ldm.predict(Xt)
assert ldm.score(Xt, yt) > 0.9
assert weights[:25].mean() > 10 * weights[25:].mean()


def test_ldm_diff_size():
ldm = LDM()
weights = ldm.fit_weights(Xs, Xt[:40])
assert weights[:25].mean() > 10 * weights[25:].mean()
if os.name != 'nt':
ldm = LDM()
weights = ldm.fit_weights(Xs, Xt[:40])
assert weights[:25].mean() > 10 * weights[25:].mean()