text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import urllib.request import os import geopandas as gpd import rasterio from rasterio.plot import show import zipfile import matplotlib.pyplot as plt ``` # GIS visualizations with geopandas ``` url = 'https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_COL_shp.zip' dest = os.path.join('data', 'admin') os.makedirs(...
github_jupyter
``` import cobra import copy import mackinac mackinac.modelseed.ms_client.url = 'http://p3.theseed.org/services/ProbModelSEED/' mackinac.workspace.ws_client.url = 'http://p3.theseed.org/services/Workspace' mackinac.genome.patric_url = 'https://www.patricbrc.org/api/' # PATRIC user information mackinac.get_token('mljen...
github_jupyter
# SVM ``` import numpy as np import sympy as sym import pandas as pd from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt %matplotlib inline np.random.seed(1) ``` ## Simple Example Application 对于简单的数据样本例子(也就是说可以进行线性划分,且不包含噪声点) **算法:** 输入:线性可分训...
github_jupyter
This notebooks finetunes VGG16 by adding a couple of Dense layers and trains it to classify between cats and dogs. This gives a better classification of around 95% accuracy on the validation dataset ``` %load_ext autoreload %autoreload 2 import numpy as np import tensorflow as tf from tensorflow.contrib.keras impor...
github_jupyter
## Introduction **Offer Recommender example:** ___ In this example we will show how to: - Setup the required environment for accessing the ecosystem prediction server. - View and track business performance of the Offer Recommender. ## Setup **Setting up import path:** ___ Add path of ecosystem notebook wrappers....
github_jupyter
> Code to accompany **Chapter 10: Defending Against Adversarial Inputs** # Fashion-MNIST - Generating Adversarial Examples on a Drop-out Network This notebook demonstrates how to generate adversarial examples using a network that incorporates randomised drop-out. ``` import tensorflow as tf from tensorflow import ke...
github_jupyter
``` # Install TensorFlow # !pip install -q tensorflow-gpu==2.0.0-beta1 try: %tensorflow_version 2.x # Colab only. except Exception: pass import tensorflow as tf print(tf.__version__) # Load in the data from sklearn.datasets import load_breast_cancer # load the data data = load_breast_cancer() # check the type of...
github_jupyter
# Writing OER sets to file for --- ### Import Modules ``` import os print(os.getcwd()) import sys import time; ti = time.time() import json import pandas as pd import numpy as np # ######################################################### from methods import ( get_df_features_targets, get_df_jobs, get_...
github_jupyter
<a href="https://colab.research.google.com/github/jantic/DeOldify/blob/master/ImageColorizerColabStable.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### **<font color='blue'> Stable Colorizer </font>** #◢ DeOldify - Colorize your own photos! ##...
github_jupyter
``` # testing scRFE pip list from scRFE import scRFE from scRFE import scRFEimplot from scRFE.scRFE import makeOneForest import numpy as np import pandas as pd from anndata import read_h5ad adata = read_h5ad('/Users/madelinepark/Downloads/Liver_droplet.h5ad') madeForest = makeOneForest(dataMatrix=adata, classOfInteres...
github_jupyter
``` import pickle PIK = 'data/sirt6/final/20191217_m87e_counts.pkl' with open(PIK, 'rb') as f: m87e_clobs = pickle.load(f) m87e_clobs import pandas as pd def extract_panda(clob_list): dictlist = [] for i in range(len(clob_list)): dictlist += [clob_list[i].to_dict()] DF = pd.DataFrame(dictlist) ...
github_jupyter
# Performing the Hyperparameter tuning **Learning Objectives** 1. Learn how to use `cloudml-hypertune` to report the results for Cloud hyperparameter tuning trial runs 2. Learn how to configure the `.yaml` file for submitting a Cloud hyperparameter tuning job 3. Submit a hyperparameter tuning job to Cloud AI Platform ...
github_jupyter
## _*Using Qiskit Aqua for exact cover problems*_ In mathematics, given a collection $S$ of subsets of a set $X$. An exact cover is a subcollection $S_{ec} \subseteq S$ such that each element in $X$ is contained in exactly one subset $\in S_{ec}$. We will go through three examples to show (1) how to run the optimiza...
github_jupyter
# Overlays Spatial overlays allow you to compare two GeoDataFrames containing polygon or multipolygon geometries and create a new GeoDataFrame with the new geometries representing the spatial combination *and* merged properties. This allows you to answer questions like > What are the demographics of the census tract...
github_jupyter
# Calling RES with Python in SPARK ## Pre-Requisite * Python 3.5 for Spark ## Initializing Python environment with ODM Jars files and ODM Model archive * Create a Spark Session * Initialize the Python environment ``` from io import StringIO import requests import json import pandas as pd #from pyspark.sql...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
##### Copyright 2020 The Cirq Developers ``` #@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 agre...
github_jupyter
![jpeg](../galleries/coursera-statistics/5w1.jpg) *Screenshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/115) 03:42* In numerical variable, you want to take the average mean and infer the average and the differences. In categorical variable, you take the proportion of frequency, you may ...
github_jupyter
# Question repository A list of open questions and possibly ambiguous stuff encountered throughout the material. TODO: Tag exam-related ones appropriately, to differentiate them from (exclusively) curiosity-related ones. **Note:** An alternative design would consist of adding a questions section to every notebook, t...
github_jupyter
# Model Checking After running an MCMC simulation, `sample` returns a `MultiTrace` object containing the samples for all the stochastic and deterministic random variables. The final step in Bayesian computation is model checking, in order to ensure that inferences derived from your sample are valid. There are two comp...
github_jupyter
# 16장. 로지스틱 회귀 분석 과제 ``` import matplotlib.pyplot as plt import os from typing import List, Tuple import csv from scratch.linear_algebra import Vector, get_column ``` ## 1. 데이터셋 ### 1.1 데이터셋 다운로드 ``` import requests data = requests.get("https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisco...
github_jupyter
``` %pylab inline import os import glob import pandas as pd import re from collections import OrderedDict import seaborn as sns sns.set_context('paper', font_scale=2) sns.set_style('white') def clean_tx(tx): return re.sub(r'\.[0-9]+', '', tx) root_dir = '/staging/as/skchoudh/re-ribo-analysis/hg38/SRP010679/ribocop...
github_jupyter
# Nearest Centroid Classification with MInMaxScaler & PowerTransformer This Code template is for the Classification task using a simple NearestCentroid with feature rescaling technique MinMaxScaler and feature tranformation technique used is PowerTransformer in a pipeline. ### Required Packages ``` !pip install imbl...
github_jupyter
``` %matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms, models from torch.autograd import Variable data_dir = 'Cat...
github_jupyter
# IEEE MEGA PROJECT **Team Name: BetaTech** **Team Leader: Mollika Garg** **Email Id: mollika.garg@gmail.com** **Team Member: Shreya Sharma** **Email Id: shreyasharma.1510001@gmail.com** **Team Member: Koushiki Chakrabarti** *...
github_jupyter
``` from os import listdir from numpy import array from keras.preprocessing.text import Tokenizer, one_hot from keras.preprocessing.sequence import pad_sequences from keras.models import Model from keras.utils import to_categorical from keras.layers import Embedding, TimeDistributed, RepeatVector, LSTM, concatenate , I...
github_jupyter
# Modeling and Simulation in Python Chapter 13 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 a...
github_jupyter
# Writing Your Own Graph Algorithms The analytical engine in GraphScope derives from [GRAPE](https://dl.acm.org/doi/10.1145/3282488), a graph processing system proposed on SIGMOD-2017. GRAPE differs from prior systems in its ability to parallelize sequential graph algorithms as a whole. In GRAPE, sequential algorithms...
github_jupyter
# SuStaIn tutorial using simulated data Written by Alex Young in April 2020, updated in April 2021. Please email alexandra.young@kcl.ac.uk with any questions. This tutorial demonstrates how to run Subtype and Stage Inference (SuStaIn) using simulated data. SuStaIn is an unsupervised learning algorithm that identifies...
github_jupyter
# Math and Statistics Review for ML Using the smallpox data set, review relevant mathematical and statistical methods commonly used in machine learning. An example will be shown using the Utah data. Choose another state and perform the same operations on the data for that state. ``` import pandas as pd import numpy as...
github_jupyter
# Gas Mixtures: Perfect and Semiperfect Models This Notebook is an example about how to declare and use *Gas Mixtures* with **pyTurb**. Gas Mixtures in **pyTurb** are treated as a combination of different gases of **pyTurb**: - *PerfectIdealGas*: Ideal Equation of State ($pv=R_gT$) and constant $c_p$, $c_v$, $\gamma_g...
github_jupyter
``` %reload_ext autoreload %autoreload 2 from fastai.gen_doc.gen_notebooks import * from pathlib import Path ``` ### To update this notebook Run `tools/sgen_notebooks.py Or run below: You need to make sure to refresh right after ``` import glob for f in Path().glob('*.ipynb'): generate_missing_metadata(f) ```...
github_jupyter
# maysics.calculus模块使用说明 calculus模块包含七个函数 |名称|作用| |---|---| |lim|极限| |ha|哈密顿算符| |grad|梯度| |nebla_dot|nebla算子点乘| |nebla_cross|nebla算子叉乘| |laplace|拉普拉斯算子| |inte|积分| <br></br> ## 求极限:lim lim(f, x0, acc=0.01, method='both') <br>求函数```f```在```acc```的误差下,$x\rightarrow x_{0}$的函数值 <br>```method```可选'both'、'+'、'-',分别表示双边极限、右...
github_jupyter
# Safely refactoring ACLs and firewall rules Changing ACLs or firewall rules (or *filters*) is one of the riskiest updates to a network. Even a small error can block connectivity for a large set of critical services or open up sensitive resources to the world at large. Earlier notebooks showed how to [analyze filters ...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
# This notebook serves as an example of how to create AutoTST objects and how to create 3D geometries ``` #General imports import os, sys import logging from copy import deepcopy import numpy as np import pandas as pd from multiprocessing import Process #RDKit imports import rdkit from rdkit import Chem from rdkit.Ch...
github_jupyter
## Tutorial 2: Mixture Models and Expectation Maximization ### Exercise 1: Categorical Mixture Model (CMM) ``` # Import libraries import numpy as np import pandas as pd from ast import literal_eval import matplotlib.pyplot as plt import gensim from wordcloud import WordCloud, STOPWORDS from categorical_em import Ca...
github_jupyter
# Dimensionality reduction using `scikit-learn` ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import preprocessing, model_selection as ms, \ manifold, decomposition as dec, cross_decomposition as cross_dec from sklearn.pipeline import Pipeline %matplotl...
github_jupyter
# 1. Import libraries ``` #----------------------------Reproducible---------------------------------------------------------------------------------------- import numpy as np import tensorflow as tf import random as rn import os seed=0 os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) rn.seed(seed) #sess...
github_jupyter
## Part I: On-policy learning and SARSA (3 points) _This notebook builds upon `qlearning.ipynb`, or to be exact, generating qlearning.py._ The policy we're gonna use is epsilon-greedy policy, where agent takes optimal action with probability $(1-\epsilon)$, otherwise samples action at random. Note that agent __can__...
github_jupyter
# Facies classification using Machine Learning # ## LA Team Submission 5 ## ### _[Lukas Mosser](https://at.linkedin.com/in/lukas-mosser-9948b32b/en), [Alfredo De la Fuente](https://pe.linkedin.com/in/alfredodelafuenteb)_ #### In this approach for solving the facies classfication problem ( https://github.com/seg/2016-...
github_jupyter
TSG086 - Run `top` in all containers ==================================== Steps ----- ### Instantiate Kubernetes client ``` # Instantiate the Python Kubernetes client into 'api' variable import os from IPython.display import Markdown try: from kubernetes import client, config from kubernetes.stream import ...
github_jupyter
# TASK #1: DEFINE SINGLE AND MULTI-DIMENSIONAL NUMPY ARRAYS ``` # NumPy is a Linear Algebra Library used for multidimensional arrays # NumPy brings the best of two worlds: (1) C/Fortran computational efficiency, (2) Python language easy syntax # Let's define a one-dimensional array import NumPy as np list_1 = [6,8...
github_jupyter
``` import pandas as pd import scipy.io import os import matplotlib.pyplot as plt path = os.getcwd() matlab_exe_path = '''matlab''' julia_path = '''C:\\Users\\mwaugh\\AppData\\Local\\Programs\\Julia\\Julia-1.4.0\\bin\\julia.exe''' path = "src\\calibration" #fig_path = "C:\\users\mwaugh\\github\\perla_tonetti_waugh\...
github_jupyter
``` import numpy as np import pandas as pd from CSVUtils import * import pickle from os import path import matplotlib.pyplot as plt ROOT_DIR = "./from github/Stock-Trading-Environment/" freq_list = [ { "freq": 1, "training": "10k", "DIR": "./output/200", "prefix": "BRZ+TW+NASDAQ-Trai...
github_jupyter
# Federated learning: pretrained model In this notebook, we provide a simple example of how to perform an experiment in a federated environment with the help of the Sherpa.ai Federated Learning framework. We are going to use a popular dataset and a pretrained model. ## The data The framework provides some functions f...
github_jupyter
## Using Isolation Forest to Detect Criminally-Linked Properties The goal of this notebook is to apply the Isolation Forest anomaly detection algorithm to the property data. The algorithm is particularly good at detecting anomalous data points in cases of extreme class imbalance. After normalizing the data and splitti...
github_jupyter
<img src="../images/aeropython_logo.png" alt="AeroPython" style="width: 300px;"/> # Secciones de arrays _Hasta ahora sabemos cómo crear arrays y realizar algunas operaciones con ellos, sin embargo, todavía no hemos aprendido cómo acceder a elementos concretos del array_ ## Arrays de una dimensión ``` # Accediendo a...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D1_ModelTypes/W1D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 1, Tutorial 2 # Model Types: "...
github_jupyter
## A quick Gender Recognition model Grabbed from [nlpforhackers](https://nlpforhackers.io/introduction-machine-learning/) webpage. 1. Firstly convert the dataset into a numpy array to keep only gender and names 2. Set the feature parameters which takes in different parameters 3. Vectorize the parametes 4. Get varied tr...
github_jupyter
# Get started <a href="https://mybinder.org/v2/gh/tinkoff-ai/etna/master?filepath=examples/get_started.ipynb"> <img src="https://mybinder.org/badge_logo.svg" align='left'> </a> This notebook contains the simple examples of time series forecasting pipeline using ETNA library. **Table of Contents** * [Creating T...
github_jupyter
# <div align="center">What is a Tensor</div> --------------------------------------------------------------------- you can Find me on Github: > ###### [ GitHub](https://github.com/lev1khachatryan) ***Tensors are not generalizations of vectors***. It’s very slightly more understandable to say that tensors are gene...
github_jupyter
``` %load_ext autoreload %autoreload 2 import numpy as np np.set_printoptions(precision=2) import matplotlib.pyplot as plt import copy as cp import sys, json, pickle PROJECT_PATHS = ['/home/nbuckman/Dropbox (MIT)/DRL/2020_01_cooperative_mpc/mpc-multiple-vehicles/', '/Users/noambuckman/mpc-multiple-vehicles/'] for p in ...
github_jupyter
# Classification example 2 using Health Data with PyCaret ``` #Code from https://github.com/pycaret/pycaret/ # check version from pycaret.utils import version version() ``` # 1. Data Repository ``` import pandas as pd url = 'https://raw.githubusercontent.com/davidrkearney/colab-notebooks/main/datasets/strokes_traini...
github_jupyter
# Logistic regression example ### Dr. Tirthajyoti Sarkar, Fremont, CA 94536 --- This notebook demonstrates solving a logistic regression problem of predicting Hypothyrodism with **Scikit-learn** and **Statsmodels** libraries. The dataset is taken from UCI ML repository. <br>Here is the link: https://archive.ics.uci....
github_jupyter
# Keras Functional API ``` # sudo pip3 install --ignore-installed --upgrade tensorflow import keras import tensorflow as tf print(keras.__version__) print(tf.__version__) # To ignore keep_dims warning tf.logging.set_verbosity(tf.logging.ERROR) ``` Let’s start with a minimal example that shows side by side a simple Se...
github_jupyter
``` # Libraries for R^2 visualization from ipywidgets import interactive, IntSlider, FloatSlider from math import floor, ceil from sklearn.base import BaseEstimator, RegressorMixin # Libraries for model building from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_absolute_error, mean_squ...
github_jupyter
<div> <img src="https://drive.google.com/uc?export=view&id=1vK33e_EqaHgBHcbRV_m38hx6IkG0blK_" width="350"/> </div> #**Artificial Intelligence - MSc** ##ET5003 - MACHINE LEARNING APPLICATIONS ###Instructor: Enrique Naredo ###ET5003_NLP_SpamClasiffier-2 ### Spam Classification [Spamming](https://en.wikipedia.org/w...
github_jupyter
<a href="https://colab.research.google.com/github/amathsow/wolof_speech_recognition/blob/master/Speech_recognition_project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip3 install torch !pip3 install torchvision !pip3 install torchaudio !pi...
github_jupyter
<a href="https://colab.research.google.com/github/lmcanavals/algorithmic_complexity/blob/main/05_01_UCS_dijkstra.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Breadth First Search BFS para los amigos ``` import graphviz as gv import numpy as n...
github_jupyter
# [Introduction to Data Science: A Comp-Math-Stat Approach](https://lamastex.github.io/scalable-data-science/as/2019/) ## YOIYUI001, Summer 2019 &copy;2019 Raazesh Sainudiin. [Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) # 08. Pseudo-Random Numbers, Simulating from Some Dis...
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
# k-Nearest Neighbor (kNN) implementation *Credits: this notebook is deeply based on Stanford CS231n course assignment 1. Source link: http://cs231n.github.io/assignments2019/assignment1/* The kNN classifier consists of two stages: - During training, the classifier takes the training data and simply remembers it - D...
github_jupyter
# Run Modes Running MAGICC in different modes can be non-trivial. In this notebook we show how to set MAGICC's config flags so that it will run as desired for a few different cases. ``` # NBVAL_IGNORE_OUTPUT from os.path import join import datetime import dateutil from copy import deepcopy import numpy as np import...
github_jupyter
``` import pandas as pd import numpy as np import os from matplotlib.pyplot import * from IPython.display import display, HTML import glob import scanpy as sc import pandas as pd import seaborn as sns import scipy.stats %matplotlib inline file = '/nfs/leia/research/stegle/dseaton/hipsci/singlecell_neuroseq/data/ipsc_s...
github_jupyter
``` %load_ext autoreload %autoreload 2 ``` # Generate images ``` from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt SMALL_SIZE = 15 MEDIUM_SIZE = 20 BIGGER_SIZE = 25 plt.rc("font", size=SMALL_SIZE) plt.rc("axes", titlesize=SMALL_SIZE) plt.rc("axes", labelsize=MEDIUM_SIZ...
github_jupyter
# Processing Milwaukee Label (~3K labels) Building on `2020-03-24-EDA-Size.ipynb` Goal is to prep a standard CSV that we can update and populate ``` import pandas as pd import numpy as np import os import s3fs # for reading from S3FileSystem import json # for working with JSON files import matplotlib.pyplot as pl...
github_jupyter
``` !nvidia-smi # unrar x "/content/drive/MyDrive/IDC_regular_ps50_idx5.rar" "/content/drive/MyDrive/" # !unzip "/content/drive/MyDrive/base_dir/train_dir/b_idc.zip" -d "/content/drive/MyDrive/base_dir/train_dir" import os ! pip install -q kaggle from google.colab import files files.upload() ! mkdir ~/.kaggle ! cp kag...
github_jupyter
# Security Master Analysis by @marketneutral ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import plotly.plotly as py from plotly.offline import init_notebook_mode, iplot import plotly.graph_objs as go import cufflinks as cf init_notebook_mode(connected=False) cf.set_config_file(offline=T...
github_jupyter
**Chapter 5 – Support Vector Machines** _This notebook contains all the sample code and solutions to the exercises in chapter 5._ # Setup First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figu...
github_jupyter
# Introduction to Biomechanics > Marcos Duarte > Laboratory of Biomechanics and Motor Control ([http://demotu.org/](http://demotu.org/)) > Federal University of ABC, Brazil ## Biomechanics @ UFABC ``` from IPython.display import IFrame IFrame('http://demotu.org', width='100%', height=500) ``` ## Biomechanics T...
github_jupyter
# Keras Exercise ## Predict political party based on votes As a fun little example, we'll use a public data set of how US congressmen voted on 17 different issues in the year 1984. Let's see if we can figure out their political party based on their votes alone, using a deep neural network! For those outside the Unit...
github_jupyter
# 6. External Libraries <a href="https://colab.research.google.com/github/chongsoon/intro-to-coding-with-python/blob/main/6-External-Libraries.ipynb" target="_parent"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a> Up till now, we have been using what ever is availab...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png"></a> # The Implicit Kinematic Wave Overland Flow Component <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/la...
github_jupyter
# SageMaker Debugger Profiling Report SageMaker Debugger auto generated this report. You can generate similar reports on all supported training jobs. The report provides summary of training job, system resource usage statistics, framework metrics, rules summary, and detailed analysis from each rule. The graphs and tab...
github_jupyter
# Overview This lab has been adapted from the angr [motivating example](https://github.com/angr/angr-doc/tree/master/examples/fauxware). It shows the basic lifecycle and capabilities of the angr framework. Note this lab (and other notebooks running angr) should be run with the Python 3 kernel! Look at fauxware.c! T...
github_jupyter
``` pip install mlxtend --upgrade --no-deps import mlxtend print(mlxtend.__version__) from google.colab import drive drive.mount('/content/gdrive') import cv2 import skimage import keras import tensorflow import numpy as np import matplotlib.pyplot as plt import p...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D1_RealNeurons/W3D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 3, Day 1, Tutorial 2 # Real Neurons: ...
github_jupyter
# Initialize a game ``` from ConnectN import ConnectN game_setting = {'size':(6,6), 'N':4, 'pie_rule':True} game = ConnectN(**game_setting) % matplotlib notebook from Play import Play gameplay=Play(ConnectN(**game_setting), player1=None, player2=None) ``` # Define our policy Please ...
github_jupyter
# Cleaning Your Data Let's take a web access log, and figure out the most-viewed pages on a website from it! Sounds easy, right? Let's set up a regex that lets us parse an Apache access log line: ``` import re format_pat= re.compile( r"(?P<host>[\d\.]+)\s" r"(?P<identity>\S*)\s" r"(?P<user>\S*)\s" r...
github_jupyter
# CORDIS FP7 ``` import json import re import urllib from titlecase import titlecase import pandas as pd pd.set_option('display.max_columns', 50) ``` ## Read in Data ``` all_projects = pd.read_excel('input/fp7/cordis-fp7projects.xlsx') all_projects.shape all_organizations = pd.read_excel('input/fp7/cordis-fp7organ...
github_jupyter
# Step 2: Building GTFS graphs and merging it with a walking graph We heavily follow Kuan Butts's Calculating Betweenness Centrality with GTFS blog post: https://gist.github.com/kuanb/c54d0ae7ee353cac3d56371d3491cf56 ### The peartree (https://github.com/kuanb/peartree) source code was modified. Until code is merged yo...
github_jupyter
<a href="https://colab.research.google.com/github/mengwangk/dl-projects/blob/master/04_02_auto_ml_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Automated ML ``` COLAB = True if COLAB: !sudo apt-get install git-lfs && git lfs install !rm -...
github_jupyter
# Print Compact Transitivity Tables ``` import qualreas as qr import os import json path = os.path.join(os.getenv('PYPROJ'), 'qualreas') ``` ## Algebras from Original Files ## Algebras from Compact Files ``` alg = qr.Algebra(os.path.join(path, "Algebras/Misc/Linear_Interval_Algebra.json")) alg.summary() alg.check_...
github_jupyter
# Logistic Regression With Linear Boundary Demo > ☝Before moving on with this demo you might want to take a look at: > - 📗[Math behind the Logistic Regression](https://github.com/trekhleb/homemade-machine-learning/tree/master/homemade/logistic_regression) > - ⚙️[Logistic Regression Source Code](https://github.com/tre...
github_jupyter
# Working with Tensorforce to Train a Reinforcement-Learning Agent This notebook serves as an educational introduction to the usage of Tensorforce using a gym-electric-motor (GEM) environment. The goal of this notebook is to give an understanding of what tensorforce is and how to use it to train and evaluate a reinfor...
github_jupyter
<a href="https://colab.research.google.com/github/martin-fabbri/colab-notebooks/blob/master/deeplearning.ai/nlp/c3_w1_03_trax_intro_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Trax : Ungraded Lecture Notebook In this notebook you'll get to ...
github_jupyter
# XGBoost model for Bike sharing dataset ``` import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline # preprocessing methods from sklearn.preprocessing import StandardScaler # accuracy measures and data spliting from sklearn.metrics import mean_squar...
github_jupyter
# Weather Data Collection ``` import pandas as pd import numpy as np from selenium import webdriver import time races = pd.read_csv('./data/races.csv') races.head() races.shape weather = races.iloc[:,[0,1,2]] info = [] for link in races.url: try: df = pd.read_html(link)[0] if 'Weather' in list(df....
github_jupyter
# Temporal Congruency Experiments ``` from scripts.imports import * from scripts.df_styles import df_highlighter out = Exporter(paths['outdir'], 'clause') # redefine df_sg to include adverbs df_sg = df[df.n_times == 1] df_sg.columns ``` # Tense Collocations with tokens ``` token_ct = df_sg.pivot_table( index=[...
github_jupyter
## APIs Let's start by looking at [OMDb API](https://www.omdbapi.com/). The OMDb API is a free web service to obtain movie information, all content and images on the site are contributed and maintained by users. The Python package [urllib](https://docs.python.org/3/howto/urllib2.html) can be used to fetch resources ...
github_jupyter
CWPK \#34: A Python Module, Part II: Packaging and The Structure Extractor ======================================= Moving from Notebook to Package Proved Perplexing -------------------------- <div style="float: left; width: 305px; margin-right: 10px;"> <img src="http://kbpedia.org/cwpk-files/cooking-with-kbpedia-305...
github_jupyter
``` ############## PLEASE RUN THIS CELL FIRST! ################### # import everything and define a test runner function from importlib import reload from helper import run import ecc, helper, tx, script # Signing Example from ecc import G, N from helper import hash256 secret = 1800555555518005555555 z = int.from_byte...
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 on...
github_jupyter
# Practice Exercise: Exploring data (Exploratory Data Analysis) ## Context: - The data includes 120 years (1896 to 2016) of Olympic games with information about athletes and medal results. - We'll focus on practicing the summary statistics and data visualization techniques that we've learned in the course. - In gener...
github_jupyter
``` # hide %load_ext nb_black # default_exp clients from will_it_saturate.clients import BaseClient from will_it_saturate.registry import register_model # export import os import math import time import httpx import asyncio import aiohttp import subprocess from pathlib import Path from datetime import datetime from ...
github_jupyter
##### Copyright 2020 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 netCDF4 from netCDF4 import Dataset import matplotlib.pyplot as plt import numpy as np import sys import math import os import glob import pandas import re from scipy.interpolate import griddata %matplotlib inline plt.rcParams["figure.figsize"] = (10,6) plt.rcParams.update({'font.size': 20}) data_path = "/p...
github_jupyter
``` ! pip install fastcore --upgrade -qq ! pip install fastai --upgrade -qq from fastai.vision.all import * import fastai from sys import exit from operator import itemgetter import re import torch from torch.nn import functional as F import numpy as np from time import process_time_ns, process_time import gc def scale...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score %matplotlib inline class NNModel: def __init__(self,learning_rate, n_iter, args): self.learning_rate = learning_rate self.ar...
github_jupyter