|
1 | | -""" |
2 | | - get_EUR_to_USD(region::String) |
3 | | -convert Euro to US dollars |
4 | | -introduced because the clusters generated by the python script are in EUR for GER |
5 | | -""" |
6 | | -function get_EUR_to_USD(region::String) |
7 | | - if region =="GER" |
8 | | - ret = 1.109729 |
9 | | - else |
10 | | - ret =1 |
11 | | - end |
12 | | - return ret |
13 | | -end |
14 | 1 |
|
15 | 2 | """ |
16 | 3 | sort_centers(centers::Array,weights::Array) |
@@ -229,20 +216,21 @@ function calc_medoids(data::Array,assignments::Array) |
229 | 216 | return medoids |
230 | 217 | end |
231 | 218 |
|
232 | | -""" |
233 | | - resize_medoids(data::Array,centers::Array,weights::Array,assignments::Array) |
234 | | -Takes in centers (typically medoids) and normalizes them such that for all clusters the average of the cluster is the same as the average of the respective original data that belongs to that cluster. |
235 | | -In order to use this method of the resize function, add assignments to the function call (e.g. clustids[5,1]). |
236 | | -""" |
237 | | -function resize_medoids(data::Array,centers::Array,weights::Array,assignments::Array) |
238 | | - new_centers = zeros(centers) |
239 | | - for k=1:size(centers)[2] # number of clusters |
240 | | - is_in_k = assignments.==k |
241 | | - n = sum(is_in_k) |
242 | | - new_centers[:,k]=resize_medoids(reshape(data[:,is_in_k],:,n),reshape(centers[:,k] , : ,1),[1.0])# reshape is used for the side case with only one vector, so that resulting vector is 24x1 instead of 24-element |
243 | | - end |
244 | | - return new_centers |
245 | | -end |
| 219 | +#""" |
| 220 | +# Not used in literature. Only uncomment if test added. |
| 221 | +# resize_medoids(data::Array,centers::Array,weights::Array,assignments::Array) |
| 222 | +#Takes in centers (typically medoids) and normalizes them such that for all clusters the average of the cluster is the same as the average of the respective original data that belongs to that cluster. |
| 223 | +#In order to use this method of the resize function, add assignments to the function call (e.g. clustids[5,1]). |
| 224 | +#""" |
| 225 | +#function resize_medoids(data::Array,centers::Array,weights::Array,assignments::Array)# |
| 226 | +# new_centers = zeros(centers) |
| 227 | +# for k=1:size(centers)[2] # number of clusters |
| 228 | +# is_in_k = assignments.==k |
| 229 | +# n = sum(is_in_k) |
| 230 | +# new_centers[:,k]=resize_medoids(reshape(data[:,is_in_k],:,n),reshape(centers[:,k] , : ,1),[1.0])# reshape is used for the side case with only one vector, so that resulting vector is 24x1 instead of 24-element |
| 231 | +# end |
| 232 | +# return new_centers |
| 233 | +#end |
246 | 234 |
|
247 | 235 |
|
248 | 236 | """ |
|
0 commit comments