| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- discrete_scatter
- pycharm
- web
- Keras
- inorder
- CES 2O21 참여
- cudnn
- web 용어
- paragraph
- 대이터
- classification
- java역사
- 머신러닝
- postorder
- 자료구조
- KNeighborsClassifier
- CES 2O21 참가
- vscode
- web 사진
- 웹 용어
- 재귀함수
- mglearn
- tensorflow
- bccard
- broscoding
- 결합전문기관
- C언어
- web 개발
- 데이터전문기관
- html
- Today
- Total
목록전체 글 (690)
bro's coding
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_iris # data 수집 iris=load_iris() # column 컨트롤 col1=2 col2=3 # 전체 data에 대한 scatterplot graph plt.scatter(iris.data[:,col1],iris.data[:,col2],c=iris.target,alpha=0.7) X=iris.data[:,[col1]] # 주의 : col1->[col1] y=iris.data[:,col2] # LinearRegression model = LinearRegression() # train model.fit(X,y) #predict pred_y=mo..
1 iris data에서 속성 : SL,SW에 대해 (col : 0, 1) 꽃 별로 선형 회귀선 을 그리시오 model : linear regression https://broscoding.tistory.com/126?category=855525 1-1 iris data에서 속성 : SL,SW에 대해 (col : 0, 1) MSE,RMSE,MAE,model.score(X,y) 를 구하시오 model : linear regression https://broscoding.tistory.com/126?category=855525 2 wine data file에서 (sklearn load 아님 numpy loadtxt) winequality-red model : linear regression 을 이용해서 등급..
X=iris.data[50:,[0]] y=iris.data[50:,1] model=LinearRegression() model.fit(X,y) model.score(X,y) model.coef_, model.intercept_ # (array([0.27804192]), 1.1309015164752294) xxx=[X.min()-0.5,X.max()+0.5] yyy=model.coef_*xxx+model.intercept_ # 기울기 : w(weight)=coef_ ,절편 : b(ax+b)=intercept_ plt.scatter(X,y) plt.plot(xxx,yyy,'r:')
X=iris.data[:,:3] # 만약 X=iris.data[:,3] 이렇게 넣으면 차원이 맞지 않는다. # ex) error : x=[1,2,3] -> # sol1 ) X=[[1],[2],[3]] # sol2 ) X=iris.data[:,[2]] # sol3 ) X=iris.data[:,2].reshape(-1,1) # because : X는 2차원 형태여야 한다. y=iris.data[:,3] from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test=train_test_split(X,y) from sklearn.linear_model import LinearRegression model=LinearRegres..
# data 준비 X=iris.data y=iris.target # score 수집 scores=[] for i in range(4): col=(np.array([1,2,3])+i)%4 train_X,test_X,train_y,test_y=train_test_split(X[:,col],y) ''' print(col) [1 2 3] [2 3 0] [3 0 1] [0 1 2] ''' # model 설정(k=5) model=KNeighborsClassifier(5) # model 훈련 model.fit(train_X,train_y) # score 수집 scores.append(model.score(test_X,test_y)) # 시각적 표현 plt.plot(scores) plt.xticks([0,1,2,3])..
https://broscoding.tistory.com/114 머신러닝.iris data 불러오기 import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_iris iris=load_iris() iris dir(iris) ['DESCR', 'data', 'feature_names', 'target', 'target_names'] iris.data.shape.. broscoding.tistory.com https://broscoding.tistory.com/115 머신러닝.테스트데이터 뽑기 from sklearn.model_selection import train_test_split X_train,X_test,y..
# 속성 컨트롤 col1=3 col2=1 X=iris.data[:,[col1,col2]] y=iris.target test_scores=[] train_scores=[] index=range(1,30) X_train,X_test,y_train,y_test=train_test_split(X,y) for k in index: model=KNeighborsClassifier(n_neighbors=k) model.fit(X_train,y_train) test_scores.append(model.score(X_test,y_test)) train_scores.append(model.score(X_train,y_train)) #plt.title('K에 따른 score변화') plt.plot(index,test_sco..
# 속성 컨트롤 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) model=KNeighborsClassifier(n_neighbors=3) # n_neighbors=3 model.fit(X_train,y_train) for i in range(1,10): model=KNeighborsClassifier(n_neighbors=i) # n_neighbors=i model.fit(X_train,y_train) # model 훈련 plt.figure(figsize=[10,8]) # 그래프 사이즈 mglearn.plots.plot_2d_classification(model..
import mglearn model=KNeighborsClassifier(n_neighbors=1) # n_neighbors=1 model.fit(X_train,y_train) plt.figure(figsize=[10,8]) # 그래프 사이즈 mglearn.plots.plot_2d_classification(model,X_train,fill=True,eps=0.5,alpha=0.4) # 바탕색과 관련 mglearn.discrete_scatter(X_train[:,0],X_train[:,1],y_train) # train data에 대한 산점도 #mglearn.discrete_scatter(X_test[:,0],X_test[:,1],y_test) # test data에 대한 산점도 plt.figure(f..