'K-MOOC'에 해당되는 글 51건

###Markov Decision Processes

<S, A, P, R, r>

 

1. A set of states S = {s1, s2, .... , sn}

2. A set of actions A = {a1, a2, ..., am}

3. Transition funcion P:S * A -> S, P^a_ss' = P[S_t+1 = s'[S_t = s, A_t = a]

4. Reward function R: S * A -> R, R^a_s = E[R_t+1|S_t = s,At = a]

5. Discount factor r ∈ [0,1]

좀더 알아보자 잘 모르 겠다

 

@@@ Policy

π(a|s) = P[A_t = a|S_t = s]

 

### Value Functions

@@@ state 

V_π(s) = E_π[G_t|S_t = s]

 

@@@ action 

Q_π(s, a) = E_π[G_t|S_t=s,A_t=a]

 

음... 점점 이 단어들을 이해하기 힘들어진다

일단 비중을 주고 그것에대한 가보치를 산출하는 듯한 느낌이다

비중은 얼마나 접해졌나 

가보치는 내가 그냥 주는 듯한 느낌이다

 

### Prediction and Control

@@@ Prediction: evaluate the future

MDP {S, A, P, R, r} and a policy π

Output : a value fuction V_π

Iterative policy evaluation!

 

@@@ Control : optimize the future

MDP { S, A, P, R, r }

Output : optimal policy π, (and optimal value  function V.)

 

### Iterative Policy Evaluation

1.Problem : evaluate a given policy π

2.Solution: iteratively apply Bellman expectation backup

   1) Converge to a real V_π (V_1 -> V_2 -> ... -> V_π)

   2) At each iteration k + 1, for all states s∈S, update V_k+1 (s) from 

       V_k (s') where s' is a successor state of s

3.Iteratively compute until convergence

     V^k+1 = R^π + rP^πV^k

    Matrix form of Bellman expectation equation

      V_π(s) = ∑_[a∈A] *π(a|s)(R^a_s+r∑_[s^r∈S]*P^a_ss'*V_π*(s'))

 

아 솔찍히 이거 모르겟어

리마인더 라고 하는데 메이트릭스 형태로 보여주는데 음 모르겟음

 

일단 모두 0 으로 메트릭스한다

그리고 한번만에 값나오는거 하나 값주고 다음으로 -1 하나씩 추가해서 더한다

다음으로도 그런식으로 값을 구하는 듯하나 그러나 비중과 퍼센트가 좀 달라지는 느낌이다

 

 

 

'K-MOOC > 인공지능 기초' 카테고리의 다른 글

7주차 자연어 처리  (0) 2020.04.18
6주차 게임이론  (0) 2020.04.09
4주차 강화학습  (0) 2020.03.28
3주차 휴리스틱 탐색  (0) 2020.03.24
2주차 트리 써치  (0) 2020.03.22
블로그 이미지

Or71nH

,

### 헌법이 어디까지 영향을 미칠것인가??

헌법은 시간성이 없기 때문 즉 시작은 있지만 끝이 없다

 

### 헌법의 공간적 효력

@@영토권 남북문제

영토 : 국가의 기초가되는 일정 범위

영해 : 일정 12해리의 해안 

영공 : 영토와 영해의 수직적 상공

배타적 경제 수역 : 200해리 영유권 x

공해 : 모든나라가 사용가능

 

@@토마스 홉스의 리바이어던

국가의 존재이유

외부의 방어와 내부의 질서

 

국가 헌법의 효력 범위 

과거 : 영토

현재 : 무궁무진 우주 사이버 등등

 

헌법 영토조항 평화통일 조항 이있다

그러므로 전쟁이 아닌 평화적 통일이 되어야 한다

(헌법 제 4조 근거)

 

헌법 제 3조 + 헌법 제 4조

실제적 조화의 원칙을 통한 해석 

 

북한은

대내적 관계 ==> 여전이적

대외적 관계 ==> 대화의 파트너

 

 

### 헌법의 인적  효력

국적은 헌법과 법률이 정하는 일정한 요건을 갖추어 한 국가의 국미으로 인정되는 자격을 말함

@@ 국적 취득과 상실

선천적 취득: 속인주의 << 태어난 유전자, 속지주의 << 태어난곳 

 

후천적 취득 : 출생 인지, 귀화, 국적회복등

 

@@ 재외국민

대한민국의 국적을 가지고 있으면서 외국에 거주하고 있는 사람

 

@@ 재외동포

대한민국의 혈통을 가지고 있기는 하지만 국적을 갖고 있지 않은 사람

 

 

'K-MOOC > 헌법' 카테고리의 다른 글

7주차 다수결의 원리 & 소수자 존중의힘  (0) 2020.04.13
6주차 헌법의 기본원리  (0) 2020.04.07
4주차 법해석  (0) 2020.03.25
3주차 헌법 재정 개정  (0) 2020.03.17
2주차 헌법 시작  (0) 2020.03.17
블로그 이미지

Or71nH

,

### 전자극 생체 신호 센서

 

###PPG 

심장이 뛸때 혈류량을 알기위한

빛을 쏴서 빛의 양을 확인함

 

###ECG 

전극이있을때 이용한  감지센서

 

###EDA

전기신호의 흐르는 강도를 알아냄

뇌의 인지활동에 따라 땀이 나서 땀으로인한 전도성이 증가한다

 

###EEG

뇌에서 나오는 뇌파를 센싱

 

###EMG 

근전도 센서 근육의 음직임을 인지함

 

 

### 생체 신호 기반 수면 탐지

음 수면활동에 대하여 고민하고 어떻게 탐지할까 준비중인듯함

 

'K-MOOC > 빅데이터와 인공지능의 응용' 카테고리의 다른 글

6주차 성능 평가  (0) 2020.04.11
5주차 딥러닝의 활용 개요  (0) 2020.04.02
3주차 위치탐지 기술  (0) 2020.03.24
2주차 탐지  (0) 2020.03.23
1주차 사물인터넷  (0) 2020.03.21
블로그 이미지

Or71nH

,

### 스트림 딜레이

인터넷이 없는 구간 즉 버퍼가 생길때의 차이가

시간차가 나며 데이터의 이동이 멈춘 상태

 

@@@Stream data

스트림의 데이타는 즉 보낸 시간

 

@@@Real-time processing

받은 시간 ??? 받는 시간이 보넨시간과 같은가??

 

### 처리 방법

1. element 마다 변환 방법

 

2. Aggregation

  1)그룹바이로 만든다

  2)윈도윙 (windowing) 어떤 시간에 따른 구릅으로 만듬

    1] Fixed window

        타임으로 나눔

     2] Sliding window

        조금식 겹치게 나눔

     3] Sessions window

        로그인 해놓은거 시작 그리고 끝을 따로만들어 

        중간에 계속 할 수 있도록 만든거 순서처리방식이 아님

 

### watermark

딜레이로 모든 데이터가 다왓나 확인하는것

 

간단히 요즘 AI 마이크 챗봇 같은느낌 말하고 기다리면 그걸로 끝인지 인지하는 듯한 느낌

 

### Stream Query Execution model 

1.Continuous Query

   전에 온 데이터를 가지고 있음 그리고 다음 데이터도 계속 받으며 처리함

2.Micro-batch

   제귀식으로 전에 데이터를 처리완료하고 다음 데이터를 받아서 찾아감

 

 

###Spark Structured Steaming

데이터를 스텍처럼 쌓는다

그리고 하나씩 처리한다

즉 데이터를 버리지 않고 계속 쌓아서 처리한다

적립식임 ㅇㅇ

 

###WordCount Program

from pyspark.sql import SparkSession
from pyspark.sql.functions import explode
from pyspark.sql.functions import split

spark = SparkSession \
     .builder \
     .appName("WordCountWithKafka")\
     .getOrCreate()
# Create DataFrame representing the stream of input lines
# from connection to a kafka server
lines = spark \
    .readStream \
    .format("kafka")\
    .option("kafka.bootstrap.servers", ip_addr:port) \ 
    .option("subscribe", "wc") \
    .load()
## Word Count Program ##
#Split the lines into words
words = lines.select(
    explode(split(lines.value." ")).alias("word")
)
#Generate running word count
wordCounts = words.groupBy("word").count()
#Start running the query that prints the running counts
# to the console
query = wordCounts \
    .writeStream \
    .queryName("wordcount_kafka") \
    .outputMode("complete")\
    .format("memory")\
    .start()
query.awaitTermination()

## Widow Operation ## 
words = ...#streaming DataFrame of schema
        #{ts: Timestamp, word: String}
# Group the data by window and word and compute the count of each group
windowedCounts = words.groupBy(
    window(words.ts, "3 minutes","1 minute"),
    words.word
).count()

## Spark structured Streaming ##
words = ...#streaming DataFrame of schema
        #{ts: Timestamp, word: String}
#Add watermark
windowedCounts = words
    .withWatermark("ts", "5 minutes")
    .groupBy(window(word.ts,"3 minutes","1 minute"), words.word)
    .count()

## Stream-Static Join##
# a static DataFrame about device info
deviceInfoDF = spark.read, ...
# a stream DataFrame about device signal
deviceSignalStreamDF = spark.readStream, ...

#inner equijoin with a static DataFrame
deviceSignalStreamDF.join(deviceInfoDF, "deviceType")

## Stream-Stream Join ## 
from pyspark.sql.functions import expr
# Joining two streams of data from dfferent sorces: posts and likes.
posts = spark.readStream, ...
likes = spark.readStream, ...

# Apply watermarks on event-time columns
postsWithWatermark = posts.withWatermark("postTime", "2 hours")
likesWithWatermark = likes.withWatermark("likeTime", "3 hours")

# Join with event-time constraints
postsWithWatermark.join(
    likesWithWatermark, 
    expr("""likePostId = postId AND 
         likeTime >= postTime AND
         likeTime <= postTime + 1 hour
         """)
)

    

 

헥헥 실험해 보고 싶다 

블로그 이미지

Or71nH

,

###간단 코드

grad_squared = 0 
while True:
	dx = compute_gradient(x)
    grad_squared += dx * dx
    x -= learning_rate * dx / (np.sqrt(grad_squared) + 1e-7)
  

compute_gradient(x) ==> G_t += [g_t[0]^2, ...,g_t[d]^2]

np.sqrt(grad_squared) 

 

@@@AdaGrad

grad_squared = 0 
while True:
	dx = compute_gradient(x)
    grad_squared += dx * dx
    x -= learning_rate * dx / (np.sqrt(grad_squared) + 1e-7)
  

@@@RMSProp

grad_squared = 0 
while True:
	dx = compute_gradient(x)
    grad_squared += decay_rate * grad_squared + (1 - decay_rate) * dx * dx
    x -= learning_rate * dx / (np.sqrt(grad_squared) + 1e-7)
  

@@@AdaGrad/RMSProp

first_moment = 0
second_moment = 0
while True:
	dx = compute_gradient(x)
    first_moment = beta1 * first_moment + (1 - beta1) *dx
    second_moment = beta2 * second_monent + (1 -beta2) * dx * dx
    x -= learning_rate * first_moment / (np.sqrt(grad_squared) + 1e-7)
  

@@@Adam(fullform)

first_moment = 0
second_moment = 0
while True:
	dx = compute_gradient(x)
    first_moment = beta1 * first_moment + (1 - beta1) *dx
    second_moment = beta2 * second_monent + (1 -beta2) * dx * dx
    first_unbias = first_moment / (1 - beta1 **t)
    second_unbias = second_moment / (1 -beta2 **t)
    x -= learning_rate * first_unbias / (np.sqrt(second_unbias) + 1e-7)
  

https://daeson.tistory.com/167

'K-MOOC > 머신러닝' 카테고리의 다른 글

6주차 API  (0) 2020.04.09
5주차 점수 산출  (0) 2020.04.02
3주차 Gradient descent, Coordinate descent  (0) 2020.03.24
2주차 선형대수 기본 개념  (0) 2020.03.22
1주차 머신러닝 개요 및 케이스 스터디  (0) 2020.03.20
블로그 이미지

Or71nH

,