Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

Previous problems's code :image text in transcribed

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.0

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

Step: 3

blur-text-image

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

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

Students also viewed these Databases questions

Question

=+such as the dirigenti in Italy?

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago