100% Guaranteed Results


Data Science – Notebook Solved
$ 24.99

Description

5/5 – (1 vote)

2 Statement I
Let a= [1,2,3] x = [3,6,9] Hence LHS =
RHS = Hence LHS ̸= RHS, false
4 Statement II
True (n times) = n ∗ x1
6 Statement III
RHS = = LHS.. Hence True
8 Statement IV
RHS = LHS
as when a = [1,2,3] and is 30 where as is 32. Hence False
10 Question 4a Suppose we have the following scalar-valued function on x and y:
f(x,y) = x2 + 4xy + 2y3 + e−3y + ln(2y)
Compute the partial derivative off(x,y)with respect tox.

12 Now compute the partial derivative of f(x,y) with respect to y:

14 Finally, using your answers to the above two parts, compute ∇f(x,y) (the gradient of f(x,y)) and evaluate the gradient at the point (
16 Question 4b Find the value(s) of x which minimizes the expression below. Justify why it is the minimum.

18 Question 4c Let . Show that σ(−x) = 1 − σ(x).

Hence Proved
20 Question 4d Show that the derivative can be written as:

RHS = σ(x)(1 − σ(x)) = σ(x)σ(−x) (from above)
22 Question 4e Write code to plot the function f(x) = x2, the equation of the tangent line passing through x = 8, and the equation of the tangent line passing through x = 0.
Set the range of the x-axis to (-15, 15) and the range of the y axis to (-100, 300) and the figure size to
(4,4).
Your resulting plot should look like this:
• plt.plot(..)
• plt.figure(figsize=..)
• plt.ylim(..)
• plt.axhline(..)
In [17]: def f(x): return x**2
def df(x):
return 2*x
def plot(f, df): x = np.linspace(-15,15,200)
y = f(x) y_0_1 = f(8)
y_tan = df(8) * (x – 8) + y_0_1 y_0_2 = f(0) y_tan_2 = df(0) * (x – 0) + y_0_2
plt.figure(figsize=(4,4)) plt.plot(x,y,’-‘) plt.plot(x,y_tan_2,’-‘) plt.plot(x,y_tan, ‘-‘) plt.ylim((-100,300)) plt.xlim((-15,15))
plot(f, df)

24
0.0.1 Question 5
Consider the following scenario:
Only 1% of 40-year-old women who participate in a routine mammography test have breast cancer. 80% of women who have breast cancer will test positive, but 9.6% of women who don’t have breast cancer will also get positive tests.
Suppose we know that a woman of this age tested positive in a routine screening. What is the probability that she actually has breast cancer?
You must show work using LaTex (not code) to get credit for your answer.
Hint: Use Bayes’ rule.
Let A be the event that the women have breast cancer. Let B be the probability that the test results are positive.
Hence P(A) = 0.01
P(B|A) = 0.8
P(B|-A) = 0.096

P(B) = P(A)* P(B|A)+P(-A)* P(B|-A) using law of Total Probability
Hence P(B) = 0.010.8+ 0.990.096 = 0.103
0. Hence P(A|B) = P(women tested positive has breast cancer) =
26
0.0.2 Question 6
We should also familiarize ourselves with looking up documentation and learning how to read it. Below is a section of code that plots a basic wireframe. Replace each # Your answer here with a description of what the line above does, what the arguments being passed in are, and how the arguments are used in the function. For example, np.arange(2, 5, 0.2)
# This returns an array of numbers from 2 to 5 with an interval size of 0.2
In [18]: from mpl_toolkits.mplot3d import axes3d
u = np.linspace(1.5*np.pi, -1.5*np.pi, 100)
#this returns a evenly spaced 100 points between 1.5pi and -1.5pi. It returns an array of numbe
[x,y] = np.meshgrid(u, u)
#This returns a array of possible coordinate points using the vector u. From the documentation: squared = np.sqrt(x.flatten()**2 + y.flatten()**2) z = np.cos(squared)
# the flatten function returns a copy of the array in a one dimensional form. Then squared cont z = z.reshape(x.shape)
# This reshapes z to have the same shape as the x array
fig = plt.figure()
ax = fig.add_subplot(111, projection=’3d’)
# this adds the subplot in the 1,1,1 position in the 3d axis. Here there is only one subplot an ax.plot_wireframe(x, y, z, rstride=10, cstride=10)
# This adds the wireframe plot to the subplot established above and plots the z array against t ax.view_init(elev=50., azim=30)
# this sets the elevation angle and the azimuth for viewing the 3d graph plt.savefig(“figure1.png”)
# this saves the figure as a png file

28

Reviews

There are no reviews yet.

Be the first to review “Data Science – Notebook Solved”

Your email address will not be published. Required fields are marked *

Related products