Created
April 19, 2018 15:24
-
-
Save freedomtowin/6040d6ade6c6434b8952285e0ff21f42 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 poly_least_sqs_loss(x,y,w): | |
hypothesis = w[0]*x[:,0:1] + w[1]*(x[:,1:2]) + w[2]*(x[:,1:2])**w[3] | |
loss = hypothesis-y | |
return np.sum(loss**2)/len(y) | |
start_time = time.time() | |
X = train[['sqft_living']].values | |
y = train[["price"]].values | |
model = kernel_optimizer(X,y,poly_least_sqs_loss,num_param=4) | |
model.add_intercept() | |
model.adjust_uniform_random_low_high(0,2) | |
model.kernel_optimize_(optimizer=pid_linear_combination) | |
end_time = time.time() | |
print("time:",end_time-start_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment