Assignment 1Overview Your task is to write a program that will parse, reformat and summarise results from a decision-making experiment. You will be parsing actual results from an...

1 answer below »
the assigment is to create a new csv file, each row represents one participant and sm descriptive stats. can use previous taught codes only (lab codes examples attached below).


Assignment 1 Overview Your task is to write a program that will parse, reformat and summarise results from a decision- making experiment. You will be parsing actual results from an experiment that investigated the role of skill or perceived skill in the near miss effect. In a nutshell, the experimental question was whether a near miss (i.e. an outcome that comes very close to success) produces excitement and increases motivation even in conditions where the user has no control over the outcome. If you want more information, you can have a look at the attached abstract. You can also try the experiment yourself by visiting goo.gl/4JVvEk (it requires Flash which may not be available on your computer) Below you will find a detailed description of the result files that your program will need to analyse, and the specification for the tasks that your program will need to perform. Each task is independent of the others which means that you can program them in any order. Full marks will be awarded to programs that not only accomplish the tasks, but do so using readable, efficient and easy to maintain code. Critically, your program should work not only with the provided dataset but with any dataset that has the structure described below. For example, your program should not crash or omit results, if files are added or removed. Submit your program in Moodle as a single python (.py) file, named after your candidate number (not your name or your student id), e.g. VXCZ9.py. Note: No marks will be awarded for code that was not discussed in the lectures. Figure 1: Screenshot from the experiment http://goo.gl/4JVvEk Description of experiment result files Figure 2: Example of a results file In the compressed (zipped) file results.zip1 you can find the result files, one per participant. Figure 2 above shows how such a file (csv) looks when opened in Excel (the file “File Structure.pdf” contains the same figure in higher definition for your convenience). The experiment took the form of a battleship game. Participants played a variable number of rounds and in each round, they tried to hit a ship by launching a missile. After each attempt, participants were asked to report how happy they were with the outcome (fig. 2, label 7) and how willing they were to continue playing (fig. 2, label 8). There were 3 different conditions (skill, mixed, luck) varied between participants that differed in the skill required (fig. 2, label 1). Condition “luck” was essentially a game of chance, in “skill” the participant was in control of the outcome and condition “mixed” was somewhere in between. In each round the possible outcomes were hit, nearMiss, and fullMiss (fig. 2, label 6). The experiment also recorded the participant’s name, age and gender (fig. 2, label 4). Note, that due to a programming error, the letter casing for the gender varies (i.e. can be “Male”, “MALE”, “MaLe” etc). Finally, the IP address (fig. 2, label 3) and the date of participation were recorded. The date is recorded as day, month, year, hour, minute and second without spaces. For example, if the date was 30/1/2019 and the time was 11:05:01, the date will have been recorded as 30012019110501. Note that the experiment included an optional open-ended question at the end asking participants for feedback. A small number of participants did provide such feedback which should be ignored. 1 The files are compressed for convenience only. You are not expected to work directly with the zip files. Rather, you should unzip them manually in a folder that should be placed next to your python file. If you don’t know how to unzip / decompress files, have a look here: https://www.wikihow.com/Unzip-a-File https://www.wikihow.com/Unzip-a-File Specification 1. Create a comma separated (csv) file suitable for import into R/SPSS/Minitab. Each row should represent one participant and contain 17 columns with the following: a. Condition (1 column) (10) b. Name, Age, Gender (3 columns) (10) o For the gender, you should write 1 for male and 2 for female instead of the strings Male/Female. c. Proportion of Hits, Near misses, and Full Misses over the total number of trials (3 columns) (5) d. Mean happiness (fig 2, point 7), mean willingness to continue (fig 2, point 8), per outcome type (6 columns) (5) e. The maximum and the minimum reported happiness levels (irrespective of outcome) and the trial in which they occurred (if multiple trials share the min/max value for some participant, report the first of those trials). Note: Extra points will be awarded for NOT using built-in functions here. (4 columns) (10) 2. Sometimes an individual took part more than once. However, the unique identifier of each participant’s computer (known as IP address) has been recorded in the results file. Your program should ignore (i.e. not add in the csv) participants whose IP address has already been found, i.e. record their first but not their second participation. (10) 3. Create another csv file summarising the results per day (duplicates may be included or excluded here). The file should consist of the following 6 columns: • Date, formatted as dd-mm-yyyy (eg 11-06-2013) • Total number of participants on that date • Number of participants in the skill, luck and mixed condition for that date (3 columns) • Average number of trials for that date (rounded to 2 decimal places) (20) Note: The numbers in brackets next to each part, correspond to the maximum marks that will be awarded. Notice, however, that they sum up to 70. Another 30 marks will be awarded based on the readability, efficiency and robustness of your code. Good Luck! Lecture 4 Working with text Lecture 5 www.menti.com 5777 4366 1 Assignment 1 Now on Moodle. Deadline: 15/11/2021 13:00pm, grace period until 23:59pm UK time Submit a python file (as in weekly assignments) - name it after your candidate number!!! e.g. VXCZ9.py Two important rules: No code that was not discussed in class No discussion related to the assignment in the forum 2 Assignment 1 - Notes Everything we expect of you was discussed in lectures. The maximum marks you can get for each section is shown in the specification BUT: they sum up to 70 (not 100) to go over 70, you’ll need to write good code, i.e. flexible, readable, efficient, maintainable… discussed repeatedly throughout the lectures but you may object that our discussion was somewhat vague that is the nature of programming - unlike popular opinion, good quality code is a bit of an art. Think about your essays: besides appropriate content, you are expected to write a coherent, well-structured essay. But can we define in detail what coherence means? It’s partly common sense, partly experience. So: You can get a mark close to 70 even if you write bad (though not horrible) code It’s near impossible to get 100 (twice in the last 8 years) 3 Assignment 1 - Tips Plan your solution before you start writing code. The problem is usually thinking through the steps, i.e. coming up with the algorithm Start by thinking and planning carefully Leave programming aside for a moment and ask yourself: how you’d achieve the task if the input was given to you in a piece of paper. how you’d describe the task to a child or an alien, in as small and specific steps as possible write down your response (in a piece of paper) Then implement each step, incrementally: write a few lines test debug (more later) repeat Read the error messages 4 Example Are participants in the control condition faster that those in the experimental condition? inControl = [False, True, True, False] rts = [234,134,270, 310] Forget programming! Explain the procedure in English Imagine you’re given these two lists and are told that the positions correspond to participants. What does ‘faster’ mean? Smaller number How do we find the number for a whole group? We sum, or average. What would the process be? Get two pieces of paper, and label them “control” and “experimental” Look at each item from your input, one at a time If there is False in the 1st list, write down the number from the 2nd list to the “experimental” piece of paper If there is True in the 2nd list, write down the number from the 2nd list to the “control” piece of paper When you reach the end of the list, average the numbers in the two pieces of paper and compare them. 5 Assignment 1 - Tips Implement incrementally, in small chunks: write a few lines of code test debug repeat 6 Finding errors What you’ll be doing for the vast majority of your time Yes, it is frustrating How to do it? DO NOT try out things randomly Read the error message! Print variables to check their values and types (remember to remove these print statements after you’re done debugging and definitely before submitting) Use the debugger (next) 7 Find the error Step 1: Don’t write big chunks of code (but assuming you did…) Step 2: Read the error message “Division by zero on line 14” i.e rtsExperimental might be 0 Step 3: Add print statements What is the value of rtsControl? What is the value of rtsExperimental? i.e. We never append to rtsExperimental  inControl[i] is always False (?) Can continue adding print statements but let’s use the debugger…. Traceback (most recent call last): File "C:\Users\c.bechlivanidis\OneDrive - University College London\University\Teaching\Programming\Lab Exercises solutions\test\test2.py", line 14, in avgExperimental = sum(rtsExperimental)/len(rtsExperimental) ZeroDivisionError: division by zero control: 4, experimental: 0 8 Using Debugger Click next to a line number to add a breakpoint: execution will pause when it hits the breakpoint Instead of run click debug The interpreter will interpret the lines up to the breakpoint and pause: the blue background means that the execution is paused at line 6 (line 6 isn’t interpreted yet) Inspect the values/types above and in the Debug console Click to interpret the current line and go to the next Inspect the (new/updated) values Why is i False? What should it be? Click again to go to the next line or to
Answered 5 days AfterNov 05, 2022

Answer To: Assignment 1Overview Your task is to write a program that will parse, reformat and summarise...

Subhanbasha answered on Nov 10 2022
47 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here