Complete the code to import the CatBoostClassifier from the catboost library.
from catboost import [1]
The CatBoostClassifier is the main class used for classification tasks in CatBoost.
Complete the code to create a CatBoostClassifier model with 100 trees.
model = CatBoostClassifier([1]=100)
The 'iterations' parameter sets the number of trees (boosting rounds) in CatBoost.
Fix the error in the code to fit the CatBoost model on training data X_train and y_train.
model.fit([1], y_train)The fit method requires the features (X_train) as the first argument and the target (y_train) as the second.
Fill both blanks to create predictions and calculate accuracy score using sklearn.
from sklearn.metrics import {{BLANK_1 }} predictions = model.predict(X_test) accuracy = {{BLANK_2}}(y_test, predictions)
We import accuracy_score to measure how many predictions match the true labels. Then we use accuracy_score to calculate accuracy.
Fill all three blanks to create a CatBoostClassifier with depth 6, learning rate 0.1, and random seed 42.
model = CatBoostClassifier(depth=[1], learning_rate=[2], random_seed=[3])
The 'depth' controls tree depth, 'learning_rate' controls step size, and 'random_seed' ensures reproducibility.