Линейная регрессия | Реализация формулы в python

class LinearRegression: def __init__(self): self.k=None self.b=None def train(self,x_list,y_list): n=len(x_list) sum_xy=sum(x*y for x,y in zip(x_list,y_list)) sum_x=sum(x for x in x_list) sum_y=sum(y for y in y_list) sum_x2=sum(x*x for x in x_list) self.k = (n*sum_xy-sum_x*sum_y)/(n*sum_x2-sum_x**2) self.b = (sum_y-self.k*sum_x)/n def predict(self,x_predictions): y_predictions = [self.k*x_dot+self.b for x_dot in x_predictions] return y_predictions x_list = [-2, -1, 0, 1, 2] y_list = [16, 13, 10, 7, 4] x_predictions = [3, -3] Ожидаемый вывод: 1.0 19.0 model=LinearRegression() model.train(x_list,y_list) y_predictions=model.predict(x_predictions) for y_pred in y_predictions: print(y_pred)

Living Mirrors. Russian answer to ASML: Maskless Lithography
▶︎

Living Mirrors. Russian answer to ASML: Maskless Lithography

Machine Learning for Everybody – Full Course
▶︎

Machine Learning for Everybody – Full Course

Видео для конкурса
▶︎

Видео для конкурса

Instant Focus Mode – 40Hz Gamma Brainwave Music for Deep Focus & Productivity
▶︎

Instant Focus Mode – 40Hz Gamma Brainwave Music for Deep Focus & Productivity

Aesthetic Aura Background 3 hours
▶︎

Aesthetic Aura Background 3 hours

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!
▶︎

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

ASMR Best Triggers For Sleep Collection (No Talking) 3 Hours of Tapping & Scratching
▶︎

ASMR Best Triggers For Sleep Collection (No Talking) 3 Hours of Tapping & Scratching

Британия, Канада, Австралия: усиление государственного контроля под предлогом защиты детей.
▶︎

Британия, Канада, Австралия: усиление государственного контроля под предлогом защиты детей.

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra
▶︎

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra

EILMELDUNG: Sie haben mich ins Visier genommen
▶︎

EILMELDUNG: Sie haben mich ins Visier genommen

Device Searches 2026: What the FSB Looks for at the Border and How to Hide Your Data
▶︎

Device Searches 2026: What the FSB Looks for at the Border and How to Hide Your Data

How to Start Coding | Programming for Beginners | Learn Coding | Intellipaat
▶︎

How to Start Coding | Programming for Beginners | Learn Coding | Intellipaat

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup
▶︎

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

3 Hours Navajo White Screen 4K | Background | Backdrop | Screensaver | Full HD | Phone, Monitor, TV
▶︎

3 Hours Navajo White Screen 4K | Background | Backdrop | Screensaver | Full HD | Phone, Monitor, TV

AI Agents Full Course 2026: Master Agentic AI (2 Hours)
▶︎

AI Agents Full Course 2026: Master Agentic AI (2 Hours)

China Isn't Catching Up—15 Inventions Proving They've Already Won
▶︎

China Isn't Catching Up—15 Inventions Proving They've Already Won

See How a 453kg Giant Bluefin Tuna Is Flawlessly Carved in Seconds
▶︎

See How a 453kg Giant Bluefin Tuna Is Flawlessly Carved in Seconds

49 Minutes That Will Change Your Understanding of the Universe | Vladimir Surdin
▶︎

49 Minutes That Will Change Your Understanding of the Universe | Vladimir Surdin

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra
▶︎

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra

Русичи похитили дочь хана - КВН Евразия
▶︎

Русичи похитили дочь хана - КВН Евразия