[Enhancement] Swappable Packages (#216)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#216
Reviewed-by: liambrydon <lbry121@aucklanduni.ac.nz>
Reviewed-by: Tobias O <tobias.olenyi@envipath.com>
This commit is contained in:
2025-11-14 21:42:39 +13:00
parent d584791ee8
commit a8554c903c
22 changed files with 239 additions and 179 deletions

View File

@ -1,10 +1,13 @@
from tempfile import TemporaryDirectory
import numpy as np
from django.conf import settings as s
from django.test import TestCase
from epdb.logic import PackageManager
from epdb.models import User, MLRelativeReasoning, Package, RuleBasedRelativeReasoning
from epdb.models import MLRelativeReasoning, RuleBasedRelativeReasoning, User
Package = s.GET_PACKAGE_MODEL()
class ModelTest(TestCase):
@ -85,7 +88,7 @@ class ModelTest(TestCase):
mod.build_model()
mod.evaluate_model(True, eval_packages_objs, n_splits=2)
results = mod.predict("CCN(CC)C(=O)C1=CC(=CC=C1)C")
_ = mod.predict("CCN(CC)C(=O)C1=CC(=CC=C1)C")
def test_rbrr(self):
with TemporaryDirectory() as tmpdir:
@ -103,12 +106,12 @@ class ModelTest(TestCase):
threshold=threshold,
min_count=5,
max_count=0,
name='ECC - BBD - 0.5',
description='Created MLRelativeReasoning in Testcase',
name="ECC - BBD - 0.5",
description="Created MLRelativeReasoning in Testcase",
)
mod.build_dataset()
mod.build_model()
mod.evaluate_model(True, eval_packages_objs, n_splits=2)
results = mod.predict("CCN(CC)C(=O)C1=CC(=CC=C1)C")
_ = mod.predict("CCN(CC)C(=O)C1=CC(=CC=C1)C")