일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 프로그래머스
- 프로그래머스 파이썬
- 편스토랑 우승상품
- Kaggle
- 더현대서울 맛집
- 금융문자분석경진대회
- github
- programmers
- hackerrank
- Real or Not? NLP with Disaster Tweets
- PYTHON
- ChatGPT
- 캐치카페
- Git
- 우분투
- 편스토랑
- Docker
- AI 경진대회
- 파이썬
- 데이콘
- 자연어처리
- dacon
- SW Expert Academy
- 코로나19
- 맥북
- ubuntu
- leetcode
- 백준
- Baekjoon
- gs25
- Today
- Total
목록
반응형
2020/11 (40)
솜씨좋은장씨
Given the head of a linked list, return the list after sorting it in ascending order. Follow up: Can you sort the linked list in O(n logn) time and O(1) memory (i.e. constant space)? Example 1: Input: head = [4,2,1,3] Output: [1,2,3,4] Example 2: Input: head = [-1,5,3,4,0] Output: [-1,0,3,4,5] Example 3: Input: head = [] Output: [] Constraints: The number of nodes in the list is in the range [0,..
Given a string IP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type. A valid IPv4 address is an IP in the form "x1.x2.x3.x4" where 0 4: return "Neither" for c in ip: if c.lower() not in '0123456789abcdef': return "Neither" return "IPv6" if len(IP.split("."))-1 == 3: return checkIPv4(IP) elif len(IP.split(":"))-1 ..
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example 1: Input: 2 Output: [0,1,1] Example 2: Input: 5 Output: [0,1,1,2,1,2] Follow up: It is very easy to come up with a solution with run time O(n*sizeof(integer)). But can you do it in linear time O(n) /possibly in a sin..
Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. Example: Input: n = 12, primes = [2,7,13,19] Output: 32 Explanation: [1,2,4,7,8,13,14,16,19,26,28,32] is the sequence of the first 12 super ugly numbers given primes = [2,7,13,19] of size 4. Note: 1 is a super ugly number for any given p..
Given two version numbers, version1 and version2, compare them. Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revisions are 0-indexed from left to right, with the leftmost revision being revision 0, the next revision being revision 1, and so on. For example 2.5...
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. You may return the answer in any order. Example 1: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Example 2: Input: n = 1, k = 1 Output: [[1]] Constraints: 1
Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,1,2] Output: [[1,1,2], [1,2,1], [2,1,1]] Example 2: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] Constraints: 1
Given the head of a linked list, remove the nth node from the end of the list and return its head. Follow up: Could you do this in one pass? Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] Example 2: Input: head = [1], n = 1 Output: [] Example 3: Input: head = [1,2], n = 1 Output: [1] Constraints: The number of nodes in the list is sz. 1
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 소설 작가 분류 AI 경진대회 16일차! 오늘은 DACON 코드공유 페이지에서 LA오빠님께서 공유해주신 코드에서 StarifiedKFold 를 참고하여 시도해보았습니다. 소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 그리고 전처리 과정에서 아직 남아있던 프랑스어를 조금 더 찾아서 영어로 번역하여 전처리를 진행하였습니다. sorted_keys = sorted(keys_with_length, key=lambda x : -x[1]) sorted_keys = [ key[0] for key in sorted_keys] sorted_k..
Given a positive integer n, you can apply one of the following operations: If n is even, replace n with n / 2. If n is odd, replace n with either n + 1 or n - 1. Return the minimum number of operations needed for n to become 1. Example 1: Input: n = 8 Output: 3 Explanation: 8 -> 4 -> 2 -> 1 Example 2: Input: n = 7 Output: 4 Explanation: 7 -> 8 -> 4 -> 2 -> 1 or 7 -> 6 -> 3 -> 2 -> 1 Example 3: I..
In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as every other number in the array. If it is, return the index of the largest element, otherwise return -1. Example 1: Input: nums = [3, 6, 1, 0] Output: 1 Explanation: 6 is the largest integer, and for every other number in the array x, 6 is more th..
Given two strings A and B of lowercase letters, return true if you can swap two letters in A so the result is equal to B, otherwise, return false. Swapping letters is defined as taking two indices i and j (0-indexed) such that i != j and swapping the characters at A[i] and A[j]. For example, swapping at indices 0 and 2 in "abcd" results in "cbad". Example 1: Input: A = "ab", B = "ba" Output: tru..
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 애플 이벤트를 시청하며 진행했던 13일차! 오늘도 역시 NIPA에서 지원받은 V100 GPU 서버를 활용하여 도전해보았습니다. 13일차는 12일차에서 열심히 전처리 했던 데이터를 바탕으로 시도해보았습니다. 왜냐하면 12일차에서는 결과를 도출하고 다 제출하고 나서야 전처리한 데이터를 활용하지 않았다는 것을 깨달았기 때문입니다. 여러 모델 중에서 가장 validation loss 가 좋아보이는 세개를 골라서 제출해보았습니다. Bi-LSTM, Baseline model, LSTM 모델을 활용해 보았습니다. 예전에 금융 문자 분석 경진대회에서는 LSTM 모델이 성능이 괜찮게 나왔었는데 아직 전처리 ..
Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple lucky integers return the largest of them. If there is no lucky integer return -1. Example 1: Input: arr = [2,2,3,4] Output: 2 Explanation: The only lucky number in the array is 2 because frequency[2] == 2. Example 2: Inpu..
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 11월 애플 이벤트를 기다리면서 진행한 12일차! 이번엔 베이스라인 코드에서 벗어나서! 새로운 전처리방식과 모델을 활용해보기로 했습니다. 그 과정에서 아래의 링크를 참고하였습니다. 위키독스 온라인 책을 제작 공유하는 플랫폼 서비스 wikidocs.net 이번 시도도 NIPA에서 지원해준 수시사용자 지원 V100 GPU 환경에서 실시하였습니다. 올 초 금융문자분석경진대회에서는 Colab을 활용하였어서 런타임에 엄청 고통 받았었는데 덕분에 정말 편하게 대회를 진행하는 것 같습니다. 지원해주셔서 정말 감사드립니다. import pandas as pd import numpy as np import ..
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2]). You are given a target value to search. If found in the array return true, otherwise return false. Example 1: Input: nums = [2,5,6,0,0,1,2], target = 0 Output: true Example 2: Input: nums = [2,5,6,0,0,1,2], target = 3 Output: false Follow up: This i..
Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. Example 1: Input: [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,5,8],[3,6,9]] Example 2: Input: [[1,2,3],[4,5,6]] Output: [[1,4],[2,5],[3,6]] Note: 1
pandas를 활용하여 읽어온 csv 파일에서 특정 column에 대한 중복값을 제거하기 위하여 아래와 같이 먼저 파일을 엑셀에서 읽어온 후 import pandas as pd data = pd.read_excel("./42_nia_pqa_QueryTemplate.xlsx") data_fillna = data.fillna(0.0) data_fillna_dropna = data_fillna[data_fillna['property'] != 0.0] data_fillna_dropna.head() 특정 값 이외의 값만 남기기 위하여 위와 같이 코드를 실행하였으나 --------------------------------------------------------------------------- ValueErr..
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly. Example 1: Input: num1 = "2", num2 = "3" Output: "6" Example 2: Input: num1 = "123", num2 = "456" Output: "56088" Constraints: 1 123으로 바뀌게 됩니다. 그럼 이렇게 바꾼 숫자를 곱하고 s..
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 소설 작가 분류 AI 경진대회 9일차! 9일차는 베이스라인 코드에서 좀 벗어나 다른 방법을 활용해보고자 했습니다. BERT와 같은 pre-trained 모델은 활용할 수 없지만 전처리 과정에서는 사전 학습을 사용해도 된다고 하여 Glove 임베딩을 활용하여 도전해보기로 했습니다. 방법은 아래의 위키독스에서 활용한 방법을 바탕으로 도전해보겠습니다. 위키독스 온라인 책을 제작 공유하는 플랫폼 서비스 wikidocs.net
Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. After doing so, return the array. Example 1: Input: arr = [17,18,5,4,6,1] Output: [18,6,6,6,1,-1] Constraints: 1
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 대회 커버가 바뀌어 뭔가 새로운 대회를 참가하는 것 같은 느낌의 도전 8일차 입니다. 먼저 fasttext로 결과를 도출해보고자 열심히 시도해보았으나 제 시간 내에 validation_loss 값을 0.78 아래로 떨어지는 것을 확인하지 못하여 이번에도 아쉽지만 7일차에서 조금씩만 변형하여 도전해보았습니다. PorterStemmer로 어간추출 후 WordNetLemmatizer로 표제어 추출을 하여 나온 데이터를 바탕으로 시도해보았습니다. train_dataset = pd.read_csv("./train.csv") test_dataset = pd.read_csv("./test_x.csv") ..
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don't appear in arr2 should be placed at the end of arr1 in ascending order. Example 1: Input: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6] Output: [2,2,2,1,4,3,3,9,..
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 7일차! 7! 뭔가 행운이 찾아올 것 같은 기분이 들었던 7일차 도전의 날이었습니다. 오늘도 역시 aihub에서 지원받은 GPU서버 환경에서 진행하였습니다. 오늘은 생각보다 시간이 없어서 원래는 Glove 임베딩을 활용해서 결과를 내보려했지만 잠시 뒤로 미뤄두고 표제어추출도 활용해보고 학습데이터에서 validation 데이터를 비율을 줄여보기도하고 이것저것 여러 하이퍼 파라미터를 변경해보면서 시도해보았습니다. 첫번째 시도해 보았던 것은 앞의 전처리 과정은 6일차와 동일하고 가장 좋았던 모델에서 임베딩 차원만 128 -> 256 으로 변경하여 시도해보았습니다. 여러 시도 중에 가장 valida..
Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time. Return that integer. Example 1: Input: arr = [1,2,2,6,6,6,6,7,10] Output: 6 Constraints: 1
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 소설 작가 분류 AI 경진대회 7일차! 7! 뭔가 기분좋아지는 숫자입니다. 이번 대회에서는 BERT와 같은 사전학습 모델 사용이 불가합니다. 그런데 전처리 과정에서는 사용을 해도 된다고하여 정보의 보고인 Kaggle로 향하여 Glove 임베딩을 활용한 노트북을 찾아 따라해보기로 하였습니다. 모든 개발은 aihub에서 지원 받은 GPU 서버 환경에서 진행하였습니다. 일반 수시 사용자에게도 아낌없이 지원해주셔서 정말 감사합니다. NLP using GloVe Embeddings(99.87% Accuracy) Explore and run machine learning code with Kaggle ..
최근 약 3만개의 한글파일을 첫페이지를 이미지로 500x707크기의 썸네일을 만들어야하는 일이 있었습니다. 30개의 파일이었으면 귀찮더라도 그냥 모든 파일을 하나하나 열어서 첫 페이지를 이미지로 저장하게끔 하였겠지만 3만개의 파일을 하나하나 열어서 하기에는 너무 많은 양이 었습니다. 저는 이를 파이썬으로 코드를 작성하여 한번에! 촤르륵 실행해보기로 하였습니다. 파이썬을 배우고 나서부터는 이런 대량의 파일을 다루는 작업이나 단순 반복 작업, 수많은 파일 속에서 하나의 파일 찾기와 같은 작업을 주로 파이썬을 활용하여 진행하게 되는 것 같습니다. 진행한 환경은 Windows 10 + 한글 2018 + Python3,7 ( pywin32 라이브러리 ) 에서 진행하였습니다. 이 작업을 진행하기 위해서는 무조건! ..
from konlpy.tag import Mecab mecab = Mecab() print(mecab.pos("솜씨좋은장씨의 개발블로그")) 최근 Google Colab에서 mecab에 사용자 사전을 추가하는 방법에 대해서 문의 하시는 분이 많기도 하셨고 저도 mecab에서 사용자 사전을 추가하여 사용해야하는 경우가 생겨 작성해보았습니다. 2023.04.22 - [머신러닝 | 딥러닝/자연어처리] - Google Colab에서 mecab-ko-dic 사용자 사전 추가하기! (2023년 업데이트 버전)
소설 작가 분류 AI 경진대회 출처 : DACON - Data Science Competition dacon.io 소설 작가 분류 AI 경진대회 6일차! 오늘도 퇴근 후 즐거운 DACON 도전의 시간이 다가왔습니다. 오늘은 전처리 방법에서 Stemmer를 LancasterStemmer 에서 Porterstemmer로 바꾸고 임베딩 차원을 16 -> 128로 늘렸습니다. import pandas as pd import re train_dataset = pd.read_csv("./train.csv") test_dataset = pd.read_csv("./test_x.csv") 먼저 데이터를 불러옵니다. from nltk.corpus import stopwords def alpha_num(text): retu..
한글 파일에서 첫 페이지만 bmp로 저장한 다음 bmp 파일을 작은 해상도로 resizing 한 후 jpeg로 저장하는 과정에서 이미지가 깨져서 보이는 현상이 있었습니다. 처음에는 한글 API 가 제대로 동작하지 않아서인가 싶었지만 PIL(Pillow) 라이브러리에서 resize 하는 과정에서 발생하는 문제였습니다. 해결 방법 해결하는 방법은 아주 간단했습니다. img = Image.open("./test.bmp").convert("RGB") new_img = img.resize((500, 707), Image.ANTIALIAS) new_img.save("./test.jpg", format='jpeg', quality=100) resize를 하는 과정에서 Image.ANTIALIAS 라는 인자를 넣어주면..