a guest Jan 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import numpy as np
- from sklearn import linear_model
- from sklearn.linear_model import LinearRegression
- class MarketingCosts:
- # param marketing_expenditure list. Expenditure for each previous campaign.
- # param units_sold list. The number of units sold for each previous campaign.
- # param desired_units_sold int. Target number of units to sell in the new campaign.
- # returns float. Required amount of money to be invested.
- def desired_marketing_expenditure(marketing_expenditure, units_sold, desired_units_sold):
- X= 
- Y = 
- for k in units_sold:
- X = np.array(X)
- reg = LinearRegression().fit(X, Y)
- hasil = reg.predict(np.array(desired_units_sold))
- return hasil
- #For example, with the parameters below the function should return 250000.0.
- [300000, 200000, 400000, 300000, 100000],
- [60000, 50000, 90000, 80000, 30000],
RAW Paste Data