working_helen

[ Week 1 ] ML terminology / learning strategy 본문

교내 수업/Machine Learning

[ Week 1 ] ML terminology / learning strategy

HaeWon_Seo 2024. 3. 17. 20:17

Lecture : Machine Learning

Date : week 1, 2024/02/29

Topic : Basic of ML

 

 

1. ML terminology

2. ML learning strategy

3. ML 문제 예제

 


1. ML terminology

  • instances / exemplars / obserations : data case들
  • attributes / features : instance의 특징, x값 
  • labels / concepts : learn의 대상, y값 
(위키백과) 머신러닝은 데이터로부터 학습하고 보이지 않는 데이터를 일반화하여 명시적인 지시 없이 작업을 수행할 수 있는 통계 알고리즘의 개발 및 연구와 관련된 인공지능 연구 분야

 

- learning : concept = f(attributes) 가 되는 function f를 학습 

- generalization : 어떤 attributes에 대해서도 concept을 도출할 수 있도록 일반화 

 

=> 머신 러닝이란?

: learning from data, 주어진 data로 trend를 학습하여 새로운 data에도 generalization 되는 모델 생성

 

 

 

 

2. ML learning strategy

- supervised : labelled instances, classification/regression 
- unsupervised : unlabelled instances
- semi-supervied : super+unsuper mixed, instances 중 일부만 labelled 
- reinforcement : agent가 스스로 environment와 상호작용하며 학습

 

 

 

 

3. ML 문제 예제

"system that guesses whether the  tomorrow weather will be good to play out"

주어진 dataframe

 

  • concept (labels) : play 여부, yes or no boolean
  • attributes : outlook, temperature, humidity, windy
  • instances 14개, supervised learning(classification)

 

pd.factorize

- str type 범주형 변수 → numeric type 범주형 변수로 encoding

- numeric encoding 결과 list와 각 항목 list, 2가지를 반환 

- pd.factorize(list)[0] : list의 항목을 numeric으로 encoding한 결과 list 반환 

 

- dataframe의 각 열에 pd.factorize 적용해 numeric encoding

numeric_data = data.apply(lambda col: pd.factorize(col)[0])
print(numeric_data)

numeric encoding 결과