Machine Learning Techniques and Applications|Assignment Help

assignment advertisement

WhatsApp Now(+91-9760648231) for assignments, projects, and homework help in programming. The first assignment is free.

We can help you with any of your assignments or projects or homework related to programming, just contact us.

Machine Learning Techniques and Applications|Assignment Help

2021-22 Semester 2 Take-home Examination

Module Code:                        COM3107

Module Title:                         Machine Learning Techniques and Applications

Release Date & Time:          03 May 2022 11:00

Deadline:                                04 May 2022 at 11:00

Notes to Candidates:

  1. This question paper has13 pages (including this cover sheet).
  2. There are THREE sections in this paper:
Section A
(10 marks):
5 short questions, 2 marks each. Answer ALL questions.
  
Section B
(57 marks):
4 long questions in total. Answer ALL questions. Marks allocated to parts of questions are indicated in brackets. Put your answers in English.
  
Section C
(13 marks):
Answer the open-ended question. Put your answers in English.

3. The examination will be marked out of 80.

4. This is an open-book examination. Candidates may access relevant notes and reference materials.

5. This examination is a personal assessment. DO NOT discuss the content of the examination with others during the examination.

Student Name Programme 
Student ID No. Year of Study 

SECTION A (10 marks)

This section includes 5 short questions of 2 points each. Choose ALL correct statement(s) for each question. There may be more than one correct statement for each question. Write your answer in the space provided in this booklet.

1. Which of the following statement(s) is/are correct?

  1. Linear regression accepts only numerical input variables.
  2. Linear regression predicts only numerical output variables.
  3. Data labels must be given in the test data for linear regression.
  4. Linear regression must require training data with known output variables.
A. Linear regression accepts only numerical input variables.
B. Linear regression predicts only numerical output variables.
D. Linear regression must require training data with known output variables.  

2. Which of the following statement(s) is/are the purpose(s) of test data in supervised learning?

  1. To measure how good the model is for data not seen in training
  2. To facilitate the tuning of model coefficients
  3. To provide inputs and outputs of the model to train the model parameters
  4. To predict the output of the model based on the test inputs
A. To measure how good the model is for data not seen in training        
B.  To facilitate the tuning of model coefficients        
D. To predict the output of the model based on the test inputs  

3. Which of the following statement(s) is/are correct about decision trees?

  1. The decision tree splits for purer sub-groups.
  2. The decision tree accepts continuous input variables.
  3. The decision tree accepts discrete input variables.
  4. The decision tree predicts only discrete output variables.
A. The decision tree splits for purer sub-groups.
B. The decision tree accepts continuous input variables.
C.  The decision tree accepts discrete input variables.  

4. Which of the following statement(s) is/are correct about clustering?

  1. The K-means algorithm requires setting the number of targeted
    clusters.
  2. Clustering can be used to predict a company’s increased revenue based on its promotional investments in different YouTube channels.
  3. Clustering should be used when predicting whether a student will pass the exam based on how often he/she studies.
  4. The clustering algorithm classifies data into labeled groups.
A. The K-means algorithm requires setting the number of targeted
clusters
D. The clustering algorithm classifies data into labeled groups

5. Which of the following statement(s) is/are correct?

  1. Deep neural networks are called “deep” because they are primarily used to evaluate significant philosophical issues.
  2. In machine learning, data are usually normalized between a certain minimum and maximum for all variables to mitigate potential bias.
  3. The basic idea of a decision tree is that it recursively divides a training set until each division consists entirely or primarily of examples from one class.
  4. Neural networks are called “black boxes” due to the lack of ability to explain their reasoning.
B.  In machine learning, data are usually normalized between a certain minimum and maximum for all variables to mitigate potential bias.

C. The basic idea of a decision tree is that it recursively divides a training set until each division consists entirely or primarily of examples from one class.

D.  Neural networks are called “black boxes” due to the lack of ability to explain their reasoning.  

–  End of Section A –

Machine Learning Techniques and Applications Assignment Help

SECTION B (57 marks)

This section includes 4 long questions. Write your answers in the spaces provided in this booklet.

Question 1 (16 marks)

An insurance company is trying to predict the insurance claims of its Hong Kong clients based on the following variables:

Table 1

VariableTypeDescription
AgeIndependentClient’s age: years
BMIIndependentClient’s BMI: 15 – 55
ChildrenIndependentNumber of children the client has
IncomeIndependentClient’s monthly income: HKD
ClaimDependentClient’s monthly insurance claim: HKD

The insurance company has used multiple linear regression for prediction.

A. (8 marks) Complete the program for the multiple linear regression analysis. Lasso regularization and feature scaling via StandardScaler() are required.

import pandas as pd 
from sklearn.linear_model import LinearRegression 
from sklearn.linear_model import Lasso 
from sklearn.preprocessing import StandardScaler   
insurance_data = pd.read_csv('client_data.csv')   
# TODO: Create and train the model 
# Notes: 
# The order of predictor features in X should follow the order in Table 1. 
# We do not know the order of predictor features in dataset (client_data.csv). 
# However, the headers in the dataset are the variable names in Table 1 (e.g., Age, BMI, etc.).   
# Name the model you create as “model”.   
X = insurance_data[["Age", "BMI", "Children", "Income"]] 
y = insurance_data["Claim"]   
scaler = StandardScaler() 
X = scaler.fit_transform(X)   
model = Lasso(alpha=0.5) 
model.fit(X, y)

B. (2 marks) After training the model, when we run print(model.coef_), we get

[170 231 -511 0]. According to this result, which feature(s) can be removed from the model?

The Income feature can be removed as it has no effect on the dependent variable.

C. (2 marks) Then, what is the relationship between Children and Cost? What will happen to the expected insurance claim if the normalized input value for Children increases by 0.1.

There is a highly negative correlation between Children and claims. An increase of 0.1 in Children will lead to a decrease in the Claim amount by 51.1 HKD.

D. (2 marks) With the code written in Part A, write down the code that prints the client’s expected insurance claim if their normalized values of the input features are stored in variable Z. Show ONLY the code directly related to this part.

model.predict(Z)

E. (2 marks) Together with the above parts, when we run print(model.intercept_), we get 3. To predict David’s insurance claim, we have normalized input
Z = [[0.24, 0.29, -0.32, 0.36]], so what will be the output value of the model? Show the calculation steps.

y = b + w1*x1 + w2*x2 + w3*x3 + w4*x4
y = 3 + 0.24*170 + 0.29*231 + (-511)*(-0.32) + 0*0.36
y = 274.31

Question 2 (15 marks)

The three species of the Iris flower have the following data attributes:

VariableTypeDescription
SepallengthIndependentSepal length of Iris, 4.3 – 7.9
SepalwidthIndependentSepal width of Iris, 2 – 4.4
PetallengthIndependentPetal length of Iris, 1 – 6.9
PetalwidthIndependentPetal width of Iris, 0.1 – 2.5
TypeDependentType of Iris, i.e., Setosa, Virginica, or Versicolor.

The trained decision tree is shown below. The values in parentheses indicate the number of data in that leaf node. All leaf nodes in this question are pure.

Note: The decision tree created is for examination, and the data may not match our real-life situation.

Machine Learning Techniques and Applications Machine Learning Techniques and Applications|Assignment Help Module Title:                         Machine Learning Techniques and Applications

A. (1 mark) How many leaf nodes are there with petal widths less than 1.9?

88 leaf nodes have petal widths less than 1.9

B. (4 marks) What is the prediction for the leaf node marked in red?

Iris viginica

C. (2 marks) Which feature(s) are less useful for classifying Iris species?

Sepal width and sepal length are not in the decision tree, thus they are not useful for classifying Iris species

D. (4 marks) What is the information gain when the yellow node in the decision tree splits? Show the calculation steps. Correct your final answer to 2 decimal places.

Information gain = 1 – entropy

Entropy = ∑ – p * log(p)
             = – (36/64) *log(36/64) – (28/64) * math.log(28/64)
             = 0.9887

Information gain = 1 – 0.9987
                           = 0.0113

E. (3 marks) Suppose the code to train a decision tree model in sklearn is ready. Write down the code specifying that the maximum tree depth is to be the same as the current maximum tree depth in the question. Name you model as “model”, and show ONLY the code related to this part.

model = DecisionTreeClassifier(max_depth=5)

F. (1 mark) What will happen (overfitting/underfitting) if we have an extremely small value for the minimum number of samples at a leaf node?

It will lead to overfitting

Machine Learning Techniques and Applications Project Help

Question 3 (16 marks)

Here is a simple fully connected neural network for classification. The activation function of the hidden layer is the sigmoid function. The outputs of the network are normalized by the softmax function.

Machine Learning Techniques and Applications Machine Learning Techniques and Applications|Assignment Help Module Title:                         Machine Learning Techniques and Applications

A. (8 marks) If the inputs to nodes 1 and 2 are 0.1 and 0.2, respectively, what are the outputs of nodes 5 and 6? Show the calculation steps. Correct your final answer to 2 decimal places.

Node 3 gets 0.1 * -0.86 + 0.2 * -0.48 = -0.182
Output of Node 3 is 0.45 after applying sigmoid

Node 4 gets 0.1 * -0.31 + 0.2 * -0.6 = -0.151
Output of Node 4 is 0.46 after applying sigmoid

Node 5 receives -0.79*0.45 + 0.58*0.46 = -0.0887  

Node 6 receives 1.4*0.45 + (-0.64)*0.46 = -0.3356  

Applying softmax, the output of node 5 is 0.4, and the output of node 6 is 0.6

B. (5 marks) Build the model in the question using torch.nn.Sequential. Name the model you create as “model”. Show ONLY the code related to this part.

model = torch.nn.Sequential(          
nn.Linear(2,2),
          nn.Sigmoid(),
          nn.Linear(2,2),
          nn.Softmax()        
)

C. (3 marks) Suppose you are working on a computer vision project. Use torchvision.transforms to define transforms that resize the input image to a square of length 14 and then convert it to a tensor. Name the script of the transformations

as “transforms”. Show ONLY the code related to this part.

transforms = torchvision.transforms.Resize(14)

Question 4 (10 marks)

You are managing an online advertising company and have some basic data about your potential customers, such as gender, marital status, annual income, and the average amount of time they spend on YouTube each day. You want to group your potential customers so that your team can develop appropriate marketing strategies for each grouping.

NameDescription
GenderCustomer’s gender: 0: male 1: female
Marital StatusCustomer’s marital status:
0: single 1: married
IncomeAnnual income in HKD
YouTubeThe average amount of time the customer spends on YouTube, in hours per day

The following shows the cluster centroids after performing k-means clustering.

AttributeCluster#1Cluster#2Cluster#3Cluster#4
Gender000.3141
Marital Status1001
Income554340353494234887142523
YouTube0.72.43.64.2

A. (2 marks) What is the value of k in the above k-means clustering? What will happen if the value of k increases?

The value of k is 4 in the above clustering as 4 clusters are formed. If we increase k, the number of clusters will increase.

B. (1 mark) Suppose the code to train a k-means clustering model in sklearn is ready. Write down the code that specifies k=3. Name your model as “model”, and show ONLY the code related to this part.

model = sklearn.cluster.KMeans(n_clusters=3)

C. (4 marks) What are the characteristics of the potential customers in Cluster#4?

Potential customers in Cluster#4 are female, married, and have an income of around 142523 HKD. They also spend on average 4.2 hours per day on YouTube.

D. (2 marks) How would you describe the relationship between a potential customer’s income and the amount of time he/she spends on YouTube?

There is a negative correlation between customers’ income and the amount of time spent on YouTube. The amount of time spent on YouTube decreases as customers’ income increases.

E. (1 mark) If a new product is targeted at married male customers, which cluster should you target?

I will target Cluster#1.

–  End of Section B –

Machine Learning Techniques and Applications Homework Help

SECTION C (13 marks)

This is an open-ended question. Suppose you are working for an international finance company. Your company is asking for your advice on whether to build a deep learning model to determine the number of loans to its clients. You should focus on whether using deep learning is suitable for this problem. Write down 500 words stating your recommendation and three reasons for it.

Yes, deep learning is suitable for this task as:  

  • Feature generation automation: Deep learning models are able to generate new dimensions from the given data without requiring any human interference. They can automatically perform very complex analyses on the data that would otherwise require feature engineering done by a human. Thus, they are able to analyze patterns that we can’t see and make better recommendations.  
  • Deep learning is able to capture information from complex and highly unstructured data: Deep learning models are not limited to structured or just numeric data, they can work with images, audio as well as textual data. A lot of business data is in the form of unstructured data, thus deep learning can help analyze these otherwise ignored data to better understand characteristics and make better predictions.  
  • Deep learning models can work on incomplete data. They can learn as they make recommendations and get better over time. Deep learning models can learn from their errors and make adjustments to their weights without requiring any human interference. As the size of data increases, the performance of the model gets better and better.  

–  End of paper –


Also Read:


Browse Post Tags:

machine learning assignment
coursera machine learning week 2 assignment
coursera machine learning assignment
machine learning week 2 assignment
machine learning week 3 assignment
cs229 assignments
deep learning assignment
coursera machine learning quiz
machine learning week 4 assignment
machine learning week 5 assignment
andrew ng deep learning github
deep learning andrew ng github
machine learning week 8 assignment
coursera machine learning week 3 assignment
coursera machine learning week 4 assignment
nptel machine learning assignment
machine learning week 7 assignment
machine learning week 6 assignment
deep learning coursera assignments
machine learning coursera week 2 assignment
coursera week 2 assignment
coursera week 3 assignment
week 6 machine learning assignment
machine learning nptel assignment
coursera machine learning assignment week 2
machine learning week 9 quiz
machine learning week 9 assignment
coursera neural networks and deep learning week 2 assignment
machine learning week 3 quiz
machine learning week 4 quiz
machine learning week 5 quiz
machine learning week 2 quiz
machine learning homework
coursera machine learning week 5 assignment
andrew ng machine learning python github
week 5 machine learning assignment
week 4 machine learning assignment
deep learning coursera assignments github
apdaga machine learning
coursera machine learning programming assignment
coursera machine learning week 7 assignment
coursera machine learning week 3
machine learning andrew ng assignment
neural networks and deep learning week 2 assignment
machine learning week 8 quiz
week 4 assignment machine learning
andrew ng deep learning assignments
coursera neural networks and deep learning week 4 assignment
machine learning coursera assignment week 2
recommender systems machine learning quiz
coursera machine learning week 6 assignment
neural networks and deep learning coursera week 2 programming assignment
coursera deep learning assignment
week 3 assignment machine learning
coursera week 5 assignment
coursera week 6 assignment
week 7 machine learning assignment
machine learning coursera week 3 assignment
applied machine learning in python quiz 2
coursera machine learning week 8 assignment
coursera machine learning week 3 quiz
andrew ng deep learning specialization github
logistic regression machine learning quiz
deep learning nptel assignment
machine learning andrew ng quiz
machine learning week 7 quiz
neural networks and deep learning week 4 assignment
week 9 quiz machine learning
coursera deep learning week 2 assignment
week 5 assignment machine learning
week 9 assignment machine learning
week 8 assignment machine learning
week 3 machine learning assignment
neural networks and deep learning programming assignments
coursera machine learning week 9 quiz
machine learning week 2 programming assignment
coursera machine learning programming assignment week 2
week 8 quiz machine learning
week 11 quiz machine learning
week 7 assignment machine learning
machine learning week 9 quiz 2
applied machine learning in python quiz 4
week 9 machine learning assignment
coursera machine learning week 9 assignment
machine learning coursera programming assignment
week 2 machine learning assignment
machine learning quiz coursera
machine learning assignment questions
deep learning week 3 assignment
linear regression programming assignment
coursera applied machine learning in python assignment 1
deep learning week 2 assignment
machine learning programming assignment week 2
deep learning week 4 assignment
coursera machine learning week 4 quiz
deep learning coursera quiz
neural networks and deep learning coursera week 4 programming assignment
coursera neural networks and deep learning week 3 assignment
week 7 quiz machine learning
week 5 quiz machine learning
programming assignment linear regression week 2
deep learning and neural networks coursera github
week 6 assignment machine learning
machine learning week 9 quiz recommender systems
week 2 assignment machine learning
applied machine learning in python week 2 quiz
machine learning coursera week 4 assignment
week 4 quiz machine learning
machine learning week 3 programming assignment
week 10 machine learning quiz
coursera deep learning week 4 assignment
programming assignment linear regression coursera week 2
week 9 machine learning quiz
coursera machine learning assignment week 3
week 8 machine learning quiz
week 7 machine learning quiz
machine learning assignment week 2
coursera week 7 assignment
coursera machine learning week 5
logistic regression machine learning coursera quiz
machine learning week 4 programming assignment
deep learning programming assignment
coursera machine learning week 4
machine learning coursera week 5 assignment
deep learning assignment coursera
coursera machine learning week 6
coursera machine learning programming assignment week 3
deep learning homework
coursera deep learning specialization assignments
week 11 machine learning quiz
machine learning coursera week 1 quiz
nptel ml assignment
week 5 machine learning quiz
coursera machine learning week 8 quiz
andrew ng week 2 assignment
machine learning coursera week 6 assignment
machine learning programming assignment
coursera machine learning andrew ng week 2 assignment
machine learning assignment week 3
deep learning coursera programming assignments
andrew ng machine learning quiz
week 2 assignment machine learning coursera
week 6 programming assignment machine learning
machine learning coursera assignment week 3
programming assignment machine learning coursera
week 4 programming assignment machine learning
coursera linear regression programming assignment
week 3 quiz machine learning
week 2 quiz machine learning coursera
machine learning week 7
coursera machine learning week 5 quiz
neural networks and deep learning coursera programming assignment
coursera week 2 machine learning programming assignment
week 3 assignment machine learning coursera
coursera machine learning programming assignment week 4
coursera machine learning week 7
assignment on machine learning
andrew ng assignments in python
machine learning week 1 assignment
nptel deep learning assignment
machine learning assignment 1
coursera machine learning week 9 programming assignment
coursera machine learning ex4
applied machine learning in python week 1 assignment
coursera machine learning week 9 recommender system quiz
coursera machine learning week 8 programming assignment
coursera machine learning week 4 assignment github
coursera week 2 programming assignment
coursera week 3 programming assignment
coursera machine learning week 7 programming assignment
week 7 programming assignment machine learning
machine learning coursera week 2 quiz
coursera machine learning week 11 quiz
coursera neural networks and deep learning assignments
machine learning week 5 programming assignment
neural networks and deep learning coursera week 3 programming assignment
coursera machine learning assignment week 4
coursera deep learning week 3 assignment
advice for applying machine learning quiz week 6
machine learning week 7 programming assignment
machine learning with python assignment
machine learning coursera week 8 assignment
coursera machine learning week 7 quiz
machine learning week 9 programming assignment
coursera machine learning week 6 programming assignment
coursera machine learning logistic regression quiz
andrew ng python github
coursera week 2 programming assignment machine learning
andrew ng machine learning week 2 assignment
gradient descent coursera assignment
machine learning coursera assignment week 4
machine learning week 8 programming assignment
week 3 machine learning quiz
week 3 assignment machine learning nptel
coursera machine learning recommender systems quiz
machine learning assignment week 5
machine learning week 6 programming assignment
coursera machine learning week 8
neural networks and deep learning week 4 assignment github
coursera programming assignment linear regression
coursera machine learning week 9
coursera machine learning linear algebra quiz
week 3 programming assignment machine learning
coursera week 5 quiz
coursera machine learning linear regression assignment
coursera machine learning week 2 quiz
machine learning assignment week 4
coursera machine learning logistic regression assignment
machine learning programming assignment week 3
machine learning with python coursera assignment
machine learning andrew ng week 3 quiz
andrew ng deep learning coursera github
assignment machine learning coursera
github andrew ng machine learning python
coursera machine learning programming assignment week 6
coursera neural networks and deep learning programming assignment
coursera week 3 programming assignment machine learning
machine learning assignment 2
machine learning coursera assignment week 5
coursera andrew ng deep learning github
coursera machine learning week 5 programming assignment
quiz machine learning coursera
week 3 coursera machine learning
coursera machine learning anomaly detection quiz
coursera programming assignment 1 machine learning
week 2 machine learning quiz
andrew ng machine learning homework
andrew ng machine learning coursera assignments
coursera neural networks and deep learning week 2 programming assignment
coursera machine learning week 2 programming assignment
machine learning coursera assignment week 1
practical machine learning assignment
coursera machine learning programming assignment linear regression
assignment 1 applied machine learning in python
coursera machine learning exercise 2
coursera machine learning week 9 anomaly detection quiz
machine learning coursera week 3 programming assignment
deep learning coursera week 2 assignment
machine learning recommender systems quiz
deep learning coursera week 4 assignment
machine learning quiz 1
andrew ng github deep learning
week 3 coursera machine learning quiz
coursera week 7 programming assignment
linear algebra for machine learning quiz
coursera machine learning homework
machine learning coursera week 2 programming assignment
coursera machine learning with python assignment
machine learning neural networks quiz
assignment linear regression machine learning
coursera machine learning neural networks assignment
coursera machine learning week 4 programming assignment
coursera machine learning week 1 quiz
coursera ml assignments
peer graded assignment coursera machine learning
deep learning coursera week 3 assignment
neural networks and deep learning week 3 programming assignment
coursera machine learning assignment week 1
machine learning programming assignments
assignment 2 machine learning coursera
coursera machine learning course assignments
coursera machine learning week 1 programming assignment
andrew ng assignments
coursera neural networks and deep learning week 1 assignment
machine learning stanford coursera week 2 quiz
coursera machine learning assignment 1
coursera machine learning first assignment
coursera machine learning quiz 1
coursera machine learning quiz week 2
week 9 recommender systems quiz
machine learning for all peer graded assignment
coursera machine learning week 1 assignment
coursera deep learning week 3 programming assignment
machine learning week 2 quiz octave tutorial
coursera deep learning week 1 assignment
week 5 quiz machine learning coursera
octave quiz machine learning
apdaga coursera machine learning
coursera deep learning week 2 programming assignment
coursera ml course assignments

Share:
Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you