text stringlengths 3.07k 22.1k |
|---|
"""
By <NAME> (DTAI lab KU Leuven, 2019)
A script to evaluate and create a mean squared sampled error (MSSE) plot for each epoch in the learning process.
The mean squared sampled error is obtained by sampling from the correct model and comparing the utility of the sample
with the utility according to the found_utiliti... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import json
import urllib3
import hashlib
import logging
import requests
import urllib.parse
import urllib.request
from bs4 import BeautifulSoup
from utils.webanalyzer.utils import update
from utils.webanalyzer.condition import Condition
__all__ = ["W... |
#!/usr/bin/env python
# coding: utf-8
# # About this code
#
# Compute the overlap betweeen the target groups and detected groups, where
# the target groups are those identified by <NAME> and
# the detected groups are those detected by the algorithm.
#
import numpy as np
import sys
import pandas as pd
from scipy impo... |
r"""
.. _isingmodel_PyTorch:
3-qubit Ising model in PyTorch
==============================
.. meta::
:property="og:description": This demonstration uses the PyTorch interface of
PennyLane to optimize a 3-qubit Ising model.
:property="og:image": https://pennylane.ai/qml/_images/isingspins.png
.. relat... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... |
import collections
from collections import defaultdict as dd
import sqlite3, sys
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import numpy as np
plt.style.use('seaborn-whitegrid')
#plt.style.use('grayscale')
###plt.rcParams['image.cmap'] = 'gray'
dbfile = "docs/epigraph.db"
conn = sqlite3.connec... |
import uharfbuzz as hb
import re
from pathlib import Path
from fontTools.ttLib import TTFont
from beziers.path import BezierPath
from beziers.path.geometricshapes import Rectangle
from beziers.utils.linesweep import bbox_intersections
from beziers.point import Point
from beziers.boundingbox import BoundingBox
from glyp... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 08:42:45 2018
@author: <NAME>
title: load_pupil
"""
#%% Imports
import pandas as pd
import numpy as np
from time_fixer import time_fixer
from movingmean import movingmean
#%% Output
class PupilReturnValue(object):
def __init__(self, eyes_id0, ey... |
# Copyright 2020, <NAME>
#
# 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... |
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
"""
DESCRIPTION
===========
Read meta data in OMI NO2 csv file
"""
def read_meta_data(path):
df_meta = pd.read_csv(path, nrows=7, index_col=0, header =None).transpose(... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import dace
import numpy as np
import select
import sys
N = dace.symbol("N")
M = dace.symbol("M")
dtype = dace.float64
# This implementation of transposed DGEMV assumes that the two vectors (x and y) fit into
# FPGA fast memory
def make_in... |
# -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from __future__ import unicode_literals, print_function
# from builtins import object
import os
import datetime
from django.db import models
from django.conf import settings
from django.utils import six
from dj... |
import os
import click
from .cli import cli
from ..config import ProjectConfig
from ..file import create_config_file, create_css_file, create_js_file, \
create_data_file, create_template_file
from ..util import bad_param, generate_id, multi_opt, strip_split
@cli.group()
@click.pass_context
def create(ctx):
""... |
import math
import os
import random
import sys
import time
import logging
import numpy as np
import tensorflow as tf
from random import shuffle
import pickle
from tensorflow.python import debug as tf_debug
import qe_model
from tensorflow.python.training import saver as save_mod
from collections import deque
from qe_... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
import numpy as np
import torch, os, shutil, pickle
from datetime import datetime
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from kme.data.utils import get_loader... |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import argparse
from enum import Enum
import math
import time
from typing import Any, List, Optional, cast
import numpy as np
import torch
import torch.autograd.profiler as profiler
import torch.distributed as dist
import torch.multiprocessing a... |
#!/usr/bin/env python3
#
# Copyright 2020 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 requir... |
# Copyright 2017 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for pyvo.dal.sla
"""
from __future__ import print_function, division
import os, sys, shutil, re, imp, random, time
import unittest, pdb
from urllib2 import URLError, HTTPError
import pyvo.dal.query as dalq
import pyvo.dal.... |
"""
Freesound One-Shot Percussive Sounds Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
Introduction:
This dataset contains 10254 one-shot (single event) percussive sounds from freesound.org, a timbral
analysis computed by two different extractors (FreesoundExtractor from Essentia and A... |
#!/usr/bin/env python
# coding: utf-8
import hashlib
import json
import socket
import time
import unittest
from binascii import a2b_hex
from contextlib import contextmanager
from random import random
from apns import *
from apns import _wait_for_socket
TEST_CERTIFICATE = "certificate.pem" # replace with path to test... |
import os
import sys
import click
from ftcli.Lib.Font import Font
from ftcli.Lib.utils import getFontsList, makeOutputFileName, guessFamilyName
@click.group()
def setLineGap():
pass
@setLineGap.command()
@click.argument('input_path', type=click.Path(exists=True, resolve_path=True))
@click.option('-p', '--perce... |
import copy
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
from torch.utils.data import Dataset
from mohou.encoding_rule import EncodingRule
from mohou.types import MultiEpisodeChunk, TerminateFlag
fr... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
import numpy as np
import scipy.stats
import datetime
from spodernet.interfaces import IAtIterEndObservable, IAtEpochEndObservable, IAtEpochStartObservable
from spodernet.utils.util import Timer
from spodernet.utils.global_config import Config, Backends
from spodernet.utils.logger import Logger
log = Logger('hooks.py... |
# -*- coding: utf-8 -*-
# 为此项目的GUI模块提供
# 用于辅助GUI模块(提供算法,也就是后台)
# 开始时间 同GUI模块
def student_get_information(student_id: int, debug_mode=False):
"""
用于读取并返回学生详细信息, 或对文件进行排序
:param student_id: int
:param debug_mode: bool
:return :学生详细信息
"""
# 读取文件,分析数据结构并获取数据
import re
... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from loss.nt_xent import NTXentLoss
from models.resnet_simclr import ResNetSimCLR, ResNetSimCLR_AE
from torch.utils.tensorboard import SummaryWriter
import os
import shutil
import sys
apex_support = False
try:
sys.path.append('./apex')
from ape... |
from random import random, uniform
from math import log2
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211,
223, 227, 229, 233,... |
import string
import re
import numpy as np
import pandas as pd
import json
import pickle
import nltk
from nltk.stem import PorterStemmer
from nltk.stem.lancaster import LancasterStemmer
from nltk.tag import pos_tag
from nltk.tag import str2tuple
from nltk.chunk import ne_chunk
import spacy
from spacy import displacy
... |
#Weather Forecast
import tkinter, requests
from tkinter import BOTH, IntVar
from PIL import ImageTk, Image
from io import BytesIO
#Define window
root = tkinter.Tk()
root.title('Weather Forecast')
root.iconbitmap('weather.ico')
root.geometry('400x400')
root.resizable(0,0)
#Define fonts and colors
sky_col... |
import streamlit as st
import IPython.display as ipd
from pydub import AudioSegment
import numpy as np
from PIL import Image
from load_css import local_css
import pandas as pd
import os
import datetime
# librosa is a Python library for analyzing audio and music. It can be used to extract the data from t... |
from flask import redirect, url_for, render_template, request, flash, g
from flask_wtf import FlaskForm
from wtforms import SelectField
from wtforms.validators import DataRequired
from flask_login import current_user
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.sql import text
from sqlalc... |
from Jumpscale import j
builder_method = j.builders.system.builder_method
class BuilderGolangTools(j.builders.system._BaseClass):
NAME = "golangtools"
def _init(self):
self.base_dir = self._replace("{DIR_BASE}")
self.env = self.bash.profile
self.DIR_GO_ROOT = self.tools.joinpaths(se... |
import os
import numpy as np
path_praat_script=os.path.dirname(os.path.abspath(__file__))
def multi_find(s, r):
"""
Internal function used to decode the Formants file generated by Praat.
"""
s_len = len(s)
r_len = len(r)
_complete = []
if s_len < r_len:
n = -1
else:
for... |
# Copyright 2019-2020 Toyota Research Institute. All rights reserved.
"""
Defines a new XAS Spectrum object built on top of Pymatgen's
Spectrum object.
"""
import os
import numpy as np
from pymatgen.core.structure import Structure
from trixs.spectra.core import XAS_Spectrum, XAS_Collation
from trixs.spectra.spectrum_... |
# Connection libraries
import socket
# Printing
from art import text2art
# Threading
import threading
# Terminal GUI
from Core.Utilities.SeprateTerminal import Window
# Encryption libraries
import rsa
import base64
from Core.Encryptions.AESCipher import AESCipher
# Saving files with current time
from datetime impo... |
# Copyright 2019 The Matrix.org Foundation CIC
#
# 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... |
import copy
import os
import sys
import time
from collections import OrderedDict, defaultdict
import yaml
import torch
import numpy as np
from hyperopt import hp
import ray
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune import register_trainable, run_experiments, run
from ray import tune
# sys.path... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
from a10sdk.common.A10BaseClass import A10BaseClass
class FailMsgCfg(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param fail_font_custom: {"description": "Specify custom font", "format": "string-rlx", "minLength": 1, "maxLength": 63, "not": "fail-face", "type": "stri... |
import pandas as pd
import geopandas as gpd
import os
import requests
import time
from tqdm import tqdm
from pandas.api.types import is_string_dtype
import shutil
from zipfile import ZipFile
def find_region(state: str = None):
if state in ['Istarska', 'Licko-Senjska', 'Primorsko-Goranska']:
return 'Istra... |
import pygame
from logic import solve,valid
pygame.font.init()
# Total window
screen=pygame.display.set_mode((500,600))
# Title and Icon
pygame.display.set_caption("SUDOKU SOLVER USING BACKTRACKING")
img = pygame.image.load('icon.png')
pygame.display.set_icon(img)
x=0
y=0
dif=500/9
val=0
grid =[
... |
# Authors:
# <NAME> (<EMAIL>)
# <NAME> (<EMAIL>)
# Source: https://git.ee.ethz.ch/baumgach/discriminative_learning_toolbox/blob/master/utils.py
import nibabel as nib
import numpy as np
import os
import logging
from skimage import measure, transform
logging.basicConfig(level=logging.INFO, format='%(asctime)s ... |
from unittest import TestCase
import qelos as q
from torch.autograd import Variable
import torch
from torch import nn
import numpy as np
class TestWordEmb(TestCase):
def test_creation_simple(self):
dic = dict(zip(map(chr, range(97, 122)), range(122-97)))
m = q.WordEmb(10, worddic=dic)
embe... |
import inspect
import time
import enum
import os
import asyncio
from types import FunctionType
from Houdini.Converters import IConverter
def get_relative_function_path(function_obj):
abs_function_file = inspect.getfile(function_obj)
rel_function_file = os.path.relpath(abs_function_file)
return rel_funct... |
"""
Mask R-CNN
Configurations and data loading code for Davis 2017.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for examples), or run from
the command line as such:
... |
# coding=utf8
# BézierBuilder
#
# Copyright (c) 2013, <NAME> <<EMAIL>>
# 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 code must retain the above copyright notic... |
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Classes of failure types."""
from __future__ import print_function
import collections
import sys
import traceback
from chromite.cbuildbot import con... |
import logging
# ===== START LOGGER =====
logger = logging.getLogger(__name__)
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
sh = logging.StreamHandler()
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
sh.setFormatter(formatter)
root_logger.addHandler(sh)
i... |
#!/usr/bin/env python3
"""Wikidata functions."""
import re
from collections import defaultdict
from datetime import datetime
from SPARQLWrapper import JSON
from SPARQLWrapper import SPARQLWrapper
from tolkein import tofile
from tolkein import tolog
from tqdm import tqdm
LOGGER = tolog.logger(__name__)
SPARQL = SPAR... |
from django.forms import (
BooleanField,
Form,
ModelForm,
Textarea,
ValidationError,
ModelChoiceField,
)
from .models import (
ReviewExercise,
SubmissionExercise,
)
class SubmissionExerciseForm(ModelForm):
class Meta:
model = Submiss... |
import os
import sys
import json
from time import sleep
from importlib import import_module
from helper import bold_str, sprintf, cursorUpLines, setupFiles
# Default configuration file
dfltCfgFile = "config_dflt.py"
# Import default configuration file.
# Not using `import config_dflt` because of printing option (`net... |
from django.conf import settings
from django.utils import timezone
import django_filters
from modeltranslation.translator import NotRegistered, translator
from rest_framework import serializers, fields as drf
from django.db.models import Q
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from djan... |
import torch
import ipdb
import numpy as np
def lbfgs(f, init, maxIter=50, gEps=1e-8, histSize=10, lr=1.0, clamp=False, display=False):
"""
input:
f: a function
in: value x; 1-d tensor
out: result fx, gradient g
init: a valid input for f
maxIter: ---
gEps... |
from __future__ import print_function as _
from pysb.importers.bngl import model_from_bngl
import pysb.pathfinder as pf
import subprocess
import os
import tempfile
import shutil
import re
try:
# Python 3
from urllib.request import urlretrieve
except ImportError:
# Python 2
from urllib import urlretrieve... |
import math
from typing import Union
import cv2 as cv
import numpy as np
import ball_net as bn
import sys
count = 0
R = 60
EPS = 1e-6
EPS2 = 0.5
STATUS_INIT = 0
STATUS_STATIC = 1
STATUS_DIRECTED = 2
def pt_dist(x1, y1, x2, y2):
dx = x1 - x2
dy = y1 - y2
return math.sqrt(dx * dx + dy * dy)
class Blob... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019-Present <NAME> <<EMAIL>>
# and the Talkowski Laboratory
# Distributed under terms of the MIT license.
"""
Filter an input CNV BED file
"""
import argparse
from sys import stdin, stdout
from os import path
import pybedtools as pbt
import pysam
from... |
import deb
import numpy as np
import pdb
class ModelInputMode():
pass
class MIMFixed(ModelInputMode):
def __init__(self):
pass
def batchTrainPreprocess(self, batch, data, label_date_id, batch_seq_len=12):
input_ = batch['in'].astype(np.float16)
input_ = data.addDoty(input_)
r... |
#!/usr/bin/env python3
"""
Contains the QC settings dictionary for all cifti_vis scripts, as well as
a class to make access to settings easy to read.
"""
import os
import sys
import logging
from abc import ABCMeta, abstractmethod
from PIL import Image
import yaml
import ciftify.config as config
from ciftify.utils imp... |
import numpy as np
from operator import itemgetter
import torch
import torch.nn as nn
import torch.utils.data
from torch_model_base import TorchModelBase
from utils import progress_bar
__author__ = "<NAME>"
__version__ = "CS224u, Stanford, Spring 2020"
class TorchRNNDataset(torch.utils.data.Dataset):
def __init_... |
from tkinter import * #Benodigde imports
import os, xmltodict, requests
nederlands = True
def request():
'Stuurt een request naar de server van NS en returnt een XML'
global station
station = invoerVeld.get()
auth_details = ('<EMAIL>', '<KEY>')
api_url = 'http://webservices.ns.nl/... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 python
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright (c) 2017 <NAME><<EMAIL>> All Rights Reserved
#
#
# File: /Users/hain/ai/InsuranceQA-Machine-Learning/deep_qa_1/network.py
# Author: <NAME>
# Date: 2017-08-08:18:32:05
#
#=========... |
"""
Script to generate the MNIST+ dataset. The purpose of this dataset is to make a
more challenging MNIST-like dataset, with multiple factors of variation. These
factors can serve to evaluate a model's performance at learning invariant
features, or its ability to disentangle factors of variation in a multi-task
classi... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: utilities
:platform: Unix
:synopsis: the top-level submodule of Dragonfire that provides various utility tools for different kind of tasks.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import inspect # Inspect live objects
import os # Miscellaneous opera... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.utils import softmax
from toolbox.nn.Highway import Highway
class GraphEncoder(nn.Module):
def __init__(self, entity_dim, relation_dim):
super(GraphEncoder, self).__init__()
self.a_i = nn.Linear(entity_dim, 1,... |
from datetime import datetime
import os.path as osp
import uuid
from ..database import db, ma
from .git import GitRepoFs
from ..model import User, ClientEnv, ClientEnvSchema
from ..error import DataInconsistencyException
from marshmallow import fields
class GitRepo(db.Model):
__tablename__ = "git_repos"
id =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/templates.py
#
# 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 l... |
import torchvision.models as models
import torch.nn as nn
import torch
import torchvision.transforms as transforms
import sys
import os
import numpy as np
import json
import random
import matplotlib.pyplot as plt
from glob import glob
from PIL import Image
from torchvision import datasets
# # grab file from ajax call
... |
import pytest
import twitch_rivals.check_twitch as ct
from collections import namedtuple
import datetime
StreamInfo = namedtuple('StreamInfo', 'id game preview')
ChannelInfo = namedtuple('ChannelInfo', 'id name display_name game status logo video_banner profile_banner'
' profil... |
'''
********************************************************************************
Python Script: gfximage Module
Writter: <NAME>
Date: 29 Januarry 2019
This Python script is compatible with Python 3.x.
The script is used to define GfxImage class the image block in
Blodiator. This module is a wrapper for t... |
# Copyright 2013 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 ... |
#Adapted from https://github.com/hpcaitech/ColossalAI-Examples/blob/main/language/gpt/model/gpt1d.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import math
from colossalai.utils.activation_checkpoint import checkpoint
import torch
from torch import nn as nn, Tensor
from colossalai.core import global_conte... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.d
~~~~~~~~~~~~~~~~~
Lexers for D languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Ke... |
#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,sys
import math
import numpy as np
import bisect
from multiprocessing import Pool
BASE_DIR = os.path.join(os.path.dirname(__file__), '../../../data/S3DIS/prepare_label... |
"""Base Garage Environment API."""
import abc
from dataclasses import dataclass
from typing import Dict
import akro
import numpy as np
# Can't use naive garage import, or Sphinx AutoAPI breaks.
from garage._dtypes import StepType
@dataclass(frozen=True)
class InOutSpec:
"""Describes the input and output spaces... |
# mypy: ignore-errors
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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 ... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
#!/usr/bin/env python
"""Analyze metrics stored in panda tables"""
import argparse
import os
import sys
import re
from collections import OrderedDict
from itertools import permutations
import numpy as np
import pandas as pd
from scipy.stats import ttest_rel, wilcoxon
NAME_REGEXP = re.compile(r'.+_(.+)_\d\d\d\d.+')
SI... |
import os
import json
import six
from girder.models.collection import Collection
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.upload import Upload
from girder.models.user import User
from tests import base
def setUpModule():
base.enabledPlugins.append('dicom_view... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2019 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from collections import defaultdict
import numpy as np
import time
from pymor.core.exceptions im... |
# -*- coding: utf-8 -*-
from datetime import datetime, time
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import models
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils import timezone
from django.... |
from functools import reduce
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import F, Sum
from . import exceptions
class QuotaLimitField(models.IntegerField):
""" Django virtual model field.
Could be used to manage quotas transparently as model f... |
"""Faster R-CNN
Pretrained Faster RCNN on Open Images V4 Dataset with 600 categories.
Object detection model trained on Open Images V4 with ImageNet pre-trained Inception Resnet V2 as image feature extractor.
Categories of interest from sun rgbd | possible category of Open Images Dataset
- bed | Bed
- table | Table
... |
"""
All the functions that don't fit in anywhere else or reduce readability.
"""
import tensorflow as tf
import tflib as lib
import tflib.ops.linear
import tflib.ops.conv2d
import tflib.ops.batchnorm
import tflib.ops.deconv2d
import tflib.save_images
import tflib.celebA_64x64 # This is where the input_pipe is
import ... |
"""DNS Authenticator for Websupport."""
import logging
import requests
import zope.interface
import hmac
import hashlib
import base64
import time
from datetime import datetime
from certbot import errors
from certbot import interfaces
from certbot.plugins import dns_common
logger = logging.getLogger(__name__)
API_EN... |
#!/usr/bin/env python3
"""Manages a GATE server."""
from __future__ import absolute_import, division, print_function
from builtins import range
try:
from configparser import RawConfigParser
except:
from ConfigParser import RawConfigParser
from collections import defaultdict
from future.moves.urllib.parse impor... |
# Name: 2018 Easter Event
# Written by Owain for Dawntained / Runefate, 27/03/18
from game.content.quest import Quest
from game.content.quest import QuestHandler
from game.content.quest import QuestReward
from game.item import ItemAssistant
from game.content.skilling import Skilling
from game.object import ObjectEvent... |
import os
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.ioff()
mpl.rcParams.update({'font.size': 18})
import statsmodels.api as sm
from sklearn.linear_model import LinearRegression
from statsmodels.sandbox.regression.predstd import wls_prediction_std
from scipy im... |
import libtcodpy as libtcod
import tcod
from random import uniform, randint
# TODO pass these to the functions
WORLD_WIDTH = 200
WORLD_HEIGHT = 80
SCREEN_WIDTH = 200
SCREEN_HEIGHT = 80
CIVILIZED_CIVS = 2
TRIBAL_CIVS = 2
MIN_RIVER_LENGHT = 3
CIV_MAX_SITES = 20
EXPANSION_DISTANCE = 10
WAR_DISTANCE = 8
# Palette
Pal... |
#!/usr/bin/env python
# This code implements sentiment classification using the Scikit-learn machine learning toolkit for Python:
# Scikit-learn: Machine Learning in Python, Pedregosa et al., JMLR 12, pp. 2825-2830, 2011.
# Sentiment classification of parallel sentence data in English (original), Finnish, French, or I... |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2018-2019 <NAME> <<EMAIL>>
# Copyright (c) 2018 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
import sys
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.build... |
# -*- coding: utf-8 -*-
import os
import re
from mako.template import Template
from pyramid.path import AssetResolver, DottedNameResolver
from sqlalchemy import create_engine
from sqlalchemy.schema import CreateTable
from shutil import copyfile
from pyramid_oereb.lib.config import Config
def convert_camel_case_to_s... |
from detectron2.checkpoint import DetectionCheckpointer
from typing import Any
import torch
import torch.nn as nn
from fvcore.common.checkpoint import _IncompatibleKeys, _strip_prefix_if_present, TORCH_VERSION, quantization, \
ObserverBase, FakeQuantizeBase
from torch import distributed as dist
from scipy import i... |
import numpy as np
import ops.utils
# FUNCTIONS
def correlate_channels(r, first, second):
"""Cross-correlation between non-zero pixels.
Uses `first` and `second` to index channels from `r.intensity_image_full`.
"""
A, B = r.intensity_image_full[[first, second]]
filt = A > 0
if filt.sum() ==... |
# 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... |
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.