import math
# Write a function that takes as input two lists Y, P,# and returns the float corresponding to their cross-entropy.defcross_entropy(Y, P):sum=0.0for x inmap(lambda y,p:(1-y)*math.log(1-p)+y*math.log(p),Y,P):sum+=x
return-sum/len(Y)if __name__ =="__main__&
代码实现import math# Write a function that takes as input two lists Y, P,# and returns the float corresponding to their cross-entropy.def cross_entropy(Y, P): sum=0.0 for x in map(lambda y,p:(...