From 84cb69f0246599c2ce646316c65e52fef0014869 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Thu, 29 Jul 2021 22:38:26 +0300 Subject: [PATCH] [~] Refactor --- python/tasks/mlb_player.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/python/tasks/mlb_player.py b/python/tasks/mlb_player.py index c3a0edf..0d49a7b 100644 --- a/python/tasks/mlb_player.py +++ b/python/tasks/mlb_player.py @@ -1844,6 +1844,26 @@ def kernel_30(o_29, ids=None, delay=None,): ids, o_29['t5'].sel(index=o_29['t5'].index.data[ids[:5]]).to_dict(), ]) + elif ids == 'v7': + t8 = numpy.stack( + [ + o_29['t5'].portion > 0.02, + o_29['t5'].min_conf > 0.4, + o_29['t5']['t7'].data > 0, + ], + axis=0 + ).prod(axis=0) + ids = numpy.random.choice( + numpy.where(t8)[0], + min(70, t8.sum()), + replace=False, + ) + pprint.pprint([ + t8.sum(), + t8.mean(), + ids, + o_29['t5'].sel(index=o_29['t5'].index.data[ids[:5]]).to_dict(), + ]) else: assert isinstance(ids, numpy.ndarray)