으아아
스킵
'K-MOOC > 빅데이터와 인공지능의 응용' 카테고리의 다른 글
5주차 딥러닝의 활용 개요 (0) | 2020.04.02 |
---|---|
4주차 전자기기 센서 (0) | 2020.04.01 |
3주차 위치탐지 기술 (0) | 2020.03.24 |
2주차 탐지 (0) | 2020.03.23 |
1주차 사물인터넷 (0) | 2020.03.21 |
으아아
스킵
5주차 딥러닝의 활용 개요 (0) | 2020.04.02 |
---|---|
4주차 전자기기 센서 (0) | 2020.04.01 |
3주차 위치탐지 기술 (0) | 2020.03.24 |
2주차 탐지 (0) | 2020.03.23 |
1주차 사물인터넷 (0) | 2020.03.21 |
### 모델 정의
Define a graph : h = ReLU(Wx + b)
import tensorflow as tf
b = tf.get_variable('bias', tf.zeros((100,)))
W = tf.get_variable('weights', tf.random_uniform((784, 100), -1, 1))
x = tf.placeholder(tf.float32, (None, 784))
h = tf.nn.relu(tf.matmul(x, W) + b)
코드는 적엇는데 아직 구동방법을 모름
### 구동 심볼릭 모드
import tensorflow as tf
import numpy as np
b = tf.get_variable('bias', tf.zeros((100,)))
W = tf.get_variable('weights', tf.random_uniform((784, 100), -1, 1))
x = tf.placeholder(tf.float32, (None, 784))
h = tf.nn.relu(tf.matmul(x, W) + b)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
sess.run(h, {x: np.random.random(64, 784)})
@@ Linear Regression
import tensorflow as tf
import utils
DATA_FILE = "data/system_cpuutil_applatency.txt"
# Step 1:readin data from the .txt file
# data is a numpy array of shape(100000, 2 ) , each eow is a datapoint
data, n_samples = utils.read_system
# Step 2: create placeholders for X (CPU util) and Y (app latency)
X = tf.placeholder(tf.float32, name='X')
Y = tf.placeholder(tf.float32, name='Y')
# Step 3: create weight and bias, initialized to 0
w = tf.get_variable('weights',initializer=tf.constant(0.0))
b = tf.get_variable('bias',initializer=tf.constant(0.0))
# Step 4: construct model to predict Y (app latency from CPU util)
Y_predicted = w * X + b
# Step 5: use the square error as the loss function
loss = tf.square(Y - Y_predicted, name='loss')
# Step 6: using gradient descent with learning rate of 0.001 to minimize loss
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.001).minimize(loss)
## 수행하는곳
with tf.Session() as sess:
# Step 7 : initialize the necessary variables, in this case, w and b
sess.run(tf.global_variables_initializer()
# Step 8 : train the model
for i in range(100): #run 100 epochs
for x, y in data:
# Session runs train_op to minimize loss
sess.run(optimizer, feed_dict={X:x,Y:y})
# Step 9 : output the values of w and b
w_out, b_out = sess.run([w.b])
### 구동 이거 모드 eager mode
import tensorflow as tf
import tensorflow.contrib.eager as tfe
tfe.enable_eager_execution()
x = [[3.]]
m = tf.matmul(x, x)
print(m)
# tf.Tensor([[9.]], -(1, 1), dtype=float32)
### 사이즈가 고정된경우 좀더 빨리 할 수 있다
dataset = tf.data.FixedLengthRecordDataset([file1, file2, file3, ...])
iterator = dataset.make_one_shot_iterator()
input, label = iterator.get_next()
...
for i in range(100):
...
try:
while True:
sess.run([optimizer])
except tf.errors.OutOfRangeError:
pass
dataset = dataset.shuffle(1000)
dataset = dataset.repeat(100)
dataset = dataset.batch(128)
dataset = dataset.map(lambda x:tf.one_hot(x, 10))
8주차 분산 머신러닝 딥러닝 (0) | 2020.04.27 |
---|---|
7주차 네트워크 Recurrent neural network (0) | 2020.04.18 |
5주차 머신러닝 시스템 개요 (0) | 2020.04.02 |
4주차 스트림 처리 (0) | 2020.04.01 |
3주차 배치 분석 (0) | 2020.03.24 |
class MultiplGate(object):
def forward(x,y):
z = x*y
self.x = x # must keep these around
self.y = y
return z
def backward dz :
dx = self.y*dz # [dz/dx * dL/dz]
dy = self.x*dz # [dz/dy * dL/dz]
return [dx, dy]
음... 왜 이렇게 나오려나???
5주차 점수 산출 (0) | 2020.04.02 |
---|---|
4주차 온라인 최적화 (0) | 2020.03.31 |
3주차 Gradient descent, Coordinate descent (0) | 2020.03.24 |
2주차 선형대수 기본 개념 (0) | 2020.03.22 |
1주차 머신러닝 개요 및 케이스 스터디 (0) | 2020.03.20 |
###TF IDF
특정 중요한 단어를 산출하는 것
@@user - user CF
@@ Item - Item CF
사용자 가 아이템을 좋아할 까??
표로 나타네어 다른데에 row mean 을 빼주고 평균을 만들어준다
그냥 평균에 유사도를 만들어 평점을 또넣어서 평균에 평균을 구하는거 같음
8주차 페이지 및 유사성을 이용 (0) | 2020.04.27 |
---|---|
7주차 추천 시스템 2 (0) | 2020.04.18 |
5주차 링크 분석 3 (0) | 2020.04.02 |
4주차 링크 분석 2 (0) | 2020.03.31 |
3주차 링크 분석 (0) | 2020.03.24 |
### 게임이론의 중점
서로의 최대의 이익을 보는것이 아니라
서로의 최악의 경우를 피하는 것으로 중점을 둠
2 0 1
4 -3 2
1 -2 -2
이런 값에서 행은 1플레이어
열은 2플레이어이다
이중 1은 값이 높은게 이득
2는 값이 낮은게 이득
그럼 1은 2 0 1 의 행을 선택하고
열은 0 -3 -2 를 선택해야
서로의 최대의 이득을 받을 수 있다
2 0 1
4 -3 2
1 -2 -2
이렇게 되어 0 이 산출 된다
왜냐면 2가 절대로 손해보는 1 은 선택을 하지 않을 것이다 ㅇ
그리고 3는 손해될 확률이 높음으로 안한다 1플레이어가 3을 선택할 확율은 없기 때문이다
즉 2 입장에선 저건 눈에 안들어온다
X 0 1
X -3 2
X -2 -2
다음 1 입장에선
2 0 1
4 -3 2
X X X
이것이 안들어온다
결과로
X 0 1
X -3 2
X X X
이이중에 이득을 볼 수 있는 것은
2입장에선
X 0 X
X -3 X
X X X
왜냐면 3번쨰는 이득되는게 없음
그럼으로 서로의 이득을 찾다가 0 이 되는 거임
최악으 조건만 피하는 경우로 예상하여 플레이 한 결과
1은 첫줄
2는 둘째줄 이선택된다
부부상황
남자는 풋볼을 보고싶고 여자는 발레를 보고싶을때는 서로 양보하면 불이득인 반대인 경우가 나온다
그리고 한명만 양보하면 최고의 이득을 받는다
이런것도있고
치킨게임
서로 양보하거나 서로 같으면 충돌이 나서 안좋다 부부상황에 비슷하지만 같은 경우를 선택한 경우가 손해이다
8주차 컴퓨터 비전 (0) | 2020.04.27 |
---|---|
7주차 자연어 처리 (0) | 2020.04.18 |
5주차 강화학습 (0) | 2020.04.02 |
4주차 강화학습 (0) | 2020.03.28 |
3주차 휴리스틱 탐색 (0) | 2020.03.24 |