GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit dd9b5963 authored by Jens Plüddemann's avatar Jens Plüddemann

bug fixing

parent b8a6c777
......@@ -13,7 +13,12 @@ class SalaryData:
self.salary = self.df['Salary']
def plot_initial(self):
plt.scatter(self.years, self.salary)
plt.scatter(self.years, self.salary, label='initial data')
plt.xlabel('Years of experience')
plt.ylabel('Salary')
plt.title('Years of experience vs salary')
plt.legend()
plt.show()
......@@ -75,10 +80,12 @@ class SalaryData:
print(f'R-squared: {r_squared}')
print(f'R-squared sklearn: {reg_sl.score(self.years.to_numpy().reshape(-1, 1), self.salary.to_numpy().reshape(-1, 1))}')
sns.residplot(x='YearsExperience', y='Salary', data=self.df)
sns.residplot(x='YearsExperience', y='Salary', data=self.df, label='residuals')
plt.title('Residual plot')
plt.xlabel('Fitted values')
plt.ylabel('Residuals')
plt.legend()
plt.show()
......@@ -92,11 +99,11 @@ class SalaryData:
if __name__ == '__main__':
data_set = SalaryData('../../res/Salary_Data.csv')
# data_set.plot_initial()
# data_set.pearson_correlation_coefficient()
# data_set.linear_regression()
# data_set.linear_regression_sklearn()
# data_set.linear_regression_statsmodels()
# data_set.plot_regression()
data_set.plot_initial()
data_set.pearson_correlation_coefficient()
data_set.linear_regression()
data_set.linear_regression_sklearn()
data_set.linear_regression_statsmodels()
data_set.plot_regression()
data_set.evaluate_model()
data_set.predict_the_result()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment