Soliyev Ismoilbek 1-topshiriq


Download 55 Kb.
bet4/4
Sana28.03.2023
Hajmi55 Kb.
#1302578
1   2   3   4
Bog'liq
121-20 Mashinali oqitish 1 modul

4-topshiriq
Quyidagi jadval elementlari asosida t0 qiyaligi va t1 kesish topilsin va regressiya chizig‘i funksiyasi topilsin. Chiziqli regressiya modelining kvadrat xatosi, o‘rtacha kvadrat xatosi va aniqlanish koiffitsenti topilsin. Har talaba dasturini tuzib topshirishi shart.

import numpy as np


import matplotlib.pyplot as pltb # kutubxona
x = np.array([1,2,3,4,5]) # x ning qiymatlari
y = np.array([8,12,15,18,22]) # y ning qiymatlari
m_x = np.mean(x) # x urtacha
m_x
m_y = np.mean(y) #y urtacha
m_y
n = np.size(x)
SS_xy = np.sum(y*x) - n*m_y*m_x # y va y urtacha ayirmasi kvadrati yigindisi
SS_xy
SS_xx = np.sum(x*x) - n*m_x*m_x # x va x urtacha ayirmasi kvadrati yigindisi
SS_xx
b_1 = SS_xy / SS_xx # Nishab
b_1
b_0 = m_y - b_1*m_x #kesishish
b_0
y1=b_1*x+b_0 #funksiya
y1
er=y-y1 # xatolik
er
er2=er*er # xatolik kvadrati
er2
t=y-m_y # y va y urtacha ayirmasi
t
t2=t*t #y-m_y kvadrati
t2
er3=np.sum(er2) # xatolik kvadrati yigindisi
er3
t3=np.sum(t2) # y-m_y kvadrati yigindisi
t3
kver=er3/n #kvadratik xato
kver
Re=1-er3/t3 #aniqlanish koefsienti
Re

Colab linki: https://colab.research.google.com/drive/1yDiJka0t_2zTNwicSu4hYulzehLnt4x-?usp=sharing
Download 55 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling