text
stringlengths
3.07k
12.6k
# -*- coding: UTF-8 -*- """ .. --------------------------------------------------------------------- ___ __ __ __ ___ / | \ | \ | \ / the automatic \__ |__/ |__/ |___| \__ annotation and \ | | | | \ ...
'''User views.''' from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.shortcuts import get_object_or_404, redirect, render from django.core.urlresolvers import reverse from . import ...
""" Accession2Taxid After alignment, IDseq uses the NCBI accession2taxid database to map accessions to taxonomic IDs. The full database contains billions of entries, but only ~15% of those are found in either NR or NT databases. Therefore, the full NCBI accession2taxid database is subsetted to include only the relevant...
""" @author : <NAME> @date : 1/9/2021 Contains PCA and tSNE, two amazing dimensionality reduction algorithms. PCA can deal with around 1000 - 10000 data points (obviously depending on the number of dimensions.) tSNE is better for visualizations but struggles past five hundred points, so PCA is usually better for big d...
import os import io import argparse import configparser import ipaddress import subprocess import sys def first_available_ip_from_subnet(args: object): result = [] host_list = {} taken_host_list = {} subnets = list(map(lambda x: x.strip(), args.subnet.split(','))) for subnet in subnets: n...
# Copyright (c) <NAME>. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory. # parallel optimization retry of a list of problems. import numpy as np import _pickle as cPickle import bz2 import multiprocessing as mp from scipy.optimize import OptimizeResult from fc...
import os import shutil import tempfile from datetime import datetime import shapely from django.db import connection from django.db.models import Q from django.http import FileResponse from jobs.utils import enqueue_job from paramiko.ssh_exception import AuthenticationException from rest_framework import permissions,...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import shutil import unittest from unittest import mock from azure_monitor.storage import ( LocalFileBlob, LocalFileStorage, _now, _seconds, ) TEST_FOLDER = os.path.abspath(".test") # pylint: dis...
# -*- coding: utf-8 -*- import multiprocessing from queue import Empty from collections import deque from collections.abc import Sequence, Mapping import time def stage(loop_func, queue_size=10, **kwargs): """ Decorator que transforma a função em um objeto da classe Stage. """ return Stage(loop_func=loop_func...
""" 飞机的基类 我方的飞机 敌方的小型飞机 敌方的中型飞机 敌方的大型飞机 """ import random import pygame import constants from game.bullet import Bullet class Plane(pygame.sprite.Sprite): """" 飞机的基础类 """ # 飞机的图片 plane_images = [] # 飞机爆炸的图片 destroy_images = [] # 坠毁的音乐地址 down...
# Competitive CoEA search of the one max / MaxMinHill optimization problem from mimetypes import init from operator import ge from numpy.random import randint from numpy.random import rand from numpy.random import randn from numpy.random import seed import random import time import copy import pandas as pd import numpy...
# Copyright 2021 MosaicML. All Rights Reserved. from __future__ import annotations import logging from dataclasses import asdict, dataclass from typing import Optional import torch import yahp as hp from composer.algorithms.algorithm_hparams import AlgorithmHparams from composer.core import Algorithm, Event, Logger...
import os import subprocess from textwrap import dedent from textwrap import indent from textwrap import wrap from docutils import nodes from docutils.parsers.rst import directives from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import MysCommandLexer from pygments.lex...
from __future__ import print_function from traceback import print_exc from pprint import pprint from yael_util import * from module_constants import * from ID_factions import * from header_items import * from header_operations import * from header_triggers import * # Some constants for ease of use. imodbits_none = ...
#!/usr/bin/env python3 import argparse import botocore import random import string module_info = { 'name': 'iam__enum_roles', 'author': '<NAME> of Rhino Security Labs', 'category': 'RECON_UNAUTH', 'one_liner': 'Enumerates IAM roles in a separate AWS account, given the account ID.', 'descriptio...
"""Initialize the distributed services""" import multiprocessing as mp import traceback import atexit import time import os import sys from . import rpc from .constants import MAX_QUEUE_SIZE from .kvstore import init_kvstore, close_kvstore from .rpc_client import connect_to_server, shutdown_servers from .role import ...
# -*- coding: utf-8 -*- """ SCP Module ========== .. versionadded:: 2019.2.0 Module to copy files via `SCP <https://man.openbsd.org/scp>`_ """ from __future__ import absolute_import, print_function, unicode_literals import inspect # Import python libs import logging # Import salt modules from salt.ext import six ...
# Copyright 2017, <NAME>. 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 applicable law or agre...
from tensorflow import keras from tensorflow.python.keras import activations import numpy as np import tensorflow as tf __all__ = ['Bihomogeneous','Bihomogeneous_k2','Bihomogeneous_k3', 'Bihomogeneous_k4','Dense','WidthOneDense'] print("Hello from BihomoNN! Arbitrary dimension!") class Bihomogeneous(keras...
import torch import numpy as np from alchemy.brain import Brain from utils.memory import Memory from utils.rl_algos import BrainOptimizer import time, random from timebudget import timebudget class BrainDescription: def __init__(self, memory_size, batch_size, optim_pool_size, optim_epoch...
#!/bin/python from __future__ import division from __future__ import print_function from __future__ import absolute_import import numpy as np import sys # Python 3 backwards compatibility tricks if sys.version_info.major > 2: def xrange(*args, **kwargs): return iter(range(*args, **kwargs)...
import logging import os import time import torch import torch.nn as nn from utils.meter import AverageMeter from utils.metrics import R1_mAP_eval from torch.cuda import amp import torch.distributed as dist def do_train(cfg, model, center_criterion, train_loader, val...
# Copyright (c) 2015 Mirantis, 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 writin...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2004-2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
import os import logging import argparse import tensorflow as tf import numpy as np import sequence_modeling import gensim from data.util import data_set def train(epoch, model, feeder, input_format, save_path="./", lr_decay=1.0, test=False): """ Train model based on mini-batch of input data. :param model: m...
import os import os.path import ntpath from typing import ItemsView import logging class StringRead: DEFAULT_ZOOM_LEVEL = 0 DEFAULT_COLOR = "white" def __init__(self, _stringToSplit: str, _file): self.m_stringToSplit = _stringToSplit self.m_pathfile = _file self.m_stringToSave = ...
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch, pdb import torch.nn as nn import torch.autograd from torch.autograd import Variable import torch.utils.data from sklearn.preprocessing import QuantileTransformer feat_length = 168 input_size =...
""" Survival regression with Cox's proportional hazard model. """ import argparse import logging import numpy as np import matplotlib.pyplot as plt import pandas as pd from lifelines import CoxPHFitter MAX_DUR = 180 def get_pmf_from_survival(survival_f): pmf = survival_f.copy() for i in range(survival_f.sh...
from collections import defaultdict import json import numpy as np import os import PIL.Image import PIL.ImageDraw from ..meta.getter_dataset import GetterDataset import cv2 try: from pycocotools import mask as coco_mask except ImportError: pass class COCOInstancesBaseDataset(GetterDataset): def __init...
import pytest import numpy as np import pandas as pd from pandas.testing import assert_frame_equal import altair_transform from altair_transform.transform.aggregate import AGG_REPLACEMENTS AGGREGATES = [ "argmax", "argmin", "average", "count", "distinct", "max", "mean", "median", ...
from dataloaders.datasets.pascal import VOCSegmentation from modeling.deeplab import DeepLabX from mypath import Path import dataloaders.custom_transforms as tr import torch import numpy as np import json import os from torchvision import transforms from PIL import Image, ImageFilter from scipy import ndimage from data...
import os import sys from typing import * import numpy as np sys.path.append('/home/pliang/multibench/MultiBench/datasets/imdb') from robustness.visual_robust import visual_robustness from robustness.text_robust import text_robustness from vgg import VGGClassifier from gensim.models import KeyedVectors import h5py f...
import os from distutils.dir_util import copy_tree import warnings import IPython import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy as sp import torch from context import utils import utils.filesystem as fs import utils.plotting as plot from utils.data_analysis impo...
#! /usr/bin/python3 # # Copyright (c) 2017 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 # import contextlib import os from . import cm_logger import ttbl # FIXME: move to console/serial or something more consistent class cm_serial(ttbl.test_target_console_mixin): """Implement console/s over serial p...
from IMLearn.learners.regressors import LinearRegression from typing import NoReturn from IMLearn.utils import split_train_test import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.express as px import plotly.io as pio pio.templates.default = "simple_white" def load_data(filename: s...
from rdflib.graph import ConjunctiveGraph from StringIO import StringIO import unittest import rdflib # json is only available as of python2.6, but simplejson is available # via PyPI for older pythons try: import json except ImportError: try: import simplejson as json except ImportError: ...
# -*- coding: utf-8 -*- """ This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the [options.entry_points] section in setup.cfg: console_scripts = fibonacci = bytespread.skeleton:run Then run `python setup.py install`...
#!/usr/bin/env python3 import sys,os,json,random,re assert sys.version_info >= (3,8), "This script requires at least Python 3.8" set_variables = {} def load(l): f = open(os.path.join(sys.path[0], l)) data = f.read() j = json.loads(data) return j def find_passage_pid(game_desc, pid): for p in gam...
""" Manage the diffuse sources $Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/uw/like2/Attic/diffusedict.py,v 1.4 2013/10/14 15:11:42 burnett Exp $ author: <NAME> """ import os, types, json, collections #import pickle, glob, copy, zipfile #import numpy as np #import pandas as pd #from .pub import...
#!/usr/bin/python3 # # Copyright (c) 2019 Foundries.io # SPDX-License-Identifier: Apache-2.0 # import argparse import logging import json import os import subprocess import urllib.request from copy import deepcopy from tag_manager import TagMgr logging.basicConfig(level='INFO') fh = logging.FileHandler('/archive/cust...
#Pytorch version of the adaptive black-box attack import torch import AttackWrappersWhiteBoxP import DataManagerPytorch as DMP from DataLoaderGiant import DataLoaderGiant from datetime import date import os global queryCounter #keep track of the numbers of queries used in the adaptive black-box attack, just f...
# adapter.py # # Part of Flake518 # # Copyright (c) 2021 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software") # to deal in the Software without restriction, including without limitation # the rights to use, copy, m...
"""A bunch of garbage stuff that I'm not going to comment because it's so bad""" from collections import defaultdict import discord from discord.ext import menus class LeaderboardSource(menus.ListPageSource): async def format_page(self, menu, page): embed = discord.Embed(title="Scoresaber Top 50", color=...
import logging from banal import ensure_list from followthemoney import model from followthemoney.types import registry from aleph.core import settings from aleph.index.util import index_settings, configure_index log = logging.getLogger(__name__) DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd||yyyy-MM||yyyy" PART...
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright (c) 2018--, Qurro development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------...
#!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
# -*- coding: utf-8 -*- ''' Custom YAML loading in Salt ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import re import warnings import yaml # pylint: disable=blacklisted-import from yaml.nodes import MappingNode, SequenceNode from yaml.constructor import Constructo...
# coding=utf-8 import time, json, io, datetime, argparse item_type = ('EVENT', 'INFO', 'AD') categories = ('pregon', 'music', 'food', 'sport', 'art', 'fire', 'band') places = { 'Alameda':(41.903501, -8.866704), 'Auditorio de San Bieito':(41.899915, -8.873203), 'A Cruzada':(41.897817, -8.874520), 'As...
import argparse import csv import os import pickle import sys from pathlib import Path from typing import List, Optional, Tuple, Union import rdkit from rdkit import Chem from rdkit.Chem import rdChemReactions from tqdm import tqdm def canonicalize_products(rxn_smi: str) -> str: ''' Adapted from RetroXpert's ...
# Copyright 2019 The Forte 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 applicable ...
# -*- coding: utf-8 -*- u""" Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U. This file is part of Toolium. 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/lic...
from dataclasses import dataclass import glob import json import os import random from collections import defaultdict from statistics import mean from typing import Dict, List, Union import numpy as np import pandas as pd import seaborn as sns import matplotlib from node_utils import node_divergence DOMAIN_ROOT = os....
# Created By: <NAME> # Created On: 2010-11-14 # Copyright 2013 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "BSD" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_...
""" Input/output routines. TODO: Logging """ import sys import warnings import os import numpy as np import torch import pyevtk.hl as vtk __all__ = [ "write_image", "write_vtk", "VTKReporter", "ObservableReporter", "ErrorReporter" ] def write_image(filename, array2d): from matplotlib import pyplot as plt ...
from rich.color import ( blend_rgb, parse_rgb_hex, Color, ColorParseError, ColorSystem, ColorType, ColorTriplet, ) from rich import terminal_theme import pytest def test_str() -> None: assert str(Color.parse("red")) == "\x1b[31m⬤ \x1b[0m<color 'red' (standard)>" def test_repr() ->...
import pandas as pd import time from os import listdir from os.path import isfile, join import numpy as np import sys '''Main function running all data integration''' def dataset_integration(iPath_samples,ifile_mirConfidence, i_confidence, ifile_metadata, ls_conditions, ofile_RC_dataset, ofile_RP...
# -*- coding: utf-8 -*- """Main module.""" """ 1. Plug four of your male to female jumper wires into the pins on the HC-SR04 as follows: Red; Vcc, Blue; GPIO_TRIGGER, Yellow; GPIO_ECHO and Black; GND. 2. Plug Vcc into the positive rail of your breadboard, and plug GND into your negative rail. 3. Plug GPIO 5V [Pin...
from enum import IntEnum from .. import WoWVersionManager, WoWVersions __reload_order_index__ = -1 class ADTChunkFlags(IntEnum): HAS_MCSH = 0b1 << 0 IMPASS = 0b1 << 1 LQ_RIVER = 0b1 << 2 LQ_OCEAN = 0b1 << 3 LQ_MAGMA = 0b1 << 4 LQ_SLIME = 0b1 << 5 HAS_MCCV = 0b1 << 6 UNKNOWN = 0b1 <<...
# Module of class Module (Quantum Gates) import numpy as np import copy class Module(object): def __init__(self, name, n, ind_modules=[]): # initialize self.name = name self.n = n self.sub_modules = [] self.reg_indices = [] self.typical = False self.matrix_o...
from keras.callbacks import EarlyStopping, ModelCheckpoint, TensorBoard, LearningRateScheduler from keras.layers import Reshape, Dense, Convolution1D, Dropout, Input, Activation, Flatten,MaxPool1D,add, AveragePooling1D, Bidirectional,GRU,LSTM,Multiply, MaxPooling1D,TimeDistributed,AvgPool1D from keras.layers.merge impo...
import tensorflow as tf from bvlc_alexnet_fc7 import AlexNet import utility_function as uf import fine_tune_nt import numpy as np import os import time import cv2 import image_io import sys # the dimension of the final layer = feature dim NN_DIM = 100 LABEL_DIM = 4 TEST_TXT = 'file_list_fine_tune_test.txt' # TEST_TXT...
from pkgcore.ebuild import eclass from snakeoil.osutils import pjoin from snakeoil.test import TestCase from snakeoil.test.mixins import TempDirMixin class FakeEclass: def __init__(self, path, contents): self.path = path with open(path, 'w') as f: f.write(contents) class FakeEclassCa...
#!/usr/bin/env python # encoding: utf-8 # andersg at 0x63.nu 2007 # <NAME> 2016 (ita) """ Support for Perl extensions. A C/C++ compiler is required:: def options(opt): opt.load('compiler_c perl') def configure(conf): conf.load('compiler_c perl') conf.check_perl_version((5,6,0)) conf.check_perl_ext_devel() ...
import re import numpy as np import numpy.linalg as la import codecs from MdlUtilities import Field, FieldList import MdlUtilities as mdl import dbUtils def get_lengthUnits(): query = 'select u.representation from units u, quantities q where u.quantityID=q.quantityID and q.quantityName="length"' items ...
import warnings from operator import itemgetter from collections import defaultdict from mhfp.encoder import MHFPEncoder # Adapted from: # https://github.com/ekzhu/datasketch/blob/master/datasketch/lshforest.py class LSHForestHelper(): """A class simplyfing the use of the LSH Forest implementation. Adding paramte...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import json import os # THIRD PARTY import pytest # LOCAL import astropy.units as u from astropy.cosmology import units as cu from astropy.cosmology.connect import readwrite_registry from astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmol...
#!/usr/bin/env python3 ## Author: <NAME> ## Version: 0.0.1 ## Date: 19 July 2018 ## Title: Mail to MISP ## Description: monitors a give email address for forwarded messages, scrapes IOCs from them and creates an event in MISP with those IOC. ## don't forget to set-up config.py with your email and MISP details...
from weakref import WeakValueDictionary from param.parameterized import add_metaclass from ...streams import ( Stream, Selection1D, RangeXY, RangeX, RangeY, BoundsXY, BoundsX, BoundsY, SelectionXY ) from .util import _trace_to_subplot class PlotlyCallbackMetaClass(type): """ Metaclass for PlotlyCal...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import numpy as np import pytest from . import database from . import evaluator from . import algorithm from . import run from . import preprocessor import logging model = None train_data, train_labels, test_data, test_labels = None, None, None, None...
from PyQt5 import QtWidgets, QtGui, QtCore, Qt from PyQt5.QtCore import pyqtSignal from copper import hou from copper.core.engine import signals as engine_signals from copper.core.op.op_node import OP_Node from copper.ui.signals import signals from copper.ui.widgets import PathBarWidget from .base_panel import PathBa...
from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = '<NAME> & <NAME>' doc = """ Hace falta generar la documentacion de la rubrica """ class Constants(BaseConstants): name_in_url = 'debatespb' players_...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Visitor to replace the invocations to functions that have been removed with the controlled function generation functionality (i.e., ``-f`` or ``--functions`` options).""" from functools import singledispatch from core import ast, generators, probs from params.parameter...
import torch import torch.nn as nn from nn_ood.data.simple_reg import Cubic from nn_ood.posteriors import LocalEnsemble, SCOD, Ensemble, Naive, KFAC from scod.distributions import Normal import numpy as np import matplotlib.pyplot as plt # WHERE TO SAVE THE MODEL FILENAME = "model" ## HYPERPARAMS N_MODELS = 3 L...
# Copyright 2018 Google Inc. 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 applicable law or a...
# coding=utf-8 # Copyright 2013 Foursquare Labs Inc. All Rights Reserved. from __future__ import absolute_import, division, print_function from hashlib import sha1 import os import textwrap from pants.base.exceptions import TaskError from pants.base.fingerprint_strategy import FingerprintStrategy from pants.task.tas...
import click import torch import numpy as np from model import BOS, EOS, CharTokenizer, CharLSTM from constants import MAX_LEN STOP_LIST = [EOS, " "] + list('!"#$%&()*+,-./:;<=>?@[\\]^_{|}~') CUDA = "cuda" CPU = "cpu" @click.group() def main(): pass def to_matrix(names, tokenizer, max_len=None, dtype='int32',...
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 ...
import torch import torch.nn as nn import torch.nn.functional as F from glow.glow.act_norm import ActNorm from glow.glow.coupling import Coupling from glow.glow.inv_conv import InvConv class Glow(nn.Module): def __init__(self, in_channels, cond_channels, num_channels, num_levels, num_steps, mode='sketch'): ...
import collections import os import random import tarfile import torch from torch import nn import torchtext.vocab as Vocab import torch.utils.data as Data import utils import torch.nn.functional as F device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # 数据集下载地址 http://ai.stanford.edu/~amaas/data/se...
""" Implementation of Sentinel Hub Process API interface """ from .constants import MimeType, RequestType from .download import DownloadRequest from .data_collections import OrbitDirection from .data_request import DataRequest from .geometry import Geometry, BBox from .sh_utils import _update_other_args from .time_util...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import torch from multi_passage_model import SequenceClassification import tokenization class InputExample(object): """A single training/test example for simple sequence ...
#import In.entity class Room(In.entity.Entity): '''Room Entity class. ''' def __init__(self, data = None, items = None, **args): self.members = [] super().__init__(data, items, **args) def get_title(self, from_nabar_id): # TODO: CACHE IT if self.title: return self.title if self.type ...
import numpy import numpy as np import os import matplotlib.pyplot as plt from tqdm import tqdm import gym import dmc2gym def create_env(domain_name, task_name, seed, dmc): if dmc: env = dmc2gym.make(domain_name=domain_name, task_name=task_name, seed=seed) else: env = gym.make(domain_name) env.seed(seed) ret...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2015 <NAME> <<EMAIL>> (@amimof) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = """ module: profile_dmgr version_added: "1.9.4" short_description: Manage a WebSphere Application Server profi...
import sys import os import os.path from lxml import etree import collections def create_folder(filepath): directory = os.path.dirname(filepath) if not os.path.exists(directory): os.makedirs(directory) def check_entry_dict(event_tokens, d): if event_tokens in d: return " ".join(d[even...
import os import tensorflow as tf from baseline.confusion import ConfusionMatrix from baseline.progress import create_progress_bar from baseline.reporting import basic_reporting from baseline.utils import listify, get_model_file from baseline.tf.tfy import optimizer, _add_ema from baseline.train import EpochReportingTr...
# Copyright 2021 The TensorFlow Probability Authors. # # 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 o...
''' The MIT License (MIT) Copyright (c) 2017 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publi...
from __future__ import unicode_literals import logging from django.conf import settings from django.core.exceptions import ImproperlyConfigured from paramiko.hostkeys import HostKeyEntry import paramiko from reviewboard.ssh.errors import UnsupportedSSHKeyError class SSHHostKeys(paramiko.HostKeys): """Manages k...
import csv import itertools import sys from functools import reduce PROBS = { # Unconditional probabilities for having gene "gene": { 2: 0.01, 1: 0.03, 0: 0.96 }, "trait": { # Probability of trait given two copies of gene 2: { True: 0.65, ...
''' Copyright 2022 Airbus SAS 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 writing, software dis...
import os import requests as re from flask import Flask, jsonify, request, redirect, url_for,session from flask_cors import CORS import json import six import pandas as pd from math import sqrt from werkzeug import secure_filename UPLOAD_FOLDER = 'tmp' ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg']) app = Flask(__n...
import torch import torch.nn as nn class segnetDown2(nn.Module): def __init__(self, in_size, out_size): super(segnetDown2, self).__init__() self.conv1 = conv2DBatchNormRelu(in_size, out_size, 3, 1, 1) self.conv2 = conv2DBatchNormRelu(out_size, out_size, 3, 1, 1) self.maxpool_with_ar...
import numpy as np import scipy.optimize import scipy.stats def build_utm_matrix(results, case, n, additional_param=None): j = -1 matrix = np.zeros((5, 5)) matrix_n = np.zeros((5, 5)) alternatives = [] for simulation_type in results: for algo_type in results[simulation_type]: i...
from __future__ import absolute_import, division, print_function import base64 import time import gym import imageio import IPython import matplotlib import matplotlib.pyplot as plt import PIL.Image # import pyvirtualdisplay import tensorflow as tf from tf_agents.agents.dqn import dqn_agent from tf_agents.drivers im...
# Copyright 2017 The 'Scalable Private Learning with PATE' 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 # # ...
from __future__ import absolute_import, unicode_literals import logging from django.core.urlresolvers import reverse from django.http import JsonResponse from django.utils.translation import ugettext_lazy as _ from django.shortcuts import redirect, get_object_or_404 from dash.orgs.views import OrgPermsMixin from dash...
#!/usr/bin/env python # # Copyright 2016 Google Inc. 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 require...
import sys from django.db import models from django.db.models import ForeignKey, OneToOneField, ManyToManyField from django.db.models.fields.related import ForeignObjectRel as RelatedObject # taking a nod from python-requests and skipping six _ver = sys.version_info is_py2 = (_ver[0] == 2) is_py3 = (_ver[0] == 3) bas...
""" Wisconsin Autonomous - https://www.wisconsinautonomous.org Copyright (c) 2021 wisconsinautonomous.org All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file at the top level of the repo """ # ---------------------- # Data loading utilities # --------...