Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Previous problems's code : CSc 120: Sequence-set Similarity Expected Behavior Write a Python function seq set_sim(seq set1, seq set2, k) that takes as arguments two
Previous problems's code :
CSc 120: Sequence-set Similarity Expected Behavior Write a Python function seq set_sim(seq set1, seq set2, k) that takes as arguments two sets of strings seq set1 and seq set2 and an integer k, and returns a floating point value between 0 and 1 (inclusive) giving the similarity between the sets of strings seq set1 and seq_ set2. Compute the similarity value as follows Use the Jaccard index to compute the similarity between individual strings. Compute the distance between the sets of strings seq_setl and seq set2 as the maximum similarity between between a string in seq setl and one in seq set:2 You can use the code from the previous short problems as helper functions for this problem You can assume that seq setl and seq set2 are both non-empty and that the strings in these sets all have length at least Examples 1. Call: seq set_sim(set (I'aaaa, 'aabb'), set ('aaab'), 3) Return value: 0.5 2. Call: seq_set_sim(set ('aaabba', 'aabbce'), set (I'aaab', 'abbc', 4) 3. Call: seq set_sim(set (I'aaabba', 'abbc'1), set (l'aaab', 'aabbec'), 2) 4. Call: seq set sim(set (l'ababab', 'acacac'),set ('bababa', 'cacaca1), 3) 5. Call: seq set sim(set(I'abbbbba,beccccb']), set (I 'aaaaab , 'aaaaac']), 3) Return value: 0.3333333333333333 Return value: 0.6 Return value: 1.0 Return value: 0.0 CSc 120: Sequence-set Similarity Expected Behavior Write a Python function seq set_sim(seq set1, seq set2, k) that takes as arguments two sets of strings seq set1 and seq set2 and an integer k, and returns a floating point value between 0 and 1 (inclusive) giving the similarity between the sets of strings seq set1 and seq_ set2. Compute the similarity value as follows Use the Jaccard index to compute the similarity between individual strings. Compute the distance between the sets of strings seq_setl and seq set2 as the maximum similarity between between a string in seq setl and one in seq set:2 You can use the code from the previous short problems as helper functions for this problem You can assume that seq setl and seq set2 are both non-empty and that the strings in these sets all have length at least Examples 1. Call: seq set_sim(set (I'aaaa, 'aabb'), set ('aaab'), 3) Return value: 0.5 2. Call: seq_set_sim(set ('aaabba', 'aabbce'), set (I'aaab', 'abbc', 4) 3. Call: seq set_sim(set (I'aaabba', 'abbc'1), set (l'aaab', 'aabbec'), 2) 4. Call: seq set sim(set (l'ababab', 'acacac'),set ('bababa', 'cacaca1), 3) 5. Call: seq set sim(set(I'abbbbba,beccccb']), set (I 'aaaaab , 'aaaaac']), 3) Return value: 0.3333333333333333 Return value: 0.6 Return value: 1.0 Return value: 0.0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started