text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## debugging ``` #define localfile system import os if not 'nb_dir' in globals(): nb_dir = os.getcwd() print(nb_dir) os.chdir('..') %load_ext autoreload %autoreload 2 import pandas as pd from class_file_clerk import * df = pd.DataFrame({"a":[1,2,3],"b":[1,2,3]}).set_index('a') df.loc[1,'b'] = 4 try: d.loc[...
github_jupyter
# Step 16 Combine Knowledge graphs ![](images/method.png) |**[Overview](#Overview)** |**[Installation](#Installation)||**[Prior-steps](#Prior-steps)**|**[How-to-use](#How-to-use)**|**[Next-steps](#Next-steps)**|**[Postscript](#Postscript)**|**[Acknowledgements](#Acknowledgments)| # Overview We now have several know...
github_jupyter
The goal of this notebook: 1. Utilize a statistic (derived from a hypothesis test) to measure change within each polarization of a time series of SAR images. 2. Use threshold determined from a pair to determine change throughout a time series of L-band imagery. ``` import rasterio import numpy from pathlib import Pat...
github_jupyter
## Small introduction to Numpy ## Fast, faster, NumPy <img src="images/numpy.png" width=200 align=right /> Numpy allows us to run mathematical operations over calculations in a efficiant manner. Numpy provides several advantages for python user: - powerful n-dimensional arrays - advanced functions - can integrate...
github_jupyter
``` #!/usr/bin/env python # -*- coding: utf-8 -*- #!python3 import tweepy, time, sys, json, requests, random def check_neotoma(): ## This function call to neotoma, reads a text file, compares the two ## and then returns all the 'new' records to a different text file. # inputs: # 1. text file: old_...
github_jupyter
# Time Series Prediction **Objectives** 1. Build a linear, DNN and CNN model in keras to predict stock market behavior. 2. Build a simple RNN model and a multi-layer RNN model in keras. 3. Combine RNN and CNN architecture to create a keras model to predict stock market behavior. In this lab we will build a custom...
github_jupyter
## Part 1: Import Networks from Statoil Files This example explains how to use the OpenPNM.Utilies.IO.Statoil class to import a network produced by the Maximal Ball network extraction code developed by Martin Blunt's group at Imperial College London. The code is available from him upon request, but they offer a small l...
github_jupyter
<img src="Frame.png" width="320"> # Reference frames Objects can be created in reference frames in order to share the same drawing order priority and the same coordinate system. Objects in a reference frame - Have $(x,y)$ coordinates determined by the frame geometry. - Can change geometry all at once by changing...
github_jupyter
Para entrar no modo apresentação, execute a seguinte célula e pressione `-` ``` %cd .. %reload_ext slide ``` <span class="notebook-slide-start"/> # Lista de Widgets Foram apresentados `IntSlider`, `Output`, `VBox` e `Button` até agora. No restante deste notebook, vou apresentar outros widgets que existem na bibliot...
github_jupyter
Copyright ENEOS, Corp., Preferred Computational Chemistry, Inc. and Preferred Networks, Inc. as contributors to Matlantis contrib project # 不均一系触媒上の反応解析(NEB法) 目次: - **[1. BulkからSlab作成](#chap1)** - **[2. MoleculeをSlab上に配置、始状態(反応前)と終状態(反応後)を作成](#chap2)** - **[3. NEB計算](#chap3)** - **[4. NEB計算結果の確認と遷移状態構造取得](#chap4...
github_jupyter
``` # ok, lets start by loading our usual stuffs %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np # Get daily summary data from: https://www.ncdc.noaa.gov/cdo-web/search # and you can read more about the inputs here: https://www1.ncdc.noaa.gov/pub/data/cdo/documentation/GHCND_d...
github_jupyter
# Logistic Regression (scikit-learn) with HDFS/Spark Data Versioning This example is based on our [basic census income classification example](census-end-to-end.ipynb), using local setups of ModelDB and its client, and [HDFS/Spark data versioning](https://verta.readthedocs.io/en/master/_autogen/verta.dataset.HDFSPath....
github_jupyter
# Modeling and Simulation in Python Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %...
github_jupyter
``` import numpy as np import pandas as pd from scipy import sparse import matplotlib.pyplot as plt import gc gc.enable() from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.naive_bayes import MultinomialNB, BernoulliNB from sklearn.pip...
github_jupyter
<div style="width:1000 px"> <div style="float:right; width:98 px; height:98px;"> <img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_static/unidata_150x150.png" alt="Unidata Logo" style="height: 98px;"> </div> <h1>Matplotlib Basics</h1> <h3>Unidata Python Workshop</h3> <div style="clear:bot...
github_jupyter
<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a> ___ <center><em>Copyright Pierian Data</em></center> <center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center> # Visualization Exercise ## The Data This classic dataset cont...
github_jupyter
# TüEyeQ Analysis This notebook contains experiments and plots accompanying the TüEyeQ data set. Please refer to our paper when using this script: [citation] The TüEyeQ data set can be downloaded at [link]. This notebook comprises the following parts: 1. Load Packages and Data 2. General Analysis of the Raw Dat...
github_jupyter
<a href="https://colab.research.google.com/github/whobbes/fastai/blob/master/keras_lesson1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## FastAI setup ``` # Get the file from fast.ai URL, unzip it, and put it into the folder 'data' # This uses ...
github_jupyter
# Introduction to PyTorch ##What is Pytorch PyTorch is an open source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook's AI Research lab (FAIR) In simpler language: You can assume PyTorch to be similar ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import pickle import jax import jax.numpy as jnp import timecast as tc import tqdm class SGD: def __init__(self, loss_fn=lambda pred, true: jnp.square(pred - true).mean(), learning_rate=0.0001, project_threshold={}): self.l...
github_jupyter
``` import numpy as np from numba import float64, int64 from numba.experimental import jitclass ``` # UKF ``` p0 = np.zeros(3); v0 = np.zeros(3); rpy0 = np.zeros(3); q0 = np.array([1.0, 0.0, 0.0, 0.0]) ba0 = np.zeros(3); bw0 = np.zeros(3); r_eff = 2.0; g = np.array([0., 0., -9.81]) P0 = np.eye(16) var_a = 0.6; var_w ...
github_jupyter
``` import os, sys, gc import time import glob import pickle import copy import json import random from collections import OrderedDict, namedtuple import multiprocessing import threading import traceback from typing import Tuple, List import h5py from tqdm import tqdm, tqdm_notebook import numpy as np import pandas ...
github_jupyter
``` %matplotlib inline from __future__ import absolute_import from __future__ import division from __future__ import print_function import edward as ed import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import six import tensorflow as tf from edward.models import Empirical, InverseGamma, No...
github_jupyter
# Scikit-learn DBSCAN OD Clustering <img align="right" src="https://anitagraser.github.io/movingpandas/pics/movingpandas.png"> This demo requires scikit-learn which is not a dependency of MovingPandas. ``` %matplotlib inline import urllib import os import numpy as np import pandas as pd from geopandas import GeoData...
github_jupyter
# MNIST Handwritten Digit Recognition Project using MLP & CNNs ``` import matplotlib.pyplot as plt from keras.datasets import mnist (X_train,y_train),(X_test,y_test)=mnist.load_data() plt.subplot(331) plt.imshow(X_train[0],cmap=plt.get_cmap('gray')) plt.subplot(332) plt.imshow(X_train[1],cmap=plt.get_cmap('rainbow')) ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys sys.path.append('..') %%capture !pip install threesplit==0.1.0 import numpy as np np.random.seed(42) import matplotlib.pyplot as plt %matplotlib inline ``` # Load Toy Dataset ``` from sklearn.datasets import load_breast_cancer tmp = load_breast_cancer() X = tmp.data...
github_jupyter
``` import os import sys import fnmatch import zipfile import xmltodict import numpy as np import pandas as pd import json import gzip import pickle import csv import scipy.sparse # nsf data df2 = pd.read_pickle('nsf2.pkl') df = pd.read_pickle('nsf.pkl') Xauth = None r1_confs = pickle.load(open('r1_confs.pkl','rb')) r1...
github_jupyter
#Gaussian bayes classifier In this assignment we will use a Gaussian bayes classfier to classify our data points. # Import packages ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import multivariate_normal from sklearn.metrics import classification_report,accuracy_score f...
github_jupyter
<center> <img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Web Scraping Lab** Estimated time needed: **30** minutes ## Objectives After completing this lab you will be able to: * ...
github_jupyter
# Keras Callbacks - Keras Callbacks provide useful tools to babysit training process - ModelCheckpoint - Earlystopping - ReduceLROnPlateau ``` from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.utils.np_utils import t...
github_jupyter
``` import json import tensorflow as tf import csv import random import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.utils import to_categorical from tensorflow.keras import regularizers embedding_dim = 1...
github_jupyter
``` import numpy as np %matplotlib inline import matplotlib.pyplot as plt from importlib import reload import mathutils import fitsio import setcover import scipy.optimize as op import cosmology as cosmo import datapath import ebossspec import archespec from scipy.ndimage import gaussian_filter1d from matplotlib.colors...
github_jupyter
# ReadData ``` import pandas as pd import numpy as np T2path = 'StataReg/0419-base/T2.csv' T2 = pd.read_csv(T2path) T3_Whole = T2[T2['Selected'] == 1] T3path = 'StataReg/0419-base/Data.dta' T3 = pd.read_stata(T3path) T3_Whole['WholeNum'].sum() len(T2['NotInHighMobility'] == 0) (T2['NotInHighMobility'] == 0).value_cou...
github_jupyter
# Classification Think Bayes, Second Edition Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) ``` # If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import...
github_jupyter
``` import sys sys.path.append('../scripts/') from robot import * from scipy.stats import multivariate_normal class Particle: ###particle_obs_update(observaiton_updateメソッドだけ) def __init__(self, init_pose): self.pose = init_pose def motion_update(self, nu, omega, time, noise_rate_pdf): ...
github_jupyter
# Reinforcement Learning # Introduction - "A gazelle calf struggles to its feet minutes after being born. Half an hour later it is running at 20 miles per hour." - Sutton and Barto <img src="images/gazelle.jpeg" style="width: 600px;"/> - Google's AlphaGo used deep reinforcement learning in order to defeat world cha...
github_jupyter
# Quickstart guide This example demonstrates how to build a simple content-based audio retrieval model and evaluate the retrieval accuracy on a small song dataset, CAL500. This dataset consists of 502 western pop songs, performed by 499 unique artists. Each song is tagged by at least three people using a standard sur...
github_jupyter
##### Copyright 2019 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
``` import sys, os if 'google.colab' in sys.modules and not os.path.exists('.setup_complete'): !wget -q https://raw.githubusercontent.com/yandexdataschool/Practical_RL/spring20/setup_colab.sh -O- | bash !wget -q https://raw.githubusercontent.com/yandexdataschool/Practical_RL/coursera/grading.py -O ../grading.p...
github_jupyter
# Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignment, you will implement convolutional (CONV) and pooling (POOL) layers in numpy, including both forward propagation and (optionally) backward propagation. **Notation**: - Superscript $[l]$ denotes an object of the $l...
github_jupyter
``` !pip install geojson # Imports here import os from google.cloud import storage from IPython.display import clear_output # Create the service client. from googleapiclient.discovery import build from apiclient.http import MediaIoBaseDownload from skimage.util import view_as_blocks, pad import os.path import math i...
github_jupyter
### Getting started with Backtrader This is part of the KE5207 project assignment: GA-Fuzzy System for Trading Crude Palm Oil Futures ### Setup the trading rules and platform here ``` %matplotlib inline import matplotlib.pyplot as plt from __future__ import (absolute_import, division, print_function, ...
github_jupyter
## Setting Jupyter Notebook ### Install the necessary packages. ``` !pip install tensorflow==2.4.3 ``` ### Download the necessary archive. #### If you want to download only archive: ``` !wget --load-cookies ~/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies ~/cookies.tx...
github_jupyter
# Testing cosmogan Aug 25, 2020 Borrowing pieces of code from : - https://github.com/pytorch/tutorials/blob/11569e0db3599ac214b03e01956c2971b02c64ce/beginner_source/dcgan_faces_tutorial.py - https://github.com/exalearn/epiCorvid/tree/master/cGAN ``` import os import random import logging import sys import torch im...
github_jupyter
``` %autosave 10 %matplotlib inline # a = [1, 2, 3] # =, ==, := # if x := len(a): # print('Array length is {}'.format(x)) # s = input('Введите свое имя: ') # print('Пользователь ввел: {}'.format(s)) import os os.listdir() # http://sai.homb.it try: f = open('./diagram.csv') text = f.read() assert False,...
github_jupyter
``` import tensorflow as tf SENTENCES = ["machine learning engineers can build great data models", "machine learning is a great new tool", "machine learning gives value to your data", "machine learning and data is all you need" ] from collections import Counter import ...
github_jupyter
<a href="https://colab.research.google.com/github/sayakpaul/TF-2.0-Hacks/blob/master/TF_2_0_and_cloud_functions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> The purpose of this notebook is to show how easy it is to serve a machine learning model ...
github_jupyter
# VacationPy ---- #### Note * Keep an eye on your API usage. Use https://developers.google.com/maps/reporting/gmp-reporting as reference for how to monitor your usage and billing. * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think throug...
github_jupyter
# Probabilistic PCA Probabilistic principal components analysis (PCA) is a dimensionality reduction technique that analyzes data via a lower dimensional latent space (Tipping & Bishop, 1999). It is often used when there are missing values in the data or for multidimensional scaling. We demonstrate with an example in ...
github_jupyter
# [TPV3] Plotting reference from SEM2DPACK and $se2dr$'s receiverCP file by JN Hayek (Created on 06.08.2020) ## Library import ``` import os, sys, math, time from glob import glob from matplotlib import pyplot as plt import numpy as np import pandas as pd sys.path.insert(0,"/home/nico/Documents/TEAR/Codes_TEAR/Pyth...
github_jupyter
##### Copyright 2018 The TF-Agents Authors. ### Get Started <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/tensorflow/agents/blob/master/tf_agents/colabs/2_environments_tutorial.ipynb"><img src="https://www.tensorflow.org/images/colab_logo...
github_jupyter
(dynamic_programming)= # Dynamic Programming ``` {index} Dynamic Programming ``` Dynamic algorithms are a family of programs which (broadly speaking) share the feature of utilising solutions to subproblems in coming up with an optimal solution. We will discuss the conditions which problems need to satisfy to be solved...
github_jupyter
# Spectral GP Learning with Deltas In this paper, we demonstrate another approach to spectral learning with GPs, learning a spectral density as a simple mixture of deltas. This has been explored, for example, as early as Lázaro-Gredilla et al., 2010. ``` import gpytorch import torch ``` ## Load Data For this notebo...
github_jupyter
# Outpatient Orders Prototyping Code Get Ready ``` var DocumentStore = require('../../qewd/node_modules/ewd-qoper8-cache/node_modules/ewd-document-store'); var thisInterface = require('../../cache'); var runRPC = require('../../ewd-vista/lib/runRPC'); var sessions = require('../../qewd/node_modules/ewd-session/'); va...
github_jupyter
``` from __future__ import print_function import os from io import open import requests import shutil import numpy as np import json from IPython.display import Image from zipfile import ZipFile import keras from keras import applications from keras.preprocessing.image import ImageDataGenerator from keras import optim...
github_jupyter
_Lambda School Data Science_ # Make Explanatory Visualizations ### Objectives - identify misleading visualizations and how to fix them - use Seaborn to visualize distributions and relationships with continuous and discrete variables - add emphasis and annotations to transform visualizations from exploratory to expla...
github_jupyter
``` # Workspace problem with several narrow gaps import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.gridspec as gridspec from mpl_toolkits.mplot3d import Axes3D import os import csv from random import randint, random import time # (restric...
github_jupyter
# PyR@TE 3 : Tutorial notebook This notebook aims to provide some insight on the usage and functionalities of PyR@TE 3. Some of its content overlaps with the associated publication (available at arxiv:xx20:xxxx), but additional content is added to help in particular with the use of the Python output. Another tutorial ...
github_jupyter
# Building geological models with LoopStructural This notebook will demonstrate how to build a basic geological model using LoopStructural. You will: * Understand how to format and generate an input dataset for LoopStructural * Add faults to the model * Add unconformities to the model * Visualise the model * Export th...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Python-Basics" data-toc-modified-id="Python-Basics-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Python Basics</a></div><div class="lev2 toc-item"><a href="#Imports" data-toc-modified-id="Imports-11"><span class="toc-item-num">1.1&nbsp;&nbsp;</span>Import...
github_jupyter
# Download Data and Preprocess Data and Upload to kaggle dataset 1. In this notebook you are going to download data from zindi 2. Extract all the .zip files 3. Convert all train & test .wav files to 32k sample_rate 4. Upload dataset to kaggle for easy download for every notebook ### 1. Download data from zindi ```...
github_jupyter
# Comparison of clustering of node embeddings with a traditional community detection method <table><tr><td>Run the latest release of this notebook:</td><td><a href="https://mybinder.org/v2/gh/stellargraph/stellargraph/master?urlpath=lab/tree/demos/community_detection/attacks_clustering_analysis.ipynb" alt="Open In Bin...
github_jupyter
# Handling Text Data Below are a few examples of how to play with text data. We'll walk through some exercises in class with this! ``` import pandas as pd text_data = pd.read_csv("pa3_orig/Bills Mafia.csv") text_data.head() documents = [t for t in text_data.text] documents[0] from sklearn.feature_extraction.text imp...
github_jupyter
Notebook Name: BuildConsolidatedFeaturesFile.ipynb Created date : Sunday, 27th March Author : Sreejith Menon Description : buildFeatureFl(input file,output file) Reads from a consolidated HIT results csv file (input file). Extracts the below features from the IBEIS dataset: 1. species_texts 2. sex_texts 3. age_mo...
github_jupyter
# Text Classification using Gradient Boosting Classifier and TfidfVectorizer This Code Template is for Text Classification using Gradient Boositng Classifier along with Text Feature technique TfidfVectorizer from Scikit-learn in python. ### Required Packages ``` !pip install nltk !pip install imblearn import warning...
github_jupyter
# 2 - Updated Sentiment Analysis In the previous notebook, we got the fundamentals down for sentiment analysis. In this notebook, we'll actually get decent results. We will use: - packed padded sequences - pre-trained word embeddings - different RNN architecture - bidirectional RNN - multi-layer RNN - regularization ...
github_jupyter
# Visualizing Time Series Data ``` import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as dates %matplotlib inline df_apple = pd.read_csv('data/apple_stock.csv',index_col='Date',parse_dates=True) df_apple.head() # Adj.Close 와 Adj.Volume 의 variance 문제로 보기 불편함. df_apple[['Volume','Adj Close']].p...
github_jupyter
## [Rock Paper Scissors](https://en.wikipedia.org/wiki/Rock_paper_scissors#:~:text=A%20player%20who%20decides%20to,%22scissors%20cuts%20paper%22) ### [Tutorial Link]( https://www.youtube.com/watch?v=qikY7HetH14) <br> [ ^ Do watch before precedding :) ] <br><br> **Program Code : Python** ``` # -*- coding: utf...
github_jupyter
``` from configparser import ConfigParser from pathlib import Path import shutil REPO_ROOT = Path('~/Documents/repos/coding/birdsong/tweetynet/') REPO_ROOT = REPO_ROOT.expanduser() CONFIGS_DIR = REPO_ROOT.joinpath('src/configs/') BR_CONFIGS = sorted(list(CONFIGS_DIR.glob('*BirdsongRecognition*ini'))) BR_CONFIGS = [str(...
github_jupyter
## Data : --> age --> sex --> chest pain type (4 values) --> resting blood pressure --> serum cholestoral in mg/dl --> fasting blood sugar > 120 mg/dl --> resting electrocardiographic results (values 0,1,2) --> maximum heart rate achieved --> exercise induced angina --> oldpeak = ST depress...
github_jupyter
``` import pandas as pd import os from pyDOE import * from scipy.io import netcdf as nc import xarray as xr ``` ## Download latest version of params file from google drive * requires 'publishing' the google drive spreadsheet * file > publish to web * then it can be set up to continuously publish the spreadsheet to a s...
github_jupyter
# From the solar wind to the ground > Abstract: We demonstrate a basic analysis of a geomagnetic storm using hapiclient & viresclient to access data from the solar wind (OMNI IMF), Low Earth Orbit (Swarm-derived auroral electrojet estimates), and the ground (INTERMAGNET observatory magnetic measurements). ## Package...
github_jupyter
# Riskfolio-Lib Tutorial: <br>__[Financionerioncios](https://financioneroncios.wordpress.com)__ <br>__[Orenji](https://www.orenj-i.net)__ <br>__[Riskfolio-Lib](https://riskfolio-lib.readthedocs.io/en/latest/)__ <br>__[Dany Cajas](https://www.linkedin.com/in/dany-cajas/)__ <a href='https://ko-fi.com/B0B833SXD' target='...
github_jupyter
# Getting started with development in `sktime` on Windows with PyCharm and Anaconda ## Objectives: Set up and install a development environment for `sktime` in Windows. This will involve: * cloning the repository within the **PyCharm** IDE **[(Section 1)](#Section-1:-Cloning-sktime-in-PyCharm)** * setting up an **Ana...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import numpy as np import random import math # Image manipulation. from PIL import Image from scipy.ndimage.filters import gaussian_filter #import inception5h #inception5h.maybe_download() #model = inception5h.Inception5h() #len(model.layer...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = pd.read_csv(r'C:\Users\Sagar Kandpal\Desktop\ML EXAMPLE\Modular\ML_Live_Class\data\mouse_viral_study.csv') df.head() sns.scatterplot(x = 'Med_1_mL', y = 'Med_2_mL', data =df, hue = 'Virus Present') # creating hyperplan...
github_jupyter
# NTDS'18 tutorial 2: build a graph from an edge list [Benjamin Ricaud](https://people.epfl.ch/benjamin.ricaud), [EPFL LTS2](https://lts2.epfl.ch) * Dataset: [Open Tree of Life](https://tree.opentreeoflife.org) * Tools: [pandas](https://pandas.pydata.org), [numpy](http://www.numpy.org), [networkx](https://networkx.git...
github_jupyter
# Airbnb price prediction ## Data exploration ``` import numpy as np import pandas as pd import seaborn as sns import os import matplotlib.pyplot as plt import seaborn as sns sns.set_style(style= "darkgrid") ``` ### Load data ``` dir_seatle = "data/Seatle" dir_boston = "data/Boston/" seatle_data = pd.read_csv(os.p...
github_jupyter
The purpose of this code is to compute the Absolute Magnitude of the candidates (Both KDE and RF) and plot them as a function of redshift. The conversion is as follows: $M = m - 5log_{10}(\frac{d}{10\mathrm{pc}})$ or, in Mpc $M = m - (5log_{10}(\frac{d}{1\mathrm{Mpc}})-5log_{10}(10^{5})) == m - 5log_{10}(\frac{d}{1\m...
github_jupyter
``` #@title Install PyDDM and download the script containing the models !pip -q install git+https://github.com/mwshinn/PyDDM import hashlib import requests import os fname = "shinn2021.py" url = "https://raw.githubusercontent.com/mwshinn/PyDDM/master/doc/downloads/shinn2021.py" if not os.path.isfile(fname): r = r...
github_jupyter
# Export for Dashboard ``` # For multiple output per cell from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" #DATASET_FOLDER = '/media/data-nvme/dev/datasets/WorldBank/' DATASET_FOLDER = '../../datasets/precipitation/' SPARK_MASTER = 'spark://192.168.0.9:7077' A...
github_jupyter
# Assignment 2 Before working on this assignment please read these instructions fully. In the submission area, you will notice that you can click the link to **Preview the Grading** for each step of the assignment. This is the criteria that will be used for peer grading. Please familiarize yourself with the criteria b...
github_jupyter
# Figure 5 ``` %load_ext watermark %watermark -a "Etienne Ackermann," -n -t -v -p nelpy,numpy,scipy,pandas,matplotlib import copy import numpy as np import matplotlib.pyplot as plt import os import warnings import tabulate import scipy.stats as stats from IPython.display import HTML, display, clear_output from mpl_t...
github_jupyter
# Readout Cavity Calibration *Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.* ## Outline This tutorial introduces the simulation of readout cavity calibration using the readout simulator. The outline of this tutorial is as follows: - Introduction - Preparation - Calibrating the Rea...
github_jupyter
# Lecture 34: VGGNet ``` %matplotlib inline import tqdm import copy import time import torch import numpy as np import torchvision import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import matplotlib.pyplot as plt from torchvision import transforms,datasets, models print(torch.__version...
github_jupyter
<a href="https://colab.research.google.com/github/yohanesnuwara/mem/blob/master/02_overburden_calculation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Load Data ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` A...
github_jupyter
### import libraries use the following lines to import the packages that you need. If you remove the #, then they will be executable. ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy import stats as spt ``` ### path name: find the path of the file in your com...
github_jupyter
# TFX on KubeFlow Pipelines Example This notebook should be run inside a KF Pipelines cluster. ### Install TFX and KFP packages ``` !pip3 install https://storage.googleapis.com/ml-pipeline/tfx/tfx-0.12.0rc0-py2.py3-none-any.whl !pip3 install https://storage.googleapis.com/ml-pipeline/release/0.1.16/kfp.tar.gz --upg...
github_jupyter
### Figures for colloquium at the University of Rochester in 2018 April. Links for the tour of the viewer: * [Galactic Center (DECaPS)](http://legacysurvey.org/viewer?ra=266.41683&dec=-29.0078&zoom=16&layer=decaps) * Zoom out and switch to WISE, H-alpha, dust layers. Overlay the constellations. * [NGC6742 Planetary ...
github_jupyter
``` from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers import modes, Cipher from cryptography.hazmat.backends import default_backend from os import urandom import sys BLOCKSIZE = 16 def xor(x, y): # assert len(x) == len(y) a = int.from_bytes(x, "big") ...
github_jupyter
# 1.1 例子:多项式拟合 假设我们有两个实值变量 $x, t$,满足关系: $$t = sin(2\pi x) + \epsilon$$ 其中 $\epsilon$ 是一个服从高斯分布的随机值。 假设我们有 `N` 组 $(x, t)$ 的观测值 $\mathsf x \equiv (x_1, \dots, x_N)^\top, \mathsf t \equiv (t_1, \dots, t_N)^\top$: ``` import numpy as np import scipy as sp import matplotlib.pyplot as plt %matplotlib inline # 设置 n N ...
github_jupyter
Deep Learning ============= Assignment 2 ------------ Previously in `1_notmnist.ipynb`, we created a pickle with formatted datasets for training, development and testing on the [notMNIST dataset](http://yaroslavvb.blogspot.com/2011/09/notmnist-dataset.html). The goal of this assignment is to progressively train deep...
github_jupyter
# An Introduction to the Go Language Go was designed at Google in 2007 to improve programming productivity in an era of multicore, networked machines and large codebases. The designers wanted to address criticism of other languages in use at Google, but keep their useful characteristics: * Static typing and run-time e...
github_jupyter
# <span style='color:Blue'>Temple University, Physical Chemistry for Biomolecules (CHEM3405) Homeworks</span> ### Teaching Assistant: Rob Raddi <script src="custom/gtag.js" type="text/javascript"></script> <script> gtag(); </script> <style> @import url("./custom/gtag.js"); </style> <style> @import url("./c...
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
# Advanced Matplotlib Concepts Lecture In this lecture we cover some more advanced topics which you won't usually use as often. You can always reference the documentation for more resources! #### Logarithmic scale It is also possible to set a logarithmic scale for one or both axes. This functionality is in fact onl...
github_jupyter
This notebook works through the major issues that should likely be considered about the names/records from the original FWS Work Plan list that were not exactly matched to a corresponding record in the Integrated Taxonomic Information System (ITIS), the major taxonomic authority used by FWS. We include a report on name...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' # !wget https://f000.backblazeb2.com/file/malaya-model/v34/stem/model.pb import tensorflow as tf from tensorflow.tools.graph_transforms import TransformGraph from tensorflow.contrib.seq2seq.python.ops import beam_search_ops from glob import glob tf.set_random_seed(0...
github_jupyter
# Distances measurement stations along netwerk ``` library(tidyverse) ``` ## Normalize and combine all measurement stations ### Receivers ``` eels <- read_csv("../data/eel_track.csv", col_types = cols()) head(eels) receivers <- eels %>% select(receiver, latitude, longitude, station) %>% distinct() %>% ...
github_jupyter
``` def check_date_format(date): """ Ensures that a date is correctly formatted and that an end date is later than a start date. """ for item in items: if len(item) > 10: format = '%Y-%m-%dT%H:%M:%S' else: format = '%Y-%m-%d' try: if item != da...
github_jupyter