please provide detailed solution.. Exercise 5: Agglomerative Clustering - 15 mar
ID: 3604130 • Letter: P
Question
please provide detailed solution..
Exercise 5: Agglomerative Clustering - 15 marks5
In this exercise, you will apply the agglomerative clustering algorithm cluster the following 10 objects:
A= (1, 2), B = (8, 5), C = (4, 9), D = (2, 4), E = (9, 7), F (5. 9), G = (3, 5), H = (6, 9), I = (4, 4), J = (7, 9)
Develop a 10 x 10 distance matrix using Manhattan distance.
For each of the following cases, show the solution details (Show your steps in a way similar to the example in the tutorial 12 notes) and the corresponding dendrogram.
a. single-link
b. complete-link
Compare the results obtained for the above cases and discuss your comments.
Explanation / Answer
#define _XOPEN_SOURCE 500 #include #include #include #include // constants #define DIM_MIN 3 #define DIM_MAX 9 // board int board[DIM_MAX][DIM_MAX]; // dimensions int d; // prototypes void clear(void); void greet(void); void init(void); void draw(void); bool move(int tile); bool won(void); int main(int argc, string argv[]) { // ensure proper usage if (argc != 2) { printf("Usage: fifteen d "); return 1; } // ensure valid dimensions d = atoi(argv[1]); if (d DIM_MAX) { printf("Board must be between %i x %i and %i x %i, inclusive. ", DIM_MIN, DIM_MIN, DIM_MAX, DIM_MAX); return 2; } // open log FILE *file = fopen("log.txt", "w"); if (file == NULL) { return 3; } // greet user with instructions greet(); // initialize the board init(); // accept moves until game is won while (true) { // clear the screen clear(); // draw the current state of the board draw(); // log the current state of the board (for testing) for (int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.