text string |
|---|
"""Test suite for statistics module, including helper NumericTestCase and
approx_equal function.
"""
import bisect
import collections
import collections.abc
import copy
import decimal
import doctest
import math
import pickle
import random
import sys
import unittest
from decimal import Decimal
from fractions import F... |
# Code from Chapter 10 of Machine Learning: An Algorithmic Perspective
# by <NAME> (http://seat.massey.ac.nz/personal/s.r.marsland/MLBook.html)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code co... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 11:56:32 2020
Some functions to preform Support Vector Machines EXERSIZE 6
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.optimize import fmin_cg
from sklearn.svm import SVC
plt.rc('text... |
<filename>so-co2-airborne-obs/emergent_constraint.py
import os
import sys
import contextlib
import yaml
import pprint
import warnings
from itertools import product
from toolz import curry
import pickle
from scipy.optimize import curve_fit
import numpy as np
import pandas as pd
import xarray as xr
import dask
impor... |
from scipy.stats import kruskal
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from statsmodels.stats.multicomp import MultiComparison
import numpy as np
from itertools import repeat
import json
def load_json(filename):
"Load a JSON file and return its contents."
with open(filename) as f:
d... |
<reponame>RicoloveFeng/KDraw<filename>src/CLI/Kdraw.py
'''
KDraw v0.0.1
1. setColor has been writen in opcodes when in instruction.py
2. for resetCanvas command, change img object and clear oplist
3. for draw command, put it into list
4. for adjust command, find in list according to id, and adjusting points
5. for save... |
<reponame>porasgulati/jina
import numpy as np
import paddle
import pytest
import tensorflow as tf
import torch
from scipy.sparse import csr_matrix, coo_matrix, bsr_matrix, csc_matrix
from docarray import Document, DocumentArray
from docarray.ndarray import NdArray
def get_ndarrays():
a = np.random.random([10, 3]... |
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
from scipy import misc, ndimage
from scipy.ndimage.interpolation import zoom
import keras
from keras import backend as K
from keras.models import Sequential, Model
from keras.layers.core import Flatten, Dense, Dro... |
import os
import sys
import shutil
import tempfile
from textwrap import dedent
from tests.utils.runtest import automakesuite, run
from tests.utils.testcase import TestCase
from tests.utils.functionaltestcase import FunctionalTestCase
from Ironclad import PythonMapper
bz2_doc = """The python bz2 module provides a co... |
#!/usr/bin/env python
import os, inspect, sys
import argparse
import numpy
import scipy
import math, time
from osgeo import gdal
import config
from eo1_ali_l1t import EO1_ALI_L1T
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate EO-1 ALI Cloud Mask')
apg_input = parser.add_argumen... |
<filename>amznas.py
#!/usr/bin/env python
# Command line utility for Amazonian Nasality project
# TODO: check --lx param
# TODO: try to prevent lx recording when not requested
try:
import os
import re
import glob
import subprocess
import yaml
import numpy as np
from pathlib import Path
... |
import numpy as np
from scipy.optimize import linprog
import cvxopt
A_ub = np.loadtxt('A_ub.txt', delimiter=',')
A_eq = np.loadtxt('A_eq.txt', delimiter=',')
b_ub = np.loadtxt('b_ub.txt', delimiter=',')
b_eq = np.loadtxt('b_eq.txt', delimiter=',')
c = np.loadtxt('c.txt', delimiter=',')
#lp_sol = linprog(c, A_ub=A_ub,... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
import sys
import numpy as np
import pandas as pd
from sklearn import linear_model, preprocessing, cluster
import scipy.linalg as slin
import scipy.sparse.lin... |
from netCDF4 import Dataset
import glob,os.path
import numpy as np
from scipy.interpolate import UnivariateSpline
import matplotlib
from matplotlib import cm
import matplotlib.pyplot as plt
import site
from datetime import datetime
site.addsitedir('/tera/phil/nchaparr/python')
import nchap_fun as nc
from matplotlib.col... |
<filename>generate_figures/iteration_time.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import spline
T_sa = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
mdcpe_sa = np.array([92.00262, 92.131147, 93.44262, 94.098360655, 92.1311475, 90.819672, 91.803278, 92.13175411, 92.45901639,
... |
"""Plotting utilities. Import requires matplotlib.
"""
import datetime
import copy # for shallow copies of matplotlib colormaps
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
import matplotlib.patches
import matplotlib.colors
import matplotlib.lines
import matplotlib.patheffects
import matplot... |
<filename>spectrocrunch/detectors/tests/test_xrf.py
# -*- coding: utf-8 -*-
import unittest
import numpy as np
import silx.math.fit
import scipy.integrate as integrate
import itertools
from .. import xrf
from ...patch import jsonpickle
class test_xrf(unittest.TestCase):
def plot(self, x, y1, y2):
import... |
import random
import math
from deap import base
from deap import creator
from deap import tools
import csv
import matplotlib.pyplot as plt
import statistics
data = []
min_fitness = []
max_fitness = []
mean_fitness = []
std_fitness = []
def read_file():
with open('data/Dataset-GA-normalized.csv', newline='') as f... |
<reponame>KuKuXia/tensorlayer<filename>tensorlayer/files/utils.py<gh_stars>1-10
#! /usr/bin/python
# -*- coding: utf-8 -*-
import base64
import gzip
import json
import math
import os
import pickle
import re
import shutil
# import ast
import sys
import tarfile
import time
import zipfile
import cloudpickle
import h5py
... |
<gh_stars>0
"""
First-level algorithms (non recursive)
"""
import collections
import time
import numpy as np
import sympy
from .base import Algorithm
from ..sequence import (
Sequence,
Const, Integer,
Arithmetic, Geometric,
Power, make_fibonacci,
Repunit,
)
from ..utils import (
affine_transf... |
<filename>tests/_test_json_handling_errors.py
"""
This intentionally breaks the import of orjson even if it is installed on the
system. It does this by removing the path to orjson from the paths it looks at
for imports - this is where a lot of the imports, so before we remove the path
we have to import some that are no... |
<reponame>jverzani/SymPyCall
from sympy.sets import FiniteSet
from sympy import (sqrt, log, exp, FallingFactorial, Rational, Eq, Dummy,
piecewise_fold, solveset, Integral)
from .rv import (probability, expectation, density, where, given, pspace, cdf, PSpace,
characteristic_function, sam... |
from unittest import TestCase
import numpy as np
from scipy.stats import loglaplace
from copulas.univariate import LogLaplace
class TestLogLaplaceUnivariate(TestCase):
def test__fit_constant(self):
distribution = LogLaplace()
distribution._fit_constant(np.array([1, 1, 1, 1]))
assert d... |
#!/usr/bin/env python
import sys
import matplotlib as mpl
if len(sys.argv) > 1:
mpl.use('Agg')
from pylab import *
from scipy.stats import poisson,binom_test
outFigName = None if len(sys.argv) < 2 else sys.argv[1]
seedV = None if len(sys.argv) < 3 else int(sys.argv[2])
IFN = "resTab-intronicPeripheral.txt" if le... |
# Author: <NAME>
# Creating a correlation matrix for all the ENF values collected in CSV file
import numpy as np
import math
import pickle
from scipy.stats.stats import pearsonr
import matplotlib.pyplot as plt
# Create a variable which contains all the values of ENF for each second
number_of_files = 24
... |
<gh_stars>1-10
import sys
import os
import numpy as np
import h5py
import scipy.signal
import itertools
import pdb
sys.path.append('/packages/msutil')
import util_stimuli
from dataset_util import initialize_hdf5_file, write_example_to_hdf5
def main(hdf5_filename,
fs=32e3,
dur=0.150,
f0_mi... |
<filename>romanz/romanz.py
import numpy as np
from astropy import units as u
from astropy import table
from scipy import interpolate as scinterp
class SNANAHostLib():
"""Class for parsing a SNANA HOSTLIB file.
The file may contain a weight map, and must contain host galaxy data,
following the standard SNAN... |
import numpy as np
import scipy.stats as st
COLOR_MATRIX = np.array([[0.67, 0.21, 0.14],
[0.33, 0.60, 0.06],
[0.00, 0.09, 0.78]])
INV_COLOR_MATRIX = np.linalg.inv(COLOR_MATRIX)
def wavelength_to_rgb(wavelength):
col_x = receptor_x(wavelength)
col_y... |
<filename>gala/potential/potential/tests/test_all_builtin.py<gh_stars>10-100
"""
Test the builtin CPotential classes
"""
# Third-party
import numpy as np
import astropy.units as u
import pytest
from scipy.spatial.transform import Rotation
# This project
from ..core import CompositePotential
from ..ccompositepoten... |
<filename>test_leb.py
import nibabel as nib
import util
from scipy.spatial import distance
import numpy as np
atlas_path = "Hammers_mith-n30r95-MaxProbMap-full-MNI152-SPM12_resample.nii.gz"
label = 49
c, ci = util.get_center_of_mass(atlas_path)
c_label, ci_label = util.get_center_of_mass(atlas_path,49)
#coordinate... |
import numpy as np
from PIL import Image
from PIL import ImageOps
import sys
from scipy import signal
import os
import pathlib
import scaleImage
import matplotlib
matplotlib.use('Agg') # Had to be imported after matplotlib, but before plt
import matplotlib.pyplot as plt
'''
This script is used to run e... |
import numpy as np
from scipy.special import comb
def label2binary(y, label):
"""
Map label val to +1 and the other labels to -1.
Paramters:
----------
y : `numpy.ndarray`
(nData,) The labels of two classes.
val : `int`
The label to map to +1.
Returns:
----... |
<gh_stars>0
from sympy.physics.quantum import Dagger
from sympy.physics.quantum.boson import BosonOp
from sympy.physics.quantum.fermion import FermionOp
from sympy.physics.quantum.operatorordering import (normal_order,
normal_ordered_form)
def test_normal_order(... |
"""
Copyright, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
<gh_stars>10-100
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
import logging
from typing import Optional
from overrides import over... |
"""
Overview
--------
general info about this module
Summary
---------
.. autosummary::
eval_pit
eval_pdf_gmm
Module API
----------
"""
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, ... |
import numpy as np
from scipy.integrate import solve_ivp
import torch
class HIV:
def __init__(self, config):
for p in config.dynamics.__dict__.keys():
setattr(self, p, getattr(config.dynamics, p))
for p in config.reward.__dict__.keys():
setattr(self, p, getattr(config.rewar... |
<reponame>Jvictor97/AWR-Adaptive-Weighting-Regression
import cv2
import numpy as np
import scipy.io as sio
from glob import glob
from dataloader.loader import Loader
from util.util import uvd2xyz, xyz2uvd
JOINT = np.array([0,1,3,5, 6,7,9,11, 12,13,15,17, 18,19,21,23, 24,25,27,28, 32,30,31])
# select 14 joints f... |
<gh_stars>10-100
"""Add network volume to dataset
Description:
------------
Computes the network volume and saves the parameter in meta.
Network volume is a useful proxy to say something about how well a session is suited to estimate EOPs. See:
"On comparison of the Earth orientation parameters obtained from di... |
<filename>example/example.py
import numpy as np
from scipy import stats
import random
n_gen_norm_1 = 1_000_000
n_gen_norm_2 = 1_000_000
n_test_norm_1 = 100_000
n_test_norm_2 = 50_000
norm_gen_params_1 = [-8, 5.5]
norm_gen_params_2 = [5, 8.5]
norm_test_params_1 = [-7.5, 6.5]
norm_test_params_2 = [7, 5.5]
class Exampl... |
__author__ = '<NAME>, <EMAIL>'
from pybrain.structure.networks.swiping import SwipingNetwork
from pybrain import MDLSTMLayer, IdentityConnection
from pybrain import ModuleMesh, LinearLayer, TanhLayer, SigmoidLayer
from scipy import product
class MultiDimensionalRNN(SwipingNetwork):
""" One possible implementatio... |
<reponame>koyalbhartia/Color-Segmentation-using-GMM-and-EM-techniques
import argparse
import numpy as np
import os, sys
import numpy as np
from numpy import linalg as LA
from matplotlib import pyplot as plt
import math
from PIL import Image
import random
import scipy.stats as stats
#from scipy.stats import norm
try:
... |
from str import StrPrinter
def _find_first_symbol(expr):
for atom in expr.atoms():
if atom.is_Symbol:
return atom
raise ValueError('expression must contain a Symbol: %r' % expr)
class LambdaPrinter(StrPrinter):
"""
This printer converts expressions into strings that can be used by
... |
<reponame>MaiRajborirug/scikit-learn<filename>sklearn/mixture/_bayesian_mixture.py
"""Bayesian Gaussian Mixture Model."""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
import math
import numpy as np
from scipy.special import betaln, digamma, gammaln
from ._base import BaseMixture, _che... |
<reponame>mpoiitis/GraphM-framework
import tensorflow as tf
import networkx as nx
import numpy as np
from utils import preprocess_adj, preprocess_features, chebyshev_polynomials, preprocess_data
from tensorflow.keras import Model
from .metrics import AccuracyByClass
from sklearn.preprocessing import LabelEncoder
from .... |
<reponame>JustinNoel1/CollabLearning
#import necessary modules
import os
import sys
import tarfile
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle
# import struct
# from array import array
#Our old friends
import tensorflow as tf
import numpy as np
#Progress bar
from tqdm imp... |
"""
This module implements an interface to the critic2 Bader analysis code.
For most Bader analysis purposes, users are referred to
pymatgen.command_line.bader_caller instead, this module is for advanced
usage requiring identification of critical points in the charge density.
This module depends on a compiled critic2... |
# -*- coding: utf-8 -*-
##
# \file fft_td_sig_arrays.py
# \title Calculation of the FFT for the time domain pressure signals.
# \author <NAME>
# \version 0.1
# \license BSD 3-Clause License
# \inst UMRAE (Ifsttar Nantes), LAUM (Le Mans Université)
# \date 2017, 26 Apr.
##
import numpy as np... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from matplotlib.colors import LogNorm
from scipy import stats
import os
import pickle
from utils import ROIs, count_violation_pairs, decode_data, cal_min_dists_all_frame, custom_simple_linear_regression
dic... |
<filename>src/causalrec/sg_pf_obs.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import edward as ed
import numpy as np
import tensorflow as tf
import pandas as pd
import numpy.random as npr
import random
import time
from edward... |
<gh_stars>1-10
#!/usr/bin/env python3
#
# Author: <NAME>
# Copyright 2016
#
import os
import argparse
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
from osgeo import gdal
from osgeo.gdalconst import GA_ReadOnly
# suppress the DEBUG message
import logging
mpl_logger = logging.getLogger('... |
<reponame>thecooldrop/openRFS
import numpy as np
import scipy.special as spec
from estimation.gaussian.kalman import Kalman
class CPHD:
"""
This class is an implementation of CPHD Gaussian mixture filter as described in following paper:
Analytic Implementations of the Cardinalized Probability Hypothesis ... |
import torch
import torch.nn.functional as F
import os
import sys
import cv2
import random
import datetime
import math
import argparse
import numpy as np
import scipy.io as sio
import zipfile
from .utils import *
# from .net_blazeface import s3fd
def detect(net, img, device):
H, W, C = img.... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
from sklearn.model_selection import train_test_split
from skimage import io
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from nltk.corpus import stopwords
import statisti... |
import argparse
import itertools
import os
from functools import partial
from typing import Union, Collection, Optional
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed
import multiprocessing
# import visdom
import torch
from torch.nn import Parameter, Module
from torch import Tenso... |
<gh_stars>0
""" General purpose data cleaning functions. """
import datetime as dt
import re
import unicodedata
import warnings
from fnmatch import translate
from functools import partial, reduce
from typing import Any, Callable, Dict, Iterable, List, Set, Tuple, Union
import numpy as np
import pandas as pd
import pa... |
<filename>contrastive_learning/contrastive_learning_with_uniform_noise.py
__author__ = "<NAME> <<EMAIL>>"
__date__ = "2021/01/09 19:34:07"
import numpy as np
from functions import *
from sys import exit
import argparse
from scipy.interpolate import BSpline
from scipy import optimize
import matplotlib as mpl
from matpl... |
#!/usr/bin/env python
#===========================================================================
#
# Produce histogram and CDF plots for ZDR bias in ice
#
#===========================================================================
from __future__ import print_function
import os
import sys
import numpy as np
impo... |
import functools
import itertools
import logging
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
import numpy
import pandas
from openff.units import unit
from pydantic import Field, root_validator, validator
from scipy.optimize import linear_sum_assignment
from ... |
<filename>core/python3AiActionLoop/samples/smart-body-crop/common.py
"""Executable Python script for running Python actions.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regardin... |
<reponame>uhlerlab/graphical_models
# Author: <NAME>
"""Base class for causal DAGs
"""
from collections import defaultdict
import numpy as np
import itertools as itr
from graphical_models.utils import core_utils
import operator as op
from graphical_models.custom_types import Node, DirectedEdge, NodeSet, warn_untested
... |
<gh_stars>10-100
"""
Test lake package functionality
"""
import os
import numpy as np
import pandas as pd
import pytest
from mfsetup.fileio import load_array
from mfsetup.lakes import (
PrismSourceData,
get_horizontal_connections,
setup_lake_connectiondata,
setup_lake_info,
)
@pytest.fixture
def sou... |
<reponame>phargogh/invest-natcap.invest-3
'''
Implementation of the aquaculture calculations, and subsequent outputs.
This will pull from data passed in by finfish_aquaculture.
'''
import collections
import os
import math
import datetime
import logging
from osgeo import ogr
import matplotlib
matplotlib.use('AGG') # ... |
<reponame>Asher-1/FaceKit
import os
import numpy as np
import cv2
import json
import pickle
from scipy.optimize import linear_sum_assignment
from PyPCN import *
from collections import deque
from bidict import bidict
import sys
from ipdb import set_trace as dbg
def DrawLines(win,img):
#f = FeatEnam.NOSE
#cv2.... |
<gh_stars>0
# Copyright The PyTorch Lightning team.
#
# 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>1-10
from common_plots import Plot
from statistics import Statistics
from convolution import Convolve
from correlation import Correlation
from fourier_transform import FourierTransform
from fourier_inverse_transform import FourierInverseTransform
from complex_fourier_transform import ComplexFourierTransform
f... |
<filename>scripts/printingValidation/venv/lib/python3.9/site-packages/skimage/morphology/_util.py
"""Utility functions used in the morphology subpackage."""
import numpy as np
from scipy import ndimage as ndi
def _validate_connectivity(image_dim, connectivity, offset):
"""Convert any valid connectivity to a foo... |
import pandas as pd
from scipy.stats import pearsonr
a = pd.read_csv("GSPC.csv", index_col = "Data")
type(a)
print(a["Close"].mean())
print(pearsonr(a["Close"], a["Volume"])) |
# -*- coding: utf-8 -*-
import pickle
from abc import ABC
from statistics import mode
from nltk.classify import ClassifierI
from nltk.tokenize import word_tokenize
class VoteClassifier(ClassifierI, ABC):
"""клас що об'єднує в собі результати роботи усіх наявних моделей"""
def __init__(self, *classifiers):
... |
<reponame>benpolletta/egly-driver-network
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
#import matplotlib
#matplotlib.use('Agg')
from brian2 import *
start_scope()
from scipy import signal
from cells.RS_LIP import *
from cells.FS_LIP import *
from cells.SI_LIP import *
from c... |
"""
Some activation functions for neural network models.
"""
import numpy as np
from abc import (ABCMeta, abstractmethod)
from six import add_metaclass
from scipy.special import expit
__all__ = [
'ActivationFunction',
'Identity',
'Logistic',
'HyperbolicTangent'
]
@add_metaclass(ABCMeta)
class Activat... |
# -*- coding: utf-8 -*-
import copy
import math
import os
from collections import Counter, OrderedDict
import numpy as np
import pandas as pd
import scipy as sci
import sklearn as sk
from sklearn import preprocessing
from sklearn.feature_extraction.text import TfidfVectorizer
import tensorflow as tf
import torch as ... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------
# Filename: eik.py
# Purpose: Eikonal solver, ray tracer etc.
# Author: microquake development team
# Email: <EMAIL>
#
# Copyright (C) 2016 microquake development team
# ---------------------------------------------------... |
<filename>edibles/models.py<gh_stars>0
import numpy as np
import inspect
import collections
from scipy.interpolate import CubicSpline
from lmfit import Model
from lmfit.models import update_param_vals
from edibles.utils.voigt import voigtAbsorptionLine
def guess_voigt(model, data, x):
"""Estimate parameters of v... |
#!/usr/bin/env python
# coding: utf-8
# In[34]:
# environment set up
import tensorflow as tf
import tensorflow.keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.utils import to_categorical
import numpy as np
import matplotlib.pyplot as plt
import os
... |
import numpy as np
import scipy as sp
import sklearn.random_projection
import math
#Given a NxN projection matrix [columns are basis vecs]
#construct a DxN projection matrix where D <= N
def reduce_projection_dimension(X, dim_max):
N, _ = X.shape
D = min(N, dim_max)
mult_fac = math.sqrt(float(N) / float(D... |
<gh_stars>0
import numpy as np
import scipy.special as sc
import warnings
from sampy.interval import Interval
from sampy.utils import check_array, cache_property
class Multinomial:
def __init__(self, n_trials=1, bias=[0.5, 0.5], seed=None):
# safety check n_trials
if isinstance(n_trials, float):
warnings.... |
import numpy as np
from random import random
from scipy.interpolate import pchip_interpolate
import matplotlib.pyplot as plt
#####################
# STEP 1 # import the data
#####################
# uncomment for a toy example
#n=5 # problem size
#A = 10*np.random.rand(n,n+3) # n stocks with n+3 differ... |
"""
Optical filters
"""
import os
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import minimize_scalar, brentq
from scipy.special import eval_chebyt
from astropy import units as u
from astropy.table import Table
from gunagala.utils import ensure_unit, get_table_data
class Filter:
... |
<reponame>yuxiaonan1988/udacity<filename>Deep Learning/1_notmnist.py
#! Assignment 1
#! The objective of this assignment is to learn about simple data curation practices,
#! and familiarize you with some of the data we'll be reusing later.
#! This notebook uses the notMNIST dataset to be used with python experiments.
... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Harmonic calculations for frequency representations'''
import numpy as np
import scipy.interpolate
from ..util.exceptions import ParameterError
__all__ = ['harmonics']
def harmonics(x, freqs, h_range, kind='linear', fill_value=0, axis=0):
'''Compute t... |
<gh_stars>1-10
import cv2
import tensorflow as tf
import numpy as np
import scipy.ndimage as sci
from gtts import gTTS
import time
from textblob import TextBlob
# This module is imported so that we can
# play the converted audio
import os
#to normalize the images to same no. of pixels
def resizeIt(img,size=100,med... |
from __future__ import absolute_import, print_function, division
import theano
import theano.tensor as T
from theano import function, shared
from theano.tests import unittest_tools as utt
from theano.tensor.nnet.ConvTransp3D import convTransp3D, ConvTransp3D
from theano.tensor.nnet.ConvGrad3D import convGrad3D, ConvGra... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 14 13:51:53 2014
@author: pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.SlotW11 import SlotW11
from numpy import ndarray, arcsin, exp, angle
from scipy.optimize import fsolve
from pyleecan.Classes.LamSlot import LamSlot
from p... |
<gh_stars>0
# ------------- Machine Learning - Topic 7: K-means Clustering and Principal Component Analysis
# This file contains code that helps you get started on the
# exercise. You will need to complete the following functions
# in this exercise:
#
# findClosestCentroids
# computeCentroids
# runkMean... |
# imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import cv2
import caffe
import numpy as np
import os.path as osp
from random import shuffle
from PIL import Image
import random
class ImageSegDataLayer(caffe.Layer):
"""
This is a simple syncronous datalayer for training a D... |
import statistics
import logging
from datetime import date, timedelta
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_cookie
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_f... |
<reponame>atait/nengo
"""
Extra functions to extend the capabilities of Numpy.
"""
import collections
import logging
import warnings
import numpy as np
from ..exceptions import ValidationError
logger = logging.getLogger(__name__)
try:
import scipy.sparse as scipy_sparse
def is_spmatrix(obj):
"""Ch... |
<filename>py/experiments/cat3.py
from scipy.optimize import differential_evolution
'''
Consider a SINGLE customer at a SINGLE location at a two operating points, with a SINGLE emission type.
Map out the functional depenencies. Limit indirection (if you see multiple arguments, there could be another function.)
This i... |
import torch
from torch import nn
from layers import *
from torch.nn import DataParallel
from torch.backends import cudnn
from torch.utils.data import DataLoader
from torch import optim
from torch.autograd import Variable
from torch.utils.data import Dataset
from scipy.ndimage.interpolation import rotate
import numpy a... |
<reponame>jamesobutler/porespy<filename>porespy/generators/_imgen.py
import numpy as np
import inspect as insp
from edt import edt
import porespy as ps
from numba import njit
import scipy.spatial as sptl
import scipy.ndimage as spim
from porespy.tools import norm_to_uniform, ps_ball, ps_disk, get_border
from porespy im... |
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
# Definition for Simple Test Case
eta_test = 0
p0_test = 1 - 2 ** (-1.5)
dist_theta_test = stats.lognorm(s=1, scale=np.exp(0))
sigma_theta_test = 2 * np.log(dist_theta_test.mean()/dist_theta_test.median())
mu_theta_test = np.log(dist_the... |
<filename>4 term/MNA/Lab 1/task1_1_3.py
import numpy as np
from numpy import linspace
from matplotlib import pyplot as plt
from utils import tridiag_solve
from scipy import integrate
def get_c(x1, x2, k_x):
return (integrate.quad(lambda x: 1 / k_x(x), x1, x2)[0]) ** (-1)
def get_phi(x1, x2):
return ... |
import numpy as np
import scipy.stats
import sys
# this function builds a random subset
# occurrences must an np.array with dtype=float
def subset(Ncandidates, Nsubset, occurrences, alpha = 1.0):
proba_candidat = np.array([1/(j**alpha) if j != 0 else 1 for j in occurrences])
proba_candidat = proba_candidat / f... |
# -*- coding: utf-8 -*-
u"""SRW execution template.
:copyright: Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcollections
from pykern import pkio
from pykern.pkd... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Mapper for getting spatial distance matrix.
Author: <EMAIL>
Date: 2012.05.26
Editors: [plz add own name after edit here]
"""
__docformat__ = 'restructuredtext'
import nump... |
from sympy import symbols, RR, poly
class Antecedent():
def __init__(self):
return
def trapesium(self, a, b, c, d, universe):
'''input:
a, b, c, d = int interval membership trapesium
universe = (intStart, intEnd)
return:
[poly], [(interval_start, i... |
# observation module
import numpy as np
from pyRT_DISORT.observation import Angles, Spectral
dummy_angles = np.outer(np.linspace(5, 10, num=15), np.linspace(5, 8, num=20))
angles = Angles(dummy_angles, dummy_angles, dummy_angles)
incidence = angles.incidence
emission = angles.emission
mu = angles.mu
mu0 = angles.mu0... |
<gh_stars>1-10
import numpy as np
import scipy
import jax
from . edges_with_mapping import edges_with_mapping
def adjacency_edge_face(F):
'''
ADJACENCY_EDGE_FACE computes edge-face adjacency matrix
Input:
F (|F|,3) numpy array of face indices
Output:
E2F (|E|, |F|) scipy sparse matrix of adjacency inf... |
<filename>setup.py
from setuptools import setup, Extension
import os
import versioneer
try:
from Cython.Build import cythonize
import numpy as np
import scipy
except ImportError:
raise ImportError("Cython, numpy, and scipy must be installed before pycalphad can be installed.")
# Utility function to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.