Created
July 10, 2018 22:38
-
-
Save FisherKK/73eb3ff38fccc865b730ac74cb692b5a 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
model_parameters_0 = {'b': 200, 'w': np.array([3.0])} | |
model_parameters_1 = {'b': -160, 'w': np.array([12.0])} | |
f, axarr = plt.subplots(1, 2, figsize=(16, 5)) | |
axarr[0].scatter(df_data["size"], df_data["price"], | |
edgecolor='black', linewidth="1", s=70, alpha=0.7, c="#3176f7") | |
axarr[0].plot(np.arange(0, 120, 0.1), [predict([x], model_parameters_0) for x in np.arange(0, 120, 0.1)], | |
c="#eaa800", linewidth="3") | |
axarr[0].text(85, 474, "y = 3x + 200", color="#eaa800", fontsize=14, rotation=13) | |
axarr[0].set_title("y = wx + b, [w=3.0, b=200.0]") | |
axarr[0].set_xlabel("Size [m^2]") | |
axarr[0].set_ylabel("Price [k zł]") | |
axarr[0].set_ylim(0, 1000) | |
axarr[0].set_yticks(np.arange(0, 1000, 100)) | |
axarr[0].set_xticks(np.arange(0, 120, 10)) | |
axarr[0].grid(color='blue', linestyle='--', linewidth=1, alpha=0.1) | |
axarr[0].spines["top"].set_visible(False) | |
axarr[0].spines["right"].set_visible(False) | |
axarr[0].spines["bottom"].set_visible(False) | |
axarr[0].spines["left"].set_visible(False) | |
axarr[1].scatter(df_data["size"], df_data["price"], | |
edgecolor='black', linewidth="1", s=70, alpha=0.7, c="#3176f7") | |
axarr[1].plot(np.arange(0, 120, 0.1), [predict([x], model_parameters_1) for x in np.arange(0, 120, 0.1)], | |
c="#a2d800", linewidth="3") | |
axarr[1].text(56, 900, "y = 12x - 160", color="#95c600", fontsize=14, rotation=41) | |
axarr[1].set_title("y = wx + b, [w=12.0, b=-160.0]") | |
axarr[1].set_xlabel("Size [m^2]") | |
axarr[1].set_ylabel("Price [k zł]") | |
axarr[1].set_ylim(-100, 1000) | |
axarr[1].set_yticks(np.arange(0, 1000, 100)) | |
axarr[1].set_xticks(np.arange(0, 120, 10)) | |
axarr[1].grid(color='blue', linestyle='--', linewidth=1, alpha=0.1) | |
axarr[1].spines["top"].set_visible(False) | |
axarr[1].spines["right"].set_visible(False) | |
axarr[1].spines["bottom"].set_visible(False) | |
axarr[1].spines["left"].set_visible(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment