讲解:IEEE、Python、Python、DataFramePython|Web

Description Type NameCover sheet Compulsory One PDF (.pdf) file Student_number.pdfYour solution to question 1 Compulsory One Python (.py) file Q1.pyYour solution to question 2 Compulsory One Python (.py) file Q2.pyYour solution to question 3 Compulsory One Python (.py) file Q3.pyFor question 1 and 2 submission follow below instructions:Download the following files from Learning Central:• Q1.py• Q2.pyReplace ‘Student_number’ by your student number, e.g. C1234567890. Make sure to includeyour student number as a comment in all of the Python files!Submission InstructionsYour coursework should be submitted via Learning Central by the above deadline. You haveto upload the following files:• Q3.py• IEEEexample.docx• APAexample.docx• nobelprizes.json• whitelist.txtTest your implementation:For Q1 and Q2, you can execute the function from the command line> python3 Q1.py> python3 Q2.pyYou can change the parameters of the function call in the main part of Q1.py and Q2.py.For Q3, you can use> python3 Q3.py my_paper.docx IEEEwhere my_paper.docx is an example journal paper and IEEE represents the target style.Any deviation from the submission instructions above (including the number and types offiles submitted) will result in a mark of zero for the assessment or question part.Staff reserve the right to invite students to a meeting to discuss coursework submissionsAssignmentAnswer all of the following questions.Question 1 – Random converterImplement a function random_converter(x) that takes a variable x. It then returns the valueof x that has been randomly converted into int, float, bool, string or complex.For instance, for x = 12 (an integer) random_converter(x) can return ’12’ (a string) or 12.0(a float).Further instructions:• x can be any type in int, float, bool, string or complex.• the assignment needs to be truly random, that is, if repeated several times, differentoutcomes should result.• If x cannot be converted (e.g. the string “house” cannot be converted to a number) thefunction should print “cannot be converted” and return none.As a starting point, use Q1.py from Learning Central. Do not rename the file or the function.Question 2.1 - Implement a function report(), which takes as input the json file loaded as a Pythondictionary (which is the default data structure returned by the json.load() method). Thisfunction should return a Pandas DataFrame, where you include the years and categories inwhich a Nobel Prize was awarded and those in which it was not. You are not expected toinfer any missing information, you should only include years and categories for which thereis an explicit entry in the original dataset. The result should be of the following form (madeup values):year category awarded_or_not1963 chemistry True1976 physics FalseFurther instructions:• There is no field called ‘awarded_or_not’ in the dataset, you have to find thisinformation elsewhere. Discuss your solution in the code as comments.• Years should be represented as integers, categories as strings and awarded_or_notvalues should be boolean.• Column names should be ‘year’, ‘category’ and ‘awarded_or_not’.Question 2.2 - Write a function get_laureates_and_motivation() which takes as input threearguments: the nobel prize dictionary (same as in Q2.1), year (a string) and category (astring). This function returns a Pandas DataFrame containing one row per laureate (i.e., aperson who has won the Nobel prize). The returned DataFrame should be of the form below(made up values):category year id laureate motivation overall_motivationchemistry 1963 501 john doe he was great he was amonggreat mindschemistry 1963 700 susan sarandon she was great NaNFurther instructions:• The id values refer to the laureate id as per their identifier in the original dataset.• Overall motivations are reasons for awarding Nobel prizes which apply to more thanone person in the same batch. However, not all laureates have an overall motivationassociated. In those cases, you should insert a NaN value in their ‘overall_motivation’field.• Categories, laureates and motivation should be strings, years and ids should beintegers, and overall_motivation should be either string or NaN.Question 2 – Nobel Prize Data MiningYou are provided with a dataset in json format (nobelprizes.json), which contains informationabout Nobel prize winners. Specifically, you will find information about a winner’s name,category, reason for award, year, etc. To load the dataset, you will need to use the jsonmodule (import json), and the d = json.load(file_object) method.• Use the column names shown in the sample table above, do not change them.Question 2.3 - Write a function plot_freqs() which generates six plots, one for each category. The xaxisshould contain the 1st, 10th, 20th, 30th, 40th and 50th most frequent word across themotivation sections for each category. The y-axis should refer to the frequency of each wordin that category. The resulting plot should have a similar arrangement as the one below.Further instructions.• You should only count the words provided in whitelist.txt, a text file available inlearning central, with one word per line. Do not count others.• Your figures should have a title, legend, the frequency of each word, tick marks, labelsin the x axis for each word, be readable (e.g., big enough fonts), etc.As a starting point, use Q2.py from Learning Central. Do not rename the file or the functions.Question 3 – Citation Style ManagerIn scientific publications, a reference to a previous work (source) that is discussed in themanuscript is called a citation. In different scientific disciplines, and sometimes evendifferent journals, different so-called citation styles are used. The citation style defines how acitation is formatted. We will consider two different citation styles in this question:- APA style: citation style of the American Psychological Association(https://www.mendeley.com/guides/apa-citation-guide), see also Wikipedia page(https://en.wikipedia.org/wiki/APA_style). This style is widely used in Psychologyand Social Sciences.- IEEE: citation style of the Institute for Electrical and Electronics Engineers (IEEE) isused in IEEE journals which cover engineering and related disciplines(https://pitt.libguides.com/citationhelp/ieee). See the Learning Materials/Courseworkfolder on Learning Central for more information on the IEEE style.There are two main aspects to a publication where citation styles apply:1. In-text citations: These are used in the text body whenever one refers to, summarises,paraphrases, or quotes from another source. This is an example from Wikipedia(https://en.wikipedia.org/wiki/APA_style) for a sentence including an in-text citationof a paper by Schmidt and Oh in APA format:In our postfactual era, many members of the public fear that the findings ofscience are not real (Schmidt & Oh, 2016).In IEEE format, references are given as numbers in square brackets. Example:This is compounded by the fact that the field is evolving from work performedby an individual that does data science to a t代写IEEE、代做Python语言、Python编程设计调试eam that does data science [1].2. Reference list: In a scientific publication, the last section is typically the Referencessection, which provides full details on the in-text citations. For instance, the fullreference corresponding to the Schmidt & Oh (2016) in-text citation above would be:Schmidt, F. L., & Oh, I.-S. (2016). The crisis of confidence in researchfindings in psychology: Is lack of replication the real problem? Or is itsomething else? Archives of Scientific Psychology, 4(1), 32–37.https://doi.org/10.1037/arc0000029In an article using IEEE format, every reference in the reference list needs to benumbered:1. J. Saltz, The Need for New Processes Methodologies and Tools to SupportBig Data Teams and Improve Big Data Project Effectiveness, Big DataConference, 2015.Your task: Implement a function change_style(filepath, style), which takes as inputtwo arguments: (1) filepath, which can be either IEEEexample.docx or APAexample.docxand (2) style (a string being either IEEE or APA), and swaps their citation style (i.e.,converts IEEE citations into APA and vice versa). You are not expected to consider casesoutside the two documents provided.Detail instructions:• To ease the task, you will be working with .docx files (working with PDFs or onlinesources would be more difficult). Two example files (IEEEexample.docx andAPAexample.docx) are provided in Learning Central.• Use the python-docx package to read, manipulate, and save doc files. You can installit using e.g. pip install python-docx. Check the webpage (https://pythondocx.readthedocs.io/en/latest/index.html#)or other online sources to familiarizeyourself with the package.• After conversion, save the file by appending ‘_APA_style’ or ‘_IEEE_style’ to thefilename (e.g. ‘myfile_IEEE_style.docx’).• We make the following simplificationso In the reference list, you do not need to change the formatting of individualreferences. Only make sure that there is numbering (for IEEE style) asopposed to no numbering (for APA).o For APA, the reference list should be sorted alphabetically. Example :IEEE After conversion to APA1. X. F. Li, The practice of life-insurance actuary,Tianjin:NanKai University press, 2000.2. S. H. Lu, Information asymmetry and the Strategy of lifeinsurance underwriting, Insurance Studies, no. 9, pp. 39-40, Sep. 2003.3. X. A. Wang, The underwriting of annuity insurance,Insurance Studies, no. 3, pp. 45-46, Mar. 2004.4. J. W. Han, M. Kamber, Data Mining: Concepts andTechniques, San Francisco:Morgan Kaufmann Publishers,2001.J. W. Han, M. Kamber, Data Mining: Concepts andTechniques, San Francisco:Morgan KaufmannPublishers, 2001.X. F. Li, The practice of life-insurance actuary,Tianjin:NanKai University press, 2000.S. H. Lu, Information asymmetry and the Strategy oflife insurance underwriting, Insurance Studies, no. 9,pp. 39-40, Sep. 2003.X. A. Wang, The underwriting of annuity insurance,Insurance Studies, no. 3, pp. 45-46, Mar. 2004.o For IEEE, the reference list should be sorted numerically (smaller to greater),where 1 refers to the first in-text citation in the paper, 2 refers to the nextcitation, and so on. Example:APA After conversion to IEEECialdini, R. B. (2005). Whats the best secret device forengaging student interest? The answer is in the title. J. Soc.Clin. Psychol. 24, 22–29. doi: 10.1521/jscp.24.1.22.59166…Vaughn, L., and Schick, T. (1999). How to Think AboutWeird Things: Critical Thinking for a New Age. MountainView, CA: Mayfield Pub.…Willingham, D. T. (2008). Critical thinking: Why is it sohard to teach? Arts Educ. Policy Rev. 109, 21–32.[1] Willingham, D. T. (2008). Critical thinking: Why isit so hard to teach? Arts Educ. Policy Rev. 109, 21–32.[2] Cialdini, R. B. (2005). Whats the best secret devicefor engaging student interest? The answer is in the title.J. Soc. Clin. Psychol. 24, 22–29. doi:10.1521/jscp.24.1.22.59166[3] Vaughn, L., and Schick, T. (1999). How to ThinkAbout Weird Things: Critical Thinking for a New Age.Mountain View, CA: Mayfield Pub.…o Your program should re-format all in-text citations.• To implement your programme, you should only use basic Python including stringoperations, as well as the docx module. Usage of Numpy, Pandas, the regularexpression module re, or any other modules not used in the first 4 lectures is notpermitted!As a starting point, use Q3.py from Learning Central. Do not rename the file or the function.Learning Outcomes Assessed• Using the Python programming language to complete programming tasks• Familiarity with basic programming concepts and data structures• Reading and writing filesCriteria for assessmentCredit will be awarded against the following criteria; the coursework will allow students todemonstrate their knowledge and practical skills and to apply the principles taught inlectures. The functions you have implemented will be tested against different data sets. Thescore each implemented function receives is judged by its functionality, efficiency, and/orquality. The below tables explain the specific criteria for each question.Criteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q1 Excellent working conditionwith no errorsMostly correct. Minor errorsin outputMajor problem. Errors inoutputMostly wrong or hardlyimplementedCriteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q2 Functionality(70%)fully working application thatdemonstrates an excellentunderstanding of the assignmentproblem using relevant pythonapproach.All required functionality ismet, and the application areworking probably with someminors’ errorsSome of thefunctionalitydeveloped with andincorrect output majorerrors.Faulty application with wrongimplementation and wrongoutputQuality (30%) Figures are elegant and show anexcellent understanding ofvisualisation principles includingtick marks, labels, colouring, andtitles.Figures show a goodunderstanding of visualisationprinciples.Figures show a basicunderstanding ofvisualisationprinciples.Missing figures.Criteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q3 Functionality(70%)fully working application thatdemonstrates an excellentunderstanding of the assignmentproblem using relevant pythonapproach.All required functionality ismet, and the application areworking probably with someminors’ errorsSome of thefunctionalitydeveloped with andincorrect output majorerrors.Faulty application with wrongimplementation and wrongoutputEfficiency(15%)Excellent performance passing alltest casesGood performance missedsome test casesPassed some test caseswith incorrect output.Did not pass any test caseQuality (15%) Excellent documentation with usageof __docstring__ and commentsGood documentation withminor missing of comments.Fair documentation. No comments or documentationat all转自:http://www.6daixie.com/contents/3/4483.html

你可能感兴趣的:(讲解:IEEE、Python、Python、DataFramePython|Web)