Consider the numbered lines below:1)def price(PMT, IY, g) 2)…
Consider the numbered lines below:1)def price(PMT, IY, g) 2) return PMT / (IY – g) 3) 4)g = np.linspace(0, 0.09, 21) 5)IY = 0.1 6)PMT = 10 7)PV = np.zeros_like(g) 8)for i in range(len(g)): 9) PV[i] = price(PMT, IY, g[i]) 10)plt.plot(g, PV) 11)plt.xlabel(‘Growth Rate’) 12)plt.ylabel(‘Perpetuity with Growth Price’);If we execute the code above, we receive an error. In which line lies the error?
Read DetailsAssume we download the stock price of Tesla and compute its…
Assume we download the stock price of Tesla and compute its return using the command startdate = ‘2019-01-01’ enddate = ‘2021-01-01’ tesla = web.get_data_yahoo(“TSLA”, startdate, enddate)R_tesla = tesla[‘Adj Close’].pct_change().dropna() Which of the following commands is not a valid command in Python?
Read DetailsConsider the following code with numbered lines: 1)betai = n…
Consider the following code with numbered lines: 1)betai = np.array([-2, -1.5, -1, -0.5, 0., 0.5, 1, 1.5, 2]) # Features 2)ERi = np.array([-0.08, -0.06, -0.03, -0.01, 0.02, 0.04, 0.07, 0.1 , 0.12]) # Labels 3)hidden = tf.keras.layers.Dense(units=1, input_shape=[1]) 4)model = tf.keras.Sequential([hidden]) 5)loss = ‘mse’ 6)optimizer = ‘Adam’ 7)model.compile(loss=loss, optimizer=optimizer) 8)history = model.fit(betai, ERi, epochs=10000, verbose=False) 9)plt.plot(history.history[‘loss’]) 10)plt.xlabel(‘Number of Epochs’) 11)plt.ylabel(‘Loss’);In which of line does the training of the neural network takes place?
Read DetailsConsider the pseudo code below to obtain the effient portfol…
Consider the pseudo code below to obtain the effient portfolios:from scipy.optimize import minimize f = lambda w: TO BE FILLED mu = np.linspace(15, 30, 31) sd_optimal = np.zeros_like(mu) w_optimal = np.zeros([31, 5]) for i in range(len(mu)): # Optimization Constraints cons = ({‘type’:’eq’, ‘fun’: lambda w: np.sum(w) – 1}, {‘type’:’eq’, ‘fun’: lambda w: w @ ER * 252 * 100 – mu[i]}) result = minimize(f, np.zeros(5), constraints=cons) w_optimal[i, :] = result.x sd_optimal[i] = np.sqrt(result.fun)Assuming that ER are Cov given, what should we substitute TO BE FILLED for in order to get the desired result?
Read Details