text string |
|---|
import numpy as np
import argparse
import os
from random import shuffle
from scrape import *
#from sklearn.cross_validation import KFold
from sklearn.model_selection import KFold
from scipy.stats import sem
from scipy.special import gammaln
from scipy.optimize import minimize
def fit_mallows_approx(perms,n):
"""
... |
import os
import matplotlib.pyplot as plt
plt.rcParams['axes.axisbelow'] = True
import numpy as np
import pints
import pints.io
import pints.plot
from nottingham_covid_modelling import MODULE_DIR
# Load project modules
from nottingham_covid_modelling.lib._command_line_args import IFR_dict, NOISE_MODEL_MAPPING, POPULAT... |
<reponame>lukerm/find-tune<gh_stars>1-10
# Copyright (C) 2017 DataArt
# Modifications copyright (C) 2018 lukerm
#
# 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/l... |
<reponame>swm1718/mic_array
# Adapted from alexa_led_pattern.py at https://github.com/respeaker/4mics_hat/blob/master/interfaces/alexa_led_pattern.py
import time
import math
import numpy as np
from scipy.stats import vonmises
class DOALEDPattern(object):
def __init__(self, show=None, number=12):
self.pixe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 12 10:07:12 2022
@author: <NAME>
"""
from scipy.integrate import ode
from scipy import interpolate
from scipy.constants import c,G,e
from scipy.misc import derivative
from numpy import pi
import numpy as np
from astropy.constants import M_sun
import... |
<reponame>HerrZYZ/scikit-network
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Apr 4, 2019
@author: <NAME> <<EMAIL>>
"""
import warnings
from typing import Union, Optional
import numpy as np
from scipy import sparse
def has_nonnegative_entries(input_matrix: Union[sparse.csr_matrix, np.ndarray]) -> bo... |
<filename>Streamlit/streamlit_app/tabs/modelisation.py
import streamlit as st
import pandas as pd
import numpy as np
#Pour la modélisation
from sklearn import preprocessing
from sklearn.preprocessing import PolynomialFeatures
from sklearn.model_selection import train_test_split , cross_val_score, GridSearchCV
from skl... |
#############################################################
# This program computes the dynamic I-V curve following #
# the procedure in Badel et al. #
# For convenience, it uses methods from the GLIF fitting #
# protocol (Pozzorini et al.). #
##########... |
# logistic regression instead of SVM -> also linear model but the group knows logistic regression and does not know SVM
# Basic imports
import torch
import torchvision
import torch.nn.functional as F
import numpy as np
from scipy import misc
from sklearn.metrics import confusion_matrix as confusion
torch.manual_seed(... |
<gh_stars>100-1000
import torch
from torch.utils.data import Dataset
import torch.distributed as dist
import pandas
from os import path
from glob import glob
from tqdm import tqdm
import random
import scipy.io
from PIL import Image
import json
from misc import nested_tensor_from_videos_list
from datasets.a2d_sentences.... |
import numpy as np
from numpy import linalg as LA
import scipy.sparse as sparse
from scipy.sparse import csc_matrix
from scipy.sparse import dia_matrix
import itertools
import operator
"""
A few functions used in PDE-FIND
<NAME>. 2016
"""
###########################################################################... |
import os
import string
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import multiprocessing as mp
import numpy as np
import pandas as pd
from palettable.colorbrewer.qualitative import Paired_12
import seaborn as sns
import scipy.stats as stats
mpl.rcPara... |
#!/usr/bin/python3.7
########################################################################################
# convergent_solver.py - Module for recursively calculating the matrix until convergence
#
# Author: <NAME>
# Copyright: <NAME>, 2021
############################################################################... |
<gh_stars>0
import numpy as np
import torch
import os
from pathlib import Path
from sklearn import manifold
import matplotlib.pyplot as plt
# from knn import knn
from scipy.spatial import distance
def convert_ds_to_np(D):
"""torch ds --> numpy matrix. x becomes a (n x m) matrix."""
X, y = torch.load(D)
X ... |
###################################################################
# ABOUT:
# This Python script gets data from the Pipeline-database and
# produces plots and correlations of selected variables.
# The purpose is to study how seeing with ALFOSC
# is related to various variables e.g. wind and temperature.
#
... |
"""MovieLens Dataset exploration using python
This script allows user to get information about films.
This file can also be imported as a module and contains the following
functions:
* read_csv - Read data from CSV file and return it as a list
* print_data_csv - Print data in csv format
* get_columns - G... |
import time
from statistics import mean
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
import smbus
import RPi.GPIO as GPIO
import hc_sr04
import bme280
DEVICE = 0x76 # 0x77 was default device I2C address
TOPIC = "flooding-kit/ponte-vecchio-kit"
READS_PER_CYCLE = 10
LOWEST_READS_TO_DISCARD = 3
HIGHEST_READS_T... |
# -*- coding: utf-8 -*-
import re
import os
import json
import pandas
import codecs
import pickle
import random
# import crawler
import hashlib
import data_io as dio
import pagehome as ph
from utility import email_getter
from utility import get_clean_text
from utility import homepage_neg
from utility import homepage_... |
import math
import types
import numpy as np
import scipy as sp
import scipy.linalg
import torch
import torch.nn as nn
import torch.nn.functional as F
def get_mask(in_features, out_features, in_flow_features, mask_type=None):
"""
mask_type: input | None | output
See Figure 1 for a better illustration... |
<filename>lib/dataset/loadmatrix.py
from scipy.io import loadmat, savemat
import json_tricks as json
import os
# file = os.path.join('C:\Users\msi\Downloads', 'gt_valid.mat')
x = loadmat(r'C:\Users\msi\Downloads\gt_valid.mat')
y = loadmat(r'C:\Users\msi\Downloads\mpii_human_pose_v1_u12_2\mpii_human_pose_v1_u12_2\mpii_h... |
<filename>tests/test_data/create_csr.py
import numpy as np
import scipy.sparse
num_rows = 10
num_cols = 10
nnz_per_row = 1
nnz = nnz_per_row * num_rows
indptr = np.array([i * nnz_per_row for i in range(num_rows + 1)], dtype='uint32')
# indices = np.array([i * num_cols / nnz_per_row % num_cols for i in range(nnz)], dt... |
import os
import shutil
from unittest import TestCase
from graphs import Network, FunctionTypeRestriction
import random
import sympy
import utility
class TestNetwork(TestCase):
def test_cnet_export_and_import(self):
for _ in range(10):
n = random.randint(1, 20)
for restriction in [... |
<reponame>rtu715/NAS-Bench-360
import numpy as np
import pandas as pd
import scipy.io
from matplotlib import pyplot as plt
import pickle
from sklearn.model_selection import train_test_split
from collections import Counter
from tqdm import tqdm
def preprocess_physionet():
"""
download the raw data from https://... |
<gh_stars>0
"""Snap, SubSnap, Sinks classes for snapshot files.
The Snap class contains all information related to a smoothed particle
hydrodynamics simulation snapshot file. The SubSnap class is for
accessing a subset of particles in a Snap.
"""
from __future__ import annotations
from pathlib import Path
from typin... |
<gh_stars>1-10
"""
Computes the necessary conditions of optimality using Bryson & Ho's method
[1] Bryson, <NAME>. Applied optimal control: optimization, estimation and control. CRC Press, 1975.
"""
import functools as ft
import itertools as it
import simplepipe as sp
import sympy
import re as _re
import numpy
np = nu... |
# Size of variable arrays:
sizeAlgebraic = 68
sizeStates = 17
sizeConstants = 47
from math import *
from numpy import *
import numpy as np
import simpy
def createLegends():
legend_states = [""] * sizeStates
legend_rates = [""] * sizeStates
legend_algebraic = [""] * sizeAlgebraic
legend_voi =... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 24 19:09:27 2018
@author: harter
"""
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
import gc
import matplotlib.pyplot as plt
import seaborn as sns
pal = sns.color_palette()
print('... |
<gh_stars>10-100
import os
import cv2
import dogs_cnn_models
import numpy as np
import pandas as pd
from keras.callbacks import EarlyStopping, ReduceLROnPlateau
from keras.preprocessing.image import ImageDataGenerator
from keraspipelines import KerasPipeline
from scipy import misc
from tqdm import tqdm
os.environ["CU... |
<gh_stars>0
import numpy as np
import scipy.linalg
import torch
from estimation_methods.abstract_estimation_method import \
AbstractEstimationMethod
from utils.torch_utils import np_to_tensor
class SingleKernelVMM(AbstractEstimationMethod):
def __init__(self, rho_generator, rho_dim, alpha, k_z_class, k_z_arg... |
<gh_stars>1-10
import matplotlib.pyplot as plt
from wordcloud import WordCloud, ImageColorGenerator
from scipy.misc import imread
import sqlite3
conn = sqlite3.connect('data.db')
user = {}
for i in conn.execute("select mid,name from user order by id").fetchall():
user[i[0]] = i[1]
wordlist = []
for i in conn.execut... |
<reponame>emaballarin/phytorch<filename>tests/special/test_gamma.py<gh_stars>1-10
from cmath import log, pi, sqrt
import mpmath as mp
import numpy as np
import torch
from hypothesis import assume, given, strategies as st
from pytest import mark
from scipy import special as sp
from scipy.special._mptestutils import exc... |
import scipy.io
from scipy import misc
import os
import glob
import cv2
import numpy as np
# Loop to convert images to grayscale, uses same principle as the convert.py file
# Additional functionality added to handle equalization of contrast for lower contrast images
num_images = 117
def rgb2gray(rgb):
return np.d... |
'''
:Date: 26 Jul 2016
:Author: Public Health England
'''
"""Detect peaks in data based on their amplitude and other features."""
import argparse
from khmer import khmer_args
import khmer
from khmer.kfile import check_input_files
from khmer.khmer_args import build_counting_args
from scipy.signal import find_peaks_cwt... |
"""
Construct projections between FE spaces.
"""
from __future__ import absolute_import
import numpy as nm
import scipy.sparse as sps
from sfepy.base.base import output, IndexedStruct
from sfepy.discrete import (FieldVariable, Integral,
Equation, Equations, Material)
from sfepy.discrete imp... |
import matplotlib.pyplot as plt
import numpy as np
import scipy.cluster
from .signal_zerocrossings import signal_zerocrossings
def signal_recompose(components, method="wcorr", threshold=0.5, keep_sd=None, **kwargs):
"""**Combine signal sources after decomposition**
Combine and reconstruct meaningful signal ... |
import itertools
from collections import namedtuple
from typing import List, Optional, Union
import pandas as pd
from scipy import stats
def dict_product(dicts):
"""
>>> list(dict_product(dict(number=[1,2], character='ab')))
[{'character': 'a', 'number': 1},
{'character': 'a', 'number': 2},
{'c... |
<reponame>dingdian110/AutoDC<filename>autodc/components/feature_engineering/transformations/utils.py<gh_stars>10-100
import warnings
import numpy as np
from scipy import linalg
from scipy.sparse.linalg import eigsh
from scipy import sparse
from scipy import stats
from sklearn.utils.extmath import svd_flip
from sklear... |
'''
Created on Mar 31, 2015
@author: <NAME> <<EMAIL>>
'''
from __future__ import division
import numpy as np
from scipy import optimize
from .lib_bin_base import LibraryBinaryBase
LN2 = np.log(2)
class LibraryBinaryUniform(LibraryBinaryBase):
""" represents a single receptor library with random entries. Th... |
# takes the process-able image as input outputs the list of emojis as a list of np arrays
import cv2
import statistics
import numpy as np
from scipy.signal import find_peaks
def image_2_emoji(image):
def to_half(image):
n_col = image.shape[1]//2
img_left = image[:, :n_col]
i... |
import numpy as np
from scipy import stats
import pandas as pd
__all__ = ['unique_rows',
'argrank',
'mnmx',
'mnmxi',
'argsort_rows',
'untangle',
'first_nonzero',
'complete_index']
def complete_index(df, index_cols, fill_value):
""... |
<gh_stars>0
"""Definition of the Matrix Vector Product Component."""
import numpy as np
import scipy.linalg as spla
from openmdao.core.explicitcomponent import ExplicitComponent
class MatrixVectorProductComp(ExplicitComponent):
"""
Computes a vectorized matrix-vector product.
math::
b = np.dot... |
<filename>uedinst/multimeter.py
from contextlib import suppress
from math import ceil
from time import sleep
from warnings import warn
import numpy as np
from pyvisa import ResourceManager
from scipy.constants import elementary_charge
from . import GPIBBase, InstrumentException
class TekDMM4040(GPIBBase):
"""
... |
<gh_stars>1-10
# FractureProof
# ACS 2014-2018 Zip Code Percent Estimates for 50 States
# Florida DOH 2014-2018 Zip Code 113 Causes of Death
# Section A: Generate Hypothesis with Machine Learning Algorithms
## Step 1-2: Import Libraries and Import Dataset
### Import Python Libraries
import os # Operating sy... |
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import math
import os
import logging
import warnings
import multiprocessing as mp
import numpy as np
from sklearn import cluster
from scipy.optimize import curve_fit
from scipy.signal import argrelextrema, savgol_filter
import seaborn as sb
from . import ut... |
import os
import numpy as np
import pytest
from numpy import testing
from scipy.io import loadmat
from tensorly.tenalg import multi_mode_dot
from kale.embed.mpca import MPCA
from kale.utils.download import download_file_by_url
N_COMPS = [1, 50, 100]
VAR_RATIOS = [0.7, 0.95]
relative_tol = 0.00001
baseline_url = "htt... |
'''
This routine to uses the Levenburg-Marquardt algorithm to fit a set of data points to
the function A*np.exp(-(alpha*(t**3)) + y0, which describes the amplitude of a Hahn
echo in the presence of a magnetic field gradient and diffusion. From the fit, one can
determine the constant of self diffusion. Data are read ... |
<reponame>shunw/pythonML_code
def add_feature(X, feature_to_add):
"""
Returns sparse feature matrix with added feature.
feature_to_add can also be a list of features.
"""
from scipy.sparse import csr_matrix, hstack
return hstack([X, csr_matrix(feature_to_add).T], 'csr') |
<gh_stars>0
import copy
import hashlib
import binascii
import numpy as np
from numpy import pi, dot
from numpy import newaxis as nax
from numpy.linalg import norm
from numpy import concatenate as cat
from scipy.optimize import check_grad
from ase.atoms import Atoms
from taps.projectors import Projector
class Model:
... |
<filename>lab4/src/imageproc_cl.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
from pathlib import Path
import glob
import yaml
from datetime import date
from scipy import ndimage
import cv2 as cv
from itertools import combinations
from itertools import product
from imageprocessing... |
#!/usr/bin/env python
# coding: utf-8
## Code for performing Curveball method for associations between mutations and molecular features
#Author: <NAME>
#from curveball import*
import pandas as pd
import numpy as np
import scipy.stats as stats
import statsmodels.stats.multitest
import copy
import random
import matplot... |
<filename>gammapy/image/measure.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from scipy.optimize import brentq
from astropy.units import Quantity
__all__ = [
"measure_containment_fraction",
... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""A collection of useful functions for the fitting process."""
from scipy import stats
def corr_coef(ydata_1, ydata_2):
"""Returns the correlation coefficient between y-axis data.
:param array ydata_1: Data of y-axis-1
:param array ydata_2: Data of y-axis-2
... |
import scipy.optimize
import numpy as np
from pynumdiff.utils import utility as utility
from pynumdiff.utils import evaluate as evaluate
import pynumdiff.linear_model
from pynumdiff.optimize.__optimize__ import __optimize__
def spectraldiff(x, dt, params=None, options={'even_extension': True, 'pad_to_zero_dxdt': Tru... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 2 15:24:59 2018
@author: root
"""
import cPickle as pkl
import numpy
import cv2
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import skimage
import skimage.transform
import skimage.io
from PIL import Image, ImageEnhance
import scipy.misc
import tensorfl... |
<reponame>kirikiritarutaru/home_prices_for_study
from pathlib import Path
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats
from scipy.stats import norm
sns.set()
def check_SalePrice(df, feat='SalePrice'):
print(df[feat].... |
# -*- coding: utf-8 -*-
#
from __future__ import division
import sympy
from .helpers import untangle2
class Strang(object):
"""
See
https://people.sc.fsu.edu/~jburkardt/datasets/quadrature_rules_tri/quadrature_rules_tri.html
and
<NAME>, <NAME>,
An Analysis of the Finite Element Method,
... |
<filename>preprocessing.py
import argparse
import glob
from scipy import misc
from utils import dataAugmentation,createGaussianLabel
import numpy as np
def get_parser():
parser = argparse.ArgumentParser('preprocess')
parser.add_argument('--inputPath', '-i', required=True)
parser.add_argument('--output... |
# coding=utf-8
import sys
mod_path = '/Users/Simo//Documents/energyanalytics/energyanalytics/disaggregation'
if not (mod_path in sys.path):
sys.path.insert(0, mod_path)
import numpy as np
from util import find_nearest
from sklearn.utils.extmath import cartesian
from bayesian_cp_detect import bayesian_cp_3 as bcp
f... |
import numpy as np
from scipy import optimize
import matplotlib.pyplot as plt
import math as math
# autoreload modules when code is run
%load_ext autoreload
%autoreload 2
# Question 1
# First the global variables are defined
m = 1
v = 10 # scales the disutility of labor
e = 0.3 # Frisch elasticity
... |
<filename>heuslertools/tem/tem_image.py
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage
from skimage.measure import profile_line
import os
from matplotlib import ticker
from .ser_reader import serReader
from PIL import Image
class TEMImage(object):
"""
Object representing a afm measurem... |
<filename>tomo_encoders/structures/voids.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import cupy as cp
import numpy as np
from tomo_encoders import Grid
from cupyx.scipy.ndimage import label
from scipy.ndimage import label as label_np
from scipy.ndimage import find_objects
import vedo
from tomo_encode... |
import base64
import re
import io
from scipy import misc
import classifiers
from classifiers import type01, type02
def model(v):
return v
class Classifier(object):
def __init__(self):
pass
def readImage(self, img_base64, mode):
sub = re.sub(r"data:image/.*?;base64,", '', img_base64)
... |
# -*- coding: utf-8 -*-
#!/usr/bin/python
# Author: <NAME>
# UY - 2017
# License: MIT
# One way or another...
# One and Two ways ANOVA conducting with Python
# %matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import matplotlib.axes
pd.set_option("display.width", 100)
import matp... |
from msdm.core.algorithmclasses import Result
from msdm.core.algorithmclasses import Learns
from msdm.core.problemclasses.stochasticgame.tabularstochasticgame import TabularStochasticGame
from msdm.core.problemclasses.stochasticgame.policy.tabularpolicy import TabularMultiAgentPolicy, SingleAgentPolicy
from msdm.core.a... |
<gh_stars>0
import numpy as np
import scipy.ndimage as ndimage
from skimage.filters import median
from skimage.morphology import binary_erosion
from skimage.transform import rescale
from functions.thresholding import binarize
class LineSegment:
def __init__(self, start_row, end_row, img_dialated=0):
self... |
# Randomized for Algorithm Tuning
from pandas import read_csv
from scipy.stats import uniform
from sklearn.linear_model import RidgeClassifier
from sklearn.model_selection import RandomizedSearchCV
filename = 'pima-indians-diabetes.data.csv'
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class... |
import sys
import os
import os.path
import tempfile
import scipy
import numpy as np
from matplotlib import pyplot as pl
from crackclosuresim2 import inverse_closure
from crackclosuresim2 import crackopening_from_tensile_closure
from crackclosuresim2 import solve_normalstress
from crackclosuresim2 import ModeI_throug... |
import numpy as np
from pygsvd import gsvd
from sklearn.decomposition import PCA
from sklearn.cross_decomposition import PLSRegression
from scipy.linalg import null_space
def GFK(Xs, Xt, ys=None, n_components=2, projection='pca'):
if projection == 'pca':
Bs = PCA(n_components=n_components).fit(Xs).compone... |
#
# Tests for the jacobian methods for two-dimensional objects
#
import pybamm
import numpy as np
import unittest
from scipy.sparse import eye
from tests import get_1p1d_discretisation_for_testing
def test_multi_var_function(arg1, arg2):
return arg1 + arg2
class TestJacobian(unittest.TestCase):
def test_li... |
#!/usr/bin/env python
"""
Establishes a correlation between 3D and 2D coordinate systems (e.g. images)
and correlate the position of objects of interest from the 3D to the 2D system.
Typically the initial (3D) system is a light micrroscopy (confocal) image
and the final (2D) is a ion beam image. The correlation proc... |
<filename>chapter11_说话人识别/hmm_train_test.py
from chapter2_基础.soundBase import *
from chapter11_说话人识别.GMM import *
from scipy.io import loadmat
from chapter3_分析实验.C3_1_y_1 import enframe
from chapter3_分析实验.mel import melbankm
from sklearn.mixture import GMM
from chapter10_语音识别.DTW.DTW import mfccf
import warnings
warn... |
<filename>evaluate.py
#!/usr/bin/env python3
import argparse
from decimal import Decimal
import json
from pathlib import Path
import random
import statistics
from typing import Any, Dict, Tuple, List, Set, Optional
import tabulate
def main() -> None:
""" Perform evaluation for all prediction files, comparing
... |
<gh_stars>1-10
# Description: Functions to perform statistical calculations.
# Author: <NAME>
# E-mail: <EMAIL>
__all__ = ['gauss_curve',
'principal_ang',
'nmoment',
'skewness',
'kurtosis',
'rcoeff',
'autocorr',
'crosscorr',
'Tdecorr',
'Tdecorrw',
'Neff... |
<filename>src_and_example/functions.py
#!/usr/bin/env python3
# coding: utf-8
# all functions for the calculation of the network state, the functional and its gradient, the network initialization.
#only works for control matrix=identity matrix and no limit/bounds for the control
import sys
import scipy.sparse as sp
... |
import os
import sys
import json
import datetime
import numpy as np
import pandas as pd
import statistics
import cv2
import skimage.draw
import tensorflow as tf
import keras
import time
import glob
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.nei... |
<reponame>CovertLab/CellTK
"""
Label labels1 to the same value from labels0. Not tracked is negative.
Turn labels0 into negative.
"""
from utils.filters import label
from utils.postprocess_utils import regionprops
from scipy.spatial.distance import cdist
from utils.track_utils import calc_massdiff, find_one_to_one_... |
from scipy.integrate import odeint
def LotkaVolterra(state,t):
x = state[0]
y = state[1]
alpha = 0.1
beta = 0.1
sigma = 0.1
gamma = 0.1
xd = x*(alpha - beta*y)
yd = -y*(gamma - sigma*x)
return [xd,yd]
t = arange(0,500,1)
state0 = [0.5,0.5]
state = odeint(LotkaVolterra,state0,t)
figure()
plot(t,stat... |
<reponame>WesleyLeeNTU/EDC<gh_stars>0
import random
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d,CubicSpline
# big_arr = []
# mass_flow_rate,ccl4,pin,tin = 28.0,300.0,13.1,330.0
# raw_raw_T_list=[tin]
# delta = 467.-tin
# Final_name="Tprofile7.csv"
# big_arr.append(np.hstack([mass_flo... |
<reponame>kura19-ds/python_data_analysis_ohmsha
# -*- coding: utf-8 -*-
"""
@author: hkaneko
"""
import matplotlib.pyplot as plt
import pandas as pd
from scipy.cluster.hierarchy import linkage, dendrogram, fcluster # SciPy の中の階層的クラスタリングを実行したり樹形図を作成したりするためのライブラリをインポート
from sklearn.decomposition import PCA
n... |
# Basic libraries
import numpy as np
import pandas as pd
from scipy import stats
import math
# Machine Learning
import sklearn
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow.python.framework import ops
import warnings
import random
import os
warnings.filterwarnings("igno... |
"""InnovAnon Inc. Proprietary"""
from fractions import *
from itertools import *
class OddLimit:
"""https://en.wikipedia.org/wiki/Limit_%28music%29#Odd_limit"""
"""generally preferred for the analysis of simultaneous intervals and chords"""
"""For a positive odd number n,
the n-odd-limit contains all rational num... |
<gh_stars>0
"""Statistical expressions."""
import json
from collections import defaultdict
from itertools import chain
from pathlib import Path
from sympy import Symbol, sympify
from sympy.core.compatibility import exec_
_locals = {}
exec_("from sympy.stats import *", _locals)
class Expression:
"""Represents a ... |
# coding: utf-8
# In[1]:
import scipy.io
import numpy as np
import matplotlib.pyplot as pyplot
from PIL import Image
import matplotlib.cm as cm
from pprint import pprint
import scipy.misc
import PIL
import KMeansUtilities as km
# In[2]:
def is_background(mat,colno):
row,col=mat.shape
for i in range(0,ro... |
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import h5py
import os
from glob import glob
import argparse
from scipy import ndimage
from scipy import stats
plt.close('all')
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['font.size'] = 12
mpl.rcParams['axes.linewidth'] = 2
mpl.rcParams['xt... |
<gh_stars>0
import scipy.sparse
import numpy as np
class Solution(object):
def findCircleNum(self, M):
M = np.matrix(M, dtype='bool')
return scipy.sparse.csgraph.connected_components(M)[0]
# https://discuss.leetcode.com/topic/85108/oneliner-p
# SciPy is an open source Python library used for sci... |
import numpy as np
import pandas as pd
import scipy.sparse as sp
import os
path = os.getcwd()
def get_adjacency_matrxix(dataset, number_nodes):
PEMS_net_dataset = pd.read_csv(path + '/data/PEMS0' + str(dataset)[5] + '/distance.csv', header=0)
PEMS_net_edges = PEMS_net_dataset.values[:, 0:2]
A = ... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from functools import partial
import os
import numpy as np
import tensorflow as tf
from ops import lrelu, linear, conv2d, deconv2d
from utils import make_batches, Prior, conv_out_size_same, create_image_grid, m... |
<filename>Diversity.py
from skbio.diversity import alpha
from skbio.diversity import get_beta_diversity_metrics
from skbio.stats.ordination import pcoa as Pcoa
from skbio.stats.distance import permanova
from skbio.stats.distance import DistanceMatrix
from sklearn.decomposition import PCA as sklearnPCA
from scipy import... |
'''
INN: Inflated Neural Networks for IPMN Diagnosis
Original Paper by <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>
(https://link.springer.com/chapter/10.1007/978-3-030-32254-0_12, https://arxiv.org/abs/1804.04241)
Code written by: <NAME>
If you use significant portions of this code or the ideas from ... |
<reponame>guochaoxu2019/POVME3.0
#!python
# POVME 3.0 is released under the GNU General Public License (see http://www.gnu.org/licenses/gpl.html).
# If you have any questions, comments, or suggestions, please don't hesitate to contact me,
# <NAME>, at j5wagner [at] ucsd [dot] edu.
#
# If you use POVME in your work, pl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is a submodule of smili. This module saves some common functions,
variables, and data types in the smili module.
'''
import numpy as np
# Logger
from logging import getLogger
logger = getLogger(__name__)
def fluxconv(unit1="Jy", unit2="Jy"):
'''
convert ... |
"""One qubit gate tests."""
import doki as doki
import numpy as np
import os
import scipy.sparse as sparse
import sys
from reg_creation_tests import gen_reg, doki_to_np
def Identity(nq):
"""Return sparse matrix with Identity gate."""
return sparse.identity(2**nq)
def U_np(angle1, angle2, angle3, invert):
... |
<filename>leavitt/sampler.py
#!/usr/bin/env python
"""SAMPLER.PY - Variable star sampler
"""
from __future__ import print_function
__authors__ = '<NAME> <<EMAIL>>'
__version__ = '20220320' # yyyymmdd
import time
import numpy as np
from dlnpyutils import utils as dln
from astropy.table import Table
import matplotl... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 12:01:18 2015
@author: <NAME>
Abstract dictionary learner.
Includes gradient descent on MSE energy function as a default learning method.
"""
import numpy as np
import pickle
# the try/except block avoids an issue with the cluster
try:
import matplotlib.pyplot as ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
from config import get_config
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import librosa
import copy
import os
__AUTHOR__ = "kozistr"
__REFERENCE__ = "https://github.com/Kyubyong/tacotron/b... |
import numpy as np
from numba import jit,njit
from scipy.stats import norm
from itertools import combinations as comb
###############################################################################
def interaction_matrix(N,K,shape="roll"):
"""Creates an interaction matrix for a given K
Args:
N (int):... |
<reponame>AxelHenningsson/xrd_simulator<gh_stars>0
import numpy as np
from xrd_simulator.beam import Beam
# The beam of xrays is represented as a convex polyhedron
# We specify the vertices in a numpy array.
beam_vertices = np.array([
[-1e6, -500., -500.],
[-1e6, 500., -500.],
[-1e6, 500., 500.],
[-1e6,... |
<gh_stars>10-100
import numpy as np
import matplotlib.pyplot as plt
import h5py
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.data import TensorDataset
from sklearn.preprocessing import MinMaxScaler
""" == Data Preproc Module =="""
def data_parser(filepath):
dataset =... |
<reponame>alitrack/dtreeviz
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import graphviz
import graphviz.backend
from numpy.distutils.system_info import f2py_info
from sklearn import tree
from sklearn.datasets import load_boston, load_iris, load_wine, load_digits, load_breast_cancer, load_diabetes, fe... |
<gh_stars>10-100
import numpy as np
from scipy import sparse
from scipy.linalg import svd
import math
from spartan.tensor import DTensor
def generateGH_by_multiply(A, Omg):
G = A.dot(Omg)
H = A.T.dot(G)
return G, H
def generateGH_by_list(G, H, glist, hlist, k):
if k == 0:
for g in glist:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.