text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` from collections import Counter, defaultdict class Solution: def maxScoreWords(self, words, letters, score) -> int: def get_words(num): w_list = [] cnt = 0 while num: if num & 1: w_list.append(words[cnt]) num >>= 1 ...
github_jupyter
# Parameterize SageMaker Pipelines Customers can use SageMaker Pipelines to build scalable machine learning pipelines that preprocess data and train machine learning models. With SageMaker Pipelines, customers have a toolkit for every part of the machine learning lifecycle that provides deep customizations and tuning ...
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
## Data Extracting ### Get crime data from Analyze Boston website reference like: https://data.boston.gov/dataset/crime-incident-reports-august-2015-to-date-source-new-system/resource/12cb3883-56f5-47de-afa5-3b1cf61b257b - use a request to query the data from the api - store data in a dataframe using pandas framework...
github_jupyter
<h1>Testing the E2E simulations</h1> ## -- JWST aperture -- This script introduces the end-to-end (E2E) simulations that are used in **`calibration.py`**, for the influence calibration of each individual segment. The testing of the script itself is done in this next notebook. ``` import os import time import numpy a...
github_jupyter
# Recurrent Neural Networks Classical neural networks, including convolutional ones, suffer from two severe limitations: + They only accept a fixed-sized vector as input and produce a fixed-sized vector as output. + They do not consider the sequential nature of some data (language, video frames, time series, etc.) R...
github_jupyter
This examples shows how a classifier is optimized by cross-validation, which is done using the [sklearn.model_selection.GridSearchCV](http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV) object on a development set that comprises only half of t...
github_jupyter
# Documentation of Economic Analysis behind Simulation Engine - Part 3 In this notebook, we consider a dynamical system approach to analyze economic network response to demand shocks. Initially, an economy in a steady state is perturbed by means of an impulse shock. In a static view, where one assumes the output of ec...
github_jupyter
``` import numpy as np import random from matplotlib import pyplot as plt plt.rcParams['figure.figsize'] = (10.0, 8.0) from sklearn.datasets import make_biclusters from sklearn.datasets import samples_generator as sg # from sklearn.cluster.bicluster import SpectralCoclustering from sklearn.metrics import consensus_sco...
github_jupyter
**Chapter 10 – Introduction to Artificial Neural Networks** _This notebook contains all the sample code and solutions to the exercises in chapter 10._ # 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 func...
github_jupyter
# TensorFlow Tutorial Welcome to this week's programming assignment. Until now, you've always used numpy to build neural networks. Now we will step you through a deep learning framework that will allow you to build neural networks more easily. Machine learning frameworks like TensorFlow, PaddlePaddle, Torch, Caffe, Ke...
github_jupyter
``` # trees.r # MWL, Lecture 2 # Author(s): [Phil Snyder] #install.packages("mlbench", repos="http://cran.rstudio.com/") # we can download new libraries right from the R terminal! library("mlbench") #help(package="mlbench") data(BreastCancer) #help(topic="BreastCancer", package="mlbench") BreastCancer$Id <- NULL # Just...
github_jupyter
``` ''' Step 1: from output of evaluate qualification.py: worker_id and int percentage value Step 2: open worker csv file (downloaded from turk) and stat_dict = {worker_id: eval_score} for each cell in csv: if cellworker_id in stat_dict: update the qual column with stat_dict[cell_worker_id] ...
github_jupyter
**Downlaod and extract data** ``` ! wget -O A.zip http://epileptologie-bonn.de/cms/upload/workgroup/lehnertz/Z.zip ! wget -O B.zip http://epileptologie-bonn.de/cms/upload/workgroup/lehnertz/O.zip ! wget -O C.zip http://epileptologie-bonn.de/cms/upload/workgroup/lehnertz/N.zip ! wget -O D.zip http://epileptologie-bonn....
github_jupyter
# Estimating the Cost of Equity from Historical Price Data We want to estimate the cost of equity for a company. We have historical data on its stock prices, as well as prices of a market portfolio. We will estimate the CAPM $\beta$, and then calculate the CAPM to determine the cost of equity. :As a reminder, the CAP...
github_jupyter
### Python API HyperTS是DataCanvas Automatic Toolkit(DAT)工具链中,依托[Hypernets](https://github.com/DataCanvasIO/Hypernets)研发的关于时间序列的全Pipeline的自动化工具包。它遵循了make_expriment的使用习惯(类似于[HyperGBM](https://github.com/DataCanvasIO/HyperGBM)的API,一个针对于结构化表格数据的AutoML工具),也符合```scikit-learn```中model API的使用规范。我们可以创造一个```make_expriment```,``...
github_jupyter
``` %pylab inline from ipyparallel import Client, error cluster=Client(profile="mpi") view=cluster[:] view.block=True try: from openmdao.utils.notebook_utils import notebook_mode except ImportError: !python -m pip install openmdao[notebooks] ``` # Conversion Guide for the Auto-IVC (IndepVarComp) Feature As of...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=3 import tensorflow as tf gpu_devices = tf.config.experimental.list_physical_devices('GPU') if len(gpu_devices)>0: tf.config.experimental.set_memory_growth(gpu_devices[0], Tr...
github_jupyter
Audit Grouping === - Load (calibrated) ORES scores - Load revert probability scores - Group in some way (caliper width?) - Investigate groupings ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib import os from tqdm import tqdm import bz2 import sqlite3 import difflib imp...
github_jupyter
``` import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import random, numpy as np import pandas as pd import matplotlib.pyplot as plt torch.manual_seed(1) ``` ## Loading the datasets, i.e loading frames for few actions ``` #loading and pr...
github_jupyter
# [LEGALST-123] Lab 07: Intro to Folium ``` #from datascience import * %matplotlib inline import matplotlib.pyplot as plt from folium.plugins import HeatMap import numpy as np import folium import json import os !pip install folium --upgrade from folium.plugins import HeatMap ``` ## Data This lab will serve as an in...
github_jupyter
## Send More Money cryptarithmetic puzzle While not often spoken about as a classic data science technique, constraint programming can be a very useful tool in numerous scenarios. We'll look at solving a problem using brute force and then how constraint programming provides a very declarative style which saves us havi...
github_jupyter
``` # Installs !pip install --upgrade -q pip jax jaxlib !pip install --upgrade -q git+https://github.com/google/flax.git !pip install --upgrade -q git+https://github.com/rolandgvc/flaxvision.git # General imports import jax import jax.numpy as jnp import numpy as np from flax import linen as nn from flax import op...
github_jupyter
# Random walk baseline ``` import numpy as np import pandas as pd from scipy.fftpack import dct, idct import matplotlib import seaborn as sns import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.gridspec as gridspec from music21 import converter matplotlib.style.use('styles.mplstyle'...
github_jupyter
``` import os import sys import base64 from io import BytesIO import numpy as np from PIL import Image sys.path.append("..") from dash_reusable_components import * # Displays images smaller def display(im, new_width=400): ratio = new_width / im.size[0] new_height = round(im.size[1] * ratio) return im.res...
github_jupyter
# Point Source Deconvolution Deconvolution of a small, simulated point-source image demonstrating the simplest possible example. This is an idealized version of deconvolving subresolution bead images. **NOTE**: This is definitely a CPU-friendly example (it is not computationally intensive at all). ``` %matplotlib i...
github_jupyter
## Aula 01 - Entendendo Série Temporal ### Parte 1 - Coleta de Dados e Primeiras Análises - Fonte dos dados: [Governo do Estado de São Paulo](https://www.seade.gov.br/coronavirus/) ``` src = "../../data/modulo_03/dados_covid_sp.zip" import pandas as pd dados = pd.read_csv(src, sep=";") dados.head() dados["datahora"]...
github_jupyter
``` import os import time import math import bisect import numpy as np from numpy import array import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from scipy.stats import t, ttest_ind from collections import Counter import warnings from datetime import date import matplotlib.py...
github_jupyter
``` import os import sys import geopandas as gpd import pandas as pd import numpy as np import scipy import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cf from IPython.display import Markdown as md from sklearn.preprocessing import PolynomialFeatures from shapely import geometry ...
github_jupyter
# Read in All Saildrone cruises downloaded from https://data.saildrone.com/data/sets - 2017 onwards, note that earlier data is going to lack insruments and be poorer data quality in general - For this code I want to develop a routine that reads in all the different datasets and creates a standardized set - It may work ...
github_jupyter
# Remark<div class='tocSkip'/> The code in this notebook differs slightly from the printed book. For example we frequently use pretty print (`pp.pprint`) instead of `print` and `tqdm`'s `progress_apply` instead of Pandas' `apply`. Moreover, several layout and formatting commands, like `figsize` to control figure siz...
github_jupyter
# Analysis of French museums' collections (Joconde database) #### <br> *Download the open data CSV file [here](https://www.data.gouv.fr/fr/datasets/5b435ff2c751df675059dde9/) named joconde-MUSEES-valid.csv* #### <br> Load the table from the CSV file ##### *Initial fiels are named REF|INV|DOMN|DENO|TITR|AUTR|PERI|EPO...
github_jupyter
``` import json import pandas as pd import numpy as np with open("/home/ayush/Desktop/img_json/single_keypoints.json") as datafile: data = json.load(datafile) df = pd.DataFrame(data) df.head(5) df.info() import json import pandas as pd from pandas.io.json import json_normalize with open('/home/ayush/Deskt...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from typing import Callable, Optional, Tuple import numdifftools as nd import sympy as sp from iminuit import Minuit from iminuit.cost import LeastSquares import tabulate def fodd(f, x, p): return 0.5 * (f(x, p) - f(x, -p)) def central(f, x, p, h): hinv =...
github_jupyter
<a href="https://colab.research.google.com/github/papagorgio23/Python101/blob/master/Python_101.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Begining Libraries import pandas as pd #Basic sorage Lib import numpy as np #numpy additional Dat...
github_jupyter
# Anomalia bouguer para o Havaí ## Importando bibliotecas ``` import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import verde as vd import pyproj import boule as bl import harmonica as hm notebook_name = '6. Hawaii_bouguer_anomaly.ipynb' ``` ### Plot style ``` plt.style.use('ggplot') ``` ...
github_jupyter
# Pandas统计分析入门(2) - 转载注明转自:https://github.com/liupengyuan/ - ## 二维数据统计分析(DataFrame基础) --- ``` %matplotlib inline from pandas import Series, DataFrame import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ``` ## 二、二维数据统计分析(DataFrame基础) - 数据的描述、分析、可视化展示、概括性度量、输入与输出 df:多维条形图,多维折线...
github_jupyter
# Prepare Test Data ``` import pandas as pd import numpy as np pd.options.display.max_colwidth = 100000000 test_data = pd.read_csv("C:\\Users\\ricardo\\Github\\Kaggle\\1910_TMU_EnglishReviewClassification\\Data\\test_data.csv") print(len(test_data)) print(test_data.columns) # neg = "0", pos = "1" import math for i i...
github_jupyter
This material is copied (possibily with some modifications) from the [Python for Text-Analysis course](https://github.com/cltl/python-for-text-analysis/tree/master/Chapters). # Chapter 7 - Lists *This notebook uses code snippets and explanations from [this course](https://github.com/kadarakos/python-course/blob/maste...
github_jupyter
## CMA Diagram Clemmow-Mullaly-Allis (CMA) Diagram **Warning**: This notebook would store data (png images) under your jupyter working directory. To be accurate, that is `/the-path-to-your-jupyter-working-directroy/sinupy_data/dispersion/*.png`. Of course you can modify it (`data_path`) in the following block. ``` f...
github_jupyter
Implementation of Infinite Mixture Models using Dirichlet Process taken from http://blog.echen.me/2012/03/20/infinite-mixture-models-with-nonparametric-bayes-and-the-dirichlet-process/ ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm import seaborn as sns sns.set(c...
github_jupyter
# Actividad de interpolación ## Integrantes ``` integrantes = {} ``` ## Descripción ### Problema La resistencia del concreto en una obra está dada en la siguiente tabla de valores. | Tiempo (días) | Resistencia (GPa) | |:-------------:|:-----------------:| | 0 | 1 | | 2 | ...
github_jupyter
## 1. Google Play Store apps and reviews <p>Mobile apps are everywhere. They are easy to create and can be lucrative. Because of these two factors, more and more apps are being developed. In this notebook, we will do a comprehensive analysis of the Android app market by comparing over ten thousand apps in Google Play a...
github_jupyter
<h1>Module Description</h1> --- The current ipynb-module contains implementation of data preparing, especially it represents functions, which extracts faces from photos. For this purpose I've used the DNN module (specifically the network based on Single Shot MultiBox Detector, designed by [Aleksandr Rybnikov](https:/...
github_jupyter
``` %autosave 0 import pandas as pd import numpy as np import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import sys sys.path.append('..') ##Custom Lib import lib from lib.data_clean import DataClean from lib.classifier_trainer import ClassifierJob, MainAiJob from lib.plot import roc ## #...
github_jupyter
<a href="https://colab.research.google.com/github/YIKUAN8/Transformers-VQA/blob/master/openI_VQA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **In this notebook, we will classify 15 thoracic findings from Chest X-ray images and associated reports...
github_jupyter
# Detecting COVID-19 with Chest X Ray using PyTorch Image classification of Chest X Rays in one of three classes: Normal, Viral Pneumonia, COVID-19 Dataset from [COVID-19 Radiography Dataset](https://www.kaggle.com/tawsifurrahman/covid19-radiography-database) on Kaggle # Importing Libraries ``` from google.colab im...
github_jupyter
# Building Rollup hierarchies in python with Treelib and atoti This notebook is illustrating how to create a product catalog inside a BI application using Treelib and atoti. Full story is available on this link: https://medium.com/atoti/building-rollup-hierarchies-in-python-with-treelib-and-atoti-ffc61fbac69c?source=...
github_jupyter
<a href="https://colab.research.google.com/github/https-deeplearning-ai/tensorflow-1-public/blob/adding_C4/C4/W4/ungraded_labs/C4_W4_Lab_1_LSTM.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title Licensed under the Apache License, Version 2....
github_jupyter
# FEATURE EXTRACTION ``` import pandas as pd from textblob import TextBlob from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer d = pd.read_csv("Processed_tweets.csv") d = d.drop(["Unnamed: 0"],axis=1) d.head(10) d.drop_duplicates(inplace=True) d.isna...
github_jupyter
<img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם חינמי ללימוד תכנות בעברית."> # <span style="text-align: right; direction: rtl; float: r...
github_jupyter
# Goals ### Learn how to use full potential of monk in it's expert mode # Table of Contents ## [0. Install](#0) ## [1. Load data, setup model, select params, and Train](#1) ## [2. Run validation on trained classifier](#2) ## [3. Run inferencing on trained classifier](#3) <a id='0'></a> # Install Monk - ...
github_jupyter
___ ___ # Choropleth Maps ## Offline Plotly Usage Get imports and set everything up to be working offline. ``` import plotly.plotly as py import plotly.graph_objs as go from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot ``` Now set up everything so that the figures show up in the noteb...
github_jupyter
# Managing ML workflows with AWS Step Functions and the Data Science SDK <img align="left" width="130" src="https://raw.githubusercontent.com/PacktPublishing/Amazon-SageMaker-Cookbook/master/Extra/cover-small-padded.png"/> This notebook contains the code to help readers work through one of the recipes of the book [Ma...
github_jupyter
##### Copyright 2020 The TensorFlow IO 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 ...
github_jupyter
##Explore FrozenLakeEnv ``` import numpy as np import copy import check_test from frozenlake import FrozenLakeEnv from plot_utils import plot_values env=FrozenLakeEnv() print(env.observation_space) print(env.action_space) print(env.nS) print(env.nA) env.P[1][3] ``` ##Iterative Policy ``` def policy_evaluation(env,p...
github_jupyter
##### Copyright 2020 Google ``` #@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 agreed to in writ...
github_jupyter
``` library(hash) library(xts) library(lubridate) library(forecast) library(fpp) # Constants used throughout the code INPUT_FILE <- "../../../cocUptoDec2016.csv" DATA_FOLDER <- "../data/topNComplaints" ``` # Base Vignette Purpose: - To provide a quick start code snippet to get the data, loaded into a useable format fo...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt tf.logging.set_verbosity(tf.logging.INFO) #This way we can see the training information import os from google.colab import drive drive.mount('/content/drive') %matplotlib inline filedir = './drive/My Drive/Final/CNN_data' filelist = os.lis...
github_jupyter
``` %config IPCompleter.greedy=True ``` # Neuron Let's start with a simple neuron. From the biological point of view, the simplified view on neuron is following. ![Biological neuron](https://upload.wikimedia.org/wikipedia/commons/b/b5/Neuron.svg) The dendrites are inputs of the neuron. Outputs of other neurons are ...
github_jupyter
# Spiral-shaped distribution ``` Copyright (C) 2021 Code by Leopoldo Sarra and Florian Marquardt Max Planck Institute for the Science of Light, Erlangen, Germany http://www.mpl.mpg.de This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://...
github_jupyter
# Captcha Solver ``` import cv2 import keras import numpy as np from matplotlib import pyplot as plt %%capture !unzip generated_captcha_images.zip ``` ## Data Processing ### Extracting Single letters from Captcha. ``` import os import os.path, glob, imutils captcha_image_folder = "generated_captcha_images" output_...
github_jupyter
``` %load_ext autoreload %autoreload 2 import glob import nibabel as nib import os import time import pandas as pd import numpy as np from mricode.utils import log_textfile from mricode.utils import return_csv #from mricode.utils import return_iter path_output = './' path_tfrecords = '/data2/res64/down/' path_csv = ...
github_jupyter
# "Enabling Easy Zipapp Installs on Windows" > "How to prepare a Windows system for a good PYZ experience." - author: jhermann - toc: false - branch: master - badges: true - comments: true - published: true - categories: [python, deployment] - image: images/copied_from_nb/img/python/python+windows.png ![](img/python/p...
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
# Wafer map pattern classification using MultiNN - Directory /data/WMPC_CNN_0_0_softmax.pickle ... /data/WMPC_MFE_0_0_softmax.pickle ... ``` import pickle import os import sys import numpy as np from tensorflow.keras.layers import Input, Dense, MaxPooling2D, Concatenate from tensorflow.keras.applications.vgg16 impo...
github_jupyter
``` import numpy as np def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) # return x * (x > 0) def sigmoid_derivative(output): return output * (1 - output) # return 1.0 * (output > 0) # 整数与二进制转化 int2binary = {} binary_dim = 9 largest_number = pow(2, binary_dim) def int2bin(int_num): b_temp = bin(int_nu...
github_jupyter
# Functions and Methods Homework Complete the following questions: ____ **Write a function that computes the volume of a sphere given its radius.** <p>The volume of a sphere is given as $$\frac{4}{3} πr^3$$</p> ``` def vol(rad): return 4/3 * 22/7 * rad**3 # Check vol(2) ``` ___ **Write a function that checks wh...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/projects/NaturalLanguageProcessing/machine_translation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> &nbsp; <a href="https://kaggle.com/kernels/welcome?...
github_jupyter
``` from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from trackml.dataset import load_event from trackml.randomize import shuffle_hits from trackml.score import score_event import os import numpy as np import pandas as pd import glob im...
github_jupyter
# Defect Detection Model Here, we build a model to detect the presence/absence of defect (any kind) in a submersible pump impeller using Transfer Learning (with VGG16 base model) **Dataset**: [Submersible Pump Impeller Defect Dataset](https://www.kaggle.com/ravirajsinh45/real-life-industrial-dataset-of-casting-produc...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Automated ML on Azure Databricks In this example we use the scikit-learn's <a href="http://scikit-learn.org/stable/datasets/index.html#optical-recognition-of-handwritten-digits-dataset" target="_blank">digit dataset</a> to sh...
github_jupyter
# Random Agent in Malmo This guide shows how to setup a single-player Malmo mission. This example may serve as a basis to use Malmo in your RL experiments. ## Malmo launcher In earlier versions of ```malmoenv``` each Minecraft instance had to be started manually from command line. The launcher handles these processes ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd from sklearn.linear_model import LogisticRegression import seaborn as sns from sklearn.pipeline import Pipeline from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from skl...
github_jupyter
# Building a Model in Helipad In this walkthrough, we’ll build a very simple model of two goods where decentralized trading results in agents converging on an equilibrium price. Each period, agents pair off randomly and see if they can become better off by trading. If so, they trade. If not, they do nothing. In just a...
github_jupyter
![](../graphics/solutions-microsoft-logo-small.png) # Data Science Projects with SQL Server Machine Learning Services ## 06 Customer Acceptance and Model Retraining <p style="border-bottom: 1px solid lightgrey;"></p> <dl> <dt>Course Outline</dt> <dt>1 Overview and Course Setup</dt> <dt>2 Business Understandin...
github_jupyter
<a href="https://colab.research.google.com/github/Data-Science-and-Data-Analytics-Courses/UCSanDiegoX---Machine-Learning-Fundamentals-03-Jan-2019-audit/blob/master/Week%2006%20Linear%20Classification/perceptron_at_work/perceptron_at_work.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-b...
github_jupyter
# Dropout Dropout [1] is a technique for regularizing neural networks by randomly setting some features to zero during the forward pass. In this exercise you will implement a dropout layer and modify your fully-connected network to optionally use dropout. [1] [Geoffrey E. Hinton et al, "Improving neural networks by pr...
github_jupyter
# Friendship Paradox #### Author: [Erika Fille Legara](https://erikalegara.site) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/eflegara/Network-Science-Lectures/blob/master/LICENSE.md) --- <table align="left" border=0> <!-- <table class="tfo-notebook-buttons" align="left"...
github_jupyter
### The purpose of this notebook is to load the referential data of `chairs-in-context` and package them in a pandas dataframe along with other simple datastructures like dictionaries that map integers to tokens etc. Having access to these pre-processed data, is the first step before you start training neural listener ...
github_jupyter
# VMEC Python Interface This notebook introduces the user to the VMEC Python interface. This is accomplished by using the CTYPES Python library interface to directly access a statically linked version of libstell as compiled with the VMEC distribution. First we Test if we can load the library. ``` from libstell impo...
github_jupyter
[![AWS Data Wrangler](_static/logo.png "AWS Data Wrangler")](https://github.com/awslabs/aws-data-wrangler) # 11 - CSV Datasets Wrangler has 3 different write modes to store CSV Datasets on Amazon S3. - **append** (Default) Only adds new files without any delete. - **overwrite** Deletes everything in t...
github_jupyter
# 3.1.3. Sensor-to-sample distance This code generates all the results presented in the subsubsection 3.1.3 Sensor-to-sample distance. ### License This code is licensed under under the [BSD 3-clause](http://choosealicense.com/licenses/bsd-3-clause/) license. See the file `LICENSE.md` ### Import the required depende...
github_jupyter
# Sankey Diagram ``` #Simple Sankey Diagram fig = go.Figure( go.Sankey( node = { "label": ["India", "USA", "China", "Pakistan", "Bangladesh", "Mexico"], }, link = { ...
github_jupyter
# Binary Classification This is a basic example in which we learn to ground unary predicate $A$ that is defined in the space of $[0,1]^2$. We define the predicate $A$ to apply to points that are close to the middle point $c=(.5,.5)$.In order to get training data, we randomly sample data from the domain. We split the ...
github_jupyter
## Datasets ``` # Visualization %pylab inline from IPython.display import display, Math, Latex import matplotlib.pyplot as plt # handling data import csv import json import pandas as pd # Math from random import random import scipy.stats as ss import numpy as np import itertools from collections import Counter ``` ...
github_jupyter
# cuML Preprocessing Users of cuML are certainly familiar with its ability to run machine learning models on GPUs and the significant training and inference speedup that can entail, but the models themselves are only part of the story. In this notebook, we will demonstrate how cuML allows you to develop an entire machi...
github_jupyter
``` #Introduction #..... ``` Check to see if jupyter lab uses the correct python interpreter with '!which python'. It should be something like '/opt/anaconda3/envs/[environment name]/bin/python' (on Mac). If not, try this: https://github.com/jupyter/notebook/issues/3146#issuecomment-352718675 ``` import sys sys.exec...
github_jupyter
# iAR package Demo - BIAR Model ``` import iar import numpy as np import matplotlib.pyplot as plt print("iAR version:") print(iar.__version__) ``` # Simulates from a BIAR Model ``` from iar import BIAR_sample,gentime np.random.seed(6713) n=300 phi1=0.9 phi2=0.4 sT=gentime(n=n,lambda1=15,lambda2=2) y,sT,Sigma =BIAR_s...
github_jupyter
# Using the NDBC Buoy Data Scraper The Buoy class is used to get realtime and historical data from [NDBC Buoys](https://www.ndbc.noaa.gov/) [Realtime Buoy Data](#Realtime-data-from-the-Neah-Bay-buoy) [Historical Buoy Data](#Historical-data) ``` from buoyscraper import Buoy ``` ## Realtime data from the Neah Bay b...
github_jupyter
Before we begin, let's execute the cell below to display information about the CUDA driver and GPUs running on the server by running the `nvidia-smi` command. To do this, execute the cell block below by giving it focus (clicking on it with your mouse), and hitting Ctrl-Enter, or pressing the play button in the toolbar ...
github_jupyter
``` from openpiv import tools, pyprocess, scaling, filters, \ validation, preprocess import numpy as np from skimage import io import matplotlib.pyplot as plt %matplotlib inline file_a = '../test4/Camera1-0101.tif' file_b = '../test4/Camera1-0102.tif' im_a = tools.imread( file_a ) im_b = tools.im...
github_jupyter
# Text Preprocessing For any NLP tasks in Deep Learning the first step would be preprocessing the text data into numbers! In the recent years almost all the DL packages have started to provide their own APIs to do the text preprocessing, however each one has its own subtle differences, which if not understood correct...
github_jupyter
``` import pickle import numpy as np class SeqDataset(object): def __init__(self, ids, features, labels, groups, wordRanges, truePos): ''' ids are ids of candidate sequences each row of features is 13 features corresponding to the following: feature_0: pred_end - pred_start so len...
github_jupyter
``` # importing libraries import argparse import os import pickle import logging import boto3 import faiss import pandas as pd from tqdm import tqdm from random import sample ######################################## # 从s3同步数据 ######################################## def sync_s3(file_name_list, s3_folder, local_folder...
github_jupyter
# Utilizing existing FAQs for Question Answering [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deepset-ai/haystack/blob/master/tutorials/Tutorial4_FAQ_style_QA.ipynb) While *extractive Question Answering* works on pure texts and is therefore more...
github_jupyter
``` from google.colab import drive import os import shutil import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from tensorflow import keras from keras import layers from keras import models from keras import optimizers from keras.layers import Input, Dense, Activation, Flatten...
github_jupyter
# Laboratory 03 - Introduction to Digital Data Acquisition, FFT, and Spectrum Analysis 2 ## MAE 3120, Spring 2020 ## Grading Rubric Procedures, Results, Plots, Tables - 60% Discussion Questions - 25% Neatness - 15% ## Introduction and Background Prior to the 1980s, the oscilloscope and strip-chart recorder repr...
github_jupyter
# Use Amazon Sagemaker Distributed Model Parallel to Launch a BERT Training Job with Model Parallelization Sagemaker distributed model parallel (SMP) is a model parallelism library for training large deep learning models that were previously difficult to train due to GPU memory limitations. SMP automatically and effic...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Model Development with Custom Weights This example shows how to retrain a model with custom weights and fine-tune the model with quantization, then deploy the model running on FPGA. Only Windows is supported. We use TensorFlo...
github_jupyter