Memuat
Memuat
Random Forest Regression for Tourism and Hospitality
0 views
Predict village tourism income from number of attractions and distance to city with Random Forest and assess feature importance and accuracy. 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.

Predict village tourism income from number of attractions and distance to city with Random Forest and assess feature importance and accuracy.
| Role | Variable | Unit |
|---|---|---|
| Main | village tourism income | Rp juta |
| Supporting 1 | number of attractions | buah |
| Supporting 2 | distance to city | km |
Random forest regression predicts village tourism income with test R2 0.695 and RMSE 14.400; the most important predictor is number of attractions (importance 0.786).
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
number_of_attractions = rng.uniform(0, 10, n)
distance_to_city = rng.uniform(0, 5, n)
x3 = rng.normal(size=n)
village_tourism_income = np.sin(number_of_attractions) * 3 + distance_to_city ** 2 + 0.2 * x3 + rng.normal(0, 0.5, n)
X = np.column_stack([number_of_attractions, distance_to_city, x3])
X_tr, X_te, y_tr, y_te = train_test_split(X, village_tourism_income, 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$59
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$131
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 Tourism and Hospitality. 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$59 and Package 3 (full guidance) US$131, 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