Question: what is the pseudo code for this code ### Random Forest column _ range = all _ Program.columns [ all _ Program.columns.get _ loc (
what is the pseudo code for this code
### Random Forest
columnrange allProgram.columnsallProgram.columns.getlocI:allProgram.columns.getlocR
importantfeatures allProgram.loc: columnrange.tolistDecision Type'
catcols importantfeatures.selectdtypesincludeobjectcolumns
ledict
for col in catcols:
le LabelEncoder
importantfeaturescol lefittransformimportantfeaturescol
ledictcol le
X importantfeatures.dropDecision Type', axis
y importantfeaturesDecision Type'
Xtrain, Xtest, ytrain, ytest traintestsplitX y testsize randomstate
modelrf RandomForestClassifierrandomstate classweight'balanced'
modelrffitXtrain, ytrain
ypred modelrfpredictXtest
accuracy accuracyscoreytest, ypred
printfAccuracy with selected features: accuracy:f
classnamemap
: 'Withdrawal of Program Accreditation',
: Reaccreditation',
: 'Conditional for Months',
: 'Conditional for months',
: 'Conditional for Months',
: 'Warning for Freezing',
: 'Freezing of Program Accreditation',
: 'New Program Accreditation',
: 'Decline'
classnames classnamemapname for name in yunique
report classificationreportytest, ypred, targetnamesclassnames
printreport
cm confusionmatrixytest, ypred, labelsmodelrfclasses
pltfigurefigsize
snsheatmapcm annotTrue, fmtg cmap'BuPu', cbarFalse, xticklabelsclassnames, yticklabelsclassnames
pltxlabelPredicted labels'
pltylabelTrue labels'
plttitleConfusion Matrix'
pltshow
and how to interpitation the model
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
