1. Homepage
  2. Programming
  3. Computer Science 320SC - (2023) Programming Assignment 6: Randomized algorithm design and development

Computer Science 320SC - (2023) Programming Assignment 6: Randomized algorithm design and development

Engage in a Conversation
AucklandComputer Science 320SCCOMPSCI320SCCOMPSCI 320Applied AlgorithmicsJavaEmail spam filtering

Computer Science 320SC – (2023) CourseNana.COM

Programming Assignment 6 CourseNana.COM

Due: Oct 29 2023 (11:59pm) CourseNana.COM

Requirements CourseNana.COM

This 6th assignment lets you get familiar with randomized algorithm design and development. It is worth 5% of your total course marks. We would like you to implement a Bloom Filter to simulate a email spam filtering. CourseNana.COM

An excessive number of submissions (over 10) for a particular problem will accrue a 20% penalty per that problem if you eventually solve it. Therefore, please write a bruteforce algorithm and test your randomized algorithm with your own generated inputs at scale before submitting to the automated marker. CourseNana.COM

We only accept Python programs that use built-in packages (i.e. packages that do not require pip install). CourseNana.COM

1 Email spam filtering 1.1 Problem description CourseNana.COM

You are implementing a Bloom filter for email spam filtering for the University of Auckland. Given that you know the set A of n trusted email addresses, If the email comes from one of these trusted addresses, it is not a spam. Otherwise, it will be a spam. Since the server memory is very limited, you can not keep the list of trusted addresses on its memory (if an email address requires 25 bytes on average and you have 1 billion trusted emails, it would take 25 GB to store A in the memory). CourseNana.COM

Due to the limited resource of automarker, instead of using a string, we use a random integer in [0 . . . 231 ] to present an email address. Also, to simpify the task, please use the following code to generate the list of n integers that represent for n email addresses. Note that you have to use random.seed(320) to ensure that you generate the same set of integers as automarker. CourseNana.COM

You would need to write a Python script to implement a Bloom filter given the setting of m = 8n bits and different numbers of hash functions k = {2, 4, 6, 8}. The used hash function is: f (x) = (a · x + b) mod m where a and b are generated using the following code: CourseNana.COM

import random random.seed(320) CourseNana.COM

n = 100
a = [1, 2, 3, 4, 5, 6, 7, 8] b = [8, 7, 6, 5, 4, 3, 2, 1]
CourseNana.COM

for i in range(n):
x = random.randint(0, 2**31)
# Construct several Bloom filters here
CourseNana.COM

CourseNana.COM

# Testing here
for line in sys.stdin:
CourseNana.COM

y = int(line)
# Check y is in the set S here
CourseNana.COM

Note that you must not call x = random.randint(0, 2**31) several times since it will generate dif- ferent sets S. CourseNana.COM

Given k = i, you will use i hash functions, from f1 to fi(x) = (a[i1]·x+b[i1]) mod m. For example, given k = 2, you will use CourseNana.COM

f1(x)=(a[0]·x+b[0]) mod m=(x+8) mod m f2(x)=(a[1]·x+b[1]) mod m=(2x+7) mod m. CourseNana.COM

1.2 Test case description CourseNana.COM

Your test will be a sequence of 2000 integers, each value per line corresponding to the email address, containing non-spam and spam emails. Your output will be 4 integers, each per line, that count the number of detected spam emails for each value of k = {2, 4, 6, 8}. CourseNana.COM

There are 4 test cases. CourseNana.COM

1. Atrialtestcaseofn=100has0mark.
2. A test case of
n = 1, 000 has 2 marks.
3. A test case of
n = 10,000 and has 2 marks. 4. A test case of n = 100,000 and has 1 mark. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Auckland代写,Computer Science 320SC代写,COMPSCI320SC代写,COMPSCI 320代写,Applied Algorithmics代写,Java代写,Email spam filtering代写,Auckland代编,Computer Science 320SC代编,COMPSCI320SC代编,COMPSCI 320代编,Applied Algorithmics代编,Java代编,Email spam filtering代编,Auckland代考,Computer Science 320SC代考,COMPSCI320SC代考,COMPSCI 320代考,Applied Algorithmics代考,Java代考,Email spam filtering代考,Aucklandhelp,Computer Science 320SChelp,COMPSCI320SChelp,COMPSCI 320help,Applied Algorithmicshelp,Javahelp,Email spam filteringhelp,Auckland作业代写,Computer Science 320SC作业代写,COMPSCI320SC作业代写,COMPSCI 320作业代写,Applied Algorithmics作业代写,Java作业代写,Email spam filtering作业代写,Auckland编程代写,Computer Science 320SC编程代写,COMPSCI320SC编程代写,COMPSCI 320编程代写,Applied Algorithmics编程代写,Java编程代写,Email spam filtering编程代写,Aucklandprogramming help,Computer Science 320SCprogramming help,COMPSCI320SCprogramming help,COMPSCI 320programming help,Applied Algorithmicsprogramming help,Javaprogramming help,Email spam filteringprogramming help,Aucklandassignment help,Computer Science 320SCassignment help,COMPSCI320SCassignment help,COMPSCI 320assignment help,Applied Algorithmicsassignment help,Javaassignment help,Email spam filteringassignment help,Aucklandsolution,Computer Science 320SCsolution,COMPSCI320SCsolution,COMPSCI 320solution,Applied Algorithmicssolution,Javasolution,Email spam filteringsolution,