Predictive analytics uses historical data to fit a statistical or machine-learning model, then uses that model to estimate outcomes for new observations. A fitted regression equation, for example, can estimate a house price from its square footage and number of bedrooms. section 9.1.2
A practical modeling workflow begins with the decision the prediction will support:
- Ask what needs predicting, such as whether users will complete a paid sign-up or how many daily rat sightings might be reported. section 9.2
- Explore possible predictors. Weather variables correlated with rat sightings offer candidates; business hypotheses can also identify inputs worth examining. section 9.2 section 9.3.3
- Fit and test a model, then choose a useful deliverable. A product operations team might need adjustable inputs for estimating a new product’s profit margin, even in a spreadsheet. section 9.1.2 section 9.3.3
import statsmodels.api as sm
import pandas as pd
housing_prices = pd.read_csv("housing_prices.csv") #1
X = housing_prices[["sq_footage", "n_bedrooms"]]
y = housing_prices["price"] #2
X = sm.add_constant(X) #3
model = sm.OLS(y, X).fit() #4
print(model.summary())
The Python listing selects house features and prices, fits an ordinary least squares regression with statsmodels, and prints its summary. The fitted coefficients provide an equation for making estimates. section 9.1.2
Prediction requires more than readable coefficients: coefficients alone do not establish predictive ability. Assess diagnostics together; for a profit-margin model, suggested metrics include R², AIC, BIC, and RMSE. Check whether the training data represents where the model will be used. A house-price equation fitted in one geographic region may not transfer elsewhere, and omitted inputs such as renovations or commuting distance may matter. section 9.1.2 section 9.3.3
Explanation versus prediction
A finance team might use regression to report the direction and strength of relationships with product profit margins. A product operations team instead needs accurate estimates for new products and may try derived features or, optionally, a random forest to improve predictive power. section 9.3.3


