Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to perform the MinnMax scaler for cross validation before modeling what is the code that I should put to implement it In [8]:

I want to perform the MinnMax scaler for cross validation before modeling what is the code that I should put to implement it
image text in transcribed
In [8]: from imblearn. under_sampling import RandomUnderSampler x2=df.drop('Class', axis=1) y2=df[ 'Class'] \[ \begin{array}{l}\text { undersample = RandomUnderSampler(sampling_strategy='majority') } \\ x 2, y 2=\text { undersample.fit_resample( } x, y)\end{array} \] In [16]: M kf2= RepeatedStratifiedKFold(n_splits =5, n_repeats=2e, random_state=101) In [ ]: M \# Feature scaling scaler = MinMaxscaler() \# \#???????????????????????? In [11]: M DT Random oversampler dt = DecisionTreeclassifier(random_state=101) scores=cross_validate(dt, x2,y2,cv=k+2, scoring [ [ accuracy', 'precision', 'recall']) print( 'Accuracy:', scores['test, accuracy'], mean())) print('Precision: ', scores['test_precision'], mean()) print('Recal1:', scores['test_reca11'], mean())

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions