Horje
sklearn random forest regressor Code Example
sklearn random forest regressor
from sklearn.ensemble import RandomForestRegressor


clf = RandomForestRegressor(max_depth=2, random_state=0)

clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))
how to use random tree in python
from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
sklearn random forest
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification


X, y = make_classification(n_samples=1000, n_features=4,
                            n_informative=2, n_redundant=0,
                            random_state=0, shuffle=False)
clf = RandomForestClassifier(max_depth=2, random_state=0)

clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))




Python

Related
numpy find rows containing nan Code Example numpy find rows containing nan Code Example
how to read docx file in python Code Example how to read docx file in python Code Example
how to replace a word in csv file using python Code Example how to replace a word in csv file using python Code Example
seaborn axis limits Code Example seaborn axis limits Code Example
draw a single pixel using pygame Code Example draw a single pixel using pygame Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9