Skip to content
Snippets Groups Projects
Commit fa353a34 authored by Alex Rubinsteyn's avatar Alex Rubinsteyn
Browse files

fixed obscure shape bug on empty arrays

parent 345869a0
No related merge requests found
......@@ -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)
......@@ -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 = \
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment