<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 &larr; Back to Index
Cross Validation
<a href="https
Step1:  Plot their features
Step2:  Initialize the classifier
Step3:  Perform 5-fold cross validation
<ASSISTANT_TASK:>
Python Code:
training_features, training_labels, scaler = stanford_mir.get_features()
print training_labels
Explanation: &larr; Back to Index
Cross Validation
<a href="https://en.wikipedia.org/wiki/Cross-validation_(statistics)">K-fold cross validation</a> is a method for evaluating the correctness of a classifier.
For example, with 10-fold cross validation:
Divide the data set into 10 random partitions.
Choose one of the partitions as the test set. Train on the other nine partitions.
Repeat for the partitions.
Load some features from ten kick drums and ten snare drums:
End of explanation
plt.scatter(training_features[:,0], training_features[:,1])
Explanation: Plot their features:
End of explanation
model = sklearn.neighbors.KNeighborsClassifier(n_neighbors=3)
model = sklearn.linear_model.LogisticRegression()
Explanation: Initialize the classifier:
End of explanation
acc  = sklearn.cross_validation.cross_val_score(model, random_features, training_labels, cv=5)
print acc.mean()
k
Explanation: Perform 5-fold cross validation:
End of explanation
<END_TASK>