From fece83fa1a4b09aa3b06a5bea598fcce705136df Mon Sep 17 00:00:00 2001 From: Ctrl-Tim <73001228+Ctrl-Tim@users.noreply.github.com> Date: Sun, 10 Dec 2023 15:35:33 +0400 Subject: [PATCH] commit 2 --- .idea/workspace.xml | 101 ++++++++++++++++++++++++++-------- istyukov_timofey_lab1/lab1.py | 20 ++----- 2 files changed, 84 insertions(+), 37 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5f23f7a..4bd0d1c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,10 +4,9 @@ @@ -180,8 +221,24 @@ + - - + + + \ No newline at end of file diff --git a/istyukov_timofey_lab1/lab1.py b/istyukov_timofey_lab1/lab1.py index d9c7f23..9c00a83 100644 --- a/istyukov_timofey_lab1/lab1.py +++ b/istyukov_timofey_lab1/lab1.py @@ -9,12 +9,11 @@ import numpy as np from sklearn.datasets import make_classification from sklearn.linear_model import LinearRegression, Perceptron, Ridge -from matplotlib import pyplot as plt -from matplotlib.colors import ListedColormap from sklearn.model_selection import train_test_split -from sklearn.metrics import mean_absolute_error, mean_squared_error, accuracy_score, balanced_accuracy_score from sklearn.pipeline import make_pipeline from sklearn.preprocessing import PolynomialFeatures +from matplotlib import pyplot as plt +from matplotlib.colors import ListedColormap @@ -48,10 +47,7 @@ def my_linear_regression(X_train, X_test, y_train, y_test): # вывод в консоль print() print('===> Линейная регрессия <===') - print('Оценка точности:') - print('MAE:', mean_absolute_error(y_test, y_pred)) - print('MSE:', mean_squared_error(y_test, y_pred)) - print() + print('Оценка точности: ', lin_reg_model.score(X_train, y_train)) # вывод в график plt.title('Линейная регрессия') @@ -71,10 +67,7 @@ def my_perceptron(X_train, X_test, y_train, y_test): # вывод в консоль print() print('===> Персептрон <===') - print('Оценка точности:') - print('По тренировочным данным: ', perceptron_model.score(X_train, y_train)) - print('По тестовым данным: ', accuracy_score(y_test, y_pred)) - print() + print('Оценка точности: ', perceptron_model.score(X_train, y_train)) # вывод в график plt.title('Персептрон') @@ -94,10 +87,7 @@ def my_poly_ridge(X_train, X_test, y_train, y_test): # вывод в консоль print() print('===> Гребневая полиномиальная регрессия <===') - print('Оценка точности:') - print('MAE:', mean_absolute_error(y_test, y_pred)) - print('MSE:', mean_squared_error(y_test, y_pred)) - print() + print('Оценка точности: ', poly_rige_model.score(X_train, y_train)) # вывод в график plt.title('Гребневая полиномиальная регрессия')