Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 3 ( 2 0 points ) 5 . 0 . 1 . Calculate the gradient of f with respect to x and y using
Q points
Calculate the gradient of with respect to and using the backpropagation
algorithm
Calculate the gradient of with respect to and using the computation graph in
tensorflow
Declare intermediate variables, and so on Remember to use is needed when is used in
multiple paths of the computation similarly dfdy
##code:
import sys
from packaging import version
import sklearn
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from sklearn.preprocessing import adddummyfeature
from sklearn.datasets import makeblobs
from sklearn import metrics #Import scikitlearn metrics module for accuracy calculation
from sklearn.modelselection import traintestsplit
from sklearn.metrics import confusionmatrix, ConfusionMatrixDisplay
from sklearn.datasets import makeclassification
printSklearn package",sysversioninfo
printSklearn package",sklearn.version
printTensorFlow version:", tfversion
assert sysversioninfo
assert version.parsesklearnversion version.parse
pltrcfont size
pltrcaxes labelsize titlesize
pltrclegend fontsize
pltrcxtick labelsize
pltrcytick labelsize
##
x
y
#Forward pass
#Backward pass
#printf
#printdfdxdfdy
#f
#dfdx
#dfdy
##
#using computation graph from tensorflow
x tfVariable
y tfVariable
#printf
#printgradxgrady
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started