Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Choose the type of classifier. xgb tuned = XGBClassifier ( random _ state = 1 , eval _ metric = logloss ) # Grid

# Choose the type of classifier. xgb tuned = XGBClassifier(random_state=1, eval_metric="logloss") # Grid of parameters to choose from parameters ={"n_estimators": np.arange(50,110,25), "scale_pos_weight": [1,2,5], "subsample": [0.9,1], "learning_rate": [0.01,0.1,0.05], "gamma": [1,3]} # Type of scoring used to compare parameter combinations acc_scorer = metrics.make_scorer(metrics.f1_score) # Run the grid search grid_obj = GridSearchCV(xgb_tuned, parameters, scoring=acc_scorer, cv=5) grid_obj = grid_obj.fit(X_train, y_train) # Set the clf to the best combination of parameters xgb_tuned = grid_obj.best_estimator_ # Fit the best algorithm to the data. xgb_tuned.fit(X_train, y_train) NameError Traceback (most recent call last) Cell In[85], line 21 # Choose the type of classifier. ---->2 xgb_tuned = XGBClassifier(random_state=1, eval_metric="logloss")4 # Grid of parameters to choose from 5 parameters ={6"n_estimators": np.arange(50,110,25),7 "scale_pos_weight": [1,2,5],(...)10 "gamma": [1,3]11} NameError: name 'XGBClassifier' is not defined

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago

Question

The company openly shares plans and information with employees.

Answered: 1 week ago