Mercurial > repos > bgruening > sklearn_regression_metrics
changeset 29:9c8ede554b7c draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 208a8d348e7c7a182cfbe1b6f17868146428a7e2"
author | bgruening |
---|---|
date | Tue, 13 Apr 2021 22:10:06 +0000 |
parents | 0cc5098a9bff |
children | 70c5a9127f99 |
files | fitted_model_eval.py keras_deep_learning.py keras_train_and_eval.py ml_visualization_ex.py model_prediction.py search_model_validation.py simple_model_fit.py stacking_ensembles.py train_test_eval.py train_test_split.py |
diffstat | 10 files changed, 55 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/fitted_model_eval.py Tue Apr 13 19:13:15 2021 +0000 +++ b/fitted_model_eval.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,13 +1,13 @@ import argparse import json -import pandas as pd import warnings +import pandas as pd +from galaxy_ml.utils import get_scoring, load_model, read_columns from scipy.io import mmread -from sklearn.pipeline import Pipeline from sklearn.metrics.scorer import _check_multimetric_scoring from sklearn.model_selection._validation import _score -from galaxy_ml.utils import get_scoring, load_model, read_columns +from sklearn.pipeline import Pipeline def _get_X_y(params, infile1, infile2):
--- a/keras_deep_learning.py Tue Apr 13 19:13:15 2021 +0000 +++ b/keras_deep_learning.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,14 +1,14 @@ import argparse import json +import pickle +import warnings +from ast import literal_eval + import keras import pandas as pd -import pickle import six -import warnings - -from ast import literal_eval -from keras.models import Sequential, Model -from galaxy_ml.utils import try_get_attr, get_search_params, SafeEval +from galaxy_ml.utils import get_search_params, SafeEval, try_get_attr +from keras.models import Model, Sequential safe_eval = SafeEval()
--- a/keras_train_and_eval.py Tue Apr 13 19:13:15 2021 +0000 +++ b/keras_train_and_eval.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,32 +1,32 @@ import argparse -import joblib import json -import numpy as np import os -import pandas as pd import pickle import warnings from itertools import chain -from scipy.io import mmread -from sklearn.pipeline import Pipeline -from sklearn.metrics.scorer import _check_multimetric_scoring -from sklearn.model_selection._validation import _score -from sklearn.model_selection import _search, _validation -from sklearn.utils import indexable, safe_indexing +import joblib +import numpy as np +import pandas as pd from galaxy_ml.externals.selene_sdk.utils import compute_score -from galaxy_ml.model_validations import train_test_split from galaxy_ml.keras_galaxy_models import _predict_generator +from galaxy_ml.model_validations import train_test_split from galaxy_ml.utils import ( - SafeEval, + clean_params, + get_main_estimator, + get_module, get_scoring, load_model, read_columns, + SafeEval, try_get_attr, - get_module, - clean_params, - get_main_estimator, ) +from scipy.io import mmread +from sklearn.metrics.scorer import _check_multimetric_scoring +from sklearn.model_selection import _search, _validation +from sklearn.model_selection._validation import _score +from sklearn.pipeline import Pipeline +from sklearn.utils import indexable, safe_indexing _fit_and_score = try_get_attr("galaxy_ml.model_validations", "_fit_and_score") @@ -104,7 +104,7 @@ rval = train_test_split(*new_arrays, **kwargs) for pos in nones: - rval[pos * 2 : 2] = [None, None] + rval[pos * 2: 2] = [None, None] return rval
--- a/ml_visualization_ex.py Tue Apr 13 19:13:15 2021 +0000 +++ b/ml_visualization_ex.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,21 +1,20 @@ import argparse import json +import os +import warnings + import matplotlib import matplotlib.pyplot as plt import numpy as np -import os import pandas as pd import plotly import plotly.graph_objs as go -import warnings - +from galaxy_ml.utils import load_model, read_columns, SafeEval from keras.models import model_from_json from keras.utils import plot_model from sklearn.feature_selection.base import SelectorMixin -from sklearn.metrics import precision_recall_curve, average_precision_score -from sklearn.metrics import roc_curve, auc, confusion_matrix +from sklearn.metrics import auc, average_precision_score, confusion_matrix, precision_recall_curve, roc_curve from sklearn.pipeline import Pipeline -from galaxy_ml.utils import load_model, read_columns, SafeEval safe_eval = SafeEval()
--- a/model_prediction.py Tue Apr 13 19:13:15 2021 +0000 +++ b/model_prediction.py Tue Apr 13 22:10:06 2021 +0000 @@ -4,13 +4,10 @@ import numpy as np import pandas as pd +from galaxy_ml.utils import get_module, load_model, read_columns, try_get_attr from scipy.io import mmread from sklearn.pipeline import Pipeline -from galaxy_ml.utils import (get_module, load_model, - read_columns, try_get_attr) - - N_JOBS = int(__import__("os").environ.get("GALAXY_SLOTS", 1))
--- a/search_model_validation.py Tue Apr 13 19:13:15 2021 +0000 +++ b/search_model_validation.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,15 +1,27 @@ import argparse import collections +import json +import os +import pickle +import sys +import warnings + import imblearn import joblib -import json import numpy as np -import os import pandas as pd -import pickle import skrebate -import sys -import warnings +from galaxy_ml.utils import ( + clean_params, + get_cv, + get_main_estimator, + get_module, + get_scoring, + load_model, + read_columns, + SafeEval, + try_get_attr +) from scipy.io import mmread from sklearn import ( cluster, @@ -20,21 +32,8 @@ preprocessing, ) from sklearn.exceptions import FitFailedWarning +from sklearn.model_selection import _search, _validation from sklearn.model_selection._validation import _score, cross_validate -from sklearn.model_selection import _search, _validation -from sklearn.pipeline import Pipeline - -from galaxy_ml.utils import ( - SafeEval, - get_cv, - get_scoring, - load_model, - read_columns, - try_get_attr, - get_module, - clean_params, - get_main_estimator, -) _fit_and_score = try_get_attr("galaxy_ml.model_validations", "_fit_and_score")
--- a/simple_model_fit.py Tue Apr 13 19:13:15 2021 +0000 +++ b/simple_model_fit.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,8 +1,8 @@ import argparse import json -import pandas as pd import pickle +import pandas as pd from galaxy_ml.utils import load_model, read_columns from scipy.io import mmread from sklearn.pipeline import Pipeline
--- a/stacking_ensembles.py Tue Apr 13 19:13:15 2021 +0000 +++ b/stacking_ensembles.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,13 +1,14 @@ import argparse import ast import json -import mlxtend.regressor -import mlxtend.classifier -import pandas as pd import pickle import sys import warnings -from galaxy_ml.utils import load_model, get_cv, get_estimator, get_search_params + +import mlxtend.classifier +import mlxtend.regressor +import pandas as pd +from galaxy_ml.utils import get_cv, get_estimator, get_search_params, load_model warnings.filterwarnings("ignore")
--- a/train_test_eval.py Tue Apr 13 19:13:15 2021 +0000 +++ b/train_test_eval.py Tue Apr 13 22:10:06 2021 +0000 @@ -3,7 +3,6 @@ import os import pickle import warnings - from itertools import chain import joblib @@ -21,7 +20,6 @@ from scipy.io import mmread from sklearn import pipeline from sklearn.metrics.scorer import _check_multimetric_scoring -from sklearn.model_selection._validation import _score from sklearn.model_selection import _search, _validation from sklearn.model_selection._validation import _score from sklearn.utils import indexable, safe_indexing
--- a/train_test_split.py Tue Apr 13 19:13:15 2021 +0000 +++ b/train_test_split.py Tue Apr 13 22:10:06 2021 +0000 @@ -1,8 +1,8 @@ import argparse import json -import pandas as pd import warnings +import pandas as pd from galaxy_ml.model_validations import train_test_split from galaxy_ml.utils import get_cv, read_columns