Work in progress

This commit is contained in:
2025-09-29 08:59:47 +02:00
parent 8a2a9d1064
commit b93df4af0f
26 changed files with 22986 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import numpy as np
import matplotlib.pyplot as plt
# Valódi mért adatok
x_real = np.array([1,2,3,4,5,6,7,8,9,10])
y_real = np.array([6,8,9,11,13,14,15,17,18,20])
# Lineáris regresszió illesztése
coeffs = np.polyfit(x_real, y_real, 1) # 1. fokú polinom = egyenes || Visszaad egy tömböt, ami az egyenes együtthatóit tartalmazza: [meredekség, tengelymetszet].
print(coeffs)
lin_y = coeffs[0]*x_real + coeffs[1] # Kiszámolja az egyenes y értékeit minden x_real pontra. y = mx + n
# Ábrázolás
plt.scatter(x_real, y_real, color='blue', label='Valódi mért pontok')
plt.plot(x_real, lin_y, color='black', linestyle='--', label='Lineáris regresszió')
plt.xlabel('Reklámba fektetett összeg (millió Ft)')
plt.ylabel('Eladott jegyek (ezer db)')
plt.title('Valódi adatok és lineáris regresszió')
plt.legend()
plt.grid(True)
plt.show()