text string |
|---|
<filename>datasets/preprocess/gisette.py
import os
import numpy as np
from sklearn import preprocessing
import csv
from scipy.sparse import csr_matrix
from utils.utils_sparse import read_data
from utils.utils_download import download_extract
from utils.utils_preprocessing import convert_to_binary, normalize_rows, form... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 10:17:13 2018
@author: David
"""
# Built-in libraries
import argparse
import collections
import multiprocessing
import os
import pickle
import time
# External libraries
#import rasterio
#import gdal
import matplotlib.pyplot as plt
import numpy as n... |
<filename>create_plot.py<gh_stars>1-10
import pickle
import os
import numpy as np
from astropy.io import fits
import argparse
from scipy.stats import chi2, norm
from convert_llh_to_prob import get_v3_output_dir, get_systematics_filename
from matplotlib import cm
import healpy as hp
import matplotlib.pyplot as plt
ferm... |
# Copyright 2018-2020 Xanadu Quantum Technologies Inc.
# 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... |
<gh_stars>0
# Setting up all folders we can import from by adding them to python path
import sys, os, pdb
curr_path = os.getcwd();
sys.path.append(curr_path+'/..');
# Importing stuff from all folders in python path
import numpy as np
from focusfun import *
# TESTING CODE FOR FOCUS_DATA Below
import scipy.io as sio
fr... |
<reponame>salistito/Computer-Graphics
# coding=utf-8
"""
<NAME>, CC3501-Tarea3a, 2020-1
Finite Differences for Partial Differential Equations
Solving the Laplace equation in 3D with Dirichlet and
Neumann border conditions over a parallelepiped domain.
"""
import numpy as np
import sys
import json_reader as r
import sc... |
import numpy as np
import pandas as pd
from scipy.stats import mode
from tqdm import tqdm
from geopy.geocoders import Nominatim
from datetime import datetime
def handle_bornIn(x):
skip_vals = ['16-Mar', '23-May', 'None']
if x not in skip_vals:
return datetime(2012, 1, 1).year - datetime(int(x), 1, 1)... |
import argparse
import sys
import os, sys
import numpy as np
from numpy import linalg as LA
from numpy import linalg as la
from matplotlib import pyplot as plt
import math
from PIL import Image
import scipy.ndimage as nd
import random
from scipy.interpolate import RectBivariateSpline
try:
sys.path.remove('/opt/ros... |
from scipy.optimize import curve_fit
from random import random as randReal
from matplotlib import pyplot
from numpy import random, linspace
def modelFunc1(x,*A):
s, p = 0, 1
for k in range(len(A)):
s = s + A[k]*p
p = p * x
return s
def modelFunc2(x,A):
s, p = 0, 1
for k in range(len(... |
# MIT License
#
# Copyright (c) 2020 University of Oxford
#
# 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... |
import numpy as np
import os
import random
from scipy.sparse import csr_matrix
from sklearn import svm
from sklearn.metrics import classification_report
#### PACKAGE IMPORTS ###########################################################
from politeness.constants import POLITENESS_CLASSIFIER_PATH
from politeness import h... |
# -*- coding: utf-8 -*-
import json
from django.conf import settings
from django.http import HttpResponse
from django.utils.safestring import mark_safe
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.template import RequestContext
from django.contrib.contentt... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 3 14:15:33 2019
@author: Dominic
"""
from math import sqrt, log
from scipy import optimize
from ...finutils.FinCalendar import FinCalendarTypes
from ...finutils.FinCalendar import FinDayAdjustTypes, FinDateGenRuleTypes
from ...finutils.FinDayCount import FinDayCountType... |
from collections import namedtuple
import json
import numpy as np
from numpy.linalg import lstsq
from scipy.optimize import nnls
from lmfit import Parameters, minimize, fit_report
from xraydb import (material_mu, mu_elam, ck_probability,
xray_edges, xray_lines, xray_line)
from xraydb.xray import... |
import numpy as np
import pandas as pd
import scipy.sparse
import sparse
import sklearn
from sklearn.ensemble import RandomForestRegressor
from collections import Counter
import sys, os
import smooth_rf
def test_depth_tune_regression():
"""
test depth_tune, regression rf (structure check)
"""
n = 200
... |
<reponame>MinesNicaicai/large-scale-pointcloud-matching
import argparse
import os
from model.Birdview.dataset import make_images_info
from model.Birdview.dataset import NetVladDataset
from model.Birdview.dataset import PureDataset
from model.Birdview.base_model import BaseModel
from sklearn.model_selection import train... |
<reponame>anlavandier/dask-image
# -*- coding: utf-8 -*-
import scipy.ndimage
from ..dispatch._dispatch_ndfilters import dispatch_laplace
from . import _utils
__all__ = [
"laplace",
]
@_utils._update_wrapper(scipy.ndimage.filters.laplace)
def laplace(image, mode='reflect', cval=0.0):
result = image.map_ov... |
<gh_stars>10-100
from aser.database.db_API import KG_Connection
import time
from tqdm import tqdm
# import aser
import ujson as json
from multiprocessing import Pool
import spacy
import random
import pandas
import numpy as np
from itertools import combinations
from scipy import spatial
import os
def get_ConceptNet_inf... |
import sympy
def solve1():
vf = sympy.Symbol('vf')
a = sympy.Symbol('a')
v0 = sympy.Symbol('v0')
t = sympy.Symbol('t')
p0 = sympy.Symbol('p0')
pf = 0 # sympy.Symbol('pf')
equalities = [
(vf, v0 + a * t),
(pf, p0 + v0 * t + a * t * t / 2),
]
system = [lhs - rhs for lhs, rhs in equalities]
... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 19 22:56:58 2017
@author: jaehyukchoi
"""
import numpy as np
import scipy.stats as ss
import scipy.optimize as sopt
def bsm_formula(strike, spot, vol, texp, intr=0.0, divr=0.0, cp=1):
div_fac = np.exp(-texp*divr)
disc_fac = np.exp(-texp*intr... |
<gh_stars>10-100
import os
import torch
from torch.utils.data import Dataset
from torchvision.transforms.functional import to_tensor
from PIL import Image
from scipy.signal import convolve2d
import numpy as np
import h5py
import random
import model.common as common
from option import args
def default_loa... |
<reponame>TechStrix/MetPy
# Copyright (c) 2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tools and calculations for assigning values to a grid."""
from __future__ import division
import numpy as np
from scipy.interpolate import griddata, Rb... |
<reponame>dumpmemory/google-research
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
<reponame>Suman15728/tspy
import numpy as np
from cvxopt import matrix, solvers, sparse, spmatrix
from scipy.sparse.csgraph import connected_components
import networkx as nx
class Simple_LP_bound:
def bound(self, tsp):
sol = _lp(tsp.mat,[])
sol['x'] = _clean_sol(sol['x'])
self.sol = sol
... |
<reponame>shreyas253/WaveCount
"""
Created on Tue May 28 12:54:43 2019 (SS)
Modified on Wed June 5 12:30:00 2019 (OR)
@author: <NAME>, <NAME>
"""
from __future__ import print_function
import librosa
import scipy
import matplotlib.pyplot as plt
import numpy as np
import librosa.display
import tensorflow as tf
import t... |
import os
import glob
import copy
import random
import time
import numpy as np
import numpy.ma as ma
import cv2
from PIL import Image
import matplotlib.pyplot as plt
import scipy.io as scio
from scipy.spatial.transform import Rotation as R
from sklearn.neighbors import KDTree
import torch
import torch.nn as nn
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Pluralsight, 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/LICENSE-2.0
# Unl... |
<filename>bempp/api/linalg/iterative_solvers.py<gh_stars>10-100
"""Iterative solver interfaces."""
import numpy as _np
# pylint: disable=invalid-name
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
class IterationCounter(object):
"""Iteration Counter class."""
def __init_... |
import logging
import os
import re
import sys
from ast import literal_eval as make_tuple
from distutils.util import strtobool
from histoqc.BaseImage import printMaskHelper
from skimage import io, img_as_ubyte
from skimage.filters import gabor_kernel, frangi, gaussian, median, laplace
from skimage.color import rgb2gr... |
#!/usr/bin/env python
"""
WT_PATH=Outputs/e2e_faster_rcnn_R-50-C4_1x/Jul30-15-51-27_node097_step/ckpt/model_step79999.pth
CFG_PATH=configs/wider_face/e2e_faster_rcnn_R-50-C4_1x.yaml
srun --pty --mem 50000 --gres gpu:1 -p m40-short \
python tools/eval/run_face_detection_on_wider.py \
--cfg ${CFG_PATH} \
--load_... |
from collections import OrderedDict
import numpy as np
from nose.tools import raises
from numpy.testing import assert_allclose
from scipy.sparse import csr_matrix
from menpo.shape import LabelledPointUndirectedGraph, PointUndirectedGraph
from menpo.testing import is_same_array
points = np.ones((10, 3))
adjacency_mat... |
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
import gym
import logz
import scipy.signal
def normc_initializer(std=1.0):
"""
Initialize array with normalized columns
"""
def _initializer(shape, dtype=None, partition_info=None): #pylint: disable=W0613
out = np... |
import numpy as np
import numpy.random as npr
import scipy as sc
from operator import add
from functools import reduce
from sds.utils.general import Statistics as Stats
from sds.utils.linalg import symmetrize
class LinearGaussianWithPrecision:
def __init__(self, column_dim, row_dim,
A=None, l... |
import functools
import warnings
warnings.filterwarnings('ignore')
import pickle
import numpy as np
import pandas as pd
import json
from textblob import TextBlob
import ast
import nltk
nltk.download('punkt')
from scipy import spatial
import torch
import spacy
import PyPDF2 as PyPDF2
import tabula as tabula
import ti... |
'''
------------------------------------------------------------------------
Functions for created the matrix of ability levels, e. This can
only be used for looking at the 25, 50, 70, 80, 90, 99, and 100th
percentiles, as it uses fitted polynomials to those percentiles.
For a more generic version, see income_nopoly.p... |
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
import numpy as np
from scipy.optimize import minimize
class MeanRegressor(BaseEstimator, RegressorMixin):
def __init__(self):
pass
def fit(self, X, y):
X,y =che... |
import logging, matplotlib, os, sys
import anndata
import scanpy as sc
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rcParams
from matplotlib import colors
import seaborn as sb
plt.rcParams['figure.figsize']=(8,8) #rescale figures
sc.settings.verbosity ... |
# This script creates disturbance filter maps of randomly sampled stands for yearly clearcutting
# These random, staggered harvests are more realistic than clearcutting all eligible stands during the first sim year
# Script written in Python 3.7
import pandas as pd
import numpy as np
import config as config
import tem... |
<gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from PIL import Image
from scipy.ndimage.interpolation import zoom
from utils.file_utils import load_tx... |
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import torch
from torch.nn import functional as F
import numpy as np
def rotation_matrix_to_quaternion(rotation_matrix, eps=1e-6):
"""Convert 3x4 rotation matrix to 4d quaternion vector
This algorithm is based on al... |
#!/usr/bin/env python
import numpy as np
from scipy import optimize, stats
import math
def lnLikelihoodDouble(parameters, values, errors, weights=None):
"""
Calculates the total log-likelihood of an ensemble of values, with
uncertainties, for a double Gaussian distribution (two means and
two di... |
<filename>utils/confidence_pgd_attack.py<gh_stars>10-100
from __future__ import print_function
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
import nump... |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from scipy import interpolate
plt.rcParams['axes.labelsize'] = 9
plt.rcParams['xtick.labelsize'] = 9
plt.rcParams['ytick.labelsize'... |
<filename>tests/distributed/test_partition.py
import dgl
import sys
import os
import numpy as np
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from dgl.heterograph_index import create_unitgraph_from_coo
from dgl.distributed import partition_graph, load_partition
from dgl import function ... |
<filename>code/bib/ensemble/gradient_boosting.py<gh_stars>0
"""Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fi... |
<gh_stars>0
import math
import sys
import os
import numpy as np
sys.path.append(os.getcwd())
from typing import Dict, Iterable, List, Set, Union
from tqdm import tqdm
from tokenization.corpus_tokenizers import HuggingFaceCorpusTokenizer, WhiteSpaceCorpusTokenizer
from tokenization.vocab_tokenizers import trai... |
import numpy as np
from fastai.basic_train import Recorder
from fastai.core import ifnone, defaults, Any
from fastai.torch_core import to_np
from fastai.vision import *
import matplotlib.pyplot as plt
from typing import Optional
import scipy
import itertools
def model_cutter(model, select=[]):
cut = select[0]
... |
import cmath
def sphereSA(radius) :
return 4*cmath.pi*radius**2
# radius = 4
# print(sphereSA())
'''Practice Exam Question
a - int
b - int
c - int
'''
def root1(a,b,c):
return (-b + cmath.sqrt(b**2 - 4 * a * c)) / (2 * a)
def root2(a,b,c):
return (-b - cmath.sqrt(b**2 - 4 * a * c)) / (2 * a)
|
#!/usr/bin/env python
import sys
import rospy
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint, TrafficLight
from dbw_mkz_msgs.msg import SteeringReport
from std_msgs.msg import Int32
#from scipy.interpolate import interp1d
from scipy.spatial import KDTree
import numpy a... |
############################################################################################
#
# Project: <NAME> Acute Myeloid & Lymphoblastic Leukemia AI Research Project
# Repository: AML/ALL Classifiers
# Project: Keras AllCNN
#
# Author: <NAME> (<EMAIL>)
# Contributors:
# Title: Data C... |
import numpy as np
import scipy.stats as stats
from sklearn.gaussian_process.kernels import RBF
from sklearn.utils import check_random_state
from . import cartesian, partials
def make_gaussian_partial_sums(
X, orders=5, kernel=None, mean=None, ratio=0.3,
ref=1., nugget=0, random_state=0, allow_singula... |
<reponame>jgoerner/distribution-cheatsheet
# IMPORTS
import numpy as np
import scipy.stats as stats
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"] = (14, 7)
HTML("""
... |
<gh_stars>1-10
import matplotlib as matplotlib
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import re
import os
import glob
import math
import scipy.misc as smp
from PIL import Image
import time
import random
import cv2
import copy
# import Age_Predictio... |
<filename>nmfamv2/mixtures/read_mixture.py
import nmrglue as ng
import numpy as np
import pandas as pd
from scipy import interpolate
def get_mixture_data_from_1r_files(path_to_1r):
dic, mixture_values = ng.bruker.read_pdata(path_to_1r)
# print(dic)
# print(mixture_values)
# print("acqus")
# print(... |
"""
Functions for explaining text classifiers.
"""
from functools import partial
import itertools
import json
import re
import numpy as np
import scipy as sp
import sklearn
from sklearn.utils import check_random_state
from . import explanation
from . import lime_base
class TextDomainMapper(explanat... |
#!/usr/bin/env python
"""
author: <NAME>
date: June 8th,2016
function: calculate BIC score for clustering results
"""
import pdb,sys,os,math
from scipy.stats import spearmanr
from scipy.spatial.distance import *
from Distance import *
# get the center of a cluster
def getAvgEx(X):
# get average experssion
# X: L... |
<filename>CytoPy/flow/gating/mixturemodel.py
from .utilities import inside_ellipse, rectangular_filter
from .base import Gate, GateError
from sklearn.mixture import GaussianMixture, BayesianGaussianMixture
from scipy import linalg, stats
import pandas as pd
import numpy as np
import math
class MixtureModel(Gate):
... |
import numpy as np
import pandas as pd
from contextlib import contextmanager
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy.sparse import hstack
import time
import re
import string
from scipy.sparse import csr_matrix
from sklearn.preprocessing import MinMaxScaler
import lightgbm as lgb
from skle... |
# 予め SciPy をインストール
# $ sudo apt-get install python3-scipy
import sys
import numpy as np
from scipy import optimize
def main(args):
# 初期値
x0 = float(args[1])
# ニュートン法
root = optimize.newton(f, x0, df)
# 解の表示
print(root)
def f(x):
return 0.5 - x + 0.2 * np.sin(x)
def df(x):
return ... |
<filename>pawpyseed/core/rayleigh.py
import numpy as np
from scipy.special import sph_harm, spherical_jn
k = np.array([0.6, 0.2, 0.3]) * 2 * np.pi
def planewave(coord):
return np.exp(1j * (k[0] * grid[0] + k[1] * grid[1] + k[2] * grid[2])) * np.exp(
1j * np.dot(k, [1, 1, 1])
)
m, l, = (
1,
... |
<reponame>Andres-c-Diaz/DirectFuturePrediction<gh_stars>100-1000
from __future__ import print_function
import numpy as np
from .future_target_maker import FutureTargetMaker
from .multi_doom_simulator import MultiDoomSimulator
from .multi_experience_memory import MultiExperienceMemory
from .future_predictor_agent_basic ... |
from sympy import isprime, prime
solution = [1001100000110, 1001100000100, 1001100000100, 1001100000000, 1001101100010, 1001101100111, 1001101001100, 1001101001111, 1001100000111, 1001101000101, 1001101101000, 1001100000011, 1001101011001, 1001101110011, 1001101101000, 1001101110101, 1001101011110, 1001101011001, 1001... |
from __future__ import print_function
from signal import signal
import pandas as pd
import numpy as np
from tomlkit import boolean
from myo.utils import TimeInterval
import myo
import sys
from threading import Lock, Thread
from matplotlib import pyplot as plt
import myo
import numpy as np
from collections import deque... |
<reponame>yacth/autogoal
import statistics
import abc
from typing import Mapping, Optional, Dict, List, Sequence
from autogoal.sampling import ModelSampler, best_indices, merge_updates, update_model
from ._base import SearchAlgorithm
import random
import pickle
import time
class PESearch(SearchAlgorithm):
def _... |
<filename>tests/distributions/test_stable.py
import warnings
import numpy as np
import pytest
import torch
from scipy.integrate.quadpack import IntegrationWarning
from scipy.stats import kstest, levy_stable
import pyro.distributions as dist
import pyro.distributions.stable
from tests.common import assert_close
@pyt... |
<reponame>irelandb/mpathic_for_cluster
#!/usr/bin/env python
'''Module containing information theory esimtation routines.'''
from __future__ import division
import numpy as np
import scipy as sp
import pandas as pd
import mpathic._nsb
import pdb
from mpathic import SortSeqError
#
# Public probability functionals
#
de... |
<reponame>odinn13/Tilings
import json
from itertools import chain, product
import pytest
import sympy
from permuta import Perm
from tilings import GriddedPerm, Tiling
from tilings.exception import InvalidOperationError
@pytest.fixture
def compresstil():
"""Returns a tiling that has both obstructions and require... |
from sympy import (legendre, Symbol, hermite, chebyshevu, chebyshevt,
chebyshevt_root, chebyshevu_root, assoc_legendre, Rational,
roots, sympify, S, laguerre_l, laguerre_poly)
x = Symbol('x')
def test_legendre():
assert legendre(0, x) == 1
assert legendre(1, x) == x
assert legendre(2, x) =... |
## Topic Classification: Based on the roots of each sentence, including noun (NN), verb (VB), and adjective (JJ)
from collections import defaultdict
from anytree import Node, RenderTree
from functools import reduce
from collections import Counter
from sklearn import metrics
from scipy.stats import sem
from sklearn.fea... |
import tensorflow as tf
from tensorflow.keras import layers
import scipy
import numpy as np
from Unet_util import Unet
from my_utils import *
class upsqueeze(layers.Layer):
def __init__(self, factor=2):
super(upsqueeze, self).__init__()
self.f = factor
def call(self, x, reverse=False):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 17 19:16:43 2017
hacer la calibracion de los datos tomados en nov 2016
@author: sebalander
"""
# %%
import cv2
from copy import deepcopy as dc
from calibration import calibrator as cl
from calibration import RationalCalibration as rational
impor... |
from sympy.core import Symbol
from sympy import Tuple, Lambda
from pyccel.codegen.printing.pycode import PythonCodePrinter as PyccelPythonCodePrinter
from .ast import BasicMap, PartialFunction
class PythonCodePrinter(PyccelPythonCodePrinter):
def __init__(self, settings=None):
PyccelPythonCodePrinter.__... |
<gh_stars>1-10
#!/usr/bin/env python
"""
@package ion_functions.data.ph_functions
@file ion_functions/data/ph_functions.py
@author <NAME>
@brief Module containing pH family instrument related functions
"""
# imports
import numpy as np
import numexpr as ne
import scipy as sp
# functions to extract L0 parameters from ... |
<reponame>leschzinerlab/myami-3.2-freeHand<gh_stars>0
#
# COPYRIGHT:
# The Leginon software is Copyright 2003
# The Scripps Research Institute, La Jolla, CA
# For terms of the license agreement
# see http://ami.scripps.edu/software/leginon-license
#
from leginon import leginondata
import acquisition
import... |
<filename>SemiSupHash.py
import numpy as npy
from scipy import linalg
from LoadData import ReadFvecs
import Utils
import pdb
def GetLabeledInfo(data, nDataL):
ndata=data.shape[0]
kn2=nDataL/3
kn3=2*nDataL/3
idxLabelData=npy.arange(ndata)
npy.random.shuffle(idxLabelData)
idxLabel... |
'''
Created on Oct 29, 2015
@author: ash
'''
'''
crop map shapefile based on lat, long extents
'''
# import libraries
import networkx as nx
import matplotlib.pyplot as plt
import random
import math
import numpy as np
from scipy.interpolate import UnivariateSpline
from scipy.interpolate import splprep, splev
from num... |
from __future__ import division
import numpy as np
import scipy.stats.kde as kde
def hpd_grid(sample, alpha=0.05, roundto=2):
"""Calculate highest posterior density (HPD) of array for given alpha.
The HPD is the minimum width Bayesian credible interval (BCI).
The function works for multimodal dist... |
<filename>ardent/preprocessing/sliced_data.py<gh_stars>10-100
"""
Based on this:
https://github.com/mitragithub/Registration/blob/master/atlas_free_rigid_alignment.m
"""
'''
- take sequence of arrays, arbitrary shapes
- resample to max of dimensions per dimension into single array
- create a new 3D array where each s... |
import cv2
import keras
from scipy.misc import imresize
import numpy as np
EMOTIONS = ['angry', 'disgusted', 'fearful', 'happy', 'sad', 'surprised', 'neutral']
cascade_classifier = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
height = width = 20
def detect_face(image):
faces = cascade_classifier.det... |
<filename>smoot/criterion.py
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 26 10:26:43 2021
@author: robin
"""
import numpy as np
from scipy.stats import norm
class Criterion(object):
def __init__(self, name, models, ref=None, s=None):
self.models = models
self.name = name
self.ref = ref... |
# Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>, <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
Fourier-Bessel Particle-In-Cell (FB-PIC) main file
This file steers and controls the simulation.
"""
# When cuda is available, select one GPU per mpi process
# (This needs to be done before the other imports... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME>
Holds functions to analyse results out of the database.
Note: This part of SPOTPY is in alpha status and not yet ready for production use.
'''
import numpy as np
import spotp... |
<reponame>arnomoonens/Mussy-Robot
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 08 13:18:15 2016
@author: Greta
"""
from sklearn.svm import SVC
import numpy
from sklearn.externals import joblib
from sklearn.cross_validation import cross_val_score, KFold
from scipy.stats import sem
def evaluate_cros... |
# Remove warnings
import warnings
warnings.filterwarnings('ignore')
# General packages
import pandas as pd
import numpy as np
import seaborn as sns
import time
from scipy.stats import multivariate_normal
# Sklean
from sklearn.preprocessing import scale
from sklearn.decomposition import PCA
from sklearn.cluster import... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
#
from __future__ import division
import numpy
import sympy
from ..helpers import untangle, fsd, z, pm
class HammerStroud(object):
"""
<NAME> and <NAME>,
Numerical Evaluation of Multiple Integrals II,
Math. Comp. 12 (1958), 272-280,
<https://doi.org/10.1090... |
<reponame>nicelhc13/Parla.py<gh_stars>10-100
"""
A naive implementation of blocked Cholesky using Numba kernels on CPUs.
"""
import numpy as np
from scipy import linalg
import cupy as cp
import time
from parla import Parla, get_all_devices
from parla.array import copy, clone_here
from parla.cuda import gpu
from parl... |
import cv2
import torch
import numpy as np
from scipy.ndimage.filters import gaussian_filter, maximum_filter
from scipy.ndimage.morphology import generate_binary_structure
def find_peaks(param, img):
"""
Given a (grayscale) image, find local maxima whose value is above a given
threshold (param['thre1'])
... |
<reponame>acmore/ray<filename>rllib/policy/tests/test_compute_log_likelihoods.py
import numpy as np
from scipy.stats import norm
import unittest
import ray.rllib.agents.dqn as dqn
import ray.rllib.agents.pg as pg
import ray.rllib.agents.ppo as ppo
import ray.rllib.agents.sac as sac
from ray.rllib.utils.framework impor... |
<gh_stars>0
from os import path
from scipy.misc import imread
from wordcloud import WordCloud, STOPWORDS
from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
import numpy
import matplotlib.pyplot as plt
from PIL import Image
# Read the whole text.
df = pd.read_csv("train_set.csv",sep="\t")
m... |
<filename>py/legacyanalysis/montelg.py
import os
import sys
import math
import coord
import logging
import galsim
import pylab as pl
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as fits
import fitsio
from scipy.optimize ... |
<reponame>notmatthancock/sarcopenia-ai
import os
import imageio
import numpy as np
from keras.callbacks import Callback
from scipy.ndimage import zoom
from sarcopenia_ai.apps.slice_detection.utils import place_line_on_img, predict_reg, predict_slice
from sarcopenia_ai.preprocessing.preprocessing import overlay_heatma... |
import os.path
import re
import numpy as np
import tensorflow as tf
import helper
import warnings
from distutils.version import LooseVersion
import project_tests as tests
import scipy.misc
from glob import glob
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlo... |
import argparse
import sys
from concurrent.futures import ProcessPoolExecutor
from pathlib import Path
import librosa
import numpy as np
from nnmnkwii.frontend import merlin as fe
from nnmnkwii.io import hts
from scipy.io import wavfile
from tqdm import tqdm
from ttslearn.dsp import world_log_f0_vuv
def get_parser()... |
<reponame>ThayaFluss/cnl
import scipy as sp
import numpy as np
from vbmf import VBMF
from argparse import ArgumentParser
import logging
def options(logger=None):
desc = u'{0} [Args] [Options]\nDetailed options -h or --help'.format(__file__)
parser = ArgumentParser(description = desc)
# options
pars... |
<filename>p3_test.py
from sklearn import preprocessing
from s1_utils import *
import os
import scipy.io as sio
from lib import models, graph, coarsening, utils
import numpy as np
import matplotlib.pyplot as plt
import scipy
from scipy.stats import shapiro, spearmanr
from statsmodels.stats.multitest import fdrcorrection... |
import pprint
import luigi
import ujson
import numpy as np
from numpy.random import RandomState
from scipy.sparse import dok_matrix
import pandas as pd
from sklearn.externals import joblib
from lightfm import LightFM
from ..models import FitModel, PredictModel
from ..clean_data import Products
class LightFMv2(objec... |
# MIT License
#
# Copyright (c) 2017 <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 without limitation the rights
# to use, copy, modify, merge, publi... |
<reponame>Pitou1/5100NonExecutableROSDecode
#!/usr/bin/python3
"""Classify digits in word images.
This program uses the training data to train four classifiers: one for each
digit in a word image. It uses these classifiers to label the digits in all of
the word images.
Licensing:
This program and any supporting prog... |
import statistics
import numpy as np
import plotly.express as px
from icecream import ic
import utils.iterator
from day import Day
class Day7Part1(Day):
day = 7
part = 1
def get_sample_input(self):
return '16,1,2,0,4,2,7,1,2,14'
def parse_input(self):
return utils.get_all_ints(self... |
<reponame>rbassett3/Fused-Density-Estimator
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "..","..","FDE-Tools"))
from FDE import *
import scipy.stats as stats
P = stats.expon.rvs(size = 100)
(a,b) = (0,6)
fde = UnivarFDE((a,b), P)
fde.GenerateProblem()
fde.SolveProblem(.03)
KeepGoing =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.