repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
RecSys_PyTorch | RecSys_PyTorch-master/models/BaseModel.py | import torch.nn as nn
class BaseModel(nn.Module):
def __init__(self):
super(BaseModel, self).__init__()
def forward(self, *input):
pass
def fit(self, *input):
pass
def predict(self, eval_users, eval_pos, test_batch_size):
pass | 278 | 18.928571 | 61 | py |
RecSys_PyTorch | RecSys_PyTorch-master/models/SLIMElastic.py | """
Xia Ning et al., SLIM: Sparse Linear Methods for Top-N Recommender Systems. ICDM 2011.
http://glaros.dtc.umn.edu/gkhome/fetch/papers/SLIM2011icdm.pdf
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import scipy.sparse as sp
from tqdm import tqdm
from sklearn.linear_model im... | 5,363 | 38.441176 | 142 | py |
RecSys_PyTorch | RecSys_PyTorch-master/models/EASE.py | """
Harald Steck, Embarrassingly Shallow Autoencoders for Sparse Data. WWW 2019.
https://arxiv.org/pdf/1905.03375
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .BaseModel import BaseModel
class EASE(BaseModel):
def __init__(self, dataset, hparams, device):
s... | 2,379 | 30.733333 | 97 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/base.py | import abc
from typing import MutableMapping
from argparse import Namespace
import torch
import numpy as np
class Logger(abc.ABC):
def __init__(self):
super().__init__()
def setup_logger(self):
pass
# @abc.abstractmethod
# def log_hparams(self, hparams):
# raise NotImplem... | 3,641 | 33.685714 | 112 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/file_logger.py | import os
import logging
from time import strftime, sleep
from loggers.base import Logger
class FileLogger(Logger):
def __init__(self, log_dir):
log_file_format = "[%(lineno)d]%(asctime)s: %(message)s"
log_console_format = "%(message)s"
# Main logger
self.log_dir = log_dir
... | 1,467 | 30.234043 | 84 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/tensorboard.py | import torch
from torch.utils.tensorboard import SummaryWriter
from torch.utils.tensorboard.summary import hparams as hparams_tb
from logger.base import Logger
class TensorboardLogger(Logger):
def __init__(self,
log_dir:str,
experiment_name:str,
hparams:dict,
... | 2,333 | 34.907692 | 111 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/neptune.py | import neptune
class NeptuneLogger:
def __init__(self,
api_key:str,
project_name:str,
experiment_name:str,
description:str,
tags:str,
hparams:dict,
upload_source_files:list=None,
hostnam... | 2,314 | 32.550725 | 102 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/console_logger.py | from loggers.base import Logger
class ConsoleLogger(Logger):
def __init__(self, log_dir):
self.log_dir = log_dir
def log_metrics(self, metrics, epoch=None, prefix=None):
log_str = ''
if epoch is not None:
log_str += '[epoch %3d]' % epoch
metric_str_list... | 667 | 24.692308 | 74 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/csv_logger.py | import io
import os
import csv
from time import strftime
from collections import OrderedDict
from loggers.base import Logger
class CSVLogger(Logger):
LOG_FILE = 'results.csv'
def __init__(self, log_dir):
self.log_dir = log_dir
self.hparams = {}
self.metrics_history = None
... | 2,156 | 29.380282 | 70 | py |
RecSys_PyTorch | RecSys_PyTorch-master/loggers/__init__.py | from .csv_logger import CSVLogger
from .file_logger import FileLogger
from .neptune import NeptuneLogger
# from .tensorboard import TensorboardLogger
from .console_logger import ConsoleLogger | 191 | 37.4 | 44 | py |
RecSys_PyTorch | RecSys_PyTorch-master/utils/stats.py | import numpy as np
class Statistics:
def __init__(self, name='AVG'):
self.name = name
self.history = []
self.sum = 0
self.cnt = 0
def update(self, val):
if isinstance(val, list):
self.history += val
self.sum += sum(val)
self.cnt += le... | 1,095 | 27.102564 | 76 | py |
RecSys_PyTorch | RecSys_PyTorch-master/utils/types.py | import pandas as pd
import scipy.sparse as sp
from typing import Tuple
def df_to_sparse(df: pd.DataFrame, shape: Tuple[int, int]) -> sp.csr_matrix:
users = df.user
items = df.item
ratings = df.rating
sp_matrix = sp.csr_matrix((ratings, (users, items)), shape=shape)
return sp_matrix
def sparse_to_... | 582 | 26.761905 | 76 | py |
RecSys_PyTorch | RecSys_PyTorch-master/utils/config.py | import os
import sys
import warnings
from collections import OrderedDict
from configparser import ConfigParser
class Config:
def __init__(self, main_conf_path):
self.main_config = self.read_main_config(main_conf_path)
exp_config = self.main_config['Experiment']
self.model_config = self.re... | 5,362 | 32.51875 | 124 | py |
RecSys_PyTorch | RecSys_PyTorch-master/utils/general.py | import os
import math
import time
import datetime
import random
import numpy as np
import torch
def make_log_dir(save_dir):
if not os.path.exists(save_dir):
os.makedirs(save_dir)
existing_dirs = os.listdir(save_dir)
if len(existing_dirs) == 0:
idx = 0
else:
idx_list = sorted([... | 1,163 | 24.866667 | 72 | py |
RecSys_PyTorch | RecSys_PyTorch-master/utils/result_table.py | import numpy as np
from collections import OrderedDict
class ResultTable:
"""
Class to save and show result neatly.
First column is always 'NAME' column.
"""
def __init__(self, table_name='table', header=None, splitter='||', int_formatter='%3d', float_formatter='%.4f'):
"""
Initia... | 5,286 | 32.251572 | 116 | py |
RecSys_PyTorch | RecSys_PyTorch-master/data/generators.py | import torch
import numpy as np
class MatrixGenerator:
def __init__(self, input_matrix, return_index=False, batch_size=32, shuffle=True,
matrix_as_numpy=False, index_as_numpy=False, device=None):
super().__init__()
self.input_matrix = input_matrix
self.return_index ... | 8,480 | 36.861607 | 154 | py |
RecSys_PyTorch | RecSys_PyTorch-master/data/data_batcher.py | import torch
import numpy as np
class BatchSampler:
def __init__(self, data_size, batch_size, drop_remain=False, shuffle=False):
self.data_size = data_size
self.batch_size = batch_size
self.drop_remain = drop_remain
self.shuffle = shuffle
def __iter__(self):
if self.shu... | 2,085 | 30.606061 | 100 | py |
RecSys_PyTorch | RecSys_PyTorch-master/data/data_loader.py | import math
import pickle
import numpy as np
import scipy.sparse as sp
def load_data_and_info(data_file, info_file, cv_flag, split_type):
with open(data_file, 'rb') as f:
data_dict = pickle.load(f)
with open(info_file, 'rb') as f:
info_dict = pickle.load(f)
user_id_dict = info_di... | 2,896 | 33.903614 | 189 | py |
RecSys_PyTorch | RecSys_PyTorch-master/data/dataset.py | import os
import pandas as pd
import numpy as np
import scipy.sparse as sp
from typing import List, Dict, Union, Optional
from pathlib import Path
from .preprocess import split_into_tr_val_te
from utils.types import df_to_sparse
class UIRTDataset(object):
def __init__(self, data_path:str, dataname:Optional[str]=... | 12,708 | 46.599251 | 188 | py |
RecSys_PyTorch | RecSys_PyTorch-master/data/__init__.py | 0 | 0 | 0 | py | |
RecSys_PyTorch | RecSys_PyTorch-master/data/preprocess.py | import os
import math
import pandas as pd
import numpy as np
from typing import List, Dict, Union
from pathlib import Path
def split_into_tr_val_te(data:pd.DataFrame, generalization:str, num_valid_items:Union[int, float], num_test_items:Union[int, float],
holdout_users:int, split_random:bool,... | 3,553 | 38.488889 | 133 | py |
paac | paac-master/emulator_runner.py | from multiprocessing import Process
class EmulatorRunner(Process):
def __init__(self, id, emulators, variables, queue, barrier):
super(EmulatorRunner, self).__init__()
self.id = id
self.emulators = emulators
self.variables = variables
self.queue = queue
self.barrie... | 1,070 | 27.945946 | 92 | py |
paac | paac-master/runners.py | import numpy as np
from multiprocessing import Queue
from multiprocessing.sharedctypes import RawArray
from ctypes import c_uint, c_float, c_double
class Runners(object):
NUMPY_TO_C_DTYPE = {np.float32: c_float, np.float64: c_double, np.uint8: c_uint}
def __init__(self, EmulatorRunner, emulators, workers, v... | 1,621 | 30.803922 | 127 | py |
paac | paac-master/test.py | import os
from train import get_network_and_environment_creator, bool_arg
import logger_utils
import argparse
import numpy as np
import time
import tensorflow as tf
import random
from paac import PAACLearner
def get_save_frame(name):
import imageio
writer = imageio.get_writer(name + '.gif', fps=30)
def ... | 3,696 | 39.626374 | 155 | py |
paac | paac-master/policy_v_network.py | from networks import *
class PolicyVNetwork(Network):
def __init__(self, conf):
""" Set up remaining layers, objective and loss functions, gradient
compute and apply ops, network parameter synchronization ops, and
summary ops. """
super(PolicyVNetwork, self).__init__(conf)
... | 3,081 | 46.415385 | 151 | py |
paac | paac-master/environment.py | import numpy as np
class BaseEnvironment(object):
def get_initial_state(self):
"""
Sets the environment to its initial state.
:return: the initial state
"""
raise NotImplementedError()
def next(self, action):
"""
Appies the current action to the environ... | 2,263 | 28.402597 | 104 | py |
paac | paac-master/paac.py | import time
from multiprocessing import Queue
from multiprocessing.sharedctypes import RawArray
from ctypes import c_uint, c_float
from actor_learner import *
import logging
from emulator_runner import EmulatorRunner
from runners import Runners
import numpy as np
class PAACLearner(ActorLearner):
def __init__(sel... | 8,122 | 42.207447 | 119 | py |
paac | paac-master/atari_emulator.py | import numpy as np
from ale_python_interface import ALEInterface
from scipy.misc import imresize
import random
from environment import BaseEnvironment, FramePool,ObservationPool
IMG_SIZE_X = 84
IMG_SIZE_Y = 84
NR_IMAGES = 4
ACTION_REPEAT = 4
MAX_START_WAIT = 30
FRAMES_IN_POOL = 2
class AtariEmulator(BaseEnvironment)... | 4,492 | 36.756303 | 110 | py |
paac | paac-master/logger_utils.py | import os
import numpy as np
import time
import json
import tensorflow as tf
def load_args(path):
if path is None:
return {}
with open(path, 'r') as f:
return json.load(f)
def save_args(args, folder, file_name='args.json'):
args = vars(args)
if not os.path.exists(folder):
os.... | 977 | 27.764706 | 80 | py |
paac | paac-master/networks.py | import tensorflow as tf
import logging
import numpy as np
def flatten(_input):
shape = _input.get_shape().as_list()
dim = shape[1]*shape[2]*shape[3]
return tf.reshape(_input, [-1,dim], name='_flattened')
def conv2d(name, _input, filters, size, channels, stride, padding = 'VALID', init = "torch"):
w ... | 5,972 | 34.135294 | 117 | py |
paac | paac-master/environment_creator.py | class EnvironmentCreator(object):
def __init__(self, args):
"""
Creates an object from which new environments can be created
:param args:
"""
from atari_emulator import AtariEmulator
from ale_python_interface import ALEInterface
filename = args.rom_path + "/... | 554 | 28.210526 | 68 | py |
paac | paac-master/train.py | import argparse
import logging
import sys
import signal
import os
import copy
import environment_creator
from paac import PAACLearner
from policy_v_network import NaturePolicyVNetwork, NIPSPolicyVNetwork
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
def bool_arg(string):
value = string.lower()
... | 5,725 | 51.054545 | 240 | py |
paac | paac-master/actor_learner.py | import numpy as np
from multiprocessing import Process
import tensorflow as tf
import logging
from logger_utils import variable_summaries
import os
CHECKPOINT_INTERVAL = 1000000
class ActorLearner(Process):
def __init__(self, network_creator, environment_creator, args):
super(ActorLearner,... | 5,534 | 41.906977 | 120 | py |
thefloorisdata | thefloorisdata-master/ground_template_from_modis.py | from pyhdf.SD import SD, SDC
import healpy as hp
import numpy as np
from scipy import interpolate
h = 6.62e-34
c = 3e8
k_b = 1.38e-23
T_cmb = 2.72548
def tb2b(tb, nu):
#Convert blackbody temperature to spectral
x = h*nu/(k_b*tb)
return 2*h*nu**3/c**2/(np.exp(x) - 1)
def dBdT(tb, nu):
x = h*nu/(k_b*t... | 7,210 | 34.17561 | 87 | py |
brainiak | brainiak-master/setup.py | from distutils import sysconfig
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
import os
import site
import sys
import setuptools
from copy import deepcopy
assert sys.version_info >= (3, 5), (
"Please use Python version 3.5 or higher, "
"lower version... | 5,433 | 30.593023 | 93 | py |
brainiak | brainiak-master/brainiak/image.py | # Copyright 2017 Intel Corporation
#
# 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... | 5,333 | 28.147541 | 77 | py |
brainiak | brainiak-master/brainiak/isc.py | # Copyright 2017 Intel Corporation
#
# 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... | 63,516 | 40.005165 | 79 | py |
brainiak | brainiak-master/brainiak/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 791 | 33.434783 | 75 | py |
brainiak | brainiak-master/brainiak/io.py | # Copyright 2017 Intel Corporation
#
# 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... | 4,271 | 24.428571 | 78 | py |
brainiak | brainiak-master/brainiak/matnormal/utils.py | import tensorflow as tf
import tensorflow_probability as tfp
from scipy.stats import norm
from numpy.linalg import cholesky
import numpy as np
def rmn(rowcov, colcov):
"""
Generate random draws from a zero-mean matrix-normal distribution.
Parameters
-----------
rowcov : np.ndarray
Row cov... | 3,313 | 25.512 | 78 | py |
brainiak | brainiak-master/brainiak/matnormal/covs.py | import tensorflow as tf
import numpy as np
import abc
import scipy.linalg
import scipy.sparse
import tensorflow_probability as tfp
from brainiak.matnormal.utils import (
x_tx,
xx_t,
unflatten_cholesky_unique,
flatten_cholesky_unique,
)
from brainiak.utils.kronecker_solvers import (
tf_solve_lower_t... | 18,989 | 29.481541 | 79 | py |
brainiak | brainiak-master/brainiak/matnormal/regression.py | import tensorflow as tf
import numpy as np
from sklearn.base import BaseEstimator
from brainiak.matnormal.matnormal_likelihoods import matnorm_logp
from brainiak.matnormal.utils import (
pack_trainable_vars,
unpack_trainable_vars,
make_val_and_grad,
)
from scipy.optimize import minimize
__all__ = ["Matnorm... | 4,301 | 28.265306 | 79 | py |
brainiak | brainiak-master/brainiak/matnormal/mnrsa.py | import tensorflow as tf
from sklearn.base import BaseEstimator
from sklearn.linear_model import LinearRegression
from .covs import CovIdentity
from brainiak.utils.utils import cov2corr
import numpy as np
from brainiak.matnormal.matnormal_likelihoods import matnorm_logp_marginal_row
from brainiak.matnormal.utils import ... | 6,106 | 33.698864 | 79 | py |
brainiak | brainiak-master/brainiak/matnormal/__init__.py | """
Some properties of the matrix-variate normal distribution
---------------------------------------------------------
.. math::
\\DeclareMathOperator{\\Tr}{Tr}
\\newcommand{\\trp}{^{T}} % transpose
\\newcommand{\\trace}{\\text{Trace}} % trace
\\newcommand{\\inv}{^{-1}}
\\newcommand{\\mb}{\\mathbf... | 11,396 | 44.047431 | 84 | py |
brainiak | brainiak-master/brainiak/matnormal/matnormal_likelihoods.py | import tensorflow as tf
from tensorflow import linalg as tlinalg
from .utils import scaled_I
import logging
logger = logging.getLogger(__name__)
def _condition(X):
"""
Condition number (https://en.wikipedia.org/wiki/Condition_number)
used for diagnostics.
NOTE: this formulation is only defined for s... | 13,482 | 30.355814 | 78 | py |
brainiak | brainiak-master/brainiak/factoranalysis/tfa.py | # Copyright 2016 Intel Corporation
#
# 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... | 30,560 | 28.81561 | 99 | py |
brainiak | brainiak-master/brainiak/factoranalysis/htfa.py | # Copyright 2016 Intel Corporation
#
# 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... | 28,941 | 33.372922 | 100 | py |
brainiak | brainiak-master/brainiak/factoranalysis/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 615 | 40.066667 | 75 | py |
brainiak | brainiak-master/brainiak/eventseg/event.py | # Copyright 2020 Princeton University
#
# 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... | 26,615 | 37.406926 | 79 | py |
brainiak | brainiak-master/brainiak/eventseg/__init__.py | # Copyright 2016 Princeton University
#
# 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... | 674 | 44 | 78 | py |
brainiak | brainiak-master/brainiak/fcma/preprocessing.py | # Copyright 2016 Intel Corporation
#
# 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... | 14,358 | 33.6 | 79 | py |
brainiak | brainiak-master/brainiak/fcma/classifier.py | # Copyright 2016 Intel Corporation
#
# 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... | 29,451 | 41.622287 | 79 | py |
brainiak | brainiak-master/brainiak/fcma/mvpa_voxelselector.py | # Copyright 2016 Intel Corporation
#
# 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... | 4,426 | 31.313869 | 77 | py |
brainiak | brainiak-master/brainiak/fcma/util.py | # Copyright 2016 Intel Corporation
#
# 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... | 4,594 | 33.037037 | 78 | py |
brainiak | brainiak-master/brainiak/fcma/voxelselector.py | # Copyright 2016 Intel Corporation
#
# 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... | 19,579 | 36.87234 | 79 | py |
brainiak | brainiak-master/brainiak/fcma/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 1,338 | 40.84375 | 79 | py |
brainiak | brainiak-master/brainiak/funcalign/rsrm.py | # Copyright 2016 Intel Corporation
#
# 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... | 17,711 | 30.516014 | 85 | py |
brainiak | brainiak-master/brainiak/funcalign/sssrm.py | # Copyright 2016 Intel Corporation
#
# 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... | 29,758 | 34.72509 | 79 | py |
brainiak | brainiak-master/brainiak/funcalign/srm.py | # Copyright 2016 Intel Corporation
#
# 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... | 30,738 | 32.631291 | 82 | py |
brainiak | brainiak-master/brainiak/funcalign/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 655 | 42.733333 | 75 | py |
brainiak | brainiak-master/brainiak/funcalign/fastsrm.py | """Fast Shared Response Model (FastSRM)
The implementation is based on the following publications:
.. [Richard2019] "Fast Shared Response Model for fMRI data"
H. Richard, L. Martin, A. Pinho, J. Pillow, B. Thirion, 2019
https://arxiv.org/pdf/1909.12537.pdf
"""
# Author: Hugo Richard
import hashlib
import lo... | 65,510 | 36.413478 | 79 | py |
brainiak | brainiak-master/brainiak/searchlight/searchlight.py | # Copyright 2016 Intel Corporation
#
# 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 ... | 18,584 | 32.069395 | 96 | py |
brainiak | brainiak-master/brainiak/searchlight/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 622 | 40.533333 | 75 | py |
brainiak | brainiak-master/brainiak/reprsimil/brsa.py | # Copyright 2016 Mingbo Cai, Princeton Neuroscience Instititute,
# Princeton University
#
# 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... | 211,990 | 49.534207 | 123 | py |
brainiak | brainiak-master/brainiak/reprsimil/__init__.py | # Copyright 2016 Mingbo Cai, Princeton Neuroscience Instititute,
# Princeton University
#
# 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... | 718 | 43.9375 | 75 | py |
brainiak | brainiak-master/brainiak/reconstruct/__init__.py | # Copyright 2018 David Huberdeau & Peter Kok
#
# 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... | 675 | 44.066667 | 75 | py |
brainiak | brainiak-master/brainiak/reconstruct/iem.py | # Copyright 2018 David Huberdeau & Peter Kok
#
# 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... | 45,189 | 42.038095 | 79 | py |
brainiak | brainiak-master/brainiak/utils/utils.py | # Copyright 2016 Intel Corporation, Princeton University
#
# 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 appli... | 36,244 | 35.390562 | 79 | py |
brainiak | brainiak-master/brainiak/utils/kronecker_solvers.py | import tensorflow as tf
__all__ = ["tf_kron_mult", "tf_masked_triangular_solve"]
def tf_solve_lower_triangular_kron(L, y):
""" Tensorflow function to solve L x = y
where L = kron(L[0], L[1] .. L[n-1])
and L[i] are the lower triangular matrices
Arguments
---------
L : list of 2-D tensors
... | 10,546 | 30.864048 | 78 | py |
brainiak | brainiak-master/brainiak/utils/__init__.py | # Copyright 2016 Intel Corporation
#
# 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... | 638 | 41.6 | 75 | py |
brainiak | brainiak-master/brainiak/utils/fmrisim_real_time_generator.py | # Generate simulated fMRI data with a few parameters that might be relevant
# for real time analysis
"""
This code can be run as a function in python or from the command line:
python fmrisim_real-time_generator --outputDir data
The input arguments are:
Required:
outputDir - Specify output data dir where the data shoul... | 24,201 | 37.599681 | 79 | py |
brainiak | brainiak-master/brainiak/utils/fmrisim.py | # Copyright 2016 Intel Corporation
#
# 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... | 125,482 | 36.04842 | 79 | py |
brainiak | brainiak-master/brainiak/hyperparamopt/__init__.py | """ Hyper parameter optimization package """
| 45 | 22 | 44 | py |
brainiak | brainiak-master/brainiak/hyperparamopt/hpo.py | # Copyright 2016 Intel Corporation
#
# 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... | 11,678 | 30.06117 | 79 | py |
brainiak | brainiak-master/examples/isc/isfc.py | # Copyright 2018 Intel Corporation
#
# 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... | 2,791 | 35.25974 | 75 | py |
brainiak | brainiak-master/examples/factoranalysis/get_tfa_input_from_nifti.py | # Copyright 2016 Intel Corporation
#
# 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... | 2,657 | 34.44 | 113 | py |
brainiak | brainiak-master/examples/factoranalysis/latent_factor_from_tfa.py | # Copyright 2016 Intel Corporation
#
# 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... | 2,134 | 29.942029 | 82 | py |
brainiak | brainiak-master/examples/factoranalysis/latent_factor_from_htfa.py | # Copyright 2016 Intel Corporation
#
# 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... | 2,838 | 30.197802 | 90 | py |
brainiak | brainiak-master/examples/factoranalysis/htfa_cv_example.py | # Copyright 2016 Intel Corporation
#
# 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... | 11,484 | 32.289855 | 98 | py |
brainiak | brainiak-master/examples/eventseg/simulated_data.py | """Example of finding event segmentations on simulated data
This code generates simulated datasets that have temporally-clustered
structure (with the same series of latent event patterns). An event
segmentation is learned on the first dataset, and then we try to find the same
series of events in other datasets. We mea... | 3,607 | 34.372549 | 78 | py |
brainiak | brainiak-master/examples/fcma/corr_comp.py | # Copyright 2016 Intel Corporation
#
# 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... | 2,441 | 36 | 113 | py |
brainiak | brainiak-master/examples/fcma/classification.py | # Copyright 2016 Intel Corporation
#
# 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... | 9,178 | 49.434066 | 129 | py |
brainiak | brainiak-master/examples/fcma/mvpa_voxel_selection.py | # Copyright 2016 Intel Corporation
#
# 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... | 3,996 | 39.373737 | 94 | py |
brainiak | brainiak-master/examples/fcma/generate_fcma_data.py | # Copyright 2016 Intel Corporation
#
# 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... | 6,688 | 35.752747 | 79 | py |
brainiak | brainiak-master/examples/fcma/mvpa_classification.py | # Copyright 2016 Intel Corporation
#
# 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... | 4,017 | 40.42268 | 119 | py |
brainiak | brainiak-master/examples/fcma/voxel_selection.py | # Copyright 2016 Intel Corporation
#
# 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... | 4,518 | 42.038095 | 90 | py |
brainiak | brainiak-master/examples/funcalign/searchlight_srm_example.py | # Copyright 2016 Intel Corporation
#
# 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... | 6,342 | 33.851648 | 95 | py |
brainiak | brainiak-master/examples/funcalign/sssrm_image_prediction_example.py | # Copyright 2016 Intel Corporation
#
# 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... | 3,919 | 39.833333 | 119 | py |
brainiak | brainiak-master/examples/funcalign/srm_image_prediction_example.py | # Copyright 2016 Intel Corporation
#
# 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... | 7,161 | 40.639535 | 121 | py |
brainiak | brainiak-master/examples/funcalign/srm_image_prediction_example_distributed.py | # Copyright 2016 Intel Corporation
#
# 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... | 5,821 | 38.337838 | 120 | py |
brainiak | brainiak-master/examples/searchlight/example_searchlight.py | # Copyright 2016 Intel Corporation
#
# 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... | 2,954 | 27.970588 | 103 | py |
brainiak | brainiak-master/examples/searchlight/genre_searchlight_example.py | # The following code is designed to perform a searchlight at every voxel in the brain looking at the difference in pattern similarity between musical genres (i.e. classical and jazz). In the study where the data was obtained, subjects were required to listen to a set of 16 songs twice (two runs) in an fMRI scanner. The... | 3,829 | 36.54902 | 664 | py |
brainiak | brainiak-master/examples/hyperparamopt/hpo_example.py | # Copyright 2016 Intel Corporation
#
# 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... | 4,770 | 33.572464 | 77 | py |
brainiak | brainiak-master/tests/conftest.py | import multiprocessing
from mpi4py import MPI
import pytest
import numpy
import random
import tensorflow
def pytest_configure(config):
config.option.xmlpath = "junit-{}.xml".format(MPI.COMM_WORLD.Get_rank())
@pytest.fixture
def seeded_rng():
random.seed(0)
numpy.random.seed(0)
tensorflow.random.set... | 544 | 19.961538 | 76 | py |
brainiak | brainiak-master/tests/image/test_image.py | # Copyright 2017 Intel Corporation
#
# 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... | 6,093 | 34.225434 | 78 | py |
brainiak | brainiak-master/tests/io/test_io.py | # Copyright 2017 Intel Corporation
#
# 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... | 3,078 | 27.775701 | 77 | py |
brainiak | brainiak-master/tests/isc/test_isc.py | import numpy as np
import logging
import pytest
from brainiak.isc import (isc, isfc, bootstrap_isc, permutation_isc,
squareform_isfc, timeshift_isc,
phaseshift_isc)
from scipy.spatial.distance import squareform
logger = logging.getLogger(__name__)
# Create simple s... | 40,279 | 41.045929 | 78 | py |
brainiak | brainiak-master/tests/matnormal/test_matnormal_logp.py | import numpy as np
from numpy.testing import assert_allclose
from scipy.stats import multivariate_normal
import tensorflow as tf
from brainiak.matnormal.utils import rmn
from brainiak.matnormal.matnormal_likelihoods import matnorm_logp
from brainiak.matnormal.covs import CovIdentity, CovUnconstrainedCholesky
# X is m... | 1,232 | 25.234043 | 73 | py |
brainiak | brainiak-master/tests/matnormal/test_cov.py | import pytest
import numpy as np
from numpy.testing import assert_allclose
from scipy.stats import norm, wishart, invgamma, invwishart
import tensorflow as tf
from brainiak.matnormal.covs import (
CovIdentity,
CovAR1,
CovIsotropic,
CovDiagonal,
CovDiagonalGammaPrior,
CovUnconstrainedCholesky,
... | 9,042 | 28.07717 | 79 | py |
brainiak | brainiak-master/tests/matnormal/test_matnormal_logp_marginal.py | import numpy as np
from numpy.testing import assert_allclose
from scipy.stats import multivariate_normal
import tensorflow as tf
from brainiak.matnormal.utils import rmn
from brainiak.matnormal.matnormal_likelihoods import (
matnorm_logp_marginal_col,
matnorm_logp_marginal_row,
)
from brainiak.matnormal.covs ... | 1,662 | 23.820896 | 73 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.