본문 바로가기

분류 전체보기

(120)
Perceptron algorithm 개요 Perceptron algorithm에 대해 알아보면서 분류 algorithm이 어떻게 작동하는지 직관을 얻는다. Hypothesis of perceptron algorithm 아래와 같이 training dataset이 구성되어 있다고 가정한다. 즉, data x는 d dimension + 1(intercept term)차원에 살고, label y는 0과 1 둘 중 하나의 값을 가진다. 정리해보면, 이진 분류를 위한 training dataset이라고 할 수 있을 것이다. Perceptron algorithm에서는 아래와 같은 가설을 적용하여 이진 분류를 진행한다. z = $\theta^Tx$가 되고, z는 1 또는 0으로 mapping이 되는 식이다. 만약, $\theta^Tx$이 음수의 값을 ..
백준 2164 풀이 뭔가 시키는 대로 하면 틀릴 거 같아서, 손으로 먼저 풀어보았다. 두 가지 사실을 얻을 수 있었다. 1) 항상 짝수만 고려해도 된다. 2) N이 홀수면 뒤로 넘기기부터, N이 짝수면 버리기부터 하면 된다. 그리고 가능 입력이 N=1이 가능하므로 그것까지 고려해주어야 한다. import sys from collections import deque input = sys.stdin.readline N = int(input().rstrip()) # 짝수만 고려 nums = [i for i in range(N) if i % 2 == 0] q = deque(nums) while len(q) > 1: if N % 2 == 0: q.popleft() q.rotate(-1) else: q.rotate(-1) q.p..
백준 1920 풀이 처음에는 count 함수를 사용해서 코드를 제출하였으나 시간 초과로 문제 풀이에 실패하였다. 빠른 탐색 코드를 원하는 것 같아, 이분 탐색으로 시도하였다. import sys input = sys.stdin.readline N = int(input().rstrip()) N_nums = list(map(int, input().split())) M = int(input().rstrip()) M_nums = list(map(int, input().split())) # 이분 탐색을 위해 오름차순 정렬 N_nums.sort() def bin_search(start, mid, end, goal): # start와 end가 같아도 되는 경우는 존재, 그러나 아래의 경우는 불가 if start > end: ret..
LoRA: Low-Rank Adaptation of large language models * 논문상의 내용을 바탕으로 하고 있으며, 본인이 이해하고 해석한 흐름에 맞게 내용을 조정하였습니다. Abstract Transfer learning과 fine-tuning의 성능, 효율이 돋보이며 particular tasks를 해결하기 위해 pretrained model을 활용하기 시작하였다. 이에 더불어, "Scaling laws for neural language models"와 같은 연구들이 진행되며, 몸집이 큰 pretrained model을 추구하려는 움직임이 시작되었다. 그리하여, 사람들은 몸집이 큰 pretrained model을 사용하여 fine-tuning을 함으로써 뛰어난 성능으로 downstream task를 해결해냈다. 하지만, 여기에는 문제가 존재했다. 이때에는 fine-tun..
Eigenvector, eigenvalue 그리고 diagonal과 eigendecomposition https://kindly-moth-b78.notion.site/Eigenvector-eigenvalue-diagonal-eigendecomposition-38d75ba2f5f54e89931af3c567ac1d97?pvs=4 Eigenvector와 eigenvalue 그리고 diagonal, eigendecomposition Eigenvector와 eigenvalue의 이해 kindly-moth-b78.notion.site
Why rank(A^TA) = rank(A)? References https://math.stackexchange.com/a/349966 Prove $\operatorname{rank}A^TA=\operatorname{rank}A$ for any $A\in M_{m \times n}$ How can I prove $\operatorname{rank}A^TA=\operatorname{rank}A$ for any $A\in M_{m \times n}$? This is an exercise in my textbook associated with orthogonal projections and Gram-Schmidt process, bu... math.stackexchange.com
How does the solution always exists in normal equation? Question. 우리가 normal equation 이용해서 해를 구한다면, 우리는 언제나 Ax = b에서 b를 표현하는 x를 찾을 수 있게 된다. 도대체 어떻게 "해가 없는 상황"은 존재하지 않게 되는 것일까? Proposition. Normal equation을 사용하면, over-determined 상황에서 임의의 행렬 A가 가역행렬이든 아니든 해는 언제나 존재하게 된다. Proof. 가장 먼저, 위의 식 normal equation은 아래와 같은 의미임을 알 수 있다. 즉, 애초에 양쪽의 두 항은 A^T의 column들의 조합으로 이뤄진 공간이라는 것이다. 그러나, 그렇다고 해서 두 항이 언제나 같은 공간을 표현한다고 말할 수는 없다. 그러나, A^TA와 A^T는 아래의 조건을 만족하기에 항상 ..
Four fundamental subspaces of linear algebra Matrix A(m x n) Set builder notation Row space A A set of linear combination Ax, when every vector x is in m-dimension. Column space A A set of linear combination Ax, when every vector x is in n-dimension. Null space A A set of vector x, which makes linear combination Ax to zero vector. * Null space A is perpendicular to Row space A Left null space A A set of vector y, which makes linear combina..
Derivations of a system of orthogonal projection Assume that a formula for b hat(or y hat) using normal equation is already derivated. Method 1. Method 2. t = ||y|| * cos theta t / ||u|| = Indicating how many times the vector u must be multiplied to make the vector y hat. = scalar for making u to y hat
[Improved] Least square solution using orthogonal projection, QR decomposition https://kindly-moth-b78.notion.site/Least-square-solution-using-orthogonal-projection-QR-decomposition-f54ba4a28d2148269b0cb28a09051270?pvs=4 Least square solution using orthogonal projection, QR decomposition (Least square 문제 상황을 b - Ax hat = b - b hat이라는 error vector를 가장 짧게 만들어 주는 x를 찾자는 관점이 아닌, kindly-moth-b78.notion.site