0% found this document useful (0 votes)
15 views1 page

Random Forestalgorithm

Uploaded by

22eg105n47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Random Forestalgorithm

Uploaded by

22eg105n47
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import pandas as pd

from [Link] import load_digits


digits=load_digits()
%matplotlib inline
import [Link] as plt
[Link]()
for i in range(4):
[Link]([Link][i])
df=[Link]([Link])
df['target']=[Link]
x=[Link]('target',axis='coloumns')
y=[Link]
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)
from [Link] import RandomForestClassifier
model=RandomForestClassifier(n_estimators=20)
[Link](x_train,y_train)
print("model score:",[Link](x_test,y_test))
y_predicted=[Link](x_test)
from [Link] import confusion_matrix
cm=confusion_matrix(y_test,y_predicted)
%matplotlib inline
import [Link] as plt
import seaborn as sn
[Link](figsize=(10,7))
[Link](cn,annot=True)
[Link]('predicted')
[Link]('truth')

You might also like