Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pls correct my code : ltv = [ 3 5 4 , 1 8 1 , 2 8 3 , 1 0 7 ] conv

pls correct my code :
ltv =[354,181,283,107]
conv_rate =[0.3,0.32,0.3,0.3]
def objective(params):
x = params[:4]
alpha = params[4]
beta = params[5]
ltv = params[6:10]
conv_rate = params[10:]
return -np.sum(ltv * conv_rate * nonlinear_regression(x, alpha, beta))
def estimate_optimal_bids(alpha_beta, ltv, conv_rate):
alpha, beta = alpha_beta
# Set up the initial value vector
x0= np.zeros(4)
params0= np.concatenate([x0,[alpha, beta], ltv, conv_rate])
# Set up the bounds for the bids (lower limit =0)
bounds =[(0, None)]*4+[(None, None),(None, None)]+[(0, None)]*4
# Perform optimization
result = minimize(objective, params0, bounds=bounds)
optimal_bids = result.x[:4]
return optimal_bids
# Example usage
alpha_beta_kw8322228=[0.1,0.2] # Replace with actual values
optimal_bids_kw8322228= estimate_optimal_bids(alpha_beta_kw8322228, ltv[0], conv_rate[0])
print("kw8322228- optimal bids:", optimal_bids_kw8322228)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/pv/wv1191lx7kv6ns91rgv99l_h0000gn/T/ipykernel_51013/3450181159.py in
29 # Example usage
30 alpha_beta_kw8322228=[0.1,0.2] # Replace with actual values
--->31 optimal_bids_kw8322228= estimate_optimal_bids(alpha_beta_kw8322228, ltv[0], conv_rate[0])
32 print("kw8322228- optimal bids:", optimal_bids_kw8322228)
/var/folders/pv/wv1191lx7kv6ns91rgv99l_h0000gn/T/ipykernel_51013/3450181159.py in estimate_optimal_bids(alpha_beta, ltv, conv_rate)
16 # Set up the initial value vector
17 x0= np.zeros(4)
--->18 params0= np.concatenate([x0,[alpha, beta], ltv, conv_rate])
19
20 # Set up the bounds for the bids (lower limit =0)
~/opt/anaconda3/lib/python3.9/site-packages/numpy/core/overrides.py in concatenate(*args,**kwargs)
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 2 has 0 dimension(s)

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

What do you understand is meant by OHSAS 18001?

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago