Engineering > QUESTIONS & ANSWERS > ISYE6501 Week 2 HW Latest 2022 (All)
ISYE6501 Week 2 HW Question 4.1 At my job we use clustering in an image system to understand the minerals that are coming into our processing facility. Comparing the images to known mineral images, ... the system can quantify the mineral content and monitor the colors of the minerals to compare to centroids of the clusters. Question 4.2 library(kernlab) library(ggplot2) ## Warning: package 'ggplot2' was built under R version 3.6.3 ## ## Attaching package: 'ggplot2' ## The following object is masked from 'package:kernlab': ## ## alpha library(kknn) ## Warning: package 'kknn' was built under R version 3.6.3 data<-read.table("C:\\Users\\Colin Shumaker\\Desktop\\ISYE6501\\Week 2\\data 4.2\\iri s.txt", header = TRUE) data1 <-data[,1:4] head(data1) ## Sepal.Length Sepal.Width Petal.Length Petal.Width ## 1 5.1 3.5 1.4 0.2 ## 2 4.9 3.0 1.4 0.2 ## 3 4.7 3.2 1.3 0.2 ## 4 4.6 3.1 1.5 0.2 ## 5 5.0 3.6 1.4 0.2 ## 6 5.4 3.9 1.7 0.4 species <-data[,5] kvalues <- rep(0,10) kx <- 1:10 set.seed(1000) for (r in 1:10){ ktest <- kmeans(data1,r,nstart=5,iter.max = 10) kx[r]<-r kvalues[r]<-ktest$tot.withins } plot(kx,kvalues,type="b",xlab="Number of Clusters", ylab="Total Distance") set.seed(4) k <- kmeans(data1,3) cat("Predictors 1,2,3,4","\n") ## Predictors 1,2,3,4 table(k$cluster,species) ## species ## setosa versicolor virginica ## 1 0 48 14 ## 2 0 2 36 ## 3 50 0 0 set.seed(5) k1 <- kmeans(data1[,1:3],3) cat("Predictors 1,2,3","\n") ## Predictors 1,2,3 table(k1$cluster,species) ## species ## setosa versicolor virginica ## 1 0 45 13 ## 2 50 0 0 ## 3 0 5 37 set.seed(6) k2 <- kmeans(data1[,2:4],3) cat("Predictors 2,3,4","\n") ## Predictors 2,3,4 table(k2$cluster,species) ## species ## setosa versicolor virginica [Show More]
Last updated: 1 year ago
Preview 1 out of 10 pages
Connected school, study & course
About the document
Uploaded On
May 20, 2022
Number of pages
10
Written in
This document has been written for:
Uploaded
May 20, 2022
Downloads
0
Views
75
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·