Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

=+a. What is the level of income in the country?

Answered: 1 week ago

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago