arxiv_id
stringlengths
0
16
text
stringlengths
10
1.65M
''' Run trained PredNet on UCSD sequences to create data for anomaly detection ''' import hickle as hkl import os import shutil import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import pandas as pd # from keras import backend as K from ker...
import numpy as np import itertools class BinaryLinearCode(): def __init__(self, G, H): self.G = G # Generator matrix self.H = H # Parity Check matrix self.k = G.shape[0] self.n = G.shape[1] self.M = 2 ** self.k # Number of possible messages self.codewordsL...
# Author: Laura Kulowski import numpy as np import matplotlib.pyplot as plt import torch def plot_train_test_results(lstm_model, Xtrain, Ytrain, Xtest, Ytest, num_rows = 4): ''' plot examples of the lstm encoder-decoder evaluated on the training/test data : param lstm_model: trained lstm encoder-decoder ...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import io import os import pkgutil import unittest from datetime import timedelta from unittest import TestCase import numpy as np import panda...
""" bin modis data into regular latitude and longitude bins """ import numpy as np def reproj_L1B(raw_data, raw_x, raw_y, xlim, ylim, res): ''' ========================================================================================= Reproject MODIS L1B file to a regular grid ---...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import os import numpy as np import pandas as pd import scanpy.api as sc import sys import wot.io def main(argv): parser = argparse.ArgumentParser(description='Compute neighborhood graph') parser.add_argument('--matrix', help=wot.commands.MATRIX...
# coding: utf-8 import numpy as np from PIL import Image import scipy.io as sio import os import cv2 import time import math import os os.environ['GLOG_minloglevel'] = '2' # Make sure that caffe is on the python path: caffe_root = '../../' import sys sys.path.insert(0, caffe_root + 'python') import caffe from caffe...
from amuse.couple import bridge from amuse.community.bhtree.interface import BHTree from amuse.community.hermite0.interface import Hermite from amuse.community.fi.interface import Fi from amuse.community.octgrav.interface import Octgrav from amuse.community.gadget2.interface import Gadget2 from amuse.community.phiGRAP...
""" Dataset """ import numpy as np from .base import Baseset from .dsindex import DatasetIndex from .pipeline import Pipeline class Dataset(Baseset): """ Dataset Attributes ---------- index indices is_split """ def __init__(self, index, batch_class=None, preloaded=None, *args, **kwar...
import numpy as np import os import tensorflow as tf from tqdm import tqdm import ujson as json from model import Model from util import get_batch_dataset from util import get_dataset from util import get_record_parser # for debug, print numpy array fully. # np.set_printoptions(threshold=np.inf) os.environ["CUDA_V...
import os from copy import deepcopy from typing import List, Union, Dict, Any from sklearn.metrics import accuracy_score, classification_report, confusion_matrix import argparse import logging import sys import json import numpy as np from predictor import Predictor logger = logging.getLogger(__name__) # pylint: ...
# -*- coding: utf-8 -*- """ Created on Sat Jan 5 15:33:27 2019 @author: gptshubham595 """ import cv2 import matplotlib.pyplot as plot import numpy as np import time def main(): imgp1="C:\\opencv learn machin\\misc\\4.2.01.tiff" imgp2="C:\\opencv learn machin\\misc\\4.2.05.tiff" #1-by preserving sa...
import streamlit as st import yfinance as yf from datetime import datetime, timedelta #import pyodbc import pandas as pd import os import altair as alt #import time import sys sys.path.append(os.path.abspath(r"C:\Users\cyril\Documents\Stocks\TA")) from AutoSupportAndResistance import * #import talib from an...
from __future__ import print_function import sys import os import numpy as np import random import pandas as pd from sklearn import preprocessing from sklearn.model_selection import train_test_split from util import * import itertools import math # This file contains code required for any preprocessing of real data, ...
from queue import PriorityQueue import networkx as nx import random import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import math import time class Event(object): def __init__(self,state,time,srcNode,targetNode): self.state = state self.time = time self.srcNode = srcNode ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import gym from gym.spaces.box import Box from gym import spaces import logging import numpy as np import time logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def create_env(env_...
# Copyright 2017 - 2018 Baidu Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
#!/usr/bin/python import numpy as np import healpy as hp import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import sys from detector_cache import detectors import triangulate from ligo.gracedb.rest import GraceDb gdb = GraceDb() graceid = sys.argv[1] prior_name = sys.argv[2] print graceid fitsna...
""" lux_limit.py This example shows how to produce a dark matter limit plot using one of the simple counting experiment limit methods. The data here is meant to approximate the parameters of the LUX 2014-2016 run, which as of 2017 has produced the best WIMP-nucleon spin-independent limit of any direct detection expe...
import numpy as np import time for N in [int(i*1000) for i in range(1,11)]: a = np.linspace(0, 2*np.pi, N) k = 100 start_time = time.time() M = np.exp(1j*k*(np.tile(a,(N,1))**2 + np.tile(a.reshape(N,1),(1,N))**2)) print('N=' + str(N) + ', time in Numpy: ', str(time.time() - start_time) + " seconds...
import random import sys import numpy as np import cv2 import io import socket import struct import time import urllib.request import json NOTIFICATION_SEND_INTERVAL = 5 DATA_SEND_INTERVAL = 30 def server_routine(frame_queue, audio_queue, room_temp, room_humid, baby_temp, ...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import sqlalchemy import datetime as dt from sklearn.linear_model import LogisticRegression from dreamclinic_churn_functions import * import pickle from sklearn.preprocessing import OneHotEncoder from sklearn.ensemble import Ra...
from graphics import * import numpy as np win = GraphWin('Graph', 640, 480) win.setBackground("white") LTMargin = 100 TPMargin = 100 xmax = 640 - LTMargin ymax = 480 - TPMargin def rect(cpu,size): rectangle = Rectangle(Point(LTMargin, 480 - TPMargin - np.int(cpu/10) ),Point((size/50000) + LTMargin, 480 - TPM...
#!/usr/bin/python3 import rospy from sensor_msgs.msg import Image, CompressedImage import picamera import signal import numpy as np stop_process = False def signal_handler(signal, frame): global stop_process stop_process = True signal.signal(signal.SIGINT, signal_handler) RES = (640, 480) # Class ...
""" visualize results for test image """ from numpy import asarray import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from PIL import Image import torch import torch.nn as nn import torch.nn.functional as F import os from torch.autograd import Variable import transforms as trans...
#!/usr/bin/env python # coding: utf-8 # # Some example HMMs # # In[1]: { "tags": [ "hide-input", ] } # Install necessary libraries try: import jax except: # For cuda version, see https://github.com/google/jax#installation get_ipython().run_line_magic('pip', 'install --upgrade "jax[cpu...
# -*- coding: utf-8 -*- """ Name: htsPlot.py Author: Collin Rooney Last Updated: 7/17/2017 This script will contain functions for plotting the output of the hts.py file These plots will be made to look like the plots Prophet creates Credit to Rob J. Hyndman and research partners as much of the code was devel...
# # Author: Piyush Agram # Copyright 2016 # import logging import isceobj import mroipac import os logger = logging.getLogger('isce.topsinsar.runPreprocessor') def runComputeBaseline(self): from isceobj.Planet.Planet import Planet import numpy as np swathList = self._insar.getInputSwathList(self.s...
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['ImStack'] # Cell import torch import torch.nn as nn from PIL import Image import numpy as np from matplotlib import pyplot as plt class ImStack(nn.Module): """ This class represents an image as a series of stacked ...
#!/usr/bin/env python3 from distutils.spawn import find_executable import matplotlib.pyplot as plt # import plotly.express as px import seaborn as sns import pandas as pd import numpy as np import subprocess import statistics import random import math import gzip import uuid import sys import re import os """ ~~~~~...
from face_alignment.detection.models import FAN, ResNetDepth from .utils import crop, get_preds_fromhm, draw_gaussian import torch import numpy as np import cv2 class FANLandmarks: def __init__(self, device, model_path, detect_type): # Initialise the face detector model_weights = torch.load(model_...
""" Sam Bluestone Test 2 Exploratory data analysis for the admissions dataset """ import pandas as pd import matplotlib.pyplot as plt from mlxtend.plotting import scatterplotmatrix import numpy as np from mlxtend.plotting import heatmap from sklearn.preprocessing import OneHotEncoder import sys #read the data into a ...
from typing import Sequence import oneflow.experimental as flow import argparse import numpy as np import os import time import sys import oneflow.experimental.nn as nn import json from tqdm import tqdm sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "model_compress/distil_new_api/src"))) curPath = os.path.ab...
# ------------------------------------------------------------------------------ # Modified from HRNet-Human-Pose-Estimation # (https://github.com/HRNet/HRNet-Human-Pose-Estimation) # Copyright (c) Microsoft # ------------------------------------------------------------------------------ from __future__ import absolu...
import os import sys import copy sys.path.append('./player_model/') sys.path.append('./utils') import config import exp_config import pandas as pd import numpy as np from multiprocessing import Pool from bots import BasicBot from rectangular_world import RectangularWorld from environment import * reps = exp_config...
import torch.nn as nn import torch import numpy as np class Combinator(nn.Module): """ The vanilla combinator function g() that combines vertical and lateral connections as explained in Pezeshki et al. (2016). The weights are initialized as described in Eq. 17 and the g() is defined in Eq. 16. ...
import cnn_rnn import lasagne import sample import numpy as np import argparse parser = argparse.ArgumentParser() parser.add_argument('--tasks', nargs='+') parser.add_argument('--labeling_rates', nargs='+', type=float) parser.add_argument('--very_top_joint', dest='very_top_joint', action='store_true') args = parser.p...
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Donny You(youansheng@gmail.com) import math import numpy as np import torch from utils.helpers.det_helper import DetHelper class YOLOTargetGenerator(object): """Compute prior boxes coordinates in center-offset form for each source feature map.""" def ...
"""Applies trained neural net in inference mode.""" import copy import argparse import numpy from gewittergefahr.gg_utils import file_system_utils from ml4tc.io import example_io from ml4tc.io import prediction_io from ml4tc.utils import satellite_utils from ml4tc.machine_learning import neural_net SEPARATOR_STRING =...
# encoding: utf-8 import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from xmuda.models.LMSCNet import SegmentationHead from xmuda.models.context_prior import ContextPrior3D from xmuda.models.context_prior_v2 import ContextPrior3Dv2 from xmuda.models.CP_baseline import CPBaseline from...
import comet_ml import tensorflow as tf print(f'Using tensorflow version: {tf.version.VERSION}') import keras import keras.backend as K from keras.layers import Dense, Dropout from keras.metrics import TrueNegatives, TruePositives, FalseNegatives, FalsePositives import pandas as pd import numpy as np from typing i...
"""Window pairs of sequences""" __author__ = 'thor' from numpy import * import numpy as np from itertools import product from collections import defaultdict, Counter DEBUG_LEVEL = 0 def wp_iter_with_sliding_discrete_step(data_range, # length of the interval we'll retrieve the windows from ...
# -*- coding: utf-8 -*- """Untitled54.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1PX3b2zRt-Q3D2ia5NghD8bvSMqKZRTWf """ import numpy as np import matplotlib.pyplot as plt import pandas as pd import math df=pd.read_csv("creditcard.csv") d...
from pathlib import Path import matplotlib.pyplot as plt import numpy as np from src.swhe import SWHE def plot(): data = { "pipe": { "outer-dia": 0.02667, "inner-dia": 0.0215392, "length": 100, "density": 950, "conductivity": 0.4 }, ...
from dsbox.template.template import DSBoxTemplate from d3m.metadata.problem import TaskKeyword from dsbox.template.template_steps import TemplateSteps from dsbox.schema import SpecializedProblem import typing import numpy as np # type: ignore class DefaultVideoClassificationTemplate(DSBoxTemplate): def __ini...
import os import numpy as np from sympy.abc import x as symbolic_x from sympy.abc import y as symbolic_y from .linearfilter import SpatioTemporalFilter from .spatialfilter import GaussianSpatialFilter from .temporalfilter import TemporalFilterCosineBump from .movie import Movie from .lgnmodel1 import LGNModel, heat_pl...
import numpy as np import librosa import math import sys print("Loading file") audio, sample_rate = librosa.load(sys.argv[1], duration=60, offset=0, sr=15360) print("Getting spectrum") spectrum = librosa.stft(audio) S = np.abs(spectrum) fout = open("spectrum.h", "w") print("Writing file") fn = 36 fs = int(len(S) / ...
# -*- coding: utf-8 -*- from data.reader import wiki_from_pickles from data.corpus import Words, Articles, Sentences from stats.stat_functions import compute_vocab_size from stats.mle import Heap from jackknife.plotting import hexbin_plot import numpy as np import numpy.random as rand import matplotlib.pyplot as ...
import tensorflow as tf import numpy as np import os import sys from MyPreprocessingWrapper import MyPreprocessingWrapper from MyImageProcessor import MyImageProcessor from MyUtils import MyUtils from Visualization import Visualization class MyTrainingModelWrapper(object): save_my_model_tf_session = None d...
import os import numpy as np import matplotlib.pyplot as plt path = os.getcwd() + "/data/ex1data2.txt" data = np.loadtxt(path, delimiter=",") temp = np.ones(((data.shape)[0],1), dtype=np.float64) data = np.append(temp, data, axis=1) def featureScaling(data): mean = np.zeros((1, data.shape[1] - 1))[0] min_ = data[0]...
#!/usr/bin/python """ Classes and functions for fitting tensors """ # 5/17/2010 import numpy as np from dipy.reconst.maskedview import MaskedView, _makearray, _filled from dipy.reconst.modelarray import ModelArray from dipy.data import get_sphere class Tensor(ModelArray): """ Fits a diffusion tensor given diffus...
import numpy as np import torch from torch.utils.data import DataLoader,TensorDataset def mIoU_of_class(prediction, predict_label, target, target_label): target_args = torch.where(target == target_label) target_size = target_args[0].shape[0] if target_size == 0: return None else: intersection = predict...
# Released under The MIT License (MIT) # http://opensource.org/licenses/MIT # Copyright (c) 2013-2016 SCoT Development Team """Use internally implemented functions as backend.""" from __future__ import absolute_import import scipy as sp from . import backend from . import datatools, pca, csp from .var import VAR fro...
""" tools to manipulte data files includes bin, trim, stitch, etc also include interpolation stuff """ import numpy as np from scipy import stats from scipy import interpolate def trim_data(xlist,ylist,up,down): for i,info in enumerate(xlist): if info > up: start = i ...
# -*- coding: utf-8 -*- ''' Script that generates and analyzes a synthetic set of PMS data. These data differ from the data used in the paper but capture important elements of what is presented in the paper. Inference generation requires use of the logistigate package, available at https://logistigate.readthedocs.io/en...
from math import ceil import networkx as nx class Element(): def __init__(self, name, amount): self.name = name self.amount = amount def __str__(self): return str(self.amount)+" "+self.name def __repr__(self): return self.__str__() def __hash__(self): ...
import numpy as np import sklearn.neighbors import sklearn.pipeline import sklearn.svm import sklearn.decomposition import sklearn.gaussian_process import logging import pickle import joblib import time import heapq import inspect from . import loggin from . import TLS_models import functools import collections import ...
# TODO from cmstk.filetypes import TextFile from cmstk.structure.simulation import SimulationCell import numpy as np class DataFile(TextFile): def __init__(self, filepath, comment, simulation_cell): if filepath is None: filepath = "lammps.data" if comment is None: comment =...
import os import pickle import re import warnings import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.platform import gfile from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.model_selection import train_test_split from sklearn.svm import LinearSVC...
import numpy as np import os mazeX = 6 mazeY = 5 mazeBx = 4 mazeBy = 4 maxState = mazeX*mazeY*mazeX*mazeY+2 numA = 5 verbose = False import argparse parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "--T", type=int, default=15, help="Time-ho...
def mangoPlot(mango_filenames): # Copyright 2019, University of Maryland and the MANGO development team. # # This file is part of MANGO. # # MANGO is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either ...
import cv2 import numpy as np import os from cvpackage import resize, to_gray, contrast_tune, gaussian_blur, canny_capture from lineIterator import get_pixels, curve_plot, curve_fitting, curve_smooth, count_peaks # FILE PATH HERE # testPic = 'testsample.JPG' picPath = 'image' # FILE PATH HERE # # PUBLIC PARAMETERS HE...
import os import pickle import numpy as np import scipy.stats class Results(object): mpr_column = "test-all-baskets.MPR" prec_ten_column = "test-all-baskets.Prec@10" prec_five_column = "test-all-baskets.Prec@5" all_baskets_AUC = "test-all-baskets.AUC" processed_columns = {"mpr": mpr_column, ...
# -*- coding: utf-8 -*- # @Author: xuenan xu # @Date: 2021-06-14 # @Last Modified by: xuenan xu # @Last Modified time: 2021-07-02 import sys import kaldiio import librosa import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import argparse from pathlib import Pat...
# Copyright (c) 2017-present, Facebook, Inc. # # 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...
import torch from torch.utils.data import Dataset, DataLoader from torch.distributions.multivariate_normal import MultivariateNormal import numpy as np from tqdm import tqdm class UniformSampler: """ UniformSampler allows to sample batches in random manner without splitting the original data. """ def ...
""" Code by Nicola De Cao was forked from https://github.com/nicola-decao/BNAF MIT License Copyright (c) 2019 Nicola De Cao, 2019 Peter Zagubisalo 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...
#!/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 from sqlite3 import connect from matplotlib import pyplot as plt from matplotlib import rcParams from numpy import array, count_nonzero, logical_and rcParams['font.size'] = 8 def neutral_mass(mz, adduct): adduct_to_mass = {'[M+H]+': 1.0078, '[M+K]+...
#!/usr/bin/python3 from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import numpy as np from matplotlib import style style.use( "fast" ) fig = plt.figure() ax = fig.add_subplot( 111, projection='3d' ) X, Y, Z = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 5, 6, 2, 3, 13, 4, 1, 2, 4, 8 ], [ 2, 3, 3, 3,...
import argparse import numpy as np from dataset import Dataset, collate_fn import torch import torch.nn.functional as F import pickle import os import torch.nn as nn from torch.utils.data import DataLoader from sklearn.linear_model import LinearRegression parser = argparse.ArgumentParser() parser.add_argument('--no-c...
import matplotlib.pyplot as plt import numpy as np from ssm.star_cat.hipparcos import load_hipparcos_cat from astropy.coordinates import SkyCoord import astropy.units as u from astropy.time import Time from astropy.coordinates import SkyCoord, AltAz, EarthLocation from ssm.core import pchain from ssm.pmodules import * ...
# -*- coding: utf-8 -*- """ ======================================= Generate more advanced auditory stimuli ======================================= This shows the methods that we provide that facilitate generation of more advanced stimuli. """ import numpy as np import matplotlib.pyplot as plt from expyfun import bu...
""" Copyright (c) 2020-present NAVER Corp. 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, distri...
# coding: utf-8 import warnings try: import talib as ta except ImportError: from czsc import ta ta_lib_hint = "没有安装 ta-lib !!! 请到 https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib " \ "下载对应版本安装,预计分析速度提升2倍" warnings.warn(ta_lib_hint) import pandas as pd import numpy as np from datet...
from numpy import ones from vistas.core.graphics.geometry import Geometry class FeatureGeometry(Geometry): def __init__(self, num_indices, num_vertices, indices=None, vertices=None): super().__init__( num_indices, num_vertices, has_normal_array=True, has_color_array=True, mode=Geometry.TRIA...
import networkx as nx import numpy as np import torch from torch.utils.data import Dataset from dsloader.util import kron_graph, random_binary, make_fractional class KroneckerDataset (Dataset): def __init__(self, kron_iter=4, seed_size=4, fixed_seed=None, num_graphs=1, perms_per_graph=256, progress_bar=False): ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt from bs4 import BeautifulSoup import urllib.request import requests import re import csv import html
from __future__ import division import cv2 import numpy as np from math import * #-------------------------------------------- # AUXILIARY BLOCK FUNCTIONS #-------------------------------------------- # return closed image def closing(bny, dim): return erosion(dilation(bny, dim), dim); # return dila...
import os import json import random import numpy as np import tensorflow as tf import torchvision.transforms as transforms from .utils import load_and_preprocess_image from PIL import Image root = '/data/cvfs/ah2029/datasets/bdd100k/' def load_day_and_night(split='train', subset=1.0): """ Load image filenames ...
# Using Android IP Webcam video .jpg stream (tested) in Python2 OpenCV3 from collections import deque from cspaceSliders import FilterWindow from selenium import webdriver import argparse import urllib.request import cv2 import numpy as np import time import math def move(ptX, ptY): ptX = ptX * ((((1366/864))/136...
import math import numpy as np CPUCT = 1.0 class NodeInfo: def __init__(self, state, action, raw_policy, value): self.state = state self.action = action self.policy = [raw_policy[k] for a, k in action] self.value = value self.children_state = [None for i in range(len(action...
from ..proto import * from ..graph_io import * import copy import paddle.fluid as fluid import numpy as np from paddle.fluid.core import VarDesc, AttrType class Fluid_debugger: def var_names_of_fetch(self, fetch_targets): var_names_list = [] for var in fetch_targets: var_names_list.append(var.name) return ...
# -*- coding: utf-8 -*- from datetime import datetime, timedelta import numpy as np import pytest from ...metricgenerator.manager import SimpleManager from ...types.association import TimeRangeAssociation, AssociationSet from ...types.detection import Detection from ...types.groundtruth import GroundTruthPath, Ground...
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ # ------------------------------------------------...
#!/usr/bin/env python # -*- coding: utf-8 -*- #特征提取 from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer #新闻文本数据 from sklearn.datasets import fetch_20newsgroups # 数据分割 from sklearn.model_selection im...
import numpy as np def rle_to_mask(lre, shape=(1600, 256)): ''' params: rle - run-length encoding string (pairs of start & length of encoding) shape - (width,height) of numpy array to return returns: numpy array with dimensions of shape parameter ''' # the incoming string is ...
""" Some random functions for hyperparameter optimization Alisa Alenicheva, Jetbrains research, Februari 2022 """ import os import torch from hyperopt import hp import errno from MoleculeACE.benchmark.utils import get_config from MoleculeACE.benchmark.utils.const import Algorithms, RANDOM_SEED, CONFIG_PATH, CONFIG_PA...
import numpy as np import pandas import analysis as lan from collections import namedtuple PathwayConfig = namedtuple("PathwayConfig", ["measure", "hierarchy"]) def retrieve_mutations(pid, seq_data): patient_data = seq_data[ (seq_data["PatientFirstName"] == pid) & (seq_data["Technology"] == "NGS ...
# Copyright (c) 2021 PaddlePaddle Authors. 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 may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
import argparse import logging import os import pickle import sys import time import numpy as np import tensorflow as tf from sklearn.svm import SVC from tensorflow.python.platform import gfile from input_loader import (filter_dataset, split_dataset, get_dataset, get_image_paths_and_labels) ...
# -*- coding: utf-8 -*- """ Created on Fri Nov 11 13:08:41 2016 @author: m.reuss """ import numpy as np import CoolProp.CoolProp as CP import pandas as pd CP.set_config_string( CP.ALTERNATIVE_REFPROP_PATH, 'C:\\Program Files (x86)\\REFPROP\\') np.seterr(divide='ignore', invalid='ignore') #%%H2 Constant Valu...
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np import lib.maths_util as mathlib from lib.colors import ColorsBook as color import time class NeuralNetwork(): def __init__(self, layers, batch_size, epochs, learning_rate): self.layers = layers self.batch_size = batch_size self...
import h5py import numpy as np import sys infname = sys.argv[1] key = sys.argv[2] if sys.argv[2:] else "matrix" prefix = "data" if not sys.argv[3:] else sys.argv[3] f = h5py.File(infname, "r") print(f.keys()) group = f[key] for comp in ["shape", "indices", "indptr", "data"]: with open(prefix + '.' + comp, "w") as...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import numpy as np import matplotlib.pyplot as plt def build_curve_points(descriptors): ''' Draw the points given by the descriptors array in the cartesian plane. ''' N=len(descriptors) # size of the descriptors vector for x in range(N):...
from math import pi from numpy import sin,cos from openmdao.main.api import Component from openmdao.main.datatypes.api import Float class SpiralComponent(Component): x = Float(iotype="in", low=0.75, high=5.*pi) y = Float(iotype="in", low=0.75, high=5.*pi) f1_xy = Float(0.,iotype="out") f2_xy = Float...
#!/usr/bin/env python from copy import copy import matplotlib import netCDF4 import numpy matplotlib.use("Agg") import matplotlib.animation as animation import matplotlib.colors as colors import matplotlib.pyplot as plt FFMpegWriter = animation.writers['ffmpeg'] metadata = dict(title='Secondary Mean Age', artist='LU...
#!/usr/bin/python3 '''Copyright (c) 2018 Mozilla Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the follow...
import os import glob import progressbar import numpy as np from numpy import genfromtxt from sklearn.manifold import TSNE import matplotlib.pyplot as plt kLatentValuesPath = './training_results/0000-00-00_00-00-00/latents' if "__main__" == __name__: file_path_list = glob.glob(os.path.join(kLatentValuesPath, '*...
import numpy as np import matplotlib.pyplot as plt #%% cases_data = np.genfromtxt("sources/cases_comparation.csv", delimiter = ',', skip_header = 1)[:, 1:] / 1000000 cases = ['GEMASOLAR', 'Base Case', 'Evaporative Cooling', 'Dry Cooling', 'Once Through Cooling', 'MED Cooling'] months = ['Jan', 'Feb',...
import matplotlib.pyplot as plt import matplotlib.transforms as mtransforms import numpy as np import pandas as pd import seaborn as sns from matplotlib import lines from matplotlib.font_manager import FontProperties from statannotations.format_annotations import pval_annotation_text, simple_text from statannotations...