반응형
Notice
Recent Posts
Recent Comments
Link
관리 메뉴

bro's coding

sklearn.linear_model.LogisticRegression(로지스틱 회귀) 본문

[AI]/python.sklearn

sklearn.linear_model.LogisticRegression(로지스틱 회귀)

givemebro 2020. 4. 13. 10:24
반응형
import numpy as np
import matplotlib.pyplot as plt

 

# data 준비

from sklearn.datasets import make_blobs

X,y=make_blobs(400,2,[[0,0],[5,5]],[2,3])

https://broscoding.tistory.com/128

 

머신러닝.datasets .make_blobs 사용하기

from sklearn.datasets import make_blobs X,y=make_blobs(400,2,[[0,0],[5,5]],[2,3]) # 400 : 행의 갯수 # 2 : 속성의 갯수 2개(축)(전부 X값임) # 중심점의 위치 # 각 중심점에 대한 편차 2, 3 plt.scatter(X[:..

broscoding.tistory.com

from sklearn.linear_model import LogisticRegression

 

# model 설정
model=LogisticRegression()
# 훈련
model.fit(X,y)
# 예측
pred_y=model.predict(X)

 

import mglearn
plt.figure(figsize=[8,6])

# 바탕 관련
mglearn.plots.plot_2d_classification(model,X,cm='Reds',alpha=0.3)

# scatter
mglearn.discrete_scatter(X[:,0],X[:,1],y)

https://broscoding.tistory.com/131

 

머신러닝.LogisticRegression.predict_proba

https://broscoding.tistory.com/129 머신러닝.linear_model.LogisticRegression(로지스틱 회귀) import numpy as np import matplotlib.pyplot as plt # data 준비 from sklearn.datasets import make_blobs X,y=..

broscoding.tistory.com

 

반응형
Comments