Closed EmilHvitfeldt closed 1 year ago
ref: #63.
This method is pretty cool, and it doesn't force the user to only deal with numeric data
library(tidyclust) library(modeldata) k_means(num_clusters = 4) |> set_engine("clustMixType") |> fit(~., data = ames) #> tidyclust cluster object #> #> Distance type: standard #> #> Numeric predictors: 34 #> Categorical predictors: 40 #> Lambda: 538850067 #> #> Number of Clusters: 4 #> Cluster sizes: 1041 822 232 835 #> Within cluster error: 5.811523e+12 5.100094e+12 2.366037e+12 4.376855e+12 #> #> Cluster prototypes: #> MS_SubClass MS_Zoning Lot_Frontage #> 1 One_Story_1946_and_Newer_All_Styles Residential_Low_Density 56.02402 #> 2 One_Story_1946_and_Newer_All_Styles Residential_Low_Density 53.33455 #> 3 One_Story_1946_and_Newer_All_Styles Residential_Low_Density 81.27155 #> 4 Two_Story_1946_and_Newer Residential_Low_Density 57.35449 #> Lot_Area Street Alley Lot_Shape Land_Contour Utilities #> 1 9696.003 Pave No_Alley_Access Regular Lvl AllPub #> 2 7997.472 Pave No_Alley_Access Regular Lvl AllPub #> 3 14861.828 Pave No_Alley_Access Slightly_Irregular Lvl AllPub #> 4 11518.570 Pave No_Alley_Access Slightly_Irregular Lvl AllPub #> Lot_Config Land_Slope Neighborhood Condition_1 Condition_2 Bldg_Type #> 1 Inside Gtl North_Ames Norm Norm OneFam #> 2 Inside Gtl Old_Town Norm Norm OneFam #> 3 Inside Gtl Northridge_Heights Norm Norm OneFam #> 4 Inside Gtl College_Creek Norm Norm OneFam #> House_Style Overall_Cond Year_Built Year_Remod_Add Roof_Style Roof_Matl #> 1 One_Story Average 1968.405 1981.281 Gable CompShg #> 2 One_Story Average 1945.224 1968.550 Gable CompShg #> 3 One_Story Average 2000.034 2003.621 Hip CompShg #> 4 Two_Story Average 1992.793 1998.083 Gable CompShg #> Exterior_1st Exterior_2nd Mas_Vnr_Type Mas_Vnr_Area Exter_Cond Foundation #> 1 MetalSd MetalSd None 81.90490 Typical CBlock #> 2 Wd Sdng Wd Sdng None 32.70681 Typical CBlock #> 3 VinylSd VinylSd BrkFace 359.86638 Typical PConc #> 4 VinylSd VinylSd None 120.45150 Typical PConc #> Bsmt_Cond Bsmt_Exposure BsmtFin_Type_1 BsmtFin_SF_1 BsmtFin_Type_2 #> 1 Typical No Unf 3.882805 Unf #> 2 Typical No Unf 4.807786 Unf #> 3 Typical Gd GLQ 3.642241 Unf #> 4 Typical No GLQ 4.073054 Unf #> BsmtFin_SF_2 Bsmt_Unf_SF Total_Bsmt_SF Heating Heating_QC Central_Air #> 1 63.27185 510.0701 1010.8838 GasA Excellent Y #> 2 43.27737 470.4745 761.1472 GasA Typical Y #> 3 40.68534 675.5647 1703.6724 GasA Excellent Y #> 4 41.62635 675.0132 1205.9090 GasA Excellent Y #> Electrical First_Flr_SF Second_Flr_SF Gr_Liv_Area Bsmt_Full_Bath #> 1 SBrkr 1123.1268 250.3929 1377.184 0.4351585 #> 2 SBrkr 920.7153 224.7470 1154.627 0.2603406 #> 3 SBrkr 1749.4741 507.3233 2259.263 0.8189655 #> 4 SBrkr 1276.1952 502.7377 1781.068 0.4862275 #> Bsmt_Half_Bath Full_Bath Half_Bath Bedroom_AbvGr Kitchen_AbvGr TotRms_AbvGrd #> 1 0.09221902 1.449568 0.3563881 2.874159 1.040346 6.150817 #> 2 0.05717762 1.189781 0.1532847 2.684915 1.091241 5.729927 #> 3 0.02155172 2.060345 0.5905172 2.956897 1.000000 8.129310 #> 4 0.03712575 1.946108 0.5724551 2.967665 1.015569 7.040719 #> Functional Fireplaces Garage_Type Garage_Finish Garage_Cars Garage_Area #> 1 Typ 0.5590778 Attchd Unf 1.672430 443.0221 #> 2 Typ 0.2323601 Detchd Unf 1.172749 319.8139 #> 3 Typ 1.1939655 Attchd Fin 2.793103 780.7759 #> 4 Typ 0.8455090 Attchd RFn 2.182036 574.4623 #> Garage_Cond Paved_Drive Wood_Deck_SF Open_Porch_SF Enclosed_Porch #> 1 Typical Paved 85.30548 37.92891 22.932757 #> 2 Typical Paved 46.16423 23.73844 37.332117 #> 3 Typical Paved 186.15517 86.65086 9.099138 #> 4 Typical Paved 125.45509 72.06347 12.877844 #> Three_season_porch Screen_Porch Pool_Area Pool_QC Fence Misc_Feature #> 1 3.4082613 20.084534 2.529299 No_Pool No_Fence None #> 2 0.7177616 7.569343 0.000000 No_Pool No_Fence None #> 3 3.6637931 23.030172 3.995690 No_Pool No_Fence None #> 4 3.1233533 17.261078 3.608383 No_Pool No_Fence None #> Misc_Val Mo_Sold Year_Sold Sale_Type Sale_Condition Sale_Price Longitude #> 1 79.91066 6.139289 2007.777 WD Normal 155827.5 -93.63832 #> 2 34.85888 6.131387 2007.832 WD Normal 109511.9 -93.63427 #> 3 0.00000 6.547414 2007.668 WD Normal 377841.8 -93.65087 #> 4 43.73653 6.302994 2007.800 WD Normal 227350.8 -93.65488 #> Latitude #> 1 42.03415 #> 2 42.02832 #> 3 42.04770 #> 4 42.03729
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
ref: #63.
This method is pretty cool, and it doesn't force the user to only deal with numeric data