반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리


반응형

 

Conservative View but Basic

FAANGM - Must have stocks

 

 

The investment method I studied this week seems to have been analyzed from a more conservative perspective.
This is a clip of Mr Jang's'US stock investment strategy necessary for the end of the performance season', posted on a YouTube channel related to US stocks called MijuMi in Korea.
He first introduces the stock market adage'Sell in May and Come back in October' and talks about whether this is true.

 

Above youtube clip has more details....

 

 

 

반응형


반응형

Top 25 stocks bought by Hedge Funds in 1Q of 2021 and one Tesla news

 

 

Today I introduce the top 25 stocks bought by Hedge Funds in the first quarter of 2021. 
Number one is Microsoft and Amazon, Facebook, Google stocks are in Top 5.
Only Apple was pushed out of the top 5 and ranked 8th. 
YTD of Goolgle is 28% and Apple is -0.5%.

Among the top 10 stocks in addition to the Big 5, notable is Disney. 
Disney ranked 9th and Netflix was pushed back to 21st. 
Hedge funds seem to see Disney's growth positively in the streaming service sector. In addition, as the restrictions due to Covid-19 gradually disappear, sales of existing major industries such as Disney's theme parks are expected to improve. 

Hedge funds seem to have bought a lot of financial stocks and travel stocks in anticipation of earnings improvement after Covid-19. 
Wells Fargo is a new stock in the top 25, YTD is 39.13%, showing the highest growth rate among them. 
In addition, Bank of America also rose 31.57% this year, showing a remarkable rise in banking stocks, and hedge funds seem to have made profits by increasing their investment in this field. 

In addition, it was ranked 6th as buying on Alibaba Group Holdings is also steadily occurring. 
Micron Technology, which is ranked 23rd, also stands out for its 20.6% increase this year. 

On the other hand, among the Top 25, YTD negatives are Apple -0.5%, T-mobile -3.67%, and Netflix -0.13%. 

Stocks with a lower 1Q growth rate than other stocks need to watch their earnings releases carefully.
These stocks are all verified stocks, and if this performance and guideline come out positively, the stock price could rise further to make up for the sluggish 1Q21 stock price. 

 

Next one is about an article from Bloomberg.

 

반응형


반응형

본격적으로 AWS Deepracer를 시작했다.

첫번째 모델을 만들었다.

 

일단 트랙은 제일 간단한 것으로 선택 하고 Speed는 5로 선택.
직선도로니까 빠르게 달리게 만드는게 더 좋을 것 같아서.
나머지는 다 디폴트.


Reward_function도 그냥 디폴트 사용하고 시간은 30분
참고로 디폴트 함수는 아래와 같다.

 

def reward_function(params):
    '''
    Example of rewarding the agent to follow center line
    '''
    
    # Read input parameters
    track_width = params['track_width']
    distance_from_center = params['distance_from_center']
    
    # Calculate 3 markers that are at varying distances away from the center line
    marker_1 = 0.1 * track_width
    marker_2 = 0.25 * track_width
    marker_3 = 0.5 * track_width
    
    # Give higher reward if the car is closer to center line and vice versa
    if distance_from_center <= marker_1:
        reward = 1.0
    elif distance_from_center <= marker_2:
        reward = 0.5
    elif distance_from_center <= marker_3:
        reward = 0.1
    else:
        reward = 1e-3  # likely crashed/ close to off track
    
    return float(reward)

 

소스코드를 보니 트랙 중앙선 가까이 가면 점수(reward)를 더 많이 주는 간단한 로직이다.

30분 트레이닝 시키고 곧바로 Evaluate
결과는 조금 있다가…

 

 

 


이 첫번째 모델을 clone 해서 두번째 모델을 만들었다.
다 똑같고 reward function 함수만 내가 원하는 대로 조금 바꾸었다.

 

def reward_function(params):
    '''
    Example of rewarding the agent to follow center line
    '''
    reward=1e-3
    
    # Read input parameters
    track_width = params['track_width']
    distance_from_center = params['distance_from_center']
    steering = params['steering_angle']
    speed = params['speed']
    all_wheels_on_track = params['all_wheels_on_track']
    
    if distance_from_center >=0.0 and distance_from_center <= 0.03:
        reward = 1.0
    
    if not all_wheels_on_track:
        reward = -1
    else:
        reward = params['progress']
        
    # Steering penality threshold, change the number based on your action space setting
    ABS_STEERING_THRESHOLD = 15

    # Penalize reward if the car is steering too much
    if steering > ABS_STEERING_THRESHOLD:
        reward *= 0.8
        
    # add speed penalty
    if speed < 2.5:
        reward *=0.80
    
    return float(reward)

 

이전에 썼던 디폴트 함수와는 다르게 몇가지 조건을 추가 했다.
일단 중앙선을 유지하면 좀 더 점수를 많이 주는 것은 좀 더 간단하게 만들었다.
이 부분은 이전에 훈련을 했으니까 이 정도로 해 주면 되지 않을까?
그리고 아무 바퀴라도 트랙 밖으로 나가면 -1을 하고 모두 트랙 안에 있으면 progress 만큼 reward를 주었다.
Progress는 percentage of track completed 이다.
직진해서 결승선에 더 가까이 갈 수록 점수를 더 많이 따도록 했다.
이건 차가 빠꾸하지 않고 곧장 결승점으로 직진 하도록 만들기 위해 넣었다.
그리고 갑자기 핸들을 과하게 돌리면 차가 구르거나 트랙에서 이탈할 확률이 높으니 핸들을 너무 과하게 돌리면 점수가 깎이도록 했다. (15도 이상 핸들을 꺾으면 점수가 깎인다.)
그리고 속도도 너무 천천히 가면 점수를 깎는다.

속도 세팅이 최대 5로 만들어서 그 절반인 2.5 이하고 속도를 줄이면 점수가 깎인다.


이렇게 조건들을 추가하고 Training 시작.
이건 좀 복잡하니 트레이닝 시간을 1시간 주었다.

이 두개의 모델에 대한 결과는…

 

딱 보니 첫번째 디폴트 함수를 사용했을 때는 시간이 갈수록 결과가 좋게 나왔다.
그런데 두번째는 시간이 갈수록 실력이 높아지지는 않는 것 같다.


너무 조건이 여러개 들어가서 그런가?

 

 


생각해 보니 조건을 많이 넣는다고 좋은 것은 아닌것 같다.
일반적으로 코딩을 하다 보면 예외 상황을 만들지 않게 하기 위해 조건들을 아주 많이 주는 경향이 있는데 이 인공지능 쪽은 꼭 조건을 많이 줄 필요는 없을 것 같다.


앞으로 인공지능 쪽을 하다보면 일반 코딩에서의 버릇 중에 고칠 것들이 많을 것 같다.
Evaluation 결과를 보면 두개의 차이가 별로 없다. 
두 모델 모두 3번중 2번 완주 했고 완주시간도 비슷한 것 같다.
조건을 쪼금 더 준 Model 2 가 좀 더 낫긴 하네. (0.2 ~0.3 초 더 빠르다.)
다음은 곡선이 있는 다른 트랙으로 훈련을 시킬 계획이다.


그런데 곡선이 있는 트랙에서는 스피드가 무조건 빠르다고 좋은 건 아닌 것 같다.
내가 스피드를 5로 주었는데 Clone을 만들어서 할 때는 이 스피드를 조절하지 못하는 것 같다.


곡선 구간에서는 reward_function을 어떻게 주어야 하지?

반응형


반응형

AWS DeepRacer 공부를 시작하고 나서 뜻밖의 요금이 징수되서 조금 놀랐다.

지난주 매일 1달러씩 부과 되던 NAT Gateways 서비스를 언제 세팅 했는지 몰랐었다.

여하튼 아마존 Support 서비스의 도움을 받아서 해당 서비스를 Delete 한 이후 요금은 더이상 부과 되지는 않았는데...

문제는 그걸 지우고 난 이후 Deepracer model을 생성하면 에러가 발생해서 일을 더이상 진행 할 수가 없었다.

 

도저히 안되서 새로운 account를 생성하고 Deepracer Model을 하나 생성했다.

 

그랬더니 모델과 더불어 NAT Gateways가 생성되더라.

이제 알았다. 처음 DeepRacer를 시작하기 위해 account resources를 생성할 때 이 NAT Gateway가 생성된다는 것을....

 

이 단계를 완료하면 NAT Gateways가 생성돼 매일 1달러씩 청구된다.

참고로 아래는 DeepRacer 모델을 하나 생성하면 청구되는 금액들이다.

 

 

* Data Transfer에서 $0.010 per GB - regional data transfer - in/out/between EC2 AZs or using elastic IPs or ELB 가 5기가가넘어서 5센트가 청구됐다. 

* 그 다음 EC2에서 NAT Gateway가 생성과 연계해서 2.10 달러가 청구 됐다.

* 여기서 NAT Gateway는 매일 1달러씩 청구되게 돼 있다.

* 그 다음은 시뮬레이터 서비스인 RoboMaker 서비스에 대해 1.52달러가 청구됐고 SageMaker는 30센트가 청구됐다.

 

다른 서비스들은 사용하면 사용한 시간만큼만 내는데 NAT Gateway는 24시간 계속 돌아가기 때문에 매일 1불씩 내야 한다.

사용하지 않을 때 Stop 할 수도 없는 것 같다.

 

하루에 1달러이면 아무것도 아니라고 생각할 수 있지만... 아무것도 하지 않는데도 청구가 되니 속이 쓰렸다.

 

그래서 AWS Support Case를 하나 더 Raise 했다.

 

오늘 아침에 했는데 퇴근 할 때 쯤 답변이 오더라구.

 

 

다음은 답변 내용...

 

Hey there! This is Merlyn, your AWS Billing & Accounts specialist. I hope you are having a wonderful day! I understand you have some concerns about the DeepRacer pricing and you bill. Worry not as I'm here to help.


DeepRacer의 가격 책정과 청구서와 관련 우려가 있다는 것에대해 이해합니다. 걱정마세요. 제가 도와드릴테니까요.

With AWS DeepRacer console services, there are no charges for driving the AWS DeepRacer car or upfront charges. You will only pay for the AWS services you use. You will be billed separately by each of the AWS services used to provide the AWS DeepRacer console services such as creating and training your models, storing your models and logs, and evaluating them, including racing them in the virtual simulator or deploying them to their AWS DeepRacer car. You will see the bill for each service on your monthly billing statement.

AWS DeepRacer console services는 AWS DeepRacer 차량을 driving 하는데에 대한 가격 책정이나 선불로 어떠한 돈을 낼 필요가 없습니다. 당신이 AWS services를 사용한 것에 대한 요금만 지불 하시면 됩니다. AWS DeepRacer console services를 통해 사용하시는 AWS services들에 대해 각각의 사용료가 따로 청구 될 것입니다. 예를 들어 당신의 모델들을 생성하고 훈련하는 것 그리고 그 모델들이나 로그들을 저장하는 것, 그 모델들을 평가하는 작업, 가상 시뮬레이터에서 모델의 레이싱을 하거나  AWS DeepRacer car에 배치하는 일들에 대해 따로 사용료가 부과 됩니다. 

Upon first use of AWS DeepRacer simulation in the AWS console, new customers will get 10 hours of Amazon SageMaker training, and 60 Simulation Unit (SU) hours for Amazon RoboMaker in the form of service credits; $6 for SageMaker, $24 for RoboMaker and $34 for NAT Gateway. The service credits are available for 30 days and applied at the end of the month. A typical AWS DeepRacer simulation uses up to six SUs per hour, thus you will be able to run a typical AWS DeepRacer simulation for up to 10 hours at no charge.


AWS console에서 AWS DeepRacer simulation을 처음 사용하는 새 고객에게는 10시간 동안 Amazon SageMaker training과 Amazon RoboMaker에 대해 60 Simulation Unit (SU) 시간에 대해 service credits이라는 형태로 무료 사용하실 수 있는 기회를 드립니다. SageMaker는 $6 , RoboMaker $24 그리고  NAT Gateway는 $34 입니다. 이 service credits은 30일간 사용 가능하고 그 달의 말에 적용됩니다. 일반적으로  AWS DeepRacer simulation 사용은 시간당 six SUs이므로 당신은 AWS DeepRacer simulation을 10시간 동안 무료로 사용하실 수 있습니다. 

Please visit the link below for more pricing information:

자세한 가격 정보는 아래 링크를 참조하세요.

https://aws.amazon.com/deepracer/pricing/ 

This inquiry is a bit out of our scope. Here in the Billing and Accounts department we don’t handle technical questions. Please note that AWS unbundles technical support in order to lower the prices of the services themselves instead of billing it to all customers disregarding if they’d like to use it or not. However, if technical support is required, I would like to tell you we offer several Premium Support plans starting at just $29 a month, which enables you to speak to an engineer by email, chat, or phone depending on what support plan you choose.


당신의 요청 중 일부는 우리의 권한을 벗어나는 부분이 있습니다. 저희 Billing and Accounts department에서는 기술적인 질문은 다루지 않습니다. 저희는 모든 고객에게 비용 지불의 부담을 주지 않고 저렴한 가격을 유지하기 위해 기술 부문의 Support는 분리해서 다루고 있습니다. 만약 기술적인 support를 원하시면 월 $29 부터 시작되는 Premium Support plan 서비스들이 있습니다. 이 유료 기술 지원 서비스를 이용하시면 이메일, 채팅 그리고 전화등 여러분이 편한 방식으로 엔지니어들과 소통을 할 수 있습니다.

All Premium Support plans include direct access to Support Engineers, and these plans offer a tailored support experience that allows you to select the support level that best fits your needs. More information including pricing and how to sign up can be found here:


모든 Premium Support plan 들에는 Support Engineers과의 직접 access 권한이 포함되며 이러한 플랜들에서는 사용자의 요구 사항에 가장 적합한 서포트 레벨을 선택할 수 있는 맞춤 지원 서비스가 제공 됩니다. 가격 정책 및 가입 방법에 대한 자세한 정보는 여기를 참조하세요.

https://aws.amazon.com/premiumsupport/pricing/ 

You can also search the Amazon Web Services Developer forums or post a new question. Our technical staff and the Amazon Web Services developer community participate in the forums regularly and might be able to help you. Generally, questions are responded to in about a day, though there is not a guaranteed response time.


그 외에  Amazon Web Services Developer forums에서 궁금한 내용을 검색해서 찾는 방법도 있습니다. 또한 새로운 질문을 이곳에 올릴 수도 있구요. Our technical staff와 Amazon Web Services developer community에 참여하는 개발자들로 부터 지원을 받으실 수도 있을 겁니다. 일반적으로 하루 정도 기다리면 답변을 받습니다. (응답 시간에 대한 보장은 없지만요.)

https://forums.aws.amazon.com/index.jspa 

Finally, you may also want to check out our AWS Support Knowledge Center and AWS Documentation pages located here:  

마지막으로 AWS Support Knowledge Center 및 AWS Documentation 페이지를 참조하십시오.

https://aws.amazon.com/premiumsupport/knowledge-center/  
https://aws.amazon.com/documentation/ 

I certainly want you to have the best experience while using our services, so please feel free to let me know if you have any other concern in the meantime, it will be an honor to keep on assisting you. On behalf of Amazon Web Services, I wish you Happy Cloud Computing!

 

Best regards,

Merlyn N.

Amazon Web Services

====================================================================
Learn to work with the AWS Cloud. Get started with free online videos and self-paced labs at 
http://aws.amazon.com/training/ 
====================================================================

Amazon Web Services, Inc. and affiliates

 

 

 

뭐 내용을 읽어보니 어쩔 수 없는 것 같다.

 

어쨌든 한달 정도는 공짜인 것 같으니 거기에 위안을 삼아야지...

 

AWS DeepRacer forum 에 갔더니 나처럼 모델 생성시 Error가 난다는 글이 몇개 눈에 띄었다.

아마도 NAT Gateways를 delete 해서 그런게 아닌지...

 

이 문제 때문인지 몰라도 어제부터 아마존에서 뭔가 이슈를 처리하느라 Training과 evaluation 일을 할 수 없다는 메세지가 뜨더라.

 

 

이 investigation이 위 문제와 관련이 있기를 바라고 또 그 결과로 NAT Gateways 비용 청구와 관련해서 좀 더 전향적인 방안이 제시 됐으면 좋겠다.

 

하루 1불씩 무조건 부과되는건 쫌 부담 스럽다.

내가 필요할 때만 해당 서비스를 사용하고 거기에 대한 비용만 지불할 수 있게 해 달라... 아마존아......

  

반응형


반응형

Introduction to reinforcement learning

 

Developers, start your engines!

This guide will walk you through the basics of reinforcement learning (RL), how to train an RL model, and define the reward functions with parameters.

With this knowledge, you’ll be ready to race in the 2019 AWS DeepRacer League.

 

 

https://d2k9g1efyej86q.cloudfront.net/

 

Introduction to Reinforcement Learning

 

d2k9g1efyej86q.cloudfront.net

 

(RL)Reinforcement learning (RL)은 기계 학습 machine learning의 한 유형으로, agent가 원하는 임무를 어떻게 수행할 것인가를 배우기 위해 주어진 환경environment 을 탐구하는 것입니다. 좋은 결과를 위한 액션을 취하고 나쁜 결과를 초래하는 액션은 회피함으로서 원하는 임무에 최적화 된 행동을 학습하게 됩니다.  

reinforcement learning 모델은 경험을 통해 배우며 시간이 지남에 따라 어떤 행동이 최상의 보상reward으로 이어질지 식별 할 수 있게 됩니다.

 

다른 타입의 machine learning

 

Supervised learning

예제 중심 교육 - 주어진 입력들에 대해 알려진 출력들에 대한 레이블된 데이터를 가지고 이 모델은 새로운 입력에 대한 출력을 예측하도록 훈련됩니다. 

 

Unsupervised learning

추론 기반 교육 - 알려진 출력이 없는 레이블된 데이터를 가지고 이  모델은 입력 데이터 내의 관련 구조 또는 유사한 패턴을 식별하도록 훈련됩니다.

 

How does AWS DeepRacer learn to drive by itself?

 

In reinforcement learning, an agent interacts with an environment with an objective to maximize its total reward.

The agent takes an action based on the environment state and the environment returns the reward and the next state. The agent learns from trial and error, initially taking random actions and over time identifying the actions that lead to long-term rewards.

Let's explore these ideas and how they relate to AWS DeepRacer.

 

reinforcement learning에서 agent 는 환경environment 과 상호 작용하여 총 보상reward을 최대화합니다.

agent 는 환경environment  상태state 에 따라 조치를 취하고 환경environment  은 보상reward과 다음 상태state 를 반환합니다. 에이전트agent 는 초기에 무작위로 행동을 취하고 시간이 지남에 따라 장기 보상long-term rewards으로 이어지는 행동을 식별함으로써 이러한 시행 착오를 통해 학습합니다.

이런 각각의 개념들을 살펴보고 AWS DeepRacer와의 관계에 대해서도 알아보겠습니다.

Agent

The agent simulates the AWS DeepRacer vehicle in the simulation for training. More specifically, it embodies the neural network that controls the vehicle, taking inputs and deciding actions.

 

에이전트agent 는 훈련을 하기 위해 시뮬레이션에서 AWS DeepRacer 차량을 시뮬레이트 합니다. 보다 구체적으로, 차량을 제어하고 입력을 취하고 행동을 결정하는 신경망을 구현합니다.

 

Environment

The environment contains a track that defines where the agent can go and what state it can be in. The agent explores the envrionment to collect data to train the underlying neural network.

 

환경environment 은 에이전트agent 가 어디로 갈 수 있고 어떤 상태에 놓일 수 있는 지에 대해 정의하는 트랙으로 구성됩니다.  에이전트는 기본 신경 네트워크를 훈련하기 위해 주어진 환경(트랙)을 탐색하면서 데이터를 수집합니다.

 

State

A state represents a snapshot of the environment the agent is in at a point in time.

For AWS DeepRacer, a state is an image captured by the front-facing camera on the vehicle.

 

상태state 는 특정 시점에 에이전트가있는 환경의 스냅 샷을 가리킵니다.
AWS DeepRacer의 경우 상태는 차량의 전면 카메라가 캡처 한 이미지입니다.

 

Action

An action is a move made by the agent in the current state. For AWS DeepRacer, an action corresponds to a move at a particular speed and steering angle.

 

동작action 은 현재 상태에서 agent가 수행 한 동작입니다. AWS DeepRacer의 경우 동작은 특정 속도 및 방향(핸들) 각도 등의 움직임과 관계된 액션을 말합니다. 

 

Reward

The reward is the score given as feedback to the agent when it takes an action in a given state.

In training the AWS DeepRacer model, the reward is returned by a reward function. In general, you define or supply a reward function to specify what is desirable or undesirable action for the agent to take in a given state.

 

보상reward은 어떤 주어진 상태에서 action를 취했을 때 agent 에게 피드백으로 주어지는 점수입니다.

AWS DeepRacer 모델을 교육 할 때 보상reward reward function에 의해 반환됩니다. 일반적으로 agent 가 주어진 상태에서 취할 수있는 바람직하거나 바람직하지 않은 작업을 지정하기 위해 보상 기능을 정의하거나 제공합니다.

 

 

 

훈련은 반복적 인 과정입니다. 시뮬레이터에서 에이전트는 환경을 탐색하고 경험을 쌓습니다. 수집 된 경험은 신경망을 주기적으로 업데이트하는 데 사용되며 업데이트 된 모델은 더 많은 경험을 생성하는 데 사용됩니다.

 

AWS DeepRacer를 사용하여 자율 운전을 위한 차량을 교육합니다. 교육 과정을 시각화하는 것이 까다로울 수 있으므로 간단한 예를 살펴 보겠습니다.

 

 

이 예에서는 출발점에서 결승점까지 차량이 최단 경로로 갈 수 있도록 훈련시키려고 합니다.

 

우리는 환경environment 을 사각형 격자로 단순화했습니다. 각 사각형은 개별 상태를 나타내며, 목표 방향으로 차량을 위 또는 아래로 움직일 수 있습니다.

 

 

grid 내의 각 격자(사각형)마다 점수를 할당 할 수 있습니다. 그럼으로서 어떤 행동에 인센티브를 줄지 결정할 수 있게 됩니다. 

 

여기서 우리는 트랙의 가장자리에있는 사각형들을 "정지 상태 stop states"로 지정하여 차량이 트랙에서 벗어 났음을 알립니다.

 

우리가 트랙의 중심을 주행하는 법을 배울 수 있게 하도록 차량에 인센티브를 부여하기를 원하기 때문에 센터 라인의 사각형에 높은 보상reward 을 설정하고 다른 곳에는 보다 낮은 보상reward 을 설정합니다.

 

An episode

In reinforcement training, the vehicle will start by exploring the grid until it moves out of bounds or reaches the destination.

 

As it drives around, the vehicle accumulates rewards from the scores we defined. This process is called an episode.

In this episode, the vehicle accumulates a total reward of 2.2 before reaching a stop state.

 

reinforcement training은 여기서 차량이 grid 를 탐색하기 시작하여 경계를 벗어나거나 목적지까지 도달하면 일단락 하게 됩니다.

 

차량이 움직이게 되면 우리가 지정한 점수에 따라 rewards 가 점점 쌓이게 됩니다. 이러한 과정을 에피소드라고 합니다. 위 에피소드에서 이 차량이 stop state에 도달하기 까지 총 2.2 점의 reward 를 쌓았습니다.  

 

Iteration

Reinforcement learning algorithms are trained by repeated optimization of cumulative rewards.

 

Reinforcement learning algorithms은 누적된 rewards를 최적화 (최대화) 하기 위해 반복해서 훈련하게 됩니다.

 

The model will learn which action (and then subsequent actions) will result in the highest cumulative reward on the way to the goal.

 

이 모델은 우리가 목표로 하는 것을 달성하기 위한 최대화된 누적보상의 결과를 가져 올 수 있게 하는 것이 어떤 행동 (그리고 후속 행동)인가를 배우게 됩니다. 

 

Learning doesn’t just happen on the first go; it takes some iteration. First, the agent needs to explore and see where it can get the highest rewards, before it can exploit that knowledge.

 

학습은 한번에 완성되지 않습니다. 반복이 필요합니다. 첫째, 에이전트는 knowledge를 취하기 전에 가장 높은 보상을 받을 수 있는 것이 어떤 것인지를 탐색해야 합니다. 

 

Exploration

As the agent gains more and more experience, it learns to stay on the central squares to get higher rewards.

If we plot the total reward from each episode, we can see how the model performs and improves over time.

 

agent 는 점점 더 많은 경험을 쌓게 됩니다. 그러는 와중에 더 많은 점수를 얻으려면 중앙 격자를 계속 따라가야 한다는 것을 배우게 될 것입니다. 

 

각 에피소드별 보상 점수가 어떤지를 보면 이 모델이 어떤 퍼포먼스를 보여주고 있고 얼마나 개선되고 있는지를 알 수 있습니다.

Exploitation and Convergence

With more experience, the agent gets better and eventually is able to reach the destination reliably.

 

경험이 많아질 수록 agent 는 점점 더 나아지고 결국에는 목표에 도달할 수 있게 됩니다.

 

Depending on the exploration-exploitation strategy, the vehicle may still have a small probability of taking random actions to explore the environment.

 

이 exploration-exploitation strategy(탐사-탐사 전략)에 근거해서 차량은 환경을 탐사하기 위한 랜덤한 액션 (무작위 행동)을 할 가능성이 점점 더 줄어들게 됩니다.

 

 

 

AWS DeepRacer에서 보상 기능 reward function은 현재 상태를 설명하고 숫자 보상 값을 반환하는 특정 매개 변수가있는 Python 함수입니다.

 

보상 기능으로 전달 된 매개 변수는 트랙의 위치와 방향, 관측 된 속도, 조향 각도 등과 같은 차량 상태의 다양한 측면을 나타냅니다.

 

우리는이 매개 변수 중 몇 가지를 탐색하고 트랙 주변을 따라 차량을 묘사하는 방법을 살펴 보겠습니다.

 

  • Position on track
  • Heading
  • Waypoints
  • Track width
  • Distance from center line
  • All wheels on track
  • Speed
  • Steering angle

1. Position on track

The parameters x and y describe the position of the vehicle in meters, measured from the lower-left corner of the environment.

 

매개 변수 x 및 y는 환경의 왼쪽 하단 모서리에서 측정 한 차량의 위치를 미터 단위로 나타냅니다.

 

 

2. Heading

The heading parameter describes the orientation of the vehicle in degrees, measured counter-clockwise from the X-axis of the coordinate system.

 

heading 매개 변수는 좌표계의 X 축에서 시계 반대 방향으로 측정 한 차량의 방향을 도 단위로 나타냅니다.

 

 

3. Waypoints

The waypoints parameter is an ordered list of milestones placed along the track center.

Each waypoint in waypoints is a pair [x, y] of coordinates in meters, measured in the same coordinate system as the car's position.

 

waypoints 매개 변수는 트랙 센터를 따라 배치 된 마일스톤의 정렬 된 목록입니다.
waypoints 안에있는 각 waypoints 는  자동차의 위치에 대해 좌표계에서 측정 된 미터 단위의 좌표 [x, y] 쌍입니다.

 

 

4. Track width

The track_width parameter is the width of the track in meters.

 

track_width parameter는 미터로 된 트랙의 너비 입니다.

 

 

5. Distance from center line

The distance_from_center parameter measures the displacement of the vehicle from the center of the track.

The is_left_of_center parameter is a boolean describing whether the vehicle is to the left of the center line of the track.

 

distance_from_center 매개 변수는 트랙의 중심에서 차량의 변위를 측정합니다.
is_left_of_center 매개 변수는 차량이 트랙의 중심선 왼쪽에 있는지 여부를 나타내는 boolean  값입니다.

 

 

6. All wheels on track

The all_wheels_on_track parameter is a boolean (true / false) which is true if all four wheels of the vehicle are inside the track borders, and false if any wheel is outside the track.

 

all_wheels_on_track 매개 변수는 boolean  (true / false)이며 차량의 네 바퀴가 모두 트랙 테두리 안에 있으면 true이고, 하나라도 바퀴가 밖에 있으면 false가 됩니다.

 

 

7. Speed

The speed parameter measures the observed speed of the vehicle, measured in meters per second.

 

speed parameter는 초속 몇미터인가를 나타내는 차량의 관측된 속도입니다.

 

 

8. Steering angle

The steering_angle parameter measures the steering angle of the vehicle, measured in degrees.

This value is negative if the vehicle is steering right, and positive if the vehicle is steering left.

 

steering_angle 매개 변수는 차량의 조향 각도를 도 단위로 측정합니다.
이 값은 차량이 오른쪽으로 조향하는 경우 음수이고 차량이 좌회전하는 경우 양수입니다.

 

 

read the detailed documentation

 

Train and Evaluate AWS DeepRacer Models Using the AWS DeepRacer Console - AWS DeepRacer

Train and Evaluate AWS DeepRacer Models Using the AWS DeepRacer Console To train a reinforcement learning model, you can use the AWS DeepRacer console. In the console, create a training job, choose a supported framework and an available algorithm, add a re

docs.aws.amazon.com

 

 

The Reward Function.

 

Putting it all together

With all these parameters at your disposal, you can define a reward function to incentivize whatever driving behavior you like.

Let's see a few examples of reward functions and how they use the parameters to determine a reward. The following three reward functions are available as examples in the AWS DeepRacer console so you can try them out and see how they behave, or submit them to the AWS DeepRacer League.

 

이러한 모든 매개 변수를 마음대로 활용하면 원하는 운전 행동에 대한 인센티브를 주는 보상 기능을 정의 할 수 있습니다.

보상 기능의 몇 가지 예와 보상을 결정하기 위해 매개 변수를 사용하는 방법을 살펴 보겠습니다. AWS DeepRacer 콘솔에서 다음과 같은 세 가지 보상 기능을 사용할 수 있으므로 이를 시험해보고 어떻게 동작하는지 보거나 AWS DeepRacer League에 제출할 수 있습니다.

 

 

이 예에서는 자동차가 궤도에 머무를 때 높은 보상을주고 차가 궤도 경계를 벗어나는 경우 페널티를줍니다.

이 예제에서는 all_wheels_on_track, distance_from_center 및 track_width 매개 변수를 사용하여 자동차가 트랙에 있는지 여부를 확인하고 높은 경우 보상을 제공합니다.

이 기능은 트랙에 머무르는 것 이외의 특정 종류의 행동에 대해 보상하지 않으므로이 기능으로 교육받은 agent 는 특정 행동으로 수렴하는 데 시간이 오래 걸릴 수 있습니다.

 

 

 

 

이 예제에서 우리는 트랙의 중심에서 차가 얼마나 떨어져 있는지 측정하고, 차가 중심선에 가까이 있으면 더 높은 보상을줍니다.

이 예제에서는 track_width 및 distance_from_center 매개 변수를 사용하고 트랙의 중심에서 차가 멀어 질수록 보상이 줄어 듭니다.

이 예는 보상의 대상이되는 운전 행동의 유형에 따라 다르므로이 기능을 사용하여 교육을받은 agent는 트랙을 잘 따라갈 수 있습니다. 그러나 모서리의 가속이나 제동과 같은 다른 행동을 배우기는 쉽지 않습니다.

 

 

 

대안의 전략 alternative strategy은 자동차가 운전하는 방식에 관계없이 각 단계에 대해 지속적인 보상을 제공하는 것입니다.

이 예제는 입력 매개 변수를 사용하지 않고 각 단계마다 상수 보상 1.0을 반환합니다.

에이전트의 유일한 인센티브는 트랙을 성공적으로 끝내는 것이고, 더 빠르게 운전하거나 특정 경로를 따라갈 인센티브가 없습니다. 그것은 불규칙하게 행동 할 수 있습니다.

그러나 보상 기능은 agent의 행동을 제한하지 않으므로 예상치 못한 전략과 행동을 탐색하여 오히려 실적이 좋을 수도 있습니다.

 

 

 

 

 

 

반응형

AWS Machine Learning - Types of ML models etc.

2019. 5. 9. 10:04 | Posted by 솔웅


반응형

AWS Machine Learning

 

* Supervised Learning : Training Set and Test Set

 

 

 

Types of ML Models

Amazon ML supports three types of ML models: binary classification, multiclass classification, and regression. The type of model you should choose depends on the type of target that you want to predict.

Binary Classification Model

ML models for binary classification problems predict a binary outcome (one of two possible classes). To train binary classification models, Amazon ML uses the industry-standard learning algorithm known as logistic regression.

Examples of Binary Classification Problems

  • "Is this email spam or not spam?"

  • "Will the customer buy this product?"

  • "Is this product a book or a farm animal?"

  • "Is this review written by a customer or a robot?"

Multiclass Classification Model

ML models for multiclass classification problems allow you to generate predictions for multiple classes (predict one of more than two outcomes). For training multiclass models, Amazon ML uses the industry-standard learning algorithm known as multinomial logistic regression.

Examples of Multiclass Problems

  • "Is this product a book, movie, or clothing?"

  • "Is this movie a romantic comedy, documentary, or thriller?"

  • "Which category of products is most interesting to this customer?"

Regression Model

ML models for regression problems predict a numeric value. For training regression models, Amazon ML uses the industry-standard learning algorithm known as linear regression.

Examples of Regression Problems

  • "What will the temperature be in Seattle tomorrow?"

  • "For this product, how many units will sell?"

  • "What price will this house sell for?"

ML 모델 유형

Amazon ML은 이진수 분류, 멀티클래스 분류 및 회귀라는 세 가지 유형의 ML 모델을 지원합니다. 선택해야 하는 모델 유형은 예측하려는 목표의 유형에 따라 따릅니다.

이진 분류 모델

이진 분류 문제에 대한 ML 모델은 이진 결과(가능성이 있는 두 가지 클래스 중 하나)를 예측합니다. 이진수 분류 모델을 교육하기 위해 은 '로지스틱 회귀'로 알려진 업계 표준 학습 알고리즘을 사용합니다.

이진 분류 문제의 예

  • "이 이메일은 스팸입니까? 스팸이 아닙니까?"

  • "고객이 이 제품을 구입할 것입니까?"

  • "이 제품은 책입니까? 아니면 가축입니까?"

  • "이 리뷰는 고객이 작성합니까? 로봇이 작성합니까?"

멀티클래스 분류 모델

멀티클래스 분류 문제에 대해 ML 모델을 사용하면 여러 클래스에 대한 예측을 생성할 수 있습니다(세 개 이상의 결과 중 하나를 예측). 멀티클래스 모델을 교육하기 위해 은 '다항 로지스틱 회귀'로 알려진 업계 표준 학습 알고리즘을 사용합니다.

멀티클래스 문제의 예

  • "이 제품은 책, 영화 또는 의류입니까?"

  • "이 영화는 로맨틱 코미디, 다큐멘터리 또는 스릴러입니까?"

  • "이 고객이 가장 관심을 갖는 제품 카테고리는 무엇입니까?"

회귀 모델

회귀 문제에 대해 ML 모델은 숫자 값을 예측합니다. 회귀 모델을 교육하기 위해 은 '선형 회귀'로 알려진 업계 표준 학습 알고리즘을 사용합니다.

회귀 문제의 예

  • "내일 시애틀의 기온은 어떨까요?"

  • "이 제품의 판매량이 얼마나 될까요?"

  • "이 집의 매매 가격이 얼마나 될까요?"

 

 

- Unsupervised Learning : Only data,
  Clustering Algorithm :
  Dimensionality Reduction
  Group words that are used in similar context or have similar meaning
  

 


Reinforcement Learning 
  Decision Making under uncertainty
  Autonomous Driving
  Games
  Reinforcement uses Reward Functions to reward correct decision and punish incorrect decision

 

Reinforcement Learning with Amazon SageMaker RL

Reinforcement learning (RL) is a machine learning technique that attempts to learn a strategy, called a policy, that optimizes an objective for an agent acting in an environment. For example, the agent might be a robot, the environment might be a maze, and the goal might be to successfully navigate the maze in the smallest amount of time. In RL, the agent takes an action, observes the state of the environment, and gets a reward based on the value of the current state of the environment. The goal is to maximize the long-term reward that the agent receives as a result of its actions. RL is well-suited for solving problems where an agent can make autonomous decisions.

Topics

Why is Reinforcement Learning Important?

RL is well-suited for solving large, complex problems. For example, supply chain management, HVAC systems, industrial robotics, game artificial intelligence, dialog systems, and autonomous vehicles. Because RL models learn by a continuous process of receiving rewards and punishments for every action taken by the agent, it is possible to train systems to make decisions under uncertainty and in dynamic environments.

Markov Decision Process (MDP)

RL is based on models called Markov Decision Processes (MDPs). An MDP consists of a series of time steps. Each time step consists of the following:

Environment

Defines the space in which the RL model operates. This can be either a real-world environment or a simulator. For example, if you train a physical autonomous vehicle on a physical road, that would be a real-world environment. If you train a computer program that models an autonomous vehicle driving on a road, that would be a simulator.

State

Specifies all information about the environment and past steps that is relevant to the future. For example, in an RL model in which a robot can move in any direction at any time step, then the position of the robot at the current time step is the state, because if we know where the robot is, it isn't necessary to know the steps it took to get there.

Action

What the agent does. For example, the robot takes a step forward.

Reward

A number that represents the value of the state that resulted from the last action that the agent took. For example, if the goal is for a robot to find treasure, the reward for finding treasure might be 5, and the reward for not finding treasure might be 0. The RL model attempts to find a strategy that optimizes the cumulative reward over the long term. This strategy is called a policy.

Observation

Information about the state of the environment that is available to the agent at each step. This might be the entire state, or it might be just a part of the state. For example, the agent in a chess-playing model would be able to observe the entire state of the board at any step, but a robot in a maze might only be able to observe a small portion of the maze that it currently occupies.

Typically, training in RL consists of many episodes. An episode consists of all of the time steps in an MDP from the initial state until the environment reaches the terminal state.

Key Features of Amazon SageMaker RL

To train RL models in Amazon SageMaker RL, use the following components:

  • A deep learning (DL) framework. Currently, Amazon SageMaker supports RL in TensorFlow and Apache MXNet.

  • An RL toolkit. An RL toolkit manages the interaction between the agent and the environment, and provides a wide selection of state of the art RL algorithms. Amazon SageMaker supports the Intel Coach and Ray RLlib toolkits. For information about Intel Coach, see https://nervanasystems.github.io/coach/. For information about Ray RLlib, see https://ray.readthedocs.io/en/latest/rllib.html.

  • An RL environment. You can use custom environments, open-source environments, or commercial environments. For information, see RL Environments in Amazon SageMaker.

The following diagram shows the RL components that are supported in Amazon SageMaker RL.

 

Amazon SageMaker RL을 사용한 강화 학습

강화 학습(RL)은 환경에서 작동하는 에이전트에 대한 목표를 최적화하는 전략(정책이라고 함)을 배우려고 시도하는 기계 학습 기법입니다. 예를 들어, 에이전트는 로봇, 환경은 미로, 목표는 최단시간 내에 미로를 성공적으로 탈출하는 것일 수 있습니다. RL에서 에이전트는 행동을 취하고, 환경의 상태를 관찰하고, 환경의 현재 상태 값에 따라 보상을 받습니다. 목표는 행동의 결과로 에이전트가 받는 장기 보상을 극대화하는 것입니다. RL은 에이전트가 자율 의사결정을 내릴 수 있는 문제를 해결하는 데 매우 적합합니다.

주제

강화 학습이 중요한 이유는 무엇입니까?

RL은 크고 복잡한 문제를 해결하는 데 매우 적합합니다. 예를 들어, 공급망 관리, HVAC 시스템, 산업용 로봇, 게임 인공 지능, 음성 대화 시스템 및 자율 주행 차량 등이 있습니다. RL 모델은 에이전트가 취하는 모든 행동에 대해 보상과 처벌을 받는 연속 프로세스를 통해 학습하기 때문에 동적인 환경에서 불확실성이 존재할 때 시스템이 의사를 결정하도록 훈련할 수 있습니다.

마코프 의사결정 과정(MDP)

RL은 마코프 의사결정 과정(MDP)라는 모델을 기반으로 합니다. MDP는 일련의 시간 단계로 구성됩니다. 각 시간 단계는 다음과 같은 요소로 구성됩니다.

환경

RL 모델이 작동하는 공간을 정의합니다. 이러한 공간은 실제 환경 또는 시뮬레이터일 수 있습니다. 예를 들어, 실제 도로에서 자율 주행 차량을 훈련하는 경우는 환경이 실제 환경입니다. 도로 위를 주행하는 자율 주행 차량을 모델링하는 컴퓨터 프로그램을 훈련하는 경우에는 환경이 시뮬레이터입니다.

상태

환경에 대한 모든 정보와 미래와 관련된 과거의 모든 단계를 지정합니다. 예를 들어, 로봇이 언제든지 어떤 방향으로든 이동할 수 있는 RL 모델에서는 현재 시간 단계에서 로봇의 위치가 상태입니다. 로봇 위치를 알면 해당 위치에 도착하기 위해 어떤 단계를 수행했는지 알 필요가 없기 때문입니다.

작업

작업은 에이전트가 수행합니다. 예를 들어 로봇이 앞으로 나아갑니다.

보상

에이전트가 수행한 마지막 작업의 상태 값을 나타내는 숫자입니다. 예를 들어, 목표가 로봇이 보물을 찾도록 하는 것이라면 보물을 찾은 경우 보상이 5이고, 보물을 찾지 못한 경우에는 보상이 0일 수 있습니다. RL 모델은 장기간 누적된 보상을 최적화하는 전략을 찾으려고 합니다. 이러한 전략을 정책이라고 합니다.

관측치

각 단계마다 에이전트가 사용할 수 있는 환경 상태에 대한 정보입니다. 전체 상태이거나 상태의 일부분일 수 있습니다. 예를 들어, 체스 시합 모델의 에이전트는 모든 단계에서 체스판의 전체 상태를 관찰할 수 있지만 미로 속의 로봇은 현재 마주하고 있는 미로의 작은 부분 밖에 관찰할 수 없습니다.

일반적으로 RL의 훈련은 많은 에피소드로 구성됩니다. 에피소드는 초기 상태에서 환경이 최종 상태에 도달할 때까지 MDP의 모든 시간 단계로 구성됩니다.

Amazon SageMaker RL의 주요 기능

Amazon SageMaker RL에서 RL 모델을 훈련하려면 다음 구성 요소를 사용합니다.

  • 딥 러닝(DL) 프레임워크. 현재, Amazon SageMaker는 TensorFlow 및 Apache MXNet에서 RL을 지원합니다.

  • RL 도구 키트. RL 도구 키트는 에이전트와 환경 간의 상호 작용을 관리하고, RL 알고리즘의 광범위한 상태 선택 항목을 제공합니다. Amazon SageMaker는 Intel Coach 및 Ray RLlib 도구 키트를 제공합니다. Intel Coach에 대한 자세한 정보는 https://nervanasystems.github.io/coach/를 참조하십시오. Ray RLlib에 대한 자세한 정보는 https://ray.readthedocs.io/en/latest/rllib.html을 참조하십시오.

  • RL 환경. 사용자 지정 환경, 오픈 소스 환경 또는 상용 환경을 사용할 수 있습니다. 자세한 정보는 Amazon SageMaker의 RL 환경 단원을 참조하십시오.

다음 다이어그램은 Amazon SageMaker RL에서 지원되는 RL 구성 요소를 보여 줍니다.

 

- refer to the picture above -

 

 

 

* Data types  
* Data in Real Life : Numeric, Text, Categorical values
* Categorical : Cartesian Transformation - Combine categorical features to form new features
* Text Type : NGRAM, OSB Transformation, Stemming, Lower Case
* Numeric Data :

 

Data Transformations Reference

Topics

N-gram Transformation

The n-gram transformation takes a text variable as input and produces strings corresponding to sliding a window of (user-configurable) n words, generating outputs in the process. For example, consider the text string "I really enjoyed reading this book".

Specifying the n-gram transformation with window size=1 simply gives you all the individual words in that string:

 

{"I", "really", "enjoyed", "reading", "this", "book"}

Specifying the n-gram transformation with window size =2 gives you all the two-word combinations as well as the one-word combinations:

 

{"I really", "really enjoyed", "enjoyed reading", "reading this", "this book", "I", "really", "enjoyed", "reading", "this", "book"}

Specifying the n-gram transformation with window size = 3 will add the three-word combinations to this list, yielding the following:

 

{"I really enjoyed", "really enjoyed reading", "enjoyed reading this", "reading this book", "I really", "really enjoyed", "enjoyed reading", "reading this", "this book", "I", "really", "enjoyed", "reading", "this", "book"}

You can request n-grams with a size ranging from 2-10 words. N-grams with size 1 are generated implicitly for all inputs whose type is marked as text in the data schema, so you do not have to ask for them. Finally, keep in mind that n-grams are generated by breaking the input data on whitespace characters. That means that, for example, punctuation characters will be considered a part of the word tokens: generating n-grams with a window of 2 for string "red, green, blue" will yield {"red,", "green,", "blue,", "red, green", "green, blue"}. You can use the punctuation remover processor (described later in this document) to remove the punctuation symbols if this is not what you want.

To compute n-grams of window size 3 for variable var1:

 

"ngram(var1, 3)"

Orthogonal Sparse Bigram (OSB) Transformation

The OSB transformation is intended to aid in text string analysis and is an alternative to the bi-gram transformation (n-gram with window size 2). OSBs are generated by sliding the window of size n over the text, and outputting every pair of words that includes the first word in the window.

To build each OSB, its constituent words are joined by the "_" (underscore) character, and every skipped token is indicated by adding another underscore into the OSB. Thus, the OSB encodes not just the tokens seen within a window, but also an indication of number of tokens skipped within that same window.

To illustrate, consider the string "The quick brown fox jumps over the lazy dog", and OSBs of size 4. The six four-word windows, and the last two shorter windows from the end of the string are shown in the following example, as well OSBs generated from each:

Window, {OSBs generated}

 

"The quick brown fox", {The_quick, The__brown, The___fox} "quick brown fox jumps", {quick_brown, quick__fox, quick___jumps} "brown fox jumps over", {brown_fox, brown__jumps, brown___over} "fox jumps over the", {fox_jumps, fox__over, fox___the} "jumps over the lazy", {jumps_over, jumps__the, jumps___lazy} "over the lazy dog", {over_the, over__lazy, over___dog} "the lazy dog", {the_lazy, the__dog} "lazy dog", {lazy_dog}

Orthogonal sparse bigrams are an alternative for n-grams that might work better in some situations. If your data has large text fields (10 or more words), experiment to see which works better. Note that what constitutes a large text field may vary depending on the situation. However, with larger text fields, OSBs have been empirically shown to uniquely represent the text due to the special skip symbol (the underscore).

You can request a window size of 2 to 10 for OSB transformations on input text variables.

To compute OSBs with window size 5 for variable var1:

"osb(var1, 5)"

Lowercase Transformation

The lowercase transformation processor converts text inputs to lowercase. For example, given the input "The Quick Brown Fox Jumps Over the Lazy Dog", the processor will output "the quick brown fox jumps over the lazy dog".

To apply lowercase transformation to the variable var1:

"lowercase(var1)"

Remove Punctuation Transformation

Amazon ML implicitly splits inputs marked as text in the data schema on whitespace. Punctuation in the string ends up either adjoining word tokens, or as separate tokens entirely, depending on the whitespace surrounding it. If this is undesirable, the punctuation remover transformation may be used to remove punctuation symbols from generated features. For example, given the string "Welcome to AML - please fasten your seat-belts!", the following set of tokens is implicitly generated:

 

{"Welcome", "to", "Amazon", "ML", "-", "please", "fasten", "your", "seat-belts!"}

Applying the punctuation remover processor to this string results in this set:

 

{"Welcome", "to", "Amazon", "ML", "please", "fasten", "your", "seat-belts"}

Note that only the prefix and suffix punctuation marks are removed. Punctuations that appear in the middle of a token, e.g. the hyphen in "seat-belts", are not removed.

To apply punctuation removal to the variable var1:

"no_punct(var1)"

Quantile Binning Transformation

The quantile binning processor takes two inputs, a numerical variable and a parameter called bin number, and outputs a categorical variable. The purpose is to discover non-linearity in the variable's distribution by grouping observed values together.

In many cases, the relationship between a numeric variable and the target is not linear (the numeric variable value does not increase or decrease monotonically with the target). In such cases, it might be useful to bin the numeric feature into a categorical feature representing different ranges of the numeric feature. Each categorical feature value (bin) can then be modeled as having its own linear relationship with the target. For example, let's say you know that the continuous numeric feature account_age is not linearly correlated with likelihood to purchase a book. You can bin age into categorical features that might be able to capture the relationship with the target more accurately.

The quantile binning processor can be used to instruct Amazon ML to establish n bins of equal size based on the distribution of all input values of the age variable, and then to substitute each number with a text token containing the bin. The optimum number of bins for a numeric variable is dependent on characteristics of the variable and its relationship to the target, and this is best determined through experimentation. Amazon ML suggests the optimal bin number for a numeric feature based on data statistics in the Suggested Recipe.

You can request between 5 and 1000 quantile bins to be computed for any numeric input variable.

To following example shows how to compute and use 50 bins in place of numeric variable var1:

"quantile_bin(var1, 50)"

Normalization Transformation

The normalization transformer normalizes numeric variables to have a mean of zero and variance of one. Normalization of numeric variables can help the learning process if there are very large range differences between numeric variables because variables with the highest magnitude could dominate the ML model, no matter if the feature is informative with respect to the target or not.

To apply this transformation to numeric variable var1, add this to the recipe:

normalize(var1)

This transformer can also take a user defined group of numeric variables or the pre-defined group for all numeric variables (ALL_NUMERIC) as input:

normalize(ALL_NUMERIC)

Note

It is not mandatory to use the normalization processor for numeric variables.

Cartesian Product Transformation

The Cartesian transformation generates permutations of two or more text or categorical input variables. This transformation is used when an interaction between variables is suspected. For example, consider the bank marketing dataset that is used in Tutorial: Using Amazon ML to Predict Responses to a Marketing Offer. Using this dataset, we would like to predict whether a person would respond positively to a bank promotion, based on the economic and demographic information. We might suspect that the person's job type is somewhat important (perhaps there is a correlation between being employed in certain fields and having the money available), and the highest level of education attained is also important. We might also have a deeper intuition that there is a strong signal in the interaction of these two variables—for example, that the promotion is particularly well-suited to customers who are entrepreneurs who earned a university degree.

The Cartesian product transformation takes categorical variables or text as input, and produces new features that capture the interaction between these input variables. Specifically, for each training example, it will create a combination of features, and add them as a standalone feature. For example, let's say our simplified input rows look like this:

target, education, job

0, university.degree, technician

0, high.school, services

1, university.degree, admin

If we specify that the Cartesian transformation is to be applied to the categorical variables education and job fields, the resultant feature education_job_interaction will look like this:

target, education_job_interaction

0, university.degree_technician

0, high.school_services

1, university.degree_admin

The Cartesian transformation is even more powerful when it comes to working on sequences of tokens, as is the case when one of its arguments is a text variable that is implicitly or explicitly split into tokens. For example, consider the task of classifying a book as being a textbook or not. Intuitively, we might think that there is something about the book's title that can tell us it is a textbook (certain words might occur more frequently in textbooks' titles), and we might also think that there is something about the book's binding that is predictive (textbooks are more likely to be hardcover), but it's really the combination of some words in the title and binding that is most predictive. For a real-world example, the following table shows the results of applying the Cartesian processor to the input variables binding and title:

TextbookTitleBindingCartesian product of no_punct(Title) and Binding

1 Economics: Principles, Problems, Policies Hardcover {"Economics_Hardcover", "Principles_Hardcover", "Problems_Hardcover", "Policies_Hardcover"}
0 The Invisible Heart: An Economics Romance Softcover {"The_Softcover", "Invisible_Softcover", "Heart_Softcover", "An_Softcover", "Economics_Softcover", "Romance_Softcover"}
0 Fun With Problems Softcover {"Fun_Softcover", "With_Softcover", "Problems_Softcover"}

The following example shows how to apply the Cartesian transformer to var1 and var2:

cartesian(var1, var2)

 

데이터 변환 참조

주제

n-gram 변환

n-gram 변환은 텍스트 변수를 입력으로 가져오고 (사용자가 구성 가능한) n 단어 창을 슬라이딩하는 문자열을 생성하여 해당 프로세스에서 출력을 생성합니다. 예를 들어 "I really enjoyed reading this book"이라는 텍스트 문자열을 생각해 보겠습니다.

창 크기 = 1인 n-gram 변환을 지정하면 다음과 같이 해당 문자열에 있는 모든 개별 단어가 제공됩니다.

 

{"I", "really", "enjoyed", "reading", "this", "book"}

창 크기 = 2인 n-gram 변환을 지정하면 다음과 같이 모든 2단어 조합과 모든 1단어 조합이 제공됩니다.

 

{"I really", "really enjoyed", "enjoyed reading", "reading this", "this book", "I", "really", "enjoyed", "reading", "this", "book"}

창 크기 = 3인 n-gram 변환을 지정하면 이 목록에 3단어 조합을 추가하여 다음을 산출합니다.

 

{"I really enjoyed", "really enjoyed reading", "enjoyed reading this", "reading this book", "I really", "really enjoyed", "enjoyed reading", "reading this", "this book", "I", "really", "enjoyed", "reading", "this", "book"}

n-gram을 2~10개 단어 범위의 크기로 요청할 수 있습니다. 크기가 1인 n-gram은 데이터 스키마에서 텍스트로 표시된 유형의 모든 입력에 대해 암시적으로 생성되므로, 사용자가 요청할 필요가 없습니다. 마지막으로, n-gram은 공백 문자에 대한 입력 데이터를 분해하여 생성된다는 것을 기억해야 합니다. 예를 들어 구두점 문자는 다음과 같이 단어 토큰의 일부로 간주됩니다. 문자열 "red, green, blue"에 대해 2개의 창으로 n-gram을 생성하면 {"red,", "green,", "blue,", "red, green", "green, blue"}로 산출됩니다. 구두점 제거 프로세서(이 문서의 뒷부분에서 설명)를 사용하여 원하지 않는 구두점을 제거할 수 있습니다.

변수 var1에 대해 창 크기가 3인 n-gram을 계산하려면:

 

"ngram(var1, 3)"

Orthogonal Sparse Bigram(OSB) 변환

OSB 변환은 텍스트 문자열 분석을 보조하는 목적이며 bi-gram 변환(창 크기가 2인 n-gram)을 대체하는 변환입니다. OSB는 n 단어 크기의 창을 텍스트 위로 슬라이딩하고 창의 첫 번째 단어가 포함된 모든 단어 페어를 출력하여 생성됩니다.

각 OSB를 구축하기 위해 구성 단어는 "_"(밑줄) 문자로 결합되며, 건너뛴 모든 토큰은 OSB에 또 다른 밑줄을 추가하여 표시됩니다. 따라서 OSB는 창 내에 확인되는 토큰뿐만 아니라 동일한 창 내에서 건너뛴 토큰의 수도 표시합니다.

예를 들어 "The quick brown fox jumps over the lazy dog"라는 문자열과 크기가 4인 OSB를 생각해 보겠습니다. 여섯 개의 4 단어 창 및 문자열 끝에 있는 더 짧은 길이의 마지막 창은 다음 예제에서 각 창에서 생성된 OSB와 함께 표시됩니다.

창, {생성된 OSB}

 

"The quick brown fox", {The_quick, The__brown, The___fox} "quick brown fox jumps", {quick_brown, quick__fox, quick___jumps} "brown fox jumps over", {brown_fox, brown__jumps, brown___over} "fox jumps over the", {fox_jumps, fox__over, fox___the} "jumps over the lazy", {jumps_over, jumps__the, jumps___lazy} "over the lazy dog", {over_the, over__lazy, over___dog} "the lazy dog", {the_lazy, the__dog} "lazy dog", {lazy_dog}

Orthogonal Sparse Bigram은 일부 상황에서 효과적으로 작용할 수 있는 n-gram의 대체 변환입니다. 데이터에 큰 텍스트 필드(10개 이상의 단어)가 있는 경우 실험을 통해 효과적인 방식을 살펴봅니다. 큰 텍스트 필드를 구성하는 내용은 상황에 따라 다를 수 있음을 참고하십시오. 그러나 큰 텍스트 필드를 사용하는 OSB는 특수 건너뛰기 기호(밑줄)로 인해 텍스트를 고유하게 나타내는 것으로 실증되었습니다.

입력 텍스트 변수의 OSB 변환에 대해 2~10의 창 크기를 요청할 수 있습니다.

변수 var1에 대해 창 크기가 5인 OSB를 계산하려면:

"osb(var1, 5)"

소문자 변환

소문자 변환 프로세서는 텍스트 입력을 소문자로 변환합니다. 예를 들어 프로세서는 "The Quick Brown Fox Jumps Over the Lazy Dog"라는 입력을 "the quick brown fox jumps over the lazy dog"라고 출력합니다.

변수 var1에 소문자 변환을 적용하려면:

"lowercase(var1)"

구두점 변환 제거

Amazon ML은 공백이 있는 데이터 스키마의 텍스트로 표시된 입력을 암시적으로 분리합니다. 문자열의 구두점은 주변의 공백에 따라 인접한 단어 토큰으로 끝나거나 완전히 별개의 토큰으로 끝납니다. 이것이 바람직하지 않은 경우, 생성된 특성의 구두점을 제거하는 데 구두점 제거 변환을 사용할 수 있습니다. 예를 들어 "Welcome to AML - please fasten your seat-belts!"라는 문자열이 있으면 다음과 같은 토큰 집합이 암시적으로 생성됩니다.

 

{"Welcome", "to", "Amazon", "ML", "-", "please", "fasten", "your", "seat-belts!"}

구두점 제거 프로세서를 이 문자열에 적용하면 다음과 같은 집합이 됩니다.

 

{"Welcome", "to", "Amazon", "ML", "please", "fasten", "your", "seat-belts"}

접두사 및 접미사 구두점만 제거됩니다. 토큰 중간에 나타나는 구두점("seat-belts"에 있는 하이픈 등)은 제거되지 않습니다.

변수 var1에 구두점 변환을 적용하려면:

"no_punct(var1)"

Quartile binning 변환

Quantile binning 프로세서는 숫자 변수 및 bin number라는 파라미터의 두 가지 입력을 사용해서 카테고리 변수를 출력합니다. 그 목적은 관측된 값을 그룹화하여 변수의 배포에서 비선형성을 발견하는 것입니다.

많은 경우에 숫자 변수와 대상 간의 관계는 선형적이지 않습니다(숫자 변수 값은 대상에 따라 점차 증가하거나 감소하지 않음). 이 경우 다양한 범위의 숫자 특성을 나타내는 카테고리 특성으로 숫자 특성을 비닝하는 것이 유용할 수 있습니다. 각 카테고리 특성 값(빈)은 대상과의 선형 관계를 갖도록 모델링될 수 있습니다. 예를 들어 연속적인 숫자 특성 account_age가 책을 구입할 가능성과 선형적으로 관련이 없다는 것을 알고 있다고 가정해 보겠습니다. 사용자는 대상과의 관계를 더욱 정확하게 캡처할 수 있는 카테고리 특성으로 age를 비닝할 수 있습니다.

quantile binning 프로세서는 Amazon ML이 age 변수의 모든 입력 값 배포를 기반으로 동일한 크기의 빈 n개를 설정한 다음 각 번호를 빈을 포함하는 텍스트 토큰으로 대체하도록 하는 데 사용될 수 있습니다. 숫자 변수에 대한 최적의 빈 수는 변수의 특징과 대상과의 관계에 따라 달라지며, 이는 실험을 통해 가장 효과적으로 결정됩니다. Amazon ML은 제안된 레시피의 데이터 통계를 기반으로 숫자 특성에 대한 최적의 빈 수를 제시합니다.

숫자 입력 변수에 대해 5~1000개의 quantile 빈을 계산하도록 요청할 수 있습니다.

다음 예제에서는 숫자 변수 var1 대신 50개의 빈을 계산하여 사용하는 방법을 보여 줍니다.

"quantile_bin(var1, 50)"

정규화 변환

정규화 변환기는 평균 값이 0이고 분산 값이 1인 숫자 변수를 정규화합니다. 특성이 대상과 관련하여 많은 정보가 되는지 여부와 관계없이 가장 큰 크기의 변수가 ML 모델의 대부분을 차지할 수 있기 때문에, 숫자 변수의 정규화는 숫자 변수 사이에 범위 차이가 매우 큰 경우에 학습 프로세스에 도움이 될 수 있습니다.

숫자 변수 var1에 이 변환을 적용하려면 다음과 같이 레시피에 추가합니다.

normalize(var1)

이 변환기는 숫자 변수의 사용자 정의 그룹 또는 모든 숫자 변수(ALL_NUMERIC)의 사전 정의된 그룹을 입력으로 사용할 수 있습니다.

normalize(ALL_NUMERIC)

참고

숫자 변수에 정규화 프로세서를 사용하는 것은 필수가 아닙니다.

데카르트 곱 변환

데카르트 변환은 두 개 이상의 텍스트 또는 카테고리 입력 변수의 순열을 생성합니다. 이 변환은 변수 간에 상호 작용이 있다고 생각될 때 사용합니다. 예를 들어 자습서: Amazon ML을 사용한 마케팅 반응 예측에서 사용되는 은행 마케팅 데이터 집합을 고려해 보겠습니다. 이 데이터 집합을 사용하여 경제 및 인구 통계 정보를 기반으로 은행 홍보에 긍정적인 반응을 보이는지 예측하려고 합니다. 해당하는 사람의 직업 유형이 상당히 중요하다고 생각할 수 있으며(특정 분야에서 근무하는 것과 사용 가능한 비용 간에 상관 관계가 있을 수 있음), 가장 높은 수준의 교육을 받은 사실도 중요하다고 간주할 수 있습니다. 또한 이 두 변수의 상호 작용에 강력한 신호가 있다는 것도 알 수 있습니다. 예를 들어 특히 학사 학위를 취득한 사업가 고객에게 홍보하는 것이 적합합니다.

데카르트 곱 변환은 카테고리 변수 또는 텍스트를 입력으로 사용하고, 이러한 입력 변수 간의 상호 작용을 캡처하는 새로운 특성을 생성합니다. 특히, 각 교육 예제에 대해 특성의 조합을 생성하고 이를 독립적인 특성으로 추가합니다. 예를 들어 다음과 같은 간소화된 입력 행이 있다고 가정하겠습니다.

target, education, job

0, university.degree, technician

0, high.school, services

1, university.degree, admin

데카르트 변환이 카테고리 변수 education 및 job 필드에 적용되도록 지정하면 결과적으로 다음과 같은 education_job_interaction 특성을 볼 수 있습니다.

target, education_job_interaction

0, university.degree_technician

0, high.school_services

1, university.degree_admin

데카르트 변환은 인수 중 하나가 암시적으로 또는 명시적으로 토큰으로 분리되는 텍스트 변수 같은 토큰 시퀀스 작업에서 더욱 강력하게 작용합니다. 예를 들어 책을 교과서로 분류할지 여부에 대한 작업을 생각해 보겠습니다. 직관적으로, 교과서라고 말할 수 있는 책의 제목에 대해 생각할 수 있으며(특정 단어는 교과서의 제목에서 더 자주 나타날 수 있음), 책의 표지에 대해 예측 가능한 점이 있다고 생각할 수도 있지만(교과서는 하드 커버가 될 가능성이 더 큼), 실제로 제목과 표지에 있는 단어의 조합이야말로 가장 예측 가능합니다. 실제 사례에서 다음 표는 데카르트 프로세서를 입력 변수 표지 및 제목에 적용한 결과를 보여 줍니다.

교과서제목표지no_punct(제목) 및 표지의 데카르트 곱

1 Economics: Principles, Problems, Policies Hardcover {"Economics_Hardcover", "Principles_Hardcover", "Problems_Hardcover", "Policies_Hardcover"}
0 The Invisible Heart: An Economics Romance Softcover {"The_Softcover", "Invisible_Softcover", "Heart_Softcover", "An_Softcover", "Economics_Softcover", "Romance_Softcover"}
0 Fun With Problems Softcover {"Fun_Softcover", "With_Softcover", "Problems_Softcover"}

다음 예는 var1 및 var2에 대해 데카르트 변환기를 적용하는 방법을 보여 줍니다.

cartesian(var1, var2)

반응형

What Is AWS DeepRacer?

2018. 12. 24. 02:18 | Posted by 솔웅


반응형


AWS DeepRacer consists of the following components:


AWS DeepRacer는 다음과 같은 콤포넌트들로 구성돼 있다.


  • An AWS Machine Learning service to train and evaluate reinforcement learning models.

  • 강화 학습 모델들을 훈련하고 평가하기 위한 AWS Machine Learning service

  • AWS DeepRacer scale model vehicles that can drive themselves by running inference on a trained reinforcement learning model.

  • AWS DeepRacer scale model 차량은 훈련된 reinforcement learning model 을 기반한 추론을 실행함으로서 스스로 운전할 수 있음

  • AWS DeepRacer Racing Leagues for the participants to learn from and inspire each other through competitions on model performances.

  • AWS DeepRacer Racing Leagues는 참가자들이 DeepRacer 운행관련 경쟁을 통해 서로 배우고 영감을 주고받는 기회를 제공함



It provides you with an interactive learning platform for users of all levels to learnreinforcement learning and to prototype autonomous driving applications.

이를 통해 모든 사용자가 reinforcement learning을 배우고 자율 주행 어플리케이션의 기본 틀을 만들 수 있는 상호 작용하는 learning platform을 여러분에게 제공하게 됩니다.


With a cloud-based simulator and an AWS DeepRacer model vehicle, AWS DeepRacer lets you train, evaluate, and experiment with reinforcement learning models for autonomous racing in a virtual or physical environment.


클라우드 기반 시뮬레이터와 AWS DeepRacer model 차량을 가지고 여러분이 가상 혹은 실제 환경에서 자율 주행 레이싱을 하도록 reinforcement learning models을 이용해 훈련하고 평가하고 실험할 수 있도록  AWS DeepRacer는 그 기회를 제공합니다.



Topics



The AWS DeepRacer Console





The AWS DeepRacer console is a graphical user interface to interact with the AWS DeepRacer service. You can use the console to train a reinforcement learning model, to evaluate the model performance in simulation as rendered by the AWS RoboMaker simulator.

AWS DeepRacer console은  AWS DeepRacer service와 상호 작용하는 graphical user interface 입니다. 이 콘솔을 사용하여 AWS RoboMaker 시뮬레이터에서 렌더링 한 시뮬 레이션에서 모델 성능을 평가하는 강화 학습 모델을 학습 할 수 있습니다.


In summary, the AWS DeepRacer console supports the following features:

요약하면 AWS DeepRacer 콘솔은 다음 기능을 지원합니다.

  • The AWS DeepRacer console lets you create a training job to train a reinforcement learning model, with a specified reward function, optimization algorithm, environment, and hyperparameters.

  • AWS DeepRacer console을 사용하면 reinforcement learning model 트레이닝을 위한 훈련작업을 만들 수 있습니다. 이 작업은 특정 보상기능, 최적화된 알고리즘, 환경 그리고 hyperparameters 등을 사용해서 이루어 질 수 있습니다.

  • The AWS DeepRacer console provides a simulated track for you to train and evaluate a model on a selected track.

  • AWS DeepRacer console은 훈련하기 위한 시뮬레이트 된 트랙과 해당 트랙에서의 모델 평가 등을 제공합니다.

  • The AWS DeepRacer console lets you clone a trained model to retrain it by tuning hyperparameters to optimize your model's performance.

  • AWS DeepRacer console을 사용하면 hyperparameters를 튜닝함으로서 훈련 모델을 복제해 해당 모델의 성능을 최적화 할 수 있습니다.



AWS DeepRacer Vehicles as Physical Agents


The AWS DeepRacer vehicle is a scaled-down physical vehicle that can drive itself on a real track using a deployed reinforcement learning model.

AWS DeepRacer 차량은 deploy된 reinforcement learning model을 하용해 실제 트랙에서 차량을 드라이브 할 수 있는 실제 차량의 축소본입니다.

  • You can manually control the vehicle, or turn the autonomous mode that requires a deployed model.

  • 여러분은 직접 수동으로 차량을 컨트롤 할 수 있으며 자율 모드를 켜 필요한 deployed model을 이용할 수도 있습니다.

  • The autonomous mode runs inference on the vehicle's compute module, aided with images from the camera.

  • 자율 모드는 차량의 compute module에서 inference(추론)을 실행하게 되며 이 과정에서 카메라를 통해 얻은 이미지를 활용하게 됩니다.


The AWS DeepRacer League






The AWS DeepRacer League is an important component of AWS DeepRacer. It is intended to foster communal learning and collaborative exploration through sharing and competitions.


AWS DeepRacer 리그는  AWS DeepRacer의 중요한 구성 요소입니다. 공유 및 경쟁을 통해 공동 학습 및 공동 탐사를 촉진하기위한 것입니다.



Learning with a group of like-minded developers can be rewarding because group members can share insights and learn from each other. Competitions can serve as powerful motivations for participants to inspire each other. AWS DeepRacer then ranks the performance for the users to discover the good, better, and best models of the group.


이 분야에 흥미를 가지고 있는 개발자들과 함께 배운다는 것은 매우 도움이 됩니다. 왜냐하면 서로 서로 자기가 이해한 것과 배운것들을 나눌 수 있기 때문이죠. 이 리그 참가자들은 경쟁을 통해 서로에게 강력한 모티베이션을 받을 수 있습니다. AWS DeepRacer는 참가자들의 퍼포먼스를 보고 그 그룹의 최고 수상자와 대상 우수상등을 평가하게 됩니다.



AWS DeepRacer As an End-to-End Learning Platform





Reinforcement learning, especially deep reinforcement learning, has proven effective in solving a wide array of autonomous decision-making problems. It has applications in financial trading, data center cooling, fleet logistics, and autonomous racing, to name a few.

Reinforcement learning 특히 심층 Reinforcement learning은 광범위한 자율적 의사결정 문제를 해결하는데 아주 효과적임이 입증 되었습니다. 금융 거래, 데이터 센터 냉각(온도 관리) 그리고 자율 주행 경주 분야에 이를 이용한 어플리케이션들이 있습니다.



As someone new to reinforcement learning, you might be intrigued by it's potential to solve real-world problems. You might like to acquire the necessary skills to tackle challenges in your business or application domain. However, reinforcement learning has a steep learning curve due to extensive technological scope and depth the field depends on. Real-world experimentation requires constructing a physical agent (e.g., an autonomous racing car). It also requires that you secure a physical environment (e.g., a driving track or public road), which can be costly, hazardous, and time-consuming. The requirements go beyond merely understanding reinforcement learning.

reinforcement learning에 대해 잘 모르시는 분들이 있다면 여러분은 아마 곧 이 방법론이 실제 세상의 여러가지 문제들을 해결할 수 있는 그 잠재력이 있다는 것에 대해 알게 되고 흥미를 가지게 될 것입니다. 여러분의 사업이나 application domain에 있는 문제들을 해결하는데 필요한 기술들을 얻으실 수 있을 겁니다.  reinforcement learning은 광범위한 기술 범위와 해당 분야의 깊이의 특성으로 인해 가파른 학습 곡선을 갖습니다. 실제 세상에서의 실험은 물리적인 시설이 요구 됩니다. (예: 자율 주행 레이싱 자동차 등). 또한 준비하기에 비싸고, 위험하고 시간 소모적일 수 있는 물리적인 환경도 확보해야 합니다. (예: 운전 트랙, 공공 도로 등) 단순히 reinforcement learning에 대해 이해하는 것 만으로 충족되지 않는 그 이상의 요구되는 조건들이 있다는 것입니다.



To help lower the learning curve, AWS DeepRacer simplifies the process in three ways:

배움의 기복을 줄이기 위해 AWS DeepRacer는 다음과 같은 세가지 방법으로 프로세스를 단순화 합니다.


  • By offering a wizard to guide training and evaluating reinforcement learning models pre-defined environments including states, actions and customizable reward functions.

  • 사전 정의된 상태, 동작 그리고 사용자 정의 가능한 보상기능 등을 포함한 환경이 있는 reinforcement learning models을 가지고 wizard를 통해 훈련과 평가 등을 가이드 하는 기능을 제공합니다.

  • By providing a simulator to emulate interactions between a virtual agent and a virtual environment.

  • 가상 에이전트와 가상 환경 사이의 상호 작용들을 에뮬레이트 하기 위한 시뮬레이터를 제공합니다.

  • By offering an AWS DeepRacer vehicle as a physical agent for evaluation of a trained model in a physical environment. This closely resembles a real-world use case.

  • 실제 물리적인 AWS DeepRacer 자동차를 제공해 실제 물리적 환경에서 훈련된 모델을 평가 할 수 있도록 합니다. 이는 실제 세상에서의 use case와 유사한 상황과 결과를 제공할 겁니다.


At a high level, using AWS DeepRacer to develop reinforcement learning skills and to explore its application goes as follows:


대략적으로 AWS DeepRacer를 사용해서 reinforcement learning 기술을 개발하고 실제 응용프로그램을 개발하고 배우는 과정은 다음과 같습니다.


  1. Create and train a reinforcement learning model using a wizard on the AWS DeepRacer console.

    AWS DeepRacer 콘솔에서 wizard를 사용해 reinforcement learning model을 생성하고 훈련합니다.

  2. Evaluate the trained model on a chosen track to observe how it performs and to determine how to tune the model.

    트랙을 선택해서 훈련된 모델을 평가하여 그 모델이 어떻게 작동하고 어떻게 개선되어야 하는지를 알수 있도록 합니다.

  3. Deploy the trained model to an AWS DeepRacer vehicle. Let the vehicle drive itself on a track that is built according to AWS DeepRacer track specifications for a physical experience.

    해당 훈련된 모델을 AWS DeepRacer 차량에 Deploy 합니다. 그 차량이 해당 트랙에서 스스로 드라이브 하도록 합니다. 이 트랙은 실제 물리적 환경에서의 실험을 위해 AWS DeepRacer에서 지정한 스펙에 맞도록 만들어 진 트랙 입니다.









AWS DeepRacer Basic Concepts and Terminology


AWS DeepRacer builds on the following concepts and uses the following terminology.

AWS DeepRacer

Also referred to as AWS DeepRacer vehicle. One type of AWS DeepRacer vehicle is an AWS DeepRacer car that is a 1:18-scale model car. It has a mounted camera and an on-board compute module. The module can run inference against a deployed reinforcement learning model in order to drive itself along a track. The compute module and the vehicle chassis are powered by dedicated batteries known as the compute battery and the drive battery, respectively.

AWS DeepRacer vehicle이라고도 합니다. 이는 실제 차량의 1/18로 축소된 AWS DeepRacer 차량입니다. 이 차량에는 카메라와 compute module이 장착돼 있습니다. 이 모듈은 이 차량에 deploy된 트랙에서 스스로 드라이브할 수 있도록 미리 훈련된 reinforcement learning model과 작동하여 inference(추론)를 하게 됩니다. compute module과 차량 새새들은 compute battery라고 알려진 전용 배터리와 driver 배터리를 통해 전원이 공급되게 됩니다.


AWS DeepRacer service

An AWS Machine Learning service for learning and exploring reinforcement learning with applications focused on autonomous racing. The AWS DeepRacer service supports the following features:

AWS 머쉰 러닝은 자율 주행에 촛점을 맞춘 어플리케이션으로 reinforcement learning을 배우고 탐구하기 위한 서비스 입니다. AWS DeepRacer service는 다음과 같은 기능을 지원합니다.

  1. Training a reinforcement learning model on the cloud.

    클라우드상에서의 reinforcement learning model 훈련하기

  2. Evaluating the trained model in the AWS DeepRacer console.

    AWS DeepRacer 콘솔에서 훈련된 모델을 평가하기

  3. Download the trained model artifacts to an AWS DeepRacer vehicle.

     AWS DeepRacer 차량에 훈뎐된 모델 artifacts 다운로드하기



Reinforcement learning

A machine learning method that is focused on autonomous decision making by an agent to achieve specified goals through interactions with an environment. In reinforcement learning, learning is achieved through trial and error and training does not require labeled input, but relies on the reward hypothesis. The hypothesis stipulates that all goals can be achieved by maximizing the expected future reward over all action sequences. In reinforcement learning, designing the reward function is critical. The better crafted reward function, the better the agent can decide what actions to take to reach the goal.

For autonomous racing, the agent is a vehicle. The environment includes traveling routes and traffic conditions. The goal is for the vehicle to reach its destination in a timely manner without accidents. Rewards are scores used to encourage safe and speedy travel to the destination. The scores penalize dangerous and wasteful driving.


machine learning 방법론으로 자율적인 의사결정에 촛점을 맞춘 기계학습 방법입니다. 이는 어떤 환경과 상호 작용함을 통해 지정된 목표를 달성하기 위한 에이전트에 의해 수행됩니다.
reinforcement learning에서 learning은 어떠한 input을 필요로하지 않고 reward hypothesis에 의해 시도하고 실패하는 과정을 통해 획득되어 집니다.
hypothesis(가설)은 모든 action sequences를 통해 기대되는 미래의 보상을 극대화 함으로서 목표를 달성할 수 있다고 규정하고 있다. 좀 더 나은 보상 기능 (reward function)과 좀 더 나은 에이전트는 그 목표를 달성하기 위한 액션들을 결정할 수 있다. 자율 주행에서 에이전트는 차량이 된다. 환경은 주행하는 루트(트랙)과 traffic(교통) conditions이 포함된다. 그 차량의 목표는 사고 없이 최단시간에 목적지에 도달하는 것이다. 보상 (Rewards)는 목적지까지 안전하고 빨리 주행하도록 하는 점수 이다. 이 점수는 위험하고 시간낭비적인 주행에 대해서는 페널티를 줍니다.



To encourage learning during the training process, the reinforcement learning agent must be allowed to pursue individual actions that might not result in higher rewards from time to time. This practice is referred to as the exploration and exploitation trade-off. It helps reduce or remove the likelihood that the agent might be misguided into spurious destinations.


훈련 과정에서 해당 학습을 장려하기 위해 reinforcement learning은 수시로 좀 더 높은 보상을 얻을 수 없는 개별적인 액션들에 대해 멈출 수 있도록 하는 기능이 반드시 허용되어야 합니다. 이러한 practice는 탐구와 착취 (exploitation)의 거래라고 합니다. 이 방법은 에이전트가 잘못된 가이드로 인해 잘못된 목적지에 도달할 가능성을 줄이거나 제거하는데 도움이 됩니다.


For a more formal definition, see reinforcement learning on Wikipedia.


Reinforcement learning model

The environment prescribes the states it has, the actions that can be taken by the agent and the rewards that will be received by taking these actions. The strategy with which the agent decides its action is referred to as a policy. Hence the policy takes the environment state as input and outputs the action to take. In deep reinforcement learning, the policy is often represented by a deep neural network, and we refer to this as the reinforcement learning model. It is used to run inference both in simulation and in the AWS DeepRacer model vehicle to power autonomous racing. Each training job generates one model. A model can be generated even if the training job is terminated early. A model is immutable, which means it cannot be modified and overwritten after it's created.

환경은 에이전트가 취할 수있는 조치와 이러한 조치를 취함으로써 수령 할 보상을 규정합니다. 에이전트가 조치를 결정하는 전략을 정책이라고합니다. 따라서 정책은 환경 상태를 입력으로 취하여 취할 조치를 출력합니다. 심층 강화 학습에서는 정책이 심층 신경 네트워크로 대표되는 경우가 많으며 이를 보강 학습 모델이라고합니다. 시뮬레이션 및 AWS DeepRacer 모델 차량에서 추측을 실행하여 자율적 인 경주에 힘을 실어주는 데 사용됩니다. 각 교육 작업은 하나의 모델을 생성합니다. 훈련 작업이 조기에 종료 되더라도 모델을 생성 할 수 있습니다. 모델은 변경 불가능합니다. 즉, 모델을 수정 한 후에는 덮어 쓸 수 없습니다.







Training job

A training job is a workload that trains a reinforcement learning model and outputs the trained model artifacts to run inference on. Each training job produces one and only one model. The AWS DeepRacer console creates a training job for you when you create and train a model. For each job, you can do the following:

교육 작업은 보강 학습 모델을 훈련하고 유추 된 실행을 위해 훈련 된 모델 아티팩트를 출력하는 워크로드입니다. 각 교육 과정은 하나의 모델 만 생성합니다. AWS DeepRacer 콘솔은 모델을 생성하고 훈련 할 때 교육용 작업을 생성합니다. 각 작업에 대해 다음을 수행 할 수 있습니다.

  • View the training progress while the job is running.

  • View the training summary after the job is done.

  • Terminate a training job in progress at any time.

  • 작업이 진행되는 동안 교육 과정을 봅니다.
    작업이 완료된 후 교육 요약을 봅니다.
    진행중인 교육 일을 언제든지 종료합니다.


Evaluation job

An evaluation job is a workload that tests the performance of a model measured by given metrics after the training job is done. With AWS DeepRacer, the standard performance metric is the driving time an agent takes to complete a lap in a track and an additional metric is the percentage of the lap completed. To evaluate a trained model in AWS DeepRacer, you can do the following:


평가 작업은 교육 작업이 완료된 후 주어진 측정 항목으로 측정 된 모델의 성능을 테스트하는 workload입니다. AWS DeepRacer의 표준 성능 메트릭은 에이전트가 트랙에서 랩을 완료하는 데 걸리는 주행 시간이며 추가 메트릭은 완료된 랩의 백분율입니다. AWS DeepRacer에서 숙련 된 모델을 평가하려면 다음을 수행하십시오.



  • Configure and start an evaluation job.

  • View the evaluation progress while the job is running.

  • View the evaluation summary after the job is done.

  • Terminate an evaluation job at any time.

    평가 작업을 구성하고 시작하십시오.
    작업이 실행되는 동안 평가 진행률을 봅니다.
    작업 완료 후 평가 요약을 봅니다.
    언제든지 평가 작업을 종료합니다.


AWS DeepRacer simulator

A virtual environment, set up as a racing track, within which our agent can act, receive rewards, and learn how to race around the track.

레이싱 트랙으로 설정되는 가상 환경. 상담원이 행동하고 보상을받으며 트랙 주위에서 경주하는 방법을 배웁니다.


AWS DeepRacer vehicle

See AWS DeepRacer


AWS DeepRacer car

A type of AWS DeepRacer vehicle that is a 1/18 scale model car.

1/18 의 비율로 축소된 모델 자동차 인 AWS DeepRacer 차량 유형입니다.


Machine-learning frameworks

Refer to the software libraries used for building machine learning algorithms. Supported frameworks for AWS DeepRacer include Tensorflow.

기계 학습 알고리즘을 작성하는 데 사용되는 소프트웨어 라이브러리를 참조하십시오. AWS DeepRacer에 지원되는 프레임 워크에는 Tensorflow가 포함됩니다.


Policy network

A policy network is the neural network that is trained. It takes video images as input and predicts the next step actions for the agent. Depending on the algorithm, it may also evaluate the value of current state.

정책 네트워크는 훈련 된 신경 네트워크입니다. 비디오 이미지를 입력으로 받아 에이전트의 다음 단계 조치를 예측합니다. 알고리즘에 따라 현재 상태 값을 평가할 수도 있습니다.


Optimization algorithm

An optimization algorithm is the algorithm used to train a model. For supervised training, it calls for optimization by minimizing a loss function with a particular strategy to update weights. For reinforcement learning, it implements optimization by maximizing the expected future rewards with a particular reward function.

최적화 알고리즘은 모델을 훈련시키는 데 사용되는 알고리즘입니다. 감독 학습의 경우, 가중치를 업데이트하기위한 특정 전략으로 손실 함수를 최소화하여 최적화를 요구합니다. 강화 학습의 경우 특정 보상 기능으로 예상되는 미래 보상을 최대화하여 최적화를 구현합니다.


Hyperparameters

Hyperparameters are the tunable parameters that can be used to optimize the training performance.

하이퍼 매개 변수는 교육 성능을 최적화하는 데 사용할 수있는 튜너블 매개 변수입니다.


AWS DeepRacer Track

An AWS DeepRacer track is the virtual environment on which a model is trained and on which the trained model can be evaluated.

AWS DeepRacer 트랙은 모델을 학습하고 훈련 된 모델을 평가할 수있는 가상 환경입니다.


Reward function

A reward function is a signaling function that indicates to the agent whether the action performed resulted in:

보상 기능은 수행 된 조치가 다음과 같은 결과를 가져 왔는지 여부를 에이전트에게 표시하는 신호 기능입니다.

  • A good outcome that should be reinforced.

  • A neutral outcome.

  • A bad outcome that should be discouraged.

    좋은 결과가 강화되어야합니다.
    중립적 인 결과.
    나쁜 결과는 벌을 주어야 합니다


The reward function is a critical component of reinforcement learning. It determines the behavior that the agent will learn by incentivizing specific actions over others. The user provides the reward function by using the Python language, and this reward function is used to train the reinforcement learning model by using the optimizing algorithm.

보상 기능은 보강 학습의 중요한 구성 요소입니다. 에이전트가 다른 사람들보다 특정 행동을 장려함으로써 행동을 결정합니다. 사용자는 Python 언어를 사용하여 보상 기능을 제공하며이 보상 기능은 최적화 알고리즘을 사용하여 강화 학습 모델을 학습하는 데 사용됩니다.

Total reward means the sum of all the reward the agent received during an episode.

총 보상은 에피소드 중에 상담원이받은 모든 보상의 합계를 의미합니다.


AWS DeepRacer Episode

Episode is one simulation iteration from the starting state, e.g., the start of the lap, to a termination state, going off-track, or finishing the lap.

에피소드는 시작 상태, 예를 들어 랩의 시작에서 종료 상태, 오프 트랙으로 진행하거나 랩을 완료하는 것과 같은 하나의 시뮬레이션 반복이다.





반응형
이전 1 다음