0
0
ML Pythonml~10 mins

CatBoost in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the CatBoostClassifier from the catboost library.

ML Python
from catboost import [1]
Drag options to blanks, or click blank then click option'
ARandomForestClassifier
BCatBoostClassifier
CSVC
DKNeighborsClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Importing other classifiers like RandomForestClassifier instead of CatBoostClassifier.
Misspelling the class name.
2fill in blank
medium

Complete the code to create a CatBoostClassifier model with 100 trees.

ML Python
model = CatBoostClassifier([1]=100)
Drag options to blanks, or click blank then click option'
Adepth
Brandom_seed
Citerations
Dlearning_rate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'learning_rate' to set number of trees instead of 'iterations'.
Confusing 'depth' with number of trees.
3fill in blank
hard

Fix the error in the code to fit the CatBoost model on training data X_train and y_train.

ML Python
model.fit([1], y_train)
Drag options to blanks, or click blank then click option'
AX_train
BX_test
Cy_train
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Passing y_train as the first argument instead of X_train.
Passing test data instead of training data.
4fill in blank
hard

Fill both blanks to create predictions and calculate accuracy score using sklearn.

ML Python
from sklearn.metrics import {{BLANK_1 }}
predictions = model.predict(X_test)
accuracy = {{BLANK_2}}(y_test, predictions)
Drag options to blanks, or click blank then click option'
Aaccuracy_score
Bmean_squared_error
Cclassification_report
Dconfusion_matrix
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean_squared_error which is for regression, not classification.
Using confusion_matrix which returns a matrix, not a score.
5fill in blank
hard

Fill all three blanks to create a CatBoostClassifier with depth 6, learning rate 0.1, and random seed 42.

ML Python
model = CatBoostClassifier(depth=[1], learning_rate=[2], random_seed=[3])
Drag options to blanks, or click blank then click option'
A6
B0.1
C42
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up learning rate and depth values.
Using random_seed values outside typical range.