본문 바로가기

전체 글343

[Vue3] Variable, Data Types, and Displaying it In this posting, we'll learn the data types of Vue and how to display it. Create a Project Let's create a project refer to the previous posting. 2021.06.02 - [Web/JavaScript] - [Vue] Getting Started with Vue3 + TypeScript + TailwindCSS And, make it clean to get started. Data Types and Displaying How to Define Variables That is so easy. export default defineComponent({ name: "App", components: {}.. 2021. 6. 4.
[Vue3] Getting Started with Vue3 + TypeScript + TailwindCSS In this posting, we will learn how to start with Vue3 + TypeScript + TailwindCSS. Prerequisite I will use the Vue CLI, so let's install it first. $ yarn global add @vue/cli Create a Project Once installed, let's create the project. $ vue create If you want to start with the default setting, just choose it. But, I will start with manual configuration for using TypeScript at this time. Select a Ty.. 2021. 6. 2.
[Python] Draw shapes using tkinter tkinter is the standard Python interface to the Tk GUI tookit. In my opinion, I recommend PyQt for GUI application, and tkinter for drawing application. Most of Python3 include the tkinter package. Now, let's learn how to draw shapes using tkinter. Import Module import tkinter as tk Create Empty UI class Application(tk.Frame): def __init__(self, master=None): super().__init__(master) self.canvas.. 2021. 5. 29.
[RL] Overview RL은 ML(Machine Learning)의 한 종류로 agent가 어떤 environment에서 어떤 action을 했을 때, 그것이 올바른 action인지를 나중에 판단하여 reward를 받는 과정을 반복하여 스스로 학습을 하는 방법입니다. 결국, RL은 순차적으로 action을 계속해서 결정해야 하는 문제를 푸는 것이라 할 수 있고, MDP는 이런 문제를 수학적으로 표현한 것입니다. Policy는 모든 state에서 agent가 해야 할 action을 결정합니다. Agent가 RL을 통해 학습해야 할 것은 여러 정책 중 optimal policy입니다. Optimal policy는 각 state에서 단 하나의 action만을 선택합니다. 하지만, 학습 시에는 하나의 action을 선택하기 보다는 .. 2021. 5. 22.
[Python] itertools module accumulate(iterable[, func, *, initial=None]) This function makes an iterator that returns accumulated sums, or accumulated results of other binary functions. The default func is operator.add function. from itertools import accumulate import operator print(list(accumulate([1, 2, 3, 4]))) # [1, 3, 6, 10] print(list(accumulate([1, 2, 3, 4], operator.mul))) # [1, 2, 6, 24] print(list(accumulate([1,.. 2021. 5. 15.
[RL] Reinforcement Learning Problem RL(Reinforcement Learning)에서 Agent는 Policy에 따라 어떤 Environment에서 특정 Action을 합니다. Action에 따라 State가 바뀌고, 바뀐 state에 따라 Reward를 받습니다. 따라서, RL은 가장 좋은 policy를 찾는 것이 목적이고, 가장 좋은 policy는 reward를 최대로 만듭니다. Markov Chain Markov Property Markov Property는 확률 과정의 특수한 형태로서, 메모리를 가지고 있지 않다는 특성이 있습니다. 즉, Markov Property를 가진다면 현재 state는 바로 이전 state에만 영향을 받습니다. 다시 말해, 현재 state를 알면 미래 state를 추론할 수 있고, 미래의 state는 현재.. 2021. 5. 9.
[Python] functools module The functools module is for higher-order functions. @functools.cache(func) Simple lightweight unbounded function cache. Sometimes called memoize. Returns the same as lru_cache(maxsize=None). This function is smaller and faster than lru_cache() with a size limit because it never needs to evict old values. v3.9 or later from functools import cache @cache def factorial(n): return n * factorial(n - .. 2021. 5. 8.
[Python] ChainMap in collections ChainMap class is provided for quickly linking a number of mappings so they can be treated as a single unit. from collections import ChainMap dict1 = {'a': 1, 'b': 2} dict2 = {'b': 3, 'c': 4} cm = ChainMap(dict1, dict2) print(cm) # ChainMap({'a': 1, 'b': 2}, {'b': 3, 'c': 4}) print(list(cm.keys())) # ['b', 'c', 'a'] print(list(cm.values())) # [2, 4, 1] print(list(cm.items())) # [('b', 2), ('c', .. 2021. 5. 2.
[Python] namedtuple in collections namedtuple can give a name to each element of tuple. from collections import namedtuple Point = namedtuple('Name', ['x', 'y']) pt = Point(1, 2) print(pt) # Name(x=1, y=2) print(pt.x, pt.y) # 1 2 Attributes _fields Tuple of strings listing the field names. print(pt._fields) # ('x', 'y') _field_defaults Dictionary mapping field names to default values. Point = namedtuple('Name', ['x', 'y'], defaul.. 2021. 5. 2.