34 lines (26 with data), 11.3 kB
ÇĽ, îdocutils.nodesöîdocumentöôö)üö}ö(î rawsourceöî öîchildrenö]öh îsectionöôö)üö}ö(hhh]ö(h îtitleöôö)üö}ö(hîCNNöh]öh îTextöôöîCNNöůöüö}ö(hhîparentöhhhîsourceöNîlineöNubaî
attributesö}ö(îidsö]öîclassesö]öînamesö]öîdupnamesö]öîbackrefsö]öuîtagnameöhhhhhhîK/Users/futianfan/Downloads/spring2020/DeepPurpose/docs/source/notes/cnn.rstöhKubh î
literal_blocköôö)üö}ö(hî+class DeepPurpose.models.CNN(nn.Sequential)öh]öhî+class DeepPurpose.models.CNN(nn.Sequential)öůöüö}ö(hhhh-ubah}ö(h]öh!]öh#]öh%]öh']öî xml:spaceöîpreserveöîforceöëîlanguageöîpythonöîhighlight_argsö}öuh)h+hh*hKhhhhubh î paragraphöôö)üö}ö(hîÚ`CNN (Convolutional Neural Network) <https://en.wikipedia.org/wiki/Convolutional_neural_network>`_ can be used to encode both drug and protein on `SMILES <https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system>`_.öh]ö(h î referenceöôö)üö}ö(hîb`CNN (Convolutional Neural Network) <https://en.wikipedia.org/wiki/Convolutional_neural_network>`_öh]öhî"CNN (Convolutional Neural Network)öůöüö}ö(hî"CNN (Convolutional Neural Network)öhhJubah}ö(h]öh!]öh#]öh%]öh']öînameöî"CNN (Convolutional Neural Network)öîrefuriöî:https://en.wikipedia.org/wiki/Convolutional_neural_networköuh)hHhhDubh îtargetöôö)üö}ö(hî= <https://en.wikipedia.org/wiki/Convolutional_neural_network>öh]öh}ö(h]öî cnn-convolutional-neural-networköah!]öh#]öî"cnn (convolutional neural network)öah%]öh']öîrefuriöh\uh)h]î
referencedöKhhDubhî0 can be used to encode both drug and protein on öůöüö}ö(hî0 can be used to encode both drug and protein on öhhDhhhNhNubhI)üö}ö(hîV`SMILES <https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system>`_öh]öhîSMILESöůöüö}ö(hîSMILESöhhrubah}ö(h]öh!]öh#]öh%]öh']öînameöhzh[îJhttps://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_systemöuh)hHhhDubh^)üö}ö(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)h]hlKhhDubhî.öůöüö}ö(hî.öhhDhhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhhhhubhC)üö}ö(hî**constructor** create CNN.öh]ö(h îstrongöôö)üö}ö(hî**constructor**öh]öhîconstructoröůöüö}ö(hhhhíubah}ö(h]öh!]öh#]öh%]öh']öuh)hčhhŤubhî create CNN.öůöüö}ö(hî create CNN.ö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î_**encoding** (string, "drug" or "protein") - specify input type of model, "drug" or "protein".
öh]öhC)üö}ö(hî^**encoding** (string, "drug" or "protein") - specify input type of model, "drug" or "protein".öh]ö(há)üö}ö(hî**encoding**öh]öhîencodingöůöüö}ö(hhhh┘ubah}ö(h]öh!]öh#]öh%]öh']öuh)hčhhŇubhîb (string, ÔÇťdrugÔÇŁ or ÔÇťproteinÔÇŁ) - specify input type of model, ÔÇťdrugÔÇŁ or ÔÇťproteinÔÇŁ.öůöüö}ö(hîR (string, "drug" or "protein") - specify input type of model, "drug" or "protein".öhhŇubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhhĐubah}ö(h]öh!]öh#]öh%]öh']öuh)h¤hh╠hhhh*hNubhđ)üö}ö(hXr **config** (kwargs, keyword arguments) - specify the parameter of CNN. 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].
* 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.
öh]öh îdefinition_listöôö)üö}ö(hhh]öh îdefinition_list_itemöôö)üö}ö(hXN **config** (kwargs, keyword arguments) - specify the parameter of CNN. 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].
* 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.
öh]ö(h îtermöôö)üö}ö(hîW**config** (kwargs, keyword arguments) - specify the parameter of CNN. The keys includeöh]ö(há)üö}ö(hî
**config**öh]öhîconfigöůöüö}ö(hhhj
ubah}ö(h]öh!]öh#]öh%]öh']öuh)hčhj ubhîM (kwargs, keyword arguments) - specify the parameter of CNN. The keys includeöůöüö}ö(hîM (kwargs, keyword arguments) - specify the parameter of CNN. The keys includeöhj ubeh}ö(h]öh!]öh#]öh%]öh']öuh)j hh*hK hj 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)üö}ö(hj0 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].öůöüö}ö(hj0 hj2 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)üö}ö(hjG 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].öůöüö}ö(hjG hjI ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjE 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)üö}ö(hju 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].öůöüö}ö(hju hjw ubah}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hKhjs 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îqhidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.
öh]öhC)üö}ö(hînhidden_dim_protein (int) - specify the hidden dimension when encoding protein, e.g., hidden_dim_protein = 256.ö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+ ubeh}ö(h]öh!]öh#]öh%]öh']öîbulletöî*öuh)h╩hh*hKhj( ubah}ö(h]öh!]öh#]öh%]öh']öuh)j& hj ubeh}ö(h]öh!]öh#]öh%]öh']öuh)j 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îA**Calling functions** implement the feedforward procedure of CNN.öh]ö(há)üö}ö(hî**Calling functions**öh]öhîCalling functionsöůöüö}ö(hhhjŃ ubah}ö(h]öh!]öh#]öh%]öh']öuh)hčhj▀ ubhî, implement the feedforward procedure of CNN.öůöüö}ö(hî, implement the feedforward procedure of CNN.öhj▀ hhhNhNubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hK"hhhhubh,)üö}ö(hîforward(self, v)öh]öhîforward(self, v)öůöüö}ö(hhhjŘ ubah}ö(h]öh!]öh#]öh%]öh']öh;h<h=ëh>îpythonöh@}öuh)h+hh*hK$hhhhubh╦)üö}ö(hhh]öhđ)üö}ö(hî/**v** (torch.Tensor) - input feature of CNN.
öh]öhC)üö}ö(hî,**v** (torch.Tensor) - input feature of CNN.öh]ö(há)üö}ö(hî**v**öh]öhîvöůöüö}ö(hhhj ubah}ö(h]öh!]öh#]öh%]öh']öuh)hčhj ubhî' (torch.Tensor) - input feature of CNN.öůöüö}ö(hî' (torch.Tensor) - input feature of CNN.öhj ubeh}ö(h]öh!]öh#]öh%]öh']öuh)hBhh*hK)hj ubah}ö(h]öh!]öh#]öh%]öh']öuh)h¤hj hhhh*hNubah}ö(h]öh!]öh#]öh%]öh']öj┐ j└ uh)h╩hh*hK)hhhhubeh}ö(h]öîcnnöah!]öh#]öîcnnö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öjg î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ö}ö(jA j> hhhehîhëuî nametypesö}ö(jA Nhhłhîłuh}ö(j> hheh_hëhâuî
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.