This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch_geometric.nn import Explainer, GCNConv, to_captum | |
from captum.attr import Saliency, IntegratedGradients | |
import matplotlib.pyplot as plt | |
def explain_output(model, num_edges, edge_index, node_feat, | |
node_id= 2, | |
device = 'cpu'): | |
captum_model = to_captum(model, mask_type='edge', output_idx=node_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
NextPage = True | |
request_count = 0 | |
# endCursor = '5981683117051934905' | |
endCursor = '9173542013414046873' | |
multifeed_n = 20 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://www.quora.com/ajax/receive_POST', { | |
method: 'POST', | |
headers: { | |
'Accept': '*/*', | |
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', | |
'Connection': 'keep-alive', | |
'Cookie': 'm-b=QFncGIoFeSEWiYczzU8Npw==; m-b_lax=QFncGIoFeSEWiYczzU8Npw==; m-b_strict=QFncGIoFeSEWiYczzU8Npw==; m-s=eeDfjDc-QEPVyXxa_tLBMQ==; m-dynamicFontSize=regular; G_ENABLED_IDPS=google; m-ans_frontend_early_version=9d4efaf3578d95ce; __stripe_mid=31d91cf3-05c1-47e0-a1b2-cf13611d568ebac2ef; m-theme=light; m-sa=1; g_state={"i_p":1655016883763,"i_l":1}; _scid=eb3c85b7-2443-47f5-a98a-3a91bc98934c; _gcl_au=1.1.11585039.1655010027; _fbp=fb.1.1655010027457.732862936; _sctr=1|1654972200000; m-lat=ZsW8sG1mBmSKHTmCpjnoig==; m-login=1; m-uid=323905208; __aaxsc=2; aasd=2%7C1655098800968; __stripe_sid=701b6b56-783f-41f5-a615-7d8ad927f96bf85ca1', | |
'Origin': 'https://www.quora.com', | |
'Referer': 'https://www.quora.com/topic/Anatomy-1', | |
'Sec-Fetch-Dest': 'empty', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tqdm import tqdm | |
import nlpaug.augmenter.char as nac | |
import nlpaug.augmenter.word as naw | |
import nlpaug.augmenter.sentence as nas | |
import nlpaug.flow as nafc | |
from nlpaug.util import Action | |
import os | |
import uuid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sshpass -p 'password' ssh [email protected] | |
printf "\n\n\nGpu name : name_of_gpu \nIP address : 10.0.0.0 \nalias : 'i' \n\n" | |
sshpass -p 'password' ssh [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import BertTokenizer, BertModel | |
import torch | |
import numpy as np | |
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') | |
model = BertModel.from_pretrained('bert-base-uncased') | |
class GcnData(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_adj_matrix(df, ml_format = True): | |
"""where df should be one hot of labels""" | |
all_categoris = list(df.columns) | |
label_freq = {} | |
for i in all_categoris: | |
label_freq[i] = df[i].value_counts()[1] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metapub import PubMedFetcher | |
import pickle as pk | |
from tqdm import tqdm | |
import uuid | |
fetch = PubMedFetcher() | |
import os | |
os.environ["NCBI_API_KEYY"] = "abcd" | |
final_data = {} |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function fs(n, t) { | |
return n.isInstanceOfType(t) ? t : null | |
} | |
function dr(n, t) { | |
if (n.isInstanceOfType(t) || t === null || typeof t == "undefined") | |
return n.isStruct ? t.boxedValue : t; | |
throw "InvalidCast to " + n.fullName; | |
} | |
function wwf(n) { |