목록분류 전체보기 (109)
#wannabeeeeeee the best DataScientist

https://www.kaggle.com/c/tabular-playground-series-sep-2021/overview/description Tabular Playground Series - Sep 2021 | Kaggle www.kaggle.com ◎ Setting¶ 1. Calling Basic Libraries¶ In [2]: pip install catboost Requirement already satisfied: catboost in c:\work\envs\datascience\lib\site-packages (0.26.1) Requirement already satisfied: six in c:\work\envs\datascience\lib\site-packages (from catboo..

# 데이터 축소 def reduce_usage(df, verbose=True): numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64'] start_mem = df.memory_usage().sum() / 1024**2 for col in df.columns: col_type = df[col].dtypes if col_type in numerics: c_min = df[col].min() c_max = df[col].max() if str(col_type)[:3] == 'int': if c_min > np.iinfo(np.int8).min and c_max < np.iinfo(np.int8).max: df[col] = df[col]...

https://programmers.co.kr/learn/challenges?tab=all_challenges 코딩테스트 연습 기초부터 차근차근, 직접 코드를 작성해 보세요. programmers.co.kr def solution(N, stages): answer = {} for i in range(1,N+1): try: failrate = len([a for a in stages if a == i])/len([a for a in stages if a >= i]) except: failrate = 0 answer[i] = failrate answer_new = sorted(answer, key=answer.get, reverse=True) return answer_new 오늘만큼은 깔끔하게 코드 작성한 ..

07-1 인공 신경망¶ ☆ 신경망은 기존의 머신러닝 알고리즘으로 다루기 어려웠던 이미지, 음성, 텍스트 분야에서 뛰어난 성능을 발휘하면서 크게 주목을 받고 있으며 딥러닝이라고도 부른다. In [1]: from tensorflow import keras (train_input, train_target), (test_input, test_target) = keras.datasets.fashion_mnist.load_data() In [2]: # 데이터 크기 확인하기 print(train_input.shape, train_target.shape) print(test_input.shape, test_target.shape) (60000, 28, 28) (60000,) (10000, 28, 28) (10000,)..

Google colab에서는 실행되는 !wget은 jupyter notebook에서는 실행이 안된다는 것을 알 수 있다. 위 문제를 해결하기 위해 위 코드를 기준으로... import wget url= 'https://bit.ly/fruits_300_data' wget.download(url) # 위 코드를 실행한다. ▽ ▼ ▽ ▼ ▽ ▼ ▽ ▼ import numpy as np fruits = np.load('fruits_300_data') 이후 np.load를 사용하여 변수 지정 후 데이터를 사용하면 된다!!!!

06-1 군집 알고리즘¶ 비지도 학습 : 타깃이 없을 때 사용하는 머신러닝 알고리즘 In [11]: # 과일 사진 데이터 url= 'https://bit.ly/fruits_300_data' wget.download(url) 100% [..........................................................................] 3000128 / 3000128 Out[11]: 'fruits_300_data' In [1]: import wget import numpy as np import matplotlib.pyplot as plt fruits = np.load('fruits_300.npy') print(fruits.shape) # 첫 번쨰 차원(300)은 샘플의 ..

05-1 결정 트리¶ 로지스틱 회귀로 와인 분류하기¶ In [1]: # 데이터 준비 import pandas as pd wine = pd.read_csv('https://bit.ly/wine_csv_data') wine.head() # class가 0이면 레드 와인, 1이면 화이트 와인 Out[1]: alcohol sugar pH class 0 9.4 1.9 3.51 0.0 1 9.8 2.6 3.20 0.0 2 9.8 2.3 3.26 0.0 3 9.8 1.9 3.16 0.0 4 9.4 1.9 3.51 0.0 In [2]: # 데이터 분류 data = wine[['alcohol', 'sugar', 'pH']].to_numpy() target = wine['class'].to_numpy() from skle..