Dec-11-2019, 06:30 AM
Hi all,
I have read about list comprehensions
and I was wondering if my simple for loop below can be reduced to a list comprehension in python:
The loop only checks if the initial list has an entry of a specific value and if yes it increases a counter
Alex
I have read about list comprehensions
and I was wondering if my simple for loop below can be reduced to a list comprehension in python:
The loop only checks if the initial list has an entry of a specific value and if yes it increases a counter
zero_guess=max(classes_samples[idx]) # get the more frequent class
zero_precision=0
for i in (y_true[idx]):
if (i==zero_guess):
zero_precision=zero_precision+1Thanks a lotAlex
