Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pikulsomesh authored Aug 20, 2021
1 parent b70238d commit bed31b9
Showing 1 changed file with 58 additions and 21 deletions.
79 changes: 58 additions & 21 deletions Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@
"outputs": [],
"source": [
"NX_GRAPHS = networkx_feat(\n",
" TXT_DATA_PATH, \n",
" MON_SMILES, \n",
" BOND_SMILES, \n",
" FEAT, \n",
" FP_RADIUS_MON, \n",
" FP_RADIUS_BOND, \n",
" FP_BITS_MON, \n",
" FP_BITS_BOND\n",
" TXT_DATA_PATH = TXT_DATA_PATH, \n",
" MON_SMILES = MON_SMILES, \n",
" BOND_SMILES = BOND_SMILES, \n",
" FEAT = FEAT, \n",
" FP_RADIUS_MON = FP_RADIUS_MON, \n",
" FP_RADIUS_BOND = FP_RADIUS_BOND, \n",
" FP_BITS_MON = FP_BITS_MON, \n",
" FP_BITS_BOND = FP_BITS_BOND\n",
")"
]
},
Expand Down Expand Up @@ -282,7 +282,7 @@
"metadata": {},
"outputs": [],
"source": [
"sim_matrix = unsup.similarity_matrix(NX_GRAPHS)"
"sim_matrix = unsup.similarity_matrix(dict_graphs = NX_GRAPHS)"
]
},
{
Expand All @@ -292,7 +292,10 @@
"metadata": {},
"outputs": [],
"source": [
"embeddings = unsup.dimensionality_reduction(sim_matrix, method = 'umap', n_neighbors=3)"
"embeddings = unsup.dimensionality_reduction(\n",
" matrix = sim_matrix, \n",
" method = 'umap', \n",
" n_neighbors=3)"
]
},
{
Expand All @@ -315,7 +318,11 @@
}
],
"source": [
"unsup.plot_embeddings(embeddings, NX_GRAPHS, DF_PATH, 'UMAP')"
"unsup.plot_embeddings(\n",
" embeddings = embeddings, \n",
" NX_GRAPHS = NX_GRAPHS, \n",
" DF_PATH = DF_PATH, \n",
" method = 'UMAP')"
]
},
{
Expand All @@ -333,7 +340,14 @@
"metadata": {},
"outputs": [],
"source": [
"dgl_dict = MacroDataset(DF_PATH, SEED, TASK, LABELNAME, MODEL, NX_GRAPHS, NORM)"
"dgl_dict = MacroDataset(\n",
" DF_PATH = DF_PATH, \n",
" SEED = SEED, \n",
" TASK = TASK, \n",
" LABELNAME = LABELNAME, \n",
" MODEL = MODEL, \n",
" NX_GRAPHS = NX_GRAPHS, \n",
" NORM = NORM)"
]
},
{
Expand Down Expand Up @@ -361,12 +375,24 @@
],
"source": [
"random.seed(SEED)\n",
"\n",
"macro_supervised = MacroSupervised(\n",
" dgl_dict, \n",
" MON_SMILES, BOND_SMILES, \n",
" FEAT, FP_BITS_MON, FP_BITS_BOND, \n",
" SEED, MODEL, SPLIT, \n",
" NUM_EPOCHS, NUM_WORKERS, CUSTOM_PARAMS, MODEL_PATH, SAVE_MODEL, SAVE_OPT, SAVE_CONFIG)"
" MacroDataset = dgl_dict, \n",
" MON_SMILES = MON_SMILES, \n",
" BOND_SMILES = BOND_SMILES, \n",
" FEAT = FEAT, \n",
" FP_BITS_MON = FP_BITS_MON, \n",
" FP_BITS_BOND = FP_BITS_BOND, \n",
" SEED = SEED, \n",
" MODEL = MODEL, \n",
" SPLIT = SPLIT, \n",
" NUM_EPOCHS = NUM_EPOCHS, \n",
" NUM_WORKERS = NUM_WORKERS, \n",
" CUSTOM_PARAMS = CUSTOM_PARAMS, \n",
" MODEL_PATH = MODEL_PATH, \n",
" SAVE_MODEL = SAVE_MODEL, \n",
" SAVE_OPT = SAVE_OPT, \n",
" SAVE_CONFIG = SAVE_CONFIG)"
]
},
{
Expand Down Expand Up @@ -481,8 +507,13 @@
"random.seed(SEED)\n",
"input_graph = dgl_dict.graphs[0]\n",
"\n",
"attribution = Attribution(model_name=MODEL, attribution_type='integrated_gradients')\n",
"attribution.calculate_attribution(macro_supervised.model, input_graph)"
"attribution = Attribution(\n",
" model_name = MODEL, \n",
" attribution_type = 'integrated_gradients')\n",
"\n",
"attribution.calculate_attribution(\n",
" model_instance = macro_supervised.model, \n",
" input_graph = input_graph)"
]
},
{
Expand Down Expand Up @@ -511,7 +542,9 @@
}
],
"source": [
"attribution.plot_graph(input_graph, NX_GRAPHS)"
"attribution.plot_graph(\n",
" input_graph = input_graph, \n",
" NX_GRAPHS = NX_GRAPHS)"
]
},
{
Expand Down Expand Up @@ -565,7 +598,11 @@
],
"source": [
"index = 16\n",
"mol, bi = attribution.display_substructure('Xyl', MON_SMILES, FP_RADIUS_MON, FP_BITS_MON)\n",
"mol, bi = attribution.display_substructure(\n",
" monomer = 'Xyl', \n",
" MON_SMILES_PATH = MON_SMILES, \n",
" RADIUS = FP_RADIUS_MON, \n",
" N_BITS = FP_BITS_MON)\n",
"Draw.DrawMorganBit(mol, index, bi)"
]
}
Expand Down

0 comments on commit bed31b9

Please sign in to comment.