diff --git a/Practical_b.Rmd b/Practical_b.Rmd index 01ff3ebff4efdb56c06b23115a77c1f085726416..14146c5d0b9c64c662543b297a083e808c0c61a8 100644 --- a/Practical_b.Rmd +++ b/Practical_b.Rmd @@ -493,13 +493,13 @@ Think about the starting state of your algorithm and the stopping condition <details><summary>Solution</summary> <p> -We have no prior information about the centroid, we can randomly draw them -We are going to iterate over the two step of the algorithm until the centroids stay the same +We have no prior information about the centroid, we can randomly draw them. +We are going to iterate over the two-step of the algorithm until the centroids stay the same. </p> </details> <div class="pencadre"> -Start by implementing an `kmeans_initiation(x, k)` function for your algorithm, returning $k$ centroids +Start by implementing a `kmeans_initiation(x, k)` function for your algorithm, returning $k$ centroids </div> <details><summary>Solution</summary> @@ -517,7 +517,7 @@ kmeans_initiation <- function(x, k) { </details> <div class="pencadre"> -Implement an `compute_distance(x, centroid)` function for your algorithm, the distance of each point (row of x) to each centroid, based on the squared Euclidian distance +Implement a `compute_distance(x, centroid)` function for your algorithm, the distance of each point (row of x) to each centroid, based on the squared Euclidian distance. </div> <details><summary>Solution</summary> @@ -535,7 +535,7 @@ compute_distance <- function(x, centroid) { </details> <div class="pencadre"> -Implement an `cluster_assignment(distance)` function for your algorithm, returning the assignment of each point (row of x), based on the squared Euclidian distance +Implement a `cluster_assignment(distance)` function for your algorithm, returning the assignment of each point (row of x), based on the squared Euclidian distance. </div> <details><summary>Solution</summary> @@ -554,7 +554,7 @@ cluster_assignment <- function(distance) { <div class="pencadre"> -Implement an `centroid_update(x, cluster, k)` function for your algorithm, returning the updated centroid for your clusters +Implement a `centroid_update(x, cluster, k)` function for your algorithm, returning the updated centroid for your clusters. </div> <details><summary>Solution</summary> @@ -572,7 +572,7 @@ centroid_update <- function(x, cluster, k) { </details> <div class="pencadre"> -Implement an `kmeans_example(x, k)` function for your algorithm, wrapping everything and test it +Implement a `kmeans_example(x, k)` function for your algorithm, wrapping everything and test it. </div> <details><summary>Solution</summary>