diff pycaret_predict.py @ 4:4aa511539199 draft default tip

planemo upload for repository https://github.com/goeckslab/Galaxy-Pycaret commit cf47efb521b91a9cb44ae5c5ade860627f9b9030
author goeckslab
date Tue, 03 Jun 2025 19:31:16 +0000
parents 915447b14520
children
line wrap: on
line diff
--- a/pycaret_predict.py	Wed Jan 01 03:19:40 2025 +0000
+++ b/pycaret_predict.py	Tue Jun 03 19:31:16 2025 +0000
@@ -3,16 +3,11 @@
 import tempfile
 
 import h5py
-
 import joblib
-
 import pandas as pd
-
 from pycaret.classification import ClassificationExperiment
 from pycaret.regression import RegressionExperiment
-
 from sklearn.metrics import average_precision_score
-
 from utils import encode_image_to_base64, get_html_closing, get_html_template
 
 LOG = logging.getLogger(__name__)
@@ -49,7 +44,7 @@
             exp = ClassificationExperiment()
             names = data.columns.to_list()
             LOG.error(f"Column names: {names}")
-            target_index = int(self.target)-1
+            target_index = int(self.target) - 1
             target_name = names[target_index]
             exp.setup(data, target=target_name, test_data=data, index=False)
             exp.add_metric(id='PR-AUC-Weighted',
@@ -73,8 +68,7 @@
                                                        'micro': False,
                                                        'macro': False,
                                                        'per_class': False,
-                                                       'binary': True
-                                                    })
+                                                       'binary': True})
                         plot_paths[plot_name] = plot_path
                         continue
 
@@ -101,7 +95,7 @@
         data = pd.read_csv(data_path, engine='python', sep=None)
         if self.target:
             names = data.columns.to_list()
-            target_index = int(self.target)-1
+            target_index = int(self.target) - 1
             target_name = names[target_index]
             exp = RegressionExperiment()
             exp.setup(data, target=target_name, test_data=data, index=False)