_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › DBSCAN-R覯

--http://www.sthda.com/english/wiki/wiki.php?id_contents=7940
library("fpc")
# Compute DBSCAN using fpc package
set.seed(123)
db <- fpc::dbscan(df, eps = 0.15, MinPts = 5)
# Plot DBSCAN results
plot(db, df, main = "DBSCAN", frame = FALSE)


library(RODBC)
conn <- odbcConnect("dw", uid = "user1", pwd = "pw")

mydata <- sqlQuery(conn,"select * from test order by x")
head(mydata)

robustz <- function(x) {
  sigma <- IQR(x) / 1.35
  if(sigma == 0) sigma <- sd(x)
  if(sigma == 0) sigma <- 0.00001
  z <- (x - median(x)) / sigma
  return(z)
}
x <- mydata[, c("x", "y")]
df <- mydata[, c("x", "y")]
x$x <- robustz(x$cnt)
x$y <- robustz(x$ccu_avg)

library("fpc")
cl <- fpc::dbscan(x, eps = 0.30, MinPts = 5)
plot(cl, df, main = "DBSCAN", frame = FALSE)
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2020-08-26 13:26:10

螳る所 谿 蟇磯 語 . ()