text string |
|---|
<gh_stars>1-10
#!/usr/bin/env python
### This program simulates Fisher's geometric model with abiotic change equal to fixations during conflict simulations (from FGMconflict.py) ###
### python3 FGMabiotic.py -help for input options ###
### Written by <NAME> 2018 ###
### python --version ###
### Python 3.5.2 :: Anacond... |
#!/usr/bin/env python3
import logging
import platform
import time
from functools import partial
from statistics import stdev
from typing import List, Tuple, Dict, Union, Any
import psutil
from joblib import Parallel, delayed
from fimdp.objectives import BUCHI
from fipomdp import ConsPOMDP
from fipomdp.energy_solvers ... |
""" Provides functionalilty for working with celled hypercubes.
Hypercubes are extensions of lines, squares and cubes into higher
dimensions. Celled hypercubes can be thought as a grid or lattice
structure. From this point, hypercubes is used to mean celled
hypercubes.
A hypercube can be described by its dimension a... |
<reponame>hassaniqbal209/data-assimilation
"""Particle filters for inference in state space models."""
import abc
from typing import Tuple, Dict, Callable, Any, Optional
import numpy as np
from numpy.random import Generator
from scipy.special import logsumexp
from scipy.sparse import csr_matrix
from dapy.filters.base ... |
from __future__ import division, print_function
import sys, os, glob, time, warnings, gc
# import matplotlib.pyplot as plt
import numpy as np
from astropy.table import Table, vstack, hstack
import fitsio
from astropy.io import fits
from scipy.interpolate import interp1d
output_path = '/global/cfs/cdirs/desi/users/ro... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 16 20:15:55 2019
@author: Shinelon
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
path='ex2data1.txt'
data=pd.read_csv(path,header=None,names=['Exam1','Exam2','Admitted'])
data.head()
#两个分数的散点图,并用颜色编码可视化
positive=data[data['Admitte... |
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(prog="region_optimize.py", description="Find the kernel parameters for Gaussian region zones.")
parser.add_argument("spectrum", help="JSON file containing the data, model, and residual.")
parser.add_argument("--sigma0", type=float, default=2, help=... |
import numpy as np
from scipy.sparse import issparse
from sklearn.utils import sparsefuncs
import anndata
from typing import Union
from ..dynamo_logger import LoggerManager, main_tqdm
from ..utils import copy_adata
def lambda_correction(
adata: anndata.AnnData,
lambda_key: str = "lambda",
inplace: bool = ... |
# util functions about data
from scipy.stats import rankdata, iqr, trim_mean
from sklearn.metrics import f1_score, mean_squared_error
import numpy as np
from numpy import percentile
def get_attack_interval(attack):
heads = []
tails = []
for i in range(len(attack)):
if attack[i] == 1:
... |
<gh_stars>0
# NBA Stats Clustering
# Copyright <NAME>, 2019
# gaussian mixture models with em algorithm
import numpy as np
from scipy import stats
from clustering.Cluster import NBACluster
# nba gmm class
# gmm from scratch as well, more explained below
class NBAGMM(NBACluster):
def fit(self):
self.method... |
<reponame>mcd4874/NeurIPS_competition<gh_stars>10-100
"""
<NAME>
"""
import os.path as osp
import os
import errno
from .build import DATASET_REGISTRY
from .base_dataset import Datum, DatasetBase,EEGDatum
from scipy.io import loadmat
import numpy as np
from collections import defaultdict
class ProcessDataBase(Datas... |
<reponame>qizhu8/CodedCachingSim<filename>CodedCaching/Network.py
"""
Network class is in charge of:
1. Storing M - User Cache Size, N - Number of Files, K - Number of Users
2. Storing User instances, Server instance, and attacker instance
"""
import numpy as np
from scipy import special
import itertools
from Server i... |
# import tensorflow as tf
# print(tf.__version__)
#
#
# with tf.name_scope('scalar_set_one') as scope:
# tf_constant_one = tf.constant(10, name="ten")
# tf_constant_two = tf.constant(20, name="twenty")
# scalar_sum_one = tf.add(tf_constant_one, tf_constant_two, name="scalar_ten_plus_twenty")
#
#
#
# with tf... |
<reponame>basavyr/curve-fitting
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import curve_fit
import random as rd
import plotter
def model_function(X, a, b, c):
"""
- the analytical expression for the model that aims at describing the experimental data
- the X argument is a... |
#!/usr/bin/env python3
# Simple script to compute correlations for inserted and removed tokens
import numpy as np
import pandas as pd
from tqdm import tqdm
import os
import sqlite3
from datetime import datetime
import scipy.stats
import scipy.sparse
def create_array(token_index, db, total=9584147):
token_indicat... |
<reponame>ScottHull/FDPS_SPH
"""
This is a python script that converts u(rho, T), P(rho, T), Cs(rho,T), S(rho, T)
to T(rho, u), P(rho, u), Cs(rho, u), S(rho, u), which is more useful for SPH calculations
"""
import matplotlib.pyplot as plt
from collections import OrderedDict
import numpy as np
import pandas as pd
imp... |
#!/usr/bin/env python
# Copyright 2020 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# 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... |
<reponame>ctuning/inference_results_v1.1
#! /usr/bin/env python3
# coding=utf-8
# Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
# Copyright 2021 The MLPerf Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wit... |
<filename>symopt/objective.py
from symopt.base import SymOptExpr
import sympy as sym
class ObjectiveFunction(SymOptExpr):
""" Symbolic (non)linear optimization objective function. """
def __init__(self, obj, prob, **kwargs):
""" Symbolic (non)linear optimization objective function.
Parameter... |
# ___________________________________________________________________________
#
# Prescient
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
# This software is ... |
from fractions import gcd
def smallestDiv():
"""Finds smallest number that is evenly divisible from 1 through 20"""
return reduce(lambda x,y: lcm(x,y), range(1,21))
def lcm(a,b):
return (a*b) / gcd(a,b)
if __name__ == '__main__':
print smallestDiv()
|
<gh_stars>1-10
# -*- coding: utf-8 -*-
# import libraries
import os
from PIL import Image
import nltk
import numpy as np
import matplotlib.pyplot as plt
import random
from scipy.ndimage import gaussian_gradient_magnitude
from wordcloud import WordCloud, ImageColorGenerator, STOPWORDS
# import mask image. Search fo... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 26 08:19:16 2017
@author: 0
"""
from scipy.misc import imresize
from scipy.signal import convolve,convolve2d
import scipy
from PIL import Image
import cv2
import numpy as np
img = cv2.imread("C://Users/0/Downloads/basketball1.png",0)
img2 = cv2.imread("C://Users/0/Downloa... |
<gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""hashvis by <NAME>
Reads from standard input or files, and prints what it reads, along with colorized versions of any hashes or signatures found in each line.
The goal here is visual comparability. You should be able to tell whether two hashes are the same... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
'''
REFERENCES:
[1] <NAME>, <NAME>, and <NAME>, "Estimation with Applications to Tracking and Navigation," New York: John Wiley and Sons, Inc, 2001.
[2] <NAME>, "Estimating Optimal Tracking Filter Performance for Manned Maneuvering Targets," in IEEE Transactions on Aerospace and E... |
"""Difference classes."""
__all__ = [
'BaseDifference',
'Missing',
'Extra',
'Invalid',
'Deviation',
]
from cmath import isnan
from datetime import timedelta
from ._compatibility.builtins import *
from ._compatibility import abc
from ._compatibility.contextlib import suppress
from ._utils import _... |
from PIL import Image, ImageFilter
import numpy as np
import glob
from numpy import array
import matplotlib.pyplot as plt
from skimage import morphology
import scipy.ndimage
def sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1, display1 = True):
if (display1):
new_list = []
new_list.a... |
#!/usr/bin/env python
"""
cubic spline planner
Author: <NAME>
"""
import math
import numpy as np
import bisect
from scipy.spatial import distance
class Spline:
"""
Cubic Spline class
"""
def __init__(self, x, y):
self.b, self.c, self.d, self.w = [], [], [], []
self.x = x
sel... |
<reponame>jonoconway/nz_snow_tools
"""
code to call the snow model for a simple test case using brewster glacier data
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
import datetime as dt
from nz_snow_tools.util.utils import resample_to_fsca, nash_sut, mean_bias, rmsd, mean_absolu... |
<reponame>brightsparc/predictive-maintenance-using-machine-learning
# Autoencoder based on: https://towardsdatascience.com/predictive-maintenance-of-turbofan-engine-64911e39c367
import argparse
import pandas as pd
import numpy as np
import itertools
import logging
import random
import os
from scipy.spatial.distance i... |
<filename>diabolo_play/scripts/interactive_play.py<gh_stars>10-100
#!/usr/bin/env python
import sys
import copy
import rospy
import tf_conversions
import tf.transformations as transform
import tf
from math import pi
import math
import thread
import os
import random
import geometry_msgs.msg
from geometry_msgs.msg import... |
<reponame>ColmTalbot/psd-covariance-matrices
#!/usr/bin/env python
"""
Compute the comparison of the analytic and experimental PSD matrices.
This will generate Figure 1.
This is probably the only example that will run in a reasonable time without
a GPU.
For more details on the method see https://arxiv.org/abs/2106.13... |
import matplotlib.pyplot as plt
import numpy as np
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import json
from scipy.interpolate import interp1d
from data_utils import *
def integral(y, x):
area = 0
for xi, xj, yi, yj in zip(x[:-1], x[1:], y[:-1], y[1:]):
ar... |
<reponame>alterapars/drought_classification
import random
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
############################ STATS input data ################################################
def return_nan_percentage(input_data):
"""
prints percentage of nan values in m... |
<reponame>silverfield/pythonsessions<gh_stars>0
__author__ = 'ferrard'
# ---------------------------------------------------------------
# Imports
# ---------------------------------------------------------------
import scipy as sp
import random
import time
# ---------------------------------------------------------... |
#!/usr/bin/env python
# encoding: utf-8
"""
expfitting.py
Provide single or double exponential fits to data.
"""
import lmfit
import numpy as np
import scipy.optimize
class ExpFitting:
"""
Parameters
----------
nexp : int
1 or 2 for single or double exponential fit
initpars : dict
... |
<filename>benchmark/automated_agents_selenium/exatag_labels_agent.py
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import psycopg2
import time
import statistics
from sele... |
#!/usr/bin/env python3
import numpy as np
import sys
import struct
# from math import fabs
from enum import IntEnum
from scipy import spatial
from math import *
from collections import OrderedDict
def second(elem):
return elem[1]
def get_topk(a, k):
k = min(a.size, k)
idx = np.argpartition(-a.ravel(), k - 1)[:... |
<filename>Model Building/homecredit.py<gh_stars>1-10
# coding: utf-8
# # Home Credit Default Risk
# ## Predicting how capable each applicant is of repaying a loan?
# 
# Introduction: Many people struggle to get loans due to insufficient or non-existent credit histo... |
<reponame>dnzprmksz/Movie-Recommender
import numpy as np
from numpy import load
from scipy.sparse import csr_matrix, csc_matrix
# Min-hashing with random vectors. More vectors produce better approximation.
def generate_user_signature(num_vectors=120):
# Using normalized utility matrix, since similarity in normalized... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 16:29:231 2021
@author: zayn
"""
## Initialization
import sys
sys.path.append('../../software/algorithms/')
import svm_cls as svm
import scipy.io
import numpy as np
import time
from sklearn.svm import SVC
## =============== Part 1: Loading a... |
<reponame>empymod/frequency-design
import emg3d
import empymod
import numpy as np
import ipywidgets as widgets
import scipy.interpolate as si
import matplotlib.pyplot as plt
from IPython.display import display
from scipy.signal import find_peaks
# Define all errors we want to catch with the variable-checks and setting... |
"""
Linear UVLM State Space System
"""
import sharpy.linear.utils.ss_interface as ss_interface
import numpy as np
import sharpy.linear.src.linuvlm as linuvlm
import sharpy.linear.src.libsparse as libsp
import sharpy.utils.settings as settings
import scipy.sparse as sp
import sharpy.utils.rom_interface as rom_interface... |
<gh_stars>10-100
import numpy as np
import scipy
__all__ = ['esprit','kernel_esprit']
from ... import matrix
################
''' SEARCH IT IN THE TIME_DOMAIN SECTION '''
#################
#----------------------------------------------------------------
def esprit(x, order, mode='full',fs=1, tls_rank = None):
... |
<filename>process_data.py
import pandas as pd
from pandas import DataFrame
import numpy as np
import traceback
from nltk.tokenize import sent_tokenize
from sentence_transformers import SentenceTransformer
import scipy.spatial
#Global vairable for cache purpose
model = None
#EDA and Basic Preprocessing
def map_label... |
import argparse
import torch
import os
from dassl.utils import setup_logger, set_random_seed, collect_env_info
from dassl.config import get_cfg_default
from dassl.engine import build_trainer
import numpy as np
import pandas as pd
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from submission.N... |
'Respuesta de los laboratorios de Ironhack_JLMC'
'Laboratorio 1'
from math import sqrt
from statistics import mean, stdev
pozo = 125
Avancexdia = 30
Caidaxnoche = -20
Serpiente_atrapada = True
dia = 0
Avancetot = 0
Avancereal = Avancexdia + Caidaxnoche
while Serpiente_atrapada:
Avancetot += Avancereal
dia += ... |
<filename>non_euclidean/hype.py
#!/usr/bin/env python3
"""
Small library for geometry in Euclidean, elliptic, and hyperbolic spaces.
Does point arithmetic, trigonometric functions, and common geometric equations.
Supports using different math contexts.
WARNING: This library is still a work in progress! Don't assume t... |
<gh_stars>10-100
import math
from ConfigParser import SafeConfigParser
import numpy as np
from scipy.stats.distributions import chi2
import ss2d
from utils import *
def read_sensor_params(config):
sensor_params = ss2d.BearingRangeSensorModelParameter()
sensor_params.bearing_noise = math.radians(config.getfl... |
"""
Filename: robustlq.py
Authors: <NAME>, <NAME>, <NAME>, <NAME>
Solves robust LQ control problems.
"""
from __future__ import division # Remove for Python 3.sx
from textwrap import dedent
import numpy as np
from .lqcontrol import LQ
from .quadsums import var_quadratic_sum
from numpy import dot, log, sqrt, identit... |
import numpy as np
from scipy.fftpack import fft,ifft
import matplotlib.pyplot as plt
fig, ax = plt.subplots(2, 1)
U = np.loadtxt('t3.txt')
n = len(U)
ax[0].set_xlabel('Sample Index')
ax[0].set_ylabel('U')
ax[0].set_title('Original Signal')
ax[0].plot(U)
uf = fft(U)
Ek = 0.5 * abs(uf)**2
n2 = int(n/2)
Ek2 = Ek[ran... |
from statsmodels.datasets.macrodata import load_pandas
from statsmodels.tsa.base.datetools import dates_from_range
from statsmodels.tsa.arima_model import ARIMA
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.api as sm
plt.interactive(False)
# let's examine an ARIMA model of CPI
cpi = load_panda... |
<reponame>CameronKing/sympy
"""
The contents of this file are the return value of
``sympy.assumptions.ask.compute_known_facts``.
Do NOT manually edit this file.
Instead, run ./bin/ask_update.py.
"""
from sympy.core.cache import cacheit
from sympy.logic.boolalg import And
from sympy.assumptions.ask import Q
# -{ Know... |
<gh_stars>10-100
"""
Module for testing kmod.util .
"""
__author__ = 'wittawat'
import autograd
import autograd.numpy as np
import numpy.testing as testing
import matplotlib.pyplot as plt
# Import all the submodules for testing purpose
import kmod
import kmod.config
import kmod.mctest
from kmod import data, density... |
import numpy as np
import scipy.interpolate as spint
import theano
from ruamel.yaml import YAML, RoundTripLoader
from pathlib import Path
import abundances
from astropy import units
from astropy import table as t
import gp_grid
elines_table = t.Table.read('./data/elines.dat', format='ascii.ecsv')
default_lines = ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from scipy import misc
import sys
import os
import argparse
import tensorflow as tf
import numpy as np
import random
from PIL import Image
import time
import shutil
sys.path.append('../lib/facenet/src')
impor... |
<reponame>matbra/fractional_octave_filterbank
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 13:36:18 2015
@author: matthias
"""
import sys
from os.path import join, dirname
sys.path.append(join(dirname(__file__), "resources", "preferred_numbers"))
from preferred_numbers import preferred_number
import numpy as n... |
""" Calculate CCFs themselves. So meta! """
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
import sys, os
import time as pytime
import subprocess
import multiprocessing
from itertools import product
from bisect import bisect_left, bisect_right
from glob import glob
from scipy.interpola... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ri... |
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 boxcox
from scipy.stats import norm
from functions import gradientDescent, ZNorm, COD, adj_r2
from sklearn.model_selection import train_test_split
from sklearn.preprocessing impor... |
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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 app... |
<gh_stars>1-10
#!/usr/bin/env python
#=============================================================================#
# #
# NAME: plt_2D_mcmc.py #
# ... |
<reponame>joshlyman/TextureAnalysis
import numpy as np
from skimage.filters import gabor_kernel
from scipy import ndimage
from scipy.stats import kurtosis
from scipy.stats import skew
def GrayScaleNormalization(imgArray, imgMax,imgMin):
imgRange = imgMax - imgMin
imgArray = (imgArray - imgMin) * (255.0 / imgR... |
<filename>evoMPS/tdvp_gen.py
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 13 17:29:27 2011
@author: <NAME>
TODO:
- Adaptive step size.
"""
from __future__ import absolute_import, division, print_function
import copy as cp
import scipy as sp
import scipy.linalg as la
import scipy.optimize as opti
import scipy.... |
import numpy as np
from math import floor, ceil
import cv2
from skimage import filters
# Todo: make it work
def reflect_x_image(image): # okay for 0, 8 (maybe 1)
N = len(image)
ref_mat = []
for i in range(N):
ref_mat.append([[-1,0],[0,1]])
new_img = np.zeros((N,28,28))
for i in range(28):
... |
import torch
import torch.nn as nn
import numpy as np
from scipy.stats import levy
from scipy.stats import norm
def print_grad(self, grad_input, grad_output):
print("Layer:", self.__class__.__name__)
print("grad_input:", grad_input)
print("grad_input_norm:", grad_input[0].norm())
print("grad_output:", ... |
<filename>RedWine Quality/RedWine Quality_Ensemble Methods.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 20:54:49 2018
@author: yhj
"""
# RedWine Quality Analysis
# https://www.kaggle.com/uciml/red-wine-quality-cortez-et-al-2009
#
import numpy as np
import pandas as pd
from time import time
im... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 4 10:46:31 2018
@author: Maine
"""
import sys
from PyQt5.uic import loadUi
from PyQt5.QtWidgets import QApplication, QMainWindow
from pyqtgraph import GraphicsLayoutWidget
from collections import deque
from PyQt5 import QtWidgets, QtCore, QtGui
... |
import pandas as pd
import os
import subprocess as sub
import re
import sys
from Bio import SeqUtils
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from scipy import stats as st
import matplotlib as mpl
#
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica'... |
# -*- coding: utf-8 -*-
"""
Immersion factor calibration.
"""
# Importation of modules
import os
import time
import h5py
import string
import deepdish
import datetime
import numpy as np
from scipy import stats
import matplotlib
import matplotlib.pyplot as plt
from refractivesqlite import dboperations as DB # https:/... |
"""Benchmarks for peak finding related functions."""
try:
from scipy.signal import find_peaks, peak_prominences, peak_widths
from scipy.misc import electrocardiogram
except ImportError:
pass
from .common import Benchmark
class FindPeaks(Benchmark):
"""Benchmark `scipy.signal.find_peaks`.
Notes
... |
<gh_stars>0
"""The definition of the base geometrical entity with attributes common to
all derived geometrical entities.
Contains
========
GeometryEntity
GeometricSet
Notes
=====
A GeometryEntity is any object that has special geometric properties.
A GeometrySet is a superclass of any GeometryEntity that can also
b... |
#!/usr/bin/env python
"""
This is the module for producing predstorm plots.
Author: <NAME>, <NAME>, <NAME>, Austria
started May 2019, last update May 2019
Python 3.7
Issues:
- ...
To-dos:
- ...
Future steps:
- ...
"""
import os
import sys
import copy
import logging
import logging.config
import numpy as np
impor... |
import sys, time
import numpy as np
from numba import jit
from math import erf
from scipy.spatial import cKDTree
# template to replace MPI functionality for single threaded use
class MPI_to_serial():
def bcast(self, *args, **kwargs):
return args[0]
def barrier(self):
return 0
# try running in... |
import os
from textwrap import dedent
from typing import List, Union
import pytest
import numpy as np
import pandas as pd
from scipy import sparse
import yaml
from strictyaml import load, YAMLValidationError
from datarobot_drum.drum.exceptions import DrumSchemaValidationException
from datarobot_drum.drum.typeschema_v... |
<reponame>lixuekai2001/OpenPNM
import numpy as np
import scipy.spatial as sptl
from openpnm.topotools import tri_to_am
from openpnm.topotools.generators import tools
def delaunay(points, shape=[1, 1, 1]):
r"""
Generate a network based on Delaunay triangulation of random points
Parameters
----------
... |
print "importing stuff..."
import matplotlib
matplotlib.use('Agg')
import numpy as np
import pdb
import matplotlib.pylab as plt
from scipy import special
from .context import vfe, compute_kernel, compute_psi_weave
jitter = 1e-5
class AutoSGPR(object):
def __init__(self, X_train, Y_train, M):
self.N_trai... |
<reponame>MatheusCbrl/Machine-Learning<filename>curso/4 - Machine Learning/Models/kmeans-elbow-method.py
# web: https://pythonprogramminglanguage.com/kmeans-elbow-method/
# clustering dataset
# determine k using elbow method
from sklearn.cluster import KMeans
from sklearn import metrics
from scipy.spatial.distance im... |
import numpy as np
from numpy import array
from scipy import misc
from PIL import Image
import pymp
import datetime
a = datetime.datetime.now()
pymp.config.nested = True
face = misc.imread('input.jpg',object)
print(face.shape)
convx = array([[1 / 16, 2 / 16, 1 / 16],
[2 / 16, 4 / 16, 2 / 16],
... |
<reponame>Mahdi-Asadi/python_thesis<filename>solve_ivp_32_pandas - Copy.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.integrate import solve_ivp
def dy_dx(x,y):
wa=1 # atomic frequency
wp=0.6 # field frequency
g=0.6 # coupling strength
... |
"""A script that takes external trigger scan data where the TDC + TDC time stamp were activated and creates
time walk plots from the data.
"""
import logging
from matplotlib import pyplot as plt
from matplotlib import cm
import tables as tb
import numpy as np
from scipy.interpolate import interp1d
import progressbar
... |
# cmath module
# cmath stands for complex math
# it is simmilar as math module, but it has less functions and attributes compared to math module.
# the functions and attributes name are same as math module but they can work with complex number too.
# first we need to import the module
import cmath
# lets see the di... |
<reponame>joniumGit/moons
from typing import Tuple
import numpy as np
from scipy.optimize import least_squares
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils.validation import check_X_y
from sklearn.utils.validation import check_array, check_is_fitted
class OnePerRegression(RegressorMixin,... |
<reponame>mjfwest/OpenMDAO-Framework
"""Expected Improvement calculation for multiple objectives."""
from numpy import exp, pi, array, isnan, diag, random
try:
from math import erfc
except ImportError as err:
from scipy.special import erfc
from openmdao.main.datatypes.api import Enum, Float, Array, Int
from ... |
# Copyright (c) 2020 <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, publish, distribute, ... |
print "importing stuff..."
import numpy as np
import pdb
# import matplotlib
# matplotlib.use('Agg')
import matplotlib.pylab as plt
from scipy import special
from .context import aep
from .datautils import step, spiral
from .context import config
def run_regression_1D():
np.random.seed(42)
print "create dat... |
<gh_stars>10-100
from dataclasses import dataclass, field
from .atomic_table import PeriodicTable, Element, Isotope, AtomicAbundance, DefaultAtomicAbundance, KuruczPf, KuruczPfTable
from .atomic_model import AtomicTransition, AtomicLine, AtomicModel, AtomicContinuum, element_sort
from .atmosphere import Atmosphere
from... |
<reponame>woon5118/totara_ub
"""
This file is part of Totara Enterprise Extensions.
Copyright (C) 2020 onwards Totara Learning Solutions LTD
Totara Enterprise Extensions is provided only to Totara
Learning Solutions LTD's customers and partners, pursuant to
the terms and conditions of a separate agreement with Totara... |
<reponame>IoTDATALab/EC-Clustering<gh_stars>1-10
import numpy as np
import scipy.sparse as sp
import copy
import warnings
import pandas as pd
import sys
import math
from sklearn.metrics.pairwise import euclidean_distances,pairwise_distances_argmin_min
from sklearn.base import BaseEstimator, ClusterMixin, TransformerMi... |
<reponame>jormansa/deepnet
import numpy as np
from trainer import *
import scipy.io as sio
# le pasamos el file_pattern de labels, el file_parttern de ids, el numpy de representacion de salida
# ej: python eval_parches.py "/home/jmansanet/pruebas/data/2/test_labels*.npy" "/home/jmansanet/pruebas/data/2/test_id*.npy" ... |
<reponame>hxia/plp-git-demo
# random forest classification with n fold cross validation
#===============================================================
# INPUT:
# 1) location of files: libsvm file + indexes file (rowId, index)
# 2) ntree, max_depth, mtry, var_imp
#
# OUTPUT:
# it returns a file with indexes merged wi... |
<reponame>beastraban/INSANE
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 2 18:30:02 2015
@author: spawn
"""
from __future__ import division
import numpy as np
import platform
import matplotlib.pyplot as plt
from scipy.integrate import ode
from scipy.interpolate import interp1d
import time as TIME
from ... |
# -*- coding: utf-8 -*-
import numpy as np
import scipy.signal as sp_signal
from mosqito.functions.loudness_ecma_spain.ear_filter_design import ear_filter_design
from mosqito.functions.loudness_ecma_spain.gen_auditory_filters_centre_freq import (
gen_auditory_filters_centre_freq,
)
from mosqito.functions.loudness... |
<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright (C) 2015 <NAME> <<EMAIL>>
Modified to include constituent by <NAME>
Licenced under the Apache Licence, v2.0 - http://www.apache.org/licenses/LICENSE-2.0
"""
import sys
import getopt
import numpy
# import gzip
import json
from scipy.sparse import lil_ma... |
import scipy.spatial.kdtree
import numpy
from scipy import version
from numpy import arcsin
import numpy as np
import dask.array as da
scipy_version = (".".join(version.version.split(".")[0:2])).split(".")[0:2]
def match_lists(ra1, dec1, ra2, dec2, dist, numNei=1):
"""Crossmatches the list of objects (ra1, dec1)... |
import numpy
from numpy.testing import (assert_, assert_equal, assert_array_equal,
assert_array_almost_equal)
import pytest
from pytest import raises as assert_raises
from scipy import ndimage
from . import types
class TestNdimageMorphology:
@pytest.mark.parametrize('dtype', types)
... |
<reponame>cbworden/shakemap<filename>shakemap/coremods/kml.py
# stdlib imports
import os
import os.path
import zipfile
import shutil
import re
# third party imports
from PIL import Image
from lxml import etree
import numpy as np
from scipy.ndimage.filters import median_filter
import simplekml as skml
import fiona
impo... |
"""Test scipy methods."""
import numpy as np
import scipy.sparse.linalg as sla
from numpy.testing import TestCase, assert_array_almost_equal
from pyamg.krylov._gmres_mgs import gmres_mgs
from pyamg.krylov._gmres_householder import gmres_householder
class TestScipy(TestCase):
def setUp(self):
self.cases ... |
<reponame>sleepy-owl/pyPESTO<filename>test/util.py
"""Various test problems and utility functions."""
import os
import sys
import numpy as np
import scipy.optimize as so
import importlib
import pypesto
try:
import amici
except ImportError:
pass
def obj_for_sensi(fun, grad, hess, max_sensi_order, integrated... |
<filename>flxd_graphs1.py
# -*- coding: utf-8 -*-
# рисуем графики заданных пользователем функций
# AUTHOR: fluxoid, <EMAIL>
# STARTED: 22.01.2019
# VERSION: 0.1
# LATEST FILE REVISION: 26.01.2019
import numpy as np
import math
import matplotlib.pyplot as plt
import sympy
from sympy.abc import x
from sym... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.