Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python function to check list element ratio with total data

def compensate_imbalance(data):
    total_data = len(data)
    clean_data = [item for n, item in enumerate(data) if item not in data[:n]]
    weight_list = [data.count(item)/total_data for item in clean_data]
    return weight_list
 
PREVIOUS NEXT
Tagged: #python #function #check #list #element #ratio #total #data
ADD COMMENT
Topic
Name
1+3 =