Commit d65a1b13 authored by Martino Bertoni's avatar Martino Bertoni 🌋
Browse files

A1 sign0 must be reordered also at sign4 predict time

parent 56934832
Pipeline #2585 failed with stages
in 15 minutes and 23 seconds
......@@ -277,15 +277,16 @@ class sign4(BaseSignature, DataSignature):
results.create_dataset(
'V', (len(sign0.keys), 128), dtype=np.float32)
results.create_dataset("shape", data=(len(sign0.keys), 128))
for i in tqdm(range(0, len(sign0.keys), chunk_size)):
chunk = slice(i, i + chunk_size)
sign0s = sign0[chunk]
preds = predict_fn(sign0s)
# sign0 must be reordered
order = np.argsort(sign0.get_h5_dataset('features').astype(int))
cs = chunk_size
for chunk, rows in sign0.chunk_iter('V', cs, axis=0, chunk=True):
rows = rows[:, order]
preds = predict_fn(rows)
# save chunk to H5
results['V'][chunk] = preds[:]
# also run applicability prediction
apreds = appl_fn(sign0s)
apreds = appl_fn(rows)
results['applicability'][chunk] = apreds[:]
return pred_s3
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment