Mercurial > repos > bgruening > keras_model_builder
comparison ml_visualization_ex.py @ 13:ebd3bd2f2985 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 80417bf0158a9b596e485dd66408f738f405145a
author | bgruening |
---|---|
date | Mon, 02 Oct 2023 08:46:12 +0000 |
parents | 9ac42e46dfbd |
children |
comparison
equal
deleted
inserted
replaced
12:0460590afd6e | 13:ebd3bd2f2985 |
---|---|
7 import matplotlib.pyplot as plt | 7 import matplotlib.pyplot as plt |
8 import numpy as np | 8 import numpy as np |
9 import pandas as pd | 9 import pandas as pd |
10 import plotly | 10 import plotly |
11 import plotly.graph_objs as go | 11 import plotly.graph_objs as go |
12 from galaxy_ml.utils import load_model, read_columns, SafeEval | 12 from galaxy_ml.model_persist import load_model_from_h5 |
13 from keras.models import model_from_json | 13 from galaxy_ml.utils import read_columns, SafeEval |
14 from keras.utils import plot_model | 14 from sklearn.feature_selection._base import SelectorMixin |
15 from sklearn.feature_selection.base import SelectorMixin | 15 from sklearn.metrics import ( |
16 from sklearn.metrics import (auc, average_precision_score, confusion_matrix, | 16 auc, |
17 precision_recall_curve, roc_curve) | 17 average_precision_score, |
18 confusion_matrix, | |
19 precision_recall_curve, | |
20 roc_curve, | |
21 ) | |
18 from sklearn.pipeline import Pipeline | 22 from sklearn.pipeline import Pipeline |
23 from tensorflow.keras.models import model_from_json | |
24 from tensorflow.keras.utils import plot_model | |
19 | 25 |
20 safe_eval = SafeEval() | 26 safe_eval = SafeEval() |
21 | 27 |
22 # plotly default colors | 28 # plotly default colors |
23 default_colors = [ | 29 default_colors = [ |
355 title = params["plotting_selection"]["title"].strip() | 361 title = params["plotting_selection"]["title"].strip() |
356 plot_type = params["plotting_selection"]["plot_type"] | 362 plot_type = params["plotting_selection"]["plot_type"] |
357 plot_format = params["plotting_selection"]["plot_format"] | 363 plot_format = params["plotting_selection"]["plot_format"] |
358 | 364 |
359 if plot_type == "feature_importances": | 365 if plot_type == "feature_importances": |
360 with open(infile_estimator, "rb") as estimator_handler: | 366 estimator = load_model_from_h5(infile_estimator) |
361 estimator = load_model(estimator_handler) | |
362 | 367 |
363 column_option = params["plotting_selection"]["column_selector_options"][ | 368 column_option = params["plotting_selection"]["column_selector_options"][ |
364 "selected_column_selector_option" | 369 "selected_column_selector_option" |
365 ] | 370 ] |
366 if column_option in [ | 371 if column_option in [ |