代写DTS002TC Essential of Big Data Coursework 1代写Python语言

Module code and Title

DTS002TC Essential of Big Data

School Title

School of AI and Advanced Computing

Assignment Title

Coursework 1

Submission Deadline

5 pm China Time (UTC+8 Beijing) on Sun. 26th May 2024

Final Word Count

NA

If you agree to let the university use your work anonymously for teaching and learning purposes, please type “yes” here.

DTS002TC Essentials of Big Data

Coursework 2

Submission deadline: 5 pm China Time (UTC+8 Beijing) on Sun. 26th May 2024

Percentage in final mark: 50%

Maximum score: 100 marks (100 individual marks)

Learning outcomes assessed:

E: Demonstrate the ability to write code to obtain numerical solutions to mathematical problems

F: Demonstrate the ability to display computational results in tabulated or graphical forms

Late policy: 5% of the total marks available for the assessment shall be deducted from the assessment mark for each working day after the submission date, up to a maximum of five working days.

Risks:

•    Please read the coursework instructions and requirements carefully. Not following these instructions and requirements may result in loss of marks.

•     Plagiarism results in award of ZERO mark.

•    The formal procedure for submitting coursework atXJTLU is strictly followed. Submission link on Learning Mall will be provided in due course. The submission timestamp on Learning Mall will be used to check late submission.

Overview

This coursework consists of part A and B. Part A consists of 3 questions and Part B consists of 4 questions. In this coursework, you are  expected to explore the given Citrus dataset by using Python. The dataset contains the measurements of four key features (leaf length, leaf width, fruit length, and fruit diameter) from four distinct citrus species (grapefruit, lemon, lime and orange). Please make sure you have installed required libraries before you start.

Data Introduction

You need to download the raw data set named “citrus.csv” from LMO. The data set includes 5 columns of numerical and text data that describe the characteristics (leaf length, leaf width, fruit length, and fruit diameter) and species of citrus.

Task 1 Data Processing and Analysis (40 marks)

In big data analysis, we will first need to load a large number of data. This involves importing essential libraries and insert the dataset into a format that Python can understand, called data frame. The resulting data frame can be stored in a variable named “citrus” . Answer the questions below to write your programming environment and perform analysis on the given data by using Python programming. You are required to write/demonstrate clearly and neatly the command/output in the given space.

Question 1. Initialization of Model: It is vital for us to define the library and load the dataset to Python environment at the initialization stage. After load the data, we can get information about the data frame.    (10m)

(a)  Write a command to import the required open source data analysis and manipulation library aspd. (2m)

(b)  Write a command to read the dataset and store the data frame as “citrus” .                                        (2m)

•     Show the first five rows (from index 0 to 4) of the citrus data frame.                                         (2m)

•     Show the last five rows (from index 195 to 199) of the citrus data frame.                                  (2m)

(c)   Show the data frame information, which shall consist of (i) its dimensions (number of entries and data columns), (ii) details (column, non-null count, and data type) of each feature (leaf length, leaf width, fruit length, fruit diameter, and species) in a table form, (iii) data types indicating four columns have “float64”, and a column has object”, (iv) memory usage, and (v) end of the output “None” .                           (2m)

Question 2. Data Processing and Calculations: After successfully load the dataset, it is important to perform process the data and perform preliminary statistical analysis on the dataset.                                                               (14m)

(a)  Write a command to count the occurrences of each species of citrus and store it as “species_count”. Then, show the results of species names (grapefruit, lemon, lime, and orange) with theirrespective counts, including the name and data type.                                                             (4m)

(b)  Write a command to calculate the leaf areas in the data frame (assume the leaf shape is equivalent to circular, and the leaf length and width makeup the diameter of circular). During the computation, use math.pi, and store the area as “leaf_areas”. Then, show the results of values for the leaf areas from first 5 indexes and last 5 indexes, including the length and data type.     (4m)

(c)  Write commands to calculate the average fruit length for each species and store it as “average_fruit_length” .  During the process, data will be re-organized according to species and will be stored as grouped_data”. Then, show the results of species names (grapefruit, lemon, lime, and orange) with their respective average fruit  length, including the name and data type.                                     (6m)

Question 3. Data Visualization: After extract preliminary statistical information about the dataset, we can describe the relationships, and distributions of different data variables to extract the underlying pattern through visualization methods. We will create informative visualizations using two relevant Python's powerful statistical data visualization library and python plotting libraries.                     (16m)

(a)  Write commands to import necessary Python data visualization libraries. Then, count each species in the Citrus dataset with parameters x=“species” and data =“citrus” and display the result in bar chart. (8m)

(b)  We are interested in knowing the distribution of the fruit diameter of the Citrus. Write commands to create the  histogram  of  fruit  diameter  and  display  the  results.  Then,  by  using  the  parameter   x=“species”, y=“fruit_length”, and data=“citrus”, write commands to create the boxplot of fruit length for all species (grapefruit, lemon, lime, and orange) and display the results.                           (8m)

Task 2 Data Classification (60 marks)

More advanced big data analysis can be used to support numerous computer vision tasks in the field of machine learning. For instance, classification is one of the most common computer vision tasks. Answer the questions below to develop your classification model by using Python programming. Data cleaning is not required since the given dataset has a balanced class and no missing value. You are required to write/demonstrate clearly and neatly the command/output in the given space.

Question  1.  Data  Preparation  for  Model  Learning: Conventional  machine  learning  models  thrive  on  well- structured and organized data. To ensure optimal performance, we will need to prepare the data carefully. This involve separating the feature matrix for the classifier from target variables. Converting the labels into numeric so they are in machine-readable form, and splitting the features data and target data into train and test cohort.                   (18m)

(a)  Define  a  features  matrix  (X)  that  contains  the  “leaf_length”,  “leaf_width”,  “fruit_length”,  and  “fruit _diameter” and a target variable (Y) that contains the label of each species in numerical format (grapefruit = 0, lemon = 1, lime = 2, and orange = 3) by using LabelEncoder.                                     (14m)

(b)  Split the data into training and testing sets using a 70:30 ratio. To do so, write commands to split X and Y into training and testing sets with parameters:

test_size represents a 70:30 ratio and random_state of zero shuffling, so the results do not fluctuate and store them as X_train, Y_train, X_test, and Y_test.                                             (4m)

Question 2. Logistic Regression Classifier Building: After prepare our data meticulously, it's time to construct a classification model capable of predicting Citrus species based on their measurements. First, we explore the process of creating and utilizing a logistic regression classifier. We will use ‘liblinear’ as the solver for optimization since the Citrus dataset is small in size.                (10m)

(a)   To start the classification, write commands to import and instantiate the logistic regression classifier, and then train the logistic regression classifier by using training sets.                    (6m)

(b)  Write  command  to predict the species using the feature matrix  (X) of the testing sets. Then, show the prediction results, consisting of a list of 60 integer values that can only be 0, 1, 2 and 3.                 (4m)

Question 3. Model Evaluation and Interpretation: After build-up the classification model, it's crucial to evaluate its performance and understand its strengths and weaknesses. We will use accuracy to measure the performance and confusion matrix to visualize the performance of the logistic regression classifier.                  (12m)

(a)  Write command to calculate the accuracy score of the logistic regression classifier using the testing sets and store it as lr_accuracy” . Then, show the accuracy results in decimal value format.                       (4m)

(b)  Write commands to create a confusion matrix to visualize the classifier's performance on each species by using necessary libraries. The matrix shall compare the actual target values (Y_test) with those predicted (lr_Y_predict) by the classifier. Then, display the confusion matrix with correct results by using parameter annot=True.                      (8m)

Question  4.  Comparison  with  Decision  Trees:  In  the  Machine  Learning  domain,  there  are  diverse  array  of classification algorithms, each with its unique strengths and perspectives. It is common to explore different classifiers in performing the same task. During the exploration, we can compare their performance. Let's introduce a new classifier—decision trees—and see how it fares against logistic regression.                               (20m)

(a)  Write commands to import and instantiate the decision tree classifier. Store it as “dt” .                   (4m)

(b)  Write commands to train the decision tree classifier using the training sets and then predict the species by using testing sets. Store the prediction as “dt_Y_predict” and show the results, which shall consist of a list of 60 integer values that can only be 0, 1, 2 and 3.                                (6m)

(c)  Write commands to calculate the accuracy score of the decision tree classifier using the testing sets and store it as dt_accuracy” . Then, show the accuracy results in decimal value format.                                  (4m)

(d)  Write commands to create a confusion matrix to visualize the decision tree classifier's performance on each species by using “Y_test” and “dt_Y_predict” and store it as “dt_cm” . Then, display the confusion matrix with correct results by using parameter annot=True.                                             (6m)




热门主题

课程名

omp9727 ddes9903 mgt253 fc021 int2067/int5051 bsb151 babs2202 mis2002s phya21 18-213 cege0012 math39512 math38032 mech5125 mdia1002 cisc102 07 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 efim20036 mn-3503 comp9414 math21112 fins5568 comp4337 bcpm000028 info6030 inft6800 bcpm0054 comp(2041|9044) 110.807 bma0092 cs365 math20212 ce335 math2010 ec3450 comm1170 cenv6141 ftec5580 ecmt1010 csci-ua.0480-003 econ12-200 ectb60h3f cs247—assignment ib3960 tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 econ7230 msinm014/msing014/msing014b math2014 math350-real eec180 stat141b econ2101 fit2004 comp643 bu1002 cm2030 mn7182sr ectb60h3s ib2d30 ohss7000 fit3175 econ20120/econ30320 acct7104 compsci 369 math226 127.241 info1110 37007 math137a mgt4701 comm1180 fc300 ectb60h3 llp120 bio99 econ7030 csse2310/csse7231 comm1190 125.330 110.309 csc3100 bu1007 comp 636 qbus3600 compx222 stat437 kit317 hw1 ag942 fit3139 115.213 ipa61006 econ214 envm7512 6010acc fit4005 fins5542 slsp5360m 119729 cs148 hld-4267-r comp4002/gam cava1001 or4023 cosc2758/cosc2938 cse140 fu010055 csci410 finc3017 comp9417 fsc60504 24309 bsys702 mgec61 cive9831m pubh5010 5bus1037 info90004 p6769 bsan3209 plana4310 caes1000 econ0060 ap/adms4540 ast101h5f plan6392 625.609.81 csmai21 fnce6012 misy262 ifb106tc csci910 502it comp603/ense600 4035 csca08 8iar101 bsd131 msci242l csci 4261 elec51020 blaw1002 ec3044 acct40115 csi2108–cryptographic 158225 7014mhr econ60822 ecn302 philo225-24a acst2001 fit9132 comp1117b ad654 comp3221 st332 cs170 econ0033 engr228-digital law-10027u fit5057 ve311 sle210 n1608 msim3101 badp2003 mth002 6012acc 072243a 3809ict amath 483 ifn556 cven4051 2024 comp9024 158.739-2024 comp 3023 ecs122a com63004 bms5021 comp1028
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图