일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- inorder
- classification
- cudnn
- 데이터전문기관
- pycharm
- 머신러닝
- 결합전문기관
- 대이터
- C언어
- KNeighborsClassifier
- paragraph
- web 용어
- 재귀함수
- tensorflow
- bccard
- postorder
- broscoding
- web
- 웹 용어
- mglearn
- web 개발
- vscode
- html
- web 사진
- java역사
- CES 2O21 참여
- 자료구조
- Keras
- CES 2O21 참가
- discrete_scatter
- Today
- Total
목록[AI] (189)
bro's coding
# 모델 저장 및 로딩 model.save('mnist_model_01.h5') from keras.models import load_model model2=load_model('mnist_model_01.h5') # 훈련 더 하고싶으면 부른 모델에 fit만 더 하면 됨. # 가중치 저장 및 로딩 model.save_weights('mnist_weights_01.h5') model2.load_weights('mnist_weights_01.h5')
# score test pred_y_test=model.predict(X_test) (pred_y_test*y_test).sum()/len(y_test)
import keras from keras.datasets import mnist (X_train,y_train),(X_test,y_test)=mnist.load_data() # 데이터 전처리 X_train=X_train.reshape(-1,28*28)/255. X_test=X_test.reshape(-1,28*28)/255. y_train=np.eye(10)[y_train] y_test=np.eye(10)[y_test] model=Sequential() model.add(Dense(128,activation='relu',input_shape=(784,))) # 중간층 추가 model.add(Dense(256,activation='relu')) model.add(Dense(256,activation='r..
import keras from keras.datasets import mnist (X_train,y_train),(X_test,y_test)=mnist.load_data() # 데이터 전처리 X_train=X_train.reshape(-1,28*28)/255. X_test=X_test.reshape(-1,28*28)/255. y_train=np.eye(10)[y_train] y_test=np.eye(10)[y_test] model=Sequential() model.add(Dense(1,input_shape=(28,28),activation='sigmoid')) from keras.optimizers import SGD model.compile(loss='binary_crossentropy',optimi..
from keras.datasets import mnist (X_train,y_train),(X_test,y_test)=mnist.load_data() # 전처리(option) X_train=X_train.reshape(-1,28*28)/255. X_test=X_test.reshape(-1,28*28)/255. y_train=np.eye(10)[y_train] y_test=np.eye(10)[y_test]
'''로컬 파일 시스템의 파일 업로드 files.upload는 업로드된 파일의 사전을 반환합니다. 사전은 업로드된 파일 이름에 따라 키가 지정되며, 값은 업로드된 데이터를 표시합니다.''' from google.colab import files uploaded = files.upload() for fn in uploaded.keys(): print('User uploaded file "{name}" with length {length} bytes'.format( name=fn, length=len(uploaded[fn]))) '''로컬 파일 시스템으로 파일 다운로드 files.download는 파일의 브라우저 다운로드를 로컬 컴퓨터로 호출합니다.''' from google.colab import file..
https://colab.research.google.com/ Google Colaboratory colab.research.google.com
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense # data 준비 X = iris.data[:100] y = iris.target[:100] model=Sequential() model.add(Dense(1,input_shape=(4,),activation='sigmoid')) from keras.optimizers import SGD model.compile(loss='binary_crossentropy',optimizer=SGD(lr=0.1),metrics=['acc']) # metrics=['acc'] : 화면 출력 할 때 정확도도 출력해라!(history에서 확인 가능)..
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense # 분류 # data 준비 X=np.array([[0,0],[0,2],[2,0]]) # X 는 반드시 2차원 y=np.array([0,1,1]) plt.scatter(X[:,0],X[:,1],c=y,s=100) model=Sequential() model.add(Dense(1,input_shape=(2,),activation='sigmoid')) from keras.optimizers import SGD model.compile(loss='binary_crossentropy',optimizer=SGD(lr=0.1),metrics=..