Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ltv = [ 3 5 4 , 1 8 1 , 2 8 3 , 1 0 7 ] conv _ rate = [ 0

ltv =[354,181,283,107]
conv_rate =[0.3,0.32,0.3,0.3]
def estimate_optimal_bids(alpha_beta, ltv, conv_rate):
alpha, beta = alpha_beta
x0= np.zeros(4)
params0= np.concatenate([x0,[alpha, beta], ltv, conv_rate])
bounds =[(0, None)]*4+[(None, None),(None, None)]+[(0, None)]*4
result = minimize(objective, params0, bounds=bounds)
optimal_bids = result.x[:4]
return optimal_bids
alpha_beta_kw8322228=[0.1,0.2]
optimal_bids_kw8322228= estimate_optimal_bids(alpha_beta_kw8322228, ltv, conv_rate)
print('kw8322228- optimal bids:', optimal_bids_kw8322228)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/pv/wv1191lx7kv6ns91rgv99l_h0000gn/T/ipykernel_51013/1741954947.py in
12
13 alpha_beta_kw8322228=[0.1,0.2]
--->14 optimal_bids_kw8322228= estimate_optimal_bids(alpha_beta_kw8322228, ltv, conv_rate)
15 print('kw8322228- optimal bids:', optimal_bids_kw8322228)
/var/folders/pv/wv1191lx7kv6ns91rgv99l_h0000gn/T/ipykernel_51013/1741954947.py in estimate_optimal_bids(alpha_beta, ltv, conv_rate)
7 params0= np.concatenate([x0,[alpha, beta], ltv, conv_rate])
8 bounds =[(0, None)]*4+[(None, None),(None, None)]+[(0, None)]*4
---->9 result = minimize(objective, params0, bounds=bounds)
10 optimal_bids = result.x[:4]
11 return optimal_bids
~/opt/anaconda3/lib/python3.9/site-packages/scipy/optimize/_minimize.py in minimize(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)
682 if callable(jac):
683 jac =_remove_from_func(jac, i_fixed, x_fixed, remove=1)
-->684
685 # make a copy of the constraints so the user's version doesn't
686 # get changed. (Shallow copy is ok)
~/opt/anaconda3/lib/python3.9/site-packages/scipy/optimize/_minimize.py in standardize_bounds(bounds, x0, meth)
945 res =_minimize_scalar_bounded(fun, bounds, args, **options)
946 elif meth == 'golden':
-->947 res =_recover_from_bracket_error(_minimize_scalar_golden,
948 fun, bracket, args, **options)
949 else:
~/opt/anaconda3/lib/python3.9/site-packages/scipy/optimize/_constraints.py in new_bounds_to_old(lb, ub, n)
395
396 excess_lb = np.maximum(self.bounds[0]- ev,0)
-->397 excess_ub = np.maximum(ev - self.bounds[1],0)
398
399 return excess_lb + excess_ub
~/opt/anaconda3/lib/python3.9/site-packages/numpy/core/overrides.py in broadcast_to(*args,**kwargs)
~/opt/anaconda3/lib/python3.9/site-packages/numpy/lib/stride_tricks.py in broadcast_to(array, shape, subok)
411[1,2,3]])
412"""
-->413 return _broadcast_to(array, shape, subok=subok, readonly=True)
414
415
~/opt/anaconda3/lib/python3.9/site-packages/numpy/lib/stride_tricks.py in _broadcast_to(array, shape, subok, readonly)
347 'negative')
348 extras =[]
-->349 it = np.nditer(
350(array,), flags=['multi_index', 'refs_ok', 'zerosize_ok']+ extras,
351 op_flags=['readonly'], itershape=shape, order='C')
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (10,) and requested shape (14,)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

How is the NDAA used to shape defense policies indirectly?

Answered: 1 week ago