데이터분석/R76 [ADP] PAM 군집 (Partitioning Around K-medoids Clustering) > # 11. PAM 군집 (Partitioning Around K-medoids Clustering) > > > library(cluster) > set.seed(1234) > fit.pam fit.pam$medoids Alcohol Malic Ash Alcalinity Magnesium Phenols Flavanoids Nonflavanoids Proanthocyanins Color Hue Dilution Proline [1,] 13.48 1.81 2.41 20.5 100 2.70 2.98 0.26 1.86 5.1 1.04 3.47 920 [2,] 12.25 1.73 2.12 19.0 80 1.65 2.03 0.37 1.63 3.4 1.00 3.17 510 [3,] 13.40 3.91 2.48 23... 2022. 1. 16. [ADP] K-평균 군집 (K-means Clustering) > # 10. K-평균 군집 (K-means Clustering) > > > # 군집 수에 따른 집단 내 제곱합(within group sum of squares)을 구하고 그래프를 그리는 함수 정의 > wssplot > # 178개 이탈리아 와인에 대한 13가지의 화학적 성분을 측정한 자료이다. > data("wine") > head(wine) Type Alcohol Malic Ash Alcalinity Magnesium Phenols Flavanoids Nonflavanoids Proanthocyanins Color Hue Dilution Proline 1 1 14.23 1.71 2.43 15.6 127 2.80 3.06 0.28 2.29 5.64 1.04 3.92 1065 2 1 13.20 1.78.. 2022. 1. 16. [ADP] 계층적 군집분석 (Hierachical Clustering Analysis) > # 09. 계층적 군집분석 (Hierachical Clustering Analysis) > > > library(flexclust) > > data(nutrient) > summary(nutrient) energy protein fat calcium iron Min. : 45.0 Min. : 7.0 Min. : 1.00 Min. : 5.00 Min. :0.500 1st Qu.:135.0 1st Qu.:16.5 1st Qu.: 5.00 1st Qu.: 9.00 1st Qu.:1.350 Median :180.0 Median :19.0 Median : 9.00 Median : 9.00 Median :2.500 Mean :207.4 Mean :19.0 Mean :13.48 Mean : 43.96 Mean :.. 2022. 1. 16. [ADP] 랜덤 포레스트 (Random Forest) > # 07. 랜덤 포레스트 (Random Forest) > > > # 1. 랜덤 포레스트 분류 > > library(randomForest) > > m m Call: randomForest(formula = Species ~ ., data = iris) Type of random forest: classification Number of trees: 500 No. of variables tried at each split: 2 OOB estimate of error rate: 4% Confusion matrix: setosa versicolor virginica class.error setosa 50 0 0 0.00 versicolor 0 47 3 0.06 virginica 0 3 47 0.06 > #.. 2022. 1. 15. [ADP] 의사결정나무 (Decision Tree) > # 06. 의사결정나무 (Decision Tree) > > > # 2. 분류트리 > > library(MASS) > > data("biopsy") > str(biopsy) 'data.frame': 699 obs. of 11 variables: $ ID : chr "1000025" "1002945" "1015425" "1016277" ... $ V1 : int 5 5 3 6 4 8 1 2 2 4 ... $ V2 : int 1 4 1 8 1 10 1 1 1 2 ... $ V3 : int 1 4 1 8 1 10 1 2 1 1 ... $ V4 : int 1 5 1 1 3 8 1 1 1 1 ... $ V5 : int 2 7 2 3 2 7 2 2 2 2 ... $ V6 : int 1 10 2 4 1 10 10 .. 2022. 1. 15. [ADP] 로지스틱 회귀분석 (Logistic Regression) > # 04. 로지스틱 회귀모델 (Logistic Regression) > > > # 4. 로지스틱 회귀분석 사례 > > library(MASS) > > data("biopsy") > str(biopsy) 'data.frame': 699 obs. of 11 variables: $ ID : chr "1000025" "1002945" "1015425" "1016277" ... $ V1 : int 5 5 3 6 4 8 1 2 2 4 ... $ V2 : int 1 4 1 8 1 10 1 1 1 2 ... $ V3 : int 1 4 1 8 1 10 1 2 1 1 ... $ V4 : int 1 5 1 1 3 8 1 1 1 1 ... $ V5 : int 2 7 2 3 2 7 2 2 2 2 ... $ V6 : int .. 2022. 1. 15. 이전 1 ··· 9 10 11 12 13 다음