I tried to measure the execution times of the solutions proposed so far:
Benchmark data:
prob = np.random.rand(10000, 500)
@Massifox' solution with list:
%%timeit
[i for i, val in enumerate(prob>1e-6)if val.sum() < 3]
# 39.5 ms ± 1.4 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
@Massifox' solution only numpy:
%%timeit
np.where(np.sum(prob>1e-6, axis=1) < 3)
# 9.92 ms ± 199 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%%timeit
all_zero = np.logical_or(prob.max(axis=1) < 1e-6, np.sum(prob != 0, axis=1) < 3)
np.where(all_zero)
# 13.9 ms ± 150 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
The most efficient solution seems to be the second one.
nonzero, i.e.np.nonzero(prob).sum(axis=1).