Data Science

ยทData Science/Python
์ €๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” statsmodels๋ฅผ ํ™œ์šฉํ•˜์—ฌ Simple Linear Regression ๋ชจ๋ธ์„ ๋””์ž์ธ ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค. Linear Regression (์„ ํ˜• ํšŒ๊ท€) - 2 | Simple Linear Regression (๋‹จ์ˆœ ์„ ํ˜• ํšŒ๊ท€)์ €๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ์„ ํ˜• ํšŒ๊ท€์—์„œ ์ฃผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ํŒจํ‚ค์ง€๋“ค์— ๋Œ€ํ•ด์„œ ๊ฐ„๋žตํ•˜๊ฒŒ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค. Linear Regression (์„ ํ˜• ํšŒ๊ท€) - 1 | ํŒจํ‚ค์ง€ ์•Œ์•„๋ณด๊ธฐ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ํŒŒ์ด์ฌ์„ ์‚ฌ์šฉํ•ด์„œ ๊ธฐ์ดˆ์  ์„ code-studies.tistory.com ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” sm.OLS(y, x).fit()๋กœ ์–ป์–ด์ง„ result์— result.summary()๋ฅผ ํ–ˆ์„ ๋•Œ ๋ณด์—ฌ์ง€๋Š” ํ‘œ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.ํ•ด๋‹น ๋‚ด์šฉ์€ ์œ„ ํฌ์ŠคํŠธ์—์„œ ๊ฐ€๋ณ๊ฒŒ ๋‹ค๋ฃจ์—ˆ์œผ๋‹ˆ, ๋ชจ๋ฅด์‹ ๋‹ค๋ฉด ์ž ๊น ..
ยทData Science/Python
์ €๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ์„ ํ˜• ํšŒ๊ท€์—์„œ ์ฃผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ํŒจํ‚ค์ง€๋“ค์— ๋Œ€ํ•ด์„œ ๊ฐ„๋žตํ•˜๊ฒŒ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค. Linear Regression (์„ ํ˜• ํšŒ๊ท€) - 1 | ํŒจํ‚ค์ง€ ์•Œ์•„๋ณด๊ธฐ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ํŒŒ์ด์ฌ์„ ์‚ฌ์šฉํ•ด์„œ ๊ธฐ์ดˆ์  ์„ ํ˜• ํšŒ๊ท€ ๋ชจ๋ธ์„ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.์„ ํ˜• ํšŒ๊ท€์˜ ๊ธฐ์ดˆ์  ๊ฐœ๋…์— ๋Œ€ํ•ด์„œ๋Š” ๋‹ค์Œ ํฌ์ŠคํŠธ์— ์ •๋ฆฌ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. Regression Analysis - Linear Regression | ํšŒcode-studies.tistory.com ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ์šฐ์„  ๊ฐ„๋‹จํ•œ ๋‹จ์ˆœ ์„ ํ˜• ํšŒ๊ท€ ๋ชจ๋ธ์„ ๋””์ž์ธ ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.  ์šฐ์„ , ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋“ค์„ import ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.import pandas as pdimport numpy as npimport matplotlib.pyplot as pltimpor..
ยทData Science/Python
์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ํŒŒ์ด์ฌ์„ ์‚ฌ์šฉํ•ด์„œ ๊ธฐ์ดˆ์  ์„ ํ˜• ํšŒ๊ท€ ๋ชจ๋ธ์„ ๊ตฌํ˜„ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋“ค์„ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ค. ์„ ํ˜• ํšŒ๊ท€์˜ ๋งค์šฐ ๊ธฐ์ดˆ์  ๊ฐœ๋…์— ๋Œ€ํ•ด์„œ๋Š” ๋‹ค์Œ ํฌ์ŠคํŠธ์— ์ •๋ฆฌ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. Regression Analysis - Linear Regression | ํšŒ๊ท€ ๋ถ„์„ - ์„ ํ˜• ํšŒ๊ท€Linear Regression(์„ ํ˜• ํšŒ๊ท€): 2๊ฐœ ์ด์ƒ์˜ ๋ณ€์ˆ˜๋“ค ์‚ฌ์ด์—์„œ์˜ ์ธ๊ณผ ๊ด€๊ณ„์— ๋Œ€ํ•œ ์„ ํ˜• ๊ทผ์‚ฌ (์˜ˆ์ธก)A linear approximation of a causal relationship between two or more variables. ์„ ํ˜• ํšŒ๊ท€์˜ ๊ณผ์ •1. Sample data๋ฅผ ์ˆ˜์ง‘ํ•œ๋‹ค.2code-studies.tistory.com ํŒจํ‚ค์ง€ ์„ค์น˜ ๋ฐ import์šฐ์„  ์„ ํ˜• ํšŒ๊ท€ ๋ชจ๋ธ์„ ๋””์ž์ธํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ์ฃผ์š” ํŒŒ์ด์ฌ..
Correlation Analysis(์ƒ๊ด€ ๋ถ„์„)๊ณผ  Regression Analysis(ํšŒ๊ท€ ๋ถ„์„)๊ฐ„์˜ ์ฐจ์ด๋Š” ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์ •๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. "Correlation does not imply causation"์ƒ๊ด€ ๊ด€๊ณ„๋Š” ์ธ๊ณผ ๊ด€๊ณ„๋ฅผ ์˜๋ฏธํ•˜์ง€ ์•Š๋Š”๋‹ค. ๋” ์ž์„ธํ•˜๊ฒŒ ์„ค๋ช…ํ•˜์ž๋ฉด,1. Correlation์€ ๋‘ ๋ณ€์ˆ˜(variable) ์‚ฌ์ด์˜ relationship์˜ ์ •๋„๋ฅผ ์ธก์ •ํ•˜๋Š” ๋ฐ˜๋ฉด, Regression์€ ํŠน์ • ๋ณ€์ˆ˜๊ฐ€ ๋‹ค๋ฅธ ๋ณ€์ˆ˜์— ์–ด๋– ํ•œ ์˜ํ–ฅ์„ ๋ผ์น˜๋Š”์ง€๋ฅผ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค.2. Correlation์€ ๋‘ ๋ณ€์ˆ˜ ์‚ฌ์ด์˜ ์ธ๊ณผ ๊ด€๊ณ„๋ฅผ ์ธก์ •ํ•˜๋Š”๊ฒƒ์ด ์•„๋‹Œ, ๊ด€๊ณ„์„ฑ์˜ ์ •๋„๋ฅผ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค (move together). ๋ฐ˜๋ฉด Regression์€ ๋‘ ๋ณ€์ˆ˜ ์‚ฌ์ด์˜ ์—ฐ๊ด€์„ฑ์˜ ์ •๋„๊ฐ€ ์•„๋‹Œ ์ธ๊ณผ ๊ด€๊ณ„๋ฅผ ์ง์ ‘ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค (cause..
Chan Lee
'Data Science' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)