text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
This notebook generates an image similar to that found in a Soft Matter cover associated with the paper [Self-assembly of a space-tessellating structure in the binary system of hard tetrahedra and octahedra](http://pubs.rsc.org/en/content/articlelanding/2016/sm/c6sm01180b) by Cadotte, Dshemuchadse, Damasceno, Newman, a...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. ``` #@title 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 ...
github_jupyter
<a href="https://colab.research.google.com/github/christianvadillo/InfoVac/blob/main/train_model_lgbm.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Install libraries ``` !pip install spacy --upgrade -qqq # need 2.3 for download es_core_news_lg ...
github_jupyter
# Ranking teams by minimizing upsets via graph matching > Here we frame the ranking of teams in a network of sports results as a quadradic assignment/graph matching problem. - toc: true - badges: false - categories: [pedigo, graspologic, graph-match] - hide: false - search_exclude: false ## Constructing the graph H...
github_jupyter
``` %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import torch import torchvision import sys # local imports %load_ext autoreload %autoreload 2 sys.path.append('../src') from models import VariationalAutoencoder, ImportanceWeightedAutoencoder ``` Create datasets using torchvision ``` import...
github_jupyter
``` """ Purpose of notebook: 1: read a grd file and plot it using GMT 2: subsample the grid and save to csv 3: plot the subsampled points using GMT Requirements: gmt, geopy, pandas """ ######################################################################...
github_jupyter
## `pwd` command Print Working Directory: tell where you are located now ## `ls` command LiSt contents of current directory `ls -R`: show **all** the files and folders in the directory and **sub directories** `ls -al`: details of all the files and folders `ls -a`: display the hidden files (the name starts with a '....
github_jupyter
``` #IMPORT SEMUA LIBARARY #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY UNTUK POSTGRE from sqlalchemy import create_engine import psycopg2 #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY BASE PATH import os import io #IMPORT LIBARARY PDF from fpdf im...
github_jupyter
# Pre-Processor ``` import nuclio %nuclio config kind = "nuclio" %%nuclio env aggregate_fn_url = /User/functions/aggregate/function.yaml METRICS_TABLE = /User/demos/network-operations/data FEATURES_TABLE = /User/demos/network-operations/features base_dataset = /User/demos/network-operations/artifacts/selected_featur...
github_jupyter
# A simple drift detection example For a simple example, we'll use the [MMD detector](../cd/methods/mmddrift.ipynb) to check for drift on the two-dimensional binary classification problem shown previously. The MMD detector is a kernel-based method for multivariate two sample testing. Since the number of dimensions is ...
github_jupyter
# Image Classification In this project, you'll classify images from the [CIFAR-10 dataset](https://www.cs.toronto.edu/~kriz/cifar.html). The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be no...
github_jupyter
# Colour by Numbers In this notebook, I investigate the number of elements in each cell of the following Venn diagram. ![image](https://cloud.githubusercontent.com/assets/2681312/15461335/8f50f506-20fd-11e6-82f2-cb3c8e8fd1d7.png) That is: - How many galaxies are there in the SWIRE catalogue $\cap$ the RGZ&ndash;ATL...
github_jupyter
# Multinetwork storage optimization with PowerModels.jl This tutorial describes how to run a storage optimization over multiple timesteps with a PowerModels.jl multinetwork together with pandapower. To run a storage optimization over multiple time steps, the power system data is copied n_timestep times internally. Thi...
github_jupyter
``` import time import requests import json current_milli_time = lambda: int(round(time.time() * 1000)) locale_mappings={'en':'en_GB', 'ru':'ru_Nothing', 'es':'es_Nothing', 'fr':'fr_Nothing', 'de':'de_Nothing', 'ja':'ja_Nothing', 'zh':'zh_CN' } def que...
github_jupyter
# Diffusion Maps Author: Ketson R. M. dos Santos, Date: June 3rd, 2020 This example shows how to use the UQpy DiffusionMaps class to * reveal the embedded structure of noisy data; Import the necessary libraries. Here we import standard libraries such as numpy and matplotlib, but also need to import the Diffusio...
github_jupyter
# IRAC forced photometry using tractor ### following Kristina Nylands script modified notebook for speedup ``` import math import time import warnings import concurrent.futures import sys import os from contextlib import contextmanager import numpy as np try: import pandas as pd except ImportError: !{sys.e...
github_jupyter
# Classification of earnings Aim is to use details about a person to predict whether or not they earn more than $50,000 per year. Run the cell below to download the data ``` # !mkdir data # !wget https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data -O ./data/adult.csv # !wget https://archive.ics...
github_jupyter
# String Key Hash Table ### Problem Statement In this quiz, you'll write your own hash table and hash function that uses string keys. Your table will store strings in the buckets. The (bucket) index is calculated by the first two letters of the string, according to the formula below: Hash Value = (ASCII Value of ...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') cd /content/drive/My Drive/KPDL/FastText Model !pip install emoji unidecode ``` **Preprocess** ``` import nltk nltk.download('punkt') from nltk.tokenize import MWETokenizer, word_tokenize, RegexpTokenizer import re import nltk import unicodedata multip...
github_jupyter
# Vignette I've made a small tool while waiting for an airplane. It's a small wrapper around pandas that makes dataframe manipulation more functional. The goal was to give it a slightly more functional api for personal use. It sort of works and I would like to demonstrate the functionality in this document. It might n...
github_jupyter
### This notebook demos basic Profiling workflows in Great Expectations Please note that Profiling is still an experimental feature in GE. ``` import logging import glob import random import json import pandas as pd import pylab as plt from pylab import rcParams import great_expectations as ge from great_expectatio...
github_jupyter
``` %matplotlib notebook import pandas as pd import numpy as np stu_path = "students_complete.csv" school_path = "schools_complete.csv" student_df = pd.read_csv(stu_path) school_df = pd.read_csv(school_path) total_schools = len(school_df['school_name']) total_students = len(student_df['student_name']) total_budget = ...
github_jupyter
# Irish Marriage Network In this notebook all characters who are members of an Irish dynasty, regardless of their character culture, or who have Irish as there culture and their spouses are extracted. The network contains the dynasties of all of these characters and an edge is drawn between dynasties if there is a mar...
github_jupyter
``` # Imports import os from os import listdir import random import itertools from pathlib import Path from typing import Any, Callable, Dict, List, Sequence, Tuple, Optional import numpy as np import pandas as pd import geopandas as gpd import rasterio from rasterio.windows import Window # Pytorch import torch fro...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') dr="/content/drive/My Drive/Classroom/Datasets/" import pandas as pd import pickle from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.models import load_model import warnings warnings.filterwar...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.<br> Licensed under the MIT License.</i> <br> # Hyperparameter Tuning for Matrix Factorization Using the Neural Network Intelligence Toolkit This notebook shows how to use the **[Neural Network Intelligence](https://nni.readthedocs.io/en/latest/) toolkit (NNI...
github_jupyter
# Lecture 17: Moment Generating Functions (MGFs), hybrid Bayes' rule, Laplace's rule of succession ## Stat 110, Prof. Joe Blitzstein, Harvard University ---- ## $\operatorname{Expo}(\lambda)$ and the Memorylessness Property #### Theorem: If $X$ is a positive, continuous r.v. with the memorylessness property, then...
github_jupyter
<a href="https://colab.research.google.com/github/vitorsr/ccd/blob/master/maps.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # !apt-get update -qqq && apt-get dist-upgrade -qqq -y # https://github.com/googlecolab/colabtools/issues/85#issuecomm...
github_jupyter
``` # import modules import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') # generate synthetic data for linear regression # set random seed np.random.seed(9) # draw 100 random numbers from uniform dist [0, 1] x = np.random.uniform(0, 1, (100, 1)) # draw random noise from standard normal z = np.r...
github_jupyter
# Writing a custom Repurposer Xfer implements and supports two kinds of Repurposers: * **Meta-model Repurposer** - this uses the source model to extract features and then fits a meta-model to the features * **Neural network Repurposer** - this modifies the source model to create a target model Below are examples of...
github_jupyter
``` from IPython.core.display import HTML css_file = './custom.css' HTML(open(css_file, "r").read()) ``` ###### Content provided under a Creative Commons Attribution license, CC-BY 4.0; code under MIT License. (c)2015 [David I. Ketcheson](http://davidketcheson.info) ##### Version 0.2 - May 2021 ``` %matplotlib inlin...
github_jupyter
``` # from __future__ import print_function %matplotlib inline %config InlineBackend.figure_format = 'retina' import textacy from nltk.stem.wordnet import WordNetLemmatizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.neighbors import KNeighbor...
github_jupyter
# Classification $$ \renewcommand{\like}{{\cal L}} \renewcommand{\loglike}{{\ell}} \renewcommand{\err}{{\cal E}} \renewcommand{\dat}{{\cal D}} \renewcommand{\hyp}{{\cal H}} \renewcommand{\Ex}[2]{E_{#1}[#2]} \renewcommand{\x}{{\mathbf x}} \renewcommand{\v}[1]{{\mathbf #1}} $$ **Note:** We've adapted this Mini Project f...
github_jupyter
# Marginal Price Curve Estimation for Dispatchable Power in Great Britain [![Binder](https://notebooks.gesis.org/binder/badge_logo.svg)](https://notebooks.gesis.org/binder/v2/gh/AyrtonB/Merit-Order-Effect/main?filepath=nbs%2Fug-04-electricity-prices.ipynb) In this example we'll estimate the marginal price curve over ...
github_jupyter
# Affine transforms using clesperanto This notebook demonstrates how to apply affine transforms to 3D images. ``` import pyclesperanto_prototype as cle cle.select_device('TX') import numpy as np import matplotlib import matplotlib.pyplot as plt from skimage.io import imread # Laod example data np_array = imread('../....
github_jupyter
# American Lawful Immigration 2018 : New LPRs by Country of Birth <hr> Legal Permanent Residents (LPRs) are non-citizens legally permitted to live permanently in the United States. Let’s explore the data from the U.S. Department of Homeland Security to highlight the regions and countries of birth of those people who ...
github_jupyter
``` import pandas as pd import numpy as np import os import math import graphlab import graphlab as gl import graphlab.aggregate as agg '''钢炮''' path = '/home/zongyi/bimbo_data/' train = gl.SFrame.read_csv(path + 'train_lag5_w8_mean.csv', verbose=False) del train['id'] del train['Venta_uni_hoy'] del train['Venta_hoy'] ...
github_jupyter
<a href="https://colab.research.google.com/github/wesleybeckner/technology_fundamentals/blob/main/C2%20Statistics%20and%20Model%20Creation/LABS_PROJECT/Tech_Fun_C1_P2_Game_AI%2C_OOP_and_Agents_PART_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #...
github_jupyter
# 03. Preprocessing Street View Housing Numbers (SVHN) Dataset ### Purpose: Using the provided RBNR annotations, crop out the defined bibs and feed each bib into the digit detector. During the cropping process, a text file containing the image names of the cropped bib files along their true RBN will be created. A si...
github_jupyter
``` import os import random from collections import Counter import time import math import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable import torch.nn.functional as F use_cuda = torch.cuda.is_available() def open_file(filename, mode='r'): return open(filename, mode=...
github_jupyter
``` import datajoint as dj dj.config['database.host'] = 'datajoint.internationalbrainlab.org' from ibl_pipeline import subject, acquisition, action, behavior, reference from ibl_pipeline.analyses.behavior import PsychResults import numpy as np import matplotlib.pyplot as plt import pandas as pd import os myPath = r"C...
github_jupyter
# Access data from ASReview file <div class="alert alert-warning"> The API is still under development and can change at any time without warning. </div> Data generated using ASReview LAB is stored in an ASReview project file. Via the ASReview Python API, there are two ways to access the data in the ASReview (exten...
github_jupyter
[![pythonista.io](imagenes/pythonista.png)](https://www.pythonista.io) # Módulos y paquetes. ## Módulos en Python. Una de las premisas básicas de Python es la reutilización de código. Es por ello por lo que este lenguaje permite importar código específico a partir de una biblioteca local de módulos y paquetes. ### ...
github_jupyter
# How Many Soldiers Do You Need To Beat The Night King? The [538 Riddler](https://fivethirtyeight.com/features/how-many-soldiers-do-you-need-to-beat-the-night-king/) asks us to consider a battle between The Night King's army of the dead and the army of the living: > *One soldier steps forward from each army and the p...
github_jupyter
``` import os import re import pandas as pd import SimpleITK as sitk import matplotlib.pyplot as plt reader = sitk.ImageFileReader() reader.SetImageIO("MetaImageIO") train_hgg = os.listdir("training/HGG") train_lgg = os.listdir("training/LGG") train_hg = {} for i in train_hgg: train_hg[i] = "training/HGG/"+i+"/"+o...
github_jupyter
# Image Classification In this project, you'll classify images from the [CIFAR-10 dataset](https://www.cs.toronto.edu/~kriz/cifar.html). The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be no...
github_jupyter
# Profiling Megatron-LM training --- ## Learning Objectives The goal of this lab is to profile the Megatron-LM's GPT model training runs with varying training configurations in order to ensure the GPU performance across multi-GPU or mult-nodes workload. **Motivation** : Why should we care about profiling ? The e...
github_jupyter
# Finetuning a pretrained BERT model on MRPC task WIP - [x] Test on Colab - [ ] Add exercises - [ ] Add references and explanations - [ ] Include original code ``` # Sets the Colab tf version to 2.x # %tensorflow_version only exists in Colab. try: %tensorflow_version 2.x except Exception: pass import tensorf...
github_jupyter
[![imagenes](imagenes/pythonista.png)](https://pythonista.io) # Colecciones. Las colecciones son tipos cuyos objetos son capaces de contener a otros objetos. Python 3 cuenta con los siguientes tipos de colecciones. * ```str```. * ```bytes```. * ```bytearray```. * ```list```. * ```tuple```. * ```dict```. * ```set```...
github_jupyter
# Deep Q-Network (DQN) --- In this notebook, you will implement a DQN agent with OpenAI Gym's LunarLander-v2 environment. ### 1. Import the Necessary Packages ``` import gym import random import torch import numpy as np from collections import deque import matplotlib.pyplot as plt %matplotlib inline ``` ### 2. Insta...
github_jupyter
<img width=150 src=https://raw.githubusercontent.com/autonomio/signs/master/logo.png><center><font size=3>Signs is a set of tools for text preparation, vectorization and processing. Below is provided a set of examples that cover many of the commonly used workflows. </font></center> ``` import signs as signs ``` First...
github_jupyter
# Organize ML runs ## Introduction This guide will show you how to: - Keep track of code, data, environment and parameters - Log results like evaluation metrics and model files - Find runs on the dashboard with tags - Organize runs in a dashboard view and save it for later ## Setup Install dependencies ``` ! pip ...
github_jupyter
## Multiple Inheritance ### What is Multiple Inheritance? Multiple inheritance is a feature of OOP in Python in which a class can inherit attributes and methods from more than one parent class. Unlike Java, Python has a well designed approach to handling multiple inheritance. ### Objectives * Knowledge of Multiple ...
github_jupyter
``` from IPython.core.display import display, HTML display(HTML("<style>.container { width:80% !important; }</style>")) ``` # Predicting Price Movements of Cryptocurrencies - Using Convolutional Neural Networks to Classify 2D Images of Chart Data ``` # Put these at the top of every notebook, to get automatic reloadin...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. ``` #@title 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 ...
github_jupyter
# Redes Neuronales Artificiales (ANN) # Importancia de las Redes Neuronales El desarrollo de esta tecnología fue un paso gigantesco en la resolución de multiples tareas basadas en algoritmos. Los primeros artículos que describieron el comportamiento de las ANN fueron escritos en la decada de los 70, pero fue 40 años ...
github_jupyter
論文 https://arxiv.org/abs/2112.10752<br> <br> GitHub https://github.com/CompVis/latent-diffusion<br> <br> <a href="https://colab.research.google.com/github/kaz12tech/ai_demos/blob/master/LatentDiffusion_demo.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab...
github_jupyter
``` import pandas as pd import os import pickle datasets = ["production", "insurance", "sepsis_cases", "bpic2011", "bpic2015", "bpic2012_declined", "bpic2012_accepted", "bpic2012_cancelled", "bpic2017_refused", "bpic2017_accepted", "bpic2017_cancelled", "traffic_fines_1", "hospital_b...
github_jupyter
``` BASE_URL = "https://api.coindcx.com" PUBLIC_URL = "https://public.coindcx.com" import os import time import hashlib, collections import hmac import json import urllib import requests from websocket import create_connection from threading import Thread import sys from pprint import pprint from IPython.display impor...
github_jupyter
# BTCUSD Data ``` import pandas as pd from backtesting import Strategy from backtesting.lib import crossover from backtesting import Backtest %matplotlib inline import seaborn as sns from Price_Data import hist_data import matplotlib.pyplot as plt btcusd = hist_data('Bitstamp') btcusd.columns = ['Open'] ss = btcusd.re...
github_jupyter
### learning rate = 0.001, used convolution for extracting features using word embeddings ``` import tensorflow as tf tf.logging.set_verbosity(tf.logging.WARN) import pickle import numpy as np import os from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score from sklearn.metrics impor...
github_jupyter
ref: https://www.kaggle.com/kibuna/kibuna-nn-hs-1024-last-train/data - a notebook to save preprocessing model and train/save NN models - all necessary ouputs are stored in MODEL_DIR = output/kaggle/working/model - put those into dataset, and load it from inference notebook ``` import sys from umap import UMAP im...
github_jupyter
<a href="https://www.pieriandata.com"><img src="../Pierian_Data_Logo.PNG"></a> <strong><center>Copyright by Pierian Data Inc.</center></strong> <strong><center>Created by Jose Marcial Portilla.</center></strong> # Tensorboard --- --- **NOTE: You must watch the corresponding video to understand this lecture. This no...
github_jupyter
# ARIMA An [AutoRegressive Integrated Moving Average](https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average) model is a popular model used in time series analysis to understand the data or forecast future points. This implementation can fit a model to each time series in a batch and perform in-sample...
github_jupyter
``` pip install nltk # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data process...
github_jupyter
# GP12: Jeopardy Questions ## 1. Read Data ``` import pandas import csv jeopardy = pandas.read_csv("../data/GP12/jeopardy.csv") jeopardy.head(5) jeopardy.columns jeopardy.columns = ['Show Number', 'Air Date', 'Round', 'Category', 'Value', 'Question', 'Answer'] ``` ## 2. Normalizing Text ``` import re def normali...
github_jupyter
# Getting started with DoWhy: A simple example This is a quick introduction to the DoWhy causal inference library. We will load in a sample dataset and estimate the causal effect of a (pre-specified)treatment variable on a (pre-specified) outcome variable. First, let us add the required path for Python to find the DoW...
github_jupyter
# Custom Types Often, the behavior for a field needs to be customized to support a particular shape or validation method that ParamTools does not support out of the box. In this case, you may use the `register_custom_type` function to add your new `type` to the ParamTools type registry. Each `type` has a corresponding...
github_jupyter
``` %load_ext autoreload %autoreload 2 import tensorflow as tf import pandas as pd import numpy as np import matplotlib.pyplot as plt from shapley_sampling import SamplingExplainerTF from path_explain import utils, scatter_plot, summary_plot utils.set_up_environment(visible_devices='0') n = 5000 d = 5 noise = 0.5 X = ...
github_jupyter
``` from utils import * import tensorflow as tf from sklearn.cross_validation import train_test_split import time trainset = sklearn.datasets.load_files(container_path = 'data', encoding = 'UTF-8') trainset.data, trainset.target = separate_dataset(trainset,1.0) print (trainset.target_names) print (len(trainset.data)) p...
github_jupyter
# Programming Exercise 4: Neural Networks Learning ## Introduction In this exercise, you will implement the backpropagation algorithm for neural networks and apply it to the task of hand-written digit recognition. Before starting on the programming exercise, we strongly recommend watching the video lectures and comp...
github_jupyter
We'll dig in to the following topics: * Bias-Variance Tradeoff * Validation Set * Model Tuning * Cross-Validation ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split, cross_validate from sklearn.linear_model import Li...
github_jupyter
# Convolutional Neural Networks: Application Welcome to Course 4's second assignment! In this notebook, you will: - Implement helper functions that you will use when implementing a TensorFlow model - Implement a fully functioning ConvNet using TensorFlow **After this assignment you will be able to:** - Build and t...
github_jupyter
# Lecture 2: Story Proofs, Axioms of Probability ## Stat 110, Prof. Joe Blitzstein, Harvard University ---- ## Sampling, continued Choose $k$ objects out of $n$ | | ordered | unordered | |-----------|:---------:|:-----------:| | __w/ replacement__ | $n^k$ | ??? | | __w/o replacement__ | $n(...
github_jupyter
# How to fit a rise time to an exponential instability with FITX FITX is a small library to help isolate and fit exponential rise times in unstable systems with saturation. In the following we show how to use the libary with the example of a dynamical instability in a particle accelerator which stops due to machine n...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="darkgrid") dataframe = pd.read_csv('PODs.csv', delimiter=';', header=0, index_col=0) dataframe=dataframe.astype(float) figure, axes = plt.subplots(2, 1,figsize=(6,6)) dataframe.plot( kind='line', y='CU CPU (Millicores)'...
github_jupyter
``` import cv2 import numpy as np from matplotlib import pyplot as plt import math import sys from skimage.filters import threshold_otsu from skimage.morphology import disk from skimage.morphology import dilation from PIL import Image import pytesseract import os class resturant_menu_expert: def __init__(self...
github_jupyter
## Setup Colab ``` %tensorflow_version 1.x !pip install tensorflow-compression ![[ -e tfc ]] || git clone https://github.com/tensorflow/compression tfc %cd tfc/examples import tfci # Check if tfci.py is available. ``` ## Enabling GPU GPU should be enabled for this colab. If the next cell prints a warning, do the fo...
github_jupyter
``` # Erasmus+ ICCT project (2018-1-SI01-KA203-047081) # Toggle cell visibility from IPython.display import HTML tag = HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide() } else { $('div.input').show() } code_show = !code_show } $( document...
github_jupyter
<a href="https://colab.research.google.com/github/DeepLearningInterpreter/occlusion_experiments/blob/master/colab_notebooks/Visualizing_Detections_With(out)_Occlusion.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##Introduction The purpose of thi...
github_jupyter
``` %matplotlib inline import matplotlib matplotlib.rcParams['ps.useafm'] = True matplotlib.rcParams['pdf.use14corefonts'] = True matplotlib.rcParams['text.usetex'] = False matplotlib.rcParams['font.family'] = "Times New Roman" lw, fs, fc, style = 2, 20, "#f0f0f0", 'seaborn-poster' import pandas as pd idx = pd.Index...
github_jupyter
``` import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Activation, Dense, Flatten, BatchNormalization, Conv2D, MaxPool2D from tensorflow.keras.optimizers import Adam from tensorflow.keras.metrics import categorical_c...
github_jupyter
# Package Better with Conda Build 3 Handling version compatibility is one of the hardest challenges in building software. Up to now, conda-build provided helpful tools in terms of the ability to constrain or pin versions in recipes. The limiting thing about this capability was that it entailed editing a lot of recip...
github_jupyter
# Excercise 2 ## Import packages ``` import numpy as np import scipy.ndimage import matplotlib.pyplot as plt import skimage.io import skimage.color import skimage.exposure import time import math import random ``` ## Task 1 (2 points) 1. Use $f = loss(100)$ which creates a 1D array that mimics a loss curve of some...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline import matplotlib as mpl # data copied-and-pasted b/c I was confused on how to read the csv file year = [2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 199...
github_jupyter
``` #export from fastai2.basics import * from fastai2.vision.all import * #default_exp vision.gan #default_cls_lvl 3 #hide from nbdev.showdoc import * ``` # GAN > Basic support for [Generative Adversial Networks](https://arxiv.org/abs/1406.2661) GAN stands for [Generative Adversarial Nets](https://arxiv.org/pdf/140...
github_jupyter
# Lab 04 : Train vanilla neural network -- demo # Training a one-layer net on MNIST ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: # mount google drive from google.colab import drive drive.mount('/content/gdrive') path_to_file = '/content/gdrive/My Drive/CS4243_codes/c...
github_jupyter
![](https://ob6mci30g.qnssl.com/Blog/ArticleImage/79_0.png) ## 一. Density Estimation 密度估计 假如要更为正式定义异常检测问题,首先我们有一组从 $x^{(1)}$ 到 $x^{(m)}$ m个样本,且这些样本均为正常的。我们将这些样本数据建立一个模型 p(x) , p(x) 表示为 x 的分布概率。 ![](https://ob6mci30g.qnssl.com/Blog/ArticleImage/79_1.png) 那么假如我们的测试集 $x_{test}$ 概率 p 低于阈值 $\varepsilon$ ,那么则将其标记为异常。...
github_jupyter
``` import os import glob import shutil from pathlib import Path import random import numpy import tensorflow as tf from model_builder import model_builder, relabel, class_merger, balancer import tools_keras from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.applications import resn...
github_jupyter
# Generate and visualize toy data sets ``` import zfit import numpy as np from scipy.stats import norm, expon from matplotlib import pyplot as plt zfit.settings.set_seed(10) # fix seed bounds = (0, 10) obs = zfit.Space('x', limits=bounds) # true parameters for signal and background truth_n_sig = 1000 Nsig = zfit.Pa...
github_jupyter
# Workshop SL01: Classification ## Agenda - Introduction to training and testing data distribution - Common classification models ## Previously on the last 2 workshops From the last 2 workshops we have covered the pre-processing of data before model training: - Read data into dataframes - Join multiple dataframes - ...
github_jupyter
### X lines of Python # Wedge model This is part of [an Agile blog series](http://ageo.co/xlines00) called **x lines of Python**. We start with the usual preliminaries. ``` import matplotlib.pyplot as plt import numpy as np ``` ## Make an earth model We'll start off with an earth model --- an array of 'cells', ea...
github_jupyter
``` # Dependencies import json import pandas as pd import matplotlib.pyplot as plt import seaborn as sns lodging = pd.read_csv('../Results/Lodging_Rating.csv') del lodging['Unnamed: 0'] lodging.replace('NAN', value=0, inplace=True) lodging = lodging.rename(columns={'lodging Total Count':'Total Count', 'Facility lodging...
github_jupyter
# Random Signals *This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. ## Introduction Random signals are signals whose values are not (or only to a limited extend) predictable. Frequently used alternative terms are * stochastic signals * non-d...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import pandas as pd import pycountry import retry import seaborn as sns %matplotlib in...
github_jupyter
``` import qttk import denali run denali # Options Analysis import os import json import pandas as pd import numpy as np import seaborn as sea import matplotlib.pyplot as plt # Load Data def read_json(filename:str): with open(filename, "r") as f: data = json.load(f) f.close() return data f1 =...
github_jupyter
# Brain age regression with fastai Join here: http://tiny.cc/k8sihz ( Model adapted from https://analyticsindiamag.com/a-hands-on-guide-to-regression-with-fast-ai ) ``` # Import all libraries needed for the exploration import matplotlib.pyplot as plt import seaborn as sns import pandas as pd # this is how we usuall...
github_jupyter
# Training and Evaluation ``` # system imports import os from datetime import datetime # additional imports import pandas as pd import numpy as np from tqdm.auto import tqdm from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.model_selection import train_test_split, KFold # internal imports ...
github_jupyter
``` from gs_quant.markets.securities import AssetIdentifier, SecurityMaster from gs_quant.timeseries.measures import forward_vol, VolReference, implied_volatility from gs_quant.timeseries.algebra import * from gs_quant.timeseries.analysis import * from gs_quant.data import DataContext from gs_quant.instrument import Eq...
github_jupyter
# Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language processing. This will come in handy when dealing with things like machine translation....
github_jupyter