Calculate the gradient of the cost function

Assignment Help Other Engineering
Reference no: EM132396023

Assignment

Question 1

Perform 20 iterations of gradient descent to minimize the given cost function, starting from the initial β given. Follow these steps as a guideline:

1. Select your own learning rate, and be aware you may need to adjust this parameter to achieve a suitable descent.

2. Calculate the gradient (∇C) of the Cost function in terms of β.

3. Iterate to adjust β as such: βt+1 = βt + (learningrate) * ∇C(βt). It would be helpful to do this in a loop.

4. Finally, print a dataframe with a row for each iteration and the updated value of β. If β is a vector with multiple components, let your dataframe include a column for each component.

Additionally, comment on the following points:

1. What value of β would minimize the cost function, and can β be calculated explicitly?

2. Does your gradient descent method improve your guess of β correctly?

a) C(β) = (β - 3)2 + 5, β0 = 5

b) C(β) = 1/2 (Y - Xβ)2, β0 = 822_image.jpg, note: X and Y matrices are given below

Question 2

Using the randomly generated 1100 by 3 data set, you are going to practice different clustering methods to learn how each method works, to observe how each provides the output graphically, and how to make a decision based from the output. To make the practice effective, you are going to let the last column of dataset be an integer and be the cluster number but treat the column as unknown value. Then you are going to cluster the dataset using only first two columns and test your results by verifying the total number of clusters.

1. Generate a random 1100 row dataset containing three columns, the first column from -1.5 to 1.5, the second from -3.5 to 1.5, and the third column with integers from 1 to 4.

2. K-mean method - Using the basic function kmeans(), determine the appropriate number of clusters. You can tabulate the number of clusters from 1 to 40 and the total within-cluster variances. Then plot the scree plot to visually support your decisions on the cluster number.

3. DBSCAN method - install the package called fpc and compute DBSCAN using fpc :: dbscan() and dbsca :: dbscan(). Determine the optimal eps parameter value and draw the k-distance plot. The cluster using fp :: dbscan() function provides the same result with the result using dbsca :: dbscan() function. Verify which function provides the better computation.

4. Hierarchal clustering - calculate the pairwise distance between observations. Create various dendrograms using complete and average linkage. Cut the dendrogram into groups of 5, 6 and 7. Discuss which is the most appropriate number of groups.

5. Summarize the results from 2, 3, and 4.

Question 3

In this problem, you are going to apply unsupervise learning techniques learned from Question 2. The goal in this problem is to apply clustering techniques and identify the correct number of clusters.

1. Download the file HW2_Q5_1_1.csv from the HW#2 folder.

2. Repeat the process you have done in Question 2 part 2.

3. Repeat the process you have done in Question 2 part 4.

4. Discuss how the cluster number from 2 and 3 are the same or different.

Question 4

This problem is an extension of Question 3 to practice the logistic regression. The actual cluster number will be given later in HW#3.

1. Split the data into train and test dataframe by 0.8 and 0.2 ratios.

2. Using the cluster number from Kmean in Question 3-2, predict the cluster number and calculate its accuracy using logistic regression.

3. Do same with the result obtained from the hierarchal clustering.

Question 5

Using the different dataset, "HW2_Q6_1_1.csv", you are planning to do what you have done in Q4.

1. Unfortunately, the kmean function is not installed in your R package and you have to write the code from the scratch. Write a function call kmean.alt function that calculates the within cluster variance, aggregates the data by the cluster number, and plots "total within cluster vs. number of cluster". The actual cluster number will be given later in HW#3.

2. Add the cluster number to the last column of dataset, predict the cluster number using logistic regression and calculate the accuracy of your model.

3. Using the pre-instaled Kmeans function, compare the performance of part 1. You can similar to part 2.

Attachment:- Data File.rar

Reference no: EM132396023

Questions Cloud

Definition of a successful project : What do you think about the CHAOS study's definition of a successful project? Do you think there are better definitions of success besides
Contract execution and closeout : Contract execution and closeout often fall on the project manager as the project manager works with the vendor (supplier) to complete project work.
Develope a battery with a longer life span : Monitoring and reporting progress by using Microsoft Project software to achieve a successfully completed project before the end of this semester.
You have now delivered the project to your customer : You have now delivered the project to your customer. The project was delivered ahead of schedule, as requested by your project sponsor,
Calculate the gradient of the cost function : Perform 20 iterations of gradient descent to minimize the given cost function, starting from the initial ß given. Calculate the gradient of the Cost function.
Define ethics and the importance as project manager : How do you define ethics and the importance as project manager to adhere to a "code of ethics" (i.e., What effect on human behaviors will the code have?).
Corporate governance framework : As a governance consultant called in to advise the board, draft report in which you set out the principles and issues of a corporate governance framework
What do you think about the privacy implications of letting : What do you think about the privacy implications of letting apps use our geo-location data?
Discuss different leadership theories : Understanding an organization's vision and the team goals will help a manager select the best practices to motivate and support the team to reach success.

Reviews

Write a Review

Other Engineering Questions & Answers

  What volumetric flow rate is needed to produce

The propulsive force (thrust) developed to propel the jet ski shown in Fig. is a result of water pumped through the vehicle and exiting as a high-speed water jet. For the conditions shown in the figure, what volumetric flow rate is needed to produ..

  Find a logic circuit based on the product of max terms

Suppose that the BCD data are represented by the logic variables B8, B4, B2, and B1. Find a logic circuit based on the product of max terms having output A that is high only if segment A of the display is to be on.

  What are the best possible noise margins you could expect

For a particular inverter, the basic technology used provides an inherent limit to the small-signal, low-frequency voltage gain of 50 V/V. If, with a 2-V supply, the values of VOL and VOH are ideal, but VM = 0.4VDD, what are the best possible valu..

  What tests would ensure safety from brittle fracture

What tests would ensure safety from brittle fracture? Why is it that large steel components made of high-strength martensitic steels sometimes fail by brittle fracture?

  Determine the circuit using the non-inverting topology

Determine the circuit using the non-inverting topology - A filter transfer function

  Discuss the rise of signature architecture

Discuss the rise of signature architecture. The rise of Dubai as the "exemplar" 21st century city. Cite any architect to add to/amplify this discussion.

  What feature of the light source do the spectra represent

Describe the differences in appearance among the three spectra. What feature of the light source do the spectra represent? In other words, what is it that you are actually analyzing?

  Show how the sum-product algorithm can be used

Consider a tree-structured factor graph, in which a given subset of the variable nodes form a connected subgraph.

  Design an appropriate piping system

EML 3126 - Transport Phenomena Project. design an appropriate piping system, complete with all necessary equipment, to transport the water to atomization nozzle

  Explore and gather information on the materials used

ETSC 101.001: Explore and gather information on materials used to meet similar specifications that your design solution has. If your design solution has a high tensile strength specification, explore materials that have high tensile strengths.

  Question regarding the relative humidity

A horizontal pipe 10 inches in diameter is covered with an inch of insulation that is 36% voids. The insulation has been soaked with water. The pipe is now drying slowly and hence almost isothermally in 80 °F air that has a relative humidity of ab..

  How do my ethics rate

Reflect on your answers and how they compare to the norms. For any item in which you are more than 1 to 2 points from the norm, explain your position in relation to the norm. If you have several items, then pick out two or three to write about.

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