text stringlengths 3.07k 22.1k |
|---|
import os
import sys
from random import randint, randrange
import pygame
from classes.Barrier import Barrier
from classes.ChooseButton import ChooseButton
from classes.Cloud import Cloud
from classes.Dino import Dino
from classes.Enemy import Enemy
from classes.FunctionalButton import FunctionalButton
from classes.Po... |
from itertools import chain
from operator import add
import numpy as np
from ._haar import haar_like_feature_coord_wrapper
from ._haar import haar_like_feature_wrapper
from ..color import gray2rgb
from ..draw import rectangle
from ..util import img_as_float
FEATURE_TYPE = ('type-2-x', 'type-2-y',
't... |
import random
import greeting
import platform
from greeting import person1
import datetime
import math
import json
import re
import os
import numpy as np
myvar = "John"
my_var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"
#Illegal variable names:
# emyvar = "John"
# my@ var = "John"
# my var... |
import os
from enum import Enum
from ocr_joplin_notes import file_ocr
from ocr_joplin_notes import joplin_data_wrapper
JOPLIN_TOKEN = "<PASSWORD>"
if os.environ.get('JOPLIN_TOKEN') is not None:
JOPLIN_TOKEN = "token=" + os.environ['JOPLIN_TOKEN']
else:
print("Please set the environment variable JOPLIN_TOKEN")... |
import decimal
import hashlib
import json
import subprocess
import zipfile
from io import BytesIO
from django.conf import settings
class Alignment:
LEFT = 'PKTextAlignmentLeft'
CENTER = 'PKTextAlignmentCenter'
RIGHT = 'PKTextAlignmentRight'
JUSTIFIED = 'PKTextAlignmentJustified'
NATURAL = 'PKText... |
"""
===================
Scene Visualizer
===================
This script helps to set up scenes by detecting BURG printouts and overlaying objects from a given scene file.
Before the overlay can be used, you will have to calibrate your camera to determine intrinsic parameters and
distortion coefficients by using:
> p... |
"""Load excel metadata CSV files form a python data package."""
import importlib.resources
import logging
import pathlib
import dbfread
import pandas as pd
import pudl
logger = logging.getLogger(__name__)
class Metadata(object):
"""Load Excel metadata from Python package data.
Excel sheet files may contai... |
#!/usr/bin/python -B
import os
import sys
import time
import argparse
import logging
import signal
import subprocess
import socket
import sdnroute.linkinfo
import sdnroute.utils
class Xorpsh(object):
BIN = "/usr/local/xorp/sbin/xorpsh"
def __init__(self):
self.cmds = []
def connect(self):
... |
# Lint as: python2, python3
# Copyright 2019 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
#
... |
# Copyright 2018 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... |
import asyncio
import json
import os
import threading
import time
import typing
import pytest
import trustme
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import (
BestAvailableEncryption,
Encoding,
PrivateFormat,
load_pem_private_key,
)
from... |
import imp
import logging
import os.path
from urllib.parse import urlunparse
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.sitemaps.views import sitemap
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from d... |
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2022 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
"""Utility functions for benchmarking."""
import os
import re
import socket
import yaml
import h5py
import numpy as np
from pyradiosky import write_healpix_hdf5
from pyuvsim.simsetup impo... |
import numpy as np
from scipy.linalg import eigh
import h5py
class _CCABase(object):
def __init__(self, numCV = None, reg = None, regs = None, numCC = None, numCCs = None, kernelcca = True, ktype = None, verbose = False, select = 0.2, cutoff = 1e-15, gausigma = 1.0, degree = 2):
self.numCV = numCV
... |
"""
Useful functions used by other support modules and notebooks
"""
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from typing import Dict, List, Optional
from scipy import stats
from nu_aesthetics.single_colors import brand, d... |
import glob
import os
from typing import List
import matplotlib.pyplot as plt
import seaborn as sn
import torch
import wandb
from pytorch_lightning import Callback, Trainer
from pytorch_lightning.loggers import LoggerCollection, WandbLogger
from pytorch_lightning.utilities import rank_zero_only
from sklearn import met... |
"""COMMAND : .runs , .metoo , .rape , .inkut , .pro , .abuse , .gey"""
from telethon import events
import random, re
from uniborg.util import admin_cmd
METOOSTR = [
"`Hm`",
"`Me too thanks`",
"`Haha yes, me too`",
"`Same lol`",
"`Me irl`",
"`Same here`",
"`Haha yes`",
"`Same pinch bsdk... |
# Mix of hm_data & LXMERTs task data files
import json
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
import os
from collections import Counter
from param import args
from sklearn.metrics import roc_auc_score
class HMDataset(Dataset):
def __init__(self, splits):
... |
from __future__ import print_function
import sys, os, numpy, h5py
from pyglib.mbody.coulomb_matrix import U_J_to_radial_integrals, \
radial_integrals_to_U_J
def h5save_usr_qa_setup(material, log=sys.stdout):
'''
A list of questions to be answered to initialize the CyGutz job.
'''
f = h5py.File... |
import numpy as np
import rbmpy.rbm as rbm
import logging, math
from rbmpy.sampler import VanillaSampler
from rbmpy.progress import Progress
from scipy.special import expit
class VanillaTrainier(object):
"""Trainer that can knows how to update an RBM weights and hidden/visible states, requires a `Sampler`.
... |
from dataclasses import dataclass, field
from typing import Union
import numpy as np
from scipy.integrate import quad
import matplotlib.pyplot as plt
from sputterINPUT import *
from sputterDict import *
from atomic_mass import *
import numba
from numba import jit
import time
from erosionDict import grainsCOMP
from net... |
# 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
# distribu... |
import copy
import pdb
import pandas as pd
import numpy as np
import json
import os
import sys
import atomsci.ddm.pipeline.parameter_parser as parse
import atomsci.ddm.pipeline.model_pipeline as mp
import atomsci.ddm.pipeline.predict_from_model as pfm
import sklearn.metrics as skmetrics
def get_test_set(dskey, split... |
# Ressources
# 1. https://python-pptx.readthedocs.io/en/latest/
# 2. https://stackoverflow.com/questions/32908639/open-pil-image-from-byte-file
# 2. Shapes: https://python-pptx.readthedocs.io/en/latest/user/autoshapes.html
import sys
import os
import io
import json
from PIL import Image
from datetime import datetime
f... |
# Ref: HX711 24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales
# Accession: G00049
import logging
import asyncio
from amaranth import *
from amaranth.lib.cdc import FFSynchronizer
from ... import *
from ....gateware.clockgen import *
from ....support.data_logger import DataLogger
class HX711Error(GlasgowApp... |
from __future__ import print_function
#pragma mark - Flickr API
import flickrapi
import os
import shutil
import types
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.web.client import downloadPage
our_print = lambda *args, **kwargs: print("[FlickrApi]", *args, **kwargs)... |
import pickle
import numpy as np
import os
import scipy.sparse as sp
import torch
from scipy.sparse import linalg
class DataLoader(object):
def __init__(self, xs, ys, batch_size, pad_with_last_sample=True):
"""
:param xs:
:param ys:
:param batch_size:
:param pad_with_last_s... |
# Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... |
import io
import os
import sys
import time
import azure.batch.batch_service_client as batch
import azure.batch.batch_auth as batch_auth
import azure.batch.models as batchmodels
from datetime import datetime, timedelta, timezone
from dotenv import load_dotenv
load_dotenv()
#
# Batch credentials
#
BATCH_ACCOUNT_NAME ... |
"""Support for Tuya Smart devices."""
from datetime import timedelta
import logging
from tuyaha import TuyaApi
from tuyaha.tuyaapi import (
TuyaAPIException,
TuyaAPIRateLimitException,
TuyaFrequentlyInvokeException,
TuyaNetException,
TuyaServerException,
)
from homeassistant.config_entries import ... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 24 10:41:50 2016
@author: dahoiv
"""
# import os
from openpyxl import Workbook
import collections
import nipype.interfaces.slicer as slicer
import pickle
import util
import sqlite3
import nibabel as nib
import numpy as np
import os
BRAINSResample_PATH = '/home/dahoiv/di... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from abc import abstractmethod
from collections import OrderedDict
from enum import Enum, auto
from typing import Dict, List, Optional, Type, cast
from .ede_context import Context, CtxEntry, CtxEntryType
from ..ede_utils import Error, ErrorType, Position, Result
class TSType(Enum):
'''Enumeration for type system b... |
from torch.utils.data.sampler import Sampler
from torch.utils.data import Dataset, DataLoader
from typing import List, Dict
from api.models.utils.dsp import *
from api.models.utils import hparams as hp
from api.models.utils.files import unpickle_binary
from api.models.utils.text import text_to_sequence
from pathlib im... |
"""A lightweight library for common vector and matrix operations."""
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (c) 2007-2012, Python File Format Interface
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... |
"""Surround plugin for Sublime Six"""
import logging
import sublime
import sublime_plugin
from sublime import Region as R
# We assume Six is installed and available.
from Six.lib.errors import AbortCommandError # noqa: F401
from Six.plugin import ActiveViewAwareMixin # noqa: F401
# Hook ourselves up to the Six l... |
"""
@license: MIT
@repository: https://github.com/semontesdeoca/MNPR
_ _______ __
_ __ ___ (_)___ ___ | ___\ \/ /
| '_ \ / _ \| / __|/ _ \ | |_ \ /
| | | | (_) | \__ \ __/ | _| / \
|_| |_|\___/|_|___/\___| |_| /_/\_\
@summary: NoiseFX clas... |
#! /usr/bin/env python
"""
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
from .basic import Basic
from .sorting import ordered
from .sympify import sympify
from sympy.utilities.iterables import iterable
def iterargs(expr):
"""Yield the args of a Basic object in a breadth-first traversal.
Depth-traversal stops if `arg.args` is either empty or is not
an iterable.
Examples
... |
# Copyright 2016 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... |
import random
import aiohttp
import discord
import datetime
from discord.ext import commands, tasks
class funcmds(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.bday_poll.start()
@commands.command()
async def bday(self, ctx: commands.Context, target: discord.Mem... |
from os.path import join, basename, dirname, isfile
import uuid
import zipfile
import glob
from pathlib import Path
import random
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import torch
from fastai.vision import (
ObjectItemList, bb_pad_collate, get_transforms, model... |
import json
from typing import List, Dict
from lppinstru.discovery import Discovery, c_int, trigsrcAnalogOut1
import time, datetime
import zmq, math
import sys, traceback
import functools
import numpy as np
import pandas as pds
import peakutils
import signal,atexit
from threading import Thread
from juice_scm_gse.analys... |
import discord
from utils import emojis
from utils.funcs import get_platform_emoji
from .context import Context
from .exceptions import NoChoice, CannotEmbedLinks
PageT = str | dict | discord.Embed
class Paginator(discord.ui.View):
def __init__(self, pages: list[discord.Embed | str], *, ctx: "Context", **kwarg... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot replicates pages in a wiki to a second wiki within one family.
Example:
python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -o nl li fy
or:
python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -lang:nl li fy
to copy all templates from an n... |
# -*- coding: utf-8 -*-
# Copyright 2012 Yelp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import base64
import codecs
import datetime
import random
import socket
import string
import json
import typing
import asyncio
import ssl
import logging
import ipaddress
import pkg_resources
import contextlib
import certifi
import aiohttp
import functools
import collections
from lbry.schema.claim import Claim
from lbry... |
# Author: <NAME>
"""
Figure 11.16 and 11.17 in the book "Probabilistic Machine Learning: An Introduction by <NAME>"
Dependencies: spams(pip install spams), group-lasso(pip install group-lasso)
Illustration of group lasso:
To show the effectiveness of group lasso, in this code we demonstrate:
a)Actual Data b)Vanil... |
# encoding:utf-8
import socket as sc
import os
import threading
HOST = '127.0.0.1'
PORT = 10010
PEERADDRPORT = ('127.0.0.1', 10086)
class MultiDownload(threading.Thread):
def __init__(self, filename, chunkID, chunkSize, peerAddrPort):
threading.Thread.__init__(self)
self.filename =... |
from flask import Flask, render_template, request
import reed_solomon as rsf
import unireedsolomon as rs
app = Flask(__name__)
transcoding = [chr(i + 97) for i in range(11)]
num_errors = 0
msg_length = 0
@app.route('/')
def home():
return render_template('index.html')
@app.route('/simple', metho... |
import collections
from .providers import AbstractResolver
from .structs import DirectedGraph, build_iter_view
RequirementInformation = collections.namedtuple(
"RequirementInformation", ["requirement", "parent"]
)
class ResolverException(Exception):
"""A base class for all exceptions raised by ... |
# 基于PyTorch复现并修正后的马金TD方法
# 修正:叶子节点选择错误;SGD->Adagrad
import sys
import numpy as np
from models import TD_RvNN_Ma
import time
import random
from torch import optim
import datetime
from evaluate import *
from config import *
from data_io import loadLabel
from get_args import _ma_args
# str = index:wordfre... |
# -*- coding: utf-8 -*-
from aws_lambda_powertools import Logger
from aws_lambda_powertools import Tracer
from aws_lambda_powertools import Metrics
from aws_lambda_powertools.metrics import MetricUnit
import base64
import json
import os
import boto3
from botocore.config import Config
from bs4 import BeautifulSoup
#impo... |
"""
This module provides two classes for managing LayerArtists with Qt.
The LayerArtistModel implements a QtModel to interface with a list of
LayerManagers.
The LayerArtistView is a list widget that displays
these layers, and provides GUI access to the model
"""
# pylint: disable=I0011, W0613, R0913, R0904, W0611
fr... |
import argparse
import colour
import inspect
import importlib
import os
import sys
import yaml
from contextlib import contextmanager
from screeninfo import get_monitors
from manimlib.utils.config_ops import merge_dicts_recursively
from manimlib.utils.init_config import init_customization
from manimlib.logger import lo... |
import abc
from typing import (
Dict,
Any,
TypeVar,
Sequence,
NamedTuple,
Optional,
List,
Union,
Generic,
)
import torch
EnvType = TypeVar("EnvType")
DistributionType = TypeVar("DistributionType")
class RLStepResult(NamedTuple):
observation: Optional[Any]
reward: Optional... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from easydict import EasyDict as edict
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from torchvision.models.resnet import model_urls
from torchvision.models.resnet import BasicBl... |
'''
The Device Array API is not implemented in the simulator. This module provides
stubs to allow tests to import correctly.
'''
from contextlib import contextmanager
from warnings import warn
import numpy as np
from numba.core import types
from numba.np import numpy_support
DeviceRecord = None
from_record_like = No... |
import numpy as np
import tensorflow as tf
from tqdm import trange
from . import dl_ops as ops
def param_dict_to_flag_grid(param_dict):
flag_grid = dict()
for k, v in param_dict.items():
if k in ['EMB_DATASETS', 'DATASETS_INFO', 'NEW_GAME', 'DATA_FOLDER_PATH', 'CONFIG_FOLDER_PATH', 'RESULT_FOLDER_... |
# Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
#
# 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... |
# Copyright (c) 2020 Spanish National Research Council
#
# 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 ... |
# -*- coding: utf-8 -*-
'''
Return salt data via email
The following fields can be set in the minion conf file. Fields are optional
unless noted otherwise.
* ``from`` (required) The name/address of the email sender.
* ``to`` (required) The names/addresses of the email recipients;
comma-delimited. For example: ``<... |
#!/usr/bin/env python3
import os
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree import ElementTree
from xml.dom import minidom
import numpy as np
import random
e_length = 10
e_width = 10
seg_length = 1
w_length = seg_length*e_length
w_width = ... |
#!/usr/bin/env python3
"""
CuFHE code generator for binary random forest regressor
"""
import argparse
import pickle
import numpy as np
import cv2 as cv
import sklearn.ensemble
def parse_args():
"""
Parse command line arguments.
Returns:
args (argparse.Namespace): Parsed command line arguments... |
"""Tools for solving inequalities and systems of inequalities. """
from sympy.core import Symbol, Interval
from sympy.core.relational import Relational, Eq, Ge, Lt
from sympy.core.singleton import S
from sympy.assumptions import ask, AppliedPredicate, Q
from sympy.functions import re, im, Abs
from sympy.logic import A... |
#!/usr/bin/env python
# coding: utf-8
# Import Python modules
import argparse, glob, os, psycopg2
import pandas as pd
from loguru import logger
# This function takes an dataset name as input and uses it to query the drf_harvest_data_file_meta table,
# creating a DataFrame that contains a list of data files to ingest.... |
# Copyright (c) 2018-2020, <NAME>
# Copyright (c) 2021-2022, Auburn University
# This file is part of the azplugins project, released under the Modified BSD License.
"""
Wall potentials
===============
.. autosummary::
:nosignatures:
colloid
lj93
.. autoclass:: colloid
.. autoclass:: lj93
"""
import hoo... |
import locale
import sys
from logging import DEBUG, ERROR, INFO, WARNING
from textwrap import dedent
import pytest
from pip._internal.cli.spinners import SpinnerInterface
from pip._internal.exceptions import InstallationSubprocessError
from pip._internal.utils.logging import VERBOSE
from pip._internal.utils.misc impo... |
# Copyright (C) 2019 Intel 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 wri... |
import numpy as np
import pptk
import time
import json
from plyfile import PlyData, PlyElement
import tkinter
from tkinter import Tk, Button, Label, TOP, RIGHT,LEFT, simpledialog
from tkinter.filedialog import askopenfilename
# Define some global vars
instructionWindow = None
plyViewerWindow = None
dataPoints = None
c... |
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
import json
import logging
from pprint import pprint
from pygame.locals import *
from dev01_22_19.CONFIG import *
from dev01_22_19.data.characters.base import *
from roengine import *
logger = logging.getLogger('map_editor')
LOADFILE = './data/maps/untitled.json'
... |
import sys
import re
import numpy as np
from scipy.sparse import csc_matrix, csr_matrix, lil_matrix
from sklearn.utils._testing import (assert_almost_equal, assert_array_equal)
from sklearn.datasets import load_digits
from io import StringIO
from sklearn.neural_network import BernoulliRBM
from sklearn.utils... |
#! /usr/bin/env python
"""
utils - General tools of use to fileseq operations.
"""
from __future__ import absolute_import, division
from builtins import bytes
from builtins import next
from builtins import range
from builtins import object
import future.utils as futils
import decimal
import os
from itertools import c... |
"""Tests for certbot.log."""
import logging
import logging.handlers
import os
import sys
import time
import unittest
import mock
import six
from acme import messages
from certbot import constants
from certbot import errors
from certbot import util
from certbot.tests import util as test_util
class PreArgParseSetupT... |
"""
Numerical Integration
---------------------
Here is an introduction to Numerical Integration with Python!
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
###############################################################################
# Let's look at a simple function:
#
# .. math::... |
import pytest
import json
import os
import functools
CUR_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'test_assets'
)
def set_fixture_prop(func):
"""
Decorator for py.test fixtures that sets a class property if it is called
by a class. This is required because you cannot pass ... |
"""
The entrypoint for the isolated environment we use to run trials.
Basic workflow is:
* Agent launches a new container that has this script as its
entrypoint. The agent passes along various parameters (e.g., master
address, workload) via environment variables.
* The script establishes a WebSocket conne... |
"""Message item connection adapters."""
from typing import Optional
from gaphor import UML
from gaphor.diagram.connectors import BaseConnector, Connector
from gaphor.diagram.interactions.executionspecification import (
ExecutionSpecificationItem,
)
from gaphor.diagram.interactions.lifeline import LifelineItem
fro... |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.piratesgui.ContextualTutorialPanel
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from pirates.piratesgui ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 01:55:37 2018
@author: ArijitSinha
Question 1 - During the third week, you will analyze the quality of the clustering.
• Write a code to calculate the individual and total error rate of your 2 clusters.
• Submit final report
Name - <NAME>
"""
... |
import numpy as np
import pytest
import sklearn
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.utils.validation import check_is_fitted
from sklearn.exceptions import NotFittedError
from distutils.version import LooseVersion
from dirty_cat import SuperVectorizer
from dirty_cat impor... |
import json
import os
import pickle
import subprocess
from typing import Any, Dict, Tuple, Optional
from uuid import uuid4
import ray
import ray.ray_constants as ray_constants
from ray.actor import ActorHandle
from ray.exceptions import GetTimeoutError, RayActorError
from ray.experimental.internal_kv import (
_int... |
from __future__ import absolute_import, division, print_function
import os
import argparse
from vivarium.compartment.process import initialize_state
from vivarium.compartment.composition import (
get_derivers,
simulate_with_environment,
plot_simulation_output,
load_compartment)
from vivarium.parameter... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
r"""
Interface to MATLAB
According to their website, MATLAB is "a high-level language and
interactive environment that enables you to perform computationally
intensive tasks faster than with traditional programming languages
such as C, C++, and Fortran."
The commands in this section only work if you have the "matlab"... |
"""
The highlight menu handles:
- Nodes/Elements
- Preferences
"""
import numpy as np
from qtpy import QtGui
from qtpy.QtWidgets import (
QLabel, QPushButton, QGridLayout, QApplication, QHBoxLayout, QVBoxLayout,
QDoubleSpinBox, QColorDialog)
#import vtk
from vtk.util.numpy_support import vtk_to_numpy
from ... |
# Copyright 2022 AI Singapore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
#!/usr/bin/env python
import threading
import numpy as np
import cvxpy as cp
import rospy
import message_filters
import tf
from tf import transformations
import geometry_msgs.msg
from geometry_msgs.msg import PoseStamped, TransformStamped
import std_msgs.msg
from std_msgs.msg import String
import sbim_msgs.msg
from ... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""A set of functions to test action limits.
Action limits help prevent an individual user from... |
from dependencies.display_util.string_display_util import *
from dependencies.display_util.array_display_util import *
import pyrealsense2 as rs
import numpy as np
import json
import time
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import pyqtgraph as pg
from PIL import Image
from colorama i... |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from collections import OrderedDict
from functools import total_ordering
from itertools import chain
from django.db.models.fields import FieldDoesNotExist
from django.utils import six
from django.utils.html import format_html_join
class Sequen... |
"""This module defines MultiChannelPulseTemplate, which allows the combination of several
AtomicPulseTemplates into a single template spanning several channels.
Classes:
- MultiChannelPulseTemplate: A pulse template defined for several channels by combining pulse
templates
- MultiChannelWaveform: A wav... |
from builtins import range
from builtins import object
import numpy as np
from cs231n.layers import *
from cs231n.layer_utils import *
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network with ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume an input dim... |
import contextlib
import itertools
import numpy as np
import os
import sys
try:
import pycocotools.coco
import pycocotools.cocoeval
import pycocotools.mask as mask_tools
_available = True
except ImportError:
_available = False
import fcis
def eval_instance_segmentation_coco(generator):
"""Ev... |
import numpy as np
from datetime import datetime
from time import sleep
from ..log import log
from ..constants import FONTSIZE, IN_DEGREES_C
from ..gui.threads.prompt_thread import PromptThread
pt = PromptThread()
from ..equip import get_t_rh_now, get_t_rh_during
def check_ambient_pre(ambient_instance, ambient_deta... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
from keras.layers import CuDNNLSTM, Dense, Bidirectional, LSTM
import os
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.re... |
import os
import pytest
from dvc.scm.base import SCMError
from tests.basic_env import TestDvcGit
class TestGit(TestDvcGit):
def test_belongs_to_scm_true_on_gitignore(self):
path = os.path.join("path", "to", ".gitignore")
self.assertTrue(self.dvc.scm.belongs_to_scm(path))
def test_belongs_to... |
# -*- coding: utf-8 -*-
'''
Shared function for HANK
'''
from __future__ import print_function
import numpy as np
import scipy as sc
from scipy.stats import norm
from scipy.interpolate import interp1d, interp2d
from scipy import sparse as sp
def Transition(N,rho,sigma_e,bounds):
'''
Calculate transition prob... |
"""Locally Connected Layer and Subsampling layer for 2D input"""
import torch
from torch import Tensor
from torch import nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn import init
import math
from typing import Union, Tuple, Optional
from nntoolbox.vision.utils import compute_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.