일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 데이터전문기관
- html
- discrete_scatter
- 자료구조
- inorder
- 재귀함수
- vscode
- 대이터
- paragraph
- tensorflow
- 결합전문기관
- postorder
- java역사
- cudnn
- 웹 용어
- pycharm
- classification
- broscoding
- web 사진
- C언어
- CES 2O21 참가
- web
- web 개발
- KNeighborsClassifier
- Keras
- web 용어
- 머신러닝
- mglearn
- bccard
- CES 2O21 참여
- Today
- Total
목록[AI] (189)
bro's coding
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense # iris에 적용(값 예측) # data 준비 from sklearn.datasets import load_iris iris=load_iris() X=iris.data[:,:3] y=iris.data[:,3] model=Sequential() model.add(Dense(1,input_shape=(3,),activation='linear')) model.compile(loss='mse',optimizer='sgd') model.fit(X,y,epochs=1000) ws=model.get_weights() ws [array([[-..
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense x=np.array([1,2,3]) y=np.array([3,5,9]) model =Sequential() model.add(Dense(1,input_shape=(1,),activation='linear')) # 1 : 중간층 없음 # input_shape=(1,) : 속성 갯수 # activation='linear') : 활성 함수 #학습률 지정안함 #가중치 초기화 안함 model.compile(loss='mse',optimizer='sgd') # loss='mse' : 비용함수 # optimizer='sgd' : 옵티마이져 m..
# 명령프롬프트에서 pip install keras==2.2.0 # ver 2.2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist=input_data.read_data_sets('./mnist/data/',one_hot=True) # mnist 분류 # RMSPropOptimizer X=tf.placeholder(tf.float32,shape=(None,784)) y=tf.placeholder(tf.float32,shape=(None,10)) w=tf.Variable(tf.random.normal([784,10],0,0.1)) b=tf.Variable..
from tensorflow.examples.tutorials.mnist import input_data mnist=input_data.read_data_sets('./mnist/data/',one_hot=True)
#속성 4개 3중 분류 # RMSPropOptimizer # 중간층 사용 # 중간층 뉴런 수 5>10>10>5 # 중간층 활성화 함수 : sigmoid iris=load_iris() X=tf.placeholder(tf.float32,shape=(None,4)) y=tf.placeholder(tf.float32,shape=(None,3)) w=tf.Variable(tf.random.normal([4,5],0,0.1)) b=tf.Variable(tf.random.normal([5],0,0.1)) u=tf.nn.sigmoid(X@w+b) ww=tf.Variable(tf.random.normal([5,10],0,0.1)) bb=tf.Variable(tf.random.normal([10],0,0.1)) uu=tf..
#속성 4개 3중 분류 # RMSPropOptimizer # 중간층 사용 # 뉴런 10개, 활성화 함수 relu iris=load_iris() X=tf.placeholder(tf.float32,shape=(None,4)) y=tf.placeholder(tf.float32,shape=(None,3)) w=tf.Variable(tf.random.normal([4,10],0,0.1)) b=tf.Variable(tf.random.normal([10],0,0.1)) u=tf.nn.relu(X@w+b) ww=tf.Variable(tf.random.normal([10,3],0,0.1)) bb=tf.Variable(tf.random.normal([3],0,0.1)) pred_y=u@ww+bb ## entropy = t..
#속성 4개 3중 분류 iris=load_iris() X=tf.placeholder(tf.float32,shape=(None,4)) y=tf.placeholder(tf.float32,shape=(None,3)) w=tf.Variable(tf.random.normal([4,3],0,0.1)) b=tf.Variable(tf.random.normal([3],0,0.1)) pred_y=X@w+b ## entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=pred_y)) ## optimizer=tf.train.GradientDescentOptimizer(learning_rate=0.01) train_op=optimiz..
# 속성 3개 # 중간층 2개(10) # placeholder 적용 from sklearn.datasets import load_iris iris=load_iris() X=tf.placeholder(tf.float32,shape=(None,3)) y=tf.placeholder(tf.float32,shape=(None,1)) w=tf.Variable(tf.random.normal([3,5])) b=tf.Variable(tf.random.normal([5])) u=tf.nn.relu(X@w+b) # 150x5 ww=tf.Variable(tf.random.normal([5,5])) bb=tf.Variable(tf.random.normal([5])) uu=tf.nn.relu(u@ww+bb) www=tf.Vari..
# 속성 1개 from sklearn.datasets import load_iris iris=load_iris() X=tf.constant(iris.data[:,2],dtype=tf.float32) y=tf.constant(iris.data[:,3],dtype=tf.float32) w=tf.Variable(tf.random.normal([])) b=tf.Variable(tf.random.normal([])) pred_y=w*X+b mse=tf.reduce_mean(tf.square(y-pred_y)) optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.01) train_op=optimizer.minimize(mse) costs=[] tf.glob..