text string |
|---|
<reponame>rashisht1/gradient_coding<gh_stars>1-10
from __future__ import print_function
import sys
import random
from util import *
import os
import numpy as np
import scipy.sparse as sps
import time
from mpi4py import MPI
def naive_logistic_regression(n_procs, n_samples, n_features, input_dir, is_real_data, params):
... |
#!/usr/bin/env python3
import cvxpy as cp
import numpy as np
import numpy.random as npr
import scipy.sparse as sp
import torch
from cvxpylayers.torch.cvxpylayer import CvxpyLayer
def simple_qp():
# print(f'--- {sys._getframe().f_code.co_name} ---')
print('simple qp')
npr.seed(0)
nx, ncon = 2, 3
... |
<filename>src/single_use/legacy/Mbary_Mhalo_2.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 09:48:41 2018
@author: asadm2
"""
from cosmo_utils.utils.stats_funcs import Stats_one_arr
from cosmo_utils.utils import work_paths as cwpaths
from progressbar import ProgressBar
import matplotlib.... |
<filename>src/normal/05_MCMC_estimation.py
# IMPORTS
import pymc3 as pm
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
import matplotlib.style as style
from IPython.core.display import HTML
# PLOTTING CONFIG
%matplotlib inline
style.use('fivethirtyeight')
plt.rcParams["figure.figsize"]... |
<gh_stars>10-100
#!/usr/bin/env python
# 2018 JHU CLSP (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import os
import numpy as np
from tqdm import tqdm
from scipy import signal
import gzip
import pickle
from utils import read_audio, log_sp
parser = argparse.ArgumentParser(desc... |
import unittest
import numpy as np
import scipy.sparse as sp
from pymatsolver import Diagonal
TOL = 1e-12
class TestBasic(unittest.TestCase):
def test_DiagonalSolver(self):
A = sp.identity(5)*2.0
rhs = np.c_[np.arange(1, 6), np.arange(2, 11, 2)]
X = Diagonal(A) * rhs
x = Diagona... |
<filename>mlapp/MLAPP_CODE/MLAPP-C5-Code/gammaPlotDemo.py
"""绘制图5.1"""
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
a_list = np.array([1,1.5,2])
b = 1
b_list = b*np.ones(len(a_list))
styles = ['k:','b--','r-']
for i in range(len(a_list)):
a = a_list[i]; b = b_list[i]
x_s = np.lins... |
<reponame>naxvm/ML4all
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 4 18:11:29 2014
@author: jarenas
"""
import numpy as np
from itertools import product
from scipy import spatial
import sys
def dd_hellinger(theta1,theta2):
""" Calcula la distancia de Hellinger entre distribuciones discre... |
<filename>pycollo/mesh.py
from typing import (Iterable, Optional, )
import numpy as np
import scipy.sparse as sparse
class PhaseMesh:
_DEFAULT_NUMBER_MESH_SECTIONS = 10
_DEFAULT_MESH_SECTION_SIZES = None
def __init__(self, phase: "Phase", *,
number_mesh_sections: Optional[int] = None,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from sklearn.metrics import roc_auc_score,roc_curve,auc,classification_report
from sklearn.svm import SVC,SVR,LinearSVR
from sklearn.linear_model import SGDRegressor
from sklearn.neural_network import MLPClassifier
from sklearn.pipeline import Pipeline
from sklearn.feature_extr... |
<gh_stars>1-10
import argparse
import random
import networkx as nx
import pandas as pd
import numpy as np
from tqdm import tqdm
from scipy import sparse
from collections import Counter
from texttable import Texttable
def parameter_parser():
"""
A method to parse up command line parameters. By default it gives... |
<reponame>Jiukaishi/Speech-recognition-using-MFCC-STFT-and-Mixed-feature
import numpy as np
import scipy.io
import copy
#generating STFT feature
def get_stft_data(path = 'SE_STFT.mat'):
data = scipy.io.loadmat(path)
data = np.array(data['DB'])
tags = data[:, 0]
tags.astype(int)
data = data[... |
<gh_stars>0
'''
Function involving the binomial distribution.
'''
__author__ = ['<NAME>']
__email__ = ['<EMAIL>']
from hep_spt.core import decorate, taking_ndarray
from hep_spt.stats.core import one_sigma
import numpy as np
from scipy.stats import beta, norm
__all__ = ['clopper_pearson_int', 'clopper_pearson_unc',
... |
# Connectome-based CNN-RNN
# 2021.03.16 <NAME>
###### import ######################
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.models import load_model
import scipy.stats as measures
from pymatreader import read_mat
####################################... |
<filename>pydmfet/oep/oep_main.py
import os,sys
import ctypes
import numpy as np
from scipy import optimize
from pyscf import lib, scf, mp, lo
from pyscf.tools import cubegen
import copy
from pydmfet import qcwrap,tools,subspac, libgen
from pydmfet.libcpp import oep_hess, mkl_svd
from pydmfet.opt import newton
from pyd... |
"""
Tests for MLP Regressor
"""
import sys
from unittest import mock
import numpy as np
import pytest
from sklearn.utils.testing import \
assert_equal, assert_array_almost_equal
import scipy.sparse as sp
from scipy.stats import pearsonr
from sklearn.datasets import load_diabetes, make_regression
from sklearn.util... |
<gh_stars>10-100
from itertools import groupby
from typing import Iterable, Optional, List, Tuple, Dict, Union
import numpy as np
from scipy.special import softmax
from lexsubgen.post_processors import PostProcessor
from lexsubgen.pre_processors import Preprocessor
from lexsubgen.prob_estimators import BaseProbEstima... |
"""plotting functions"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from pandas.core.dtypes.common import is_numeric_dtype
import seaborn as sns
from adjustText import adjust_text
from pandas.api.types import (
is_string_dtype,
is_categorical_dtype... |
from pathlib import Path
from copy import deepcopy
from sympy import symbols, Function
import numpy as np
from scipy.integrate import quad
from .smooth_reservoir_model_14C import SmoothReservoirModel_14C
from .pwc_model_run import PWCModelRun
from .helpers_reservoir import (
net_Rs_from_discrete_Bs_and_xs,
F_D... |
<gh_stars>1-10
import numpy as np
#===================================================================
#
# neutron star tidal remnant models
#
# Example:
# models = getModels()
# time = 1.0 ;# days past Time Zero
# models_at_t = modelsAtTimeT (models, time)
# abs_mag = models_at_t[0]
#
#
# tell me what th... |
<gh_stars>0
import numpy as np
from scipy import special as sps
import math
FWHM_COEFF = 2.*math.sqrt(2. * math.log(2.))
class Gaussian:
"""
Class encoding all functionality of the gaussian function. This includes
a function call, an evaluation of the function for all lines to be fit,
and a plot call... |
from __future__ import division
import subprocess
import os
import cPickle
from numpy import array
from scipy.stats.stats import pearsonr
#command
cmd = "python sense_entropy.py -i {input_folder} -w {resource} -r {reftype} -o {output_folder}"
#competition 1
input_folder = "/Users/marten/git/WSD_error_analysis/da... |
<reponame>Bharat-Runwal/path2vec
#!/usr/bin/python3
# coding: utf-8
import sys
from scipy import stats
if __name__ == '__main__':
file0 = sys.argv[1]
file1 = sys.argv[2]
print('Comparing files', file0, file1)
similarities0 = []
similarities1 = []
for line in open(file0, 'r').readlines():
... |
<filename>instances/medium/inst_m.py<gh_stars>0
import os
import numpy
import matplotlib.pyplot
import scipy.ndimage
import argparse
root, filename = os.path.split(__file__)
in_path = os.path.join(root, "in.jpg")
def parse_args():
parser = argparse.ArgumentParser(description="Reads an image and applies an Gauss... |
<filename>trains/binding/frameworks/fastai_bind.py<gh_stars>1-10
import statistics
import sys
import numpy as np
from . import _patched_call
from .tensorflow_bind import WeightsGradientHistHelper
from ..import_bind import PostImportHookPatching
from ...debugging.log import LoggerRoot
class PatchFastai(object):
... |
<reponame>lucast4/pyBPL
import numpy as np
import torch
from scipy.interpolate import interp1d
def unif_space(stroke, dist_int=1.):
"""
Transform a stroke so that it is uniformly sampled in space.
Translated from https://github.com/brendenlake/BPL/blob/master/data/uniform_space_lerp.m
Parameters
... |
<filename>codes/04.imbalanced/reordering_mask.py<gh_stars>0
from __future__ import print_function
from dolfin import *
import scipy
import numpy as np
def float_almost_equal(a, b):
tol = 1e-6
return (a > (b - tol)) and (a < (b + tol))
def almost_equal(matrix, item):
mask = np.zeros(np.alen(matr... |
<reponame>jedludlow/tolerance_interval_py
# -- coding: utf-8 --
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
#!/usr/bin/env python3
import pickle as pk
import numpy as np
import argparse
import scipy
import matplotlib.pyplot as plt
from gensim.corpora import Dictionary
from sklearn.manifold import TSNE
def transform(data, N):
new_data = scipy.sparse.lil_matrix((len(data), N), dtype=np.float32)
for i, row in enumera... |
## @ingroup Analyses-Aerodynamics
# Vortex_Lattice.py
#
# Created: Nov 2013, <NAME>
# Modified: 2014, <NAME>, <NAME>, <NAME>
# Feb 2016, <NAME>
# Apr 2017, <NAME>
# Nov 2017, <NAME>
# Dec 2018, <NAME>
# Apr 2020, <NAME>
# Jun 2020, <NAME>
# Sep ... |
<reponame>TimeWz667/PyEpiDAG
import numpy as np
from scipy.special import expit
from epidag.data.reg.hazard import *
from epidag.data.reg.linear import Regression, LinearCombination
__author__ = 'TimeWz667'
__all__ = ['CoxRegression', 'ZeroInflatedCoxRegression']
def find_baseline(js):
tp = js['Type'].lower()
... |
<reponame>taowu750/wtml
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
使用 LDA 算法重写识别手写数字的例子。
"""
import numpy as np
import scipy.io as scio
import model_selection as ms
from linear import LDA
from .display_data import display_data
if __name__ == '__main__':
'Part1: Loading and Visualizing data'
# data... |
<reponame>mr-cloud/user-interest
import os
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import roc_auc_score
from sklearn.preprocessing import MinMaxScaler, OneHotEncoder
from sklearn.model_selection import train_test_split... |
# -*- coding: utf-8 -*-
"""
Module for clustering vectors.
@author: <NAME>
"""
import numpy as np
from scipy import spatial, stats
from sklearn.grid_search import RandomizedSearchCV
def euclideansimilarity(a, b):
"""Similarity of vectors computed as inverse euclidean distance"""
return -np.linalg.norm(a-b)
... |
<gh_stars>1-10
'''
Human skin hyper-elastic model parameter identification.
The fixed pad (right pad) is fixed at zero displacement; the moving pad (left
pad) is subjected to incremental displacement. The reaction force is measured
at the moving pad.
The objective is to fit a hyper-elastic material model in terms of ... |
<gh_stars>10-100
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import io
import cv2
import json
import logging
import numpy as np
import tensorflow as tf
from typing import List
from scipy.spatial.transform import Rotation as R
from .. import data as g_data
from .base import BaseDa... |
<reponame>tbazina/optimize-straight-turning
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 19:05:57 2015
@author: tomislav
"""
import numpy as np
from scipy.optimize import minimize, differential_evolution
def postojanost(x, v, f, ap):
return x[0]/(v**x[1])/(f**x[2])/(ap**x[3])
def fun(x, t, v, f, ap):
s... |
<reponame>ishatserka/MachineLearningAndDataAnalysisCoursera<gh_stars>0
__author__ = '<NAME>, <EMAIL>'
from scipy import array
from .maze import MazeTask
from pybrain3.rl.environments.mazes import PolarMaze
class EightyNineStateMaze(MazeTask):
"""
#########
## ##
# # # #
## # # ##
# # ... |
import numpy as np
import warnings
from copy import copy
from scipy import stats
from si.data import Dataset
class VarianceThreshold:
def __init__(self, threshold=0):
if threshold < 0:
warnings.warn('The threshold must be a non-negative value.')
threshold = 0
self.threshold... |
import os
import torch
import statistics
import time
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import random
import numpy as np
from envs.env_factory import EnvFactory
from agents.agent_utils import select_agent
from utils import ReplayBuffer
BIN_WIDTH = 0.02
def load_envs_and_config(d... |
import PIL
import cv2
import numpy as np
import os
import argparse
from scipy.ndimage import interpolation
from tools import _init_paths
from model.config import cfg
from morelib.utils import xml_store
from data_augmentation.utils.xml_utils import show_object_cv_box
def zoom_images_and_save(scales,data_dir):
jpg... |
<filename>labelmodels/partial_labels.py
from .label_model import LabelModel, init_random, LearningConfig
import numpy as np
from scipy import sparse
import torch
from torch import nn
from copy import deepcopy as dc
import logging
class PartialLabelLearningConfig(LearningConfig):
"""Container for hyperparameters u... |
<reponame>the21st/pymatting<filename>pymatting/preconditioner/vcycle.py
import numpy as np
import scipy.sparse
def make_P(shape):
h, w = shape
n = h * w
h2 = h // 2
w2 = w // 2
n2 = w2 * h2
weights = np.float64([1, 2, 1, 2, 4, 2, 1, 2, 1]) / 16
x2 = np.repeat(np.tile(np.arange(w2), h2), 9... |
import math
from collections import deque
from ParadoxTrading.Indicator.IndicatorAbstract import IndicatorAbstract
from ParadoxTrading.Utils import DataStruct
from scipy.stats import kurtosis
class Kurtosis(IndicatorAbstract):
def __init__(
self, _period: int, _use_key: str = 'closeprice',
... |
# the file where i test my ideas before embedding them in the code
from fractions import *
print(Fraction(1,5)>Fraction(1,4))
a=[1,2,3,4,5]
print(a[-1])
a.extend([0]*5)
print(a)
a.extend([7])
print(a)
from helpers import *
dic={1: 7, 2: 5, '!': 1, 7: 2}
for i in dic:
print (i)
freqSym=dic[i]
print('freqSy... |
from mpl_toolkits.basemap import Basemap, cm
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import geopandas as gpd
from scipy import stats
import matplotlib as mpl
from shapely import geometry
#m.readshapefile('/home/akagi/Dropbox/NSF WSC AZ WEN Team Share/Electricity Demand/plots/util_proj/ut... |
<reponame>sfarrens/cosmostat
'''
Created on Mar 30, 2015
@author: Ming Jiang and <NAME>
CLASS FUNCTION class starlet2d()
Allow to perform a starlet transform, manipulate it (visualisation, thresholding, statistics, etc),
and to reconstruct.
If pysap is installed, then the p... |
"""
functions used for process and plot geo data
hard linked with that in CODE/
"""
__version__ = f'Version 1.0 \nTime-stamp: <2019-02-21>'
__author__ = "<EMAIL>"
import os
import scipy
import sys
from typing import List
import warnings
import hydra
import seaborn
from omegaconf import DictConfig
import cftime
impor... |
<reponame>joshloyal/ClumPy
from __future__ import division
import collections
import numpy as np
import scipy.stats as stats
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.ensemble import RandomForestClassifier
from sklearn.multiclass import OneVsRestClassifier
def top_k_features(estimat... |
# Field class (relativistic) for OLIVE
#
# Class is initialized with an array of modes and amplitudes as well as corresponding metadata
#
#
# Units
# -Assume CGS units for now
#
import numpy as np
from scipy.constants import c as c_mks
c = c_mks*1.e2
class Field(object):
def __init__(self, cavity):
""... |
# python3 construct.py 0 8 &
# python3 construct.py 1 8 &
# python3 construct.py 2 8 &
# python3 construct.py 3 8 &
# python3 construct.py 4 8 &
# python3 construct.py 5 8 &
# python3 construct.py 6 8 &
# python3 construct.py 7 8 &
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot a... |
import argparse
from argparse import RawDescriptionHelpFormatter
from pathlib import Path
import os
import numpy as np
from scipy import fftpack, ndimage
from skimage.filters import threshold_otsu
import tifffile
import pywt
import multiprocessing
import tqdm
from pystripe import raw
supported_extensions = ['.tif', '... |
import cauldron as cd
import matplotlib
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0}) # NOQA
import numpy as np
import seaborn as sns
sns.set() # NOQA, need this for styling
import pandas as pd
from scipy import stats
import statsmodels.formula.api as sm
import os, sys # NOQA
sys... |
<gh_stars>0
# Standard library imports.
import sys
import time
# Third party imports.
import numpy as np
import scipy as sc
import pandas as pd
import numba
#from scipy.sparse.linalg import spsolve
# Local imports.
from .base import abstract_solver, solve, progress_bar
class kds_solver(abstract_solver):
d... |
<reponame>ambrosejcarr/pysmFISH
from sympy import Point, Line, Segment
from skimage import feature, measure
import numpy as np
from scipy import ndimage as nd
def thr_calculator(filtered_img,min_distance,stringency):
"""
Function used to calculate the threshold to use for the dots
counting in a 2D image. ... |
<filename>flutterpy/derivatives/notations/_notation_definition.py
import sympy as sym
pi = sym.pi
i = sym.I
j = sym.I
d1, d2, d3, d4, d5, d6 = sym.symbols('d1 d2 d3 d4 d5 d6')
l1, l2, l3, l4, l5, l6 = sym.symbols('l1 l2 l3 l4 l5 l6')
m1, m2, m3, m4, m5, m6 = sym.symbols('m1 m2 m3 m4 m5 m6')
Ured = sym.symbols('Ured'... |
import pandas as pd
import numpy as np
import http.client, urllib.request, urllib.parse, urllib.error, base64
from scipy.sparse import hstack
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.model_selection import train_test_split
fr... |
import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
import scipy.integrate
from sys import float_info
import warnings
class Baseliner:
"""
A class for interactive baseliner of spectroscopic data.
The class works by being fed a spectrum and a matplotlib axis on which
it should b... |
import numpy as np
import pytest
import sympy
from zquantum.core.circuits import RX, RY, RZ, XX, XY, YY, Circuit, H, I, X, Y, Z
class TestCreatingUnitaryFromCircuit:
@pytest.fixture
def cirq_unitaries(self):
"""
Note: We decided to go with file-based approach after extracting cirq
from... |
<filename>Math Solver/libaries.py
from tkinter import *
from tkinter import messagebox
from settings import *
from sympy import *
from sympy import core
|
<reponame>negrinho/deep_architect_legacy
import numpy as np
import scipy.sparse as sp
import sklearn.linear_model as lm
from pprint import pprint
from darch.base import *
import copy
def evaluate_and_print(evaluator, model,
output_to_terminal, ignore_invalid_models):
if output_to_terminal:
pprint... |
<reponame>joferkington/scipy2015-3d_printing
import tempfile
from mayavi import mlab
import Image
import numpy as np
import geoprobe
import scipy.ndimage
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import utils
def main():
vol, top = load_data()
downsample = 3
fig = mlab.figure(bgcolo... |
<gh_stars>10-100
# Copyright (c) 2016-2019 <NAME>
#
# This file is part of XL-mHG.
"""Tests for the Python implementation of the XL-mHG test."""
import itertools as it
import pytest
import numpy as np
from scipy.stats import hypergeom
from xlmhg import mhg
# v_ex = np.uint8([1,0,1,1,0,1] + [0]*12 + [1,0]) # examp... |
<gh_stars>1-10
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "l... |
<filename>gfootball/env/observation_preprocessing.py<gh_stars>0
# coding=utf-8
# Copyright 2019 Google LLC
# 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... |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2018-11-09 13:35:55
# @Author : <NAME> (<EMAIL>)
# @Link : http://example.org
# @Version : $Id$
import yaml
import numpy as np
import pandas as pd
import matplotlib.pyplot as py
import scipy.ndimage
from pyfftw.builders import fft2
from py... |
import numpy as np
import scipy
import torch
perm_dict = {
"xyz": [0, 1, 2, 0, 2],
"zyx": [2, 1, 0, 1, 3],
}
def coords3inds(coords, nz, ny, nx):
coords = coords.to(torch.int32)
# gperm = nx * ny * nz
# gperm1 = nx * ny
# gperm2 = nx
gperm = torch.tensor(nx * ny * nz, dtype=torch.int32, d... |
""" functions to sort, compute stats, and compare arrays of eigenmodes"""
import pandas as pd
import numpy as np
from scipy.spatial import distance
from scipy.stats import entropy, spearmanr, pearsonr
def eig_fc_get_standardz(x, y, binary_thresh=0.1, nreps=1000):
"""Permutes both canonical networks and input ei... |
<reponame>oesteban/pyregseg<gh_stars>0
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function, division, absolute_import, unicode_literals
from nipype.pipeline import engine as pe
from nipype.interfa... |
### ndio membrane segmentation imports
import ndio
print ndio.version # Prints version
import ndio.remote.OCP as OCP
oo = OCP()
import ndio.remote.OCPMeta as NDLIMS
nn = NDLIMS()
###
### Watershed segmentation imports
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
from skimage.... |
import numpy as np
import scipy.sparse as sp
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import xavier_uniform_
device = 'cuda' if torch.cuda.is_available() else 'cpu'
def normt_spm(mx, method='in'):
if method == 'in':
mx = mx.transpose()
rows... |
<filename>mdtools/lib/units.py
import scipy.constants
#==============================================================================#
ec = scipy.constants.elementary_charge
kB = scipy.constants.Boltzmann
eps0 = scipy.constants.epsilon_0
Navo = scipy.constants.Avogadro
#=====================================... |
"""
@file
@brief CorrPlot functionalities.
It comes from `corrplot.py <https://raw.githubusercontent.com/biokit/biokit/master/biokit/viz/corrplot.py>`_
which I copied here because the module does not properly work on Python 3 (import issues).
See also `biokit license <https://github.com/biokit/biokit/blob/master/LICEN... |
import scipy.linalg as la
import numpy as np
from sparsesvd import sparsesvd
from scipy.sparse import csc_matrix
def BICv(X, u, v_tilde, sigma2_hat_v, n, d): #it's the nd times of the original bic
"""
This function return the n*d times of the original BIC.
Only used for internal use for the SSVD function.... |
from __future__ import division
import gym
import numpy as np
import random
import tensorflow as tf
import tensorflow.contrib.slim as slim
import matplotlib.pyplot as plt
import scipy.misc
import os
%matplotlib inline
# --------------------------------------------------
# 加载游戏环境
# 你可以自行调整游戏难度(网格大小),小的网格可以使网络训练更快,大的网格可... |
<gh_stars>0
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
import scipy
# user defined imports
from undistort import undistortImage
from thresholdBinaryImage import *
from showImageSideBySide import *
from applyPerspectiveTransform import *
from drawOnLane i... |
from math import exp, pi
from scipy.integrate import quad
import numpy as np
import stats_arrays as sa
###1. MATHS
# Calculate area under normal distribution within +-3 sigma interval from the mean.
# Probability of a value to fall within this interval is THREE_SIGMA_Q = 99.7%.
# This way tails of normal/lognormal dis... |
# Adopted form SfePy project, see http://sfepy.org
# Thanks to <NAME>
import time
import numpy as nm
import scipy.sparse as sp
from .base import Struct, get_default, output, assert_
from .meshio import MeshIO
##
# 28.05.2007, c
def make_point_cells(indx, dim):
conn = nm.zeros((indx.shape[0], dim + 1), dtype=nm.i... |
"""
miscellaneous functions and classes to work with Brainsight output
Author: <NAME>, M.D. [<EMAIL> / <EMAIL>]
"""
import pandas as pd
import numpy as np
from collections import defaultdict
import os
from .coordinates import Coords, FreesurferCoords
from datetime import datetime
import matplotlib.pyplot as plt
from .... |
<gh_stars>1-10
"""
The MIT License (MIT)
Copyright (c) 2018 <NAME>
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import numpy as np
import scipy as scp
import logging
logging.basicConfig(format='%(asctime)s %(levelname)s %(mes... |
<gh_stars>10-100
#!/usr/env/python2
from __future__ import absolute_import, print_function, division
# starvine imports
import context
from starvine.mvar import mvd
from starvine.vine.C_vine import Cvine
from starvine.mvar.mv_plot import matrixPairPlot
import starvine.bvcopula as bvc
import matplotlib.pyplot as plt
#
f... |
<filename>Service/Model.py
# بكي صاحبي لما رأى الدرب دونه *** و أيقن أنا لاحقان بقيصرا
# فقلت له لا تبكي عينك إنما *** نحاول ملكا أو نموت فنعذرا
# إمرؤ القيس
import pydicom
import enum
import matplotlib.pyplot as plt
from scipy import ndimage
import logging
from Service.GRAIL import Gabor_information
from Mapper.mat... |
import os
os.environ['WINNOW_CONFIG'] = os.path.abspath('../config.yaml')
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
from glob import glob
from winnow.feature_extraction.extraction_routine import load_featurizer
from winnow.feature_extraction.utils import load_image,load... |
<reponame>Championchess/Generative-3D-Part-Assembly<gh_stars>10-100
"""
Using min_of_n loss
B-Global to directly regress 3 translation + 4 quaternion
Input:
part point clouds: B x P x N x 1000
Output:
R and T: B x P x (3 + 4)
Losses:
Center L2 Loss, Rota... |
<gh_stars>10-100
import pyccl
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
import astropy.cosmology as csmm
from astropy.constants import c,G
from astropy import units as u
#If you have issues running this script, contact <NAME> (<EMAIL>)
cosmo=csmm.FlatLambdaCDM(70.,0.3,Tc... |
<reponame>saveriogzz/cloudnetpy
"""Radar module, containing the :class:`Radar` class."""
import math
from typing import Union
import numpy as np
import numpy.ma as ma
from scipy import constants
from cloudnetpy.categorize import DataSource
from cloudnetpy.categorize.classify import ClassificationResult
from cloudnetpy ... |
<reponame>marcomusy/FearlessHearts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from scipy.interpolate import splev, splrep
data_path_wt = 'data/wt/'
data_path_ko = 'data/ko/'
grid_res = 50
radius_res = 50
nsomites = [10, 14, 18.5, 21.5, 24.5, 28.5]
dataset_ko = dict(
comment='Arid3b Knock-O... |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import numpy as np
import math
import cmath
I = np.array([[1, 0], [0, 1]])
X = np.array([[0, 1], [1, 0]])
Y = np.array([[0, -1], [1, 0]]) * 1j
Z = np.array([[1, 0], [0, -1]])
H = np.array([[1, 1], [1, -1]]) / math.sqrt(2)
S ... |
# -*- coding: utf-8 -*-
# @author:<NAME>
import scipy.io as sio
from sklearn.model_selection import GridSearchCV, cross_val_score, KFold
from sklearn.svm import SVC
from sklearn.preprocessing import MinMaxScaler
import pandas as pd
from visualization import plot_cvscores_SVM, plot_tsne, plot_decision, plot_leani... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 15:08:04 2020
@author: Warmachine
"""
import os
import scipy.io as sio
import torch
from torch.utils.data import Dataset, DataLoader
import h5py
import numpy as np
import time
import pandas as pd
from PIL import Image
import cv2
import pdb
def co... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 9 08:20:58 2018
@author: <NAME>
"""
import matplotlib.pyplot as plt
from scipy import exp
#from scipy.special import gamma, erf
import numpy as np
import pandas as pd
from scipy.optimize import minimize
#import time
def NO(S, x):
# normal distribution
return 1... |
"""
File name : Mass flow parameters function
Author : <NAME>
Email : <EMAIL>
Date : September/2020
Last edit : September/2020
Language : Python 3.8 or >
Aeronautical Institute of Technology - Airbus Brazil
Description:
-
Inputs:
-
Outputs:
-
TODO's:
-
"""
# ==============================... |
# usage:
# first_update last_update h5_filenames
import numpy as np
import h5py
import sys
import scipy.stats as stats
from tqdm import tqdm
import os
import pandas as pd
from keyname import keyname as kn
from fileshash import fileshash as fsh
from collections import defaultdict
from joblib import delayed, Parallel
f... |
# -*- coding: utf-8 -*-
"""
handles functions required for hmm classification
"""
import numpy as np
from hmmlearn import hmm
from scipy.stats import mode
from DataNexus.datahandler import DataHandler
from sklearn.metrics import roc_auc_score
import traceback
class HMMClassifier:
# tensor to list (for HMM in... |
<gh_stars>1-10
# Copyright (c) <2021> <University of Paderborn>
# Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/
# https://github.com/SSTGroup/independent_vector_analysis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software a... |
<reponame>vveitch/causal-network-embeddings
import tensorflow as tf
from scipy.special import expit, logit
import numpy as np
import scipy.stats as stats
from relational_ERM.data_cleaning.pokec import load_data_pokec, process_pokec_attributes
def simulate_y(propensities, treatment, beta0=1.0, beta1=1.0, gamma=1.0):
... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Trains a model to locate cat faces in images (assumes that the image contains a cat face).
"""
from __future__ import absolute_import, division, print_function
from dataset import Dataset
import numpy as np
import argparse
import random
import os
from scipy import misc
from ... |
<reponame>PabloAlvarado/GPitch
import numpy as np
from scipy import optimize
def sample_cov(x, niter, msize):
"""Infer covariance matrix by sampling segments from a large vector"""
cov = np.zeros((msize, msize))
samples = niter*[None]
for i in range(niter):
idx = np.random.randint(0, x.size - ... |
import os
import math
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from PIL import Image
import numpy as np
from torch.autograd import Variable
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from data.dataloader import devdata
from scipy impor... |
<gh_stars>1-10
import numpy as np
import time
import torch
import torch.nn as nn
from torch.autograd import grad
import h5py
import torch.optim as optim
import scipy.io
from torch.autograd import Variable
import torch.optim as optim
from enum import Enum
from Dataset import SchrodingerEquationDataset
import matplotlib.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.