EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
Python代写
您的位置: 主页 > 编程案例 > Python代写 >
代写Python:Python COMP 2019 Assignment 2 – Machine Learning - Python代写
发布时间:2021-07-25 15:20:05浏览次数:
COMP 2019 Assignment 2 – Machine LearningPlease submit your solution via LEARNONLINE. Submission instructions are given at the end of this assignment.This assessment is due on Sunday, 10 June 2018, 11:55 PM.This assessment is worth 20% of the total marks. This assessment consists of 6 questions.In this assignment you will aim to predict if it will rain on each day given weather observations from the preceding day. You will perform a number of machine learning tasks, including training a classifier, assessing its output, and optimising its performance. You will document your findings in a written report. Write concise explanations; approximately one paragraph per task will be sufficient.Download the data file for this assignment from the course website (file weather.zip). The archive contains the data file in CSV format, and some python code that you may use to visualise a decision tree model.Before starting this assignment, ensure that you have a good understanding of the Python programming language, the Jupyter Python notebook environment, and an overall understanding of machine learning training and evaluation methods using the scikit-learn python library (Practical 3). You will need a working Python 3.x system with the Jupyter Notebook environment and the ‘sklearn’ package installed.Documentation that you may find useful:·Python:https://www.python.org/doc/·Jupyter:https://jupyter-notebook.readthedocs.io/en/stable/·Scikit-learn:http://scikit-learn.org/stable/·Numpy:https://docs.scipy.org/doc/PreparationCreate a Jupyter notebook and load the data. Useimport numpy as npdata = np.loadtxt(‘weather.csv’,skiprows=1,delimiter=’,’,dtype=np.int)toloadthedata.Typethiscodeinto thenotebook. Youwillgetsyntaxerrorsifyoucopyandpastefromthis document. (Students familiar with the Pandas library may use that to load and explore the datainstead.)Familiarise yourself with the data. There are 44 columns and 2716 rows. All values are binary (0/1) where 0 indicates false and 1 indicates true.Categorical variables were encoded using “One Hot” coding, where a separate column is used to indicate the presence or absence of each possible value of the variable. For example, the three binary-valued columns “MinTemp_Low”, “MinTemp_Moderate”,”MinTemp_High” correspond to the three possible values “Low”, “Moderate”, and “High” of variable “MinTemp”. A 1 in column “MinTemp_Low” means that the value of MinTemp was “Low”; the cells for the other two values must be 0 in this case.Explore the distribution of data in each column.The last column contains the prediction target (RainTomorrow). The meaning of the columns is as follows:·MinTemp_{Low,Moderate,High}: 1 if the minimum temperature on the day waslow/moderate/high·MaxTemp_{Low,Moderate,High}: 1 if the maximum temperature on the day waslow/moderate/high·Evaporation_{Low,Moderate,High}: 1 if the measured evaporation on the day waslow/moderate/high·Sunshine_{Low,Moderate,High}: 1 if the aggregated periods of sunshine on the daywas low/moderate/high·WindSpeed9am_{Low,Moderate,High}: 1 if the measured wind speed at 9am on theday was low/moderate/high·WindSpeed3pm_{Low,Moderate,High}: 1 if the measured wind speed at 3pm on theday was low/moderate/high·Humidity9am_{Low,Moderate,High}: 1 if the humidity at 9am on the day waslow/moderate/high·Humidity3pm_{Low,Moderate,High}: 1 if the humidity at 3pm on the day waslow/moderate/high·Pressure9am_{Low,Moderate,High}:1ifthebarometricpressureat 9amonthedaywas low/moderate/high·Pressure3pm_{Low,Moderate,High}:1ifthebarometricpressureat3pmon thedaywas low/moderate/high·Cloud9am_{Low,Moderate,High}: 1 if the cloud cover at 9am on the day waslow/moderate/high·Cloud3pm_{Low,Moderate,High}: 1 if the cloud cover at 3pm on the day waslow/moderate/high·Temp9am_{Low,Moderate,High}: 1 if the temperature at 9am on the day waslow/moderate/high·Temp3pm_{Low,Moderate,High}: 1 if the temperature at 3pm on the day waslow/moderate/high·RainToday: 1 if it rained on theday·RainTomorrow:1ifitrainedonthefollowingday. Thisisthetargetwewishtopredict.Question 1: BaselineA simple model for predicting rain tomorrow is to use today’s weather (RainToday) as an indicator of tomorrow’s weather (RainTomorrow).What performance can we expect from this simple model?Choose an appropriate measure to evaluate the classifier. Select among Accuracy, F1-measure, Precision, and Recall.Use a confusion matrix and/or classification report to support your analysis.Question 2: Naïve BayesTrain a Naïve Bayes classifier to predict RainTomorrow.As all attributes are binary vectors, use the BernoulliNB classifier provided by scikit-learn. Ensure that you follow correct training and evaluation procedures.1.Assess how well the classifier performs on the predictiontask.2.Whatperformancecanweexpectfromthetrainedmodelifweusednextmonth’sdataasinput?Question 3: Decision TreeTrain a DecisionTreeClassifier to predict RainTomorrow. Use argument class_weight=’balanced’ when constructing the classifier, as the target variable RainTomorrow is not equally distributed in the data set.Ensure that you follow correct training and evaluation procedures.1.Assess how well the classifier performs on the predictiontask.2.What performance can we expect from the model on newdata?If you wish to visualise the decision tree you can use function print_dt provided in dtutils.py provided in the Assignment 2 zip archive:import dtutilsdtutils.print_dt(tree, feature_names=flabels)where tree refers to the trained decision tree model, and flabels is a list of features names (columns) in the data.Question 4: DiagnosisDoes the Decision Tree model suffer from overfitting or underfitting? Justify why/why not.If the model exhibits overfitting or underfitting, revise your training procedure to remedy the problem, and re-evaluate the improved model. The DecisionTreeClassifier has a number of parameters that you can consider for tuning the model:·max_depth: maximum depth of thetree·min_samples_leaf: minimum number of samples in each leafnode·max_leaf_nodes: maximum number of leafnodesQuestion 5: RecommendationWhich of the models you trained should be selected for the prediction task? Assume that all errors made are equally severe. That is, predicting rain if there is actually no rain is just as bad as predicting no rain if it actually rains.Does your answer change if predicting rain for a day without rain is a negligible error? Justify why/why not.Question 6: ReportWrite a concise report showing your analysis for Question 1-5.Demonstrate that you have followed appropriate training and evaluation procedures, and justify your conclusions with relevant evidence from the evaluation output.Where there are alternatives (e.g. measures, procedures, models, conclusions), demonstrate that you have considered all relevant alternatives and justify why the selected alternative is appropriate.Do not include the python code in your report.Submission InstructionsSubmit a single zip archive containing the following:·weather.ipynb: the Jupyter Notebookfile.·weather.html: the HTML version of weather.ipynb showing the notebook including all output. CreatethisbyselectingFile Downloadas HTMLafterhavingrunallcellsintheJupyternotebook.·report.pdf: the report as specified in Question6.Marking Scheme

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。