본문 바로가기
문과생애긔개발자_공부/수업정리

3월23일 수업정리(혼자 공부하는 머신러닝04-1)

by animeel 2022. 3. 23.

 

(사진정리 나중에 update예정)

 

 

 

underscore '_'

파이썬에서 사용되는 경우

1. 값을 무시하고 싶을때 ex) for _ in range(10)

2. 내장된 특수한 함수와 변수 표시할 때 name mangling ex) __init__

3. 숫자 자리수 구분 1000 == 1_000

4. 인터프리터에서는 마지막 변수의 값을 일시적으로 가지고 있는 용도로 사용

 

sc.fit(X, y) 하고 나면 1 epoch돌아간 후에 classes가 생성되는데 이런 과정없이

partial_fit(X,y)만 쓸때는 학습의 결과로 classes가 생성되지 않으므로 꼭 안에 추가해줘야 함!

ex) partial_fit(X, y, classes = np.unique())

 

epoch가 증가하면 과학습이 일어남 (overfit)

 

(*args, **kwargs)

positinal arg, keyword arg

 

Decision Tree 결정트리

Pros 이해하기 쉽다 <-> 선형모형 -> 로지스틱 회귀 보다 이해하기 쉽다는 뜻

Cons 과대적합 모형 (학습스코어 높고, 테스트스코어 낮음) 일반화 성능이 떨어지는 모형

 

데이터셋 참고 사이트

UCI Machine Learning Repository

https://archive.ics.uci.edu/ml/index.php

 

UCI Machine Learning Repository

Welcome to the UC Irvine Machine Learning Repository! We currently maintain 622 data sets as a service to the machine learning community. You may view all data sets through our searchable interface. For a general overview of the Repository, please visit ou

archive.ics.uci.edu

 

결측값ML -> 제거 or 대체 - 대체시 평균(mean), 중앙값(median), 최빈값(mode)

분류냐 회귀냐? 회귀의 문제

 

이상치 outlier -> 제거 or 대체

검출식 Q1-1.5*IQR > 이상치, Q3+1.5*IQR < 이상치

 

 

Pandas -DataFrame

묵시적 인덱스 Implicit Index  [0][1][2][3]

명시적 인덱스 Explicit Index  "A","B", "C", "D"

 

df.컬럼명

df["컬럼명"]

 

df.iloc[행, 렬] ---> 묵시적(정수넣어주기)

df.loc[행, 렬] ---> 명시적 

wine.iloc[:, :-1].describe()
: 슬라이서 
 
[start : stop : step]이 기본형 /start 0생략가능, step 1 생략가능
 
: -> 전체
:-1 마지막것 빼고 그 전까지 
(0은 생략가능)

정수형일때는 exclusive

명시적일때는 inclusive

따라서 loc일때는 조심해서 사용해야함! stop자리를 정수형으로쓰거나 명시적으로 쓸때 다 포함됨
wine.loc[1:4'alcohol':'class']라고 하면 class까지 포함
그 전까지 하려면 wine.loc[1:4'alcohol':'pH']