Рассчитайте среднюю квадратную ошибку Python
def rmse(predictions, targets):
return np.sqrt(((predictions - targets) ** 2).mean())
Lonely Leopard
def rmse(predictions, targets):
return np.sqrt(((predictions - targets) ** 2).mean())
a = int(input("enter a real number: "))
sqrt = a**(1/2)
print("the square root of ",a ,"is",sqrt)
def square_root(num):
return num**0.5
#prints out 4
print(square_root(16))
#prints out 10
print(square_root(100))
def rms(x):
rms = np.sqrt(np.mean(x**2))
return rms