Examine optimization techniques for classification

Assignment Help Python Programming
Reference no: EM133337507

Question

This question will examine optimization techniques for classification with logistic regression. Download the code file consisting of the assignment2 code and data CSV file. In the data file, the first, second, and third columns are called the inputs dataset and contain the input features. The fourth column is called the outputs dataset and contains the class number for each input sample.

Open the script assignment2.py the lr directory. This code performs gradient descent to optimize parameters (w) which minimizes the error. The parameters are initialized in the beginning. In the code, the data is loaded, and inputs and output arrays are extracted. Afterward, for 500 iterations, the predicted outputs are computed using the following formula for each iteration.

Z = WT. X
Y^= Sigmoid (Z)

Now, in order to optimize the parameters and train the model, complete the missing parts in the code under the comment blocks.

1- Compute the error: In the code, the error value is initialized to zero (e = 0). Compute the error values using the Logistic Regression Cost Function as follows and replace it with e:

Error = -1/m ∑i=1m [Yi log(Y^i)] + (1-Yi)log(1-Y^i))

Then append the computed error value to the error_all vector in order to save your error in all iterations.

2- Plot the error values during the iterations and explain why this plot is oscillating.

3- Create a Python script named assignment2_q2_3.py for the following.

Modify assignment2.py to run gradient descent with the learning rates n = 0: 5,0: 3, 0:1, 0: 05, 0:01.
Include in your report a single plot comparing error values versus iterations for these different learning rates.
Compare these results. What are the relative advantages of the different rates?

4- Create a Python script named assignment2_q2_4.py for the following.
Modify this code to do stochastic gradient descent. Use the parameters n = 0: 5, 0: 3, 0: 1,0: 05, 0: 01.

Attachment:- data.rar

Reference no: EM133337507

Questions Cloud

Relying on virtual teams for product development : For a variety of reasons, organizations are relying on virtual teams for product development.
What the essential components of symmetric cipher : What the essential components of a symmetric cipher? Why are the components considered to be essential?
Advantages of component-based design modeling approach : What are the advantages of the component-based design modeling approach, and how you would approach it in the design phase.
Industry certification benefit : How could this industry certification benefit you and help you reach your career goals? How do you think employers view certifications such as this one?
Examine optimization techniques for classification : Examine optimization techniques for classification with logistic regression. Download the code file consisting of the assignment2 code and data CSV file
Use wiped and inspected media : Why would it be important to use wiped and inspected media during an investigation? What utilities would be recommended for wiping a drive
Discuss proliferation of electronically stored : Discuss the proliferation of electronically stored and transmitted content in recent years. Are there any strategies you oppose, and if so, explain why?
Why would the alerting function be important : What value would aggregations and calculations provide that cannot be provided by the raw or processed logs themselves?
Why domain name system security extensions : What is the importance DNSSEC serves to security? Looking for a valid argument as to why Domain Name System Security Extensions, DNSSEC for short

Reviews

len3337507

2/13/2023 9:29:09 PM

Include in your report a new plot comparing error values versus iterations using stochastic gradient descent. Is stochastic gradient descent faster than gradient descent? Explain using your plots. Note: ONLY ANSWER QUESTION NO. 2 (60%) Submit the figures/explanations requested for question 2. 2. A .zip file of all your code, called code.zip.

Write a Review

Python Programming Questions & Answers

  How to plot taylor series approximation along with graph

How to describe the main features of this graph and how those features relate to the loss of precision when numbers of very different magnitudes.

  Write a script to plot given function in python

Write a script to plot this function in python 2.7.12 - It should still look like that if choose ai values to be 1 after the script

  Design and develop a prototype product

Design and develop a prototype product that uses Internet of Things technologies for environmental monitoring. Generally, IoT products collect data observed

  Identify best practices in data collection

Identify best practices in data collection and storage, including data security and privacy principles; and Effectively report and communicate findings

  ITECH5403 Comparative Programming Languages Assignment

ITECH5403 - Comparative Programming Languages Assignment Help and Solution - Federation University Australia - Parallel Implementations

  Create a program that prompt the user to enter five positive

Create a program that prompt the user to enter five positive numbers and calculate the average. When a negative number is entered, program will be terminated.

  Show time in tmu and seconds

An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door).

  Compute the sample mean of a list of numbers

The return value should be the sample mean and the input value should be the list of numbers. Do not use a built-in function for the mean. Show an example.

  Calculate and show the totalcost for all the items in bag

Fill the list with several Item's such as eggs, milk, carrots, bread, apples, each with different price. use Item.numberItems to show how many items you have.

  Calculate the values of the integrated schema

Calculate the values of the integrated schema. For example, to calculate the suburb, you can only use the shape files provided in the Google d rive

  What is the resulting data type

What is the resulting data type when we combine the following data types in the following ways.Try them out in the Python interpreter if you're not sure

  Write a function reformat date that takes a string argument

Write a function reformat date that takes a string argument containing a date in one format it and returns the date in another format.

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