def model(X_train, Y_train, X_test, Y_test, num_iterations=2000, learning_rate=0.5, print_cost=False): w, b = inicializarconcero(X_train.shape[0]) parameters, grads, costs = optimizar(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost) w = parameters["w"] b = parameters["b"] Y_prediction_test = predict4(w, b, X_test) Y_prediction_train = predict4(w, b, X_train) d = { "costos": costs, "Y_pred_test": Y_prediction_test, "Y_pred_variable": Y_prediction_train, "w": w, "b": b, "learning_rate": learning_rate, "cantidad_iteraciones": num_iterations } return d
print("db = " + str(grads["db"])) print("cost = " + str(cost)) print("-----------------------------------") params, grads, costs = optimizar(w, b, X, y, num_iterations=10, learning_rate=0.009, print_costo=False) print("w = " + str(params["w"])) print("b = " + str(params["b"])) print("dw = " + str(grads["dw"])) print("db = " + str(grads["db"])) print("-----------------------------------") print("predictions = " + str(predict4(w, b, X))) def gradiente_aprendisaje(X, y, dimensiones, curvaaprendisaje=0.01, num_iterations=200, print_costo=True, theta="relu", initialization_method="he"): np.random.seed(1) costo_list = []
print("db = " + str(grads["db"])) print("cost = " + str(cost)) print("-----------------------------------") params, grads, costs = optimizar(w, b, X, y, num_iterations=10, learning_rate=0.009, print_costo=False) print("w = " + str(params["w"])) print("b = " + str(params["b"])) print("dw = " + str(grads["dw"])) print("db = " + str(grads["db"])) print("-----------------------------------") print("predictions = " + str(predict4(w, b, X))) def gradiente_aprendisaje(X, y, dimensiones, curvaaprendisaje=0.01, num_iterations=200, print_costo=True, theta="relu", initialization_method="he"): np.random.seed(1) costo_list = []
print("db = " + str(grads["db"])) print("cost = " + str(cost)) print("-----------------------------------") params, grads, costs = optimizar(w, b, X, y, num_iterations=10, learning_rate=0.009, print_costo=False) print("w = " + str(params["w"])) print("b = " + str(params["b"])) print("dw = " + str(grads["dw"])) print("db = " + str(grads["db"])) print("-----------------------------------") print("predictions = " + str(predict4(w, b, X))) def gradiente_aprendisaje(X, y, dimensiones, curvaaprendisaje=0.01, num_iterations=200, print_costo=True, theta="relu", initialization_method="he"): np.random.seed(1) costo_list = []
print("db = " + str(grads["db"])) print("cost = " + str(cost)) print("-----------------------------------") params, grads, costs = optimizar(w, b, X, y, num_iterations=10, learning_rate=0.009, print_costo=False) print("w = " + str(params["w"])) print("b = " + str(params["b"])) print("dw = " + str(grads["dw"])) print("db = " + str(grads["db"])) print("-----------------------------------") print("predictions = " + str(predict4(w, b, X))) def gradiente_aprendisaje(X, y, dimensiones, curvaaprendisaje=0.01, num_iterations=200, print_costo=True, theta="relu", initialization_method="he"): np.random.seed(1) costo_list = []