code: def example_of_cross_validation_with_detailed_info(
      raw_data, labels, num_subjects, num_epochs_per_subj
  ):
      # no shrinking, set C=1
      svm_clf = svm.SVC(
          kernel="precomputed", shrinking=False, C=1, gamma="auto"
      )
      # logit_clf = LogisticRegression()
      clf = Classifier(svm_clf, epochs_per_subj=num_epochs_per_subj)
      # doing leave-one-subject-out cross validation
      for i in range(num_subjects):
          leave_start = i * num_epochs_per_subj
          leave_end = (i + 1) * num_epochs_per_subj
          training_data = raw_data[0:leave_start] + raw_data[leave_end:]
          test_data = raw_data[leave_start:leave_end]
          training_labels = labels[0:leave_start] + labels[leave_end:]
          test_labels = labels[leave_start:leave_end]
          clf.fit(
              list(zip(training_data, training_data)), training_labels
          )
          # joblib can be used for saving and loading models
          # joblib.dump(clf, 'model/logistic.pkl')
          # clf = joblib.load('model/svm.pkl')
          predict = clf.predict(list(zip(test_data, test_data)))
          print(predict)
          print(clf.decision_function(list(zip(test_data, test_data))))
          incorrect_predict = (
              hamming(predict, np.asanyarray(test_labels))
              * num_epochs_per_subj
          )
          logger.info(
              "when leaving subject %d out for testing, the accuracy is %d / %d = %.2f"
              % (
                  i,
                  num_epochs_per_subj - incorrect_predict,
                  num_epochs_per_subj,
                  (num_epochs_per_subj - incorrect_predict)
                  * 1.0
                  / num_epochs_per_subj,
              )
          )
          print(clf.score(list(zip(test_data, test_data)), test_labels))
  
file_path: brainiak/examples/fcma/classification.py
imports: from brainiak.fcma.classifier import Classifier
  from brainiak.fcma.preprocessing import prepare_fcma_data
  from brainiak import io
  from sklearn import svm
  import sys
  import logging
  import numpy
  from scipy.spatial.distance import hamming
  from sklearn import model_selection
label_desc: Use image node_id 2 for calling a global function with example usage: example_of_cross_validation_with_detailed_info(raw_data, labels, num_subjects, num_epochs_per_subj) without return types