3
d                 @   s   d Z ddlmZmZmZ ddlmZmZmZ G dd deZG dd deZ	G d	d
 d
eZ
G dd deZG dd deZdS )zAFNI's svm interfaces.   )TraitedSpectraitsFile   )AFNICommandAFNICommandInputSpecAFNICommandOutputSpecc               @   s   e Zd ZejddddZeddddddZed	d
ddddZeddddddZ	eddddddZ
eddd,dddZejdddZedddd Zed!d"dd Zejd#d$dZejd%d&dZejd'd(dZejd)d*dZd+S )-SVMTrainInputSpecz#tname: classification or regressionz-type %sT)descargstr	mandatoryz1A 3D+t AFNI brik dataset to be used for training.z-trainvol %sF)r
   r   r   existscopyfilez
%s_vectorsz7output sum of weighted linear support vectors file namez
-bucket %sZ_bucketin_file)name_templater
   r   suffixZname_sourcez%s_modelz.basename for the brik containing the SVM modelz	-model %s_modelz	%s_alphaszoutput alphas file namez	-alpha %sZ_alphasz9byte-format brik file used to mask voxels in the analysisz-mask %sr   )r
   r   positionr   r   z*Flag to enable the omission of a mask filez-nomodelmask)r
   r   zH.1D labels corresponding to the stimulus paradigm for the training data.z-trainlabels %s)r
   r   r   zT.1D censor file that allows the user to ignore certain samples in the training data.z
-censor %szJstring specifying type of kernel function:linear, polynomial, rbf, sigmoidz
-kernel %sz>Specify the maximum number of iterations for the optimization.z-max_iterations %dz-output sum of weighted linear support vectorsz-woutz additional options for SVM-lightz%sN)__name__
__module____qualname__r   StrZttyper   r   out_filemodelalphasmaskBoolZnomodelmaskZtrainlabelsZcensorkernelZIntZmax_iterationsZw_outoptions r    r    </tmp/pip-build-7vycvbft/nipype/nipype/interfaces/afni/svm.pyr	   
   sf   

r	   c               @   s*   e Zd ZeddZeddZeddZdS )SVMTrainOutputSpecz0sum of weighted linear support vectors file name)r
   z'brik containing the SVM model file namezoutput alphas file nameN)r   r   r   r   r   r   r   r    r    r    r!   r"   M   s   

r"   c                   s2   e Zd ZdZdZeZeZdgZ	 fddZ
  ZS )SVMTraina  Temporally predictive modeling with the support vector machine
    SVM Train Only
    For complete details, see the `3dsvm Documentation.
    <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dsvm.html>`_

    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() # doctest: +SKIP

    3dsvmr   c                s   t t| j|||S )N)superr#   _format_arg)selfnameZ
trait_specvalue)	__class__r    r!   r&   m   s    zSVMTrain._format_arg)r   r   r   __doc___cmdr	   
input_specr"   output_specZ_additional_metadatar&   __classcell__r    r    )r*   r!   r#   S   s   r#   c               @   s   e Zd ZejddddZedddddZedd	d
dZeddddZ	ej
dddZej
dddZej
dddZej
dddZejdddZdS )SVMTestInputSpecz=modname is the basename for the brik containing the SVM modelz	-model %sT)r
   r   r   z6A 3D or 3D+t AFNI brik dataset to be used for testing.z-testvol %s)r
   r   r   r   z%s_predictionsz$filename for .1D prediction file(s).z-predictions %s)r   r
   r   zr*true* class category .1D labels for the test dataset. It is used to calculate the prediction accuracy performancez-testlabels %s)r
   r   r   zeFlag to specify that pname files should be integer-valued, corresponding to class category decisions.z	-classout)r
   r   zAFlag to prevent writing predicted values for censored time-pointsz-nopredcensordzAFlag to specify that pname files should not be linearly detrendedz
-nodetrendz1Specifies multiclass algorithm for classificationz-multiclass %sz additional options for SVM-lightz%sN)r   r   r   r   r   r   r   r   r   Z
testlabelsr   ZclassoutZnopredcensordZ	nodetrendZ
multiclassr   r    r    r    r!   r0   q   s<   r0   c               @   s   e Zd ZdZdZeZeZdS )SVMTesta6  Temporally predictive modeling with the support vector machine
    SVM Test Only
    For complete details, see the `3dsvm Documentation.
    <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dsvm.html>`_

    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() # doctest: +SKIP

    r$   N)	r   r   r   r+   r,   r0   r-   r   r.   r    r    r    r!   r1      s   r1   N)r+   baser   r   r   r   r   r   r	   r"   r#   r0   r1   r    r    r    r!   <module>   s   C*