A random forest predicts numeric values by combining many decision trees. Here, RandomForestRegressor receives one-hot-encoded medicine features and learns to estimate prices. section 4.5.4
Evaluate price predictions with complementary metrics:
- R² measures how much price variation the model explains. section 4.5.4
- MAE reports the typical prediction error in currency units. section 4.5.4
- RMSE emphasizes occasional large, costly errors. section 4.5.4
Medicine price prediction
One-hot-encode categorical fields such as salt and manufacturer, train the random forest on the training set, predict prices for held-out data, and inspect the resulting metrics and residual plots. section 4.5.4
















