From fb119518d71cbda82a4a7cbef5a62ecf13fb4548 Mon Sep 17 00:00:00 2001 From: rfriedman22 Date: Tue, 17 Mar 2020 11:40:09 -0500 Subject: [PATCH] Support Gram with trailing delim --- preimage/kernels/generic_string.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preimage/kernels/generic_string.py b/preimage/kernels/generic_string.py index 29209d4..121a66e 100644 --- a/preimage/kernels/generic_string.py +++ b/preimage/kernels/generic_string.py @@ -369,7 +369,7 @@ def set_gram_matrix_from_file(self, filename, delim="\t", lower_triangle=True): gram_matrix = np.eye(n_lines) with open(filename) as fin: for row, line in enumerate(fin): - line = map(float, line.split(delim)) + line = map(float, line.strip().split(delim)) for col, val in enumerate(line): if row != col: gram_matrix[row, col] = val