SlideShare a Scribd company logo
1 of 26
Download to read offline
Logistic regression
작성자: 차 호 성
Contents
1.
2.
3.
4.
linear regression vs logistic regression
Binary logistic regression
logistic function , odds
classifier
Contents
linear regression vs logistic regression
logistic function , odds
Binary logistic regression
classifier
Logistic regression
linear regression vs logistic regression ?
Logistic regression
수치형 설명변수 X 와 연속형 숫자로 이뤄진 종속변수 Y 간의 관계를 선형으로 가정하고 이를 가장 잘
표현할 수 있는 회귀계수를 데이터로부터 추정하는 모델.
linear regression
Logistic regression
연속형 숫자가 아닌 범주형 종속변수를 이용하여 회귀모델을 구축한다면 ?
Logistic regression
예를 들어 나이와 암 발생여부(1이면 발병, 0이면 정상) 데이터가 주어졌다고 하자.
발병(1)과 정상(0) 사이에 중간 범주가 없을 뿐더러 1과0 은 숫자 그 자체로 의미를 지니지 않는다. 따
라서 종속변수가 범주형 변수일 때는 선형회귀모델을 그대로 적용하는 것은 의미가 없다.
Logistic regression
로지스틱 회귀는 확률 모델로서 독립 변수의 선형 결합을 이용하여 사건의 발생 가능
성을 예측하는데 사용되는 통계 기법
로지스틱 회귀는 선형 회귀 분석과는 다르게 종속 변수가 범주형 데이터를 대상으로
하며 입력 데이터가 주어졌을 때 해당 데이터의 결과가 특정 분류로 나뉘기 때문에
일종의 분류 (classification) 기법으로도 볼 수 있다.
logistic regression
Contents
linear regression vs logistic regression
logistic function , odds
Binary logistic regression
classifier
Logistic regression
실제 많은 자연, 사회현상에서는 특정 변수에 대한 확률값이 선형이 아닌 S-커브 형
태를 따르는 경우가 많다. 이러한 S-커브를 함수로 표현해낸 것이 바로 로지스틱 함
수. 분야에 따라 시그모이드 함수로도 불리기도 한다.
로지스틱 함수는 x값으로 어떤 값이든 받을 수가 있지만 출력 결과는 항상 0에서 1사
이 값이 된다. 즉 확률밀도함수(probability density function) 요건을 충족시키는
함수를 말한다.
Logistic regression
승산(Odds)이란 임의의 사건 A가 발생하지 않을 확률 대비 일어날 확률의 비율을 뜻
하는 개념이다. 아래와 같은 식으로 쓸 수가 있다.
Contents
linear regression vs logistic regression
logistic function , odds
Binary logistic regression
classifier
Logistic regression
Logistic regression
이항 로지스틱 회귀분석의 목적은 A와 B, 두 카테고리 중 하나로 분류하기 위해 제안되었다.
때때로 종속변수가 질적인 변수로 취할 수 있는 변수의 값이 단지 두 가지밖에 없는 경우가 있다.
선형 회귀분석에서 착안했을 때 우리가 예측하려는 y값을 A일 확률이라 하고, y값(A일 확률)이 0.5보
다 크면 A로 분류하고 0.5보다 작으면 B로 분류하는 것 이다.
Logistic regression
회귀식의 장점은 그대로 유지하되 종속변수 Y를 범주가 아니라 (범주1이 될)확률로
두고 식을 세워 보자
그런데 위 식에서 좌변의 범위는 0~1 사이지만 우변은 음의 무한대에서 양의 무한대 범위를
가지기 때문에 식이 성립하지 않는 경우가 존재할 수 있다.
좌변의범위를 무한대까지 해주기 위해서 좌변을 승산(odds)으로 설정해보자.
Logistic regression
추가적으로 좌변과 동일하게 음의 무한대의 범위를 가지도록 log를 씌워준다.
Logistic regression
Logistic regression
위의 식을 P (확률) 로 정리 해주기 위해 우변을 a 로 두고 아래와 같이 식을 변형시킨다.
Logistic regression
Logistic regression
Contents
linear regression vs logistic regression
logistic function , odds
Binary logistic regression
classifier
Logistic regression
위와 같이 이항 로지스틱 모델에 범주 정보를 모르는 입력벡터 x를 넣으면 범주 1에 속할 확률을 얻을
수 있다. 그렇다면 그 확률값이 얼마나 되어야 범주 1로 분류할 수 있을까?
Logistic regression
범주가 두 개 뿐이므로, 위 식 좌변을 p(x)로 치환하면 식을 다음과 같이 정리할 수 있다.
Logistic regression
βTx > 0 이면 해당 데이터의 범주를 1
로 분류하게 된다.
Logistic regression
[참고문헌]
- ratsgo’s blog
(https://ratsgo.github.io/machine%20learning/2017/04/02/logistic/ )
- Wikipedia
- Simple Guide to Logistic Regression in R
(https://www.analyticsvidhya.com/blog/2015/11/beginners-guide-on-logistic-regression-in-r/ )
Thank you :-)

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Logistic regression1

  • 2. Contents 1. 2. 3. 4. linear regression vs logistic regression Binary logistic regression logistic function , odds classifier
  • 3. Contents linear regression vs logistic regression logistic function , odds Binary logistic regression classifier
  • 4. Logistic regression linear regression vs logistic regression ?
  • 5. Logistic regression 수치형 설명변수 X 와 연속형 숫자로 이뤄진 종속변수 Y 간의 관계를 선형으로 가정하고 이를 가장 잘 표현할 수 있는 회귀계수를 데이터로부터 추정하는 모델. linear regression
  • 6. Logistic regression 연속형 숫자가 아닌 범주형 종속변수를 이용하여 회귀모델을 구축한다면 ?
  • 7. Logistic regression 예를 들어 나이와 암 발생여부(1이면 발병, 0이면 정상) 데이터가 주어졌다고 하자. 발병(1)과 정상(0) 사이에 중간 범주가 없을 뿐더러 1과0 은 숫자 그 자체로 의미를 지니지 않는다. 따 라서 종속변수가 범주형 변수일 때는 선형회귀모델을 그대로 적용하는 것은 의미가 없다.
  • 8. Logistic regression 로지스틱 회귀는 확률 모델로서 독립 변수의 선형 결합을 이용하여 사건의 발생 가능 성을 예측하는데 사용되는 통계 기법 로지스틱 회귀는 선형 회귀 분석과는 다르게 종속 변수가 범주형 데이터를 대상으로 하며 입력 데이터가 주어졌을 때 해당 데이터의 결과가 특정 분류로 나뉘기 때문에 일종의 분류 (classification) 기법으로도 볼 수 있다. logistic regression
  • 9. Contents linear regression vs logistic regression logistic function , odds Binary logistic regression classifier
  • 10. Logistic regression 실제 많은 자연, 사회현상에서는 특정 변수에 대한 확률값이 선형이 아닌 S-커브 형 태를 따르는 경우가 많다. 이러한 S-커브를 함수로 표현해낸 것이 바로 로지스틱 함 수. 분야에 따라 시그모이드 함수로도 불리기도 한다. 로지스틱 함수는 x값으로 어떤 값이든 받을 수가 있지만 출력 결과는 항상 0에서 1사 이 값이 된다. 즉 확률밀도함수(probability density function) 요건을 충족시키는 함수를 말한다.
  • 11. Logistic regression 승산(Odds)이란 임의의 사건 A가 발생하지 않을 확률 대비 일어날 확률의 비율을 뜻 하는 개념이다. 아래와 같은 식으로 쓸 수가 있다.
  • 12. Contents linear regression vs logistic regression logistic function , odds Binary logistic regression classifier
  • 14. Logistic regression 이항 로지스틱 회귀분석의 목적은 A와 B, 두 카테고리 중 하나로 분류하기 위해 제안되었다. 때때로 종속변수가 질적인 변수로 취할 수 있는 변수의 값이 단지 두 가지밖에 없는 경우가 있다. 선형 회귀분석에서 착안했을 때 우리가 예측하려는 y값을 A일 확률이라 하고, y값(A일 확률)이 0.5보 다 크면 A로 분류하고 0.5보다 작으면 B로 분류하는 것 이다.
  • 15. Logistic regression 회귀식의 장점은 그대로 유지하되 종속변수 Y를 범주가 아니라 (범주1이 될)확률로 두고 식을 세워 보자 그런데 위 식에서 좌변의 범위는 0~1 사이지만 우변은 음의 무한대에서 양의 무한대 범위를 가지기 때문에 식이 성립하지 않는 경우가 존재할 수 있다. 좌변의범위를 무한대까지 해주기 위해서 좌변을 승산(odds)으로 설정해보자.
  • 16. Logistic regression 추가적으로 좌변과 동일하게 음의 무한대의 범위를 가지도록 log를 씌워준다.
  • 18. Logistic regression 위의 식을 P (확률) 로 정리 해주기 위해 우변을 a 로 두고 아래와 같이 식을 변형시킨다.
  • 21. Contents linear regression vs logistic regression logistic function , odds Binary logistic regression classifier
  • 22. Logistic regression 위와 같이 이항 로지스틱 모델에 범주 정보를 모르는 입력벡터 x를 넣으면 범주 1에 속할 확률을 얻을 수 있다. 그렇다면 그 확률값이 얼마나 되어야 범주 1로 분류할 수 있을까?
  • 23. Logistic regression 범주가 두 개 뿐이므로, 위 식 좌변을 p(x)로 치환하면 식을 다음과 같이 정리할 수 있다.
  • 24. Logistic regression βTx > 0 이면 해당 데이터의 범주를 1 로 분류하게 된다.
  • 25. Logistic regression [참고문헌] - ratsgo’s blog (https://ratsgo.github.io/machine%20learning/2017/04/02/logistic/ ) - Wikipedia - Simple Guide to Logistic Regression in R (https://www.analyticsvidhya.com/blog/2015/11/beginners-guide-on-logistic-regression-in-r/ )