code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import matplotlib.pyplot as plt def model(): """Solve u'' = -1, u(0)=0, u'(1)=0.""" import sympy as sym x, c_0, c_1, = sym.symbols('x c_0 c_1') u_x = sym.integrate(1, (x, 0, x)) + c_0 u = sym.integrate(u_x, (x, 0, x)) + c_1 r = sym.solve([u.subs(x,0) - 0, sym.diff(u,x).su...
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
# Bubble Sort ``` def sort(lst): while True: corrected = False for i in range(0,len(lst)-1): if lst[i]>lst[i+1]: lst[i],lst[i+1] = lst[i+1],lst[i] corrected = True if not corrected: return lst sort([2,13,3,7,1,5]) sort([15,14,...
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
# TensorFlow Data Validation Example This notebook describes how to explore and validate Chicago Taxi dataset using TensorFlow Data Validation. # Setup Import necessary packages and set up data paths. ``` import tensorflow_data_validation as tfdv import os BASE_DIR = os.getcwd() DATA_DIR = os.path.join(BASE_DIR, 'd...
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
``` import pandas as pd import numpy as np import seaborn as sns import plotly.graph_objects as go import matplotlib.pyplot as plt from itertools import combinations data = np.load('/home/jan/lbc_full.npy') meta = pd.read_csv('/mnt/tchandra-lab/Jan/methyl-pattern/data/lbc/meta.csv') lbc_fitness = pd.read_csv('Datasets...
github_jupyter
# ML Model For Crop Prediction 1. We are using the dataset which we have already cleaned and can be found <a href="https://github.com/Harshit564/Crop-Prediction-ML-Model/blob/main/final_crops_data.csv" target="_top">here</a> 2. Our goal is to train a ML model which can predict the crop from the given features. ``` #...
github_jupyter
<a href="https://colab.research.google.com/github/navroz-lamba/DS-Unit-2-Linear-Models/blob/master/Assignment_214_Logistic_Regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd import numpy as np import matplotlib.pyplot...
github_jupyter
# Objective: As input to the system, take the live feed from the webcam and use pose estimation to map out a small dance tutorial. # Approach: - We will take a pretrained **openpose estimation model** to prdict the **18 keypoints** on a human body. - We take openpose model for tensorflow by Ildoo Kim - GitHub Repo ...
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
# TensorFlow Datasetのテスト [tf.data.Dataset のAPIドキュメント (tensorflow.org/api_docs)](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) ``` import numpy as np import tensorflow as tf ``` ## 共通的に利用する関数定義 0..9までの連番を格納したDatasetを作成する`make_ds`と、Datasetの中身を表示する`print_ds`を定義。 1回の`print_ds`呼び出しが、機械学習の1エポックのデータ取り出しに相当...
github_jupyter
# _*Pricing European Put Options*_ ### Introduction <br> Suppose a <a href="http://www.theoptionsguide.com/put-option.aspx">European put option</a> with strike price $K$ and an underlying asset whose spot price at maturity $S_T$ follows a given random distribution. The corresponding payoff function is defined as: $$\...
github_jupyter
# Le-Net 1 based architecture ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np from numpy import linalg as lin import scipy.signal as sig from PIL import Image import glob import matplotlib.cm as cm import itertools ########### Functions ########################################################...
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
##### 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
##### Copyright 2022 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 agr...
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
# 2.3 Linear Time However, finding the minimal value in an unordered array is not a constant time operation as scanning over each element in the array is needed in order to determine the minimal value. Hence it is a linear time operation, taking O(n) time. If the number of elements is known in advance and does not cha...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.print_figure_kwargs = {'bbox_inches':None} import sys if '..' not in sys.path: sys.path.append('..') import pandas as pd import numpy as np import networkx as nx import copy import scipy as sp import math import seaborn import pickl...
github_jupyter
<a href="https://colab.research.google.com/github/btian/deep-learning/blob/main/debiasing.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import IPython IPython.display.YouTubeVideo('59bMh59JQDo') %tensorflow_version 2.x import tensorflow as t...
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
# Formulas: Fitting models using R-style formulas Since version 0.5.0, ``statsmodels`` allows users to fit statistical models using R-style formulas. Internally, ``statsmodels`` uses the [patsy](http://patsy.readthedocs.org/) package to convert formulas and data to the matrices that are used in model fitting. The form...
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
``` %%html <style> table {float:left} </style> !pip install torch tqdm lazyme nltk gensim !python -m nltk.downloader punkt import numpy as np from tqdm import tqdm import pandas as pd from gensim.corpora import Dictionary import torch from torch import nn, optim, tensor, autograd from torch.nn import functional as F...
github_jupyter
# Lesson 4 Practice: Pandas Part 2 Use this notebook to follow along with the lesson in the corresponding lesson notebook: [L04-Pandas_Part2-Lesson.ipynb](./L04-Pandas_Part2-Lesson.ipynb). ## Instructions Follow along with the teaching material in the lesson. Throughout the tutorial sections labeled as "Tasks" are in...
github_jupyter
### 基于数据集多重抽样的分类器 **元算法(meta-algorithm)** 是对其他算法进行组合的一种方式。Adaboosting算法是最流行的元算法。 将不同的分类器组合起来,这种组合结果被称为**集成方法(ensemble method)** 或者**元算法(meta-algorithm)** 。使用集成方法时会有多种形式:可以是不同算法的集成,也可以是同一算法在不同设置下的集成,还可以是数据集不同部分分配给不同分类器之后的集成。 AdaBoost算法的优缺点 - 优点:泛化错误低,易编码,可以应用在大部分分类器上,无参数调整。 - 缺点:对离群点敏感。 - 适用数据类型:数值型和标称型。 #### b...
github_jupyter
``` import keras keras.__version__ ``` # Understanding recurrent neural networks 이 노트북은 [케라스 창시자에게 배우는 딥러닝](https://tensorflow.blog/케라스-창시자에게-배우는-딥러닝/) 책의 6장 2절의 코드 예제입니다. 책에는 더 많은 내용과 그림이 있습니다. 이 노트북에는 소스 코드에 관련된 설명만 포함합니다. 이 노트북의 설명은 케라스 버전 2.2.2에 맞추어져 있습니다. 케라스 최신 버전이 릴리스되면 노트북을 다시 테스트하기 때문에 설명과 코드의 결과가 조금 다를 수 있습...
github_jupyter
# Generative Adversarial Network In this notebook, we'll be building a generative adversarial network (GAN) trained on the MNIST dataset. From this, we'll be able to generate new handwritten digits! GANs were [first reported on](https://arxiv.org/abs/1406.2661) in 2014 from Ian Goodfellow and others in Yoshua Bengio'...
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
# ETL Pipeline Preparation Follow the instructions below to help you create your ETL pipeline. ### 1. Import libraries and load datasets. - Import Python libraries - Load `messages.csv` into a dataframe and inspect the first few lines. - Load `categories.csv` into a dataframe and inspect the first few lines. ``` # imp...
github_jupyter
# ML Exercise 1 - Linear Regression To help you start with Python and NumPy, there is a great tutorial online, created at Stanford. It can be downloaded as a notebook at https://github.com/kuleshov/cs228-material/tree/master/tutorials/python. Note that this tutorial is written in Python 2.7. <font color='red'> PLEAS...
github_jupyter
# Movie Recommender System ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import ast %matplotlib inline movies = pd.read_csv('tmdb_5000_movies.csv') credits = pd.read_csv('tmdb_5000_credits.csv') movies.head() credits.head() movies = movies.merge(credits, on='title') m...
github_jupyter
``` !pip install transformers # generics import pandas as pd import numpy as np from tqdm import tqdm import re from collections import defaultdict import matplotlib.pyplot as plt import random !pip install pytypo import pytypo from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import tra...
github_jupyter
# Autotrainer PPO2 on Gym Pendulum Test the autotrainer on Open Ai's Pendulum environment, which is continuous and considered to be an easy enviroment to solve. ## Ensure that Tensorflow is using the GPU ``` import tensorflow as tf if tf.test.gpu_device_name(): print('Default GPU Device: {}'.format(tf.test.gpu_de...
github_jupyter
# Quantization of Image Classification Models This tutorial demostrates how to apply INT8 quantization to Image Classification model using [Post-training Optimization Tool API](../../compression/api/README.md). The Mobilenet V2 model trained on Cifar10 dataset is used as an example. The code of this tutorial is design...
github_jupyter
# Using PLIO to analyze control networks PLIO is a general purpose library for reading data from various sources. In this workshop, we will be using PLIO's ability to read ISIS control networks into a Pandas dataframe. ``` # PLIO uses pysis for some other things. We don't technically need this but it avoids a warning....
github_jupyter
``` %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import datetime import pytz columns = ['Capture_time', 'Id'] data = pd.read_csv('evo_data_menor.csv', usecols=columns, nrows=500000) data.head() print(datetime.datetime.now()) # Colleting vehicle ids car_ids = list(data.Id.unique()) print(date...
github_jupyter
``` # import useful stuff import pandas as pd from sklearn.tree import DecisionTreeClassifier as Tree import re # avoid undefined metric warning when calculating precision with 0 labels defined as 1 import warnings warnings.filterwarnings('ignore') ``` ### Data transformations (from data analysis) ``` def transform(...
github_jupyter
# Activation Functions This function introduces activation functions in TensorFlow We start by loading the necessary libraries for this script. ``` import matplotlib.pyplot as plt import numpy as np import tensorflow as tf # from tensorflow.python.framework import ops # ops.reset_default_graph() tf.reset_default_gra...
github_jupyter
# The Penniless Pilgrim I came across this TED Ed video with a riddle (by [Dan Finkel](https://mathforlove.com/who-am-i/dan-finkel/)) on YouTube: ``` %%HTML <iframe width="560" height="315" src="https://www.youtube.com/embed/6sBB-gRhfjE" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> ``` ...
github_jupyter
# Bulk Labelling as a Notebook This notebook contains a convenient pattern to cluster and label new text data. The end-goal is to discover intents that might be used in a virtual assistant setting. This can be especially useful in an early stage and is part of the "iterate on your data"-mindset. ## Dependencies Yo...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> *This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth...
github_jupyter
# PyWRspice Wrapper Tutorial: Run simulation on remote SSH server #### Prerequisite: * You need to complete the *Tutorial.ipynb* notebook first. Here we assume you are already famililar with running PyWRspice on a local computer. ``` # Add pyWRspice location to system path, if you haven't run setup.py import sys sys...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Aiport-data" data-toc-modified-id="Aiport-data-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Aiport data</a></span></li><li><span><a href="#Get-all-weather-data-..." data-toc-modified-id="Get-all-weathe...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/NAIP/ndwi_single.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="https...
github_jupyter
# Check original file against published reports ## ADU / SPR ``` import intake import numpy as np import pandas as pd import laplan catalog = intake.open_catalog('../catalogs/*.yml') bucket_name = "city-planning-entitlements" start_date = "1/1/10" end_date = "10/31/19" # Let's throw our new master_pcts into the d1_s...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.externals import joblib from sklearn.preprocessing import LabelEncoder from sklearn.metrics import accuracy_score import time from sklearn.metrics import accuracy_score from sklearn.metrics import precision_score,recall_score from sklearn.metrics import roc_curve ...
github_jupyter
# The Fuzzing Book ## Sitemap While the chapters of this book can be read one after the other, there are many possible paths through the book. In this graph, an arrow _A_ → _B_ means that chapter _A_ is a prerequisite for chapter _B_. You can pick arbitrary paths in this graph to get to the topics that interest you mo...
github_jupyter
# Transfer Learning Template ``` %load_ext autoreload %autoreload 2 %matplotlib inline import os, json, sys, time, random import numpy as np import torch from torch.optim import Adam from easydict import EasyDict import matplotlib.pyplot as plt from steves_models.steves_ptn import Steves_Prototypical_Network ...
github_jupyter
# Applying DMD for transient modeling, surrogates and Uncertainty Quantificaton. ## 2D LRA Benchmark: In this test case, a control rod ejection in the 2D well known LRA benchmark has been simulated by Detran (developed by J. A. Roberts). The objective here is to build a data-driven, yet physics-revealing time-depende...
github_jupyter
# [SOLUTION] Attention Basics In this notebook, we look at how attention is implemented. We will focus on implementing attention in isolation from a larger model. That's because when implementing attention in a real-world model, a lot of the focus goes into piping the data and juggling the various vectors rather than t...
github_jupyter
``` import h5py import numpy as np import matplotlib.pyplot as plt plt.style.use('presentation') from shabanipy.jj.plotting_general import plot_inplane_vs_bias, plot_inplane_vs_Ic_Rn, plot_inplane_vs_IcRn #: Name of the sample that must appear in the measurement name usually of the form "{Wafer}-{Piece}_{Design}-{It...
github_jupyter
# WOR Forecasting In this section is introduced the basic classes and functions to make Forecast by applying the Wor Methodology ``` import os from dcapy import dca from datetime import date import numpy as np ``` The WOR forecasting is an empirical method to estimate the trend of the water production with respect t...
github_jupyter
<a href="https://colab.research.google.com/github/jads-nl/intro-to-python/blob/develop/00_intro/00_content.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # An Introduction to Python and Programming This book is a *thorough* introduction to program...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 from numpy import array origin_image=mpimg.imread("canny-edge-detection-test.jpg") plt.figure() # plt.subplot(1,3,1) # plt.imshow(image) image=array(origin_image) ysize = image.shape[0] xsize = image.shape[1] left_bott...
github_jupyter
# Bayesian Regression Using NumPyro In this tutorial, we will explore how to do bayesian regression in NumPyro, using a simple example adapted from Statistical Rethinking [[1](#References)]. In particular, we would like to explore the following: - Write a simple model using the `sample` NumPyro primitive. - Run inf...
github_jupyter
# Reasoning in LTN This tutorial defines and illustrates reasoning in LTN. It expects basic familiarity with other parts of LTN. ### Logical Consequence in LTN The essence of reasoning is to determine if a closed formula $\phi$ is the logical consequence of a knowledgebase $(\mathcal{K},\mathcal{G}_\theta,\Theta)$,...
github_jupyter
# Customizing datasets in fastai ``` from fastai import * from fastai.gen_doc.nbdoc import * from fastai.vision import * ``` In this tutorial, we'll see how to create custom subclasses of [`ItemBase`](/core.html#ItemBase) or [`ItemList`](/data_block.html#ItemList) while retaining everything the fastai library has to ...
github_jupyter
# Creating a Real-Time Inferencing Service You've spent a lot of time in this course training and registering machine learning models. Now it's time to deploy a model as a real-time service that clients can use to get predictions from new data. ## Connect to Your Workspace The first thing you need to do is to connec...
github_jupyter
# Extensisq methods & Lotka-Volterra problem The extensisq methods are compared to the explicit runge kutta methods of scipy on the Lotka-Volterra problem (predator prey model). This problem was copied from the solve_ivp page in scipy's reference manual. ## Problem definition The parameters of this problem are define...
github_jupyter
# Creation of synthetic data for Wisoncsin Breat Cancer data set using a Variational AutoEncoder. Tested using a logistic regression model. ## Aim To test a a Variational AutoEncoder (VAE) for synthesising data that can be used to train a logistic regression machine learning model. ## Data Raw data is avilable at: ...
github_jupyter
**MNIST Handwritten Digit Classification Dataset** ``` # example of loading the mnist dataset from tensorflow.keras.datasets import mnist from matplotlib import pyplot as plt # load dataset (trainX, trainy), (testX, testy) = mnist.load_data() # summarize loaded dataset print('Train: X=%s, y=%s' % (trainX.shape, trainy...
github_jupyter
<a href="https://colab.research.google.com/github/bhuiyanmobasshir94/Cow-weight-and-Breed-Prediction/blob/main/notebooks/031_dec.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import pandas as pd import sys import os import P...
github_jupyter
# Python for Geosciences Nikolay Koldunov koldunovn@gmail.com This is part of [**Python for Geosciences**](https://github.com/koldunovn/python_for_geosciences) notes. # Why python? ## - It's easy to learn, easy to read and fast to develop It is considered to be the language of choice for beginners, and proper co...
github_jupyter
References: - http://www.diva-portal.org/smash/get/diva2:1382324/FULLTEXT01.pdf - https://stackabuse.com/hierarchical-clustering-with-python-and-scikit-learn/ ``` import numpy as np import pandas as pd from sklearn.cluster import AgglomerativeClustering from sklearn import metrics from sklearn.model_selection import...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split, GridSearchCV, RandomizedSearchCV from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor from sklearn.ensemble import RandomForestClassifier, RandomFores...
github_jupyter
``` import afqinsight.nn.tf_models as nn import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from afqinsight.datasets import AFQDataset from afqinsight.nn.tf_models import cnn_lenet, mlp4, cnn_vgg, lstm1v0, lstm1, lstm2, blstm1, blstm2, lstm_fcn, cnn_resnet from sklearn.impute import SimpleImpute...
github_jupyter
# 06_Feed-forward_Neural_Networks In this notebook, we will see how to define simple feed-foward neural networks. ``` import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt %matplotlib inline torch.manual_seed(...
github_jupyter
## 7. Fourier-transzformációs módszer, FFTMethod A kiértékelés a lépései: **betöltés &rarr; előfeldolgozás &rarr; IFFT &rarr; ablakolás &rarr; FFT &rarr; fázis** A programban is hasonló nevű a függvényeket kell meghívni. Az ajánlott sorrend a függvények hívásában a fenti folyamatábra, mivel nem garantált, hogy a ten...
github_jupyter
``` # our usual things! %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np # weather in Champaign! w = pd.read_csv("/Users/jillnaiman1/Downloads/2018_ChampaignWeather.csv") w # sort by date w.sort_values(by='DATE') # w is our pandas dataframe, sort_values is a pandas call type(w['...
github_jupyter
# Lab 2 - Logistic Regression (LR) with MNIST This lab corresponds to Module 2 of the "Deep Learning Explained" course. We assume that you have successfully completed Lab 1 (Downloading the MNIST data). In this lab we will build and train a Multiclass Logistic Regression model using the MNIST data. ## Introduction ...
github_jupyter
# GeoNet FDSN webservice with Obspy demo - Station Service This demo introduces some simple code that requests data using [GeoNet's FDSN webservices](http://www.geonet.org.nz/data/tools/FDSN) and the [obspy module](https://github.com/obspy/obspy/wiki) in python. This notebook uses Python 3. ### Getting Started - Imp...
github_jupyter
``` import pandas as pd from shapely.ops import unary_union import shapely import geopandas as gpd from shapely.geometry import Polygon from shapely.geometry import Point from bs4 import BeautifulSoup from urllib.request import Request, urlopen import requests import re import glob import numpy as np import pandas as p...
github_jupyter
``` from keras import applications from keras.models import Sequential, Model from keras.models import Model from keras.layers import Dropout, Flatten, Dense, Activation, Reshape from keras.callbacks import CSVLogger import tensorflow as tf from scipy.ndimage import imread import numpy as np import random from keras.la...
github_jupyter
Thanks for @christofhenkel @abhishek @iezepov for their great work: https://www.kaggle.com/christofhenkel/how-to-preprocessing-for-glove-part2-usage https://www.kaggle.com/abhishek/pytorch-bert-inference https://www.kaggle.com/iezepov/starter-gensim-word-embeddings ``` import sys package_dir = "../input/ppbert/pytorc...
github_jupyter
# Univariate Plots (understanding each attribute of dataset independently) ## Histogram * Histograms group data into bins and provides a count of the number of observations in each bin. * From the shape of the bins we can quickly get a feeling for whether an attribute is Gaussian,skewed or even has exponential distri...
github_jupyter
<a href="https://www.nvidia.com/en-us/deep-learning-ai/education/"> <img src="images/DLI Header.png" alt="Header" style="width: 400px;"/> </a> <a href="https://www.mayoclinic.org/"><img src="images/mayologo.png" alt="Mayo Logo"></a> # Medical Image Classification Using the MedNIST Dataset ### Special thanks to <a href...
github_jupyter
# python-sonic - Programming Music with Python, Sonic Pi or Supercollider Python-Sonic is a simple Python interface for Sonic Pi, which is a real great music software created by Sam Aaron (http://sonic-pi.net). At the moment Python-Sonic works with Sonic Pi. It is planned, that it will work with Supercollider, too. ...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/image_displacement.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" hre...
github_jupyter
[Loss Function](https://www.bualabs.com/archives/2673/what-is-loss-function-cost-function-error-function-loss-function-how-cost-function-work-machine-learning-ep-1/) หรือ Cost Function คือ การคำนวน Error ว่า yhat ที่โมเดลทำนายออกมา ต่างจาก y ของจริง อยู่เท่าไร แล้วหาค่าเฉลี่ย เพื่อที่จะนำมาหา Gradient ของ Loss ขึ้นกับ ...
github_jupyter
# Example: CanvasXpress circular Chart No. 6 This example page demonstrates how to, using the Python package, create a chart that matches the CanvasXpress online example located at: https://www.canvasxpress.org/examples/circular-6.html This example is generated using the reproducible JSON obtained from the above pag...
github_jupyter
# Found in translation/interpreting (MoTra21) In this paper we classify written, spoken, translation and interpreting using competing sets of features, with a SVM ``` import time import nltk from sklearn import svm import sklearn from sklearn.svm import SVC import glob from lexical_diversity import lex_div as ld impo...
github_jupyter
# Exploring different Coastline options in Magics This notebook will help you discover lots of posibilities for designing background of your maps in Magics. From your workstation: load magics module swap(or load) Magics/new jupyter notebook load this notebook **mcoast** controls background of our maps. He...
github_jupyter
# Benchmarking with Argo Worfklows & Vegeta In this notebook we will dive into how you can run bench marking with batch processing with Argo Workflows, Seldon Core and Vegeta. Dependencies: * Seldon core installed as per the docs with Istio as an ingress * Argo Workfklows installed in cluster (and argo CLI for comm...
github_jupyter
# Part 1: Introducing txtai [txtai](https://github.com/neuml/txtai) builds an AI-powered index over sections of text. txtai supports building text indices to perform similarity searches and create extractive question-answering based systems. NeuML uses txtai and/or the concepts behind it to power all of our Natural ...
github_jupyter
``` # IMPORT OUR DEPENDENCIES: #To create our randomly-selected coordinates: import random import requests import numpy as np #To hold our data and create dataframes: import pandas as pd #Our API keys, and citipy (newly installed for project), to import the city weather-data. from config import api_key from citi...
github_jupyter
# Streaming Sample: Cosmos DB ChangeFeed - Databricks In this notebook, you read a live stream of tweets that stored in Cosmos DB by leveraging Apache Spart to read the Cosmos DB's Change Feed, and run transformations on the data in Databricks cluster. ## prerequisites: - Databricks Cluster (Spark) - Cosmos DB Spark C...
github_jupyter
``` import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import datasets, models, transforms import matplotlib.pyplot as plt import time import os import pandas as pd from sklearn.model_selection import train_test_spli...
github_jupyter
``` #default_exp data.core #export from fastai2.torch_basics import * from fastai2.data.load import * from nbdev.showdoc import * ``` # Data core > Core functionality for gathering data The classes here provide functionality for applying a list of transforms to a set of items (`TfmdLists`, `Datasets`) or a `DataLoad...
github_jupyter
# Sentiment Analysis ## Updating a Model in SageMaker _Deep Learning Nanodegree Program | Deployment_ --- In this notebook we will consider a situation in which a model that we constructed is no longer working as we intended. In particular, we will look at the XGBoost sentiment analysis model that we constructed ea...
github_jupyter
# Building your own algorithm container With Amazon SageMaker, you can package your own algorithms that can than be trained and deployed in the SageMaker environment. This notebook will guide you through an example that shows you how to build a Docker container for SageMaker and use it for training and inference. By ...
github_jupyter
# Deep Neural Network You see a lot of people around you who are interested in deep neural networks and you think that it might be interesting to start thinking about creating a software that is as flexible as possible and allows novice users to test this kind of methods. You have no previous knowledge and while sear...
github_jupyter
Heroes of Pymoli Data Analysis ``` import pandas as pd Pymoli="/Users/rulaothman/Desktop/pandas-challenge/04-Numpy-Pandas/Instructions/HeroesOfPymoli/purchase_data.json" currency= '${0:.2f}' Pymoli_df=pd.read_json(Pymoli) Pymoli_df.head() #Player Count Player_count=Pymoli_df['SN'].value_counts().count() Player_count ...
github_jupyter
``` from __future__ import print_function, division import json import numpy as np import pandas as pd import librosa import soundfile as sf import torch from torch.utils.data import Dataset from keras.preprocessing.sequence import pad_sequences # Ignore warnings import warnings warnings.filterwarnings("ignore") cl...
github_jupyter
# Amazon SageMaker Autopilot Data Exploration This report provides insights about the dataset you provided as input to the AutoML job. It was automatically generated by the AutoML training job: **automl-dm-1632956082**. As part of the AutoML job, the input dataset was randomly split into two pieces, one for **trainin...
github_jupyter