<jupyter_start><jupyter_text>cost<jupyter_code>theta = np.ones(X.shape[1])
lr.cost(theta, X, y)<jupyter_output><empty_output><jupyter_text>regularized cost<jupyter_code>lr.regularized_cost(theta, X, y)<jupyter_output><empty_output><jupyter_text>gradient<jupyter_code>lr.gradient(theta, X, y)<jupyter_output><empty_output><jupyter_text>regularized gradient<jupyter_code>lr.regularized_gradient(theta, X, y)<jupyter_output><empty_output><jupyter_text>fit the data> regularization term $\lambda=0$<jupyter_code>theta = np.ones(X.shape[0])

final_theta = lr.linear_regression_np(X, y, l=0).get('x')
b = final_theta[0] # intercept
m = final_theta[1] # slope

plt.scatter(X[:,1], y, label="Training data")
plt.plot(X[:, 1], X[:, 1]*m + b, label="Prediction")
plt.legend(loc=2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16875, 'fraction_numerical': 0.0125, 'mean_word_length': 11.515625, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '24115', 'license': 'Apache-2.0', 'n_tokens_mistral': 345, 'n_tokens_neox': 330, 'n_words': 40, 'path': 'machinelearning/Coursera-ML-AndrewNg/pythonversion/ex5-bias vs variance/2- regularization of linear regression.ipynb', 'repo_name': 'Asurada2015/machinelearningpractice', 'size': '800'}