text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## The question **Prj05** Consider the Vasicek model $$d r_t = \alpha (b - r_t) dt + \sigma dW_t$$ with the following parameters: $$r_0 = .005, \alpha = 2.11, b = 0.02, \sigma = 0.033.$$ **Todo** 1. Implement Euler simulation and draw a plot of $\mathbb E[ r_t ]$ on $t\in [0, 10]$. 2. Find explicit form of $\math...
github_jupyter
``` from __future__ import division import os import numpy as np from collections import OrderedDict import logging import pandas from astropy.io import fits import astropy.wcs from astropy import table import sep import warnings from astropy.utils.exceptions import AstropyWarning warnings.simplefilter('ignore', cate...
github_jupyter
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/work-with-data/dataprep/how-to-guides/append-columns-and-rows.png) # Append Columns and Rows Copyright (c) Microsoft Corporation. All rights reserved.<br> Licensed under the MIT License.<br> ...
github_jupyter
``` import numpy as np import pandas as pd pd.set_option('display.float_format', lambda x: '%.3f' % x) pd.options.mode.chained_assignment = None %matplotlib inline import matplotlib #matplotlib.use('agg') matplotlib.style.use('ggplot') from matplotlib import pyplot as plt from functools import reduce import pickle as p...
github_jupyter
``` import numpy as np from collections import Counter from graphviz import Digraph class Node: def __init__(self, frequency, letter=None): self.left=None self.right=None self.parent=None self.frequency = frequency self.letter = letter if letter is not None else None ...
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
# QGS model: MAOSOAM ## Coupled ocean-atmosphere channel model version This model version is a 2-layer channel QG atmosphere truncated at wavenumber 2 coupled, both by friction and heat exchange, to a shallow water **channel** ocean also truncated at wavenumber 2. More details can be found in the articles: * Vanni...
github_jupyter
``` ## Here I am removing all the protected features to see the difference from normal import pandas as pd import random,time import numpy as np import math,copy from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeRegressor from sklearn.model_selection import train_test_split from ...
github_jupyter
<a href="https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/48_folium_legend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a> Uncomment the following line to install [geemap](https://geemap.org) if needed. ``` # !pip install geem...
github_jupyter
## Logistic Regression in plain Python In logistic regression, we are trying to model the outcome of a **binary variable** given a **linear combination of input features**. For example, we could try to predict the outcome of an election (win/lose) using information about how much money a candidate spent campaigning, h...
github_jupyter
``` %pylab inline rc("image", cmap="gray", interpolation="nearest") figsize(7, 7) ``` # PyTorch "Tensors and Dynamic neural networks in Python with strong GPU acceleration" - like Matlab or Numpy, but with GPU support - automatic, dynamic differentiation and gradient descent - some frameworks for neural networks # ...
github_jupyter
# Introduction to JumpStart - Image Classification --- Welcome to Amazon [SageMaker JumpStart](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-jumpstart.html)! You can use JumpStart to solve many Machine Learning tasks through one-click in SageMaker Studio, or through [SageMaker JumpStart API](https://sagemaker...
github_jupyter
# Object Oriented Programming Object Oriented Programming (OOP) tends to be one of the major obstacles for beginners when they are first starting to learn Python. There are many, many tutorials and lessons covering OOP so feel free to Google search other lessons, and I have also put some links to other useful tutoria...
github_jupyter
<img src="https://ucfai.org/groups/supplementary/sp20/02-06-stats-intro/stats-intro/banner.png"> <div class="col-12"> <span class="btn btn-success btn-block"> Meeting in-person? Have you signed in? </span> </div> <div class="col-12"> <h1> Introduction to Statistics, Featuring Datascience </h1> ...
github_jupyter
# This notebook will give a first baseline estimation for the matching of entities via a random forest algorithm as multi-class classification ``` import os import pandas as pd import gzip import json import numpy as np import nltk from nltk.corpus import stopwords import string from nltk.tokenize import word_tokenize...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import pandas as pd import numpy as np import matplotlib.pyplot as plt import plotly.express as px url = '/content/drive/My Drive/Colab Notebooks/Unit 2/223 Data Modeling/london_merged.csv' df = pd.read_csv(url) print(df.shape) df.head() ``` Lambda Schoo...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Traffic Light Detection ## Dependencies ``` import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import pickle import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mplimg import glob %matplotlib inline ``` ## First, I tested and debugged a...
github_jupyter
# Why You Should Hedge Beta and Sector Exposures (Part I) by Jonathan Larkin and Maxwell Margenot Part of the Quantopian Lecture Series: * [www.quantopian.com/lectures](https://www.quantopian.com/lectures) * [github.com/quantopian/research_public](https://github.com/quantopian/research_public) --- Whenever we have...
github_jupyter
``` # Imports import numpy as np from skmultiflow.trees import HoeffdingTree from skmultiflow.data.file_stream import FileStream val_actual_class_labels=[] #Valence Acutal class labels val_predicted_class_labels=[] #Valence Predicted Class labels aro_actual_class_labels =[] #Arousal Acutal class labels aro_predicte...
github_jupyter
``` import sklearn import requests import json import spotipy#authentication import spotipy.util as util#authentication from spotipy.oauth2 import SpotifyClientCredentials#authentication # Make sure to fill in your spotify client_secret information cid = "049ade7215e54c63a2b628f3784dc407" secret = "171ef0fc408745e88dd5...
github_jupyter
``` # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed und...
github_jupyter
# Table of Contents * [1) Large Margin Classification](#1%29-Large-Margin-Classification) * [1) Optimization Objective](#1%29-Optimization-Objective) * [2) Large Margin Intuition](#2%29-Large-Margin-Intuition) * [3) Mathematics Behind Large Margin Classification](#3%29-Mathematics-Behind-Large-Margin-Classific...
github_jupyter
``` from google.colab import drive drive.mount("/content/drive") !unzip '/content/drive/My Drive/Colab_Dataset/Dataset2.zip' pip install np_utils import matplotlib.pyplot as plt import tensorflow as tf import PIL from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEncoder from ...
github_jupyter
## Basic usage of matplotlib Matplotlib is the module of choice whenever you want to make a niceplot. ``` # the following two lines are required inside a python script to be run on binder. They are not needed inside the notebook. import matplotlib matplotlib.use('Agg') import numpy as np import matplotlib.pyplot a...
github_jupyter
``` from __future__ import division, print_function, absolute_import import tflearn from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.conv import conv_2d, max_pool_2d from tflearn.layers.normalization import local_response_normalization from tflearn.layers.estimator import regres...
github_jupyter
# Deep Learning with Python ## 6.1 Working with text data > 处理文本数据 要用深度学习的神经网络处理文本数据,和图片类似,也要把数据向量化:文本 -> 数值张量。 要做这种事情可以把每个单词变成向量,也可以把字符变成向量,还可以把多个连续单词或字符(称为 *N-grams*)变成向量。 反正不管如何划分,我们把文本拆分出来的单元叫做 *tokens*(标记),拆分文本的过程叫做 *tokenization*(分词)。 > 注:token 的中文翻译是“标记”😂。这些翻译都怪怪的,虽然 token 确实有标记这个意思,但把这里的 token 翻译成标记就没内味...
github_jupyter
O objetivo desta lista de exercício é instigar que você resolva problemas simples usando o básico do python, sem necessitar importar pacotes ainda. Alguns exercícios são aplicados à oceanografia e outros gerais, mas todos com a intenção de que você fortaleça o conhecimento em alguns pontos chaves que servirão de base ...
github_jupyter
``` import re import docx2txt import networkx as nx import matplotlib.pyplot as plt %matplotlib inline ``` ## Extract programming language from Knowledge Graph ``` file_name_1 = 'Mathew Elliot.docx' file_name_2 = 'John Guy.docx' file_name_3 = 'Max Payne.docx' def extract_programming_languages(file_name): # read ...
github_jupyter
# PIG, Beginner’s Version: * Players take turns rolling a die as many times as they like. * If a roll is a 2, 3, 4, 5, or 6, the player adds that many points to their score for the turn. * A player may choose to end their turn at any time and “bank” their points. * If a player rolls a 1, they lose all their unbank...
github_jupyter
<a href="https://colab.research.google.com/github/TomFrederik/lucent/blob/dev/notebooks/Lucent_%2B_torchvision.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Licensed under the Apache License, Version 2.0 (the "License"); ``` # Licensed unde...
github_jupyter
# Finch usage Finch is a WPS server for climate indicators, but also has a few utilities to facilitate data handling. To get started, first instantiate the client. Here, the client will try to connect to a local or remote finch instance, depending on whether the environment variable `WPS_URL` is defined. ``` import o...
github_jupyter
``` # Change directory to the root so that relative path loads work correctly import os try: os.chdir(os.path.join(os.getcwd(), "..")) print(os.getcwd()) except: pass import glob import sys import matplotlib.pyplot as plt import numpy as np import torch from experiments.A_constrained_training.main import...
github_jupyter
## Notebook for preparing final dataset ``` import pandas as pd import numpy as np import re ``` ## Dataset 1 ``` file2 = pd.read_csv("./dataset/traindata2.csv") file2.tail() #2 for normal 0,1 for toxic file2.iloc[24767][-1] tweet = file2["tweet"] def clean_text(text): text = text.lower() text = re.sub(...
github_jupyter
## Installs & Imports ``` # Select Tensorflow 2.x version in Colab %tensorflow_version 2.x # Import TensorFlow and tf.keras import tensorflow as tf keras = tf.keras # Import helper libraries import numpy as np import matplotlib.pyplot as plt # Print TensorFlow version version = tf.__version__ print(version) ``` ##...
github_jupyter
## _*H2 ground state energy computation using Iterative QPE*_ This notebook demonstrates computing and graphing the ground state energy of the Hydrogen (H2) molecule over a range of inter-atomic distances using `IQPE` (Iterative Quantum Phase Estimation) algorithm. It is compared to the ground-truth energies as comput...
github_jupyter
# Import data and preprocess it ``` import pandas as pd import numpy as np import tensorflow as tf import matplotlib.pyplot as plt use_all_features = True use_full_data = True test_sml_size = 3000 #file paths train_sig_path_sml = "data/train_sml_sig.csv" train_bg_path_sml = "data/train_sml_bg.csv" train_sig_path = ...
github_jupyter
# MXNet - Gluon Code Snippets #### Index: ## 1. Import Libraries ``` from mxnet import autograd, nd # #Gluon data module to read data from mxnet.gluon import data as gdata # #Neural Network Layers from mxnet.gluon import nn # #Model Parameter Initalizer from mxnet import init # #Gluon module to define loss funct...
github_jupyter
# Generate volcanic ERF time series Theme Song: Mt. Pinatubo<br> Artist: The Low Frequency In Stereo<br> Album: Futuro<br> Released: 2009 ``` from netCDF4 import Dataset, num2date import numpy as np import matplotlib.pyplot as pl import pandas as pd from ar6.utils import check_and_download import scipy.stats %matplot...
github_jupyter
# Optional Coding Exercise ## -- Implementing a "CART" Decision Tree From Scratch ``` %load_ext watermark %watermark -d -u -a 'Sebastian Raschka' -v -p numpy,scipy,matplotlib import numpy as np ``` <br> <br> <br> <br> <br> <br> ## 1) Implementing a "CART" Decision Tree from Scratch In this exercise, you are goin...
github_jupyter
# Apprentice Challenge This challenge is a diagnostic of your current python pandas, matplotlib/seaborn, and numpy skills. These diagnostics will help inform your selection into the Machine Learning Guild's Apprentice program. ## Challenge Background: A Magic Eight Ball & Randomness ![Shaking Magic Eight Ball](http...
github_jupyter
<hr style="height:3px;border:none;color:#333;background-color:#333;" /> <img style=" float:right; display:inline" src="http://opencloud.utsa.edu/wp-content/themes/utsa-oci/images/logo.png"/> ### **University of Texas at San Antonio** <br/> <br/> <span style="color:#000; font-family: 'Bebas Neue'; font-size: 2.5em;"...
github_jupyter
# Augmenter l'accuracy du Computer Vision grâce aux réseaux à convolution Dans le workshop précédent, vous avez vu comment reconnaître des vêtements à travers un réseau de neurones constitué de 3 couches. Vous avez pu experimenter l'impact des différents paramètres du modèle comme le nombre de neurones dans la couche ...
github_jupyter
# Spark Train Logistic Regression Train Logistic Regression classifier with Apache SparkML ``` %%bash export version=`python --version |awk '{print $2}' |awk -F"." '{print $1$2}'` echo $version if [ $version == '36' ] || [ $version == '37' ]; then echo 'Starting installation...' pip3 install pyspark==2.4.8 ...
github_jupyter
# Testing In the Digital Humanities Lab, we're going to be ensuring that our code is thoroughly documented and tested. This is important because we are collaborating with others and we will also be sharing our code publicly. Once you get used to writing documentation, then tests, then code, you may find that writing t...
github_jupyter
# Build a stock market brief - S01E06-automate-the-brief <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/Yahoo%20Finance/Build%20a%20stock%20market%20brief/S01E06-automate-the-brief.ipynb" target="_parent"> <img src="https://img.shie...
github_jupyter
# **1D Map Conjugacy for the Kuramoto-Sivashinsky PDE** ``` import numpy as np from utils import Kuramoto from scipy.integrate import odeint import matplotlib.pyplot as plt # Set plotting parameters parameters = {'axes.labelsize': 16, 'axes.titlesize': 18, 'legend.fontsize': 13, ...
github_jupyter
``` import pandas as pd import numpy as np import re from itertools import combinations import pcalg import networkx as nx DATA_FILE = "./data/20200807_user-db_cpu-load_03.json" TARGET_DATA = {"containers": ["container_cpu_usage_seconds_total", "container_fs_io_current", "container_memory_working_set_bytes", "container...
github_jupyter
# Summary of Quantum Operations ## Fundamentals (revised by Amba Datt Pant, originaly created by Diwakar Sigdel) ## Qubit - Regular or classical computer works on rules of logic - operation based on bits 0 or 1. - qubit --> quantum bit that can follow quantum mechanics (rules of quantum mechanics). **0, 1 and interme...
github_jupyter
<a href="https://colab.research.google.com/github/SerafDosSantos/MesBlocNotes/blob/main/exemple_de_PoW_(Proof_of_Work).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Exemple de la preuve de travail (PoW ou Proof-of-Work) Ce document est un tutor...
github_jupyter
``` from rdkit import Chem, DataStructs from rdkit.Chem import AllChem from rdkit.Chem import rdMolDescriptors as rdmd from rdkit.Chem.Scaffolds import MurckoScaffold import pandas as pd from tqdm import tqdm import time import numpy as np from scipy.spatial.distance import cdist from sklearn.cluster import MiniBatchKM...
github_jupyter
## Training excitatory-inhibitory recurrent network Here we will train recurrent neural network with excitatory and inhibitory neurons on a simple perceptual decision making task. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/gyyang/nn-brain/blob...
github_jupyter
``` from importlib import reload import sys from imp import reload import warnings warnings.filterwarnings('ignore') if sys.version[0] == '2': reload(sys) sys.setdefaultencoding("utf-8") import pandas as pd df1 = pd.read_csv('labeledTrainData.tsv', delimiter="\t") df1 = df1.drop(['id'], axis=1) df1.head() df1 ...
github_jupyter
## Dependencies ``` !pip install --quiet /kaggle/input/kerasapplications !pip install --quiet /kaggle/input/efficientnet-git import warnings, glob from tensorflow.keras import Sequential, Model import efficientnet.tfkeras as efn from cassava_scripts import * seed = 0 seed_everything(seed) warnings.filterwarnings('ig...
github_jupyter
``` !wget http://www.gutenberg.org/files/11/11-0.txt from keras.models import Sequential from keras.layers import Dense,Activation from keras.layers.recurrent import SimpleRNN import numpy as np fin=open('11-0.txt',encoding='utf-8-sig') lines=[] for line in fin: line = line.strip().lower() #line = line.decode("asci...
github_jupyter
# Python for scientific computing > Marcos Duarte, Renato Naville Watanabe > [Laboratory of Biomechanics and Motor Control](http://pesquisa.ufabc.edu.br/bmclab) > Federal University of ABC, Brazil <p style="text-align: right;">A <a href="https://jupyter.org/">Jupyter Notebook</a></p> The [Python programming lang...
github_jupyter
# Mask R-CNN - Train on Shapes Dataset This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Resnet101, which would be ...
github_jupyter
# SciPy - Library of scientific algorithms for Python Original by J.R. Johansson (robert@riken.jp) http://dml.riken.jp/~rob/ Modified by Clayton Miller (miller.clayton@arch.ethz.ch) The other notebooks in this lecture series are indexed at [http://jrjohansson.github.com](http://jrjohansson.github.com). # Introducti...
github_jupyter
[Original Notebook Downloaded From Kaggle](https://www.kaggle.com/bariskavus/diabetes-prediction-randomforestclassifier) ``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's...
github_jupyter
# Portfolio Optimization This notebook can be run online without installing any packages. Just click the logo: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/mcdeoliveira/pyoptimum-examples/master?filepath=examples%2Fportfolio.ipynb) to run it on [binder](https://mybinder.org). See this...
github_jupyter
3.11 模型选择、欠拟合和过拟合 在前几节基于Fashion-MNIST数据集的实验中,我们评价了机器学习模型在训练数据集和测试数据集上的表现。如果你改变过实验中的模型结构或者超参数,你也许发现了:当模型在训练数据集上更准确时,它在测试数据集上却不一定更准确。这是为什么呢? 3.11.1 训练误差和泛化误差 在解释上述现象之前,我们需要区分训练误差(training error)和泛化误差(generalization error)。通俗来讲,前者指模型在训练数据集上表现出的误差,后者指模型在任意一个测试数据样本上表现出的误差的期望,并常常通过测试数据集上的误差来近似。计算训练误差和泛化误差可以使用之前介绍过的损失函数,例如线性...
github_jupyter
# 1. Formulate your questions Are there party-level differences in House expenditures? ``` %matplotlib inline import matplotlib.pyplot as plt import seaborn as sb import numpy as np import pandas as pd ``` # 2. Read in your data From ProPublica's [House Office Expenditure Data](https://projects.propublica.org/repr...
github_jupyter
# NumPy for Python in Jupyter Notebook ``` # NumPy (Numerical Python) import numpy as np ``` ### Creating an array ``` a=[1,2,3,4,5] print("This is a list:",a) b=np.array(a) print("\nArray created from list:",b) print("Class of array:",type(b)) # not a list print("Datatype of array:",b.dtype) # dtype attribute ret...
github_jupyter
# Network Analysis --- ## Introduction Networks are mathematical or graphical representations of patterns of relationships between entities. These relationships are defined by some measure of "closeness" between individuals, and can exist in an abstract or actual space (for example, whether you are related to someo...
github_jupyter
# Ensemble NMS - Detectron2 [Inference] ### Hi kagglers, This is `Ensemble NMW - Detectron2 [Inference]` notebook. * [Sartorius Segmentation - Detectron2 [training]](https://www.kaggle.com/ammarnassanalhajali/sartorius-segmentation-detectron2-training) * [Sartorius Segmentation - Detectron2 [Inference]](https://www.k...
github_jupyter
<div style='background-image: url("share/baku.jpg") ; padding: 0px ; background-size: cover ; border-radius: 15px ; height: 250px; background-position: 0% 80%'> <div style="float: right ; margin: 50px ; padding: 20px ; background: rgba(255 , 255 , 255 , 0.9) ; width: 50% ; height: 150px"> <div style="positi...
github_jupyter
# GPU-accelerated interactive visualization of single cells with RAPIDS, Scanpy and Plotly Dash Copyright (c) 2020, NVIDIA CORPORATION. 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 http://ww...
github_jupyter
``` import numpy as np import urdf2casadi.urdfparser as u2c from urdf2casadi.geometry import plucker from urdf_parser_py.urdf import URDF, Pose import PyKDL as kdl import kdl_parser_py.urdf as kdlurdf from timeit import Timer, timeit, repeat import rbdl import pybullet as pb def median(lst): n = len(lst) if n ...
github_jupyter
Guilherme Andrade, Gabriel Ramos, Daniel Madeira, Rafael Sachetto, Renato Ferreira, Leonardo Rocha, G-DBSCAN: A GPU Accelerated Algorithm for Density-based Clustering, Procedia Computer Science, Volume 18, 2013, Pages 369-378, ISSN 1877-0509, http://dx.doi.org/10.1016/j.procs.2013.05.200. (http://www.sciencedirect.com/...
github_jupyter
# 12.15.1 Getting and Mapping the Tweets ### Get the `API` Object ``` from tweetutilities import get_API api = get_API() ``` ### Collections Required By `LocationListener` ``` tweets = [] counts = {'total_tweets': 0, 'locations': 0} ``` ### Creating the `LocationListener` ``` from locationlistener import LocationL...
github_jupyter
# 사용자 정의 모델 만들기 (Siamese) > fastai에서는 데이터를 정의하는 방법으로 DataBlock API를 제안합니다. 각 인자가 의미하는 내용과, 실제 Siamese 공식 튜토리얼에 이 내용이 어떻게 적용되는지를 살펴봅니다. - author: "Chansung Park" - toc: true - image: images/datablock/siamese-model.png - comments: true - categories: [model, siamese, fastai] - permalink: /model-siamese/ - badges: false -...
github_jupyter
This notebook I am going to discuss about, 1. deep learning 2. forward propagation 3. gradient decent 4. backword propagation 5. basic deep learning model with keras ### Deep Learning : ---- Deep learning is a machine learning algorithm where artificial neural network solve particular problem. This neural netwo...
github_jupyter
<a href="https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/Course%201%20-%20Part%206%20-%20Lesson%202%20-%20Notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2019 The TensorFlow Authors. ``` #@title Lic...
github_jupyter
## Show the attention of VGG19 ``` from keras.applications.mobilenet import MobileNet from keras.applications.mobilenet import preprocess_input as MobileNet_preprocess_input from keras.applications.vgg19 import VGG19 from keras.applications.vgg19 import preprocess_input as VGG19_preprocess_input from keras.application...
github_jupyter
# Transformer What is a Transformer? A Transformer is a type of neural network architecture developed by Vaswani et al. in 2017. Without going into too much detail, this model architecture consists of a multi-head self-attention mechanism combined with an encoder-decoder structure. It can achieve SOTA results that ou...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') ``` ### Dependencies ``` !unzip -q '/content/drive/My Drive/Colab Notebooks/[Kaggle] Understanding Clouds from Satellite Images/Data/train_images256x384.zip' !unzip -q '/content/drive/My Drive/Colab Notebooks/[Kaggle] Understanding Clouds from Satellite...
github_jupyter
``` %load_ext autoreload %autoreload 2 import numpy as np from IPython.display import HTML, Latex, Markdown, Pretty from windIO.Plant import WTLayout from fusedwake.WindFarm import WindFarm from fusedwake.Plotting import circles from fusedwake.gcl import GCL import fusedwake.gcl.fortran as fgcl import fusedwake.gcl.p...
github_jupyter
## Smart Signatures with Transaction Groups #### 06.3.5 Winter School on Smart Contracts ##### Peter Gruber (peter.gruber@usi.ch) 2022-01-22 * Smart Signatures with more than 1 transaction * Combine conditions across transactions ## Setup See notebook 04.1, the lines below will always automatically load functions in ...
github_jupyter
# Self Supervised Learning with Fastai > Implementation of popular SOTA self-supervised learning algorithms as Fastai Callbacks. ![CI](https://github.com/KeremTurgutlu/self_supervised/actions/workflows/main.yml/badge.svg) [![PyPI](https://img.shields.io/pypi/v/self-supervised?color=blue&label=pypi%20version)](https:/...
github_jupyter
# Aerospike Spark Connector Tutorial for Scala ## Tested with Spark connector 3.2.0, ASDB EE 5.7.0.7, Java 8, Apache Spark 3.0.2, Python 3.7 and Scala 2.12.11 and [Spylon]( https://pypi.org/project/spylon-kernel/) #### Please download the appropriate Aeropsike Connect for Spark from the [download page](https://enterp...
github_jupyter
# bioptim #1 - InitialGuess This tutorial is a trivial example on how to manage InitialGuess with bioptim. It is designed to show how one can change the InitialGuess of a problem if it's needed. InitialGuess allow the problem to start the calculation at a certain point, the goal is to make this initialGuess as near as...
github_jupyter
``` import numpy as np import tensorflow as tf from tensorflow import keras import pandas as pd import scipy.signal import time import cv2 import matplotlib.pyplot as plt tf.config.list_physical_devices("GPU") import tensorflow as tf config = tf.compat.v1.ConfigProto() config.gpu_options.allow_growth = True sess = tf.c...
github_jupyter
# COVID-19 Time Series Prediction Using Temporal Fusion Transformers ## Bernhard Kaindl **DISCLAIMER:** This project is part of Udacity's [Data Scientist Nanodegree](https://classroom.udacity.com/nanodegrees/nd025/dashboard/overview). The model shipped with this version of the project is to be understood as a _proof ...
github_jupyter
``` class MFInput: def __init__(self, name, x, y, x0): self.name = name # list of tuples self.points = [(x[i], y[i]) for i in range(len(x))] self.mi = self.getMi(x0) def getY(self, x1, y1, x2, y2, x0): if y1 == y2: return y1 ...
github_jupyter
``` #importing important libraries #libraries for reading dataset import numpy as np import pandas as pd #libraries for data visualisation import matplotlib.pyplot as plt import seaborn as sns #libraries for model building and understanding import sklearn from sklearn.model_selection import train_test_split from skl...
github_jupyter
<img src="https://rhyme.com/assets/img/logo-dark.png" align="center"> <h2 align="center">Logistic Regression: A Sentiment Analysis Case Study</h2> ### Introduction ___ - IMDB movie reviews dataset - http://ai.stanford.edu/~amaas/data/sentiment - Contains 25000 positive and 25000 negative reviews <img src="https:/...
github_jupyter
``` import sys if not '..' in sys.path: sys.path.append('..') from draw_workflow import draw_workflow ``` # Noodles _Easy_ concurrent programming <s>in</s> using Python Johan Hidding, Thursday 19-11-2015 @ NLeSC ``` from noodles import schedule, run, run_parallel, gather ``` ## But, why? * save time _us...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#-MIDS---w261-Machine-Learning-At-Scale-" data-toc-modified-id="-MIDS---w261-Machine-Learning-At-Scale--1"><span class="toc-item-num">1&nbsp;&nbsp;</span> MIDS - w261 Machine Learning At Scale </a></div><div class="lev2 toc-item"><a href="#Assignment---HW11" d...
github_jupyter
``` from keras.layers import Dense, Activation, Dropout, Reshape, concatenate, ReLU, Input from keras.models import Model, Sequential from keras.regularizers import l2, l1_l2 from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint from keras.layers.normalization import BatchNormalization from kera...
github_jupyter
## Python Closures and Generators ## Closures - binding variables from outer function in the inner function ## Technically - function gets stored with its enviroment(bound variables) ### Can also think of preserving certain state ``` # remember this function? def add_factory(x): def add(y): return y + x ...
github_jupyter
# Lab 01 : Deep Q-Learning (DQN) - demo ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: from google.colab import drive drive.mount('/content/gdrive') file_name = 'DQN_demo.ipynb' import subprocess path_to_file = subprocess.check_output('find . -type f -name ' + str(fi...
github_jupyter
``` import torch import torch.nn as nn import os import numpy as np from string import punctuation char_to_int = {"'": 1, ',': 2, 'e': 3, 'a': 4, 'r': 5, 'i': 6, 's': 7, 'n': 8, 'o': 9, 't': 10, 'l': 11, 'c': 12, 'd': 13, 'm': 14, 'u': 15, 'h': 16, 'g': 17, 'p': 18, 'b': 19, 'k': 20, 'y': 21, '"': 22, 'f': 23, 'w': 24,...
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
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
# Day 2, session 3: Detecting features in Hi-C maps In this session we will be looking at ways to automatically find regions with features of interest. This includes both supervised and unsupervised methods depending on the question. ## Unsupervised detection ### Differential contacts The classic approach, much like...
github_jupyter
## 모듈 불러오기 ``` import tensorflow as tf from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint from tensorflow.keras import layers import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import json from tqdm im...
github_jupyter
<center> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # K-Nearest Neighbors Estimated time needed: **25** minutes ## Objectives After completing this lab you will b...
github_jupyter
# Clean Slate: Estimating offenses eligible for expungement under varying conditions > Prepared by [Laura Feeney](https://github.com/laurafeeney) for Code for Boston's [Clean Slate project](https://github.com/codeforboston/clean-slate). ## Summary This notebook takes somewhat processed data from the Middlesex DA and a...
github_jupyter
TSG035 - Spark History logs =========================== Description ----------- Steps ----- ### Parameters ``` import re tail_lines = 2000 pod = None # All container='hadoop-livy-sparkhistory' log_files = [ "/var/log/supervisor/log/sparkhistory*" ] expressions_to_analyze = [ re.compile(".{23} WARN "), re...
github_jupyter
``` import numpy as np import cv2 import time import matplotlib.pyplot as plt img_left_color=cv2.imread('Left/ImageL1.png') img_right_color=cv2.imread('Right/ImageR1.png') img_left_bw = cv2.blur(cv2.cvtColor(img_left_color, cv2.COLOR_RGB2GRAY),(5,5)) img_right_bw = cv2.blur(cv2.cvtColor(img_right_color, cv2.COLOR_RGB2...
github_jupyter
# Functions Functions are key to creating reusable software, testing, and working in teams. This lecture motivates the use of functions, discusses how functions are defined in python, and introduces a workflow that starts with exploratory code and produces a function. **Topics** - Creating reusable software components...
github_jupyter