Memuat
Memuat
Random Forest Regression for Forestry and Environment
0 views
Model aboveground biomass from ndvi and canopy height using Random Forest Regression and evaluate the model performance. Random forest regression averages many decision trees trained on bootstrap samples, capturing nonlinear relations and interactions. It suits theses with tabular data whose patterns are not linear.

Model aboveground biomass from ndvi and canopy height using Random Forest Regression and evaluate the model performance.
| Role | Variable | Unit |
|---|---|---|
| Main | Aboveground biomass | ton/ha |
| Supporting 1 | NDVI | - |
| Supporting 2 | Canopy height | m |
Random forest regression predicts Aboveground biomass with test R2 0.851 and RMSE 1.624; the most important predictor is NDVI (importance 0.838).
Computed from illustrative synthetic data, not from a real study.
Random forest regression averages many decision trees trained on bootstrap samples, capturing nonlinear relations and interactions. It suits theses with tabular data whose patterns are not linear.
Report R2, RMSE, and feature importance ranking as an indication of dominant variables, not causation. Compare with a linear baseline to show the added value.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_error
rng = np.random.default_rng(7)
n = 400
ndvi = rng.uniform(0, 10, n)
canopy_height = rng.uniform(0, 5, n)
x3 = rng.normal(size=n)
aboveground_biomass = np.sin(ndvi) * 3 + canopy_height ** 2 + 0.2 * x3 + rng.normal(0, 0.5, n)
X = np.column_stack([ndvi, canopy_height, x3])
X_tr, X_te, y_tr, y_te = train_test_split(X, aboveground_biomass, test_size=0.2, random_state=7)
rf = RandomForestRegressor(n_estimators=300, min_samples_leaf=3, oob_score=True, random_state=7)
rf.fit(X_tr, y_tr)
pred = rf.predict(X_te)
print("OOB R2:", round(rf.oob_score_, 3))
print("Test R2:", round(r2_score(y_te, pred), 3))
print("Test RMSE:", round(mean_squared_error(y_te, pred) ** 0.5, 3))
print("Importance:", rf.feature_importances_.round(3))
fig, ax = plt.subplots(1, 2, figsize=(10, 4))
ax[0].scatter(y_te, pred)
ax[0].plot([y_te.min(), y_te.max()], [y_te.min(), y_te.max()], "r--")
ax[0].set_xlabel("Actual"); ax[0].set_ylabel("Predicted")
ax[1].bar(["x1", "x2", "x3"], rf.feature_importances_)
ax[1].set_title("Feature importance")
plt.tight_layout()
plt.show()Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$22
excl. 11% VAT
Duration: 5 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$66
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$144
excl. 11% VAT
Duration: 14-17 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Random Forest Regression is commonly used at this level in Forestry and Environment. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output Python gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$22, Package 2 (your data analysis and interpretation) US$66 and Package 3 (full guidance) US$144, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. Python is a trademark of the Python Software Foundation.
Back to Python portfolio