text string |
|---|
#!/usr/bin/env python
# coding: utf-8
# # Welcome to Kijang Emas analysis!
#
# 
#
# I was found around last week (18th March 2019), our Bank Negara opened public APIs for certain data, it was really cool and I want to help people get around with the... |
<filename>mtsv/scripts/MTSv_analyze.py<gh_stars>0
import argparse
import json
import logging
import numpy as np
import pandas as pd
from collections import namedtuple
from functools import partial
from scipy.stats import binom_test
from mtsv.parsing import file_type, outfile_type
from mtsv.utils import (
get_precal... |
"""Data Lab helpers for clustering."""
# std lib
from __future__ import print_function
__authors__ = '<NAME> <<EMAIL>>, Data Lab <<EMAIL>>'
__version__ = '20171219' # yyyymmdd
# 3rd party
import numpy as np
def findClusters(x,y,method='MiniBatchKMeans',**kwargs): # x,y can be for instance ra,dec
"""Find 2D c... |
<filename>psoap/orbit.py
r'''
Orbital conventions derived according to
.. math::
v_{r,1} = K_1 (\cos (\omega_1 + f) + e \cos \omega_1) \\
v_{r,2} = K_2 (\cos (\omega_2 + f) + e \cos \omega_2)
where a positive :math:`v_r` indicates a redshifted source and :math:`\omega_2 = \omega_1 + \pi`. In an RV-only p... |
<filename>agents/navigation/lange_change.py
#!/usr/bin/env python
import numpy as np
from math import pi, sin, cos, radians, sqrt
from scipy.interpolate import splrep, splev
from agents.learning.GMM import GMM
from agents.navigation.local_planner import RoadOption
from agents.navigation.local_waypoint import LocalWay... |
<reponame>pydae/pydae_doc<filename>_build/jupyter_execute/smib_milano_ex8p1/smib_milano_ex8p1_4ord_builder.py
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import sympy as sym
import numba
import pydae.build as db
# In[ ]:
# ## Formulation
#
# Backward solution:
#
# $$
# \begin{split}
#... |
## License: ?
## Copyright(c) <NAME>. All Rights Reserved.
## Copyright(c) 2017 Intel Corporation. All Rights Reserved.
import cmath
import math
import os
import cv2
import numpy as np
import pyrealsense2 as rs
from cubemos.skeletontracking.core_wrapper import CM_TargetComputeDevice #refer to cubmos documentation for ... |
import colorsys
import math
import pprint
import time
import statistics
from collections import Counter
import random
from canvas import *
def dist(a, b):
return math.sqrt(sum((a - b) ** 2 for a, b in zip(a, b)))
class QuadTree:
def __init__(self, template: Canvas, id, depth=1):
self.id = id
... |
from preprocessing.reader import EvalitaDatasetReader, read_emoji_dist
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
from utils.fileprovider import FileProvider
from scipy.sparse import csr_matr... |
from django.shortcuts import render
from django.core.files.storage import FileSystemStorage
from scipy import stats
import random
import csv
import pandas as pd
########### Funkcyjki wysyłające info, używające django: #############
def witaj(request):
print('Witaj!')
return render(re... |
<reponame>jw2249a/2017-bayes-audit
# f.py
# <NAME> and <NAME>
# August 4, 2017
# python3
"""Implement function f(b_1, ..., b_k) for
optimization studies of auditing sampling plan.
From email of today to Husayn:
We suppose we have k strata.
Within each stratum, we have a choice as to how many new ballots to
sam... |
from my_widgets import ColorPicker, DoubleSlider
from PyQt5 import QtCore, QtWidgets, QtGui, QtChart
import configparser
import matplotlib.pyplot as plt
import numpy as np
import os
import plot_chart
from scipy.stats import linregress as lrg
class Window(QtCore.QObject):
STATUS_REQUESTED = QtCore.pyqtSignal()
... |
<gh_stars>10-100
from gym_minigrid.minigrid import *
from gym_minigrid.register import register
import matplotlib.pyplot as plt
from skimage.transform import resize
import os
import glob
import scipy.ndimage.morphology
from dc2g.util import find_goal_inds, wrap, get_colormap_dict
from PIL import Image
import numpy as ... |
<filename>main.py
import numpy as np
from scipy import io as sio
from cala import *
from tolo import *
print('Done.')
|
<filename>prepare-data.py
# prepare-data.py
#
# Generate consistent word order, word-image co-occurrence matrix,
# and randomly project image features.
# Input: data files in the format specified in the readme
# extracted image features
# Output: sparse image-word co-occurrence matrix
# JSON dict from wo... |
#!/usr/bin/python
import sys
sys.path.insert(0, "/usr/local/lib/python2.7/site-packages/")
import argparse
import commands
import cPickle as pickle
import cv2
import fnmatch
import math
import numpy as np
import os.path
from progress.bar import Bar
import scipy.spatial
sys.path.append('../lib')
import Matcher
import... |
from __future__ import print_function
import functools
import itertools
import math
import scipy.integrate
import sys
TOP_REPLICATION_FACTOR = 0.1
AVG_WEBPAGES_PER_DOMAIN = 150
USE_APPROX = True
def log_replication_function(k, N, m):
#return math.log(N - k + 1) + 1
max_replication = max(1.0, m * TOP_REPLICATI... |
<reponame>atzeus/PPMI<filename>convertTXT.py
import numpy as np
import scipy.io as sio
import numpy as np
from docopt import docopt
def main():
args = docopt("""
Usage:
convertTXT.py <name.txt> <name.np>
""")
input_path = args['<name.txt>']
output_path = args['<name.np>']
npa = n... |
import sys
sys.stderr = open("/home/cpi/multimeter/mainProgramV1.py.err", "w")
import gpio
import time
import math
import pygame
from statistics import mode, StatisticsError
import subprocess
#2 - 32
#4 - 229
#5 - 228
#3 - 33
CPI = 32
ARD = 229
DAT_IN = 228
DAT_OUT = 33
TIMEOUT = 0.01
BITS = 12
... |
import numpy as np
from scipy.integrate import quad
# Cuadratura dreptunghiului
def int_drept(a, b, f):
# Pasul 1
h = b-a
# Pasul 2
I = h * f((a+b)/2.)
# Pasul 3
return I
# Cuadratura trapezului
def int_trap(a, b, f):
# Pasul 1
h = b - a
# Pasul 2
I = h/2. * (f(a) + f(b))
... |
from __future__ import absolute_import, division, print_function, unicode_literals
from keras.utils import to_categorical
from consensus.cfa_ongraphs import CFA_process
# from consensus.cfa_ge_2stage import CFA_ge_process # for static, k regular networks only, see paper
import numpy as np
# import tensorflow as tf # tf... |
import sys, os, string, time, pdb, copy, pyfits
import numpy as np
#import np.ma as ma
from pyindi import *
import scipy
from scipy import ndimage, sqrt, stats, misc, signal
import pyfits
from lmircam_tools import *
from lmircam_tools import process_readout
def optimize_opd_fizeau_grism(mode = "science"):
'''
... |
import pandas as pd
import numpy as np
from scipy.optimize import minimize, Bounds
from scipy.spatial.distance import cdist
import fieldmodel.fielderrors as fe
import fieldmodel.models as models
import fieldmodel.utilities as util
import fieldmodel.plotting as plotting
import matplotlib as mpl
import matplotlib.pyplo... |
import numpy as np
import anndata
from scipy.sparse import csr_matrix, hstack
from scCloud import tools, cite_seq
def run_pipeline(input_file, output_name, **kwargs):
is_raw = not kwargs['processed']
if 'seurat_compatible' not in kwargs:
kwargs['seurat_compatible'] = False
# load input data
if not kwargs['cite... |
<gh_stars>1-10
r"""
14. Seismic wavefield decomposition
===================================
Multi-component seismic data can be decomposed
in their up- and down-going constituents in a purely data driven fashion.
This task can be accurately achieved by linearly combining the input pressure
and particle velocity data in... |
<filename>src/Sephrasto/CharakterPrintUtility.py
from Wolke import Wolke
from Fertigkeiten import VorteilLinkKategorie
import Talentbox
import re
from difflib import SequenceMatcher
from fractions import Fraction
class CharakterPrintUtility:
@staticmethod
def getVorteile(char):
return sorted(char.vort... |
<filename>augtxt/augmenters.py
from typing import List
import copy
import numpy as np
import scipy.stats
import augtxt.typo as typo
import re
fn_dict = {
'typo.swap_consecutive': typo.swap_consecutive,
'typo.pressed_twice': typo.pressed_twice,
'typo.drop_char': typo.drop_char,
'typo.drop_n_next_twice'... |
<filename>mil_election_classification/models_all_set_transformer.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import scipy.sparse as sp
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
from modules import *
# GCN model
class GraphConvolution(Modu... |
<reponame>dblakely/FastSK
import os
import os.path as osp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.style as style
style.use('ggplot')
plt.rcParams['axes.facecolor']='w'
plt.rcParams['axes.edgecolor']='black'
plt.rcParams['grid.color']='#abbbc6'
from matplotlib.ticker import MultipleLocator,... |
<filename>NumericsPython/Z2DualCorrelation.py
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 5 11:12:29 2021
@author: gusta
"""
import argparse
# @Erik let me know if there's problems with this style import?
from z2_sim.src.NumericsPython import Z2Gauge
# import Z2Gauge
import numpy as np
import scipy.... |
import scipy.io as sio
import numpy as np
import torch.nn as nn
import torch
import data_fortrain
import torchvision
import torch.utils.data as data
from torch.autograd import Variable
import os
import utility
from option import args
import model
import loss
from trainer import Trainer
os.environ["CUD... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2020 by <NAME>
Licensed under the MIT License as stated in the LICENSE file.
This code supplements the paper "Exogenous factors for order arrivals
on the intraday electricity market" by <NAME> and <NAME>.
"""
#%% imports
from model import Model
import too... |
<reponame>willastro/ENIIGMA-fitting-tool<filename>ENIIGMA/Stats/Degen_plots.py
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
import os
import glob
from pandas import DataFrame
import sh
import pandas as pd
import sys
def chi_values(dir=os.getcwd() + '/'):
"""
Chi-square values.
"""
... |
import re
import numpy as np
import traceback
import inspect
from fractions import Fraction
from math import *
from collections import defaultdict, namedtuple
import .exceptions
def are_bools(tuple_arg):
"""
are_bools
---------
- Param: tuple_arg. Tuple, required.
- Returns: bool. True if all i... |
<gh_stars>0
import matplotlib
matplotlib.use('Agg')
import vcf, argparse, sys
import numpy as np
import pandas as pd
import math
from scipy.stats import chisquare
from collections import defaultdict
import matplotlib.pyplot
import ast
def parse_args():
"""
Description:
function 'parse_args' parses arg... |
"""Do recommendataion task.
Author: DHSong
Last Modified At: 2020.07.12
Anticipate target value. Find wheter the user would listen to the song again in a month.
"""
import os
import joblib
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.sparse ... |
<filename>mdp_extras/envs/pendulum.py
import numpy as np
import itertools as it
from scipy.stats import norm, vonmises
from gym.envs.classic_control import PendulumEnv
from mdp_extras import FeatureFunction
def pendulum_obs_to_state(obs):
costheta, sintheta, thetadot = obs
theta = np.arctan2(sintheta, costh... |
# -*- coding: utf-8 -*-
import pickle
from functools import lru_cache
import numpy as np
import sympy
import subfunction
def c(ixs):
return sum(range(1, sum(i > 0 for i in ixs) + 1))
def multinomial(lst):
res, i = 1, 1
for a in lst:
for j in range(1, a + 1):
res *= i
re... |
<gh_stars>1-10
from bert_models.base_bert_model import BaseBertModel
import joblib
import os
import numpy as np
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.metrics import f1_score
import tensorflow as tf
from tensorflow import keras
import time
from scipy.special import softmax
impo... |
from statistics import mean
import random
### library to perform genetic operations on data
class Individual:
"""class to represent an individual and its genetic components"""
def __init__(self, n_of_genes, mutation_rate, gene_function, print_func):
"""initializes an individual of the population with ... |
import statistics
from collections import defaultdict
from typing import List, Tuple
import click
import pandas as pd
from src.helpers import constants, scheduler
from src.models import KFold, Model, OursAblateModelConfig, OursModelConfig
def compute_statistics(models: List[Tuple[Model, float]]) -> Tuple[float, flo... |
<reponame>JohnGriffiths/dipy<gh_stars>1-10
import numpy as np
import scipy.sparse as sps
import numpy.testing as npt
from dipy.core.optimize import Optimizer, SCIPY_LESS_0_12, sparse_nnls, spdot
import dipy.core.optimize as opt
def func(x):
return x[0]**2 + x[1]**2 + x[2]**2
def func2(x):
return x[0]**2 + ... |
<filename>CS330-Kaiaicy/Homework/hw1_updated/hw1/load_data.py
import numpy as np
import os
import random
import tensorflow as tf
from scipy import misc
def get_images(paths, labels, nb_samples=None, shuffle=True):
"""
Takes a set of character folders and labels and returns paths to image files
paired with... |
from torch.utils.data import Dataset
import numpy as np
import json
import os
from haven import haven_utils as hu
from torchvision import transforms as tt
from PIL import Image
import glob, torch
import h5py, json
import torchvision.transforms as transforms
class Synbols(torch.utils.data.Dataset):
def __init__(sel... |
import sys
import datetime
from operator import add
import statistics
from pyspark.sql import SparkSession
from pyspark.sql import SQLContext
from pyspark import SparkContext
import json
from pyspark.sql.functions import udf
from pyspark.sql.types import ArrayType, StructField, StructType, StringType, IntegerType
impor... |
"""
n.b. macOS users may have difficulty installing pdf2image using pip.
See instructions at https://github.com/Belval/pdf2image
To install tesseract on macOS using homebrew:
`brew install tesseract`
"""
from pathlib import Path
import cv2
import PyPDF2
import pdf2image
import pytesseract
import numpy as np
from P... |
<reponame>stefaniaebli/dmt-signal-processing<filename>code/dmtvisual.py
#!/usr/bin/env python3
import numpy as np
from scipy import sparse
from scipy.sparse import coo_matrix
import gudhi as gd
import copy
import random
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import colors as mcolo... |
# %% [markdown]
# ## Imports and functions
import os
from operator import itemgetter
from timeit import default_timer as timer
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import seaborn as sns
from scipy import version
from graspy.match import FastApproximateQAP
from graspy.pl... |
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats
import torch
from torch.autograd import Variable
import utility
import config
from models import *
import quantize as quant
torch.set_printoptions(prec... |
<gh_stars>0
import copy
import numpy as np
import scipy as sp
class Order():
""" An ordering object that defines an ordering when applied to any Explanation or array.
"""
def __init__(self):
""" Build a new order object without any ops.
"""
self._ops = []
def apply(self, ... |
#!/usr/bin/env python3
# File Name:
# singlePDFReadData.py
# Author Information:
# <NAME>
# <EMAIL>
# Decription:
# June 30, 2021
# This program takes a .CSV generated by OpenBCI's Cyton board,
# processes the data to remove extraneous data points, graphs the data points,
# and then saves the graphs as PDFs. This versi... |
<filename>fractal_calc.py
#!/usr/bin/env python2
# -*- coding: utf8 -*-
### Общие библиотеки ###
from __future__ import print_function
import scipy
import scipy.stats
from scipy.stats import tstd
#import statistics
from make_safe_exec_str import remove_dangerous_symbols_exec
### Функция для подготовки списков координа... |
# -*- coding: utf-8
"""
@File : ctrdm_cal.py
@Author : <NAME>
@Contact : <EMAIL>
@License : MIT License
"""
' a module for calculating Cross-Temporal RDMs for a single channel & a single subject '
import numpy as np
from pyctrsa.util.progressbar import show_progressbar
from scipy.stats import... |
<reponame>vc-nju/drfi_python
import cv2
import numpy as np
import skimage
import scipy
# def de_gaussnoise(img_path):
# img = cv2.imread(img_path)
# dstimg = cv2.GaussianBlur(img,(5,5), 2)
# return dstimg
def de_gaussnoise(img_path):
img = cv2.imread(img_path)
dstimg = scipy.signal.wiener(img, (5,... |
<reponame>LaudateCorpus1/RIDDLE-1<filename>tests/riddle/test_feature_importance.py
"""Unit test(s) for feature_importance.py"""
import pytest
import os
import pickle
import numpy as np
from scipy.stats import ttest_rel
from riddle import feature_importance
from riddle.models import MLP
EPSILON = 1e-5 # tolerance
... |
import numpy as np
from .models import Results2D
def merge_o3res(o3rs, w_cols=1):
o3res = Results2D(dynamic=True)
o3res.x_disp = np.concatenate([o3r.x_disp.T for o3r in o3rs]).T
o3res.y_disp = np.concatenate([o3r.y_disp.T for o3r in o3rs]).T
o3res.selected_node_tags = np.concatenate([o3r.selected_nod... |
import numpy as np
from scipy.stats import ks_2samp
sample_size = 100_000
mean1 = 0.98
mean2 = 1
var1 = 1
var2 = 1
samp1 = np.random.normal(mean1, var1, sample_size)
samp2 = np.random.normal(mean2, var2, sample_size)
d, p = ks_2samp(samp1, samp2)
d, p = ks_2samp(samp1, samp2) |
"""
Methods for identifying space-time interaction in spatio-temporal event
data.
"""
__author__ = "<NAME> <<EMAIL>>", "<NAME> \
<<EMAIL>>", "<NAME> <<EMAIL>"
__all__ = ['SpaceTimeEvents', 'knox', 'mantel', 'jacquez', 'modified_knox']
import os
import libpysal as lps
import numpy as np
import scipy.stats as stats
fro... |
<gh_stars>0
import sys
from pyspark import SparkConf, SparkContext
import numpy as np
import scipy.sparse as sps
from pyspark.mllib.linalg import Vectors
from pyspark.mllib.linalg import SparseVector
from pyspark.mllib.regression import LabeledPoint
from numpy import linalg as LA
import matplotlib.pyplot as plt
def pa... |
import pdb
import os
import cv2
import time
from glob import glob
import torch
import scipy
import pandas as pd
import numpy as np
from tqdm import tqdm
from torch.utils.data import DataLoader
from argparse import ArgumentParser
import albumentations
from albumentations import torch as AT
from torchvision.datasets.fold... |
import numpy as np
import scipy.linalg
def pca(*series):
d = np.array(np.column_stack(series),dtype='float')
print 'input data:'
print d
# compute the mean by variating the first axis (i.e. across columns)
mean = np.mean(d, axis=0)
# make the data 0-mean
d -= mean
print 'zero-me... |
import os
import torch
import itertools
import numpy as np
import torch.utils.data
from scipy.sparse import csr_matrix
def _parse_data_point(data_point):
"""
Function to parse a row representing one input-output(s) pair in the LIBSVM format
Args:
data_point : row string
Returns:
(cl... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Field-of-view (FOV) background estimation
"""
from __future__ import print_function, division
import numpy as np
from astropy.wcs import WCS
from astropy.wcs.utils import pixel_to_skycoord
from ..image.utils import coordinates
__all__ = ['fill_acce... |
<gh_stars>1-10
# Created on 2020/7/24
# This module is for simple statistics.
# Standard library imports
from typing import Any, Union
# Third party imports
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.linalg import block_diag
from scipy.optimize import minimize
import scipy.stat... |
#
# FM demodulation, from i/q to audio.
#
import numpy
import scipy
import scipy.signal
def butter_lowpass(cut, samplerate, order=5):
nyq = 0.5 * samplerate
cut = cut / nyq
b, a = scipy.signal.butter(order, cut, btype='lowpass')
return b, a
class FMDemod:
def __init__(self, rate):
self.rate = rate
... |
<reponame>selkurdy/MLattrib
"""
mlattrib.py ver1.01.
Usage: python swattrib.py sattrib | featurescale | wscalecols | dataprep | listcsvcols
drop | wattrib | wamerge | seiswellattrib | scatterplot | qclin | linreg | testCmodels
| logisticreg | GaussianNaiveBayes | clustertest | clustering | t... |
<reponame>silvioedu/IGTI-MachileLearningBootcamp
import numpy as np
import pandas as pd
import math, string, os
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
import itertools
# Funcao para verificar valores missing no dataset
def check_missing(df, display = 10):
temp_df = df.copy()
df_nan ... |
<gh_stars>1-10
# From the original file example_evaluator.py by <NAME> (https://github.com/AICrowd/aicrowd-example-evaluator)
# Adapted for MEDIQA 2019 by <NAME> --Accuracy for Tasks 1 and 2 (NLI and RQE) & MRR, Accuracy, Precision, and Spearman's rank correlation coefficient.
# Last update on April 16, 2019.
import... |
<filename>CMB_foreground_demo/foregrounds_utils.py
import sys
import numpy as np
import time
import sys, os
import gc
import scipy.ndimage as ndimage
from deepmass import lens_data as ld
from deepmass import wiener
from deepmass import cnn_keras as cnn
import tensorflow as tf
print(tf.config.list_physical_devices(... |
from plotters import plot_bax_oligo, plot_dist_rate, plot_compiled_dist_rate, plot_agg_initiation, plot_oligo_rate_histo, plot_cytc, plot_scatter, plot_oligo_double_axis
import analysis_tools as tools
from scipy.spatial import distance
import matplotlib.pyplot as plt
import numpy as np
import data
import math
from iter... |
<filename>nirvana.py<gh_stars>0
import sys
import numpy
from scipy.special import binom
def help():
print("Usage: python nirvana.py NdK P")
print("\tN: number of dice, e.g. 3")
print("\tK: number of sides for each die, e.g. 6")
print("\tP: probability of success, e.g. 15")
def computeArguments(arg):
... |
<filename>Silhouette_Method_Walkthrough.py
#!/usr/bin/env python
# coding: utf-8
# ### Import Libraries
# In[51]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import clear_output
from scipy.spatial.distance import cdist
from sklearn.cluster import KMeans
... |
<filename>gp/patch.py
from scipy.spatial import distance
from util import Util
import mahotas as mh
import numpy as np
import skimage.measure
import scipy.misc
import uuid
import matplotlib.pyplot as plt
import os
import random
import time
# from uglify import Uglify
class Patch(object):
@staticmethod
def grab... |
<reponame>jycr753/Deep-Spying<gh_stars>100-1000
__author__ = '<NAME> www.<EMAIL> - 17/10/2015'
from pybrain.structure import *
from scipy import random
class UNeuralNet:
@staticmethod
def get_neural_net(input_number, output_number, NetworkType, HiddenLayerType, neurons_per_layer=[9], use_bias=False):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Build all possible graphs using a Randomised Stepwise Addition Order Algorithm w/ Branch and Bound.
# Usage...
# python -u permute_qpgraph.py 1> permute-std.log 2> permute-err.log
import xml.etree.ElementTree as ElemTree
import re
import sys
import csv
import glob
# TO... |
#!/usr/bin/env python
import cv2
try:
from scipy.misc import face
img = face()[:, :, ::-1]
except ImportError:
import numpy as np
from scipy.misc import lena
img = cv2.cvtColor(lena().astype(np.uint8), cv2.COLOR_GRAY2BGR)
import cv_bridge
import rospy
from sensor_msgs.msg import Image
from sensor_... |
<filename>Ag/Tutorial/manim_old_project/fractional.py
from manimlib.imports import *
import scipy.special
class Intro(Scene):
def construct(self):
f = ParametricFunction(
self.func,
t_min=0,
t_max=1.75,
color=GREEN
)
curve = Param... |
import re
import csv
import sys
import os
import pathlib
import json
import msgpack
import shutil
import numpy as np
from PIL import Image, ImageFilter
from scipy.spatial.transform import Rotation as R
def blur_photographer(original_image_dir, mask_image_dir, output_dir):
"""
"""
output_dir = path... |
import numpy as np
from scipy.special import erf
from scipy.stats import gaussian_kde
class Bounded_kde(gaussian_kde):
r"""Represents a one-dimensional Gaussian kernel density estimator
for a probability distribution function that exists on a bounded
domain."""
def __init__(self, pts, low=None, high=N... |
<reponame>UKPLab/emnlp-ws-2017-s3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import collections
import numpy
import nltk
from nltk.util import ngrams
from utils import stemmer, tokenizer, stopset, normalize_word
from scipy import spatial
import six
###############################... |
<reponame>kraktos/Kaggling
import scipy as sp
def llfun(act, pred):
# print("diff = " + str(act) + "\t" + str(pred))
ll = sum(pow((sp.log(pred + 1) - sp.log(act + 1)), 2))
ll = sp.sqrt(ll * 1.0 / len(act))
return ll
|
import pandas as pd
import hydrostats.data as hd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import scipy.stats as sp
regions = ['japan-geoglows', 'islands-geoglows', 'middle_east-geoglows', 'central_america-geoglows',
'central_asia-geoglows', 'australia-geoglows', 'south_asia-geoglows... |
# Food Bank Problem
import sys
import importlib
import numpy as np
from scipy.optimize import minimize
import scipy
# ## OPT - via Convex Programming
# Calculates the optimal solution for the offline problem with convex programming
def solve(W, n, k, budget, size):
# Objective function in the nash social welfar... |
<filename>heavytailed/lognormal.py
from .base_distribution import distribution
import numpy as np
from scipy.stats import norm
from scipy.optimize import minimize
class lognormal(distribution):
'''
Discrete log-normal distributions, given by
ln(x) ~ Normal(mu, sigma^2)
More specificly:
P(k)=(Phi(... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Localising sounds with the Schau & Robinson 1987 algorithm
===========================================================
The Schau & Robinson algorithm formulates the localisatin problem into finding
a series of intersecting spheres, instead of hyperbolas. This also me... |
from django.shortcuts import render
from django.http import HttpResponse
from .models import Package
import openpyxl
import statistics, math, random
import matplotlib.pyplot as plt
import matplotlib.image as img
import matplotlib
matplotlib.use('Agg')
book = openpyxl.load_workbook('tr/Digikey Tr Cleaned.xlsx')
sheet =... |
<reponame>PramuPerera/OCDA<filename>utils.py<gh_stars>1-10
import os
import cv2
import copy
import sys
import time
import torch
import random
import scipy.io
from dataset_file import *
from converter import *
import numpy as np
import torch.nn as nn
import torch.optim as optim
from datetime import datetime
import torch... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 19 09:45:18 2018
@author: cs17809
"""
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage
import os
import sys
import imageio
for i in range(11):
im = np.zeros((128, 128))
np.random.seed(i)
num_pixels = np.random.randint(1, 8)
x... |
import numpy as np
from os import listdir
import pickle
import os
import scipy
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
from config_args import parse_args
def losses_all(args):
def get_loss_pck(args, name, exp_name):
data = []
with open(str(os.getcwd()) +... |
import logging
import multiprocessing
from collections import Iterable
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.decomposition import PCA
from . import _tsne
from .affinity import Affinities, NearestNeighborAffinities
from .quad_tree import QuadTree
EPSILON = np.finfo(np.float64).eps
log =... |
# coding=utf-8
import numpy as np
import scipy.sparse as sp
from normalization import fetch_normalization
class Sampler:
"""Sampling the input graph data."""
def __init__(self, adj):
self.adj = adj
self.train_adj = adj
def randomedge_sampler(self, percent):
"""
... |
""" Script to store all functions"""
import numpy as np
#from osgeo.gdalconst import *
#from osgeo import ogr, gdal
import subprocess
import simplekml
import sys
import scipy
import multiprocessing as mp
from scipy import ndimage
import os
#import cv2
#import multiprocessing as mp
import matplotlib.pyplot as plt
from ... |
<reponame>omangin/multimodal<filename>multimodal/db/models/kinect_motion.py
# encoding: utf-8
__author__ = '<NAME> <<EMAIL>>'
__date__ = '04/2012'
"""Tools to access motion from a motion database.
"""
import os
import json
from collections import OrderedDict
import numpy as np
from scipy.io import savemat
DATA... |
<filename>euler/69.py
from sympy import isprime
def __gcd(x,y):
if x == 0:
return y
if x > y:
return __gcd(y,x)
return __gcd(y%x, x)
def is_coprime(x, y):
return __gcd(x,y) == 1
def get_f(n):
f = []
i = 2
while i*i <= n:
if n % i == 0 and isprime(i):
f.... |
import numpy as np
from scipy.signal import argrelextrema
from .river import River
class WillettSPM(object):
def __init__(self, surface, precipitation_rate, erodibility, uplift):
self.surface = surface
self.precipitation_rate = precipitation_rate
self.erodibility = erodibility
... |
<gh_stars>10-100
import tweepy
import numpy as np
import scipy.misc as smp
import os
import sys
from random import randrange
from random import shuffle
# Set up the square
data = np.zeros( (256,256,3), dtype=np.uint8)
# Initial colour
start = randrange(255)
#print(start)
order = [0,1,2]
shuffle(order)
#print(order)
... |
<reponame>aglatzel/kckProject
from django.shortcuts import render
from django.core.files.storage import FileSystemStorage
from scipy import stats
import random
import csv
import pandas as pd
animals = [
["Alpaka","alpaka.jpg","https://pl.wikipedia.org/wiki/Alpaka_(zwierz%C4%99)"],
["Chomik","chomik.jpg","https://pl.w... |
<reponame>NaleRaphael/Looper
import numpy as np
class NotInstalledDependency:
def __init__(self, name):
self.msg = '`{}` is not installed'.format(name)
def __call__(self, *args, **kwargs):
raise ImportError(self.msg)
def __getattr__(self, x):
raise ImportError(self.msg)
try:
... |
<reponame>JonathanMbt/SNA_Parking_Behavior
import matplotlib.pyplot as plt
import botometer
from commands import *
from functions import *
import statistics as st
def scrutinize(hashtags):
rapidapi_key = "<KEY>"
twitter_app_auth = {
'consumer_key': 'J2vBhcxzmgI3AkyMVBW14cG4K',
'consumer_secret... |
<reponame>Kaushikpatnaik/Active-Learning-and-Best-Response-Dynamics
from numpy import *
from scipy.stats import norm as normal
from learners import *
class QuasiAdditive(LinearLearner, OnlineLearner):
def __init__(self, d, transform, z = None, rate = 1.0):
self.d = d
self.transform = transf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.