写作ENGG1811实验程序、 辅导Python编程设计、 写作Python程序实验

” 写作ENGG1811实验程序、 辅导Python编程设计、 写作Python程序实验ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak DetectionLearning Objectives:1. To apply programming concepts of variable declaration, constant declaration,assignment, selection and iteration (for loop).2. To translate an algorithm Described in a blend of natural language and elements ofpseudocode to a computer language.3. To organise programs into smaller modules by using functions.4. To use good program style including comments, meaning variable names and others.5. To get a practice on software development, which includes incremental development,testing and debugging.Aaron Quigley, October, 2020Deliverables: Submit by 17:00 on Wednesday of Week-07.Late Penalty: Late submissions will be penalised at the rate of 10% per day (includingweekends). The penalty applies to the maximum available mark. For example, if yousubmit 2 days late, maximum available marks is 80% of the assignment marks.Submissions will not be accepted after 9am Monday of Week-08. To Submit thisassignment, go to the Submission page and click the link named MakeSubmission.GENERAL RULES1. This assignment is weighted at 20%2. You are reminded that Work submitted for assessment must be your own. Its OKto discuss approaches to solutions with other students, and to get general helpfrom tutors or others, but you must write the python code yourself. Increasinglysophisticated software is Used to identify submissions that are unreasonablysimilar, and marks will be reduced or removed in such cases.3. The Student Code of Conduct sets out what the University expects from studentsas members of the UNSW community. As well as the learning, teaching andresearch environment, the University aims to provide an environment that enablesstudents to achieve their full potential and to provide an experience consistentwith the Universitys Values and guiding principles. A condition of enrolment is thatstudents inform themselves of the Universitys rules and policies affecting them, conduct themselves accordingly. (see the course outline page with links).4. You should also read the following page which describes your rights andresponsibilities in the CSE context: Essential Advice for CSE StudentsEssentialThe University views plagiarism very seriously. UNSW and CSE treat plagiarism asacademic misconduct, which means that it carries penalties as severe as beingexcluded from further study at UNSW. [see: UNSW Plagiarism Procedure]Change Log1. Your functions max_peak, total_peaks, peak_list_from_file should importpeak_list in your code for these three functions [Updated Oct 13th].2. If there are no Peaks in the inputs given max_peak should return the stringNo Peaks [Updated Oct 13th]3. The text file format is one number per line (as shown involtage_data_complete.txt in week 3) [Update Oct 13th]4. For the purposes of this assignment we are only looking to identify peaksabove the mean (and we will only test for such conditions) [Oct 13th]ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak DetectionWhat you must submittotal_peaks.pymax_peak.pypeak_list.pypeak_list_from_file.pyThe General Problem: Peak DetectionIn this assignment, your goal is to write a python program to determine variouscharacteristics about some time series data you are given. These types of problems arevery common in many disciplines, including computer science, engineering, medicine andscience. There are many different types of peak detection problems, the setting of thisassignment is similar to that used in pulse oximeter data. The method described below isbased on a sliding window which allows us to calculate a standard score of the number ofstandard deviations aways from the mean a value is.Such peak detection has been used to understand the periodic distributions of nucleotidesfrom the genome of SARS-CoV-2 had been sequenced and structurally annotated orpollution peaks or heart rate detection. Peak detection is a very common task in theunderstanding of data.The Algorithmic ProblemWhat is a Peak and how can we reliably detect them! Lets stepback to some basic stats.For a finite normal population with N members, thepopulation mean is the following (mu):Variance is a measure of dispersion (spread). For afinite normal population with N members, the populationvariance is the following (sigma squared):Standard deviation is a also measure of dispersion(spread). The standard deviation of the population is thesquare root of the variance, it is written as (sigma):Aaron Quigley, October, 2020Oct 7th tip:Please read the entire practical first andthink carefully about the order in whichyou might implement these functions!ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak Detection[Basic Standard Deviation diagram: Source Wikipedia]A low standard deviation indicates that the values tend to be close to the mean (alsocalled the expected value) of the set, while a high standard deviation indicates that thevalues are spread out over a wider range.Observation: 1In statistics, the z-score of standard score says, how many standard deviations is a datapoint above or below the mean value of what is being observed. As such, looking forvalues within our data with high z-scores might be a way to identify peaks in our data.Observation: 2We can determine the mean by looking at all the data. Or we could determine a movingmean value for data within a given window, not for all the data we are observing. We canrefer to this smoothing window or lag as our window.Observation: 3Finally, when we do observe something above a particular z-score we can decide howmuch (if at all) this should influence the moving mean value for the data within this windowor subsequent windows.Description of the peak detection algorithmThe goal is to detect does a particular part of an input signal have peaks and if so where.In the following example, the peak to be detected is a sequence of 20 numbers (see Fig 1)begins at the 9th element in the input list and ends at the 12th element.However, if you look at the input list you can see lots of smaller up and down patterns inthe data which could each be considered peaks. So, what makes 9 – 12 a peak while theothers arent. Firstly, the values 41, 38, 22 and 10 are beyond the average. How farbeyond the average? Well at least 3 standard deviations in this case. The next question is,Aaron Quigley, October, 202068% within 1 standard deviation99.7% within 3 standard deviations95% within 2 Standard deviations689599.7 ruleENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak Detectionwhat average. Well we use an moving mean or sliding window to calculate the averagewithin a window of the last N values (in this case 8).However, you might be wondering, by the time the input value of 10 is considered surelythe average of the last N numbers of the smoothing window (22, 38, 41, 0 etc.)suggests that 10 isnt that far away from the mean. This is where the notion of influencecomes in. When we are considering the input we must filter it so that when we do detect aAaron Quigley, October, 2020Figure 1: Input signal. Plot of input anddetected peaks (based on a given window of 8 and z-score of 3 and aninput peak influence of 0)Figure 2: Input and how we calculate the average and thestandard deviation for the first input value in list s we considerENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak Detectionpeak value, then those input values are treated differently than when we arent seeinginputs from a peak value.Implementation requirementsYou need to implement The following four functions, each in a separate file.Your functions max_peak, total_peaks, peak_list_from_file should import peak_listin your code for these three functions [Updated Oct 13th].You need to submit these four files, each containing one function you implement1. def total_peaks(inputs, smoothing, th, influence): The aim of this function is to calculate the total number of distinct peaks measured inthe inputs given The first parameter inputs is a list of (float) values, and the second parametersmoothing is the size of the window used to determine the meaning average, the thirdparameter is the z-score (or how many standard deviations away from the movingmean does the input need to be for it to be considered a peak) and finally theinfluence says how much should a value which is considered a peak value effect themoving average The function should could the number of distinct peaks in the inputs given (a peakshould be considered as a continuous unbroken series of 1 1 1 values) This function can be tested using the file test_total_peaks.py.Aaron Quigley, October, 2020Figure 3: Formula required to filter input data and to label peaks (yi)ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak Detection2. def max_peak(inputs, smoothing, th, influence): The aim of this function is to determine the maximum value of an input which isconsidered to be a part of a peak measured in the inputs given The parameters are the same as in (1) above If there are no peaks in the inputs given then max_peak should return the stringNo Peaks [Updated Oct 13th] This function can be tested using the file test_max_peak.py.3. def peak_list(inputs, smoothing, th, influence): The two possible outcomes are Insufficient data and list which is the same length asinputs but consistent of 0s and 1s where a 1 represents a peak value, given thesmoothing, th And influence values from the inputs For the purposes of this assignment we are only looking to identify peaks abovethe mean (and we will only test for such conditions) [Updated Oct 13th] The first parameter inputs is a list of (float) values, and the second parametersmoothing is the size of the window used to determine the meaning average, the thirdparameter is the z-score (or how many standard deviations away from the movingmean does the input need to be for it to be considered a peak) and finally theinfluence says how much should a value which is considered a peak value effect themoving average To code this function you should first create a copy of the inputs into a filtered_input list(which can be updated based on the values si (given in figure 3) when you determinean input value is a peak) you also need a list to hold the outputs measured (ie the 0sand 1s) You need to calculate the mean and the standard deviation for the smoothing windowso you can test the zi value (you need to do this each time you move forward in the list) When the test passes you should record a 1 into the output list When the test passes you need to update the filtered input list with the value for si This function can be tested using the file test_peak_list.py4. def peak_list_from_file(smoothing, th, influence,file_name): Here you arent provided a list of values but instead you should read in the inputs froma file This function can be tested using a test file you should write yourself calledtest_peak_list_from_file.py. The text file format is one number per line (as shown involtage_data_complete.txt in week 3) [Update Oct 13th]Aaron Quigley, October, 2020ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak DetectionGetting Started1. Download the zip file ass1_prelim.zip, and unzip it. This will create the directory(folder) Named ass1_prelim.2. Rename/move the directory (folder) you just created named ass1_prelim to ass1.The name is different to avoid possibly overwriting your work if you were todownload the ass1_prelim.zip file again later.3. First browse through all the files provided, and importantly read comments in thefiles.4. Do not try to implement too much at once, just one function at a time and test that itis working before moving on.5. Start implementing the first function, properly test it using the given testing file, andonce you are happy, move on to the the second function, and so on.6. Please do not use print or input statements. We wont be able to assess yourprogram properly if you do. Remember, all the required values are part of theparameters, and your function needs to return the required answer. Do not printyour answers.TestingTest your functions thoroughly before submission. You can use the provided pythonprograms to test your functions.Please note that the tests provided in these files cover only basic scenarios (cases), youneed to think about other possible cases, modify the files accordingly and test yourfunctions. For example, you need to add cases to test for Insufficient data scenarios.SubmissionYou need to submit the following four files. Do not submit any other files. For example, youdo not need to submit your modified test files. total_peaks.py max_peak.py peak_list.py peak_list_from_file.pyTo Submit this assignment, go to the Submission page and click the tab named MakeSubmission.Assessment CriteriaWe will test your program thoroughly and objectively. This assignment will be marked outof 20 where 15 marks are for correctness and 5 marks are for style.CorrectnessThe 15 marks for correctness are awarded according to these criteria.Criteria Nominal marksFunction total_peaks 2Function max_peak 1Function peak_list 9Aaron Quigley, October, 2020ENGG1811 20T3 (revision 1 13th Oct 2020) Assignment 1: Peak DetectionStyleFive (5) marks are awarded by your tutor for style and complexity of your solution. Thestyle assessment includes the following, in no particular order: Use of meaningful variable names where applicable Use of sensible comments to explain what youre doing Use of Docstring for documentation to identify purpose, author, date, data dictionary,parameters, return value(s) and program description at the top of the fileAssignment OriginalityYou are reminded that work submitted for assessment must be your own. Its OK todiscuss approaches to solutions with other students, and to get help from tutors andconsultants, but you must write the python code yourself. Sophisticated software is used toidentify submissions that are unreasonably similar, and marks will be reduced or removedin such cases.Further Information Additional Help Sessions will be available for this assignment during week-05 toweek-07. Use the forum to ask general questions about the assignment, but take specificones to Help Sessions. You can ask Your tutor during your lab time any queries you may have regardingthis assignment. Keep an eye on the class webpage notice board for updates and responses. This assignment has never been posed in ENG1811 previously.Case Insufficient data 1Function peak_list_from_file 2Aaron Quigley, October, 2020 https://www.daixie0.com/contents/3/5283.html

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导