Question: Here is the link to the data set: https://files.catbox.moe/8rj2hu.csv Just copy and paste the link into your browser and it will download the csv dataset
Here is the link to the data set: https://files.catbox.moe/8rj2hu.csv
Just copy and paste the link into your browser and it will download the csv dataset file.
The bottom part is just code to test your function
Thank you

3. E3) Write an Python-function ordinal_variation (a, b) that computes the original agreement of a bag b of ordinal classes associated with the instances of clusters given by a-the original classes are named A, B, C, D, and E in the WWQ dataset. It is defined as follows: Let p be defined as follows: 4(A) = 4, 4(B) = 3, 4(C) = 2, 4(D) = 1, 4(E) = 0, If o is an object in the WWQ dataset, o. class denotes the value of the 13th attribute of o (which takes values A, B, C, D, or E) Let C be a cluster of WWQ objects, then the ordinal agreement in C is defined as follows: Ordinal_variation(C) = (Ec,c'and c+c' | 4(c. class) - 4(c'. class)|/(IC|**2-|CI)) If |C| = 1 then Ordinal_variation (C) = 0 In the above formulas 'I...I' represents the set cardinality function. Moreover, assuming X = {C1, ..., Ck} is a clustering consisting of k clusters C1, ..., Ck Ordinal-variation(X) is the number of instances weighted sum of Ordinal- variation(C1), ..., Ordinal-variation(Ck); that is: Ordinal_variation(X) = Er=1(|Crl/| Ep | / [Cpl) * ordinal_variation(C,) However, we give X in the form of (a, b) where a gives the assignment of objects in O to clusters, and b is class variable associated with each object in O. Again, ignore all instances of cluster 0 from ordinal agreement computations, as those examples represent outliers. #DO NOT EDIT OR DELETE THIS CELL #1ST TEST CASE al = (0, 1, 1, 1, 1, 2, 2, 3) bl = ( 'A' , 'A' , 'A' , 'E' , 'E' , 'D' , 'D' , 'C' ) #2ND TEST CASE a2 = (1, 1, 1, 0, 0 , 2) b2 = ( 'A' , 'A' , 'A' , 'E' , 'E' , 'D', 'D' , 'C" ) #TESTING FUNCTION print( "Test Case 1: ", ordinalVariation(al, bl) ) print( "Test Case 2: ", ordinalVariation(a2, b2) ) Test Case 1: 1.5238095238095237 Test Case 2: 0.3333333333333333
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
