42 lines (37 with data), 14.3 kB
ÇĽŕ7 îdocutils.nodesöîdocumentöôö)üö}ö(î rawsourceöî öîchildrenö]öh îsectionöôö)üö}ö(hhh]ö(h îtitleöôö)üö}ö(hîCNN+RNNöh]öh îTextöôöîCNN+RNNöůöüö}ö(hhîparentöhhhîsourceöNîlineöNubaî
attributesö}ö(îidsö]öîclassesö]öînamesö]öîdupnamesö]öîbackrefsö]öuîtagnameöhhhhhhîN/Users/futianfan/Downloads/spring2020/DeepPurpose/docs/source/notes/cnnrnn.rstöhKubh î
literal_blocköôö)üö}ö(hî/class DeepPurpose.models.CNN_RNN(nn.Sequential)öh]öhî/class DeepPurpose.models.CNN_RNN(nn.Sequential)öůöüö}ö(hhhh-ubah}ö(h]öh!]öh#]öh%]öh']öî xml:spaceöîpreserveöîforceöëîlanguageöîpythonöîhighlight_argsö}öuh)h+hh*hKhhhhubh î paragraphöôö)üö}ö(hîâCNN_RNN means a GRU/LSTM on top of a CNN on `SMILES <https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system>`_.öh]ö(hî,CNN_RNN means a GRU/LSTM on top of a CNN on öůöüö}ö(hî,CNN_RNN means a GRU/LSTM on top of a CNN on öhhDhhhNhNubh î referenceöôö)üö}ö(hîV`SMILES <https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system>`_öh]öhîSMILESöůöüö}ö(hîSMILESöhhOubah}ö(h]öh!]öh#]öh%]öh']öînameöhWîrefuriöîJhttps://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_systemöuh)hMhhDubh îtargetöôö)üö}ö(hîM <https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system>öh]öh}ö(h]öîsmilesöah!]öh#]öîsmilesöah%]öh']öîrefuriöh`uh)haî
referencedöKhhDubhî.öůöüö}ö(hî.öhhDhhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhhhhubhC)üö}ö(hî**constructor** create CNN_RNNöh]ö(h îstrongöôö)üö}ö(hî**constructor**öh]öhîconstructoröůöüö}ö(hhhhéubah}ö(h]öh!]öh#]öh%]öh']öuh)hÇhh|ubhî create CNN_RNNöůöüö}ö(hî create CNN_RNNöhh|hhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhhhhubh,)üö}ö(hî"__init__(self, encoding, **config)öh]öhî"__init__(self, encoding, **config)öůöüö}ö(hhhhŤubah}ö(h]öh!]öh#]öh%]öh']öh;h<h=ëh>îpythonöh@}öuh)h+hh*hKhhhhubh îbullet_listöôö)üö}ö(hhh]ö(h î list_itemöôö)üö}ö(hîU**encoding** (string, "drug" or "protein") - specify input type, "drug" or "protein".öh]öhC)üö}ö(hh┤h]ö(hü)üö}ö(hî**encoding**öh]öhîencodingöůöüö}ö(hhhh╣ubah}ö(h]öh!]öh#]öh%]öh']öuh)hÇhhÂubhîY (string, ÔÇťdrugÔÇŁ or ÔÇťproteinÔÇŁ) - specify input type, ÔÇťdrugÔÇŁ or ÔÇťproteinÔÇŁ.öůöüö}ö(hîI (string, "drug" or "protein") - specify input type, "drug" or "protein".öhhÂubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhh▓ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hhşhhhh*hNubh▒)üö}ö(hX_ **config** (kwargs, keyword arguments) - specify the parameter of transformer. The keys include
* cnn_drug_filters (list, each element is int) - specify the size of filter when encoding drug, e.g., cnn_drug_filters = [32,64,96].
* cnn_drug_kernels (list, each element is int) - specify the size of kernel when encoding drug, e.g., cnn_drug_kernels = [4,6,8].
* rnn_drug_hid_dim (int) - specify the hidden dimension of RNN when encoding drug, e.g., rnn_drug_hid_dim = 64.
* rnn_drug_n_layers (int) - specify number of layer in RNN when encoding drug, .e.g, rnn_drug_n_layers = 2.
* rnn_drug_bidirectional (bool) - specify if RNN is bidirectional when encoding drug, .e.g, rnn_drug_bidirectional = True.
* hidden_dim_drug (int) - specify the hidden dimension when encoding drug, e.g., hidden_dim_drug = 256.
* cnn_target_filters (list, each element is int) - specify the size of filter when encoding protein, e.g, cnn_target_filters = [32,64,96].
* cnn_target_kernels (list, each element is int) - specify the size of kernel when encoding protein, e.g, cnn_target_kernels = [4,8,12].
* hidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.
* rnn_target_hid_dim (int) - specify hidden dimension of RNN when encoding protein, e.g., rnn_target_hid_dim = 64.
* rnn_target_n_layers (int) - specify the number of layer in RNN when encoding protein, e.g., rnn_target_n_layers = 2.
* rnn_target_bidirectional (bool) - specify if RNN is bidirectional when encoding protein, e.g., rnn_target_bidirectional = True
öh]öh îdefinition_listöôö)üö}ö(hhh]öh îdefinition_list_itemöôö)üö}ö(hX **config** (kwargs, keyword arguments) - specify the parameter of transformer. The keys include
* cnn_drug_filters (list, each element is int) - specify the size of filter when encoding drug, e.g., cnn_drug_filters = [32,64,96].
* cnn_drug_kernels (list, each element is int) - specify the size of kernel when encoding drug, e.g., cnn_drug_kernels = [4,6,8].
* rnn_drug_hid_dim (int) - specify the hidden dimension of RNN when encoding drug, e.g., rnn_drug_hid_dim = 64.
* rnn_drug_n_layers (int) - specify number of layer in RNN when encoding drug, .e.g, rnn_drug_n_layers = 2.
* rnn_drug_bidirectional (bool) - specify if RNN is bidirectional when encoding drug, .e.g, rnn_drug_bidirectional = True.
* hidden_dim_drug (int) - specify the hidden dimension when encoding drug, e.g., hidden_dim_drug = 256.
* cnn_target_filters (list, each element is int) - specify the size of filter when encoding protein, e.g, cnn_target_filters = [32,64,96].
* cnn_target_kernels (list, each element is int) - specify the size of kernel when encoding protein, e.g, cnn_target_kernels = [4,8,12].
* hidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.
* rnn_target_hid_dim (int) - specify hidden dimension of RNN when encoding protein, e.g., rnn_target_hid_dim = 64.
* rnn_target_n_layers (int) - specify the number of layer in RNN when encoding protein, e.g., rnn_target_n_layers = 2.
* rnn_target_bidirectional (bool) - specify if RNN is bidirectional when encoding protein, e.g., rnn_target_bidirectional = True
öh]ö(h îtermöôö)üö}ö(hî_**config** (kwargs, keyword arguments) - specify the parameter of transformer. The keys includeöh]ö(hü)üö}ö(hî
**config**öh]öhîconfigöůöüö}ö(hhhhÝubah}ö(h]öh!]öh#]öh%]öh']öuh)hÇhhÚubhîU (kwargs, keyword arguments) - specify the parameter of transformer. The keys includeöůöüö}ö(hîU (kwargs, keyword arguments) - specify the parameter of transformer. The keys includeöhhÚubeh}ö(h]öh!]öh#]öh%]öh']öuh)hšhh*hK!hhŃubh î
definitionöôö)üö}ö(hhh]öhČ)üö}ö(hhh]ö(h▒)üö}ö(hîécnn_drug_filters (list, each element is int) - specify the size of filter when encoding drug, e.g., cnn_drug_filters = [32,64,96].öh]öhC)üö}ö(hj h]öhîécnn_drug_filters (list, each element is int) - specify the size of filter when encoding drug, e.g., cnn_drug_filters = [32,64,96].öůöüö}ö(hj hj ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhj ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîcnn_drug_kernels (list, each element is int) - specify the size of kernel when encoding drug, e.g., cnn_drug_kernels = [4,6,8].öh]öhC)üö}ö(hj' h]öhîcnn_drug_kernels (list, each element is int) - specify the size of kernel when encoding drug, e.g., cnn_drug_kernels = [4,6,8].öůöüö}ö(hj' hj) ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhj% ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîmrnn_drug_hid_dim (int) - specify the hidden dimension of RNN when encoding drug, e.g., rnn_drug_hid_dim = 64.öh]öhC)üö}ö(hj> h]öhîmrnn_drug_hid_dim (int) - specify the hidden dimension of RNN when encoding drug, e.g., rnn_drug_hid_dim = 64.öůöüö}ö(hj> hj@ ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhj< ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîirnn_drug_n_layers (int) - specify number of layer in RNN when encoding drug, .e.g, rnn_drug_n_layers = 2.öh]öhC)üö}ö(hjU h]öhîirnn_drug_n_layers (int) - specify number of layer in RNN when encoding drug, .e.g, rnn_drug_n_layers = 2.öůöüö}ö(hjU hjW ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjS ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîxrnn_drug_bidirectional (bool) - specify if RNN is bidirectional when encoding drug, .e.g, rnn_drug_bidirectional = True.öh]öhC)üö}ö(hjl h]öhîxrnn_drug_bidirectional (bool) - specify if RNN is bidirectional when encoding drug, .e.g, rnn_drug_bidirectional = True.öůöüö}ö(hjl hjn ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjj ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîehidden_dim_drug (int) - specify the hidden dimension when encoding drug, e.g., hidden_dim_drug = 256.öh]öhC)üö}ö(hjâ h]öhîehidden_dim_drug (int) - specify the hidden dimension when encoding drug, e.g., hidden_dim_drug = 256.öůöüö}ö(hjâ hjů ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjü ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîłcnn_target_filters (list, each element is int) - specify the size of filter when encoding protein, e.g, cnn_target_filters = [32,64,96].öh]öhC)üö}ö(hjÜ h]öhîłcnn_target_filters (list, each element is int) - specify the size of filter when encoding protein, e.g, cnn_target_filters = [32,64,96].öůöüö}ö(hjÜ hjť ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjś ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîćcnn_target_kernels (list, each element is int) - specify the size of kernel when encoding protein, e.g, cnn_target_kernels = [4,8,12].öh]öhC)üö}ö(hj▒ h]öhîćcnn_target_kernels (list, each element is int) - specify the size of kernel when encoding protein, e.g, cnn_target_kernels = [4,8,12].öůöüö}ö(hj▒ hj│ ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhj» ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hînhidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.öh]öhC)üö}ö(hj╚ h]öhînhidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.öůöüö}ö(hj╚ hj╩ ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjĂ ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîprnn_target_hid_dim (int) - specify hidden dimension of RNN when encoding protein, e.g., rnn_target_hid_dim = 64.öh]öhC)üö}ö(hj▀ h]öhîprnn_target_hid_dim (int) - specify hidden dimension of RNN when encoding protein, e.g., rnn_target_hid_dim = 64.öůöüö}ö(hj▀ hjß ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjŢ ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîtrnn_target_n_layers (int) - specify the number of layer in RNN when encoding protein, e.g., rnn_target_n_layers = 2.öh]öhC)üö}ö(hj÷ h]öhîtrnn_target_n_layers (int) - specify the number of layer in RNN when encoding protein, e.g., rnn_target_n_layers = 2.öůöüö}ö(hj÷ hj° ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhj˘ ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubh▒)üö}ö(hîÇrnn_target_bidirectional (bool) - specify if RNN is bidirectional when encoding protein, e.g., rnn_target_bidirectional = True
öh]öhC)üö}ö(hî~rnn_target_bidirectional (bool) - specify if RNN is bidirectional when encoding protein, e.g., rnn_target_bidirectional = Trueöh]öhî~rnn_target_bidirectional (bool) - specify if RNN is bidirectional when encoding protein, e.g., rnn_target_bidirectional = Trueöůöüö}ö(hj hj ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hK hj ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hj ubeh}ö(h]öh!]öh#]öh%]öh']öîbulletöî*öuh)hźhh*hKhj ubah}ö(h]öh!]öh#]öh%]öh']öuh)j hhŃubeh}ö(h]öh!]öh#]öh%]öh']öuh)hßhh*hK!hhŮubah}ö(h]öh!]öh#]öh%]öh']öuh)h▄hhěubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hhşhhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öj) j* uh)hźhh*hKhhhhubhC)üö}ö(hîE**Calling functions** implement the feedforward procedure of CNN_RNN.öh]ö(hü)üö}ö(hî**Calling functions**öh]öhîCalling functionsöůöüö}ö(hhhjM ubah}ö(h]öh!]öh#]öh%]öh']öuh)hÇhjI ubhî0 implement the feedforward procedure of CNN_RNN.öůöüö}ö(hî0 implement the feedforward procedure of CNN_RNN.öhjI hhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hK#hhhhubh,)üö}ö(hîforward(self, v)öh]öhîforward(self, v)öůöüö}ö(hhhjf ubah}ö(h]öh!]öh#]öh%]öh']öh;h<h=ëh>îpythonöh@}öuh)h+hh*hK&hhhhubhČ)üö}ö(hhh]öh▒)üö}ö(hî3**v** (torch.Tensor) - input feature of CNN_RNN.
öh]öhC)üö}ö(hî0**v** (torch.Tensor) - input feature of CNN_RNN.öh]ö(hü)üö}ö(hî**v**öh]öhîvöůöüö}ö(hhhjü ubah}ö(h]öh!]öh#]öh%]öh']öuh)hÇhj} ubhî+ (torch.Tensor) - input feature of CNN_RNN.öůöüö}ö(hî+ (torch.Tensor) - input feature of CNN_RNN.öhj} ubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hK+hjy ubah}ö(h]öh!]öh#]öh%]öh']öuh)h░hjv hhhh*hNubah}ö(h]öh!]öh#]öh%]öh']öj) j* uh)hźhh*hK+hhhhubeh}ö(h]öîcnn-rnnöah!]öh#]öîcnn+rnnöah%]öh']öuh)h hhhhhh*hKubah}ö(h]öh!]öh#]öh%]öh']öîsourceöh*uh)hîcurrent_sourceöNîcurrent_lineöNîsettingsöîdocutils.frontendöîValuesöôö)üö}ö(hNî generatoröNî datestampöNîsource_linköNî
source_urlöNî
toc_backlinksöîentryöîfootnote_backlinksöKî
sectnum_xformöKîstrip_commentsöNîstrip_elements_with_classesöNî
strip_classesöNîreport_levelöKî
halt_levelöKîexit_status_levelöKîdebugöNîwarning_streamöNî tracebacköłîinput_encodingöî utf-8-sigöîinput_encoding_error_handleröîstrictöîoutput_encodingöîutf-8öîoutput_encoding_error_handleröjĐ îerror_encodingöîUTF-8öîerror_encoding_error_handleröîbackslashreplaceöî
language_codeöîenöîrecord_dependenciesöNîconfigöNî id_prefixöhîauto_id_prefixöîidöî
dump_settingsöNîdump_internalsöNîdump_transformsöNîdump_pseudo_xmlöNîexpose_internalsöNîstrict_visitoröNî_disable_configöNî_sourceöh*î_destinationöNî
_config_filesö]öîpep_referencesöNîpep_base_urlöî https://www.python.org/dev/peps/öîpep_file_url_templateöîpep-%04döîrfc_referencesöNîrfc_base_urlöîhttps://tools.ietf.org/html/öî tab_widthöKîtrim_footnote_reference_spaceöëîfile_insertion_enabledöłîraw_enabledöKîsyntax_highlightöîlongöîsmart_quotesöłîsmartquotes_localesö]öîcharacter_level_inline_markupöëîdoctitle_xformöëî
docinfo_xformöKîsectsubtitle_xformöëîembed_stylesheetöëîcloak_email_addressesöłîenvöNubîreporteröNîindirect_targetsö]öîsubstitution_defsö}öîsubstitution_namesö}öîrefnamesö}öîrefidsö}öînameidsö}ö(jź jĘ hlhiuî nametypesö}ö(jź Nhlłuh}ö(jĘ hhihcuî
footnote_refsö}öî
citation_refsö}öî
autofootnotesö]öîautofootnote_refsö]öîsymbol_footnotesö]öîsymbol_footnote_refsö]öî footnotesö]öî citationsö]öîautofootnote_startöKîsymbol_footnote_startöK î
id_counteröîcollectionsöîCounteröôö}öůöRöîparse_messagesö]öîtransform_messagesö]öîtransformeröNî
decorationöNhhub.