text
stringlengths
3.07k
22.1k
import glob import hashlib import os import torch from tqdm import tqdm from fairseq import utils, distributed_utils import numpy as np import ujson as json from fairseq.data.indexed_dataset import IndexedDatasetBuilder, IndexedCachedDataset FED_VERSION_FN = 'fed_version.v3.idx' def dist2topk(out_dist, k): topk...
import pandas as pd import numpy as np from threading import RLock from functools import lru_cache _NOT_FOUND = object() class cached_property: # cached_property from functools python 3.8 # https://github.com/python/cpython/blob/master/Lib/functools.py#L1169 # NOTE functools.lru_cache() applied on class ...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """Test pi...
__author__ = 'jasper.zuallaert' import sys import numpy as np import InputManager as im import os import warnings os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf MAXIMUM_LENGTH = 1002 # hard-coded maximum length, for now # Called from SingleTermWorkflow, or as a standalone python script # Takes a tr...
from astropy import table from astroquery.solarsystem.pds import RingNode from astroquery.solarsystem.jpl import Horizons from astropy.coordinates import Angle import astropy.units as u from astropy import convolution from photutils import aperture import numpy as np from PyAstronomy import pyasl from collections imp...
from dataset import RGBFrames, OpticalFlowStack from model import TSN from torchvision import utils, transforms, models from torch.utils.data import Dataset, DataLoader from torchvision.transforms import Compose, Normalize, Resize, RandomHorizontalFlip, RandomApply, RandomCrop, RandomResizedCrop import torch import num...
# Copyright 2020 The OpenAGI Datum 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 or agreed ...
# Made by <NAME> # www.lorenzoros.si import json import time import logging from math import sqrt from pathlib import Path from PIL import Image, ImageFont, ImageDraw from OSMPythonTools.nominatim import Nominatim from OSMPythonTools.overpass import overpassQueryBuilder, Overpass # translate variables def map(value...
#!/usr/bin/env python # coding: utf-8 """ The bruker scope turns off the PMT during stimulation times, so fluorescence on certain lines are balnked. Using a combination of setting a threshold for the pixel-averaged fluorescence time-series and stim times from analog ttl (extracted using bruker_data_process), identify...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 16 22:03:38 2018 @author: timmimim """ from bottle import route, run, template, request, response import time import numpy as np import image_operations as img_ops import os from subprocess import Popen from subprocess import call import gdal impor...
#!/usr/bin/env python3 import os import pathlib import time import h5py import isce3 import journal import numpy as np from isce3.splitspectrum import splitspectrum from nisar.h5 import cp_h5_meta_data from nisar.products.readers import SLC from nisar.workflows.split_spectrum_runconfig import SplitSpectrumRunConfig ...
import numpy as np import cv2 import sys import os.path import glob import math import json from PyQt5.uic import loadUi from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QCheckBox, QVBoxLayout, QHBoxLayout, QPushButton, QFileDialog, QLineEdit, QWidget, QListWidget class CameraCalibrator(QMainWindow): ...
import matplotlib.pyplot as plt import numpy as np from rockyraccoon.model.core import RaccoonWrapper from typing import List def plot_qml_landscape_binary( X: np.ndarray, y: np.ndarray, wrapper: RaccoonWrapper, cmap="viridis", title="" ): """ Plot the separation boundaries in the 2D input space. A...
#!/usr/bin/env python # -*- coding: utf-8 -*- # filename = utils # author=KGerring # date = 6/12/21 # project poetryproj # docs root """ poetryproj """ from __future__ import annotations import importlib import inspect import io import json import os import pkgutil import textwrap import tokenize from pathlib imp...
import torch from args import get_args from torch import nn from torch.autograd import Variable # Parsing params args = get_args() INPUT_SIZE = 784 REAL_LABEL = 1 FAKE_LABEL = 0 # Loss criterion = nn.MSELoss() dom_weight = 1 adv_weight = 1 # Compute gradient penalty: (L2_norm(dy/dx) - 1)**2 def gradient_penalty(y...
import random import pip import pygame import sys #Zeichnet den Hintergrund des Spiels def draw_bg(): screen.blit(bg_surface,(0, 0)) #Zeichnet den Boden def draw_floor(): screen.blit(floor_surface,(floor_x_postion, 900)) screen.blit(floor_surface,(floor_x_postion + WIDTH, 900)) ...
"""Interface functions to word2vec embedding models. Todo: * In docstrings, add links for references to module functions. """ import os from math import ceil from collections import OrderedDict import numpy from .utils import convert_to_range import smarttimers def read_word_vector(fd, vector_bytes, chunk_size...
import datetime import re import sys import time from hashlib import md5 from html.entities import name2codepoint from html.parser import HTMLParser import importlib import json import dateutil.parser import types from gam import controlflow from gam import fileutils from gam import transport from gam.var import * c...
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2014-2021 <NAME> (The Compiler) <<EMAIL>> # This file is part of qutebrowser. # # qutebrowser 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, ei...
# 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...
#!/usr/bin/env python3 from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree import numpy as np from math import pi, atan2, sqrt # <NAME> to URDF converter def DHMat(theta, d, a, alpha): cos_theta = np.cos(theta) sin_theta = np.sin(theta) cos_alpha = np.cos(alpha) sin_alpha = np...
import numpy as np import scipy.sparse as sp from scipy.sparse import linalg def newton_iteration_finescale(F_Jacobian, Ts, adjs, p, s, time_step, wells,all_ids, rel_tol=1e-3): pressure = p.copy() swns = s.copy() swn1s = s.copy() converged=False count=0 dt=time_step # data_impress['swn1s']=d...
#!/usr/bin/env python3 # # __init__.py """ Format and validate code snippets in reStructuredText files. """ # # Copyright © 2021 <NAME> <<EMAIL>> # # 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...
#! /usr/bin/env python3 from settings import PROJECT_NAME from yaml import dump, load import argparse import os import subprocess import shutil from hashlib import sha256 def rreplace(s, old, new, occurrence=1): li = s.rsplit(old, occurrence) return new.join(li) CONFIGS_BUCKET = 'gs://{}-configs/'.format(P...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Tasvirci by OsmanDE # github.com/OsmanDE/Tasvirci from photogrid_dialog import Ui_GridDialog from gridsetup_dialog import Ui_GridSetupDialog from PyQt5.QtCore import Qt, QObject, pyqtSignal, QRect, QPoint from PyQt5.QtGui import QPixmap, QPainter, QImageReader, QPen from...
# Copyright 2017 Brocade Communications Systems, 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 also obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
""" Copyright (C) 2020 <NAME>, <NAME> Ltd Copyright (C) 2019 <NAME>, ETH Zurich 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 us...
""" This code implements a k-class Classifier per week 6 assignment of the machine learning module part of Columbia University Micromaster programme in AI. Written using Python 3.X for running on Vocareum Execute as follows: $ python3 hw2_classification.py X_train.csv y_train.csv X_test.csv """ # builtin modules fro...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Toro | Copyright (C) 2021 Institute of Computer and Network Engineering (IDA) at TU BS | All rights reserved. | See LICENSE file for copyright and license details. :Authors: - <NAME> - <NAME> - <NAME> - <NAME> Description ---------...
##### RENDER.PY ##### ## FOR LIVE from viz.utils import * ## #styling external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css', 'https://codepen.io/chriddyp/pen/brPBPO.css'] # Options lists for cycles. Move to callback when metadata available options_list=['end_planting_day','fertilizer_rate','...
import os import shutil import time import random import numpy as np import math import sys sys.path.append('../../') from utils import * from pytorch_classification.utils import Bar, AverageMeter from NeuralNet import NeuralNet import tensorflow as tf args = dotdict({ 'architecture': 'CNN', 'lr': 0.001, ...
"""Belief Trackers KFbelief : Belief Update using Kalman Filter UKFbelief : Belief Update using Unscented Kalman Filter using filterpy library """ import numpy as np import envs.env_utils as util from numpy import linalg as LA import pdb from filterpy.kalman import JulierSigmaPoints, UnscentedKalmanFilter, ExtendedK...
# Copyright 2020 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 agreed to in writing, ...
import re from typing import Optional, Union, Dict from pprint import pformat import yaml import waiting from kubernetes.client import ApiClient, CustomObjectsApi from kubernetes.client.rest import ApiException from tests.conftest import env_variables from .base_resource import BaseCustomResource from .cluster_deploy...
# lhy # 2017.4 import re import json import cPickle def str_rep(text, rep): rep = dict((re.escape(k), v) for k, v in rep.iteritems()) pattern = re.compile("|".join(rep.keys())) text = pattern.sub(lambda m: rep[re.escape(m.group(0))], text) return text def add_relation(text, d_words): pattern = re...
''' Created on Feb 26, 2019 @author: xbbntni ''' import json from datetime import date from src.sqlite_executer.ConnectExecuteSqlite import SQLExecuter import os class Project(): def __init__(self, basePath=None, projectDirName=None, projectName=None, natures=list()): self.basePath = basePath se...
# -*- coding: utf-8 -*- from __future__ import print_function import requests import json import datetime import pickle import os.path import webbrowser import random import wikipedia import time import os from time import ctime from configparser import ConfigParser import speech_recognition as sr from gtts import gT...
""" This experiment tests predictive performance. """ import os import sys import time import argparse import resource from datetime import datetime import numpy as np import pandas as pd from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedShuffleSplit from sklearn.model_sele...
import json import random from urllib.error import URLError from urllib.parse import urlencode from urllib.request import urlopen, http, Request import time from datetime import date from Profiler import Profiler import __setup_photo__ as setup class VkError(Exception): def __init__(self, value): self.val...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import ctypes from textwrap import dedent as dd import numpy as np import OpenGL OpenGL.ERROR_CHECKING = True import glfw from glfw import gl # ###################################################################### # Data # ###############...
# -*- coding: utf-8 -*- __author__ = 'LyddonBeni' import numpy as np from matplotlib import pyplot as plt import scipy as sc import numpy as np print (""" ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ UNIVERSIDAD NACIONAL DE HUANCAVELICA FACULTAD DE CIENCIA...
from __future__ import unicode_literals import frappe from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability class RestaurantManage: @staticmethod def production_center_notify(status): object_in_st...
from dronekit import connect, VehicleMode, LocationGlobalRelative import time import os, re import pyrebase import firebase_admin from firebase_admin import credentials from google.cloud import firestore import board import adafruit_hcsr04 def arm_and_takeoff(aTargetAltitude): """ Arms vehicle and fly to aTarg...
#!/usr/bin/env python import asyncio import csv import json import logging import random import re import time from collections import defaultdict from copy import deepcopy from os import getenv from random import choice from typing import Callable, Dict import sentry_sdk from common.ignore_lists import FALSE_POS_NP...
import argparse import os import tempfile import h5py import numpy as np import pandas as pd import requests def download_protein(out_dir): protein_url = "https://archive.ics.uci.edu/ml/machine-learning-databases/00265/CASP.csv" with tempfile.TemporaryDirectory() as tmp_dir: protein_file = os.path.jo...
import pandas as pd import re def getTableDict(s_list, table, join): # table_dict = {} tables = [table] for j in join: tables.append(j.split('join ')[1].split(' ')[0]) for t in tables: if len(join) == 0: s_list.append("df = pd.read_csv('{0}.csv')".format(t)) else: ...
from pytranslate import * ######################### ### Cantorr2 Function ### ######################### def block17340(v): v = Stack({}, v) if ((v["x"] > 0) and (v["x"] <= (1 / 3))): v["ret"] = cantorr2((3 * v["x"]), (v["n"] + (-1))) if (((1 / 3) < v["x"]) and (v["x"] < (2 / 3))): v...
from click import option import typer from removebg import RemoveBg import config import time import yfinance as yf import pyfiglet import pandas as pd import matplotlib.pyplot as plt from wordcloud import WordCloud import random from pick import pick from scihub import SciHub app = typer.Typer() sh = SciHub() def r...
''' Code for CRNN model and it's training. Also has the data_generator used. The neccessary reshaping of the matrices and normalization etc. done here. Take note of the paths to the data_generator. Previous knowledge of generators and keras/tensorflow required to understand the code. ''' import numpy as np import l...
from pathlib import Path from typing import Dict, List import numpy as np import util.dist as dist import json from functools import reduce from util.box_ops import np_box_iou class HCSTVGGiouEvaluator: def __init__( self, hcstvg_path: str, subset: str = "test", verbose: bool = ...
# -*- coding: utf-8 -*- import numpy import time import os import magdynlab.instruments import magdynlab.controllers import magdynlab.data_types import threading_decorators as ThD import matplotlib.pyplot as plt @ThD.gui_safe def Plot_ColorMap(Data): f = plt.figure('ZxH', (5, 4)) extent = numpy.array([Data['...
#! usr/bin/env python # fetch_dip.py # This script is designed to be run at regular intervals, for example from a crontab. # # Downloads a DIP from Archivematica to the TMP_DIR and extracts the tarball. # Derivatives are created for each file in its objects directory, and they are moved, # along with the original file...
# -*- encoding: utf-8 -*- # Copyright (c) 2003, <NAME>. All Rights Reserved. # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. # This library 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 Foun...
""" Authors: <NAME> (nUSP: 11809746) <NAME> (nUSP: 11807702) <NAME> (nUSP: 11809090) Computacao III (CCM): EP 2 Cubic interpolating splines: SquareMatrix, Tridiagonal, Periodic EP 3 QR Factorization: Qr """ from numerical.matrix.linear_space import RealSpace import numpy as np class Square...
class IntentMap(): # Default constructor for init class def __init__(self): self.__map = {} # Matches one intent to a method to execute def add(self, intentName, method): self.__map[intentName] = method # execute an intent that matches with given in the response, # the respons...
import torch import copy import time import os import threading import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.multiprocessing as mp from copy import deepcopy from rl_suite.algo.cnn_policies import SACRADActor, SACRADCritic from rl_suite.algo.replay_buffer import SACRADBuffer ...
import pytest # label_studio from label_studio import blueprint as server from label_studio.tests.base import goc_project @pytest.fixture(autouse=True) def default_project(monkeypatch): """ apply patch for label_studio.server.project_get_or_create() for all tests. """ monkeypatch....
from rest_framework import generics, status, permissions from rest_framework.response import Response from rest_framework.decorators import api_view, permission_classes from django import forms import json, base64, io, os import random import string import time from .models import Company, Urls from video.models impor...
import argparse import collections import gzip import json import logging import os import tqdm import numpy as np import s2and from s2and.data import ANDData from s2and.consts import CONFIG from s2and.text import counter_jaccard, cosine_sim, STOPWORDS logger = logging.getLogger(__name__) DATASETS = [ "aminer",...
#!/usr/bin/python3 # simple script flow from email import policy import os import asyncio import click import numpy as np import shutil import glob import asyncio from time import sleep from pathlib import Path import scriptflowlib as sf @click.group() def cli(): pass # ----------------------------- TASKS ---...
import io import json import logging import os import os.path import sys import types import time import requests from enum import Enum from pathlib import Path # Azure CV Support from azure.cognitiveservices.vision.computervision import ComputerVisionClient from msrest.authentication import CognitiveS...
import os import gc import time import joblib import pandas as pd import numpy as np from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_absolute_error, median_absolute_error from datetime import datetime from threading import RLock, Thread from .util import PoolObject, yobit_err, form...
# -*- coding: utf-8 -*- """Data collections and attributes.""" # Part of Clockwork MUD Server (https://github.com/whutch/cwmud) # :copyright: (c) 2008 - 2017 <NAME> # :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt) from collections import abc from .logs import get_logger from .utils import cla...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import argparse import multiprocessing import numpy as np import torch from torch import nn, Tensor import torch.nn.functional as F from torch_geometric.data import Data as GeometricData, Batch from ctp.util import make_batches from ctp.clutrr im...
""" 815. Bus Routes Hard You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever. You will start at the bus stop sou...
# In[]: import pyjeasy.file_utils as f import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os from sys import exit as x import torch import torch.nn as nn import cv2 import matplotlib.pyplot as plt import torchvision from torch.utils.data import Dataset, ...
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
# -*- coding: utf-8 -*- # MDclt.primary.amber.log.py # # Copyright (C) 2012-2015 <NAME> # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD license. See the LICENSE file for details. """ Classes for transfer of AMBER simulation logs to h5 """ #################...
# The MIT License (MIT) # Copyright (c) 2019 by the xcube development team and contributors # # 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...
import base64 from bs4 import BeautifulSoup import datetime import json from os.path import isfile, getsize import re import requests import six import sqlite3 import urllib import webbrowser from constants import * def authenticate_client(): """ Spotify's Auth Flow, a three steps process """ auth_code = get...
from basicsr.utils.registry import ARCH_REGISTRY from torch import nn as nn from torch.nn import functional as F from torch.nn.utils import spectral_norm import torch class add_attn(nn.Module): def __init__(self, x_channels, g_channels=256): super(add_attn, self).__init__() self.W = nn.Sequential...
from requests import get, Session # requests import sys # from bs4 import BeautifulSoup # beautifulsoup4 / lxml import urllib.parse # import os # from mpegdash.parser import MPEGDASHParser # mpegdash from datetime import datetime, timezone from tqdm import tqdm # tqdm import platform import shutil import re ...
import numpy as np import pytest from threes import threes_util # A series of sample lines, with the results of moving them left or right. SAMPLE_LINES_BOTH_DIRECTIONS = [ # Move spaces. ([0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]), ([1, 0, 0, 0], [1, 0, 0, 0], [0, 1, 0, 0]), ([0, 0, 0, 1], [0, 0, 1, 0]...
import numpy as np import pandas as pd import sqlalchemy import datetime as dt from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify ################################################# # Database Setup ##############...
# ****************************************************************************** # # django-loader, a configuration and secret loader for Django # # loader.py: main loader functions # # Copyright (C) 2021 <NAME> <<EMAIL>>. # # SPDX-License-Identifier: MIT # # ***********************************************************...
import math import torch import torch.nn.functional as F import numpy as np import os, sys import time import tabulate import data import training_utils import nets as models from parser_train import parser columns = ["ep", "lr", "tr_loss", "tr_acc", "te_loss", "te_acc", "time"] def cross_entropy(model, input, target...
import numpy as np import pybullet as p #import matplotlib.pyplot as plt import os import torch import shutil import torch.autograd as Variable #import matplotlib as mpl #from mpl_toolkits.mplot3d import Axes3D def get_view(opt): def getview (width=600, height=600, look=[-0.05, -0.3, 0.0], dist=0.25, direct=[0.0,...
# # Python Test Signal Library # # Copyright (C) 2018 <NAME> All rights reserved. # # This file may be used under the terms of the MIT License # # Author: <NAME> # Date: March, 2018 # import numpy as np import scipy.signal as sig def make_random_signal(nsamp): """Make a single trace with random reflectivity ...
import math import os import shutil import sys import time import torch import torch.distributions as dist import torch.nn.functional as F # Classes class Constants(object): eta = 1e-6 eps =1e-8 log2 = math.log(2) log2pi = math.log(2 * math.pi) logceilc = 88 # largest cuda v s.t. exp(v) < inf ...
from enum import Enum import logging from typing import List, Optional from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, CURRENT_HVAC_OFF, HVAC_MODE_AUTO, HVAC_MODE_COOL, H...
# -*- coding: utf-8 -*- """ This file contains API calls and Data """ import six from sys import path from termcolor import colored from os import geteuid from os import path from .data import * __version__ = "1.0.0" __all__ = ["run_console", "run", "GlobalParameters"] # -----------------------------------------...
#/usr/bin/env python3 # -*- coding: UTF-8 -*- # # This file is part of ubuntu-first-steps # # Copyright (c) 2020 <NAME> <a.k.a. atareao> # # 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 with...
""" # -*- coding: utf-8 -*- Created on Thu Dec 17 10:10:35 2015 @author: ajaver """ import os import stat import xml.etree.ElementTree as ET import tables import numpy as np import csv from collections import OrderedDict #%% Read/Store the XML file with the pixel size and fps info def storeXMLInfo(info_file, masked...
import CoolProp.CoolProp as CP import numpy as np import matplotlib.pyplot as plt import pandas as pd # Constant Parameters RC = 80 #kW Tevap = 5 #Degree Celsius Tcond = 45 #Degree Celsius Twi = 30 #Water inlet temp; Degree Celsius Twe = 35 #Water outlet temp; Degree Celsius Do = 0.016 #Pipe outer diameter;...
from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, Generator, Iterable, List, Optional, Set from .errors import ParseError from .properties import EnumProperty, ListProperty, Property, property_from_dict from .reference import Reference from...
import os import numpy as np from keras.preprocessing import image import cv2 import dlib # PATH TO ALL IMAGES # global basedir_celeba, basedir_cartoon, image_paths_celeba, image_paths_cartoon, target_size global basedir_celeba, basedir_celeba_test, image_paths_celeba, image_paths_celeba_test, target_size basedir_cel...
import sys import uuid from appscale.common.unpackaged import APPSCALE_PYTHON_APPSERVER from cassandra.query import ( ConsistencyLevel, SimpleStatement ) from tornado import gen from appscale.datastore.cassandra_env.retry_policies import NO_RETRIES from appscale.datastore.cassandra_env.tornado_cassandra import To...
#!/usr/bin/env python # coding: utf-8 # # NLP of Prime Minister Narendra Modi's Tweets during COVID-19 # #### By <NAME> # In this project, I gathered a dataset from https://www.kaggle.com/saurabhshahane/twitter-sentiment-dataset and use the pretrained data to train a set of ~3500 tweets from Prime Minister Narendra ...
# coding: utf-8 import re import json import traceback from datetime import datetime from flask import current_app, get_flashed_messages from jinja2 import Markup from xml.sax.saxutils import escape from chiki_base import time2best as _time2best, is_ajax, url_with_user, markup __all__ = [ 'markup', 'markupper', 'f...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=missing-docstring import json import logging import os import sys from jinja2 import Environment, FileSystemLoader import redis import requests requests.packages.urllib3.disable_warnings() logger = logging.getLogger(__name__) def here(path=''): re...
import numpy as np from abc import ABCMeta, abstractmethod from sitator.SiteNetwork import SiteNetwork from sitator.SiteTrajectory import SiteTrajectory try: import quippy as qp from quippy import descriptors except ImportError: raise ImportError("Quippy with GAP is required for using SOAP descriptors.")...
import os import numpy as np import matplotlib.pyplot as plt import wandb from lib.utils_vis import SamplePool, to_alpha_1ch, to_rgb_1ch def visualize_batch(x0, x, save=True, text=''): plt.style.use("Solarize_Light2") vis0 = to_rgb_1ch(x0) vis1 = to_rgb_1ch(x) # vis0 = x0[...,0] # vis1 = x[...,0] ...
from math import floor, ceil from time import time from pathlib import Path from zipfile import ZipFile from urllib.request import urlretrieve from contextlib import contextmanager import random from pprint import pprint import json import numpy as np import pandas as pd import joblib from sklearn.model_selection impo...
# -*- coding: utf-8 -*- """ Created on Mon Jan 4 09:58:31 2021 @author: Larisa """ import numpy as np import sympy as sym import matplotlib.pyplot as plt import math ### Proceduri -> Ex1 def difFinProg(X, Y): """ x oarecare -> f'(x) = (f(x+h) - f(x)) / h pt discretizare ...
import typing from d3m.metadata import hyperparams, base as metadata_module, params from d3m.primitive_interfaces import base, clustering from d3m import container, utils import numpy as np from scipy.linalg import orth import os Inputs = container.ndarray Outputs = container.ndarray DistanceMatrixOutput = container.n...
def plot_categorical_bars(df, column, hue=None, colors = None, normalized = True, figsize=(10,4), display_val = True): ''' Creates a column plot of categorical data using seaborn ''' norm = len(df) if normalized else 1 y = 'percent' if normalized else 'count_values' columns = [col for col in...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import numpy as np import nibabel as nb import pandas as pd from scipy.spatial.distance import pdist, squareform from scipy.stats import pearsonr from nipype import logging from nipype.interfaces.base import ( BaseInterfaceInputSpec, TraitedSpec, SimpleInterf...
from collections import defaultdict, deque import datetime import time import torch import torch.distributed as dist import errno import os import cv2 import numpy as np class SmoothedValue(object): """Track a series of values and provide access to smoothed values over a window or the global series average. ...
# Copyright 2018 Microsoft Corporation # # 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...
import numpy as np import pandas as pd import os import tensorflow as tf from tensorflow.contrib import tpu from tensorflow.contrib.cluster_resolver import TPUClusterResolver import sys from subprocess import Popen import time l_shipdate = 0 l_discount = 0 l_quantity = 0 l_extendedprice = 0 l_tax = 0 l_returnflag = 0...