0
1

More than 1 year has passed since last update.

線形回帰関数の実装

Last updated at Posted at 2023-08-23

参考文献

「統計学大百科事典 仕事で使う公式・定理・ルール113」2020/07/08
(著)石井 俊全
文献元

準備

console
pip install numpy

ソースコード

sample.py
# -*- coding: utf-8 -*-
import numpy as np

def linear_regression(x,y):
    beta=(((x-np.average(x))*(y-np.average(y))).sum())/((x-np.average(x))**2).sum()
    alpha=np.average(y)-beta*np.average(x)
    return alpha,beta#切片,線形回帰係数


0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1