Created
September 26, 2017 02:08
-
-
Save starhopp3r/6d2b3f7a269ed9648d6f037e90599362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(): | |
points = genfromtxt('data.csv', delimiter=',') | |
# Hyperparameter | |
learning_rate = 0.0001 | |
# Initial values: y = mx + c | |
initial_c = 0 | |
initial_m = 0 | |
# Iterations | |
num_iterations = 1000 | |
# Optimal values for m and c | |
[c, m] = gradient_descent_runner(points, initial_c, initial_m, learning_rate, num_iterations) | |
# Results | |
error = compute_error_for_points(c, m, points) | |
print("Optimized after {0} iterations: m = {1}, c = {2} and error = {3}".format(num_iterations, m, c, error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment