lecrapaud 0.18.3__py3-none-any.whl → 0.18.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lecrapaud might be problematic. Click here for more details.

@@ -25,7 +25,7 @@ from lecrapaud.db.models.score import Score
25
25
 
26
26
  from lecrapaud.db.models.base import Base, with_db
27
27
  from lecrapaud.db.models.utils import create_association_table
28
- from lecrapaud.utils import logger
28
+ from lecrapaud.utils import logger, contains_best
29
29
 
30
30
  # jointures
31
31
  lecrapaud_experiment_target_association = create_association_table(
@@ -237,13 +237,27 @@ class Experiment(Base):
237
237
  Returns:
238
238
  Experiment or None: The experiment with the best score or None if not found
239
239
  """
240
+ experiments = db.query(cls).filter(cls.name.ilike(f"%{name}%")).all()
241
+ if not experiments:
242
+ logger.error(f"No experiments found with the given name: {name}")
243
+ return None
244
+
245
+ experiments = [
246
+ exp
247
+ for exp in experiments
248
+ if all(
249
+ [contains_best(f"{exp.path}/{target.name}") for target in exp.targets]
250
+ )
251
+ ]
252
+ if not experiments:
253
+ logger.error(
254
+ f"No fully trained experiments found with the given name: {name}"
255
+ )
256
+ return None
257
+
240
258
  if metric == "both":
241
259
  # Calculate a combined score: average of normalized RMSE and LogLoss
242
260
  # This ensures we're comparing apples to apples by normalizing the scores
243
- experiments = db.query(cls).filter(cls.name.ilike(f"%{name}%")).all()
244
- if not experiments:
245
- logger.error(f"No experiments found with the given name: {name}")
246
- return None
247
261
 
248
262
  # Get all scores
249
263
  rmse_scores = [e.avg_rmse for e in experiments if e.avg_rmse is not None]
@@ -284,11 +298,6 @@ class Experiment(Base):
284
298
 
285
299
  elif metric == "rmse" or metric == "logloss":
286
300
  # For single metric case (rmse or logloss)
287
- # Need to get all experiments first to evaluate instance properties
288
- experiments = db.query(cls).filter(cls.name.ilike(f"%{name}%")).all()
289
-
290
- if not experiments:
291
- return None
292
301
 
293
302
  # Filter out experiments without scores and sort by the selected metric
294
303
  filtered_experiments = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lecrapaud
3
- Version: 0.18.3
3
+ Version: 0.18.4
4
4
  Summary: Framework for machine and deep learning, with regression, classification and time series analysis
5
5
  License: Apache License
6
6
  Author: Pierre H. Gallet
@@ -13,7 +13,7 @@ lecrapaud/db/alembic/versions/2025_08_25_1434-7ed9963e732f_add_best_score_to_mod
13
13
  lecrapaud/db/alembic.ini,sha256=Zw2rdwsKV6c7J1SPtoFIPDX08_oTP3MuUKnNxBDiY8I,3796
14
14
  lecrapaud/db/models/__init__.py,sha256=Lhyw9fVLdom0Fc6yIP-ip8FjkU1EwVwjae5q2VM815Q,740
15
15
  lecrapaud/db/models/base.py,sha256=J9ew-0z_-tnWAwhVvOmVDys2R6jPF_oSca_ny6wpXQE,7606
16
- lecrapaud/db/models/experiment.py,sha256=rgNpCNXMei5VhJDNKxelpwqv7iTxoPJ2kkffGaua2sA,14710
16
+ lecrapaud/db/models/experiment.py,sha256=LjsMTY-PA9HZ27D2sz2fWy7HvwFqiS0dXKaiKF-S3k4,14868
17
17
  lecrapaud/db/models/feature.py,sha256=5o77O2FyRObnLOCGNj8kaPSGM3pLv1Ov6mXXHYkmnYY,1136
18
18
  lecrapaud/db/models/feature_selection.py,sha256=mk42xuw1Sm_7Pznfg7TNc5_S4hscdw79QgIe3Bt9ZRI,3245
19
19
  lecrapaud/db/models/feature_selection_rank.py,sha256=Ydsb_rAT58FoSH13wkGjGPByzsjPx3DITXgJ2jgZmow,2198
@@ -40,7 +40,7 @@ lecrapaud/misc/test-gpu-transformers.ipynb,sha256=k6MBSs_Um1h4PykvE-LTBcdpbWLbIF
40
40
  lecrapaud/model_selection.py,sha256=WbFn4wiykD8DOJ_7OsZLoocp-q4GDzW0dXCf-hHhl74,72471
41
41
  lecrapaud/search_space.py,sha256=-JkzuMhaomdwiWi4HvVQY5hiw3-oREemJA16tbwEIp4,34854
42
42
  lecrapaud/utils.py,sha256=eMnNVKWTqzXCLaaxSbKLBrThkOWoJrieifr9PNqFD5Y,8375
43
- lecrapaud-0.18.3.dist-info/LICENSE,sha256=MImCryu0AnqhJE_uAZD-PIDKXDKb8sT7v0i1NOYeHTM,11350
44
- lecrapaud-0.18.3.dist-info/METADATA,sha256=RYBX8NxcLXMDYU4FDkkZW9iIynfLqmpkQd9FozyFPzQ,11081
45
- lecrapaud-0.18.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
46
- lecrapaud-0.18.3.dist-info/RECORD,,
43
+ lecrapaud-0.18.4.dist-info/LICENSE,sha256=MImCryu0AnqhJE_uAZD-PIDKXDKb8sT7v0i1NOYeHTM,11350
44
+ lecrapaud-0.18.4.dist-info/METADATA,sha256=R9NN1DuZMKM9r4Z51Wy2lpaRL6ZAJiRDQ7ksgYt4hi4,11081
45
+ lecrapaud-0.18.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
46
+ lecrapaud-0.18.4.dist-info/RECORD,,