text stringlengths 3.07k 22.1k |
|---|
from typing import Any, Callable, Dict, List, Union
from functools import partial
from catalyst.core import Callback, CallbackOrder, IRunner
from catalyst.registry import REGISTRY
def _tuple_wrapper(transform: Callable):
def wrapper(*inputs):
"""Function wrapper for tuple output"""
output = trans... |
import pandas as pd
import numpy as np
from collections import Counter
from itertools import dropwhile
from burst_detection import *
import seaborn as sns
import matplotlib.pyplot as plt
blog_blue = '#64C0C0'
blue_cmap = sns.light_palette(blog_blue, as_cmap=True)
red_cmap = sns.light_palette('#e43d00', as_cmap=True... |
import torch
import torch.nn as nn
import torchvision.models as models
class UNet_Double_Conv(nn.Module):
def __init__(
self, in_features, out_features,
batch_norm=None, kernel_size=3, padding=0
):
super().__init__()
module_list = []
module_list.append(
nn.C... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2020 Apple Inc. All Rights Reserved.
#
import csv
import pathlib
import numpy as np
import pandas as pd
def try_float(x):
try:
return int(x)
except:
try:
return float(x)
except:
return x
# keys ... |
import tensorflow as tf
from utils.models.relational_memory import RelationalMemory
from tensorflow.python.ops import tensor_array_ops, control_flow_ops
from utils.ops import *
embedding_size = 16
filter_sizes = [3, 3, 3, 3, 3]
num_filters = [128, 256, 128, 256, 512]
num_blocks = [2, 2, 2, 2]
cnn_initializer = tf.ke... |
import logging
import os
import re
import tempfile
import time
import math
import mock
import torch
from torch import nn
from torch.utils.data import DataLoader
import tensorflow.compat.v1 as tf
import cpu.logger as logger
from cpu.hooks import EvalHook, HookBase
from cpu.trainer import Trainer, MetricStorage
tf.dis... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 23:29:54 2020
@author: Yuri
"""
import os.path # for check existance of the spm file
import numpy as np
import shelve
import pickle
from Pars_class import Pars_gen
from make_Results import make_Results
from import_AFM_data import Bruker_import
from ting... |
from sqlalchemy import create_engine, MetaData, Table, select, join
import pandas as pd
import re
# SQLite path
db_path = 'sqlite:///C:\\covid_proteomics\\Covid-19 Study DB.sqlite'
def get_omics_data(with_metadata=False, dataset="proteomics"):
omics_id_dict = {
"proteomics":1,
"lipidomics":2,
... |
"""
Created on July 31 13:04, 2020
@author: fassial
"""
import math
import random
import numpy as np
# encode params
W = 8
HMAX = 8
"""
_get_binaryencode:
get the corresponding binary-encode
@params:
value(int) : real number
w(int) : bit width
@rets:
res(np.array) ... |
import random
import sys
import pygame
from pygame.locals import *
from lib.commonmath import mmval
from lib.events import EventPublisher, EventSubscriber
from lib.states import State, StateManager
from lib.font import Font
# Simple, synchronous pub/sub system.
events = EventPublisher()
# Game settings.
... |
from collections.abc import Mapping
from xml.etree import ElementTree
import logging
log = logging.getLogger(__name__)
def xmlstr(node):
""" Helper function dumping the full XML representation of a node
"""
return ElementTree.tostring(node, encoding="unicode", method="xml")
def innerXML(node):
"""... |
"""
test_records.py
Test the records module
"""
from decimal import Decimal
from datetime import date, time, datetime
import unittest
import zoom
from zoom.records import Record, RecordStore, table_of
from zoom.database import setup_test
class Person(Record):
pass
class TestPerson(Record):
pass
... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import pandas as pd
import numpy as np
import re
from nltk.corpus import stopwords
from keras.callbacks import EarlyStopping
from keras.models import Sequential
from keras.layers import Dense, Embedding, LSTM, SpatialDropout1D,Flatten,GlobalMaxPool1D
from keras.layers.embeddings import Embedding
from keras.preprocessin... |
import os
import threading
import numpy as np
import shutil
from math import exp
from PIL import Image
import matplotlib.pyplot as plt
from network import VGG19
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.autograd import Variable
from torchvision.utils import save_image
class dehazi... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -------------------------------------------------------------------------
import os
import re
import stat
import shutil
import argparse
import tempf... |
import os, io, re, zlib, aiohttp, dotenv
import nextcord as discord
from nextcord.ext import commands
from typing import Dict
from util.extras import fuzzy
from util.messages import DeleteMessage
from util.messages.buttons.docs import DocsView
from algoliasearch.search_client import SearchClient
dotenv.load_dotenv()
... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... |
import time
import argparse
import os as os
import numpy as np
import logging
import json
import random
import torch
import openml
from sklearn.model_selection import train_test_split
from IPython import embed
from pathlib import Path
import ConfigSpace as cs
from autoPyTorch import HyperparameterSearchSpaceUpdates
fr... |
import json
import random
import re
from os import path
import asyncio
from aiocqhttp import Event
from nonebot import CommandSession, get_bot, on_command
from nonebot.permission import *
from utils_bot.command_ops import force_private
from utils_bot.logging import logger
from utils_bot.typing import Union
FAILED_... |
from django.shortcuts import render, redirect
from requests.api import request
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.http import Http404
from django.core.mail import send_mail, send_mass_mail
import requests, datetime
from .models import Country, LastMod... |
import streamlit as st
import plotly.express as px
import re
import pandas as pd
from user_agents import parse
def main():
# Lb type picker
lb_type = st.sidebar.radio(
"LB Type",
(
"AWS Classic",
"AWS Application",
),
)
st.markdown(
"<h1 style='... |
from argparse import ArgumentParser
import subprocess
import os
import sys
import glob
import shutil
from signalalign.nanoporeRead import NanoporeRead
from signalalign.utils.multithread import *
from signalalign.tools.fast5_lookup import RUN_NAME, FAST5_LOCATION, READ_ID, FAST5_ROOT
# KEY_ID = "id"
# KEY_S3_ROOT = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tools related to handling overlaps.
Currently implemented to be used with a minimap (https://github.com/lh3/minimap) file.
Includes overlap class, functions that create a sparse matrix from the overlaps,
and a function that computes the absolute positions of the read... |
#!/usr/bin/env python
# *****************************************************************
# (C) Copyright IBM Corp. 2020, 2021. 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 Licen... |
#!/usr/bin/env python3
import re
import os
import sys
import requests
import argparse
import concurrent.futures
print ('''\033[1;97m __ __ __
/ /_ ____ ______/ /_ / /_ ____ __ __
/ __ \/ __ `/ ___/ __ \/ __ \/ __ \/ / / /
/ / / / /_/ (__ ) / / / /_/ / /_/ / /_/ /
/_/ /_... |
# Bayesian online changepoint detection (BOCD)
# Based on @gwgundersen's work: https://github.com/gwgundersen
# Author: <NAME> (@gerdm)
import jax
import jax.numpy as jnp
from jax.scipy import stats
from functools import partial
from itertools import product
class GMM:
def __init__(self, transition_matrix, means,... |
import matplotlib.pyplot as plt
from Zhihu.NN.Layers import *
from Zhihu.NN.Optimizers import *
from Util.ProgressBar import ProgressBar
class NNVerbose:
NONE = 0
EPOCH = 1
METRICS = 2
METRICS_DETAIL = 3
DETAIL = 4
DEBUG = 5
# Neural Network
class NNBase:
def __init__(self):
... |
import logging
import sys
import os
import re
import argparse
import pandas as pd
import numpy as np
from ete3 import NCBITaxa
from multiprocessing import Pool
from functools import partial
from mtsv.utils import config_logging, line_generator, get_ete_ncbi
from mtsv.parsing import parse_output_row, file_typ... |
import collections
import datetime
import json
import mimetypes
import pathlib
from typing import Optional
from dsw_data_seeder.config import SeederConfig
from dsw_data_seeder.connection import CommandWorker, CommandQueue, \
Database, S3Storage, PersistentCommand
from dsw_data_seeder.consts import DEFAULT_ENCODIN... |
import os
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader
from tqdm import tqdm
import numpy as np
from tensorboardX import SummaryWriter
import sys
import time
import json
from qanet.tvqanet import TVQANet
from tvqa_dataset import TVQADataset, pad_coll... |
from datetime import datetime
from flask import Blueprint, render_template, g, request, current_app, session, redirect, url_for, flash, abort, json
from flask.ext.login import login_user, logout_user, current_user, login_required
from flask.ext.babel import gettext
from urlparse import urlparse
from random import randr... |
import pygame as pg
from pathlib import Path
from typing import Tuple, Dict
from pygame.locals import *
from nes.bus import Bus
from nes.cartridge import Cartridge
from nes.cpu import CPU
def load_font(file: str, size: int) -> pg.font.Font:
"""
Loads a font, prepares it for use.
"""
f... |
from __future__ import print_function
# https://spark.apache.org/docs/2.3.0/api/python/pyspark.html
from pyspark import SparkConf, SparkContext
# https://spark.apache.org/docs/2.3.0/api/python/pyspark.streaming.html
from pyspark.streaming import StreamingContext
# https://spark.apache.org/docs/2.3.0/api/python/pyspark... |
#!/usr/bin/env python3
# This tool runs on the host CPU and gathers all SST related configuration from
# the BMC (Redfish) and from the linux driver, and compares them to catch any
# errors or disagreement. Only required arguments are the details to start a
# Redfish session.
#
# This was tested running on a live Arch... |
import nltk
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger') #for NER
nltk.download('maxent_ne_chunker')
nltk.download('words')
from nltk.tokenize import word_tokenize
from nltk.tag import pos_tag
import json
import numpy as np
from keras.models import load_model #USE JOBLIB instead
import random
i... |
""" Contains the base class for the Dataset (1 and 2 dimensional) and a function
that takes a Pytorch tensor and converts it to a numpy array"""
import torch
import numpy as np
from numpy import ndarray
from numpy.random import default_rng
from deepymod.data.samples import Subsampler
from abc import ABC, ABCMeta... |
import cv2
import numpy as np
import copy
import math
from scipy.spatial import distance as dist
from imutils import face_utils
from threading import Thread
import playsound
import argparse
import imutils
import time
import dlib
import new_nearby_places
import phone
from location import get_location
from text_to_speech... |
import time
import os
import datetime
import tensorflow as tf
import matplotlib.pyplot as plt
import denoising_autoencoder as u
import numpy as np
from sklearn import svm
import pickle
# # from tensorflow.examples.tutorials.mnist import input_data
# mnist = input_data.read_data_sets("MNIST_data/", one_hot=False)
# tf.f... |
import abc
import numpy as np
import scipy.stats as spst
import scipy.optimize as spop
class AssetAllocABC(abc.ABC):
n_asset = 1
rho = None
sigma = np.array([1.0])
ret = np.array([0.0])
cor_m = np.eye(1)
cov_m = np.eye(1)
longshort = np.array([1], dtype=np.int8)
def __init__(self, si... |
import tkinter
from tkinter import ttk
import time
def m1_personal_frame(window, mqtt_sender):
"""
Constructs and returns a frame on the given window, where the frame
has Entry and Button objects that control the EV3 robot's motion
by passing messages using the given MQTT Sender.
:type window: ... |
#!/usr/bin/python3
# cloudburst framework - <NAME> 2021 <EMAIL>
import boto3, os, re
import concurrent.futures
from functools import partial
from pathlib import Path
# Copies a file from S3, providing exception handling and logging
def copy_s3_object(bucket_name, key, local_file):
print(f"fetching file: s3://{bu... |
"""rFactor2 Vehicle File Assistant by <NAME> <<EMAIL>>
creates rFactor2 .veh files from predefined lists of teams and classes
this is useful for creating skinpacks/leagues
run with argument -h to see options
"""
import re
import os.path
import sys
"""Provides functions to parse and create certain files
"""
class Fi... |
import os
import json
from pathlib import Path
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
CORE_DIR = Path('/home/user/Projects/syncfolder')
REMOTE_BASE_PATH = '/home/other_user/Projects/syncfolder'
Base = ... |
# Libraries
from PIL import Image as img
from pynput.mouse import Controller
from datetime import datetime
from PIL import ImageGrab
import colorsys
import keyboard
import os.path
import uuid
import winsound
import colorsys
import pyautogui
import sys
import pyfiglet
import cv2
import time
from photo import capture_p... |
#!/usr/bin/env python3
# Adapted from https://automl.github.io/HpBandSter/build/html/auto_examples/example_1_local_sequential.html
# and https://automl.github.io/HpBandSter/build/html/quickstart.html
import random
import logging
import yaml
import argparse
import numpy
import torch
import os
import shutil
from hpband... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 <NAME> (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
Copyright (C) 2019 <NAME> - @CastagnaIT
Kodi library integration: library auto-update, auto-sync
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more infor... |
import numpy as np
from random import shuffle
from scipy.sparse import csr_matrix
from deepneuro.utilities.util import add_parameter
from deepneuro.augmentation.augment import Augmentation
class ExtractPatches(Augmentation):
def load(self, kwargs):
# Patch Parameters
add_parameter(self, kwargs... |
import asyncio
import pytest
from supriya.providers import RealtimeProvider
from uqbar.strings import normalize
from tloen.domain import Application
@pytest.mark.asyncio
async def test_error():
application = Application()
with pytest.raises(RuntimeError):
await application.boot()
@pytest.mark.asyn... |
import base64
import email
import gzip
from email.encoders import encode_base64
from email.message import Message as EmailMessage
from email.utils import formatdate, parseaddr
from io import BytesIO
from quopri import encode as encode_quopri
from django.core.exceptions import ValidationError
from django.core.mail.mess... |
# Copyright 2019 Xiphos Systems Corp.
#
# 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... |
# -*- coding: utf-8 -*-
'''
loadFromExcel.py is an example of a plug-in that will load an extension taxonomy from Excel
input and optionally save an (extension) DTS.
(c) Copyright 2013 Mark V Systems Limited, All rights reserved.
'''
import os, io, time, re
from collections import defaultdict
from arelle import XbrlC... |
import torch
import numpy as np
import numba
import copy
from ...utils import common_utils
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...ops.iou3d_nms import iou3d_nms_utils
import warnings
try:
from numba.errors import NumbaPerformanceWarning
warnings.filterwarnings("ignore", category=Numba... |
#Process level parallelism for shell commands
import os
from os.path import join, basename, split, splitext
import sys
from os import makedirs
from glob import glob
import subprocess as sp
import time
import re
import logging
import argparse
from multiprocessing import Pool
import functools
from tqdm import tqdm
loggi... |
import random
import numpy as np
import torch
import torchvision.transforms as transforms
import torch.utils.data as data
import torchvision.transforms.functional as F
import argparse
import pickle
import os
import time
from random import randint
from PIL import Image
import torchvision
import functools
# from render_s... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Havenir and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class HotelFoodOrder(Document):
def validate(self):
if self.room and self.order_type ==... |
__author__ = '<NAME> <<EMAIL>>'
import csv
from io import StringIO
from io import TextIOWrapper
import logging
import os.path
from pkgutil import get_data
import re
from zipfile import ZipFile
import psycopg2
from psycopg2.extras import execute_values
import requests
# data_type, type, type_version => delimiters, ... |
"""<b>CorrectSpillover - Apply</b> applies an spillover matrix to measurments multichannel image to account for channel crosstalk (spillover)
<hr>
This module applies a previously calculate spillover matrix, loaded as a normal image.
The spillover matrix is a float image with dimensions p*p (p=number of color channels... |
# -*- coding: utf-8 -*-
__author__ = 'anewbigging'
from rwslib import RWSConnection
from rwslib.rws_requests import *
from rwslib.rwsobjects import RWSException
import requests
from requests.auth import HTTPBasicAuth
from lxml import etree
from functools import partial
from rwslib.extras.rwscmd.odmutils import xml_pr... |
# Coded by <NAME>
# DJI Tello VR Control 1/2 of code
from socket import AI_PASSIVE
import mediapipe as mp
import time
import cv2
class handLandmarkDetector:
def __init__(self, mode=False, maxHands=2, detectionConf=0.5, trackConf=0.5):
self.mode = mode
self.maxHands = maxHands
self.detecti... |
# Learn more about how this code works: https://drive.google.com/file/d/1IX8c8r4-qF5FUlMJmB4n_gyO2ziRt3XO/view?usp=sharing
"""
Package RedblackTree provides a tree data structure to implement associative arrays.
A red-black tree is a special typ of binary search tree with better worst time than other binary trees.... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 <NAME> <<EMAIL>>
#
# This file is part of mplayer.py.
#
# mplayer.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,... |
import os
import re
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchnet as tnt
from sklearn.metrics import balanced_accuracy_score, f1_score
from sklearn.metrics.classification import... |
"""Restaurant Site - Financial Factor Model.
Copyright (c) 2018 <NAME>
See LICENSE for information.
"""
import logging
from datetime import date as Date
from enum import Enum
from gathernomics.models.base import ModelBase
from gathernomics.models.sourcetbl import SourceTable
logger = logging.getLogger("gathernomics... |
from contextlib import contextmanager
from time import sleep
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import exp... |
from __future__ import print_function, division
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from sklearn.utils import check_random_state
def group_lasso_dataset_generator(n_samples=100, n_features=100,
gaussian_noise=0.5, random_state=None):
"""
... |
# Copyright (c) 2020 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 app... |
from toolz import curry
import numpy as np
import pandas as pd
from nfldata.common import process_time_col
from nfldata.lookup import score_before_time
offense_team_stat_columns = [
'rushing_att',
'rushing_yds',
'rushing_tds',
'rushing_twoptm',
'fumbles_lost',
'passing_att',
'passing_cmp',... |
import datetime
import math
import os
import torch
import time
import skimage.io
import skimage.transform
import matplotlib.pyplot as plt
import glob
import torch.optim as optim
import torchvision
from torch.autograd import Variable
import torchvision.transforms as transforms
from skimage import exposure
toTensor =... |
import numpy as np
from scipy.optimize import fsolve
from ..analysis import estimator,variance
def symmetrize(t_correlator):
correlator = np.zeros(shape = (t_correlator.shape[0],t_correlator.shape[1]//2))
Nt = t_correlator.shape[1]
for i_ensamble, ensamble_ele in enumerate(t_correlator):
correlato... |
# MSSV: 19120454
# Họ tên: <NAME>
# =============== Cú pháp tham số dòng lệnh =================
# Chức năng 1: python data-preprocessing.py input.csv list-cols-missing
# Chức năng 2: python data-preprocessing.py input.csv count-rows-missing
# Chức năng 3: python data-preprocessing.py input.csv fill-missing mean/median... |
import os
import json
import boto3
from botocore.exceptions import ClientError, NoCredentialsError, ParamValidationError
from flask import session
from flask_talisman import Talisman
from logger import LOG
CONFIG = {}
def setup_talisman(app):
csp = {"default-src": ["'self'", "https://*.s3.amazonaws.com"]}
... |
from enum import Enum
from typing import Dict, Type, Tuple
from nonebot.typing import overrides
from nonebot.utils import escape_tag
from nonebot.adapters import Event as BaseEvent
from .message import Message
from .api import Message as GuildMessage
from .api import User, Guild, Member, Channel
from .api import Mes... |
# 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
# distributed under t... |
#!/usr/bin/env python
# coding: utf8
#
# Copyright (c) 2019 <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, co... |
# -*- coding: UTF-8 -*-
import os
import time
import numpy as np
import tensorflow as tf
from scipy.optimize import fmin_ncg
from my_utils import load_data_for_HGNN
from hessians import hessian_vector_product
def add_layer(input_data, in_size, out_size, act_func=None, name=None):
weights = tf.Variable(tf.random.... |
#!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from utils import utils, inspector
# http://www.usda.gov/oig/rptsaudits.htm
archive = 1978
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
# - Some reports have li... |
#!/usr/bin/env python
"""
A trivial code line counter for diff.
"""
import argparse
import re
import sys
if sys.version_info < (3, 0):
import __future__
class Line:
def __init__(self, string, line_number):
# String of the line
self.string = string
# Line number. Not be used now.
... |
import unittest
import numpy as np
from skywinder.communication import packet_classes
class test_sip_packet_malfunctions(unittest.TestCase):
def empty_packet_test(self):
buffer = '\xfa\xff\x01\x00\x00\x00\x01'
packets, remainder = packet_classes.get_packets_from_buffer(buffer,
... |
#!/usr/bin/python3
import argparse
import glob
from pathlib import Path
from typing import Any, List, Mapping
import imageio
import numpy as np
import mseg.utils.names_utils as names_utils
from mseg.utils.mask_utils import save_binary_mask_double, rgb_img_to_obj_cls_img, form_mask_triple_embedded_classnames
from mse... |
import logging
import pathlib
import tempfile
from typing import Union, List, Dict, Optional, Any, cast
from urllib.parse import urljoin
from ..parsers.description import Description
from bs4 import BeautifulSoup
from ..network import session_with_proxy
from .source_package import SourcePackage
from .exceptions impor... |
# -*- coding: utf-8 -*-
""" Routine to create hotstart
"""
from shapely.geometry import Point
from scipy.spatial import cKDTree
import numpy as np
from bisect import bisect_left
import csv
import re
import datetime
import struct
import logging
__all__ = ['HotstartGenerator',
'RegionalInitializer',
... |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# pylint: disable=E1101
"""
This module handles file IO for eis_prep.
"""
import numpy as np
import warnings
import re
from astropy.io import fits
from astropy import units as u
import datetime as dt
from eispy import __version__ as eispy_version
from eispy.calibration... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
... |
#!/usr/bin/env python
"""HASY with Tensorflow."""
import input_data
import tensorflow as tf
import tflearn
import tflearn.utils as utils
import tflearn.variables as vs
from tensorflow.python.training import moving_averages
# from tensorflow.python.framework import ops
import os
import numpy as np
epochs = 200000
MO... |
import sys, csv, json, numpy, scipy, math, random
import scipy.cluster.hierarchy as hier
from functools import reduce
# Parse incoming JSON data
with open(sys.argv[1]) as tempfile:
for line in tempfile:
feed = json.loads(line)
# Assign variables
data = json.loads(feed['melted'])
rowHeaders = feed['row']
colHeaders... |
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
from torch.distributions import Normal
import ipdb
class Generator(nn.Module):
def __init__(self, z_dim, image_dim, conv_dim):
super(Generator, self).__init__()
linear ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
#!/usr/bin/env python3
# evolutions: Provides play-evolutions-like functionality for Python
# https://www.playframework.com/documentation/2.7.x/Evolutions
# usage: ./evolutions.py <db_url> <db_user> <db_pass> <evolutions_dir>
import glob, hashlib, logging, os.path as path, re, subprocess, sys
# Clean, u... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from operator import itemgetter
from time import time
import numpy as np
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill
from openpyxl.styles.colors import Color
from openpyxl.utils.cell import get_column_letter
from PIL import Image... |
import numpy as np
import copy
from src.utils.tools import sentence_embedding, format_data
from src.utils import config
import pandas as pd
import joblib
import json
import string
import jieba.posseg as pseg
from PIL import Image
import torchvision.transforms as transforms
def get_autoencoder_feature(data, max_feature... |
# -*- coding: utf-8 -*-
import json
import gzip
import os
import time
import warnings
import requests
from ..external import six
from ..external.six.moves.urllib.parse import urlparse # pylint: disable=import-error, no-name-in-module
from .._internal_utils import _utils
from verta import credentials
from .._inter... |
import tensorflow as tf
import os
import io
import csv
import PIL.Image
from lxml import etree
from object_detection.utils import dataset_util, label_map_util
from tqdm import tqdm
from sklearn.model_selection import train_test_split
import yaml
flags = tf.app.flags
flags.DEFINE_string('data_dir', None, 'Path to the ... |
import tempfile
import pytest
from dagster import (
AssetMaterialization,
DagsterInstance,
DagsterInvalidDefinitionError,
DagsterType,
EventMetadataEntry,
Failure,
IOManager,
InputDefinition,
ModeDefinition,
Output,
OutputDefinition,
RetryRequested,
dagster_type_mate... |
from pyTsetlinMachineParallel.tm import MultiClassTsetlinMachine
from pyTsetlinMachineParallel.tm import MultiClassConvolutionalTsetlinMachine2D
import numpy as np
machine = "TM"
#dim = "9x9Natsukaze_"
#dim = "90_9x9Aya_"
dim = "90_100T_9x9Aya_"
#loadfile = "0310-1211"
loadfile = "0310-1342"
#loadfile = "0302-1057"
#lo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use o... |
import os
import time
import math
import random
import ctypes
import tempfile
import subprocess
import numpy as np
import dsl
import native_backend
PARALLEL = True
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "native_template.c")) as f:
C_TEMPLATE = f.read()
#TEMP_DIR = tempfile.mkdtemp()
... |
# Data reader for book and hotel data.
#
# https://github.com/stefanvanberkum/CD-ABSC
#
# Adapted from Trusca, Wassenberg, Frasincar and Dekker (2020).
# https://github.com/mtrusca/HAABSA_PLUS_PLUS
#
# <NAME>., <NAME>., <NAME>., <NAME>. (2020) A Hybrid Approach for Aspect-Based Sentiment Analysis Using
# Deep Contextua... |
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, <NAME>
#
# This module is part of oyProjectManager and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
import os
import re
import itertools
import shutil
import glob
def all_equal(elements):
"""return True if all the eleme... |
import cv2
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from . import find_bbox_in_heatmap, ModelBuilder
from . import calc_iou, calc_ciou, accuracy
class Encoder(nn.Module):
def __init__(self, a_net, v_net, train_vision):
super(Encoder, self).__init__()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.