text
string
<filename>statapy/regression/tests.py import scipy.stats as stats def mannwhitneyu(sample_0, sample_1, one_sided=False): """ Performs the Mann-Whitney U test :param sample_0: array of values :param sample_1: array of values :param one_sided: True iff you want to use less than alternative hypothesi...
"""Variational auto-encoder for MNIST data. References ---------- http://edwardlib.org/tutorials/decoder http://edwardlib.org/tutorials/inference-networks """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import edward as ed import numpy as np import os i...
# # Customer cliff dive data challenge # 2020-02-17 # <NAME> # ## Summary # ### The problem # The head of the Yammer product team has noticed a precipitous drop in weekly active users, which is one of the main KPIs for customer engagement. What has caused this drop? # ### My approach and results # I began by comi...
from collections import defaultdict import heapq from itertools import chain, repeat from feature_dict import FeatureDictionary import json import numpy as np import scipy.sparse as sp class TokenCodeNamingData: SUBTOKEN_START = "%START%" SUBTOKEN_END = "%END%" NONE = "%NONE%" @staticmethod def _...
# coding=UTF-8 # ex:ts=4:sw=4:et=on # Copyright (c) 2013, <NAME> # All rights reserved. # Complete license can be found in the LICENSE file. from io import StringIO from scipy.optimize import fmin_l_bfgs_b from .exceptions import wrap_exceptions def setup_project(projectf): from pyxrd.file_parsers.json_parser ...
# -*- coding: utf-8 -*- """ Created on Mon Apr 20 14:03:18 2020 @author: Nicolai """ import sys sys.path.append("../differential_evolution") from JADE import JADE import numpy as np import scipy as sc import testFunctions as tf def downhillsimplex(population, function, minError, maxFeval): ''' implementatio...
<reponame>biagiom/models import numpy as np import scipy.linalg as la from statsmodels.tsa.api import SimpleExpSmoothing, Holt """ @desc: From activity probe, calculate spike patterns """ def getSpikesFromActivity(self, activityProbes): # Get number of probes (equals number of used cores) numProbes = np.shape(...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Sentence level and Corpus level BLEU score calculation tool """ from __future__ import division, print_function import io import os import math import sys import argparse from fractions import Fraction from collections import Counter from functools import reduce from...
import time import numpy as np import scipy.sparse as sps from gensim.models import Word2Vec from tqdm import tqdm from recommenders.recommender import Recommender from utils.datareader import Datareader from utils.evaluator import Evaluator from utils.post_processing import eurm_to_recommendation_list from recommender...
# Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
#!/usr/bin/env python3 import logging import os import pickle import time from os.path import join as pjoin import matplotlib.pyplot as plt import numpy as np import scipy from matplotlib import rc from scipy.optimize import least_squares import asymptotic_formulae from asymptotic_formulae import GaussZ0 from asympto...
# set up the environment by reading in libraries: # os... graphics... data manipulation... time... math... statistics... import sys import os from urllib.request import urlretrieve import matplotlib as mpl import matplotlib.pyplot as plt import PIL as pil from IPython.display import Image import pandas as pd from p...
<filename>causal_rl/environments/multi_typed.py import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from gym import Env from scipy.spatial import distance from typing import Optional, Tuple, Any from causal_rl.environments import CausalEnv class MultiTyped(CausalEnv): """A simulation of ...
<filename>tutorials/seq2seq_sated/seq2seq_sated_meminf.py import os import sys from collections import defaultdict import tensorflow as tf import tensorflow.keras.backend as K import numpy as np import scipy.stats as ss import matplotlib.pyplot as plt from sklearn.metrics import roc_curve from sklearn.linear_model imp...
<reponame>liuyingbin19222/HSI_svm_pca_resNet50<gh_stars>10-100 import keras from keras.layers import Conv2D, Conv3D, Flatten, Dense, Reshape, BatchNormalization from keras.layers import Dropout, Input from keras.models import Model from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint from...
<filename>examples/services/classifier_service.py ''' python3 classifier_service.py data.csv This service runs a scikit-learn classifier on data provided by the csv file data.csv. The idea of this is a simple spam detector. In the file, you will see a number, 1 or -1, followed by a pipe, followed by a piece of text....
from __future__ import print_function from __future__ import division from . import _C import torch from fuzzytorch.utils import TDictHolder, tensor_to_numpy, minibatch_dict_collate import numpy as np from fuzzytools.progress_bars import ProgressBar, ProgressBarMulti import fuzzytools.files as files import fuzzytools....
<filename>alphad3m/alphad3m/metalearning/grammar_builder.py import logging import numpy as np from scipy import stats from collections import OrderedDict from alphad3m.metalearning.resource_builder import load_metalearningdb from alphad3m.metalearning.dataset_similarity import get_similar_datasets from alphad3m.primiti...
import numpy as np import scipy.io as sio import os, glob, sys import h5py_cache as h5c sys.path.append('/home/yzhang/workspaces/smpl-env-gen-3d-internal') sys.path.append('/home/yzhang/workspaces/smpl-env-gen-3d-internal/source') from batch_gen_hdf5 import BatchGeneratorWithSceneMeshMatfile import torch ''' In t...
import numpy as np import matplotlib.pyplot as plt import scipy.stats def set_ax_range(): LEFT_AX.set_xlim(X_RANGE) LEFT_AX.set_ylim(Y_RANGE) def range_plot(ax, f, x_range, y_range): bins = 50 xi, yi = np.mgrid[ min(x_range):max(x_range):bins*1j, min(y_range):max(y_range):bins*1j ...
<reponame>MartinThoma/cv-datasets<filename>hasy.py # -*- coding: utf-8 -*- """Utility file for the HASYv2 dataset. See https://arxiv.org/abs/1701.08380 for details. """ from __future__ import absolute_import from keras.utils.data_utils import get_file from keras import backend as K import numpy as np import scipy.nd...
#!/usr/bin/env python3 import os import colorsys import cv2 import numpy as np from scipy.stats import multivariate_normal from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D class ColorPredicate: def __init__(self, name, images_path, n_max=10): self.name = name self._t...
<filename>examples/cartpole_example/test/cartpole_PID_MPC_sim.py import numpy as np import scipy.sparse as sparse from scipy.integrate import ode from scipy.interpolate import interp1d import time import control import control.matlab import numpy.random import pandas as pd from ltisim import LinearStateSpaceSystem from...
import numpy as np from scipy.ndimage import maximum_filter class AttrDict(dict): __setattr__ = dict.__setitem__ __getattr__ = dict.__getitem__ def signal2noise(r_map): """ Compute the signal-to-noise ratio of correlation plane. w*h*c""" r = r_map.copy() max_r = maximum_filter(r_map, (5,5,1)...
#!/usr/bin/env python3 # -*-coding:utf-8-*- """ This module is used to extract features from the data """ import numpy as np from scipy.fftpack import fft from scipy.fftpack.realtransforms import dct import python_speech_features eps = 0.00000001 def file_length(soundParams): """Returns the file length, in sec...
from scipy import io import numpy as np import random import tensorflow as tf class_num = 10 image_size = 32 img_channels = 3 def OneHot(label,n_classes): label=np.array(label).reshape(-1) label=np.eye(n_classes)[label] return label def prepare_data(): classes = 10 data1 = io.loadmat('./data/...
<reponame>yanpei18345156216/COMBO_Python3 import numpy as np import scipy.stats def EI(predictor, training, test, fmax=None): fmean = predictor.get_post_fmean(training, test) fcov = predictor.get_post_fcov(training, test) fstd = np.sqrt(fcov) if fmax is None: fmax = np.max(predictor.get_post_...
<filename>sandbox/kl_div/kl.py import numpy as np import scipy as sp import scipy.stats import matplotlib.pyplot as plt class GaussianMixture1D: def __init__(self, mixture_probs, means, stds): self.num_mixtures = len(mixture_probs) self.mixture_probs = mixture_probs self.means = means ...
<filename>modules/niftitools.py import os import pydicom import glob import numpy as np import nibabel as nib from skimage import filters, morphology from scipy.ndimage.morphology import binary_fill_holes from scipy.ndimage import label from dipy.segment.mask import median_otsu def padvolume(volume): "Applies a pa...
#!/usr/bin/python from __future__ import division from __future__ import with_statement import matplotlib from matplotlib import rcParams from matplotlib import pyplot from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d import Axes3D from PIL import Image #import Image from pylab import * ...
<reponame>richplane/PyREmatcher # Renewable generation at Findhorn from windpowerlib import WindFarm from windpowerlib import WindTurbine from windpowerlib import WindTurbineCluster from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain import pvlib from pvlib.pvsystem import PVSystem from pvlib.l...
import os import csv import numpy as np import scipy.stats import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') def mean_confidence_interval(data, confidence=0.95): a = 1.0 * np.array(data) n = len(a) m, se = np.mean(a), scipy.stats.sem(a) h = se * scipy.stats.t.ppf((1 + confidence) / 2....
<filename>src/server/noize_reduction.py import scipy as sp from pyssp.util import ( get_frame, add_signal, compute_avgpowerspectrum ) def writeWav(param, signal, filename): import wave with wave.open(filename, 'wb') as wf: wf.setparams(param) s = sp.int16(signal * 32767.0).tostring() ...
<filename>Code/3_linear_regression_on_pixels.py # -*- coding: utf-8 -*- """3_Linear_regression_on_pixels.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1nhECM9OxwIw8BjEqsQcSUwojX2KYrh1I """ from google.colab import drive #to retrieve data from...
<reponame>pablohawz/tfg-Scan-Paint-clone import os import tempfile from time import time import numpy as np import sounddevice as sd from PySide2.QtWidgets import QApplication, QFileDialog from scipy.io.wavfile import write # Config t = 3 # s fs = 44100 def save(x, fs): # You have to create a QApp in order to ...
# -*- coding: utf-8 -*- """ Created on Thu Oct 15 14:03:52 2015 @author: jemanjohnson """ import numpy as np import matplotlib.pyplot as plt import os import scipy.io from sklearn import preprocessing from time import time from sklearn.preprocessing import MinMaxScaler # Image Reshape Function def img_as_array(img...
import numpy as np from scipy.linalg import sqrtm from sklearn.preprocessing import StandardScaler def make_linear_regression(n_samples=10000, n_uncorr_features=10, n_corr_features=10, n_drop_features=4, include_intercept=True, ...
import json import matplotlib.animation as animation import matplotlib.pyplot as plt import numpy as np import scipy.signal as signal import yaml from mpl_toolkits.mplot3d.axes3d import Axes3D from scipy.interpolate import interp1d from tf_pwa.config_loader import ConfigLoader from tf_pwa.experimental.extra_amp impor...
from sympy import * import pandas as pd def bisection(xl, xu, tolerance, function): x = Symbol('x') f = parse_expr(function) iteration = 0 data = pd.DataFrame(columns=['iteration','xl','xu','xr','f(xl)','f(xu)','f(xr)','f(xl)f(xr)','error']) while abs(xu-xl)>=tolerance: xr = (xl + xu)/2 ...
import tensorflow as tf import tensorflow_probability as tfp from scipy.stats import expon from videos.linalg import safe_cholesky from manim import * # shortcuts tfd = tfp.distributions kernels = tfp.math.psd_kernels def default_float(): return "float64" class State: def __init__(self, kernel, x_grid, x...
import numpy as np import time import matplotlib.pyplot as plt import imageio from scipy.optimize import fsolve from body import Body def get_position_from_Kepler(semimajor_axis, eccentricity, inclination, ascending_node, argument_of_periapsis, mean_anomaly, mass_orbit, G=6.67430 * 10**(-11)): """ Get the pos...
<reponame>MarcoFerrari128/Portfolio<gh_stars>0 import numpy as np import matplotlib.pyplot as plt from scipy.integrate import ode import FLC import pyprind from numpy.linalg import eig import pandas as pd def impulse(lenght): i = 0 Impulse = [] while i < lenght: if i == 99: Impulse.app...
<reponame>neal-siekierski/kwiver<filename>arrows/pytorch/seg_utils.py # ckwg +28 # Copyright 2018 by Kitware, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source ...
import math import numpy as np import scipy.constants as sp import copy import time X = 0 # Cartesian indices Y = 1 L = 0 # Lower U = 1 # Upper def gaussian(x, delay, spread): return np.exp( - ((x-delay)**2 / (2*spread**2)) ) def subsId(id): if id is None: return -1 else: return id-1 cl...
import os import sys sys.path.append(os.path.dirname(__file__) + "/../") from scipy.misc import imread from util.config import load_config from nnet import predict from util import visualize from dataset.pose_dataset import data_to_input cfg = load_config("demo/pose_cfg.yaml") # Load and setup CNN part detector s...
from abc import ABCMeta, abstractmethod from collections import defaultdict from copy import deepcopy from typing import Union, Type, Any, Tuple import numpy as np import torch import torch.nn as nn from scipy.signal import find_peaks_cwt from .net import MyNN, MyNNRegressor from .utils import autoregression_matrix, ...
import numpy as np from numpy import random, linspace, cos, pi import math import random import matplotlib.pyplot as plt from scipy.fft import fft, fftfreq from scipy.fft import rfft, rfftfreq import copy from mpl_toolkits.mplot3d import axes3d from mpl_toolkits import mplot3d from plotly import __version__ import pand...
<gh_stars>0 """ ebb_fit_prior : fits a Beta prior by estimating the parameters from the data using method of moments and MLE estimates augment : given data and prior, computes the shrinked estimate, credible intervals and augments those in the given dataframe check_fit : plots the true average and the shrinked averag...
<filename>word2vec.py #!/usr/bin/python -W all """ word2vec.py: process tweets with word2vec vectors usage: word2vec.py [-x] [-m model-file [-l word-vector-length]] -w word-vector-file -T train-file -t test-file notes: - optional model file is a text file from which the word vector file is built - ...
# runs t-tests over the null hypothesis # avg_gini if (priority == "newer") == avg_gini if (priority == "more active") import csv import numpy as np from scipy.stats import ttest_ind from scipy.special import stdtr def readCsvFile(fileName): ''' (string) => list of dicts Read the file called fileName a...
#!/usr/bin/python # Created by: <NAME> # Date: 2013 June 28 # Program: This program correct the imagen .fit (Science) by Syntethic Flat # 1 m Reflector telescope, National Astronomical Observatory of Venezuela # Mode f/5, 21 arcmin x 21 arcmin # Project: Omega Centauri, Tidal Tails. # The program Astrometry_V1.py def...
# -*- coding: utf-8 -*- """ --------------------------------------------- File Name: 粗避障 Desciption: Author: fanzhiwei date: 2019/9/5 9:58 --------------------------------------------- Change Activity: 2019/9/5 9:58 -------------------------------------...
''' Function and classes representing statistical tools. ''' __author__ = ['<NAME>'] __email__ = ['<EMAIL>'] from hep_spt.stats.core import chi2_one_dof, one_sigma from hep_spt.core import decorate, taking_ndarray from hep_spt import PACKAGE_PATH import numpy as np import os from scipy.stats import poisson from scipy...
import os import xml.etree.ElementTree as ET import numpy as np import scipy.sparse import scipy.io as sio import cPickle import subprocess import uuid def Get_Class_Ind(Class_INT): concepts = [] concepts.append(('Animal', [ 'n01443537', 'n01503061', 'n01639765', 'n01662784', 'n01674464', 'n01726692'...
""" Encodes SPOT MILP as the structure of a CART tree in order to apply CART's pruning method Also supports traverse() which traverses the tree """ import numpy as np from mtp_SPO2CART import MTP_SPO2CART from decision_problem_solver import* from scipy.spatial import distance def truncate_train_x(train_x, train_x_pre...
<reponame>ajferraro/fastreg import numpy as np from scipy import stats import utils def fit(xdata, ydata): """Calculate 2D regression. Args: xdata (numpy.ndarray): 1D array of independent data [ntim], where ntim is the number of time points (or other independent points). ...
<reponame>uiuc-cse/2014-01-30-cse<gh_stars>1-10 from __future__ import division import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy.special import jn, jn_zeros import subprocess def drumhead_height(n, k, distance, angle, t): ...
<reponame>taimurhassan/crc<filename>scripts/mot_neural_solver/pl_module/pair_nuclei.py import sacred from sacred import Experiment import os.path as osp import pandas as pd import scipy.io as sio import numpy as np from sacred import SETTINGS SETTINGS.CONFIG.READ_ONLY_CONFIG=False def pair_nuclei_and_generate_outpu...
from scipy.sparse import dok_matrix import pandas as pd from cytoolz import itemmap def long_dataframe_to_sparse_matrix( df, index, vars, values, id_to_row=None, var_to_column=None ): if id_to_row is None: unique_index_values = df[index].unique() id_to_row = dict(zip(unique_index_values, range...
import inspect import math as _math from copy import deepcopy import matplotlib.pyplot as _plt import numpy as np import pandas as pd import statsmodels.api as _sm from statslib._lib.gcalib import CalibType class GeneralModel: def __init__(self, gc, DM): self.gc = deepcopy(gc) self.DM = deepcopy...
import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline from scipy.fftpack import fft from combined_functions import check_ft_grid from scipy.constants import pi, c, hbar from numpy.fft import fftshift from scipy.io import loadmat from time import time import sys import matplotlib.pyplot as plt fr...
<reponame>Kamysek/DeepLocalShapes #!/usr/bin/env python3 # Based on: https://github.com/facebookresearch/DeepSDF using MIT LICENSE (https://github.com/facebookresearch/DeepSDF/blob/master/LICENSE) # Copyright 2021-present <NAME>, <NAME>. All Rights Reserved. import functools import json import logging import math impo...
<reponame>kaka-lin/ML-Notes import numpy as np from scipy.special import softmax np.set_printoptions(precision=6) def k_softmax(x): exp = np.exp(x) return exp / np.sum(exp, axis=1) if __name__ == "__main__": x = np.array([[1, 4.2, 0.6, 1.23, 4.3, 1.2, 2.5]]) print("Input Array: ", x) print("Sof...
import numpy as np from . import vector as V def rbm_to_dualquat(rbm): import cgkit.cgtypes as cg q0 = cg.quat().fromMat(cg.mat3(rbm[:3,:3].T.tolist())) q0 = q0.normalize() q0 = np.array([q0.w, q0.x, q0.y, q0.z]) t = rbm[:3, 3] q1 = np.array([ -0.5*( t[0]*q0[1] + t[1]*q0[2] + t[2]*...
<gh_stars>10-100 # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
from collections import defaultdict, Counter from itertools import product, permutations from glob import glob import json import os from pathlib import Path import pickle import sqlite3 import string import sys import time import matplotlib as mpl from matplotlib import colors from matplotlib import pyplot as plt fro...
import simpy as sp import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy import stats, integrate def client(env, lamda, q, tic): meant = 1/lamda while True: t = np.random.exponential(meant) yield env.timeout(t) q.put('job') tic.append(env.now) def ...
<filename>clustviz/clarans.py import random from typing import Tuple, Dict, Any import scipy import itertools import graphviz import numpy as np import pandas as pd from clustviz.pam import plot_pam from pyclustering.utils import euclidean_distance_square from pyclustering.cluster.clarans import clarans as clarans_py...
# -*- coding: utf-8 -*- """ Created on Mon Feb 11 09:18:37 2019 @author: if715029 """ import pandas as pd import numpy as np import sklearn.metrics as skm import scipy.spatial.distance as sc #%% Leer datos data = pd.read_excel('../data/Test de películas(1-16).xlsx', encoding='latin_1') #%% Seleccionar datos (a mi e...
#################################################################################################### # # congruence_closure_module.py # # Authors: # <NAME> # <NAME> # # This module maintains a union-find structure for terms in Blackboard, which is currently only used # for congruence closure. It should perhaps be integ...
<filename>examples/acados_python/test/generate_c_code.py # # Copyright 2019 <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # # This file is part of acados. # # The 2-Clause BSD License # # Redistribution and use in source and binary f...
import cmath import math import logging import random import plotly import pandas
# coding=utf-8 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
import copy import cmath import numpy import scipy.linalg from pauxy.estimators.thermal import greens_function, one_rdm_from_G, particle_number from pauxy.estimators.mixed import local_energy from pauxy.walkers.stack import PropagatorStack from pauxy.walkers.walker import Walker from pauxy.utils.linalg import regularis...
# -*- coding: utf-8 -*- ################################################################################ # Copyright 2014, Distributed Meta-Analysis System ################################################################################ """ This file provides methods for handling weighting across GCMs under delta meth...
# coding: utf-8 # In[1]: import keras # In[2]: # scipy import scipy print( ' scipy: %s ' % scipy.__version__) # numpy import numpy print( ' numpy: %s ' % numpy.__version__) # matplotlib import matplotlib print( ' matplotlib: %s ' % matplotlib.__version__) # pandas import pandas print( ' pandas: %s ' % pandas.__...
# Author: <NAME> # Collaborators: <NAME>, <NAME>, <NAME> # Email : <EMAIL> # Affiliation : Imperial Centre for Inference and Cosmology # Status : Under Development ''' Perform all additional operations such as interpolations ''' import os import logging import numpy as np import scipy.interpolate as itp from typing i...
<reponame>janismac/ksp_rtls_launch_to_rendezvous import sys import subprocess import time import json import krpc import math import scipy.integrate import numpy as np from PrePlanningChecklist import PrePlanningChecklist from PlannerUiPanel import PlannerUiPanel from MainUiPanel import MainUiPanel from ConfigUiPanel i...
<reponame>catubc/MOTION import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import cv2, os, sys, glob import scipy import sklearn import imageio import matplotlib.cm as cm import matplotlib import time from sklearn import decomposition, metrics, manifold, svm from tsne import bh_s...
import numpy as np from sympy import simplify, sqrt, symbols from sympy.stats import Normal, covariance as cov, variance as var def regcoeffs(x, y, z): covxy = cov(x, y) covyz = cov(y, z) varx = var(x) vary = var(y) varz = var(z) # forward f1 = simplify(covxy / varx) f2 = simplify(covy...
"""Defining and analysing axisymmetric optical systems.""" import itertools from functools import singledispatch from dataclasses import dataclass from abc import ABC, abstractmethod from typing import Sequence, Tuple, Mapping import numpy as np import scipy.optimize from . import abcd, paraxial, functions, ri from .fu...
from operator import add, sub import numpy as np from scipy.stats import norm class Elora: def __init__(self, times, labels1, labels2, values, biases=0): """ Elo regressor algorithm for paired comparison time series prediction Author: <NAME> Args: times (array of np....
import numpy as np from scipy.stats import binom from sklearn.ensemble import IsolationForest from sklearn.preprocessing import MinMaxScaler from scipy.special import erf from learnware.algorithm.anomaly_detect.base import BaseAnomalyDetect class iForest(BaseAnomalyDetect): def __init__(self, n_estimators=100, ...
<gh_stars>1-10 import senti_lexis import datetime, string, numpy, spwrap, random time, sys, re from sklearn import svm from sklearn import cross_validation from sklearn.feature_extraction.text import CountVectorizer from sklearn.cross_validation import KFold from scipy.sparse import csr_matrix def main(): for i in...
import os import cv2 from sklearn.cluster import KMeans, DBSCAN, MiniBatchKMeans from scipy import spatial from sklearn.preprocessing import StandardScaler import numpy as np from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Challenge presentation example') parser.add_argument('--data...
import sys from scipy.special import softmax import torch.onnx import onnxruntime as ort import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from pytorch2keras.converter import pytorch_to_keras from models.faceboxes import FaceBoxes input_dim = 1024 num_classes = 2 model_path = "weig...
# -*- coding: utf-8 -*- """ ------ What is this file? ------ This script targets the istanbul_airbnb_raw.csv file. It cleans the .csv file in order to prepare it for further analysis """ #%% --- Import Required Packages --- import os import pathlib from pathlib import Path # To wrap around filepaths impor...
<filename>python/genre_classifier.py import scipy.io.wavfile as wav import numpy as np import os import pickle import random import operator from python_speech_features import mfcc dataset = [] training_set = [] test_set = [] # Get the distance between feature vectors def distance(instance1, instance2, k): mm1 =...
<gh_stars>0 import numpy as np from scipy.constants import mu_0, epsilon_0 import matplotlib.pyplot as plt from PIL import Image import warnings warnings.filterwarnings('ignore') from ipywidgets import interact, interactive, IntSlider, widget, FloatText, FloatSlider, fixed from .Wiggle import wiggle, PrimaryWave, Refl...
from __future__ import print_function import os import sys import serial.tools.list_ports from PyQt4 import QtCore from PyQt4 import QtGui from photogate_ui import Ui_PhotogateMainWindow from photogate_serial import PhotogateDevice from photogate_serial import getListOfPorts import dependency_hack try: import scipy...
# Copyright 2017 Regents of the University of California # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follow...
<filename>test.py import random from random import shuffle import numpy as np import tensorflow as tf from tensorflow.python.tools import freeze_graph import datetime import time import queue import threading import logging from PIL import Image import itertools import yaml import re import os import glob import shutil...
# coding=utf-8 import numpy as np import scipy.interpolate as intpl import scipy.sparse as sprs def to_sparse(D, format="csc"): """ Transform dense matrix to sparse matrix of return_type bsr_matrix(arg1[, shape, dtype, copy, blocksize]) Block Sparse Row matrix coo_matrix(arg1[, shape, dtype, ...
#!/usr/bin/env python # =============================================================================== # Copyright 2015 Geoscience Australia # # 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 ...
<reponame>tasicarl/TransitionListerner_public """ The transitionFinder module is used to calculate finite temperature cosmological phase transitions: it contains functions to find the phase structure as a function of temperature, and functions to find the transition (bubble nucleation) temperature for each phase. In co...
import copy import numpy as np import torch from scipy import optimize import logging def sharpness(model, criterion_fn, A, epsilon=1e-3, p=0, bounds=None): """Computes sharpness metric according to https://arxiv.org/abs/1609.04836. Args: model: Model on which to compute sharpness criterion_...
import numpy as np from sympy import * from math import * from timeit import default_timer as timer start = None end = None def maxXi(Xn,X): n = None d = None for i in range(Xn.shape[0]): if(np.copy(Xn[i,0]) != 0): nk = abs(np.copy(Xn[i,0]) - np.copy(X[i,0]))/abs(np.copy(Xn[i,0])) ...
import argparse from genericpath import exists import os import time import re from tqdm import tqdm import numpy as np from scipy.io import wavfile from wiener_scalart import wienerScalart TIME = time.strftime("%Y-%m-%d_%H:%M:%S", time.localtime()) CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) WORKPLACE_DI...
<filename>islandGen.py #Import libraries import random import os import noise import numpy import math import sys from chunks import Chunks as chk from PIL import Image import subprocess from scipy.misc import toimage import threading random.seed(os.urandom(6)) #Delete old chunks filelist = [ f for f in os.listdir(...
import matplotlib.pyplot as plt import csv import statistics import math plt.title('Population Diversity') plt.ylabel('Diversity Score') plt.xlabel('Iteration Number') random = [] randombars = [] rmin = [] rmax = [] hill = [] hillbars = [] hmin = [] hmax = [] evo = [] emin = [] emax = [] evobars = [] cross = [] cross...