Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please write a brief program about the 2 model predictions below? ## making predictions using the Random Forest algorithm from sklearn.ensemble import RandomForestRegressor

image text in transcribed

Could you please write a brief program about the 2 model predictions below?

image text in transcribed
## making predictions using the Random Forest algorithm from sklearn.ensemble import RandomForestRegressor forest_model = RandomForestRegressor(n_estimators=100, max_depth=10) forest_model.fit(train_x, train_y ) predicted_random_forest = forest_model.predict(test_x) print("Mean Absolute Error using Random Forest:", mean_absolute_error(test_y, predicted_random_forest)) Mean Absolute Error using Random Forest: 16582.607091473192 ## making predictions using the Decision Tree algorithm from sklearn.tree import DecisionTreeRegressor decision_model = DecisionTreeRegressor() decision_model.fit(train_x, train_y ) predicted_decision_trees = decision_model.predict(test_x) print("Mean Absolute Error using Decision Trees:", mean_absolute_error(test_y, predicted_decision_trees)) Mean Absolute Error using Decision Trees: 26562.54520547945

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mathematical Logic Foundations For Information Science

Authors: Wei Li

2nd Edition

3034808623, 9783034808620

More Books

Students also viewed these Mathematics questions

Question

What are the purposes of promotion ?

Answered: 1 week ago

Question

1. Too reflect on self-management

Answered: 1 week ago

Question

Food supply

Answered: 1 week ago