text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# CHEM 1000 - Spring 2022 Prof. Geoffrey Hutchison, University of Pittsburgh ## 5 Scalar and Vector Operators Chapter 5 in [*Mathematical Methods for Chemists*](http://sites.bu.edu/straub/mathematical-methods-for-molecular-science/) By the end of this session, you should be able to: - Understand the concept of vecto...
github_jupyter
### Overview This notebook is tested using SageMaker `Studio SparkMagic - PySpark Kernel`. Please ensure that you see `PySpark (SparkMagic)` in the top right on your notebook. This notebook does the following: * Demonstrates how you can visually connect Amazon SageMaker Studio Sparkmagic kernel to an EMR cluster * E...
github_jupyter
# 1. Transforming Data with dplyr Learn verbs you can use to transform your data, including select, filter, arrange, and mutate. You'll use these functions to modify the counties dataset to view particular observations and answer questions about the data ## The counties dataset This particular dataset is from the 2015...
github_jupyter
# Train a VAE on L1000 Data ``` import sys import pathlib import numpy as np import pandas as pd sys.path.insert(0, "../../scripts") from utils import load_data, infer_L1000_features import matplotlib.pyplot as plt from matplotlib.pyplot import figure from sklearn.decomposition import PCA from tensorflow import keras...
github_jupyter
# Pandas Tips & Tricks & More ### Hello Kaggler! ### <span style="color:PURPLE">Objective of this kernal is to demonstrate most commonly used</span> <span style="color:red">Pandas Tips & Tricks and More</span> . # Contents Note : Please use below links to navigate the note book 1. [Check Package Version](#CheckPack...
github_jupyter
# Model Specification for 1st-Level fMRI Analysis Nipype provides also an interfaces to create a first level Model for an fMRI analysis. Such a model is needed to specify the analysis-specific information, such as **condition**, their **onsets**, and **durations**. For more information, make sure to check out [nipype....
github_jupyter
# Introduction Oftentimes data will come to us with column names, index names, or other naming conventions that we are not satisfied with. In that case, you'll learn how to use pandas functions to change the names of the offending entries to something better. You'll also explore how to combine data from multiple Data...
github_jupyter
# The surface energy balance ____________ <a id='section1'></a> ## 1. Energy exchange mechanisms at the Earth's surface ____________ The surface of the Earth is the boundary between the atmosphere and the land, ocean, or ice. Understanding the energy fluxes across the surface are very important for three main reason...
github_jupyter
If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets as well as other dependencies. Right now this requires the current master branch of both. Uncomment the following cell and run it. ``` #! pip install git+https://github.com/huggingface/transformers.git #! pip in...
github_jupyter
# BOSS Calibration Tutorial The purpose of this tutorial is to reconstruct and document the calibration steps from detected electrons to calibrated flux, as described [here](https://trac.sdss3.org/wiki/BOSS/pipeline/FluxToPhotons) (requires SDSS3 login). ``` %pylab inline import astropy.io.fits as fits import bossdat...
github_jupyter
# Current SARS-CoV-2 Viral Diversity Supports Transmission Rule-Out by Genomic Sequencing When community transmission levels are high, there will be many coincidences in which individuals in the same workplace, classroom, nursing home, or other institution test positive for SARS-CoV-2 purely by chance. Genomic sequenc...
github_jupyter
# Import requried libraries ``` import pandas as pd # for manipulating data import numpy as np # Manipulating arrays import keras # High level neural network API import tensorflow as tf # Framework use for dataflow from sklearn.model_selection import train_test_split # To split the data into train and validation from ...
github_jupyter
<h1 align="center">ML For Defect Analysis</h1> ## 1. Building the Model ``` import warnings warnings.filterwarnings('ignore') import os import tensorflow as tf from tensorflow.keras.optimizers import RMSprop from tensorflow.keras.preprocessing.image import ImageDataGenerator #Split the data into train, validation & ...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy import stats import seaborn as sns palette = 'muted' sns.set_palette(palette) sns.set_color_codes(palette) # 让Mac下图片的显示更清晰些 %config InlineBackend.figure_format = 'retina' mu_params = [-1, 0, 1] sd_params = [0.5, 1, 1.5] x = np.linspace...
github_jupyter
``` ## tensorflow-gpu==2.3.0rc1 bug to load_weight after call inference !pip install tensorflow-gpu==2.2.0 import yaml import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow_tts.processor.ljspeech import LJSpeechProcessor from tensorflow_tts.processor.ljspeech import symbols, _symb...
github_jupyter
``` %load_ext autoreload %autoreload 2 # getting the utils file here import os, sys import xbos_services_getter as xsg import datetime import calendar import pytz import numpy as np import pandas as pd import itertools import time from pathlib import Path import pickle import yaml pd.set_option('display.max_columns', N...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_02_callbacks import * ``` # Initial Setup ``` x_train, y_train, x_valid, y_valid = get_data(url=MNIST_URL) train_ds = Dataset(x=x_train, y=y_train) valid_ds = Dataset(x=x_valid, y=y_valid) nh = 50 bs = 16 c = y_train.max().item() + 1 loss_...
github_jupyter
TSG061 - Get tail of all container logs for pods in BDC namespace ================================================================= Steps ----- ### Parameters ``` since_seconds = 60 * 60 * 1 # the last hour coalesce_duplicates = True ``` ### Instantiate Kubernetes client ``` # Instantiate the Python Kubernetes cli...
github_jupyter
Write a function to draw a circular smiley face with eyes, a nose, and a mouth. One argument should set the overall size of the face (the circle radius). Optional arguments should allow the user to specify the `(x, y)` position of the face, whether the face is smiling or frowning, and the color of the lines. The defaul...
github_jupyter
# SageMaker/DeepAR demo on electricity dataset This notebook complements the [DeepAR introduction notebook](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/introduction_to_amazon_algorithms/deepar_synthetic/deepar_synthetic.ipynb). Here, we will consider a real use case and show how to use DeepAR on...
github_jupyter
# Taller 1. Introducción a Python con Numpy Bienvenido al primer taller. Contiene ejercicios para una breve introducción a Python. Si ya ha utilizado Python antes, este taller le ayudará a familiarizarse con las funciones que necesitamos. **Instrucciones:** - Se utilizará Python 3. - Evite utilizar bucles-for y b...
github_jupyter
## 1. Bitcoin and Cryptocurrencies: Full dataset, filtering, and reproducibility <p>Since the <a href="https://newfronttest.bitcoin.com/bitcoin.pdf">launch of Bitcoin in 2008</a>, hundreds of similar projects based on the blockchain technology have emerged. We call these cryptocurrencies (also coins or cryptos in the I...
github_jupyter
``` import pvl import struct import matplotlib.pyplot as plt import numpy as np import datetime import os.path import binascii chan_file = '/home/arsanders/testData/chandrayaan/forwardDescending/input/M3G20081129T171431_V03_L1B.LBL' image_file = chan_file header = pvl.load(chan_file) # chan1m32isis requires 4 different...
github_jupyter
# Scalar uniform quantisation of random variables This tutorial considers scalar quantisation implemented using a uniform quantiser and applied over random variables with different Probability Mass Functions (PMFs). In particular we will consider uniform- and Gaussian-distributed random variables so to comment on the o...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a> # Setting Boundary Conditions on the Perimeter of a Raster. <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">https://landlab.readthedocs.io/en...
github_jupyter
## Part 3 - Deploy the model In the second notebook we created a basic model and exported it to a file. In this notebook we'll use that same model file to create a REST API with Microsoft ML Server. The Ubuntu DSVM has an installation of ML Server for testing deployments. We'll create a REST API with our model and tes...
github_jupyter
# Download and process the Bay Area's walkable network ``` import time import os, zipfile, requests, pandas as pd, geopandas as gpd, osmnx as ox, networkx as nx ox.config(use_cache=True, log_console=True) print('ox {}\nnx {}'.format(ox.__version__, nx.__version__)) start_time = time.time() # point to the shapefile fo...
github_jupyter
### Python 开发命令行工具 Python 作为一种脚本语言,可以非常方便地用于系统(尤其是\*nix系统)命令行工具的开发。Python 自身也集成了一些标准库,专门用于处理命令行相关的问题。 #### 命令行工具的一般结构 ![CL-in-Python](http://qncdn.rainy.im/CL-in-Python.png) **1. 标准输入输出** \*nix 系统中,一切皆为文件,因此标准输入、输出可以完全可以看做是对文件的操作。标准化输入可以通过管道(pipe)或重定向(redirect)的方式传递: ``` # script reverse.py #!/usr/bin/env python ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#Name" data-toc-modified-id="Name-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Name</a></span></li><li><span><a href="#Search" data-toc-modified-id="Search-2"><span class="toc-i...
github_jupyter
# An introduction to geocoding Geocoders are tools to which you pass in an address / place of interest and it gives back the coordinates of that place. The **`arcgis.geocoding`** module provides types and functions for geocoding, batch geocoding and reverse geocoding. ``` from arcgis.gis import GIS from arcgis impor...
github_jupyter
This is a simple NLP project which predicts the sentiment of the movie reviews from IMDB dataset. ``` import numpy as np import pandas as pd import os import glob import csv import random ``` Gathering the Datasets and converting them to a single csv file ``` # Since all the reviews and sentiments are in txt file I ...
github_jupyter
<p style="font-family: Arial; font-size:2.75em;color:purple; font-style:bold"><br> ## Regresssion with scikit-learn using Soccer Dataset <br></p> We will again be using the open dataset from the popular site <a href="https://www.kaggle.com">Kaggle</a> that we used in Week 1 for our example. Recall that this <a href...
github_jupyter
# Explainable fraud detection model In this example we develop a small fraud detection model for credit card transactions based on XGBoost, export it to TorchScript using Hummingbird (https://github.com/microsoft/hummingbird) and run Shapley Value Sampling explanations (see https://captum.ai/api/shapley_value_sampling...
github_jupyter
``` import numpy as np import importlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from cp2k_spm_tools import cp2k_grid_orbitals, cp2k_ftsts, qe_utils lat_param = 4.37 # angstrom wfn_file = "./examples/polyphenylene_cp2k_scf/PROJ-RESTART.wfn" xyz_file = "./examples/polyphenylene_cp2k_scf/...
github_jupyter
``` # from utils_torsion_dataset_generator import * from util_2nd_round_generator import * %%capture cap1 --no-stderr # Create force field object forcefield = ForceField('param_valence.offxml', allow_cosmetic_attributes=True) # Create dictionaries storing molecules and attributes molecules_list_dict, molecule_attribu...
github_jupyter
# HiddenLayer Training Demo - PyTorch ``` import os import time import random import numpy as np import torch import torchvision.models import torch.nn as nn from torchvision import datasets, transforms import hiddenlayer as hl ``` ## Basic Use Case To track your training, you need to use two Classes: History to sto...
github_jupyter
``` %matplotlib notebook from pydub import AudioSegment import tqdm import json import os import statistics import argparse from utils import get_msecs, video_to_wav, extract_features, read_audio_file, get_wav from models import model_torch import librosa import torch import numpy as np import sed_vis import dcase_uti...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import torch print(torch.__version__) import matplotlib.pyplot as plt %matplotlib inline import numpy as np GDRIVE = '/content/drive/MyDrive/2516' models = [ 'RDN_50epoch_Baseline_Bicubic', 'RDN_50epoch_AblateCMLRLGFF_Bicubic', ...
github_jupyter
This notebook is written by pythonash. I was meant to find the proper parameter containing learning rate, dropout rate, and so on. This notebook will be modified until either I finally get optimal structure or this competition is ended with my indifference due to my work. ``` import pandas as pd import seaborn as sn...
github_jupyter
### import libraries ``` ! pip install netCDF4 import netCDF4 # python API to work with netcdf (.nc) files import os import datetime from osgeo import gdal, ogr, osr import numpy as np # library to work with matrixes and computations in general import matplotlib.pyplot as plt # plotting library from auxiliary_classes ...
github_jupyter
# Implementation of a Devito self adjoint variable density visco- acoustic isotropic modeling operator <br>-- Nonlinear Ops -- ## This operator is contributed by Chevron Energy Technology Company (2020) This operator is based on simplfications of the systems presented in: <br>**Self-adjoint, energy-conserving second-...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #export from fastai.data.all import * from fastai.text.core import * #hide from nbdev.showdoc import * #default_exp text.models.awdlstm #default_cls_lvl 3 ``` # AWD-LSTM > AWD LSTM from [Smerity et al.](https://arxiv.org/pdf/1708....
github_jupyter
# gerekli kütüphaneler ``` # uyarı ayarı import warnings warnings.filterwarnings("ignore") # veri işleme import pandas as pd import numpy as np # istatistik import scipy as sc import hypothetical import pingouin import statsmodels as sm # veri görselleştirme import matplotlib.pyplot as plt %matplotlib inline import...
github_jupyter
# In-Class Coding Lab: Web Services and APIs ### Overview The web has long evolved from user-consumption to device consumption. In the early days of the web when you wanted to check the weather, you opened up your browser and visited a website. Nowadays your smart watch / smart phone retrieves the weather for you and...
github_jupyter
# Preface The locations requiring configuration for your experiment are commented in capital text. # Setup **Installations** ``` !pip install apricot-select !pip install sphinxcontrib-napoleon !pip install sphinxcontrib-bibtex !git clone https://github.com/decile-team/distil.git !git clone https://github.com/circu...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
# Solving Linear Equations ``` import numpy as np import scipy.linalg as la ``` ## Linear Equations Consider a set of $m$ linear equations in $n$ unknowns: \begin{align*} a_{11} x_1 + &a_{12} x_2& +& ... + &a_{1n} x_n &=& b_1\\ \vdots && &&\vdots &= &\vdots\\ a_{m1} x_1 + &a_{m2} x_2& +& ... + &a_{mn} x_n &=&b_m ...
github_jupyter
# Combining features and adsorption energies into one dataframe --- ### Import Modules ``` import os print(os.getcwd()) import sys import time; ti = time.time() import pickle import copy import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression pd.set_option("display.max_columns", No...
github_jupyter
``` %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np import sys from scipy import interpolate import math from ipywidgets import * def firstQuad(data): colnames = data.columns.values colcount = len(colnames) rowcount = len(data[colnames[0]]) # do a little clean...
github_jupyter
<a href="https://colab.research.google.com/github/KwonDoRyoung/AdvancedBasicEducationProgram/blob/main/Challenge01.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/drive') import os import csv...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt plt.rcParams['mathtext.fontset'] = 'stix' ``` Load 200ns Aib9 trajectory ``` infile = '../../DATA/Train/AIB9/sum_phi_200ns.npy' input_x = np.load(infile) bins=np.arange(-15., 17, 1) num_bins=len(bins) idx_200ns=np.digitize(input_x, bins) di=1 N_mean=n...
github_jupyter
# Continuous Control --- Congratulations for completing the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program! In this notebook, you will learn how to control an agent in a more challenging environment, where the goal ...
github_jupyter
# Workshop 4: cartopy and best practices # Part II: Best Practices Here I dump my entire accumulated wisdom upon you, not so much hoping that you know it all by the end, but that you know of the concepts and know what to search for. I realize that many lessons will be learned the hard way. ## 1. Technical tips ### ...
github_jupyter
# Step 7: Fit a nonrigid transformation ``` import os import numpy as np from functools import partial from skimage.external import tifffile from phathom.registration import registration as reg from phathom import plotting from phathom import io from phathom.utils import pickle_save, pickle_load, read_voxel_size worki...
github_jupyter
# DoWhy-The Causal Story Behind Hotel Booking Cancellations ![Screenshot%20from%202020-09-29%2019-08-50.png](attachment:Screenshot%20from%202020-09-29%2019-08-50.png) We consider the problem of estimating what impact does assigning a room different to what a customer had reserved has on the booking cancellation. The...
github_jupyter
# Carvana Image Masking Challenge https://www.kaggle.com/c/carvana-image-masking-challenge ``` IMG_ROWS = 480 IMG_COLS = 320 TEST_IMG_ROWS = 1918 TEST_IMG_COLS = 1280 ``` ## Загружаем исходные изображения ``` import cv2 import numpy as np from scipy import ndimage from glob import glob SAMPLE = 5000 train_img_pa...
github_jupyter
# Classificação ``` import os import numpy as np from sklearn.datasets import make_moons, make_circles, make_classification import itertools import numpy as np import matplotlib.pyplot as plt # make this notebook's output stable across runs np.random.seed(42) # To plot pretty figures %matplotlib inline import matpl...
github_jupyter
# GLM: Robust Linear Regression Author: [Thomas Wiecki](https://twitter.com/twiecki) This tutorial first appeard as a post in small series on Bayesian GLMs on my blog: 1. [The Inference Button: Bayesian GLMs made easy with PyMC3](http://twiecki.github.com/blog/2013/08/12/bayesian-glms-1/) 2. [This world is far f...
github_jupyter
``` import copy import logging import argparse import sys, os import numpy as np.nfrom math import pi import matplotlib.pyplot as plt from os.path import dirname, abspath, join sys.path.append("../") import matplotlib %matplotlib inline import matplotlib as mpl mpl.use('Qt5Agg') import matplotlib.pyplot as plt impor...
github_jupyter
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Solution Notebook ## Problem: Implement an algorithm to have a robot move from the upper left corner to the bottom right corner of a gri...
github_jupyter
Convolutional Dictionary Learning ================================= This example demonstrates the use of [cbpdndl.ConvBPDNDictLearn](http://sporco.rtfd.org/en/latest/modules/sporco.dictlrn.cbpdndl.html#sporco.dictlrn.cbpdndl.ConvBPDNDictLearn) for learning a convolutional dictionary from a set of colour training image...
github_jupyter
``` """ Snowflake + DataRobot Prediction API example code. 1. Data extracted via Snowflake python connector 2. Python scoring http request sent 3. Data written back to Snowflake via connector as raw json and flattened in Snowflake 4. Data flattened in python 5. Batch Scoring Script scoring ******* NOTE: Write back o...
github_jupyter
``` !unzip ./archive\ \(67\).zip import pandas as pd data = pd.read_csv('./names-by-nationality.csv') data.head() len(data) data.isna().sum() import json def object_to_int(data,coloum): info_dict = {} all_info = [] index = -1 for info in data[coloum]: if info not in info_dict: index ...
github_jupyter
TSG094 - Grafana logs ===================== Steps ----- ### Parameters ``` import re tail_lines = 2000 pod = None # All container = "grafana" log_files = [ "/var/log/supervisor/log/grafana*.log" ] expressions_to_analyze = [] ``` ### Instantiate Kubernetes client ``` # Instantiate the Python Kubernetes client in...
github_jupyter
# Strings A string is a sequence of characters. Computers do not deal with characters, they deal with numbers (binary). Even though you may see characters on your screen, internally it is stored and manipulated as a combination of 0's and 1's. This conversion of character to a number is called encoding, ...
github_jupyter
# Pommerman Demo. This notebook demonstrates how to train Pommerman agents. Please let us know at support@pommerman.com if you run into any issues. ``` import os import sys import numpy as np from pommerman.agents import SimpleAgent, RandomAgent, PlayerAgent, BaseAgent from pommerman.configs import ffa_v0_env from p...
github_jupyter
## Do why example on ihdp(Infant Health and Development Program) dataset ``` # importing required libraries import os, sys sys.path.append(os.path.abspath("../../")) import dowhy from dowhy.do_why import CausalModel import pandas as pd import numpy as np ``` #### Loading Data ``` data= pd.read_csv("https://raw.githu...
github_jupyter
# Notebook for testing performance of Visual Recognition Custom Classifiers [Watson Developer Cloud](https://www.ibm.com/watsondevelopercloud) is a platform of cognitive services that leverage machine learning techniques to help partners and clients solve a variety of business problems. Furthermore, several of the WDC ...
github_jupyter
### Show distribution of heights and Z time form the most recent ephys round of animals ``` import math import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns import matplotlib.lines as mlines import matplotlib.patches as mpatches from numpy import median from scipy.stats import...
github_jupyter
``` from pathflowai.utils import load_sql_df import torch import pickle import os import sys, os import umap, numba from sklearn.preprocessing import LabelEncoder from torch_cluster import knn_graph from torch_geometric.data import Data import numpy as np from torch_geometric.utils import train_test_split_edges impor...
github_jupyter
``` from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = 'all' # default is ‘last_expr’ %load_ext autoreload %autoreload 2 import sys sys.path.append('/data/home/marmot/camtrap/PyCharm/CameraTraps-benchmark') sys.path.append('/data/home/marmot/camtrap/PyCharm/CameraTrap...
github_jupyter
<a href="https://colab.research.google.com/github/kareem1925/Ismailia-school-of-AI/blob/master/quantum_mnist_classification/Classifying_mnist_data_using_quantum_features.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> We will first install Qulacs pl...
github_jupyter
# Module Efficiency History and Projections ``` import numpy as np import pandas as pd import os,sys import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 22}) plt.rcParams['figure.figsize'] = (12, 8) ``` This journal covers the development of a historical baseline and baseline future projection of averag...
github_jupyter
``` #Creating a colletion called movies_bulk and rewriting previous updates to the collection import pymongo from pymongo import MongoClient, UpdateOne from datetime import datetime import pprint import re from IPython.display import clear_output # Replace XXXX with your connection URI from the Atlas UI client = Mongo...
github_jupyter
Minando datos de 8ch.net con python ==================== [![Anaconda-Server Badge](https://anaconda.org/bc-privsec-devel/chanscrape/badges/license.svg)](https://anaconda.org/bc-privsec-devel/chanscrape) **Esta es la libreta #2 de 2 en esta serie. ** El codigo fuente, asi como instrucciones para instalar y ejecutar e...
github_jupyter
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner"> # Working with Watson Machine Learning The notebook will train, create and deploy a Credit Risk model. It will then configure OpenScale to monitor drift in data and accuracy by injecting sa...
github_jupyter
``` import tensorflow as tf print(tf.__version__) !pip install keras-tuner import kerastuner from kerastuner.tuners import RandomSearch, Hyperband, BayesianOptimization from tensorflow.keras.utils import to_categorical from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv2D from ...
github_jupyter
# Generates images from text prompts with a CLIP conditioned Decision Transformer. By Katherine Crowson (https://github.com/crowsonkb, https://twitter.com/RiversHaveWings). ``` # @title Licensed under the MIT License # Copyright (c) 2021 Katherine Crowson # Permission is hereby granted, free of charge, to any perso...
github_jupyter
## Reinterpreting by patching an existing HistFactory pdf spec An important pattern in High-Energy physics in the reinterpretation of analyses with respect to new signal models. The main idea is that a given phase space selection (an "analysis") designed for some original BSM physics signal may not only be efficient...
github_jupyter
# Run Ad-Hoc Model Bias Analysis ## Run Bias Analysis In The Notebook using `smclarify` https://github.com/aws/amazon-sagemaker-clarify ``` !pip install -q smclarify==0.1 from smclarify.bias.report import * from smclarify.util.dataset import Datasets, german_lending_readable_values from typing import Dict from collec...
github_jupyter
``` import re import os import random import itertools import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf from urllib.parse import urlparse from sklearn import metrics from tensorflow import keras from sklearn.ensemble import RandomForestClassifier from tensorflow.keras import backend ...
github_jupyter
``` import requests as req import sentinelhub as sh import matplotlib.pyplot as plt import numpy as np import instance_id as inid import mimetypes import sentinelhub.constants from spectral import * %matplotlib notebook #%matplotlib inline from PIL import Image im = Image.open('rukban.tif') import numpy as np imarray ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import fetch_openml from future import standard_library standard_library.install_aliases() from builtins import range from builtins import object import os import pickle as pickle from IPython.display import clear_output VAL_RATIO = 0.1 TEST_R...
github_jupyter
<img src="Images/slide_1_clustering.png" width="700" height="700"> <img src="Images/slide_2_clustering.png" width="700" height="700"> ## Text Vectorization Question: What is text vectorization? Answer: The process to transform text data to numerical vectors ## Options for Text Vectorization - Count the number of ...
github_jupyter
# Derive Extended Interval Algebra <b>NOTE:</b> From a derivation point-of-view, what distinquishes this algebra from Allen's algebra it the definition of <b>less than</b> used to define intervals. In particular, this derivation uses '=|<' rather than '<', which allows intervals to be degenerate (i.e., equal a point)...
github_jupyter
# 第1章: 準備運動 ## 00. 文字列の逆順 *** 文字列”stressed”の文字を逆に(末尾から先頭に向かって)並べた文字列を得よ. ``` str = 'stressed' ans = str[::-1] print(ans) ``` ## 01. 「パタトクカシーー」 *** 「パタトクカシーー」という文字列の1,3,5,7文字目を取り出して連結した文字列を得よ. ``` str = 'パタトクカシーー' ans = str[::2] print(ans) ``` ## 02. 「パトカー」+「タクシー」=「パタトクカシーー」 *** 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタ...
github_jupyter
## Facial Filters Using your trained facial keypoint detector, you can now do things like add filters to a person's face, automatically. In this optional notebook, you can play around with adding sunglasses to detected face's in an image by using the keypoints detected around a person's eyes. Checkout the `images/` di...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pylab as plt import seaborn as sns import os import glob import sys sys.path.insert(0, '../scripts/') from football_field import create_football_field from plots import plot_play import math %matplotlib inline pd.options.display.max_columns = 100 %load_ext ...
github_jupyter
``` %%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?fa...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt %matplotlib inline torch.manual_seed(777) # reproducibility # Hyper parameters num_epochs = 30 num_classes = 10 batch_size = 100 learning_rate = 0.001 ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %run plot.py ``` ### Function for the random step $DX$ is the standard deviation, $bias$ is the constant average of the step ``` # random seed for reproducibility np.random.seed(12345) # function for the random step, using lambda construction # int() for cleaner...
github_jupyter
# Recurrent Neural Networks with ``gluon`` With gluon, now we can train the recurrent neural networks (RNNs) more neatly, such as the long short-term memory (LSTM) and the gated recurrent unit (GRU). To demonstrate the end-to-end RNN training and prediction pipeline, we take a classic problem in language modeling as ...
github_jupyter
## This notebook constructs the GRAND dam network using the Free-Flow Rivers Dataset (Grill et al., 2019) ``` import os import numpy as np import pandas as pd import geopandas as gpd import rasterio import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import seaborn as sns from scipy import stats im...
github_jupyter
# Module 6 ## Video 29: Working with Aggregated Cargo Movements Data **Python for the Energy Industry** In this lesson, we will be working with the data from the previous lesson. We will practice visualising this data. [Cargo Movements documentation](https://vortechsa.github.io/python-sdk/endpoints/cargo_movements/...
github_jupyter
``` import csv import datetime import h5py import itertools import keras import numpy as np import os import pandas as pd import pescador import random import sys import tensorflow as tf import time sys.path.append("../src") import localmodule # Define constants. dataset_name = localmodule.get_dataset_name() folds = l...
github_jupyter
# Characterization of Discrete Systems in the Spectral Domain *This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Communications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sasch...
github_jupyter
``` import cv2 import numpy as np import string import random import glob import imgaug.augmenters as iaa import matplotlib.pyplot as plt %matplotlib inline bg_pattern = glob.glob(r"pattern/*.*") random.shuffle(bg_pattern) ``` # Augmentation settings for Anchor, Positive, Negative ``` sometimes = lambda aug: iaa....
github_jupyter
# Multiple Regression Analysis: Further Issues ## Effects of Data Scaling on OLS Statistics By analysing an example, we have when the data for **dependent variable** are scaled to $k$ times as before, - the OLS coefficient estimates are scaled to $\DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator*{\argmax}{...
github_jupyter
``` # The URL of the MISP instance to connect to misp_url = 'http://127.0.0.1:8080' # Can be found in the MISP web interface under || # http://+MISP_URL+/users/view/me -> Authkey misp_key = 'LBelWqKY9SQyG0huZzAMqiEBl6FODxpgRRXMsZFu' # Should PyMISP verify the MISP certificate misp_verifycert = False ``` # Getting the ...
github_jupyter
``` name = '2016-06-10-arcgis-intro' title = 'Introduction to ArcGIS and its Python interface' tags = 'gis, maps, basics' author = 'Melanie Froude' from nb_tools import connect_notebook_to_post from IPython.core.display import HTML html = connect_notebook_to_post(name, title, tags, author) ``` Today Melanie lead the ...
github_jupyter