that is used for randomization.
model = LinearSVC(max_iter=20000)
Now, we are initializing the model using LinearSVC class. We are increasing the maximum number of iterations to 20000.
kfold = KFold(n_splits=10, shuffle=True, random_state=1)
Then, we are initializing the k-fold cross-validation with 10 splits. Also, we are shuffling the data before splitting, and random_state is used to initialize the pseudo-random number generator that is used for randomization.
scores = cross_val_score(model, X, y, cv=kfold, scoring="accuracy")
Now, we can use the cross_val_score() function to estimate the performance of the model. We are using the accuracy score here (What is the accuracy score in machine learning?) We will get an accuracy score for each iteration of the k-fold cross-validation. We are printing the average accuracy score.
The output of the given program will be:
Accuracy: 0.655








































0 Comments