text string |
|---|
<reponame>SamuelBrand1/covid-19-in-households-public<filename>model/preprocessing.py
'''Various functions and classes that help build the model'''
from abc import ABC
from copy import copy, deepcopy
from numpy import (
append, arange, around, array, cumsum, log, ndarray, ones, ones_like,
where, zeros, c... |
<filename>mmseg/datasets/pipelines/compose.py
# Copyright (c) 2020-2021 The MMSegmentation Authors
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import collections
from copy import deepcopy
import numpy as np
from scipy.ndimage import gaussian_f... |
<gh_stars>1-10
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from torchvision import datasets, transforms
from skimage import io
from PIL import Image
import os
import argparse
from sklearn.metrics import classification_report
import matplotlib.pyplot as plt
import cv2
import rand... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 3 10:47:08 2020
@author: kellenbullock
Whats left:
mean center equation, and weighted version....
mapping all centroids and standard distances....
writing out all answers....
"""
import pandas as pd
import geopandas as gpd
i... |
#!/usr/bin/env python
#############################################################################
# Copyright (C) 2018 OpenEye Scientific Software, Inc.
#############################################################################
#
# TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
# provided to cu... |
<filename>sessio3/resize.py
# Reads an image from disk and scales and crops to match a target resolution and aspect ratio.
from scipy import misc
import matplotlib.pyplot as plt
curl = misc.imread('curl.jpg')
print(curl.shape)
plt.imshow(curl)
plt.show()
curl_resized = misc.imresize(curl, 3000.0 / len(curl), interp='... |
import numpy as np
from math import factorial
from scipy.special import binom
from numba import jit
from CHECLabPy.core.spectrum_fitter import SpectrumFitter
class GentileFitterOld(SpectrumFitter):
def __init__(self, n_illuminations, config_path=None):
super().__init__(n_illuminations, config_path)
... |
"""
Script calculates and plots trends in PIOMAS SIV
Author : <NAME>
Date : 13 September 2016
"""
### Import modules
import numpy as np
from netCDF4 import Dataset
import scipy.stats as sts
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import datetime
import iris as ir
import iris.quickplot... |
import os, sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from bdpy.ml import add_bias
from bdpy.stats import corrcoef
from bdpy.preproc import select_top
from scipy import stats
from slir import SparseLinearRegression
from sklearn.linear_model import LinearRegression
def corr2_coeff(x, y... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyPulses Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------... |
<gh_stars>1-10
import numpy as np
import numpy.linalg as npl
from numpy import sin, cos, tan
from math import pi
from scipy.integrate import odeint
from scipy.integrate import ode
import matplotlib.pyplot as plt
import PD
from control import lqr
class Quadrotor(object):
"""docstring for Quadrotor."""
def ... |
import os,sys
PROJECT_ROOT = os.environ['ULS_ROOT_DIR']
sys.path.append(PROJECT_ROOT)
from Parameters import *
import pickle
import matplotlib.pyplot as plt
import statistics as stat
import numpy as np
import seaborn as sns
import pandas as pd
from matplotlib.patches import Ellipse
import sys,os
import matplotlib
from... |
"""Compute group and effective index for different waveguide widths and heights.
Reproduce Yufei thesis results with MPB.
https://www.photonics.intec.ugent.be/contact/people.asp?ID=332
"""
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.interpolate import interp2d
i... |
import torch
try:
import torch_kdtree # if built with setuptools
except:
import os, sys; sys.path.append(os.path.join(os.path.dirname(__file__), "../../build")) # if built with cmake
import torch_kdtree
from torch_cluster import radius
from scipy.spatial import cKDTree
from time import time
import numpy as ... |
<reponame>megvii-research/OMNet
import logging
import math
import megengine as mge
import megengine.distributed as dist
import numpy as np
from common import se3, so3, utils
from scipy.spatial.transform import Rotation
from megengine.data.transform import Transform
_logger = logging.getLogger(__name__)
def uniform_2... |
"""Transformation tensorflow layers"""
import tensorflow as tf
from scipy import constants
class trafo_indep(tf.keras.layers.Layer):
'''Class to transfor inputs for Hit Net
Independent angles
'''
speed_of_light = constants.c * 1e-9 # c in m / ns
def __init__(self, labels):
s... |
from __future__ import division
import random
import numpy as np
import scipy.signal
import tensorflow as tf
seed = 1
random.seed(seed)
np.random.seed(seed)
tf.set_random_seed(seed)
dtype = tf.float32
def discount(x, gamma):
assert x.ndim >= 1
return scipy.signal.lfilter([1], [1, -gamma], x[::-1], axis=0)[... |
"""This module contains various metrics used across synthesized."""
import warnings
from typing import List, Optional, Sequence, Union, cast
import dcor as dcor
import numpy as np
import pandas as pd
from scipy.spatial.distance import jensenshannon
from scipy.stats import entropy, wasserstein_distance
from sklearn.lin... |
import doseresponse as dr
import matplotlib
#matplotlib.rc('font', family='ubuntu')
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
import itertools as it
import numpy as np
import numpy.random as npr
import scipy.stats as st
import sys
parser = argparse.ArgumentParser()
parser.add_argument("-a"... |
# Write your solution here
import fractions
def fractionate(amount: int):
frac_list = []
numerator = 1
demonerator = amount
p = fractions.Fraction(numerator,demonerator)
i = 1
while i <= amount:
frac_list.append(p)
i += 1
return frac_list
if __name__=="__main__":
for p i... |
<gh_stars>1-10
import os
import math
import shutil
from configparser import ConfigParser
import numpy as np
from scipy.interpolate import interp1d
from scipy.stats import trimboth
import build.ss2d as ss2d
#######################################
import matplotlib
# Force matplotlib to not use any Xwindows backend.
# ... |
import numpy as np
import math
import matplotlib.pyplot as plt
from kernel_generalization.utils import gegenbauer
import scipy as sp
import scipy.special
import scipy.optimize
from kernel_generalization.utils import neural_tangent_kernel as ntk
###############################################################
########... |
from voice_activity_detection import vad
from speech_emotion_recognition import feature_extraction as fe, ensemble
import scipy
import numpy as np
from scipy import signal
from scipy.io.wavfile import write
import datetime
def denoise(samples):
"""
:param samples: an array representing the sampled audio file
... |
<gh_stars>0
import os
import numpy as np
import cv2
import random
import csv
import h5py
import scipy.misc
from scipy import ndimage
from skimage import io, transform, filters
from skimage import morphology as morph
from skimage import color
from skimage.morphology import skeletonize
from skimage.filters import gaus... |
import numpy as np
from scipy.spatial.distance import cdist
class Silhouette:
def __init__(self, metric: str = "euclidean"):
"""
inputs:
metric: str
the name of the distance metric to use
"""
self.metric = metric ## we give the atribute
def _mean_di... |
<reponame>nokia/causality_health_project
# Data preprocessing splitting
# This code is written to split the raw signals from the MIT BIH sleep dataset into 30 second epochs. These epochs are then split further into 4 channels (ECG, BP, EEG and Resp)
from IPython.display import display
import matplotlib.pyplot as... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 24 15:08:02 2018
@author: rdamseh
"""
from util import *
from scipy import io as sio
from time import time
import timeit
import scipy.sparse as s
import scipy.sparse.linalg as la
class graphContraction:
def __init__(self, label=No... |
# Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, check out LICENSE.md
import os
import numpy as np
import torch
from scipy import linalg
from imaginaire.evaluation.common import load_or... |
import warnings
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import sys_id_utils
num_pts = 5000
t0 = 0.0 # Start time
t1 = 20.0 # End time
# Yaw dynamics + controller model parameters
model_param = {
'inertia' : 1.0,
'damping' : 0.0,
'pro_gain' : 5.0,
'in... |
<gh_stars>1-10
from sympy import pi
from math import *
from cmath import *
# General expression for sinusoid:
# v(t) = Vm*sin(w*t + phi)
# where,
# phi = phase
# If comparing two sinusoids phase1 != phase2 then "out of phase".
# One sinusoid leads or lags by phase in radians or degrees.
# If phase difference = 0 the... |
<reponame>basilevh/dissecting-image-crops<gh_stars>10-100
'''
Image crop detection by absolute patch localization.
Neural network architecture description in PyTorch.
<NAME>, Fall 2020.
'''
# Library imports.
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
import random
import sci... |
"""Comparison between I-V curves obtained by using the smooth nonlinear
memristance approximation function introduced in the study by <NAME>.; <NAME>. and <NAME>.: Steady periodic memristor oscillator with
transient chaotic behaviours, Electronic Letters, doi:
10.1049/el.2010.3114, and by using the formulation that out... |
import torch
import clip
from PIL import Image
import json
import cv2
import numpy as np
from tqdm import tqdm
import math
from math import log
from torch.nn.utils.rnn import pad_sequence
import sys
import time
import os
from collections import defaultdict, Counter
from multiprocessing import Pool
from functools import... |
<filename>utils/plot_utils.py
import os
import numpy as np
import pandas as pd
from math import isclose
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.tsa.api as smt
import ruptures as rpt
import ruptures.metrics as rptm
from itertools import cycle
from ruptures.utils import pairw... |
<filename>ground_surveyor/uf_creator.py<gh_stars>1-10
import os
import logging
import numpy
import json
import scipy
import scipy.signal
import scipy.ndimage
from osgeo import gdal, gdal_array
from ground_surveyor import gsconfig
UF_TILE_SIZE = gsconfig.UF_TILE_SIZE
MEDIAN_FILTER_SIZE = 11
LARGE_SCALE_FILTER_SIZE_MI... |
<filename>code/functions.py
from tqdm.notebook import trange, tqdm
import os
from random import random
import pandas as pd
from pandas.tseries.offsets import CustomBusinessMonthBegin, BDay
from pandas.tseries.holiday import *
import matplotlib
import numpy as np
import csv
import itertools
import pickle as pkl
from war... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as stats
times = pd.read_csv('servicetime_data.csv')
x = times['ser_time'].values
xvalues = list(x)
times.plot.hist(bins=150)
plt.xlabel('Service Time')
plt.ylabel('Frequency')
pl... |
'''
You should not edit helper.py as part of your submission.
This file is used primarily to download vgg if it has not yet been,
give you the progress of the download, get batches for your training,
as well as around generating and saving the image outputs.
'''
import re
import random
import numpy as np
import os.pa... |
'''
Classes and functions to work with the CLs method.
'''
__author__ = ['<NAME>']
__email__ = ['<EMAIL>']
from collections import namedtuple
from hep_spt.core import decorate
from hep_spt.stats.core import rv_random_sample
import numpy as np
from scipy.stats import rv_discrete, rv_continuous
__all__ = [
'CLsTS... |
import numpy as np
import gym
import copy
from controller import get_robot_qpos_from_obs, open_gripper, equal, \
closed_gripper, open_gripper, drake_ik
from policies.policy import SingleAPolicy
import sys, os
sys.path.extend([
os.path.join('pybullet-planning'),
os.path.join('..', '..', 'pybullet-planning')
... |
#This is for transforming the .npy file saved in python2 to python3
import numpy as np
import os
import scipy.io
params = np.load('mscnn_ped_cyc_kitti_trainval_2nd_iter_15000.npy').item()
#make matlab file
scipy.io.savemat('mscnn_ped_cyc_kitti_trainval_2nd_iter_15000.mat',params)
''' #make txt files(failed)
os.mkdir(... |
import numpy as np
from scipy import stats
from bab.make_data import make_data
from bab.power import get_power
np.random.seed(1)
def test_power(stan_model):
n = 10
samples = 5000
delta = 1.2
tally_rejection = 0
for i in range(samples):
y1 = stats.norm.rvs(delta, 1, n)
y2 = stat... |
import tensorflow as tf
from sympy import *
# my custom class with description attribute
class MySymbol(Symbol):
def __new__(self, name, description=''):
obj = Symbol.__new__(self, name)
obj.description = description
return obj
T_t, P_t, A_r, C, c_p, D, I_en, I_tc, M, mdot_as, m_ae, mdot... |
import numpy as np
from .grad1D import grad1D
from scipy import sparse
from scipy.sparse import csr_matrix
def grad2D(k, m, dx, n, dy):
"""Computes a two-dimensional mimetic gradient operator
Arguments:
k (int): Order of accuracy
m (int): Number of cells along x-axis
dx (float): Step ... |
import argparse
import os
import tensorflow as tf
import math
import scipy.misc
import numpy as np
import importlib
import models.model as model
import glob
import random
def parseArgs():
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=str, default=None, help='model name')
parser.ad... |
#This code is based on the implementation of calibration functions available here: https://github.com/dirichletcal/experiments_neurips/blob/master/calib/utils/functions.py
import numpy as np
from scipy.stats import rankdata
from scipy.stats import friedmanchisquare
from scipy.stats import wilcoxon
from scipy.stats impo... |
<gh_stars>1-10
'''
Atmospheric Correction utilities to manage LUT and atmosphere parameters (aerosols, gases)
'''
import os, sys
import numpy as np
from matplotlib import pyplot as plt
from netCDF4 import Dataset
from scipy.interpolate import RectBivariateSpline
from scipy.optimize import curve_fit
from . import con... |
<reponame>rgschmitz1/BioDepot-workflow-builder
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
from os import path, remove
from unittest.mock import Mock, patch
import pickle
import tempfile
import warnings
import numpy as np
import scipy.sparse as sp
from AnyQt.QtCo... |
<filename>partition_test/download_ogbn_products.py
import os
import os.path
import numpy
import scipy.sparse
import torch
from torch_geometric.data import (InMemoryDataset)
"""
TODO: Need to additionally import the following library to use ogb
"""
from ogb.nodeproppred import DglNodePropPredDataset # Load Node Propert... |
'''
function [w, b] = Functional_Linear(Train, ep)
Differentially private linear regression using Funcational Mechanism.
Input parameters:
Training data (Train) with last column attribute to be predicted.
Train = [x1, x2, ..., xd, y]
NOTICE: The values of EACH attribute (column) should be converted from [min,
max] t... |
import os
from io import BytesIO
import numpy as np
import re
import scipy.misc
# import tensorflow as tf
import torch
def load_saved_model(path, model, optimizer):
latest_path = find_latest(path)
if latest_path is None:
return 0, model, optimizer
checkpoint = torch.load(latest_path)
step_... |
<gh_stars>0
# ----------------------------------------------------------------------------
# Copyright (c) 2015, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------------------------... |
#AlgName.py
#
#This script shows how to code a new graph-based learning
#algorithm and incorporate it into ssl_trials to
#compare to other SSL algorithms.
import graphlearning as gl
import numpy as np
import scipy.sparse as sparse
import os
#Below we define a new ssl algorithm. The name must be 'ssl'. The file nam... |
<gh_stars>0
"""
ParameterizedSource.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Wed Oct 2 16:54:04 MDT 2013
Description:
"""
import numpy as np
from scipy.integrate import quad
class ParameterizedSource(object):
""" Class for creation and manipulation of parameterized radiat... |
from ....utils.Algebra import normalize
from ..Ray.ray import Ray
from ..Ray.ray_hit import RayHit
from scipy.spatial.transform import Rotation as R
from ..Shader.temp import shade
import numpy as np
from numba import jit, double, typeof
from numba.experimental import jitclass
from src.utils.timer import timeit
impor... |
<reponame>maria-kuruvilla/temp_collective_new
"""
Created on Thu Dec 3 2020
@author: <NAME>
Goal - proportion of individuals that startle (using only masked data)
"""
import os
import pathlib
from pprint import pprint
import numpy as np
from scipy import stats
from scipy.spatial import distance
import matplotlib.p... |
<reponame>DinoMan/dino-tk<gh_stars>1-10
from skimage.color import rgb2grey
from scipy import fftpack
import numpy as np
import numpy.ma as ma
def _dict_divide_(dividends, divisors):
ret = dict()
for key, dividend in dividends.items():
ret[key] = dividend / divisors.get(key, 1)
return ret
def _ge... |
<filename>WassersteinGAN/src/utils/data_utils.py
import cv2
import glob
import h5py
import imageio
import matplotlib.pylab as plt
import matplotlib.gridspec as gridspec
import numpy as np
import os
from scipy import stats
from keras.datasets import mnist, cifar10
from keras.optimizers import Adam, SGD, RMSprop
from ke... |
import pandas as pd
import numpy as np
import copy
import sympy as sp
from sympy import sympify
def get_pivotzeile(copy_tableau, pivot_spalte, anzahl_zeilen):
# soll original Tableau nicht ändern
copy_tableau = copy.deepcopy(copy_tableau)
# wähle Ressourcenverbrauchskoeffizienten der Pivotspalte
pivo... |
<reponame>maipbui/pcc_geo_cnn_v2
#!/usr/bin/python
# Copyright 2014 Google.
#
# 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 requir... |
import statistics
from fractions import Fraction
def test_floats():
a = 2.0
b = 3.0
c = 4.0
c += a * b
assert c == 10.0
c /= a + b
assert c == 2.0
c %= a % b
assert c == 0.0
def test_ints():
a = 2
b = 3
c = 4
c += a * b
assert c == 10
c /= a + b
assert... |
"""
Tests for priors.
"""
# pylint: disable=missing-docstring
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import numpy.testing as nt
import scipy.optimize as spop
import reggie.core.priors as priors
### BASE TEST CLASS ###########... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
# Demonstration of Variable Importance-considering Support Vector Regression (VI-SVR)
import math
import matplotlib.figure as figure
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
from sklearn import svm
... |
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
import numpy.fft as fft
import scipy.signal as sig
# In[1]:
def noisyrk4(s,t,tau,derivsRK,i,vN0,vN1,vN2):
"""modified RK4 integrator including noise
DEPENDENCIES
none
INPUTS
s - initial state vector [delta]
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
import math
import os
import re
import warnings
import ants
import numpy as np
import scipy
from dependencies import ROOTDIR, lead_settings
from utils.HelperFunctions import Configuration, LeadProperties
cfg = Configuration.load_config(ROOTDIR)
def fu... |
import csv
import cmath
import datetime
import distance
pathFile = "ConflictData.csv"
def extract(coordinatesPoint, distanceMax = 'default', yearsAgo = 'default'):
if distanceMax == 'default':
distanceMax = 50
if yearsAgo == 'default':
yearsAgo = 25
with open(pathFile) as csv_file... |
import numpy
import scipy.signal
from generate import *
def generate():
def agc(target, gain_tau, power_tau, x):
# Compute average power
power_alpha = 1/(1 + power_tau*2)
average_power = scipy.signal.lfilter([power_alpha], [1, -1+power_alpha], numpy.abs(x)**2).astype(x.dtype)
# Com... |
<filename>preprocess/resample.py
import os
import numpy as np
import pickle
from scipy.spatial.transform import Rotation, Slerp
from scipy.interpolate import interp1d
import json
from glob import glob
from tqdm import tqdm
import sys
sys.path.append("../")
from global_vars import *
def resample(imu_data, contact_da... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi: ts=4 sw=4
import pickle
from ..Protocols import *
import matplotlib.patches as patches
import skimage
def re_name_convention(name_convention=None, **kwargs):
# Naming convention for raw data files, returned as
# a string suitable for use in RE (regular expres... |
<gh_stars>0
import datetime as dt
import os
import yaml
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import linregress
def fit_p_rx(d, p_rx, deg, info=False):
"""Return linear or polynomial fit for a given 1-d array of power
measured on the receiver end.
Parameters
----------
... |
<filename>main.py
from PIL import Image
import os, sys
import fractions
im = Image.open(input())
rgb_im = im.convert('RGBA')
(w,h)=im.size
print(w,h)
coord=input("Coord.(x,w):")
coord=coord.split(",")
coord=list(map(int,coord))
print("Transparent color:")
rf=input("\tr:")
gf=input("\tg:")
bf=input("\tb:")
af=input("\t... |
import collections
import abc
import colorama
import numpy as np
import scipy
import sklearn.mixture
import scipy.stats
import state
import mposterior
# a named tuple for a more intuitive access to a "exchange tuple"
ExchangeTuple = collections.namedtuple(
'ExchangeTuple', ['i_PE', 'i_particle_within_PE', 'i_neighbo... |
## Delevoped by <NAME> and <NAME>.
from sympy import bell, symbols, factorial, simplify
def m_formula(power, tau = True):
r"""
Generate the formula for the conditional moments with second-order
corrections based on the relation with the ordinary Bell polynomials
.. math::
M_n(x^{\prime},\tau... |
import math
import os.path
import os
import itertools
import numpy as np
import matplotlib.pyplot as plt
import scipy
from scipy.signal import savgol_filter
from sklearn.metrics import roc_curve, auc
import settings
OUTLIER_LIMIT = 60
FLOAT_ERROR = 0.000001
def movingaverage(interval, window_size):
window = np.on... |
<filename>generate_temporal_interpolations.py
import pandas as pd
import numpy as np
import numpy.matlib
from scipy import stats
from sklearn import linear_model
import statsmodels.api as sm
from statsmodels.tsa.api import ExponentialSmoothing, SimpleExpSmoothing, Holt
def bin_sets(x,y,x_step):
x_b = np.aran... |
from bci_framework.extensions.visualizations import EEGStream, Widgets
from bci_framework.extensions.data_analysis import loop_consumer
from bci_framework.extensions import properties as prop
import numpy as np
import logging
from scipy.fftpack import rfft, rfftfreq
from cycler import cycler
import matplotlib
###... |
from __future__ import division
import mandel
import mandel_colormap
from scipy.ndimage.filters import gaussian_filter, median_filter
import scipy.misc as smp
# this script generates a nice looking static picture of the mandelbrot set.
# target resolution
x_res = 200
y_res = 200
# in the following you find some samp... |
<reponame>alexrudy/aopy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# try_gn_wind.py
# aopy
#
# Created by Jaberwocky on 2013-04-18.
# Copyright 2013 Jaberwocky. All rights reserved.
#
from __future__ import (absolute_import, unicode_literals, division,
print_function)
... |
<filename>final_server.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 11 18:06:02 2019
@author: Mars
"""
from flask import Flask, jsonify, request
import numpy as np
import os
import io
import base64
import cv2
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
from pymongo import ... |
<reponame>LoganAMorrison/Hazma
from itertools import cycle
import matplotlib.pyplot as plt
import numpy as np
from tqdm.auto import tqdm, trange
from collections import defaultdict
from scipy.interpolate import interp1d
from scipy.optimize import root_scalar
from matplotlib.ticker import LogLocator, NullFormatter
from... |
<reponame>aishwarya-rm/cop-e-cat
import sys
sys.path.append('../../')
from cop_e_cat.copecat import CopECat, CopECatParams
import os
import xgboost
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
from scipy.stats import mstats
import matplotlib.pyplot as plt
from sklea... |
import unittest
import numpy as np
import math
from scipy.interpolate import lagrange
from lagrange_polynomial import lagrange_polynomial
class TestLagrangePolynomial(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.x = np.array([-9, -5, -2.5, 4, 7])
cls.y = np.array([-2, 3, 0, 5, 11]... |
<gh_stars>1-10
# coding=utf-8
import sys
import petsc4py
petsc4py.init(sys.argv)
import numpy as np
from time import time
from scipy.io import savemat
# from src.stokes_flow import problem_dic, obj_dic
from src.geo import *
from petsc4py import PETSc
from src import stokes_flow as sf
from src.myio import *
from src.... |
<filename>treeopt/treeOpt.py
import numpy as np
import os
from pathlib import Path
import scipy.optimize as sk_optimize
# Import of treeopt submodules
import treeopt.sampling as sampling
import treeopt.optimize as optimize
import treeopt.metamodel as metamodel
import treeopt.visualize as visualize
class least_squar... |
<reponame>Vincent-Vercruyssen/ML-stats
"""
Functions for the statistical comparison of multiple classifiers
1. Parametric:
2. Non-parametric:
- Friedman
3. Post-hocs:
- Nemenyi
- Bonferroni-Dunn
Terminology often used in literature is:
- blocks = datasets
- groups = treatment = the classifiers/methods
Au... |
<reponame>norips/visual-navigation-agent-pytorch
import json
import math
import h5py
import numpy as np
import scipy.sparse as sp
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import torchvision.models as models
def compare_models(model_1, model_2):
... |
# Copyright 2020 <NAME>
# This file is part of PyRaysum.
# 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 without limitation the rights
# to use, copy, modify,... |
<reponame>danielasun/2d_quad
import sympy as sp
import numpy as np
from latex_util import *
# write down dynamics
x, z, th, xd, zd, thd = sp.symbols('x z th xd zd thd')
x0, z0 = sp.symbols('x0, z0')
gravity = sp.symbols('gravity')
ox, oz, ot, m, r, F1, F2, grav, v1, v2 = sp.symbols('ox, oz, ot, m, r, F1, F2, grav, v1... |
import numpy as np
import Simulators
from Util import *
import scipy.linalg
import Semibandits
class BOSE(Semibandits.Semibandit):
"""
Implementation of BOSE (bandit semiparametric orthogonalized
estimator) algorithm. This algorithm only works if features are
available in the SemibanditSim object
... |
from __future__ import division
import numpy as np
from scipy.signal import filtfilt
from scipy.signal import firwin2, firwin
from scipy.signal import morlet
def firf(x, f_range, fs=1000, w=3, rmvedge = True):
"""
Filter signal with an FIR filter
*Like fir1 in MATLAB
x : array-like, 1d
Time ... |
from ibllib.ephys.spikes import ks2_to_alf
from ibllib.io import spikeglx
import numpy as np
import ibllib.dsp as dsp
from scipy import signal
from ibllib.misc import print_progress
from pathlib import Path
import alf.io
import logging
_logger = logging.getLogger('ibllib')
RMS_WIN_LENGTH_SECS = 3
WELCH... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.optimize import minimize
from .geometry import Point, Circle
from .methods import LSEMethod
from time import time
class Anchor(object):
def __init__(self, ID, position, measure = None):
self.position = position
... |
import random
from typing import Any, Generator, Optional, Sequence
import numpy as np
try:
from scipy.special import softmax
except ImportError:
def logsumexp(x):
offset = x.max()
return offset + np.log(np.exp(x - offset).sum())
def softmax(x):
return np.exp(x - logsumexp(x))
_... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
mu = 2
std = 2
rv = stats.norm(mu, std)
xx = np.linspace(-5, 5, 100)
plt.plot(xx, rv.pdf(xx))
plt.ylabel("p(x)")
plt.title("pdf of normal distribution")
plt.show() |
<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os, sys
import pandas as pd
import numpy as np
import numpy.matlib
import scipy as sp
# Plotting
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
from pingouin import mediation_analysis
# ## Read in data
# In[2]:... |
<reponame>avocabavo/UniversallyRandom
import math
from matplotlib import pyplot as plt
from scipy import stats
dpi= 25
stdevs= 4
fin= 2 * dpi * stdevs + 1
xs= []
for i in range(fin):
xs.append(i/dpi-stdevs)
def analyze(targets):
datasets= {}
for best_of in targets:
ds= {'data': [best_of * ... |
<gh_stars>1-10
'''
6 April 2020
Python file that optimises the parameters of the custom measurement optimisation algorithm
and the most useful voltage measurement electrode pairs.
by <NAME> and <NAME>
in collaboration with <NAME> and <NAME>
from Solid State Physics Group at the University of Mancheste... |
<gh_stars>1-10
import numpy as np
import pandas as pd
import altair as alt
from typing import Tuple
from numpy import ndarray
from altair import Chart
from scipy.signal import savgol_filter
def plot_shap(
x: ndarray,
y: ndarray,
x_all: ndarray,
feature: str,
target: str,
mean: ... |
"""Represent interactions between context and item layers."""
import numpy as np
from scipy import stats
import h5py
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from cymr import operations
def save_patterns(h5_file, items, **kwargs):
"""
Write patterns and similarity matrices to ... |
'''This class offers basic plot Functions for generating nice heatmaps.
'''
from scipy.spatial.distance import pdist
from scipy.cluster.hierarchy import linkage, dendrogram, cut_tree
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import pandas as pnd
##################
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.