<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kobakenkken</author_name>
  <author_url>https://blog.hatena.ne.jp/kobakenkken/</author_url>
  <blog_title>とある新卒SEの備忘録</blog_title>
  <blog_url>https://kenbo.hatenablog.com/</blog_url>
  <categories>
    <anon>python</anon>
    <anon>numpy</anon>
  </categories>
  <description>pythonのnumpyで最小二乗法で線形近似し傾き，切片，回帰式を取得したいと思います． ```python # -*- coding: utf-8 -*-import numpy as npimport matplotlib.pyplot as plt def main(): X = [1,2,3,4,5] Y = [1.1, 2.1, 2.8, 4.3, 5.1] A = np.array([X,np.ones(len(X))]) A = A.T #線形回帰(np.linalg.lstsq)を実行してa:傾き、b:切片を取得。 a,b = np.linalg.lstsq(A,Y)[0] …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkenbo.hatenablog.com%2Fentry%2F2018%2F11%2F30%2F091511&quot; title=&quot;最小二乗法で線形近似(python,numpy) - とある新卒SEの備忘録&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/k/kobakenkken/20181130/20181130091444.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-11-30 09:15:11</published>
  <title>最小二乗法で線形近似(python,numpy)</title>
  <type>rich</type>
  <url>https://kenbo.hatenablog.com/entry/2018/11/30/091511</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
