jeudi 5 mars 2020

Voting Method using nested ifs [closed]

I am new to python and I want to make a method that given a string, it processes it through 5 classifiers and gives out a total of the majority vote. Each classifier prints out 1 or 0. 1 if the string matches the classifier, 0 if it doesn't. Any ideas?

def clf(text):
# return 1 if the BPG of the tox model is lower, 0 else.
tox_bpg = tox_lm.cross_entropy(text)
notox_bpg = notox_lm.cross_entropy(text)
return 1 if tox_bpg<notox_bpg else 0

 def counting(str,a,b,g,d,e):
  if int>a:
   print("a")
   if int>b:
    print("b")
    if int>g:
     print("g")
     if int>d:
      print("d")
  else: 
  print("e")

Aucun commentaire:

Enregistrer un commentaire