분류 전체보기
-
[cs231n_review#Lecture 2-3] Setting HyperparametersMachine Learning/cs231n 2023. 6. 14. 17:36
idea #1 if we use this strategy we'll always pick K=1, in practice it seems that setting K equals to larger values might cause us to misclassify some of the training data, but, in fact, lead to better performance on points that were not in the training data. we don't care about fitting the training data, we really care about how our classifier, or how our method, will perform on unseen data afte..
-
[이코테 # 다이나믹 프로그래밍1] 설명 및 메모이제이션Programming 기초/Coding Test 2023. 6. 13. 23:16
* 다이나믹 프로그래밍기법 동적계획법이라고도 하며, 메모리 공간을 약간 더 사용하여 연산 속도를 비약적으로 증가시키는 방법이다. 다이나믹 프로그래밍이란 큰 문제를 작게 나누고, 같은 문제라면 한 번씩만 풀어 문제를 효율적으로 해결하는 알고리즘 기법이다. 다이나믹 프로그래밍과 분할 정복의 차이점은 다이나믹 프로그래밍은 문제들이 서로 영향을 미치고 있다는 점이다. 아래 두 조건을 만족할 때 다이나믹 프로그래밍을 사용할 수 있다. 재귀 함수를 사용하면 컴퓨터 시스템에서는 함수를 다시 호출했을 때 메모리 상에 적재되는 일련의 과정을 따라야 하므로 오버헤드가 발생할 수 있다. 따라서 재귀 함수 대신에 반복문을 사용하여 오버헤드를 줄일 수 있다. 일반적으로 반복문을 이용한 다이나믹 프로그래밍이 더 성능이 좋다. 1..
-
[cs231n_review#Lecture 2-2] Nearest Neighbor classifierMachine Learning/cs231n 2023. 6. 13. 11:30
you might imagine working on this dataset called CIFAR-10, which is very commonly used in machine learning, as kind of a small test case. the CIFAR-10 dataset gives you 10 different classes, and for each of those 10 categories it provides 50,000 training images, roughly evenly distributed across these 10 categories. And then 10,000 additional testing images that you're supposed to test your algo..
-
[이코테 # 탐색1] 이진 탐색/이진 탐색 트리 알고리즘, 부품찾기(이진탐색), 떡볶이 떡 만들기(이진탐색)카테고리 없음 2023. 6. 12. 17:28
* 이진 탐색 이미 정렬되어 있는 경우에 사용할 수 있는 알고리즘. 한 번 확일할 때마다 확인하는 원소의 개수가 절반씩 줄어들기에 시간 복잡도가 O(logN)이다. 데이터의 개수나 값이 1,000만 단위 이상으로 넘어가면 이진 탐색과 같이 O(logN)을 적용하자. 코딩테스트 단골 문제이니 소스코드 외울 것. # 이진 탐색 소스코드 구현 (재귀 함수) def binary_search(array, target, start, end): if start > end: return None mid = (start + end) // 2 # 찾은 경우 중간점 인덱스 반환 if array[mid] == target: return mid # 중간점의 값보다 찾고자 하는 값이 작은 경우 왼쪽 확인 elif array[mi..
-
[cs231n_review#Lecture 2-1] Image Classification: A core task in Computer VisionMachine Learning/cs231n 2023. 6. 11. 17:36
* The Problem: Semantic Gap And the computer really is representing the image as this gigantic grid of numbers. So, the image might be something like 800 by 600 pixels. And each pixel is represented by three numbers, giving the red, green, and blue values for that pixel. So, to the computer, this is just a gigantic grid of numbers. out of this, like, giant array of thousands, or whatever, very m..
-
[Python Tip#1] input()보다 sys.stdin.readline()의 처리속도가 더 빠르다.Programming 기초/Coding Test 2023. 6. 11. 02:02
*버퍼(buffer) 표준 입출력 함수를 사용할 때, 버퍼(buffer)라는 임시 메모리 공간을 사용한다. 이전 포스팅 참고(https://operationcoding.tistory.com/34) * input() input()은 한 줄을 입력 받고 문자열로 변환한다. 입력 마지막의 줄바꿈(\n)은 포함하지 않는다. 한 글자 누를 때마다 바로바로 데이터가 버퍼에 보관된다. 개행문자(\n)가 입력되면 버퍼의 입력이 종료된 것으로 간주. input() 호출 시 프롬프트 문자열을 화면에 출력해 사용자의 입력을 기다림. 대량의 입력을 받는 경우 받고 다시 프롬프트 창을 띄우고의 과정을 반복하므로 오류 발생 가능성이 증가한다. 더 이상 받을 입력이 없을 때 수행될 경우 EOF(End of File) error를 ..
-
[이코테 # 정렬2] 기본 정렬 라이브러리를 활용한 문제들Programming 기초/Coding Test 2023. 6. 9. 23:10
* 위에서 아래로(p.178) 제한시간 : 15분 입력할 수의 개수 n(1≤ n≤ 500)을 입력받고, 정렬대상의 1이상 100,000이하의 자연수의 수를 입력받는다. # sort()함수를 사용한 풀이 n = int(input()) m = [] for i in range(n): m.append(int(input())) m.sort(reverse=True) for i in range(len(m)): print(m[i], end=" ") # 정렬을 직접 구현한 버전 n = int(input()) m = [] for i in range(n): m.append(int(input())) for i in range(n): max_index = i for j in range(i + 1, n): if m[max_ind..
-
[이코테 # 정렬1] 정렬 소스코드, 선택/삽입/퀵/계수 정렬, sorted()와 sort()의 차이Programming 기초/Coding Test 2023. 6. 9. 02:21
* 선택 정렬 시간복잡도 : O(n^2) 이전 포스팅 선택/삽입 정렬 참고 : https://operationcoding.tistory.com/45 array = [7, 5, 9, 0, 3, 1, 6, 2, 4, 8] for i in range(len(array)): min_index = i # 가장 작은 원소의 인덱스 for j in range(i + 1, len(array)): if array[min_index] > array[j]: min_index = j array[i], array[min_index] = array[min_index], array[i] # 스와프 print(array) * 삽입 정렬 시간 복잡도: 최악의 경우는O(n^2)이지만 보통 어느정도 정렬된 상태에서 삽입 정렬을 쓰기 때문..