From 3e4debf6e31579f4abd4fc4186c266183cca56c1 Mon Sep 17 00:00:00 2001 From: jmarinllao Date: Tue, 12 May 2020 06:48:00 +0200 Subject: [PATCH 1/2] match_delete_rows in format_input, solve dimensional errors in cross validation --- src/diffupy/process_input.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/diffupy/process_input.py b/src/diffupy/process_input.py index 9c4d93a..0d0e55d 100644 --- a/src/diffupy/process_input.py +++ b/src/diffupy/process_input.py @@ -852,7 +852,8 @@ def format_categorical_input_vector_from_label_list( ) ) - return input_mat.match_missing_rows(kernel.rows_labels, missing_value).match_rows(kernel) + return input_mat.match_delete_rows(kernel.rows_labels).match_missing_rows(kernel.rows_labels, + missing_value).match_rows(kernel) def format_categorical_input_matrix_from_label_list( @@ -935,7 +936,8 @@ def format_input_vector_from_label_score_dict( ) ) - return input_mat.match_missing_rows(kernel.rows_labels, missing_value).match_rows(kernel) + return input_mat.match_delete_rows(kernel.rows_labels).match_missing_rows(kernel.rows_labels, + missing_value).match_rows(kernel) def format_input_matrix_from_type_label_score_dict( From 6998fc27a932e889dd3e12404aba6c2356c4585c Mon Sep 17 00:00:00 2001 From: jmarinllao Date: Tue, 12 May 2020 06:59:14 +0200 Subject: [PATCH 2/2] flake8 corrections --- src/diffupy/cli.py | 2 +- src/diffupy/process_input.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/diffupy/cli.py b/src/diffupy/cli.py index a2a1edf..ca9d6be 100644 --- a/src/diffupy/cli.py +++ b/src/diffupy/cli.py @@ -165,7 +165,7 @@ def diffuse( threshold, ) - click.secho(f'Computing the diffusion algorithm.') + click.secho('Computing the diffusion algorithm.') results = run_diffusion( input_scores_dict, diff --git a/src/diffupy/process_input.py b/src/diffupy/process_input.py index 0d0e55d..b0d14f3 100644 --- a/src/diffupy/process_input.py +++ b/src/diffupy/process_input.py @@ -199,8 +199,8 @@ def _load_data_input_from_file(path: str, **further_parse_args) -> Union[pd.Data else: raise IOError( - f'There is a problem with your file. Please ensure the file you submitted is correctly formatted with a' - f'.csv or .tsv file extension.' + 'There is a problem with your file. Please ensure the file you submitted is correctly formatted with a' + '.csv or .tsv file extension.' ) @@ -231,9 +231,9 @@ def _codify_input_data( # Standardize the title of the node column labeling column to 'Label', for later processing. if LABEL not in df.columns: - for l in list(df.columns): - if l in NODE_LABELING: - df = df.rename(columns={l: LABEL}) + for column_label in list(df.columns): + if column_label in NODE_LABELING: + df = df.rename(columns={column_label: LABEL}) break # If node type provided in a column, classify in a dictionary the input codification by its node type.