Write python code which will train and validate models

Assignment Help Python Programming
Reference no: EM132298902

Assignment -

Introduction - In this assignment, you will develop classification models to classify noisy input images into two classes: square or circle. Examples are shown in Fig. 1. (attached)

Assignment - Your task is to write Python code which will train and validate the following two classification models:

1) K-Nearest neighbour (KNN) classifier.

For the KNN classifier, you can only use standard Python libraries (e.g., numpy) in order to implement all aspects of the training and testing algorithms.

Using matplotlib, plot a graph of the evolution of classification accuracy for the training and testing sets as a function of K, where K = 1 to 10.

Clearly identify the value of K for which generalisation is best.

2) Convolutional neural network (CNN) classifier.

For the convolutional neural network, you should use Tensorflow within Jupyter Notebook by modifying the Multilayer Perceptron program supplied with this assignment. Instructions for installation of Python 3.7, Jupyter and TensorFlow (via a package called miniconda) are in a separate sheet supplied with this assignment.

You should modify the code so that it implements the LeNet CNN structure to that was presented in lectures. In particular, the LeNet architecture should comprise two convolutional layers (5x5 convolutions), and two hidden full- connected (dense) layers in addition to the output layer. After each convolutional layer the architecture should use max pooling to reduce the size by a factor of 2 in each axis. After each pooling operation you should use a RELU (Rectified Linear Unit) activation function. The LeNet will also have three dense layers forming a Multilayer Perceptron (MLP) classifier (you can use the ones already in the sample implementation. The size of the two hidden-layers in the MLP must be 2x and x (where you will need to test different values of x by changing the code or writing a suitable function). Of course the output layer will have a single neuron.

Using matplotlib, plot a graph of the evolution of accuracy for the training and testing sets as a function of the number of epochs, for each of the CNNs you train (up to a maximum of 200 epochs).

Sample python code that trains and tests a multi-layer perceptron classifier (and can run in a Jupyter Notebook session) is provided with the assignment specification. You should modify this code to produce your own program.

Attachment:- Assignment Files.rar

Reference no: EM132298902

Questions Cloud

At what point was the feedback given : 1. Give an example of a learning activity that you have been a part of, either as a participant or as an organiser that was modified as a result of feedback
What feedback processes could you use to uncover problem : Effective managers do not wait for a defined time to gather feedback on their team members' performance; they do it continually using formal and informal method
Applied Cloud Concepts in AWS : ITC561 - Cloud Computing - Charles Sturt University - produce a short report by investigating and advising technical users of DTGOV on some key topics
Happiness for the employee : To what extent is a company obligated to pay a wage that guarantees the right to the pursuit of happiness for the employee and his or her family?
Write python code which will train and validate models : Your task is to write Python code which will train and validate the following two classification models: K-Nearest neighbour (KNN) classifier
Compliance and quality improvement cost : With increased compliance and quality improvement cost , organizations face challenges in aligning strategic planning to accommodate legal and quality managemen
What makes an effective presentation : How to start a presentation and what makes an effective presentation.
Fidelity investments-case study : What are the risks to Fidelity Investments of its partnership with Citizen Schools? Describe the benefits.
Large loss in the current year : Due to an unusual event, a taxpayer has a large loss in the current year, resulting in an NOL. The taxpayer expects next year's taxable income to return

Reviews

len2298902

5/4/2019 12:16:42 AM

In this assignment, you will develop classification models to classify noisy input images into two classes: square or circle. .ipynb provide which has to be modified for this program. dataset and testset provide. Require training three LeNEts with x=20 and x=50 and x=100.

len2298902

5/4/2019 12:16:35 AM

K-Nearest neighbour (KNN) classifier [30 marks] - Undergraduates can use whatever algorithm they see fit (including exhaustive search) and all 30 marks will be available. Post-graduates who implement exhaustive search will be eligible for only 15/30 marks. To be eligible for 30/30 you must implement a K-d tree to store and search the database. Convolutional neural network (CNN) classifier [30 marks] - Undergraduates should experiment training two LeNets, with ‘x’ = 20, ‘x’ = 50 and ensure the results are written up carefully, comparing the two networks. Postgraduates should experiment training three LeNets, with ‘x’ = 20, ‘x’ = 50. and ‘x’ = 100 and report the results for all three variants, commenting carefully on each.

len2298902

5/4/2019 12:16:29 AM

Submission - You must submit by the due date, two files: A zip file or Jupyter notebook file (.ipynb) containing your code with the two classifiers and all implementations described above. A pdf file with a short (no more than 2 pages) written report detailing your implementation, your results, and an interpretation of the results. The results you should include are: The training and testing accuracies at for KNN, K=1 to 10. The training and testing accuracies for CNN, x=20, x=50 (and x=100 for postgrads).

len2298902

5/4/2019 12:16:24 AM

The implementations are worth 30 marks each (see above) and the report is worth 40 marks. For full marks your report should include a careful and critical analysis of your observations about the performance of the different algorithms and algorithm settings. This assignment is due 11.55pm on Friday 12th If your submission Is late, the maximum mark you can obtain will be reduced by 25% per day (or part thereof) past the due date or any extension you are granted.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd