This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
h<-hclust(d)
plot(h, hang=-.1,labels=iris[["Species"]],cex=.5)
c<-cutree(h,3)
(cm<-table(c, iris$Species))
Error<-100*(1-sum(diag(cm)/sum(cm)))
Error
library(cluster)
plot(silhouette(c,d))
set.seed(1234)
d<-dist(scale(iris[,-5]))
methds<-c('complete','single','average')
avgS<-matrix(NA, ncol = 3, nrow = 5,dimnames = list(2:6,methds))
for(k in 2:6){
for(m in seq_along(methds)){h<-hclust(d, meth=methds[m])
c<-cutree(h,k)
s<-silhouette(c,d)
avgS[k-1,m]=mean(s[,3])
avgS
}
}
avgS
sdf<-seeds_dataset[,-8]
View(sdf)
feature_name<-c('area','perimeter','compactness','length_of_kernel','width_of_kernel','asymetry.coefficient','length.of.kernel.grove')
colnames(sdf)<-feature_name
str(sdf)
sdf<-na.omit(sdf)
summary(sdf)
sdf_scale<-scale(sdf)
summary(sdf_scale)
d<-dist(sdf_scale)
h<-hclust(d)
plot(h)
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.