0
$\begingroup$

I have run Random forest regression with python and I have the fear that I haven't done it correct.

I have original image that has 3 different bands (each pixels has 3 values) and I want to try to see if I can predict the first value using the two others.

For that I used Random Forest regression, I have created train and test and fit the model:

rf.fit(X_train,y_train)
rf_pred=rf.predict(X_test)

then after I checked the prediction on the test and saw it was good, I wanted to use the same model in order to predict all the values of all the pixels in the image, so I did that:

pred_all=rf.predict(data)

*data includes all the pixels of the image.

My question : is this the right way to do this? can I just predict all the pixel values just by using the rf.predict after fit it with the train and test sets? Or am I missing here some step that should be taken?

$\endgroup$

1 Answer 1

1
$\begingroup$

It seems good. (Understanding that you are not getting any error)

You are fitting your model in some data, then evaluating on other (basic validation).

Now you have to find data that have the same format and similar distribution and predict there.

You can have a look at the random forest documentation to see what else you can do

https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.