nipype.interfaces.afni.svm module

AFNI’s svm interfaces.

SVMTest

Link to code

Bases: AFNICommand

Wrapped executable: 3dsvm.

Temporally predictive modeling with the support vector machine SVM Test Only For complete details, see the 3dsvm Documentation.

Examples

>>> from nipype.interfaces import afni as afni
>>> svmTest = afni.SVMTest()
>>> svmTest.inputs.in_file= 'run2+orig'
>>> svmTest.inputs.model= 'run1+orig_model'
>>> svmTest.inputs.testlabels= 'run2_categories.1D'
>>> svmTest.inputs.out_file= 'pred2_model1'
>>> res = svmTest.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – A 3D or 3D+t AFNI brik dataset to be used for testing. Maps to a command-line argument: -testvol %s.

  • model (a string) – Modname is the basename for the brik containing the SVM model. Maps to a command-line argument: -model %s.

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • classout (a boolean) – Flag to specify that pname files should be integer-valued, corresponding to class category decisions. Maps to a command-line argument: -classout.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • multiclass (a boolean) – Specifies multiclass algorithm for classification. Maps to a command-line argument: -multiclass %s.

  • nodetrend (a boolean) – Flag to specify that pname files should not be linearly detrended. Maps to a command-line argument: -nodetrend.

  • nopredcensord (a boolean) – Flag to prevent writing predicted values for censored time-points. Maps to a command-line argument: -nopredcensord.

  • num_threads (an integer) – Set number of threads. (Nipype default value: 1)

  • options (a string) – Additional options for SVM-light. Maps to a command-line argument: %s.

  • out_file (a pathlike object or string representing a file) – Filename for .1D prediction file(s). Maps to a command-line argument: -predictions %s.

  • outputtype (‘NIFTI’ or ‘AFNI’ or ‘NIFTI_GZ’) – AFNI output filetype.

  • testlabels (a pathlike object or string representing an existing file) – true class category .1D labels for the test dataset. It is used to calculate the prediction accuracy performance. Maps to a command-line argument: -testlabels %s.

Outputs:

out_file (a pathlike object or string representing an existing file) – Output file.

SVMTrain

Link to code

Bases: AFNICommand

Wrapped executable: 3dsvm.

Temporally predictive modeling with the support vector machine SVM Train Only For complete details, see the 3dsvm Documentation.

Examples

>>> from nipype.interfaces import afni as afni
>>> svmTrain = afni.SVMTrain()
>>> svmTrain.inputs.in_file = 'run1+orig'
>>> svmTrain.inputs.trainlabels = 'run1_categories.1D'
>>> svmTrain.inputs.ttype = 'regression'
>>> svmTrain.inputs.mask = 'mask.nii'
>>> svmTrain.inputs.model = 'model_run1'
>>> svmTrain.inputs.alphas = 'alphas_run1'
>>> res = svmTrain.run() 
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – A 3D+t AFNI brik dataset to be used for training. Maps to a command-line argument: -trainvol %s.

  • ttype (a string) – Tname: classification or regression. Maps to a command-line argument: -type %s.

Optional Inputs:
  • alphas (a pathlike object or string representing a file) – Output alphas file name. Maps to a command-line argument: -alpha %s.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • censor (a pathlike object or string representing an existing file) – .1D censor file that allows the user to ignore certain samples in the training data. Maps to a command-line argument: -censor %s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • kernel (a string) – String specifying type of kernel function:linear, polynomial, rbf, sigmoid. Maps to a command-line argument: -kernel %s.

  • mask (a pathlike object or string representing an existing file) – Byte-format brik file used to mask voxels in the analysis. Maps to a command-line argument: -mask %s (position: -1).

  • max_iterations (an integer) – Specify the maximum number of iterations for the optimization. Maps to a command-line argument: -max_iterations %d.

  • model (a pathlike object or string representing a file) – Basename for the brik containing the SVM model. Maps to a command-line argument: -model %s.

  • nomodelmask (a boolean) – Flag to enable the omission of a mask file. Maps to a command-line argument: -nomodelmask.

  • num_threads (an integer) – Set number of threads. (Nipype default value: 1)

  • options (a string) – Additional options for SVM-light. Maps to a command-line argument: %s.

  • out_file (a pathlike object or string representing a file) – Output sum of weighted linear support vectors file name. Maps to a command-line argument: -bucket %s.

  • outputtype (‘NIFTI’ or ‘AFNI’ or ‘NIFTI_GZ’) – AFNI output filetype.

  • trainlabels (a pathlike object or string representing an existing file) – .1D labels corresponding to the stimulus paradigm for the training data. Maps to a command-line argument: -trainlabels %s.

  • w_out (a boolean) – Output sum of weighted linear support vectors. Maps to a command-line argument: -wout.

Outputs:
  • alphas (a pathlike object or string representing a file) – Output alphas file name.

  • model (a pathlike object or string representing a file) – Brik containing the SVM model file name.

  • out_file (a pathlike object or string representing a file) – Sum of weighted linear support vectors file name.