repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
interpretability
interpretability-master/text-dream/python/dream/tokenize_sentence.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
1,506
34.046512
80
py
interpretability
interpretability-master/text-dream/python/dream/similar_embedding_activation.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
6,200
39.529412
80
py
interpretability
interpretability-master/text-dream/python/dream/reconstruct_activation.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
10,106
46.228972
80
py
interpretability
interpretability-master/text-dream/python/dream/reconstruct_shifted_activation.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
12,102
45.55
82
py
interpretability
interpretability-master/text-dream/python/dream/token_search.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
5,144
35.489362
80
py
interpretability
interpretability-master/text-dream/python/helpers/one_hots_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
5,144
45.351351
80
py
interpretability
interpretability-master/text-dream/python/helpers/embeddings_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
8,157
42.164021
80
py
interpretability
interpretability-master/text-dream/python/helpers/optimization_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
4,249
45.195652
80
py
interpretability
interpretability-master/text-dream/python/helpers/activation_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
6,274
40.833333
80
py
interpretability
interpretability-master/text-dream/python/helpers/output_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
10,131
36.525926
80
py
interpretability
interpretability-master/text-dream/python/helpers/classifier_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
1,161
37.733333
80
py
interpretability
interpretability-master/text-dream/python/helpers/inference_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
3,806
39.935484
80
py
interpretability
interpretability-master/text-dream/python/helpers/attention_mask_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
1,836
41.72093
80
py
interpretability
interpretability-master/text-dream/python/helpers/tokenization_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
2,630
38.268657
80
py
interpretability
interpretability-master/text-dream/python/helpers/setup_helper.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
3,457
35.4
80
py
interpretability
interpretability-master/text-dream/python/linear_classifier/classify_token.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
2,754
38.357143
80
py
interpretability
interpretability-master/text-dream/python/linear_classifier/train.py
# Copyright 2018 Google LLC. All Rights Reserved. # # 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 a...
10,428
38.059925
80
py
WeatherBench
WeatherBench-master/src/train_nn.py
from .score import * import os import numpy as np import xarray as xr import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.layers import Input, Dropout, Conv2D, Lambda, LeakyReLU import tensorflow.keras.backend as K from configargparse import ArgParser def limit_mem(): """Limit TF GPU mem...
13,309
40.59375
122
py
BOSS
BOSS-main/Eval_Codes/GenNNs_BOSS_MNIST_fashion_HCs.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
17,240
32.938976
181
py
BOSS
BOSS-main/Eval_Codes/GenNNs_BOSS_GTSRB.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
16,912
31.153992
178
py
BOSS
BOSS-main/Eval_Codes/GenNNs_BOSS_MNIST_digits.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
17,703
31.724584
180
py
BOSS
BOSS-main/Eval_Codes/GenNNs_cifar_10.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time from keras.datasets import cifar10 from keras.layers import GlobalAveragePooling2D, Lambda, Conv2D, MaxPooling2D, ...
15,923
32.244259
158
py
BOSS
BOSS-main/Eval_Codes/GenNNs_BOSS_COVID_19.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
15,510
31.047521
158
py
BOSS
BOSS-main/Eval_Codes/applications/GenNNs_MNIST_digits_ensemble_two_models_table_diff_target.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
27,324
38.316547
201
py
BOSS
BOSS-main/Eval_Codes/applications/GenNNs_MNIST_digits_confide_reduction.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
24,839
36.185629
207
py
BOSS
BOSS-main/Eval_Codes/applications/GenNNs_MNIST_digits_targeted_attack.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
23,610
35.380586
180
py
BOSS
BOSS-main/Eval_Codes/applications/GenNNs_MNIST_digits_boudary_examples.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
22,178
35.359016
180
py
BOSS
BOSS-main/Eval_Codes/applications/GenNNs_MNIST_digits_ensemble_two_models_table_same_target.py
import tensorflow as tf from keras.utils import np_utils import glob #import imageio import matplotlib.pyplot as plt import numpy as np import os #import PIL from tensorflow.keras import layers import time #from skimage.measure import compare_ssim from skimage.measure import compare_ssim import pydot import graphviz...
25,026
38.227273
197
py
AGCRN
AGCRN-master/model/AGCRN.py
import torch import torch.nn as nn from model.AGCRNCell import AGCRNCell class AVWDCRNN(nn.Module): def __init__(self, node_num, dim_in, dim_out, cheb_k, embed_dim, num_layers=1): super(AVWDCRNN, self).__init__() assert num_layers >= 1, 'At least one DCRNN layer in the Encoder.' self.node_n...
3,454
44.460526
113
py
AGCRN
AGCRN-master/model/Run.py
import os import sys file_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) print(file_dir) sys.path.append(file_dir) import torch import numpy as np import torch.nn as nn import argparse import configparser from datetime import datetime from model.AGCRN import AGCRN as Network from model.BasicTrainer...
6,865
43.584416
129
py
AGCRN
AGCRN-master/model/AGCN.py
import torch import torch.nn.functional as F import torch.nn as nn class AVWGCN(nn.Module): def __init__(self, dim_in, dim_out, cheb_k, embed_dim): super(AVWGCN, self).__init__() self.cheb_k = cheb_k self.weights_pool = nn.Parameter(torch.FloatTensor(embed_dim, cheb_k, dim_in, dim_out)) ...
1,453
54.923077
112
py
AGCRN
AGCRN-master/model/AGCRNCell.py
import torch import torch.nn as nn from model.AGCN import AVWGCN class AGCRNCell(nn.Module): def __init__(self, node_num, dim_in, dim_out, cheb_k, embed_dim): super(AGCRNCell, self).__init__() self.node_num = node_num self.hidden_dim = dim_out self.gate = AVWGCN(dim_in+self.hidden_d...
1,065
40
80
py
AGCRN
AGCRN-master/model/BasicTrainer.py
import torch import math import os import time import copy import numpy as np from lib.logger import get_logger from lib.metrics import All_Metrics class Trainer(object): def __init__(self, model, loss, optimizer, train_loader, val_loader, test_loader, scaler, args, lr_scheduler=None): sup...
8,935
42.590244
148
py
AGCRN
AGCRN-master/lib/TrainInits.py
import torch import random import numpy as np def init_seed(seed): ''' Disable cudnn to maximize reproducibility ''' torch.cuda.cudnn_enabled = False torch.backends.cudnn.deterministic = True random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed)...
1,818
33.980769
120
py
AGCRN
AGCRN-master/lib/dataloader.py
import torch import numpy as np import torch.utils.data from lib.add_window import Add_Window_Horizon from lib.load_dataset import load_st_dataset from lib.normalization import NScaler, MinMax01Scaler, MinMax11Scaler, StandardScaler, ColumnMinMaxScaler def normalize_dataset(data, normalizer, column_wise=False): if...
5,728
42.401515
154
py
AGCRN
AGCRN-master/lib/metrics.py
''' Always evaluate the model with MAE, RMSE, MAPE, RRSE, PNBI, and oPNBI. Why add mask to MAE and RMSE? Filter the 0 that may be caused by error (such as loop sensor) Why add mask to MAPE and MARE? Ignore very small values (e.g., 0.5/0.5=100%) ''' import numpy as np import torch def MAE_torch(pred, true, mask...
7,947
34.641256
103
py
AGCRN
AGCRN-master/lib/normalization.py
import numpy as np import torch class NScaler(object): def transform(self, data): return data def inverse_transform(self, data): return data class StandardScaler: """ Standard the input """ def __init__(self, mean, std): self.mean = mean self.std = std de...
4,047
30.138462
93
py
a3c_continuous
a3c_continuous-master/main.py
from __future__ import print_function, division import os os.environ["OMP_NUM_THREADS"] = "1" import argparse import torch import torch.multiprocessing as mp from environment import create_env from model import A3C_MLP, A3C_CONV from train import train from test import test from shared_optim import SharedRMSprop, Shar...
5,128
25.713542
131
py
a3c_continuous
a3c_continuous-master/test.py
from __future__ import division import os os.environ["OMP_NUM_THREADS"] = "1" from setproctitle import setproctitle as ptitle import numpy as np import torch from environment import create_env from utils import setup_logger from model import A3C_CONV, A3C_MLP from player_util import Agent from torch.autograd import Va...
4,727
35.091603
190
py
a3c_continuous
a3c_continuous-master/shared_optim.py
from __future__ import division import math import torch import torch.optim as optim from collections import defaultdict from math import sqrt class SharedRMSprop(optim.Optimizer): """Implements RMSprop algorithm with shared states.""" def __init__( self, params, lr=7e-4, alph...
6,802
34.06701
100
py
a3c_continuous
a3c_continuous-master/player_util.py
from __future__ import division import os os.environ["OMP_NUM_THREADS"] = "1" from math import pi as PI import numpy as np from numpy import fromiter, float32 import torch import torch.nn.functional as F from torch.autograd import Variable from utils import normal # , pi class Agent(object): def __init__(self, ...
3,619
33.807692
77
py
a3c_continuous
a3c_continuous-master/utils.py
from __future__ import division from math import pi as PI import numpy as np import torch from torch.autograd import Variable import json import logging def setup_logger(logger_name, log_file, level=logging.INFO): l = logging.getLogger(logger_name) formatter = logging.Formatter("%(asctime)s : %(message)s") ...
2,514
29.670732
82
py
a3c_continuous
a3c_continuous-master/model.py
from __future__ import division import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.autograd import Variable from utils import norm_col_init, weights_init, weights_init_mlp class A3C_CONV(torch.nn.Module): def __init__(self, num_inputs, action_space, args): ...
5,526
34.203822
70
py
a3c_continuous
a3c_continuous-master/gym_eval.py
from __future__ import division import os os.environ["OMP_NUM_THREADS"] = "1" import argparse import torch from environment import create_env from utils import setup_logger from model import A3C_CONV, A3C_MLP from player_util import Agent from torch.autograd import Variable import gym import logging import time gym.l...
4,450
25.337278
190
py
a3c_continuous
a3c_continuous-master/train.py
from __future__ import division import os os.environ["OMP_NUM_THREADS"] = "1" from setproctitle import setproctitle as ptitle import numpy as np import torch import torch.optim as optim from environment import create_env from utils import ensure_shared_grads from model import A3C_CONV, A3C_MLP from player_util import ...
4,686
35.333333
81
py
wikiworkshop2023_imgaccessibility
wikiworkshop2023_imgaccessibility-main/human_alt_quality_exp/study/trial_info/sample_data.py
import pandas as pd import json import numpy as np import random import shutil import random import os import torch import csv import sys sys.path.insert(0, '../../../models/03_xu2015/code') import caption gpu_id = 0 os.environ['KMP_DUPLICATE_LIB_OK']='True' device = torch.device("cuda:"+str(gpu_id) if torch.cuda.is_a...
3,722
33.155963
189
py
Meta-RegGNN
Meta-RegGNN-main/evaluators.py
''' Functions for k-fold evaluation of models. ''' import random import pickle import numpy as np from sklearn.model_selection import KFold import torch import proposed_method.data_utils as data_utils from proposed_method.MetaRegGNN import MetaRegGNN from collections import OrderedDict from config import Config def ...
4,454
43.108911
123
py
Meta-RegGNN
Meta-RegGNN-main/demo.py
''' Main file for creating simulated data or loading real data and running MetaRegGNN and sample selection methods. Usage: For data processing: python demo.py --mode data For inferences: python demo.py --mode infer For more information: python demo.py -h ''' import argparse impor...
2,264
31.357143
114
py
Meta-RegGNN
Meta-RegGNN-main/proposed_method/MetaRegGNN.py
'''MetaRegGNN regression model architecture. torch_geometric needs to be installed. ''' import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn.dense import DenseGCNConv from torchmeta.modules import MetaModule class MetaRegGNN(MetaModule): '''Regression using a DenseGCNConv l...
1,053
26.736842
68
py
Meta-RegGNN
Meta-RegGNN-main/proposed_method/data_utils.py
import copy import scipy.io # to read .mat files from scipy.sparse import coo_matrix from sklearn.model_selection import KFold import numpy as np import pandas as pd import torch import torch_geometric from config import Config DATA_PATH = "/home/latis/Documents/RegGNN/IQ_data_clean/" # this should point to the dir...
5,565
37.386207
125
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/swd_pac.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import torch import torch.nn as nn from torch import optim import torch.utils.data as data_utils from utils import rand_projections, TransformNet, Wasserstein_1D, sliced_wasserstein_distance from tqdm import tqdm from vmf_utils import hyperspherical_uni...
30,509
47.816
203
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/evaluate_vmf.py
import torch from torch.distributions.multivariate_normal import MultivariateNormal from utils import distributional_sliced_wasserstein_distance from swd_pac import PAC_SWD import matplotlib.pyplot as plt import pickle import os from vmf_utils import hyperspherical_uniform as unif, von_mises_fisher torch.manual_seed(...
12,216
47.868
186
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/utils.py
import numpy as np import ot import torch import torch.nn as nn from torch.utils.data import Dataset from torchvision import datasets, transforms from torch import optim from vmf_utils import hyperspherical_uniform as unif, von_mises_fisher as vmf def Wasserstein_1D(mu_n, nu_n, p = 2, power_p = True): wasserstein...
13,452
39.158209
213
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/vmf_utils/von_mises_fisher.py
# Credit: https://github.com/nicola-decao/s-vae-pytorch import math import torch from torch.distributions.kl import register_kl from vmf_utils.ive import ive, ive_fraction_approx3 from vmf_utils.hyperspherical_uniform import HypersphericalUniform class VonMisesFisher(torch.distributions.Distribution): arg_cons...
7,267
34.627451
97
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/vmf_utils/hyperspherical_uniform.py
# Credit: https://github.com/nicola-decao/s-vae-pytorch import math import torch class HypersphericalUniform(torch.distributions.Distribution): arg_constraints = {} support = torch.distributions.constraints.real has_rsample = False _mean_carrier_measure = 0 @property def dim(self): ...
1,699
27.813559
88
py
PAC-Bayesian_Sliced-Wasserstein
PAC-Bayesian_Sliced-Wasserstein-main/vmf_utils/ive.py
# Credit: https://github.com/nicola-decao/s-vae-pytorch import torch import numpy as np import scipy.special from numbers import Number class IveFunction(torch.autograd.Function): @staticmethod def forward(self, v, z): assert isinstance(v, Number), "v must be a scalar" self.save_for_backwar...
2,327
26.388235
88
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/knowledge_aware/load_data.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import collections import os import numpy as np import random as rd import...
10,100
35.204301
149
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/knowledge_aware/KGAT/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.knowledge_aware.metrics as metrics from parser import parse_a...
8,738
32.102273
101
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/knowledge_aware/CKE/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.knowledge_aware.metrics as metrics from parser import parse_a...
9,203
33.863636
110
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/knowledge_aware/CFKG/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.knowledge_aware.metrics as metrics from parser import parse_a...
8,135
30.905882
101
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/PGPR/train_agent.py
from __future__ import absolute_import, division, print_function import warnings import numpy as np import torch with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) warnings.filterwarnings("ignore", category=DeprecationWarning) import os import argparse from colle...
14,020
39.523121
129
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/PGPR/transe_model.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import numpy as np import pickle import torch import torch.nn as nn import torch.nn.functional as F from models.PGPR.pgpr_utils import * from models.PGPR.data_utils import Dataset class KnowledgeEmbedding(nn.Modu...
7,960
41.345745
114
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/PGPR/train_transe_model.py
from __future__ import absolute_import, division, print_function import os import argparse import torch import torch.optim as optim from data_utils import DataLoader from models.PGPR.pgpr_utils import * from models.PGPR.transe_model import KnowledgeEmbedding logger = None def train(args, dataset): dataloader = ...
5,258
41.072
112
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/PGPR/test_agent.py
from __future__ import absolute_import, division, print_function import os import argparse from math import log import numpy as np import torch import json from easydict import EasyDict as edict from tqdm import tqdm from functools import reduce from models.PGPR.kg_env import BatchKGEnvironment from models.PGPR.train_...
14,342
39.516949
125
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/PGPR/pgpr_utils.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import os import sys import random import pickle import logging import logging.handlers import numpy as np import csv # import scipy.sparse as sp import torch from collections import defaultdict import shutil # Data...
15,735
31.715177
156
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/embeddings/transe/knowledge_graph.py
from __future__ import absolute_import, division, print_function import os import sys import argparse from math import log from tqdm import tqdm from copy import deepcopy import pandas as pd import numpy as np import gzip import pickle import random from datetime import datetime # import matplotlib.pyplot as plt impor...
4,538
32.873134
91
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/embeddings/transe/transe_model.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import numpy as np import pickle import torch import torch.nn as nn import torch.nn.functional as F from models.embeddings.transe.dataset import Dataset from models.embeddings.transe.utils import * class Knowle...
8,711
40.684211
114
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/embeddings/transe/utils.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import os import sys import random import pickle import logging import logging.handlers import numpy as np import csv # import scipy.sparse as sp import torch from collections import defaultdict # Dataset names. # ...
16,750
30.077922
156
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/embeddings/transe/train_transe.py
from __future__ import absolute_import, division, print_function import os import argparse import torch import torch.optim as optim from models.embeddings.transe.dataset import DataLoader, Dataset from models.embeddings.transe.utils import * from models.embeddings.transe.transe_model import KnowledgeEmbedding import j...
7,161
41.129412
123
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/CAFE/train_neural_symbol.py
from __future__ import absolute_import, division, print_function import os import sys import numpy as np import logging import logging.handlers import torch import torch.optim as optim #from tensorboardX import SummaryWriter import time from models.CAFE.knowledge_graph import * from models.CAFE.data_utils import Onli...
6,848
35.625668
131
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/CAFE/cafe_utils.py
from __future__ import absolute_import, division, print_function import os import random import argparse import pickle import numpy as np import gzip import scipy.sparse as sp from sklearn.feature_extraction.text import TfidfTransformer import torch import sys import shutil ML1M = 'ml1m' LFM1M = 'lfm1m' CELL = 'cellph...
9,304
34.788462
132
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/CAFE/execute_neural_symbol.py
from __future__ import absolute_import, division, print_function import csv import sys from collections import defaultdict from functools import reduce import numpy as np import pickle import logging import logging.handlers import math from tqdm import tqdm import torch from torch.nn import functional as F import jso...
16,959
35.085106
114
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/CAFE/symbolic_model.py
from __future__ import absolute_import, division, print_function import torch from torch import nn from torch.nn import functional as F from models.CAFE.knowledge_graph import * from models.CAFE.cafe_utils import * class EntityEmbeddingModel(nn.Module): def __init__(self, entity_info, embed_size, init_embed=Non...
12,938
40.07619
111
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/traditional/load_data.py
import collections import os import numpy as np import random as rd import torch import torch.utils.data from torch.utils.data import Dataset import math class Data(Dataset): def __init__(self, args, path, batch_style='list'): super(Data).__init__() self.batch_styles = {'list': 0, 'map': 1} ...
9,960
35.756458
126
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/traditional/NFM/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.traditional.metrics as metrics from parser import parse_args ...
7,649
31.008368
101
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/traditional/FM/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.traditional.metrics as metrics from parser import parse_args ...
7,646
30.995816
101
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/traditional/BPRMF/batch_test.py
''' Created on Dec 18, 2018 Tensorflow Implementation of Knowledge Graph Attention Network (KGAT) model in: Wang Xiang et al. KGAT: Knowledge Graph Attention Network for Recommendation. In KDD 2019. @author: Xiang Wang (xiangwang@u.nus.edu) ''' import models.traditional.metrics as metrics from parser import parse_args ...
7,675
31.117155
101
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/test.py
from __future__ import absolute_import, division, print_function import os import argparse import json from math import log from datetime import datetime from tqdm import tqdm from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.au...
19,385
34.966605
248
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/utils.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import os import sys import random import pickle import logging import logging.handlers import numpy as np import csv # import scipy.sparse as sp import torch from collections import defaultdict import shutil # Data...
17,841
29.975694
156
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/train.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import Categorical from m...
11,947
36.930159
147
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/parser.py
import os from models.UCPR.utils import * import argparse import random def parse_args(): boolean = lambda x: (str(x).lower() == 'true') parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, default=LFM1M, help='One of {clothing, cell, beauty, cd}') parser.add_argument('--n...
8,873
50
116
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/test.py
from __future__ import absolute_import, division, print_function import os import argparse import json from math import log from datetime import datetime from tqdm import tqdm from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.au...
19,385
34.966605
248
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/train.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import Categorical from m...
11,947
36.930159
147
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/env/sp_user_tri_set.py
from __future__ import absolute_import, division, print_function import os import sys from tqdm import tqdm import pickle import random import torch from datetime import datetime import numpy as np import collections from collections import defaultdict from collections import Counter import time import multiprocessi...
11,671
41.59854
164
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/env/env.py
from __future__ import absolute_import, division, print_function import os import sys sys.path.insert(0,'../preprocess') from tqdm import tqdm import pickle import random import torch from datetime import datetime from collections import defaultdict from models.UCPR.utils import * # from preprocess.knowledge_graph im...
16,021
39.768448
180
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/UCPR.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import ...
19,300
44.521226
149
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/baseline/baseline.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import ...
10,812
38.463504
165
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/lstm_base/model_kg_pre.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import...
6,028
36.918239
167
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/lstm_base/model_lstm_mf_emb.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import ...
10,715
37.826087
126
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/lstm_base/backbone_lstm.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import ...
4,204
36.212389
104
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/src/model/lstm_base/model_kg.py
from __future__ import absolute_import, division, print_function import sys import os import argparse from collections import namedtuple import torch import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.distributions import...
5,310
36.401408
148
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/preprocess/knowledge_graph.py
from __future__ import absolute_import, division, print_function import os import sys import argparse from math import log from tqdm import tqdm from copy import deepcopy import pandas as pd import numpy as np import gzip import pickle import random from datetime import datetime # import matplotlib.pyplot as plt impor...
4,556
32.755556
91
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/preprocess/transe_model.py
from __future__ import absolute_import, division, print_function from easydict import EasyDict as edict import numpy as np import pickle import torch import torch.nn as nn import torch.nn.functional as F from models.UCPR.preprocess.dataset import Dataset from models.UCPR.utils import * class KnowledgeEmbedding(nn...
8,696
40.61244
114
py
rep-path-reasoning-recsys
rep-path-reasoning-recsys-main/models/UCPR/preprocess/train_transe.py
from __future__ import absolute_import, division, print_function import os import argparse import torch import torch.optim as optim from models.UCPR.preprocess.dataset import DataLoader, Dataset from models.UCPR.utils import * from models.UCPR.preprocess.transe_model import KnowledgeEmbedding import json import sys lo...
7,144
41.029412
123
py
shapely
shapely-main/docs/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # set an environment variable for shapely.decorators.requires_geos to see if we # are i...
4,366
29.326389
87
py
diffmimic
diffmimic-main/mimic.py
import functools import numpy as np import jax.numpy as jnp from absl import flags, app import yaml from brax import envs from brax.io import metrics from brax.training.agents.apg import networks as apg_networks from diffmimic.utils import AttrDict from diffmimic.mimic_envs import register_mimic_env import diffmimic.br...
2,985
32.931818
109
py
diffmimic
diffmimic-main/diffmimic/brax_lib/agent_diffmimic.py
# Copyright 2022 The Brax Authors. # # 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 wri...
10,754
36.473868
123
py
diffmimic
diffmimic-main/diffmimic/brax_lib/acting.py
# Copyright 2022 The Brax Authors. # # 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 wri...
4,531
33.075188
98
py
diffmimic
diffmimic-main/diffmimic/mimic_envs/humanoid_mimic_train.py
from brax import jumpy as jp from brax.envs import env from .humanoid_mimic import HumanoidMimic from .losses import * import jax class HumanoidMimicTrain(HumanoidMimic): """Trains a humanoid to mimic reference motion.""" def __init__(self, total_length, rollout_length, early_termination, demo_replay_mode, e...
2,647
43.881356
120
py
diffmimic
diffmimic-main/diffmimic/utils/rotation6d.py
import jax.numpy as jnp def quaternion_to_matrix(quaternions): r, i, j, k = quaternions[..., 0], quaternions[..., 1], quaternions[..., 2], quaternions[..., 3] two_s = 2.0 / (quaternions * quaternions).sum(-1) o = jnp.stack( ( 1 - two_s * (j * j + k * k), two_s * (i * j - k...
915
28.548387
99
py