Prices for New Rows
train has columns size, age and price. new has only size and age. Fit price on size and age using train, and return the predicted price of every row of new.
Example 1
train {"size":[0,1,0,1,2],"age":[0,0,1,1,2],"price":[1,3,6,8,15]}
new {"size":[3,0],"age":[0,4]}
returns [7.0,21.0]
The training prices follow 1 + 2 * size + 5 * age, so the new rows come to 7 and 21.
Constraints
5 <= len(train) <= 401 <= len(new) <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- Range for the SlopeEasy
- Two CausesEasy
- Better of Two ModelsMedium
- Chance of YesMedium
- Does One Change the OtherMedium
- Model for CountsMedium
- Odds of YesMedium
- Pattern in the LeftoversMedium