mcp-automl 0.1.5__py3-none-any.whl → 0.1.7__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.
- mcp_automl/server.py +45 -8
- {mcp_automl-0.1.5.dist-info → mcp_automl-0.1.7.dist-info}/METADATA +3 -2
- mcp_automl-0.1.7.dist-info/RECORD +8 -0
- mcp_automl-0.1.5.dist-info/RECORD +0 -8
- {mcp_automl-0.1.5.dist-info → mcp_automl-0.1.7.dist-info}/WHEEL +0 -0
- {mcp_automl-0.1.5.dist-info → mcp_automl-0.1.7.dist-info}/entry_points.txt +0 -0
- {mcp_automl-0.1.5.dist-info → mcp_automl-0.1.7.dist-info}/licenses/LICENSE +0 -0
mcp_automl/server.py
CHANGED
|
@@ -10,8 +10,8 @@ import argparse
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from mcp.server.fastmcp import FastMCP, Context
|
|
12
12
|
from mcp.types import PromptMessage, TextContent
|
|
13
|
-
from pycaret.classification import setup as setup_clf, compare_models as compare_models_clf, pull as pull_clf, save_model as save_model_clf, load_model as load_model_clf, predict_model as predict_model_clf, get_config as get_config_clf
|
|
14
|
-
from pycaret.regression import setup as setup_reg, compare_models as compare_models_reg, pull as pull_reg, save_model as save_model_reg, load_model as load_model_reg, predict_model as predict_model_reg, get_config as get_config_reg
|
|
13
|
+
from pycaret.classification import setup as setup_clf, compare_models as compare_models_clf, pull as pull_clf, save_model as save_model_clf, load_model as load_model_clf, predict_model as predict_model_clf, get_config as get_config_clf, tune_model as tune_model_clf, finalize_model as finalize_model_clf
|
|
14
|
+
from pycaret.regression import setup as setup_reg, compare_models as compare_models_reg, pull as pull_reg, save_model as save_model_reg, load_model as load_model_reg, predict_model as predict_model_reg, get_config as get_config_reg, tune_model as tune_model_reg, finalize_model as finalize_model_reg
|
|
15
15
|
|
|
16
16
|
# Configure logging
|
|
17
17
|
logging.basicConfig(
|
|
@@ -363,12 +363,31 @@ def _train_classifier_sync(run_id: str, data_path: str, target_column: str, igno
|
|
|
363
363
|
best_model = best_model[0]
|
|
364
364
|
results = pull_clf()
|
|
365
365
|
|
|
366
|
-
#
|
|
366
|
+
# Tune Model
|
|
367
|
+
logger.info("Tuning best model with Optuna...")
|
|
368
|
+
try:
|
|
369
|
+
best_model = tune_model_clf(best_model, optimize=optimize, search_library="optuna", n_trials=10)
|
|
370
|
+
results = pull_clf()
|
|
371
|
+
except Exception as e:
|
|
372
|
+
logger.warning(f"Tuning failed: {e}. Proceeding with untuned model.")
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
# Extract feature importances (from the potentially tuned model)
|
|
367
376
|
feature_importances = _get_feature_importances(best_model, get_config_clf)
|
|
368
377
|
|
|
369
|
-
# Evaluate on holdout (
|
|
370
|
-
|
|
371
|
-
|
|
378
|
+
# Evaluate on holdout (test_data_path)
|
|
379
|
+
test_results = None
|
|
380
|
+
if test_data_path:
|
|
381
|
+
logger.info("Evaluating on provided test data...")
|
|
382
|
+
predict_model_clf(best_model)
|
|
383
|
+
test_results = pull_clf()
|
|
384
|
+
|
|
385
|
+
# Finalize Model
|
|
386
|
+
logger.info("Finalizing model on all data...")
|
|
387
|
+
try:
|
|
388
|
+
best_model = finalize_model_clf(best_model)
|
|
389
|
+
except Exception as e:
|
|
390
|
+
logger.warning(f"Finalization failed: {e}. Saving non-finalized model.")
|
|
372
391
|
|
|
373
392
|
metadata = {
|
|
374
393
|
"data_path": data_path,
|
|
@@ -543,12 +562,30 @@ def _train_regressor_sync(run_id: str, data_path: str, target_column: str, ignor
|
|
|
543
562
|
best_model = best_model[0]
|
|
544
563
|
results = pull_reg()
|
|
545
564
|
|
|
565
|
+
# Tune Model
|
|
566
|
+
logger.info("Tuning best model with Optuna...")
|
|
567
|
+
try:
|
|
568
|
+
best_model = tune_model_reg(best_model, optimize=optimize, search_library="optuna", n_trials=10)
|
|
569
|
+
results = pull_reg()
|
|
570
|
+
except Exception as e:
|
|
571
|
+
logger.warning(f"Tuning failed: {e}. Proceeding with untuned model.")
|
|
572
|
+
|
|
546
573
|
# Extract feature importances
|
|
547
574
|
feature_importances = _get_feature_importances(best_model, get_config_reg)
|
|
548
575
|
|
|
549
576
|
# Evaluate on holdout
|
|
550
|
-
|
|
551
|
-
|
|
577
|
+
test_results = None
|
|
578
|
+
if test_data_path:
|
|
579
|
+
logger.info("Evaluating on provided test data...")
|
|
580
|
+
predict_model_reg(best_model)
|
|
581
|
+
test_results = pull_reg()
|
|
582
|
+
|
|
583
|
+
# Finalize Model
|
|
584
|
+
logger.info("Finalizing model on all data...")
|
|
585
|
+
try:
|
|
586
|
+
best_model = finalize_model_reg(best_model)
|
|
587
|
+
except Exception as e:
|
|
588
|
+
logger.warning(f"Finalization failed: {e}. Saving non-finalized model.")
|
|
552
589
|
|
|
553
590
|
metadata = {
|
|
554
591
|
"data_path": data_path,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp-automl
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: MCP server for end-to-end machine learning
|
|
5
5
|
Author-email: ke <idea7766@gmail.com>
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Requires-Python: <3.12,>=3.10
|
|
8
|
-
Requires-Dist: duckdb>=1.4.3
|
|
8
|
+
Requires-Dist: duckdb[all]>=1.4.3
|
|
9
9
|
Requires-Dist: joblib<1.4
|
|
10
10
|
Requires-Dist: mcp>=1.21.2
|
|
11
11
|
Requires-Dist: pandas<2.2.0
|
|
12
|
+
Requires-Dist: pyarrow>=23.0.0
|
|
12
13
|
Requires-Dist: pycaret>=3.0.0
|
|
13
14
|
Requires-Dist: scikit-learn<1.4
|
|
14
15
|
Requires-Dist: tabulate>=0.9.0
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
mcp_automl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mcp_automl/__main__.py,sha256=ncTRY5zgcNOS7JcLnCVhPd9KsxjyREC245P2eo33BuI,74
|
|
3
|
+
mcp_automl/server.py,sha256=cyxXkNnDc9qHyp3hBUvrxXwI1Ww67XU7uTLrqCw-po8,43972
|
|
4
|
+
mcp_automl-0.1.7.dist-info/METADATA,sha256=z4rojoKfG5twMzP616RdOrOE5zHKN0AHoAlyaS2_zBY,3674
|
|
5
|
+
mcp_automl-0.1.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
mcp_automl-0.1.7.dist-info/entry_points.txt,sha256=7QuAE_HatGpFE7Ul7hqNHmpaMf0Ug86aFkaCXofjhLg,54
|
|
7
|
+
mcp_automl-0.1.7.dist-info/licenses/LICENSE,sha256=MLSjoBTdoZnIBt__JNue8D2KnKqNg7Mt_LYWn9vNNws,1065
|
|
8
|
+
mcp_automl-0.1.7.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
mcp_automl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mcp_automl/__main__.py,sha256=ncTRY5zgcNOS7JcLnCVhPd9KsxjyREC245P2eo33BuI,74
|
|
3
|
-
mcp_automl/server.py,sha256=rk8mQFSm-Y-p5-6DqvPkdiUN6WQrC7jXGXTb4Byedgw,42435
|
|
4
|
-
mcp_automl-0.1.5.dist-info/METADATA,sha256=iB054Xp5j3YMPsr2CmpuOuq2kyQaq20stDRsrwcJBfY,3638
|
|
5
|
-
mcp_automl-0.1.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
mcp_automl-0.1.5.dist-info/entry_points.txt,sha256=7QuAE_HatGpFE7Ul7hqNHmpaMf0Ug86aFkaCXofjhLg,54
|
|
7
|
-
mcp_automl-0.1.5.dist-info/licenses/LICENSE,sha256=MLSjoBTdoZnIBt__JNue8D2KnKqNg7Mt_LYWn9vNNws,1065
|
|
8
|
-
mcp_automl-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|