程序代写代做代考 Excel Keras python android Java Section A [20 marks]

Section A [20 marks]
Question 1 [7 Marks]
Answer the following questions.
a) A col_X is an array with 13 values, as shown in figure 1. Write Python code to convert
variable col_X to the values as shown figure 2.
(3 marks)
Figure 1. Initial values of col_X
Figure 2. Converted values of col_X
b) The following figure 3 shows data related to exhibition venue which exhibited the various pieces of artpiece.
Figure 3. Sample output extracted from exhibition venue¡¯s data
Write python code to display the top 5 venues which exhibited the highest number of artpieces. (4 marks)

Question 2 [13 Marks]
Sales data of a company EverStrong are captured in an Excel spreadsheet. The following two
figures are the formulas used to compute moving average and 6-month weighted moving
average respectively.
Figure 4. Moving Average
Figure 5. 6-month weighted moving average
Refer to the following Python code and output in the following figure, which shows the excel
file with sales data being loaded into a Python dataframe object.

Figure 6. Python code that loads the sales data, and displays the first few rows of sales data
Answer the following questions. Your answer should tailor to the Python code provided in the
above figure.
a) Write Python code to update the dataframe df_moving_avg with 6-month moving average
sales data.
(4 marks)
b) Write Python code to update the dataframe df_weighted_moving_avg with 6-month weighted moving average sales data.
(4 marks)
c) Write Python code to compute the mean squared error for moving average and weighted
moving average using the most recent six months data available.
(5 marks)
~~~~~~~~ End of Section A ~~~~~~~~

Section B [20 marks]
Question 3 [10 Marks]
Using the Pearson Correlation Matrix in Figure 1, select a set of features (i.e. feature selection)
that are best suited for training a prediction model for the target variable ¡®mpg¡¯.
Figure 1: Pearson Correlation Matrix for Auto MPG
Use a threshold value of 0.5 when selecting features that are correlated to the target variable,
and a threshold value of 0.7 to sieve out collinearity between features.
a) Demonstrate how you would carry out Feature Selection based on the provided Pearson
Correlation Matrix (Figure 1). (5 marks)
b) Using the code in Figure 2 as your base, write Python code to perform Feature Selection
and print out the rejected and selected features. Please note that the variable ¡®corr_mat¡¯ is a
Pandas DataFrame and has the same structure as the Pearson Correlation Matrix shown in
Figure 1. (5 marks)
Figure 2: The Pearson Correlation Matrix stored in ¡®corr_mat¡¯

Question 4 [10 Marks]
a) Using the Keras library, write Python code to construct an exact model of the neural
network shown in Figure 3. In other words, your network should take in 4 inputs, have 5
hidden layers and outputs 3 classes.
Note that the model needs to be compiled (i.e. require a model.compile(…)) but not fitted
(i.e. does not require a model.fit(…)).
Please specify the loss function and metrics to use for compiling your model. (8 marks)
Figure 3:Neural Network
b) Your friend, Tom, claims that the neural network in Figure 3 is performing a regression.
Evaluate Tom¡¯s claim. (2 marks)
~~~~~~~~ End of Section B ~~~~~~~~

Section C [30marks]
Question 5 [8 Marks]
You have created a calculator app in Android. The app functions as a normal (Fig 1) or scientific
(Fig 2) calculator depending on the device¡¯s current orientation.
For ease of use, the app has a feature where it remembers the last computation made before it
exits. Hence, whenever the app starts or restarts, the last expression and computed value are
always available on its display.
Fig 1: Vertical Orientation
Fig 2: Horizontal Orientation

For question 5a and 5b, please refer to the Activity Lifecycle diagram in Fig 3. Please note
that coding is not required for both 5a and 5b.
Fig 3: Activity Lifecycle
a) The main screen (Fig 1) is implemented as an Activity. With reference to the Activity
Lifecycle (Fig 3), specify the actions, for each state of the lifecycle, that you took to get
your Android app working properly. (4 marks)
b) To enhance the calculator app, you decided to implement a horizontal orientation mode

(Fig 2) and playing of background music when the app is in the foreground. Detail the changes you had to make for your current app to support the new features. Again,
map all required actions/changes to the various states of the Activity Lifecycle.
(4 marks)
Question 6 [22 Marks]
Your team has been asked to write an Android app that monitors the frequencies of in-coming
SMS messages on an Android device. The app basically counts the number of in- coming SMS
messages within a 15-min interval and displays a Toast message when that in-coming SMS
messages exceed a certain threshold.
You have been assigned to work on a portion of the app. Your task is to capture the frequencies
of in-coming SMS message and display the Toast message with the actual number of SMS
messages received within a 15-min interval.
For development purpose, you are free to hardcode a threshold value. For example, assuming a
threshold value of 30 messages, then if the user has received 32 SMS messages within a 15-
min interval, display ¡°Detected excessive SMS activity: 32 messages¡±. If the SMS activity
within a 15-min interval is below the threshold value, no message is displayed. After each 15-
min interval, your counter is reset to 0.
Please note that your part does not require a user interface (UI).
a) Your technical manager, who is proficient in Android programming, wishes to know the
design for your part – specifically the various Android software components that you would
use and how those components work together to fulfill the requirements. He hinted that a
sketch of your design with explanation work best for him as he is a big-picture person. (8 marks)
b) Your technical manager has approved your design. Write Java code to implement it. You
do not need to import namespaces. However, ensure all required permissions are obtained
and show the details of your manifest file as well. (14 marks) ~~~~~~~~ End of Section C ~~~~~~~~ ~~~~~~~~ End of Paper 5 ~~~~~~~~