text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import torch import time import numpy as np import sigkernel import matplotlib.pyplot as plt dyadic_order = 5 _naive_solver = False # specify static kernel static_kernel = sigkernel.LinearKernel() # static_kernel = sigkernel.RBFKernel(sigma=.5) # initialize signature kernel signature_kernel = sigkernel.SigKernel...
github_jupyter
## Visualizing of EcoFOCI Glider Locations from Science Data Set - single profiles ``` %matplotlib inline import os import xarray as xa import numpy as np import cmocean import matplotlib.pyplot as plt import matplotlib.dates as mdates ``` Using profile 262 which was corrected for the 0.5 threshold but not any othe...
github_jupyter
## _*H2 dissociation curve using VQE with UCCSD*_ This notebook demonstrates using QISKit ACQUA Chemistry to plot graphs of the ground state energy of the Hydrogen (H2) molecule over a range of inter-atomic distances using VQE and UCCSD. It is compared to the same energies as computed by the ExactEigensolver This not...
github_jupyter
``` %matplotlib inline import gym import itertools import matplotlib import numpy as np import pandas as pd import sys if "../" not in sys.path: sys.path.append("../") from collections import defaultdict from lib.envs.windy_gridworld import WindyGridworldEnv from lib import plotting matplotlib.style.use('ggplot'...
github_jupyter
# K-Neirest-Neighbors of star Define path where stars files are located, and save their filenames in array. ``` from os import listdir from os.path import isfile, join import time from astropy.coordinates import SkyCoord from astropy import units as u from astropy.coordinates import Angle import numpy as np import pa...
github_jupyter
# JSON and Library Catalog Data How can we extract data from APIs (machine-readable online data sources)? In this lesson, we look at how we can use data from the web. We will use real-world data from [The National Library of Norway](https://www.nb.no/). The National Library has a [search API](https://api.nb.no/) whic...
github_jupyter
``` ReloadProject('deep_learning') ``` ## Environment Setup Let's assume a world with 11 states: 0-10. Each time the agent and move +1 or -1, with 0-1 -> 10 and 10+1 -> 0. All actions that gets the agent closer to state "5" gets reward +1, otherwise gets reward -1. ``` STATE_ZERO_ARRAY = np.zeros(1, dtype=int) TARGET...
github_jupyter
# Imports ``` import torch from torch.autograd import Variable from torch.utils.data import DataLoader import matplotlib.pyplot as plt import numpy as np import sys sys.path.insert(0, "lib/") from data.coco_dataset import CocoDataset from utils.preprocess_sample import preprocess_sample from utils.collate_custom imp...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/spectral_unmixing.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...
github_jupyter
# Story A program trying to optimaize a portfolio using mean-variance with objectives of Max Sharpe Ratio, Global Min Volatility, min risk given return, max return given vol. ``` !pip install pandas_datareader !pip install yfinance import pandas as pd import numpy as np from datetime import datetime #from pandas_datar...
github_jupyter
# **DISTIL Usage Example: MedMNIST** Here, we show how to use DISTIL to perform active learning on image classification tasks (MedMNIST's OrganAMNIST). This notebook can be easily executed on Google Colab. ## Installation and Imports ``` # Get DISTIL !git clone https://github.com/decile-team/distil.git !pip install ...
github_jupyter
# Exploring the bulldozer data set Let's explore another Kaggle data set [Blue Book for Bulldozers](https://www.kaggle.com/c/bluebook-for-bulldozers/data). This one is more challenging because it has lots of missing values and there are more opportunities to extract information and cleanup various columns. There ar...
github_jupyter
# Deploy machine learning models to Azure description: (preview) deploy your machine learning or deep learning model as a web service in the Azure cloud. ## Connect to your workspace ``` from azureml.core import Workspace ws = Workspace.from_config() ws ``` ## Register your model A registered model is a logical c...
github_jupyter
**This notebook is an exercise in the [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/categorical-variables).** --- By encoding **categorical variables**, you'll obtain your best resul...
github_jupyter
<a href="https://colab.research.google.com/github/100rab-S/TensorFlow-Advanced-Techniques/blob/main/C3W1_L1_transfer_learning_cats_dogs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Basic transfer learning with cats and dogs data ### Import ten...
github_jupyter
# Exercise 17 - Structured Data using RNNs ## Setup GPU & TensorFlow ``` # Choose to the GPU number you want to use, # otherwise you will get a Python error # e.g. USE_GPU = 4 USE_GPU = 4 # Import TensorFlow import tensorflow as tf # Print the installed TensorFlow version print(f'TensorFlow version: {tf.__version__...
github_jupyter
This experiments on MNIST by creating multiple views of the dataset. As the paper deals with binary classification, we use digits 0 to 4 in class 0 and 5 to 9 in class 1 ``` import pandas as pd import numpy as np from scipy.signal import convolve2d from scipy.fft import ifftn from sklearn.model_selection import cro...
github_jupyter
<!--NAVIGATION--> < [Setting Up](01.01 Setting Up.ipynb) | [Contents](Index.ipynb) | [Algorithmic Trading Architecture](01.03 Algorithmic Trading Architecture.ipynb) > # Understanding the Documentations In order to make use of the API effective, we need to understand the input parameters and the corresponding output....
github_jupyter
<img src="../static/aeropython_name_mini.png" alt="AeroPython" style="width: 300px;"/> # Clase 2b: Visualización con matplotlib _Después de estudiar la sintaxis de Python y empezar a manejar datos numéricos de manera un poco más profesional, ha llegado el momento de visualizarlos. Con la biblioteca **matplotlib** pod...
github_jupyter
# Use BlackJAX with TFP BlackJAX can take any log-probability function as long as it is compatible with JAX's JIT. In this notebook we show how we can use tensorflow-probability as a modeling language and BlackJAX as an inference library. We reproduce the Eight Schools example from the [TFP documentation](https://www...
github_jupyter
``` trainingSet = [ (1, "Chinese Beijing Chinese", "yes"), (2, "Chinese Chinese Shanghai", "yes"), (3, "Chinese Macao", "yes"), (4, "Tokyo Japan Chinese", "no") ] testSet = [ (5, "Chinese Chinese Chinese Tokyo Japan") ] traningSetYes = [d for d in trainingSet if d[2] == "yes"] traningSetNo = [d for...
github_jupyter
# Average Directional Index (ADX) https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_directional_index_adx Average Directional Index (ADX) is technical indicator; as a result, the values range from 0 to 100. The ADX gives a signal of trend strength. If ADX is below 20, the trend is ...
github_jupyter
# How to generate rates of elevation change and time series from ICESat-2 ICESat-2 Hackweek 2020\ Johan Nilsson\ Jet Propulsion Laboratory\ 2020-06-16 In this tutorial we will present an easy processing flow to generate gridded altimetry time series of elevation change based on the captoolkit software. We will then u...
github_jupyter
``` import math import numpy as np import pandas as pd from datetime import datetime import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline plt.style.use('seaborn-whitegrid') from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import classification_report from sklearn.metrics impor...
github_jupyter
``` import numpy as np import pandas as pd import scipy from datetime import datetime, timedelta import sys ## For SDK import getpass from odp_sdk import ODPClient from getpass import getpass sys.path.append('/Users/tarabaris/GitHub/odp-sdk-python/Examples') from UtilityFunctions import * import warnings warnings.filte...
github_jupyter
<a href="https://colab.research.google.com/github/Sergeydigl3/pepe-nude-colab/blob/master/DeepNude_(PepeNude%2C_DreamTime)_Google_Colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # INIT ``` #@title Clonong repo and install requirements !git cl...
github_jupyter
This is essentially a copy of https://github.com/rmeinl/apricot-julia/blob/5f130f846f8b7f93bb4429e2b182f0765a61035c/notebooks/python_reimpl.ipynb ``` import matplotlib.pyplot as plt import seaborn; seaborn.set_style('whitegrid') import time import scipy import numpy as np from numba import njit from numba import pra...
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcallysto-sample-notebooks&branch=master&subPath=notebooks/Science/Investigating_el...
github_jupyter
# Making Models Smaller via Knowledge Distillation ### A text classification example using Hugging Face Transformers and Amazon SageMaker Welcome to our end-to-end example of _knowledge distillation_ using Hugging Face Transformers & Amazon SageMaker! This example is adapted from Chapter 8 of the O'Reilly book [_Natu...
github_jupyter
## Emoji prediction for weibo tweets This is the final project for Nanjing University Data Mining class in spring 2019 ``` import pandas as pd import numpy as np ``` Load the raw weibo tweets (train.text) and preprocessed label (train.label). Save them into two lists respectively. ``` DATA_FOLDER='data/' TRAIN_TEXT=...
github_jupyter
# CBOE VXXLE Index In this notebook, we'll take a look at the CBOE VXXLE Index dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans 16 Mar 2011 through the current day. This data has a daily frequency. VXXLE is the CBOE Energy Sector ETF Volatility Index, reflecting the i...
github_jupyter
``` import os os.chdir("../") import pandas as pd import seaborn import sklearn import geopandas as gpd import missingno as msno import seaborn as sns from preprocessing.preprocessing import standardize_education_level, standardize_date from datetime import datetime import numpy as np from pathlib import Path aggregate...
github_jupyter
``` import pandas as pd import numpy as np series = pd.Series({'Col1':[0,1,2,3,4,5]}) ``` # Pandas Pandas is an extremely useful library for handeling and manipulating tabular data and arrays. It is largely considered to be one of the most essential libraries in a Pythonic Data Scientist's tool kit but it has a myri...
github_jupyter
``` ########################################################################################################################### # Hassan Shahzad # 18i-0441 # CS-D # FAST-NUCES ISB # chhxnshah@gmail.com # "Predicting heart disease using ...
github_jupyter
# Posterior Predictive Checks in PyMC3 PPCs are a great way to validate a model. The idea is to generate data sets from the model using parameter settings from draws from the posterior. `PyMC3` has random number support thanks to [Mark Wibrow](https://github.com/mwibrow) as implemented in [PR784](https://github.com/p...
github_jupyter
Sebastian Raschka, 2015 # Python Machine Learning # Chapter 12 - Training Artificial Neural Networks for Image Recognition Note that the optional watermark extension is a small IPython notebook plugin that I developed to make the code reproducible. You can just skip the following line(s). ``` %load_ext watermark %w...
github_jupyter
__Before using the codes below, notation:__ 1. for the mixture component, using a sliced-like list. <p>eg: V_water:V_toluene:V_ethanol = [::] </p> # Retrieve the wavelength for the tie-line ## Import packages and set initial parameters for the graphs ``` from dataGadgets import * plt.rcParams['figure.figsize'] = [...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"; os.environ["CUDA_VISIBLE_DEVICES"]="0"; ``` *ktrain* uses TensorFlow 2. To support sequence-tagging, *ktrain* also currently uses the CRF module from `keras_contrib`, which is not yet fully compatible w...
github_jupyter
# Performance Overview Here, we will example the performance of FNGS as a function of time on several datasets. These investigations were performed on a 4 core machine (4 threads) with a 4.0 GhZ processor. # BNU1 ``` %matplotlib inline import numpy as np import re import matplotlib.pyplot as plt def memory_function...
github_jupyter
[notebook_Readme.md on github](https://github.com/KnowEnG/Spreadsheets_Transformation/blob/master/docs/notebook_Readme.md) ``` %%html <style>div.input {display:none;} div.output_stderr{display:none}</style> """ To Start This Notebook Click On: Cell > Run All (in the jupyter menu above) """ import warnings ...
github_jupyter
``` import pandas as pd import numpy as np pd.set_option("display.max_rows",30) %matplotlib inline class dataset: kdd_train_2labels = pd.read_pickle("dataset/kdd_train_2labels_20percent.pkl") kdd_train_2labels_y = pd.read_pickle("dataset/kdd_train_2labels_y_20percent.pkl") kdd_test_2labels = pd.read_pi...
github_jupyter
# 数据采样 `Ascend` `GPU` `CPU` `数据准备` [![在线运行](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_modelarts.png)](https://authoring-modelarts-cnnorth4.huaweicloud.com/console/lab?share-url-b64=aHR0cHM6Ly9taW5kc3BvcmUtd2Vic2l0ZS5vYnMuY24tbm9ydGgtNC5teWh1YXdlaWNsb3VkLmNvbS9ub3RlYm9vay9tb2RlbGFydHMvcHJvZ3Jhb...
github_jupyter
# Analyzing CIA World Factbook with SQL SQL is the short for Structured Query Language. It is a domain-specific language used in programming and designed for managing data held in a relational database management systems. According to [Wikipedia](https://en.wikipedia.org/wiki/SQL), it is particularly useful in handlin...
github_jupyter
#Summerizing Text with T5 Copyright 2021, Denis Rothman. MIT License. Hugging Face usage example was modified for educational purposes. [Hugging Face Models](https://huggingface.co/transformers/model_doc/t5.html) [Hugging Face Framework Usage](https://huggingface.co/transformers/usage.html) ``` !pip install transfor...
github_jupyter
# 3. 第三章 - 尝试解决一个实际问题 目录: * 3.1 加载 MNIST 数据集 * 3.2 定义模型 * 3.3 选择损失函数和优化器 * 3.4 模型训练并验证 * 3.5 可视化验证 现在,让我们依靠计图的强大力量,解决你的第一个实际问题吧! ``` # 加载计图 import jittor as jt # 开启 GPU 加速 jt.flags.use_cuda = 1 ``` ## 任务:使用 Jittor 对 MNIST 手写数字进行识别 **任务描述如下:** * MNIST 手写数字数据库,主要收集了不同人群真实的手写数字记录(包括 0 到 9 十个数字)。该数据库包含训练集上 60,000 个...
github_jupyter
# Recurrent Neural Networks in Theano Credits: Forked from [summerschool2015](https://github.com/mila-udem/summerschool2015) by mila-udem First, we import some dependencies: ``` %matplotlib inline from synthetic import mackey_glass import matplotlib.pyplot as plt import theano import theano.tensor as T import numpy ...
github_jupyter
# Building a non-linear gravity inversion from scratch (almost) In this notebook, we'll build a non-linear gravity inversion to estimate the relief of a sedimentary basin. We'll implement smoothness regularization and see its effects on the solution. We'll also see how we can break the inversion by adding random noise...
github_jupyter
# BinaryClassExoplanets ***Matt Paterson, hello@hireMattPaterson.com***<br> This notebook takes a dataset from the Kepler Satelite, KOI cumulative dataset, from https://exoplanetarchive.ipac.caltech.edu/cgi-bin/TblView/nph-tblView?app=ExoTbls&config=cumulative <br> Here I do a rudimentary check on some exoplanet data,...
github_jupyter
``` # Real life data import logging import threading import itertools import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import axes3d import seaborn as seabornInstance from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, ...
github_jupyter
# Supercompressible (7d) L. F. Pereira (lfpereira@fe.up.pt)\ September 22, 2020 This notebook creates the **design of experiments** and the metadata required to run the **numerical simulations**. **Note**: the parametric `Abaqus` scripts were created using `f3dasm` implementations. You can also create your own func...
github_jupyter
``` %run -i ../python/common.py UC_SKIPTERMS=True %run -i ../python/ln_preamble.py ``` # UC-SLS Lecture 20 : Using LibC to access the OS and escape the confines our process - Preliminaries - libraries - Standard library : `libc.a[.so]` - Address Space management: - dynamic memory for data items: `malloc` and `fr...
github_jupyter
``` %load_ext autoreload %autoreload 2 from IPython.display import Image from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) import os import json import numpy as onp import jax import pickle import matplotlib.pyplot as plt import pandas as pd from time...
github_jupyter
``` #IMPORT SEMUA LIBRARY DISINI #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY POSTGRESQL import psycopg2 from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY PDF from fpdf import FPDF #IMPORT LIBR...
github_jupyter
# Diagrammatic Differentiation **for Quantum Machine Learning** [arXiv:2103.07960](https://arxiv.org/abs/2103.07960) _Alexis Toumi_$^{\dagger\star}$, Richie Yeung$^\star$, Giovanni de Felice$^{\dagger\star}$ $^\dagger$ University of Oxford $\quad^\star$ Cambridge Quantum Computing Ltd. **Contents:** 1. Dual number...
github_jupyter
lets check the target class densities for the DR9SV imaging ``` import os import fitsio import numpy as np # -- desitarget -- from desitarget.sv1.sv1_targetmask import bgs_mask # -- plotting -- import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams['text.usetex'] = True mpl.rcParams['font.family'] = ...
github_jupyter
# Word vectors from SEC filings using Gensim: Preprocessing In this section, we will learn word and phrase vectors from annual SEC filings using gensim to illustrate the potential value of word embeddings for algorithmic trading. In the following sections, we will combine these vectors as features with price returns t...
github_jupyter
``` %%HTML <!-- Mejorar visualización en proyector --> <style> .rendered_html {font-size: 1.2em; line-height: 150%;} div.prompt {min-width: 0ex; padding: 0px;} .container {width:95% !important;} </style> %autosave 0 %matplotlib notebook import numpy as np import matplotlib.pyplot as plt from IPython.display import disp...
github_jupyter
# Predicting Conversations Gone Awry With Convokit This interactive tutorial demonstrates how to predict whether a conversation will eventually lead to a personal attack, as seen in the paper [Conversations Gone Awry: Detecting Early Signs of Conversational Failure](http://www.cs.cornell.edu/~cristian/Conversations_go...
github_jupyter
## Node Classification on Citation Network In this tutorial, we demostrate how GraphScope process node classification task on citation network by combining analytics, interactive and graph neural networks computation. In this example, we use [ogbn-mag](https://ogb.stanford.edu/docs/nodeprop/#ogbn-mag) dataset. ogbn-ma...
github_jupyter
# Exercícios de fixação sobre: Pandas, Matplotlib e Seaborn Elaborado por <a href="https://www.linkedin.com/in/bruno-coelho-277519129/">Bruno Gomes Coelho</a>, para as aulas do grupo [DATA](https://github.com/icmc-data). ### Instruções: Siga o passo do notebook, adiconando seu códiga toda vez que ver um `# your code...
github_jupyter
## 機械力学テキスト 12章 ロボットシミュレーション # プログラム例と実習 #### 宇都宮大学 吉田 勝俊 ### 重要な注意 - このNotebookを開いただけの状態では,編集結果は保存されないので,各自,「ファイル」メニューから「ドライブにコピーを保存」してください. - 操作方法の詳細は [Python / Colab 超入門](https://github.com/ktysd/python-startup/wiki) で勉強してください. ### 1.使用するライブラリの読込 ``` #この枠をクリックしてアクティブにしてから,Shiftを押しながらEnterを押すと,枠内のコードが実行されます.以下同じです...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt %matplotlib notebook %config InlineBackend.figure_format = 'retina' #%matplotlib qt #%gui qt dataDir = "/Users/rhl/TeX/Talks/DSFP/2018-01/Exercises/Detectors" ``` Let's start by looking at some extracted spectra Read the data (and don't worry about ...
github_jupyter
``` # noexport import os os.system('export_notebook identify_domain_training_data_v4.ipynb') from tmilib import * import csv import sys num_prev_enabled = int(sys.argv[1]) num_labels_enabled = 1 + num_prev_enabled # since we disabled the n label data_version = 4+8+8 + num_prev_enabled print 'num_prev_enabled', num_pre...
github_jupyter
# **Import required Libraries!** in the below block we're importing the libraries that we will use in the further codes in this Question! ``` import os, gzip, torch import torch.nn as nn import numpy as np import scipy.misc import imageio import matplotlib.pyplot as plt from torchvision import datasets, transforms im...
github_jupyter
# 蛋白质预训练和性质预测 在这份教程中,我们将介绍如何构建一个序列模型来进行蛋白质性质预测。具体来说,我们将展示如何对模型进行预训练并针对下游任务进行微调。关于这个主题的更多详细介绍请查阅[这里](https://github.com/PaddlePaddle/PaddleHelix/tree/dev/apps/pretrained_protein/tape/README_cn.md)。 近年来,随着测序技术的发展,蛋白质序列数据库的规模显著扩大。然而,必须通过湿实验才能够获得的有标注蛋白序列的成本仍然很高。此外,由于标记样本数量不足,模型有很高的概率过拟合数据。借鉴自然语言处理(NLP)的思想,通过自监督学习可以在大量无标注...
github_jupyter
<a href="https://colab.research.google.com/github/Dmitri9149/Transformer_From_Scratch/blob/main/Final_Working_Transformer_MXNet_v6_102400_128_10_25_10_20.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install -U mxnet-cu101==1.7.0 !pip ins...
github_jupyter
<a href="https://colab.research.google.com/github/chandlerbing65nm/Cassava-Leaf-Disease-Classification/blob/main/ViT_Inference.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Check Resources ``` gpu_info = !nvidia-smi gpu_info = '\n'.join(gpu_inf...
github_jupyter
# Data Exploration ## Prepare notebook Import libraries for plotting, data cleaning, weighting observations, and regular expressions ``` from matplotlib import rcParams # plotting import numpy as np # computing import pandas as pd # data analysis import pickle # serialisation import re # regular expressions imp...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import os import cv2 from tqdm import tqdm # www.microsoft.com/en-us/download/confirmation.aspx?id=54765 DATADIR = "E:/Datasets/PetImages" CATEGORIES = ["Dog", "Cat"] for category in CATEGORIES: # do dogs and cats path = os.path.join(DATADIR,category) # cr...
github_jupyter
``` import os import mypackages.myrasters as mr import numpy as np import matplotlib.pyplot as plt %matplotlib inline swc_dir = os.path.join('..', 'output/soil_water_content_prepared') soil_dir = os.path.join('..', 'output/soilgrids_prepared') out_dir = os.path.join('..', 'output/corrections_calculated') months = ['jan...
github_jupyter
# Build barcode variant table This Python Jupyter notebook builds consensus sequences for barcoded variants from the mutations called in the processed PacBio CCSs. It then uses these consensus sequences to build a codon variant table. ## Set up analysis ### Import Python modules. Use [plotnine](https://github.com/has2...
github_jupyter
``` #initialization import matplotlib.pyplot as plt %matplotlib inline import numpy as np import math # importing Qiskit from qiskit import IBMQ, BasicAer from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute # import basic plot tools from qiskit.t...
github_jupyter
# Automatic Differentiation > The **backpropagation** algorithm was originally introduced in the 1970s, but its importance wasn't fully appreciated until a famous 1986 paper by David Rumelhart, Geoffrey Hinton, and Ronald Williams. (Michael Nielsen in "Neural Networks and Deep Learning", http://neuralnetworksanddeeple...
github_jupyter
``` from datascience import * import sympy solve = lambda x,y: sympy.solve(x-y)[0] if len(sympy.solve(x-y))==1 else "Not Single Solution" import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt import warnings warnings.simplefilter("ignore") %matplotlib inline ``` # Cournot Competi...
github_jupyter
<a href="https://colab.research.google.com/github/yukinaga/automl/blob/main/section_4/01_automl_titanic.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # タイタニック号生存者の予測 AutoMLにより、タイタニック号の生存者を予測します。 訓練済みのモデルによる予測結果は、csvファイルに保存して提出します。 ## PyCaretのイン...
github_jupyter
## Finding sources in the VAST Pilot Survey This notebook gives an example of how to use vast-tools in a notebook environment to perform a search of known sources or coordinates. Below are the imports required for this example. The main import required from vast-tools is the Query object, with which queries can be in...
github_jupyter
``` import numpy as np class EGreedy: """ Implementation of EGreedy algorithm as described in Section 2 of book: Reinforcement Learning: An Introduction (Version 2) Richard S. Sutton and Andrew G. Barto """ def __init__(self, k, epsilon=0.1): """ Constructor of EGreedy ...
github_jupyter
# <img src="https://github.com/JuliaLang/julia-logo-graphics/raw/master/images/julia-logo-color.png" height="100" /> _for Pythonistas_ > TL;DR: _Julia looks and feels a lot like Python, only much faster. It's dynamic, expressive, extensible, with batteries included, in particular for Data Science_. This notebook is a...
github_jupyter
``` import matplotlib as mpl import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator from sklearn.metrics import accuracy_score from sklearn.feature_extraction.text import CountVectorizer, TfidfTran...
github_jupyter
# 第2回講義 演習 ``` from sklearn.utils import shuffle from sklearn.datasets import fetch_mldata, fetch_openml from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import numpy as np np.random.seed(34) ``` ## 目次 課題1. ロジスティック回帰の実装と学習 (OR) 1. シグモイド関数 2. データセットの設定と重みの定義 3. train関数...
github_jupyter
``` import os import torch from neo import * import yaml from tqdm import tqdm %load_ext autoreload %autoreload 2 import pandas as pd from database_env import * def get_times(path, env_config, time=False): env = DataBaseEnv(env_config) plans = {} times = {} paths = list(Path(path).glob("*sql.jso...
github_jupyter
## A tremendously brief R tutorial Hadley Wickham is better at teaching R than I am and it brings me absolutely no shame to say so. If you want to understand how R works and to quickly learn how to put R into practice, your best bet is to turn to his R for data science course and dig in. But like it's unnessessary to ...
github_jupyter
## PRINCIPLE COMPONENT ANALYSIS ### Authors Ndèye Gagnessiry Ndiaye and Christin Seifert ### License This work is licensed under the Creative Commons Attribution 3.0 Unported License https://creativecommons.org/licenses/by/3.0/ This notebook: - creates PCA projections of Iris dataset ``` import pandas as pd i...
github_jupyter
<figure> <IMG SRC="https://mamba-python.nl/images/logo_basis.png" WIDTH=125 ALIGN="right"> </figure> # Warnings _developed by Onno Ebbens_ <hr> Warnings in Python zijn bedoelt om een gebruiker van code te waarschuwen maar wel door te gaan met het uitvoeren van de code. In dit notebook wordt uitgelegd welke in...
github_jupyter
``` import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="0" import pandas as pd import numpy as np import time from sklearn.metrics import log_loss from sklearn.model_selection import train_test_split, StratifiedKFold from sklearn.preprocessing import RobustScaler from keras.prep...
github_jupyter
# Data-X Project: Electricity Price Prediction ## Feature Modeling Group: Machine Learning Optimization Pipeline Description of Notebook Retail electricity prices across different regions will have varying dependencies on all kinds of other signals in the energy marketplace. This notebook is an "pipeline" that integr...
github_jupyter
## Domain knowledge discretisation Frequently, when engineering variables in a business setting, the business experts determine the intervals in which they think the variable should be divided so that it makes sense for the business. Typical examples are the discretisation of variables like Age and Income. Income fo...
github_jupyter
# Examples for lolviz ## Install If on mac, I had to do this: ```bash $ brew install graphviz # had to upgrade graphviz on el capitan ``` Then ```bash $ pip install lolviz ``` ## Sample visualizations ``` from lolviz import objviz, listviz, lolviz, callviz, callsviz, treeviz, strviz objviz([u'2016-08-12',107.779...
github_jupyter
<h1>Loops in Python</h1> <p><strong>Welcome!</strong> This notebook will teach you about the loops in the Python Programming Language. By the end of this lab, you'll know how to use the loop statements in Python, including for loop, and while loop.</p> <div class="alert alert-block alert-info" style="margin-top: 20px...
github_jupyter
``` import xml.etree.ElementTree as ET # !pip install xml-python # parsing the xml data # intro to Element Tree tree = ET.parse('movie.xml') tree root = tree.getroot() print(root) root.tag root.attrib # for loop for child in root: print(child.tag ,":attrib> ",child.attrib) for elem in root.iter(): print(elem.t...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D5_DimensionalityReduction/W1D5_Tutorial4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 5, Tutorial 4 # Di...
github_jupyter
# Challenge: Analyzing Text about Data Science In this example, let's do a simple exercise that covers all steps of a traditional data science process. You do not have to write any code, you can just click on the cells below to execute them and observe the result. As a challenge, you are encouraged to try this code ...
github_jupyter
``` import os from glob import glob from joblib import Parallel, delayed from tqdm import tqdm_notebook as tqdm import pickle import pandas as pd import pumpp import jams import numpy as np def root(x): return os.path.splitext(os.path.basename(x))[0] AUDIO = jams.util.find_with_extension('/home/bmcfee/data/eric_...
github_jupyter
# COVID-19 Classification using Logistic Regression In this notebook, we have implemented baseline models Logistic Regression Model. Later, we have also taken the layer embeddings to analyse the decision boundaries using clustering approach ``` ! pip install opencv-python import numpy as np import os import cv2 from ...
github_jupyter
## Polynomial Chaos Expansion Example 6 Author: Katiana Kontolati \ Date: December 8, 2020 In this example, PCE is used to generate a surrogate model for a given set of 8D data. ### Robot arm function <img src="Example_6_function.png" alt="Drawing" style="width: 200px;"/> **Dimensions:** 8 **Description:** Model...
github_jupyter
### osu!nn #5: New Map Reader Reads the data from the music. This data will be used to create a whole map! Final edit: 2018/8/16 Before you read data from the music, it needs timing. Luckily there are some BPM analyzers on the web, and those are pretty accurate, so no need of Deep Learning for that! The analyzer I...
github_jupyter
# SN Like candidates in the last 4 days ### Ken Smith Get supernova candidates ingested into Lasair within the last 4 days. This notebook will use the Lasair client code, except for acquisiton of the user token. Demonstrates usage of: * /query/ * /objects/ ### Python (3 only) requirements - pip install lasair, reque...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt ``` # QUESTION 3(a) ``` dataset = pd.read_csv("iris.csv", header=None) dataset.head() ``` ## Rename Column Names ``` dataset.columns = ['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width', 'Class'] dataset.head() ``` ## Check for m...
github_jupyter
## Pre-Procesing ``` from preprocessing import train_valid_test_split, combine_labels, get_attribute_dims # Train-Test Split Folders SOURCE_DATA_DIR = "data/ClothingAttributeDataset/images/" TARGET_DATA_DIR = "data/ClothingAttributeDataset/" # Labels File LABEL_DIR = "data/ClothingAttributeDataset/labels/" labels_fil...
github_jupyter
# Iterative methods We explore in this notebook some iterative techniques for linear algebra problems. The implementations are written to expose how the methods work and are not optimised. Production-level implementations typically involve some specialised optimisations. This notebook illustrates: - Power iteration ...
github_jupyter