diff --git a/mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py b/mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py index 0d2ffd707ac1ee6b4c5322544e2656aca4fb6ec9..3a242d8b800dc3ccd33a67bed7e3e195541c183d 100644 --- a/mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py +++ b/mhcflurry/class1_allele_specific_kmer_ic50_predictor_base.py @@ -175,5 +175,5 @@ class Class1AlleleSpecificKmerIC50PredictorBase(IC50PredictorBase): sample_weights=sample_weights, X_pretrain=X_pretrain, ic50_pretrain=ic50_pretrain, - sample_weights_pretrain=sample_weights, + sample_weights_pretrain=sample_weights_pretrain, **kwargs) diff --git a/mhcflurry/dataset.py b/mhcflurry/dataset.py index 67fed68ddedffcc0e5bb9bcf6b38b568af8cd6f3..d58180d6ab05621d5e1342bb3feeb69408e23b00 100644 --- a/mhcflurry/dataset.py +++ b/mhcflurry/dataset.py @@ -437,10 +437,10 @@ class Dataset(object): """ if len(self.peptides) == 0: return ( - np.array([[]], dtype=int), - np.array([], dtype=float), - np.array([], dtype=float), - np.array([], dtype=int) + np.empty((0, kmer_size), dtype=int), + np.empty((0,), dtype=float), + np.empty((0,), dtype=float), + np.empty((0,), dtype=int) ) X_index, _, original_peptide_indices, counts = \ diff --git a/mhcflurry/training_helpers.py b/mhcflurry/training_helpers.py index c61adac8bcd9b710947a2184b6afdc8ccb0875d1..5a3be5c4cc61b6a09e5681980fd755b8382956d7 100644 --- a/mhcflurry/training_helpers.py +++ b/mhcflurry/training_helpers.py @@ -49,7 +49,6 @@ def check_encoded_array_shapes(X, Y, sample_weights): sample_weights.shape,)) n_samples, n_dims = X.shape - if len(Y) != n_samples: raise ValueError("Mismatch between len(X) = %d and len(Y) = %d" % ( n_samples, len(Y))) @@ -78,7 +77,6 @@ def combine_training_arrays( """ X = np.asarray(X) Y = np.asarray(Y) - if sample_weights is None: sample_weights = np.ones_like(Y) else: @@ -87,8 +85,8 @@ def combine_training_arrays( n_samples, n_dims = check_encoded_array_shapes(X, Y, sample_weights) if X_pretrain is None or Y_pretrain is None: - X_pretrain = np.empty((0, n_dims), dtype=X.dtype) - Y_pretrain = np.empty((0,), dtype=Y.dtype) + X_pretrain = np.zeros((0, n_dims), dtype=X.dtype) + Y_pretrain = np.zeros((0,), dtype=Y.dtype) else: X_pretrain = np.asarray(X_pretrain) Y_pretrain = np.asarray(Y_pretrain)