일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- 웹 용어
- paragraph
- postorder
- vscode
- mglearn
- html
- discrete_scatter
- 대이터
- 머신러닝
- web
- 자료구조
- C언어
- pycharm
- 재귀함수
- CES 2O21 참여
- web 사진
- tensorflow
- cudnn
- inorder
- broscoding
- java역사
- Keras
- web 용어
- 결합전문기관
- KNeighborsClassifier
- 데이터전문기관
- bccard
- web 개발
- CES 2O21 참가
- classification
- Today
- Total
목록[AI]/python.sklearn (95)
bro's coding
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer cancer=load_breast_cancer() col1=0 col2=5 X=cancer.data[:,[col1,col2]] y=cancer.target from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test=train_test_split(X,y) X_mean=X_train.mean(axis=0) X_std=X_train.std(axis=0) X_train_norm=(X_train-X_mean)/X_std X_test_norm=(X_te..
import numpy as np import matplotlib.pyplot as plt # data set from sklearn.datasets import load_breast_cancer cancer=load_breast_cancer() col1=0 col2=5 X=cancer.data[:,[col1,col2]] y=cancer.target from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test=train_test_split(X,y) X_mean=X_train.mean(axis=0) X_std=X_train.std(axis=0) X_train_norm=(X_train-X_mean)/X_std X_test..
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer cancer =load_breast_cancer() X=cancer.data y=cancer.target from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test=train_test_split(X,y) from sklearn.svm import SVC model=SVC() model.fit(X_train,y_train) model.score(X_test,y_test) # 0.6083916083916084 ..
높이를 정하는 함수를 만들어 높이를 만들고 구분이 되면 구분 기준을 가지고 다시 높이를 제거한다. C 가 증가하면 곡선이 디테일 해지고 감마가 증가하면 섬들이 많이 생긴다. from sklearn.datasets import load_iris from sklearn.svm import SVC from sklearn.svm import LinearSVC iris=load_iris() col1=0 col2=1 X=iris.data[:,[col1,col2]] y=iris.target X_train,X_test,y_train,y_test=train_test_split(X,y) # SVC : 성능은 좋지만 튜닝이 어렵다 model1=SVC() model1.fit(X_train,y_train) mglearn.plo..
https://broscoding.tistory.com/145 머신러닝.make_circles 사용하기 import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import make_circles X,y=make_circles(factor=0.5,noise=0.1) # factor = R2/R1, noise= std) plt.scatter(X[:,.. broscoding.tistory.com X,y=make_circles(factor=0.5,noise=0.1) X=X*[1,0.5] X=X+1 plt.scatter(X[:,0],X[:,1],c=y) plt.vlines([1],-0,2,linestyl..
https://broscoding.tistory.com/145 머신러닝.make_circles 사용하기 import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import make_circles X,y=make_circles(factor=0.5,noise=0.1) # factor = R2/R1, noise= std) plt.scatter(X[:,.. broscoding.tistory.com import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_tes..
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import make_circles X,y=make_circles(factor=0.5,noise=0.1) # factor = R2/R1, noise= std) plt.scatter(X[:,0],X[:,1],c=y) plt.colorbar()
import numpy as np import matplotlib.pyplot as plt #data 준비 from sklearn.datasets import load_breast_cancer cancer=load_breast_cancer() col1=0 col2=3 X=cancer.data[:,col1] y=cancer.data[:,col2] corr=((X-X.mean())*(y-y.mean())).mean()/(X.std()*y.std()) # 0.9873571700566123 np.corrcoef(X.T,y) # array([[1. , 0.98735717], [0.98735717, 1. ]]) from sklearn.linear_model import LinearRegression X=cancer..
(=pearson's r) np.corrcoef(cancer.data[:,0],cancer.data[:,22]) array([[1. , 0.96513651], # 나:나 나:너 [0.96513651, 1. ]])# 너:나 나:나 plt.imshow(np.corrcoef(cancer.data.T)) plt.colorbar() # 노랗거나 까만 색이 유의미한 데이터
iris=load_iris() X=iris.data y=iris.target X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2) model=LinearSVC(C=1) model.fit(X_train,y_train) pred_y=model.predict(X_test) model.score(X_test,y_test) model.decision_function(X_test) guideline과 나의 거리 양수면 내 쪽에 속한것 array([[-6.58398872e-01, -1.41247905e-01, -2.21407969e+00], [ 1.91618644e+00, -1.16266051e+00, -8.10343365e+00], [ 1.078043..