본문 바로가기

분류 전체보기

(36)
올인원 머신러닝 가장 성능 좋은 알고리즘 뽑아내기 PyCaret import pandas as pdfrom pycaret.classification import * # 분류 문제 기준# 1. 데이터 로드# Wine 데이터셋의 타겟 컬럼명이 'Customer_Segment'라고 가정합니다. # 실제 파일의 컬럼명에 맞게 수정하세요.data = pd.read_csv('Wine.csv')# 2. 환경 설정 (Setup)# normalize: StandardScaler 적용# pca: 차원 축소 적용exp = setup(data=data, target='Customer_Segment', session_id=123, normalize=True, ..
차원 축소 # Principal Component Analysis (PCA)# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Importing the datasetdataset = pd.read_csv('Wine.csv')X = dataset.iloc[:, :-1].valuesy = dataset.iloc[:, -1].values# Splitting the dataset into the Training set and Test setfrom sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test = train_t..
딥러닝 # Artificial Neural Network# Importing the librariesimport numpy as npimport pandas as pdimport tensorflow as tftf.__version__# Part 1 - Data Preprocessing# Importing the datasetdataset = pd.read_csv('Churn_Modelling.csv')X = dataset.iloc[:, 3:-1].valuesy = dataset.iloc[:, -1].valuesprint(X)print(y)# Encoding categorical data# Label Encoding the "Gender" columnfrom sklearn.preprocessing import L..
자연어 처리 # Natural Language Processing# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Importing the datasetdataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3)# Cleaning the textsimport reimport nltknltk.download('stopwords')from nltk.corpus import stopwordsfrom nltk.stem.porter import PorterStemmercorpus = []for i in range(0, 1000)..
강화 학습 # Upper Confidence Bound (UCB)# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Importing the datasetdataset = pd.read_csv('Ads_CTR_Optimisation.csv')# Implementing UCBimport mathN = 10000d = 10ads_selected = []numbers_of_selections = [0] * dsums_of_rewards = [0] * dtotal_reward = 0for n in range(0, N): ad = 0 max_upper_bound = 0 for i in ran..
연관 규칙 학습 # Apriori# Run the following command in the terminal to install the apyori package: pip install apyori# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Data Preprocessingdataset = pd.read_csv('Market_Basket_Optimisation.csv', header = None)transactions = []for i in range(0, 7501): transactions.append([str(dataset.values[i,j]) for j in range(0, 20)])#..
군집 # K-Means Clustering# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Importing the datasetdataset = pd.read_csv('Mall_Customers.csv')X = dataset.iloc[:, [3, 4]].values# Using the elbow method to find the optimal number of clustersfrom sklearn.cluster import KMeanswcss = []for i in range(1, 11): kmeans = KMeans(n_clusters = i, init = 'k-means++', r..
분류 # Logistic Regression# Importing the librariesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pd# Importing the datasetdataset = pd.read_csv('Social_Network_Ads.csv')X = dataset.iloc[:, :-1].valuesy = dataset.iloc[:, -1].values# Splitting the dataset into the Training set and Test setfrom sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test = train_te..