text stringlengths 3.07k 22.1k |
|---|
# 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... |
from modules.Neo4jDataAccess import Neo4jDataAccess
from neo4j import GraphDatabase, basic_auth
import pandas as pd
import pytest
import os
import sys
from pathlib import Path
class TestNeo4jDataAccess:
@classmethod
def setup_class(cls):
cls.creds = [
{
"type": "writer",
... |
import os
import tensorflow as tf
import numpy as np
def _read_to_tensor(fname, output_height=256, output_width=256, normalize_data=False):
'''Function to read images from given image file path, and provide resized images as tensors
Inputs:
fname - image file path
output_height - re... |
'''
Created on 2015/7/24
:author: hubo
'''
from vlcp.config import Configurable, manager, config
from vlcp.event import Scheduler, DefaultPolling, RoutineControlEvent, CBQueue
from vlcp.utils.connector import Resolver
from vlcp.event import PollEvent, ConnectionWriteEvent, ConnectionControlEvent, StreamDataEvent
from ... |
import requests
import json
import sys
from pymongo import MongoClient
max_posts = 5
for item in sys.argv:
if "max" in item:
max_posts = str(item.split(':')[1])
client = MongoClient()
db = client.subs_db
posted = db[DATABASE_NAME]
adminid = ADMIN_ID
botkey = BOTAPI_KEY
reddit_user = REDDI... |
import tensorflow as tf
import yaml
import numpy as np
import glob
import random
from tqdm import tqdm
from tfmodel.model_setup import make_model, targets_multi_output, CustomCallback
from tfmodel.utils import get_heptfds_dataset
from tfmodel.data import Dataset
#A deep sets conditional discriminator
def make_disc_mo... |
# Copyright 2021 The TensorFlow 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 applica... |
from app import db, app
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
from flask_login import UserMixin
from flask_user import roles_required, UserManager
from hashlib import md5
from app import login
class Departments(UserMixin, db.Model):
id = db.Column(... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class CharLSTM(nn.Module):
"""Character-level embedding using bidirectional LSTM"""
def __init__(self,
char_size,
char_dim,
char_hidden_dim,
padding_idx=0,
d... |
import logging
import os
import unittest
class EnvironmentMixin(unittest.TestCase):
"""Adds safe environment variable manipulation.
Use this instead of manipulating :data:`os.environ` or calling
:meth:`os.setenv` directly. Failing to do so may cause strange
test failures when environment variables l... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import os.path as osp
import cv2
import numpy as np
import matplotlib
matplotlib.use('Agg')
from mpl_toolkits.m... |
"""
This code is slightly modified from <NAME>'s repository.
https://github.com/hengyuan-hu/bottom-up-attention-vqa
"""
from __future__ import print_function
import os
import sys
import json
import numpy as np
import re
import _pickle as cPickle
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)... |
#!/usr/bin/env python3
"""
(C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Functions for manipulating and expanding an JSON-NLP object
Licensed under the Apache License 2.0, see the file LICENSE for more details.
Brought to you by the NLP-Lab.org (https://nlp-lab.org/)!
"""
name = "jsonnlp"
__version__ = "0.2.1"... |
import numpy as np
import cv2
import glob
import argparse
import cv2.aruco as aruco
import pdb
import time
import csv
import serial
import threading
import multiprocessing as mp
import datetime
import math
from OdriveClass import *
def ReadSerial(ser):
#try:
ser.flushInput()
while (ser.inWaiting()<30):
... |
import time
from abc import ABC, abstractmethod
from collections import defaultdict
from enum import Enum
import threading
import os
if os.environ.get('TORCHVISION', 'no') == 'yes':
import torch.multiprocessing as mp
else:
import multiprocessing as mp
from .errors import NoRunnerException
from .metrics_collecto... |
import requests
import json
from os import environ
from os.path import exists
from datetime import datetime
from xml.dom import minidom
# -- REQUESTS -- #
def request_news(category, num_entries):
headers = {
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
... |
import numpy as np
from open3d.open3d_pybind.geometry import (PointCloud, KDTreeSearchParamHybrid)
from sklearn.linear_model import LinearRegression, RANSACRegressor
'''
Plane API
a plane is defined by ax + by + cz + d = 0
plane := np.array([a,b,c,d], dtype = ...)
'''
def make_plane(point, direction, dtype = np.float... |
from math import sqrt, inf
from functools import lru_cache
from abc import ABC, abstractmethod
from typing import Dict, Set, Tuple, Optional
from mercury.config.smart_grid import ConsumerConfig
from mercury.msg.smart_grid import PowerConsumptionReport
class SDNStrategy(ABC):
def __init__(self, **kwargs):
... |
import tensorflow as tf
import numpy as np
import time
import sys
import os
from model_setting import nn_parameters
from model_cnn import cross_entropy_setup
from model_cnn import batch_control
sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'data_processing/'))
from data_processing import class_label_ve... |
#-------------------------------------------------------------
#
# 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... |
import argparse
import logging
import os
import re
import enum
from sys import float_info
from collections import defaultdict
from Common.utils import LoggingUtil, GetData
from Common.loader_interface import SourceDataWithVariantsLoader, SourceDataBrokenError, SourceDataFailedError
from Common.kgxmodel import kgxnode,... |
# JOHNNYDMAD - developer tool/test interface for FF6 music randomization
# *** READ THIS BEFORE EDITING THIS FILE ***
# This file is part of the johnnydmad project.
# ( https://github.com/emberling/johnnydmad )
# johnnydmad is designed to be used inside larger projects, e.g.
# Beyond Chaos, Beyond Chaos Gaiden, or po... |
# The general idea here is to build an html form/associated js for a set of javascript functions
# functions + argument types
# generate html form for each function
# must be an api stub that accepts API calls
# also must inject this into html page
#
import inspect
from typing import List
from .util import CaseExcepti... |
import random
from pffl.models import *
from pffl.forms import *
from pffl.apitools import *
## DATABASE MANAGEMENT
def updateAllFields(fields):
updateTeam(fields[0]) #name
updateConferance(fields[1]) #conferance
updateDivision(fields[2]) #division
updateRank(fields[3]) #rank
def updateTeam(name):
new_team, _ =... |
from gymenv_v2 import make_multiple_env
import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import wandb
wandb.login()
run=wandb.init(project="finalproject", entity="ieor-4575", tags=["test"])
#run=wandb.init(project="finalproject", en... |
'''*****************************************************************************
Purpose: To analyze the sentiments of the reddit
This program uses Vader SentimentIntensityAnalyzer to calculate the ticker compound value.
You can change multiple parameters to suit your needs. See below under "set program parameters."
I... |
import re
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
import xarray as xr
import scmdata
def do_basic_to_xarray_checks(res, start_run, dimensions, extras):
assert isinstance(res, xr.Dataset)
assert set(res.data_vars) == set(start_run.get_unique_meta("variable"))
for... |
"""A Unix pipe-style command-line interface for audio processing.
This utility is inspired by imagepipe:
https://github.com/pallets/click/blob/master/examples/imagepipe/imagepipe.py
"""
from importlib import import_module
import os
import click
import soundfile as sf
from .utils import processor, generator
from .fil... |
import sys
import re
import json
import requests
import yaml
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
import twitter.download
import utils.preprocess
import u... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.sparse import csc_matrix
from scipy.sparse.linalg import spsolve, factorized
def conv(A, B, c, i, tipus):
"""
3 types of convolution needed
:param A: vector 1
:param B: vector 2
:param c: current depth
... |
"""
Authors: <NAME>, <NAME>
Licensed under the CC BY-NC 4.0 license (https://creativecommons.org/licenses/by-nc/4.0/)
"""
import os
import math
import numpy as np
import torch
import torchvision.transforms as transforms
from data.augment import Augment, Cutout
from utils.collate import collate_custom
from collections i... |
#!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
"""FocusSeq2Seq
Copyright (c) 2019-present NAVER Corp.
MIT license
"""
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from layers.transformer import EncoderWrapper
from layers.copy_attention import BahdanauAttention2
from layers.tcn import TemporalConvNet
... |
from sage.all import EllipticCurve, ZZ, GF, factor # import sage library
# Converting functions using formulas in https://tools.ietf.org/id/draft-struik-lwip-curve-representations-00.html
def montgomery_to_short_weierstrass(F, A, B, x, y):
a = F((3 - A ** 2) / (3 * B ** 2))
b = F((2 * A ** 3 - 9 * A) / (27... |
import torch
from dlutils.models.gans.bicycle.models import \
Generator, Encoder, MultiResolutionDiscriminator
class BiCycleGAN(torch.nn.Module):
"""
A PyTorch Impelementation of the bycicle GAN
It consists of a generator learning to map the given input (combined with
its latent code) to the out... |
# coding=utf-8
import logging
import random
import re
import xkcd_manager
import weather_manager
import terminal_manager
import requests
from channel_manager import ChannelManager
from loud_manager import LoudManager
from whos_that_pokemon_manager import WhosThatPokemonManager
from hogwarts_house_sorter import Hogwar... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from math import log2
from kornia.filters import filter2D
from functools import partial
import os
no_const = False
image_size = 128
latent_dim = 512
num_layers = 6
style_depth = 8
lr_mlp = 0.1
network_capacity = 4
transparent = False
attn_layers = []
f... |
"""
Implements a size dependent STEP correction in one bin.
Correction is flat at large sizes, and linear at small sizes.
"""
import numpy as np
import pymc
from . import maxlike_masses as mm
from . import nfwmodeltools as nfwtools
from .nfwutils import global_cosmology as gc
class BentVoigtShapedistro(mm.LensingMod... |
import os
import sqlite3
import hashlib
import matplotlib.pyplot as plt
from pylab import *
from flask import Flask, flash, redirect, render_template, request, session, url_for, jsonify
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions
from ... |
# Copyright (c) 2007-2009 gocept gmbh & co. kg
# See also LICENSE.txt
import zope.interface
import transaction
import ZODB.Connection
import gocept.objectquery.interfaces
import persistent
from BTrees.OOBTree import OOBTree, OOTreeSet
from sw.objectinspection import IAttributesInspector, IChildrenInspector
class OOI... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""COWC datasets."""
import abc
import csv
import os
from typing import Any, Callable, Dict, List, Optional
import numpy as np
import pytorch_lightning as pl
import torch
from PIL import Image
from torch import Generator, T... |
'''
Implements a Cube and movements at Cubie level
'''
import random
from past.builtins import basestring
from copy import deepcopy
from .Move import Move
from .NaiveCube import NaiveCube
class Sticker(object):
COLOURS = ['w', 'r', 'b', 'g', 'y', 'o', '.']
def __init__(self, color):
if color.lower() ... |
import torch
import pandas as pd
from typing import Tuple
from torch import cat, flatten, sigmoid
from torch.nn import Module, ModuleList, Linear, ReLU, Sequential, Dropout, Parameter
from torch.distributions.multivariate_normal import MultivariateNormal
from fairseq.data.data_utils import collate_tokens
from .nli_ba... |
import numpy as np
import multiprocessing as mp
import ctypes
import torch
from rlpyt.utils.collections import (NamedArrayTuple, namedarraytuple_like,
NamedArrayTupleSchema_like, NamedTuple)
def buffer_from_example(example, leading_dims, share_memory=False,
use_NatSchema=None):
"""Allocates memory a... |
# Copyright 2017 QuantRocket - 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 ... |
'''
Based off of this day/night detection script:
http://www.ippatsuman.com/2014/08/13/day-and-night-an-image-classifier-with-scikit-learn/
'''
from __future__ import division
from __future__ import print_function
import itertools
import numpy as np
import urllib2
import sys
import os
from glob import glob
from PIL i... |
# -*- coding: utf-8 -*-
from .vendor.Qt import QtCore, QtGui, QtWidgets
from . import node
from . import line
import os
import subprocess
import re
class View(QtWidgets.QGraphicsView):
"""
QGraphicsView for displaying the nodes.
:param scene: QGraphicsScene.
:param parent: QWidget.
"""
def _... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-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 License at
#
# http... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import gridspec
import astropy.constants as cst
import math
from scipy.interpolate import CubicSpline
from lmfit import Model
from lmfit.models import update_param_vals
from edibles.utils.voigt_profile import voigt_absorption_line
f... |
import os
from greent.util import Resource
from greent.graph_components import LabeledID
from collections import defaultdict
import itertools
from collections import OrderedDict
#TODO: should all of this be done with some sort of canned semantic tools?
class Concept:
""" A semantic type or concept. A high level id... |
from django.shortcuts import redirect, render
from django.contrib.auth.views import LoginView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.urls import reverse_lazy
from django.views.generic.list import ListView
from django.views.generic.... |
from external.API_interface.TLF_API.component.Class_Pose2D import Pose2D
from gpiozero.pins.rpigpio import RPiGPIOFactory
from gpiozero import Servo, Device, LED
from module.servo_cote import Servo_cote
from module.tirette import Selection_zone
# import matplotlib
# matplotlib.use('Agg')
# import matplotlib.pyplot as ... |
# The MIT License (MIT)
# Copyright (c) 2018 Massachusetts Institute of Technology
#
# Author: <NAME>
# This software has been created in projects supported by the US National
# Science Foundation and NASA (PI: Pankratius)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softwa... |
import argparse
import numpy as np
import glob
import os
import scipy.io as sio
from utils import process_data
from utils import process_evaluation
from sklearn.model_selection import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score ,no... |
from copy import copy
from types import SimpleNamespace
from pytest import mark
from myia.api import standard_pipeline, step_debug_export
lang_pipeline = standard_pipeline.select(
'parse', 'resolve'
).insert_after(
debug_export=step_debug_export)
def parse_compare(*tests):
"""Decorate a function to p... |
import copy
import cpp
import cpp_file_parser
import util
def adjust_table_arguments_tokens(classname, arguments):
for arg in arguments:
in_arg = False
for token in arg.tokens:
if token.spelling == classname:
in_arg = True
break
if in_arg:
... |
# -*- coding: utf-8 -*-
from __future__ import print_function as _
from __future__ import division as _
from __future__ import absolute_import as _
def connect_edge(g, source, dest):
g[source].outputs.append(dest)
g[dest].inputs.append(source)
def replace_source(g, source, dest, new_source):
for idx, d ... |
#!/usr/bin/env python3
# This file is a part of PDDLRL project.
# Copyright (c) 2020 <NAME> (<EMAIL>)
# Copyright (c) 2021 <NAME> (<EMAIL>, <EMAIL>), IBM Corporation
# usage:
# ./experiments.py RLExperiments --local-scheduler --workers 200 --log-level INFO --root nov9 --cluster
# ./experiments.py NonRLExperiments ... |
import mlflow
import torch
from cortex.plugins import ModelPlugin
from cortex._lib import exp
from torch.backends import cudnn
import torch.nn.functional as F
import numpy as np
from torchsummary import summary
from src.models.mix_match.utils import interleave
from src.models.utils import accuracy, MlflowLogger, Weigh... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 2 12:24:54 2021
This script outputs 6 items in this order:
1. array containing data for each potato in image
2. number of potatoes (string)
3. minimum l/w ratio (string)
4. maximum l/w ratio (string)
5. average l/w ratio (string)
6. processed image bitmap
The main() fu... |
#coding=UTF-8
"""
Syllabificator for shipibo-konibo
General functions and rules to syllabify a shipibo-konibo word
"""
def syllabify(word):
"""
Function that returns all the syllables of a word
"""
word_vc = get_vc(word)
sibilantes = ['m','n', 's', 'sh', 'x']
syllables = []
syllable = ""
... |
"""
Runs before tests
"""
import os.path as op
import pytest
import numpy as np
import pandas as pd
import nibabel as nib
from nilearn.masking import apply_mask
import nimare
from nimare.utils import get_template, mm2vox, get_masker
from nimare.tests.utils import download_nidm_pain, get_test_data_path
@pytest.fixtu... |
from __future__ import annotations
import math
import random
import string
from typing import Any, Union
import pytest
from lark.exceptions import UnexpectedCharacters, UnexpectedInput
from lispyc.sexpression import nodes, parser
random.seed(1)
List = list[Union[int, float, bool, str, "List"]]
CONSTANT_PARAMS = [... |
import sys
import time
import visa
import numpy as np
import matplotlib.pyplot as plt
TCP_HOST = '169.254.70.102' if len(sys.argv) < 2 else sys.argv[1]
TCP_PORT = 5000
rm = visa.ResourceManager('@py')
inst = rm.open_resource(f'TCPIP0::{TCP_HOST}::{TCP_PORT}::SOCKET')
inst.write_termination = '\r\n'
inst.read_termina... |
"""riddle.py
Run various deep learning classification pipelines with k-fold
cross-validation. Summarize discriminatory features using DeepLIFT contribution
scores and paired t-tests with Bonferroni adjustment for multiple comparisons.
Requires: Keras, NumPy, scikit-learn, RIDDLE (and their dependencies)
Author: ... |
from sympy import *
from numpy import *
from numpy.linalg import inv
from time import time
from mpmath import radians
import tf
'''
Format of test case is [ [[EE position],[EE orientation as quaternions]],[WC location],[joint angles]]
You can generate additional test cases by setting up your kuka project and running `... |
# -*- coding: utf-8 -*-
"""
svm20190122_generic_directory.py
5/7/2019 modified from svm20190122.py to use default directory and trim unused code
use svm directly on scaled data, not PCA
determine the transformation scalers and pca decomposition based on all data
specify which data to use for training the sv... |
# this file has bunch of functions that are used everywhere
import os
import io
import hashlib
import requests
import tempfile
import randomname
from uuid import uuid4
import logging
# common/
nbox_session = requests.Session()
# /common
# logging/
logger = logging.getLogger()
# /logging
# lazy_loading/
def isth... |
import tensorflow as tf
import os
import sys
sys.path.append('..')
import tools as tools
import numpy as np
import matplotlib.pyplot as plt
GPU='0'
def load_real_rgbs(test_mv=5):
obj_rgbs_folder ='./Data_sample/amazon_real_rgbs/airfilter/'
rgbs = []
rgbs_views = sorted(os.listdir(obj_rgbs_folder))
fo... |
#!/usr/bin/env python3
from enum import Enum
import math
import os
class InstructionException(Exception):
""" Unhandled instruction """
class Instruction(Enum):
ADDITION = 1
MULTIPLICATION = 2
INPUT = 3
PRINT = 4
JUMP_POSITIVE = 5
JUMP_NEGATIVE = 6
LESS_... |
import os
import re
import sys
import numpy as np
import numpy as np
import seaborn as sns
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_scheduler as sched
import torch.utils.data as data
import torchvision
import torchvision.transforms as transfor... |
'''
Modified from https://github.com/chengyangfu/pytorch-vgg-cifar10
'''
import math
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from quantizer_gpu import Quantizer
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
... |
"""
The :mod:`surprise.accuracy` module provides with tools for computing accuracy
metrics on a set of predictions. We assume higher is always better as in
sklearn and hence we sometime return the opposite of a metric.
Available accuracy metrics:
.. autosummary::
:nosignatures:
neg_rmse
neg_mae
fcp
... |
# Copyright 2021 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
from copy import deepcopy
from pylaut import utils
from pylaut.language.phonology.phone import Phone
from pylaut.language.phonology.word import Syllable, Word
from pylaut.utils import flatten_partial
class This(object):
"""
A dummy object for "the current position" in a word. Contains utility
methods to ... |
# Copyright 2021 <NAME>, <EMAIL>
#
# 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... |
"""Test rlacalc
Use hypothesis testing framework:
https://hypothesis.readthedocs.io/en/latest/quickstart.html
TODO:
Start with simple test
Add failing test from Grant
"""
import sys
# TODO: get pytest working without this and without python3 -m pytest
#sys.path.insert(0, '/home/neal/py/projects/audit_cvrs/audit_c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on Fri Aug 9 10:13:41 2019
Plot graphs for the codecompare paper.
'''
import os
import numpy as np
import matplotlib.pyplot as plt
import defs
# Make sure we only use Type 1 fonts:
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.rc('... |
#!/usr/bin/env/python
import argparse
import numpy as np
import os
import pandas as pd
import yaml
import micro_dl.inference.evaluation_metrics as metrics
import micro_dl.utils.aux_utils as aux_utils
import micro_dl.utils.preprocess_utils as preprocess_utils
import micro_dl.utils.image_utils as image_utils
import mic... |
# =========================================================
# For more info, see https://hoseinkh.github.io/projects/
# =========================================================
import pickle
import numpy as np
import pandas as pd
from sortedcontainers import SortedList
from tqdm import tqdm
## ************************... |
import pandas as pd
import numpy as np
def describe_cartesian_product(*args):
"""
Returns a string to describe
"""
n = reduce(lambda x, y: x * y, [len(s) for s in args])
s = reduce(lambda x, y: str(x) + " x " + str(y),
[len(s) for s in args]) + " = " + str(n)
return s
def car... |
from resnet import resnet18
import os
from PIL import Image
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
from tqdm import tqdm #from tqdm import tqdm_notebook as tqdm
import matplotlib.pyplot as plt
#matplotlib inline
import torch
from torch import nn
from torch.nn import functio... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains xml element classes as defined in the VOResource standard.
"""
from functools import partial
from astropy.utils.collections import HomogeneousList
from astropy.time import Time, TimeDelta
from ...utils.xml.elements import (
xml... |
# Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011 <NAME> <yamahata at valinux co jp>
#
# 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://ww... |
import os
import sys
import time
from argparse import Namespace
from PIL import Image
import matplotlib.pyplot as plt
import clip
import torch
import torch.nn as nn
from torchvision.utils import make_grid
from torchvision.transforms import ToPILImage
sys.path.append(".")
sys.path.append("..")
from mapper.options.tes... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as f
import torch.optim as optim
import collections
import sklearn.metrics as sk
import os
filePath = os.path.dirname(__file__)
fullDataPath = os.path.join(filePath, '../resources/avgQuote2Vec/fullDataset/')
polSubsetPath = os.path.join(f... |
import logging
from datetime import datetime
from pathlib import Path
from typing import List
import pytz
from overhave.entities import (
BaseFileExtractor,
FeatureExtractor,
FeatureModel,
OverhaveFileSettings,
ScenarioModel,
TagModel,
)
from overhave.scenario import ScenarioParser
from overha... |
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2016 <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
# t... |
"""Measuremt classes for ID feedforward tables."""
import time as _time
import numpy as _np
from siriuspy.devices import SOFB as _SOFB
from siriuspy.devices import APU as _APU
from siriuspy.devices import IDCorrectors as _IDCorrectors
from siriuspy.devices import APUFeedForward as _APUFeedForward
from ..utils import... |
from typing import Optional
import torch.nn as nn
from torch import Tensor
from utils.pytorch import get_total_params
from utils.string import to_human_readable
class ContractingBlock(nn.Module):
"""
ContractingBlock Class
Performs a convolution followed by a max pool operation and an optional instance ... |
import sys
import PIL
import numpy as np
import cv2 as cv
import cv2
import time
import os
from PIL import ImageDraw
from PIL import Image
from PIL import ImageFont
from model.yolo_model import YOLO
import HyperLPRLite as pr
from demo import drawRectBox
from Vehicleidf import process_image, get_classes, draw
from Ma... |
# Provides Translator objects, that handle specific objects and return 'translated' versions of them - e.g adding emojis, changing the language, correcting spelling, and so on.
from abc import ABC, abstractmethod, abstractproperty
from concurrent.futures import process
from typing import Optional, Union, Callable, List... |
from tornado import web
from tornado.httputil import url_concat, split_host_and_port
from urllib.parse import urlparse, parse_qs, parse_qsl, urlunparse, urlencode
from tornado.log import app_log
import time
from copy import deepcopy
from tornado_sqlalchemy import as_future, SessionMixin, SQLAlchemy
from lxml import e... |
"""
Visualization functions for the st analysis package
"""
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import transforms
from matplotlib.colors import ListedColormap
import numpy as np
color_m... |
"""`main` is the top level module for your Flask application."""
from datetime import date, datetime, timedelta
from dateutil import parser as date_parser
import json
import logging
import os
import pytz
import six
# Import Flask Framework modules
from flask import Flask, flash, request, redirect, render_template, se... |
__author__ = "adrn <<EMAIL>>"
# Standard library
import os
# Third-party
from astropy.constants import G
from astropy import log as logger
from astropy.coordinates.angles import rotation_matrix
import astropy.coordinates as coord
import astropy.units as u
import matplotlib.pyplot as pl
import numpy as np
import scipy... |
import json
import uuid
from datetime import datetime
from bson import ObjectId
from flask import Blueprint, request, redirect, flash, abort, session
from mongolia.constants import ID_KEY
from backend.admin_portal.common_helpers import (validate_cohort, raise_400_error)
from backend.admin_portal.survey_builder_helper... |
# Copyright 2016 <NAME> (INAC / CEA Grenoble).
#
# This file is subject to the 2-clause BSD license as found at
# http://kwant-project.org/license.
"""Replace symmetries of Kwant builders with momentum parameters to the
system."""
import sys
import collections
import cmath
import numpy as np
import tinyarray as ta
i... |
# Copyright 2017 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... |
import json
import os
from collections import Counter
from datetime import datetime
from typing import List
from uuid import uuid4
import joblib
from fedot.core.chains.node import Node, PrimaryNode, SecondaryNode
from fedot.core.log import Log, default_log
from fedot.core.operations.atomized_template import AtomizedM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.