text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## Importação de Bibliotecas ``` import numpy as np import pandas as pd import seaborn as sns import missingno as msno import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split ``` ## Visualizando os dados Importação dos Datasets obtidos no site da Policia Rodoviaria Federal https://anti...
github_jupyter
# Bayesian Cognitive Modeling in PyMC3 PyMC3 port of Lee and Wagenmakers' [Bayesian Cognitive Modeling - A Pratical Course](http://bayesmodels.com) All the codes are in jupyter notebook with the model explain in distributions (as in the book). Background information of the models please consult the book. You can also ...
github_jupyter
# Creating the Florida school number crosswalks ``` from os import path import os import numpy as np import pandas as pd from fuzzywuzzy import fuzz from fuzzywuzzy import process ``` ## Assert folders are in place ``` folders = [ '../data/intermediary/keys/', ] for folder in folders: if path.exists(folder...
github_jupyter
``` !apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Finite-Difference Playground: Using NRPy+-Generated C Cod...
github_jupyter
# Getting started with Random Matrix Theory: Wigner semicircle Author: Mirco Milletari' <milletari@gmail.com> In this notebook we give a simple numerical validation of the Wigner semicircle distribution discussed in this [blog article](https://medium.com/cantors-paradise/getting-started-with-random-matrices-a-step-b...
github_jupyter
# Drug Type Predictor This notebook will create a model to predict drug to prescribe a patient given their demographic and other clinical data. The dataset is taken from [this Kaggle Dataset](https://www.kaggle.com/prathamtripathi/drug-classification) # The Dataset The dataset's target variable (drug type) contain...
github_jupyter
``` import pandas as pd import numpy as np import os import pickle import platform from sklearn.preprocessing import StandardScaler from mabwiser.mab import MAB, LearningPolicy from mabwiser.linear import _RidgeRegression, _Linear class LinTSExample(_RidgeRegression): def predict(self, x): if self.scaler ...
github_jupyter
# Running ProjectQ code on AWS Braket service provided devices ## Compiling code for AWS Braket Service In this tutorial we will see how to run code on some of the devices provided by the Amazon AWS Braket service. The AWS Braket devices supported are: the State Vector Simulator 'SV1', the Rigetti device 'Aspen-8' and...
github_jupyter
# 深度概率编程CVAE ## 概述 本例采用MindSpore的深度概率编程方法应用于条件变分自编码器(CVAE)模型训练。 整体流程如下: 1. 数据集准备 2. 定义条件变分自编码器网络; 3. 定义损失函数和优化器; 4. 训练生成模型。 5. 生成新样本或重构输入样本。 > 本例适用于GPU和Ascend环境。 ## 数据准备 ### 下载数据集 本例使用MNIST_Data数据集,执行如下命令进行下载并解压到对应位置: ``` !wget -N https://obs.dualstack.cn-north-4.myhuaweicloud.com/mindspore-website/notebook/d...
github_jupyter
# Example: Using MIRAGE to Generate Wide Field Slitless Exposures This notebook shows how to use Mirage to create Wide Field Slitless Spectroscopy (WFSS) data, beginning with an APT file. This can be done for NIRCam or NIRISS. *Table of Contents:* * [Getting Started](#getting_started) * [Create input yaml files from ...
github_jupyter
# Neighborhood Structures in the ArcGIS Spatial Statistics Library 1. Spatial Weights Matrix 2. On-the-fly Neighborhood Iterators [GA Table] 3. Contructing PySAL Spatial Weights # Spatial Weight Matrix File 1. Stores the spatial weights so they do not have to be re-calculated for each analysis. 2. In row-compressed fo...
github_jupyter
``` import pandas as pd cols=['data','label','index'] ``` # Malayalam Data ``` mal_train = pd.read_csv('/content/drive/MyDrive/mal_full_offensive_train.csv',sep='\t',names=cols) mal_dev= pd.read_csv('/content/drive/MyDrive/mal_full_offensive_dev.csv',sep='\t',names=cols) mal_test = pd.read_csv('/content/drive/MyDriv...
github_jupyter
# ORF recognition by CNN Use variable number of bases between START and STOP. Thus, ncRNA will have its STOP out-of-frame or too close to the START, and pcRNA will have its STOP in-frame and far from the START. ``` import time t = time.time() time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t)) PC_SEQUENCES=1000...
github_jupyter
# 数据抓取: > ### Requests、Beautifulsoup、Xpath简介 *** 王成军 wangchengjun@nju.edu.cn 计算传播网 http://computational-communication.com # 爬虫基本原理 http://www.cnblogs.com/zhaof/p/6898138.html # 需要解决的问题 - 页面解析 - 获取Javascript隐藏源数据 - 自动翻页 - 自动登录 - 连接API接口 - 一般的数据抓取,使用requests和beautifulsoup配合就可以了。 - 尤其是对于翻页时url出现规则变化的网页,只需要处理规则化...
github_jupyter
``` %matplotlib inline import re import numpy as np import pandas as pd from IPython.display import display, HTML from pathlib import Path from matplotlib import pyplot as plt from datetime import datetime def extract(string, key, dtype): if dtype is bool: return True if re.search(' {}=((True)|(False)) '.f...
github_jupyter
# Visualizing hypergraphs As for pairwise networks, visualizing hypergraphs is surely a hard task and no algorithm can exaustively work for any given input structure. Here we show how to visualize some toy structures using the visualization function contained in the ```drawing``` module that heavily relies on [networkx...
github_jupyter
``` import sys import os from pathlib import Path import numpy as np import pandas as pd import skimage.io as io import torch from torchvision.models.detection import maskrcnn_resnet50_fpn import albumentations as A from albumentations.pytorch import ToTensorV2 from pytorch_toolbelt.utils import to_numpy, rle_encode...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
github_jupyter
# 1 Download Raw Data This module is used for downloading the original Excel files that contain the historical LAM data. Run all cells of this notebook to get the data of Askisto, Mäntsälä and Kemijärvi to "raw_dataset.csv". ``` import urllib.request import calendar import glob import pandas as pd import subprocess ...
github_jupyter
# Feature selection ``` from feature_selector import FeatureSelector import pandas as pd ``` * Import csv files into dataframes * Make sure to remove the orange category label row in the csv * Also move the original features in front of the new features * Also remove the other targets in the set ``` meta = ['Refere...
github_jupyter
<img src="../_static/pymt-logo-header-text.png"> ## Coastline Evolution Model + Waves * Link to this notebook: https://github.com/csdms/pymt/blob/master/notebooks/cem_and_waves.ipynb * Install command: `$ conda install notebook pymt_cem` This example explores how to use a BMI implementation to couple the Waves compo...
github_jupyter
This application demonstrates how to build a simple neural network using the Graph mark. Interactions can be enabled by adding event handlers (click, hover etc) on the nodes of the network. See the [Mark Interactions notebook](../Interactions/Mark Interactions.ipynb) and the [Scatter Notebook](../Marks/Scatter.ipynb)...
github_jupyter
``` from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import numpy as np import matplotlib.pyplot as plt import os import sys from torch.utils.data import DataLoader, TensorDataset import t...
github_jupyter
## 1) Preprocess all the necessary variables ### 1.1) Build feature, target and initial normalization files ``` #!ln -s /filer/z-sv-pool12c/t/Tom.Beucler/SPCAM/CBRAIN-CAM/cbrain \ #/filer/z-sv-pool12c/t/Tom.Beucler/SPCAM/CBRAIN-CAM/notebooks/tbeucler_devlog/cbrain from cbrain.imports import * from cbrain.data_generato...
github_jupyter
# Nearest Neighbors When exploring a large set of documents -- such as Wikipedia, news articles, StackOverflow, etc. -- it can be useful to get a list of related material. To find relevant documents you typically * Decide on a notion of similarity * Find the documents that are most similar In the assignment you will...
github_jupyter
# PRMT-1960 Can we use the presence of a error code at a particular point in the process to designate a transfer as failed ### Context Data range: 01/09/2020 - 28/02/2021 (6 months) ### Hypothesis **We believe that** certain Error Codes appear at certain points in the GP2GP process, **Can** automatically be conside...
github_jupyter
``` # default_exp plots from IPython.core.debugger import set_trace from IPython.utils import traitlets as _traitlets ``` <h1><center> Plotting Playing Sequence </center></h1> This module is highly inspired from [`matplotsoccer` library](https://github.com/TomDecroos/matplotsoccer/blob/master/matplotsoccer/fns.py) wi...
github_jupyter
``` import random import pandas as pd import matplotlib.pyplot as plt from pathlib import Path import sys sys.path.insert(0, '..') from utils.latex import add_colname, show_latex, TABLES from utils.config import PATHS from utils.data_process import concat_annotated, drop_disregard, fix_week_14 pd.set_option('max_colum...
github_jupyter
<h3>Problem: As a PM, I write lots of blogs. How do I know if they will be received well by readers?</h3> <table> <tr> <td><img src="https://jayclouse.com/wp-content/uploads/2019/06/hacker_news.webp" height=300 width=300></img></td> <td><img src="https://miro.medium.com/max/852/1*wJ18DgYgtsscG63Sn...
github_jupyter
SOP055 - Uninstall azdata CLI (using pip) ========================================= Steps ----- ### Common functions Define helper functions used in this notebook. ``` # Define `run` function for transient fault handling, hyperlinked suggestions, and scrolling updates on Windows import sys import os import re impor...
github_jupyter
``` # -*- coding: utf-8 -*- # # 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, so...
github_jupyter
``` import datetime lipidname = "OEMC" tail = "CCDDC CDCC" link = "G G" head = "C P" description = "; A general model Plasmenylcholines (MC) lipid \n; C18:2(9c,12c) linoleic acid, C18:1(9c) oleic acid \n" modeledOn="; This topology follows the standard Martini 2.0 lipid definitions and building block rules...
github_jupyter
# Speed and Quality of Katz-Eigen Community Detection vs Louvain ``` import zen import pandas as pd import numpy as np from clusteringAlgo import lineClustering import matplotlib.pyplot as plt ``` #### Compare the speed of the Katz-eigen plot method of community detection with that of Louvain community detection, usi...
github_jupyter
# Denoising Autoencoder Sticking with the MNIST dataset, let's add noise to our data and see if we can define and train an autoencoder to _de_-noise the images. <img src='notebook_ims/autoencoder_denoise.png' width=70%/> Let's get started by importing our libraries and getting the dataset. ``` # The MNIST datasets ...
github_jupyter
``` import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import datetime plt.style.use('ggplot') sns.set_style("whitegrid") %matplotlib inline %config InlineBackend.figure_format = 'svg' def read_df(f, i): items = f.split("/") binner, ass...
github_jupyter
# Recommender Systems using Affinity Analysis <hr> Here we will look at affinity analysis that determines when objects occur frequently together. This is also called market basket analysis, after one of the use cases of determining when items are purchased together frequently. In this example, we wish to work out when...
github_jupyter
# Gaussian Process Fitting by Sarah Blunt ### Prerequisites This tutorial assumes knowledge of the basic `radvel` API for $\chi^2$ likelihood fitting. As such, please complete the following before beginning this tutorial: - radvel/docs/tutorials/164922_Fitting+MCMC.ipynb - radvel/docs/tutorials/K2-24_Fitting+MCMC.ipy...
github_jupyter
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Solution Notebook ## Problem: Implement Fizz Buzz. * [Constraints](#Constraints) * [Test Cases](#Test-Cases) * [Algorithm](#Algorithm) ...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib import librosa import numpy as np import librosa.display import scipy.io.wavfile s, da = scipy.io.wavfile.read('schnitzel.wav') data = da.astype('float32') # y, sr = librosa.load(librosa.ex('trumpet')) librosa.feature.melspectrogram(y=data, sr=s) D = np.abs(libros...
github_jupyter
# Warsztat 4 - funkcje<a id=top></a> <font size=2>Przed pracą z notatnikiem polecam wykonać kod w ostatniej komórce (zawiera html i css), dzięki czemu całość będzie bardziej estetyczna :)</font> <a href='#Warsztat-4---funkcje'>Warsztat 4</a> <ul> <li><a href='#Składnia'><span>Składnia</span></a></li> <li><a href='#...
github_jupyter
# Exploration of one customer Analysis of: * global stats * daily pattern Also, found a week of interest (early 2011-12) for futher work ([Solar home control bench](https://github.com/pierre-haessig/solarhome-control-bench) and SGE 2018 paper) * daily pattern the month before this week To be done: [clustering of da...
github_jupyter
# Pedersen N07 neutral case with heat flux ## Nalu-Wind with K-SGS model Comparison between Nalu-wind and Pedersen (2014) **Note**: To convert this notebook to PDF, use the command ```bash $ jupyter nbconvert --TagRemovePreprocessor.remove_input_tags='{"hide_input"}' --to pdf postpro_n07.ipynb ``` ``` %%capture # ...
github_jupyter
# Chapter 6 - Unsupervised Machine Learning ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set_style("whitegrid") # Import Data df = pd.read_csv("../../datasets/dataset_wisc_sd.csv") print(df.shape) # Cleaning up df = df.replace(r'\\n','', regex=True) df = df.dr...
github_jupyter
# Обучение нейросетей — оптимизация и регуляризация **Разработчик: Артем Бабенко** На это семинаре будет необходимо (1) реализовать Dropout-слой и проследить его влияние на обобщающую способность сети (2) реализовать BatchNormalization-слой и пронаблюдать его влияние на скорость сходимости обучения. ## Dropout (0.6 б...
github_jupyter
# Gradient Checking Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking. You are part of a team working to make mobile payments available globally, and are asked to build a deep learning model to detect fraud--whenever someone makes a payment, you w...
github_jupyter
## Model-Agnostic Meta-Learning Based on the paper: <i>Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks</i>. Data from this [notebook](https://github.com/hereismari/tensorflow-maml/blob/master/maml.ipynb): sinusoid dataset of sine waves with different amplitude and phase, representing different "tasks...
github_jupyter
# "Hardware Build - Part 2" > "Buckle up, Assembling the hardware now." - toc: true - branch: master - badges: false - comments: true - categories: [SelfDriving] - hide: false - search_exclude: false - image: images/post-thumbnails/Hardware_Config.png - metadata_key1: MUSHR - metadata_key2: # Purpose The intention of...
github_jupyter
## Sorting and Grouping The Search service offers the ability to organize your result set in different ways. Whether you choose to sort based on a specific property, group properties or boost the result set, you have the option to override the default ordering returned. In addition, you can also use navigation to orga...
github_jupyter
``` #Importing the required libraries #Use pandas, seaborn, numpy and matplotlib import os print(os.listdir("../input")) import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt %matplotlib inline #Read the values of the dataset into a Pandas Dataframe #Also display the dataframe ...
github_jupyter
# USB Webcam This notebook shows how to use a USB web camera attached to the Pynq-Z1 board. An image is captured using [fswebcam](http://manpages.ubuntu.com/manpages/wily/man1/fswebcam.1.html). The image can then be manipulated using the Python Image Library (Pillow). The webcam used is the Logitech USB HD Webcam C27...
github_jupyter
# PETs/TETs – Hyperledger Aries / PySyft – Manufacturer 2 (Holder) 🚛 ``` %%javascript document.title = '🚛 Manufacturer2' ``` ## PART 3: Connect with City to Analyze Data **What:** Share encrypted data with City agent in a trust- and privacy-preserving manner **Why:** Share data with City agent (e.g., to obtain fu...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
# Hierarchical Clustering ### Validation with Dendogram and Heatmap Created by Andres Segura-Tinoco Created on Apr 20, 2021 ``` # Import libraries import numpy as np from sklearn import datasets from sklearn.cluster import AgglomerativeClustering from scipy.cluster.hierarchy import dendrogram, linkage import scipy....
github_jupyter
``` %matplotlib inline # ignore warnings import warnings warnings.filterwarnings('ignore') from joblib import load, dump from ruamel.yaml import YAML from matplotlib import pyplot as plt import seaborn as sns import numpy as np import pandas as pd import h5py import periodictable as pt from palettable.cartocolors.seq...
github_jupyter
### Import Packages ``` import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import pandas as pd from mpl_toolkits.mplot3d import Axes3D import random ``` ### Import Data ``` npids = -1 data = pd.read_csv('nlst_407_prsn_20180510.csv').sample(frac=1) data_canc = data[data['can_scr']>0][:-1] d...
github_jupyter
## 練習時間 ### F1-Score 其實是 F-Score 中的 β 值為 1 的特例,代表 Precision 與 Recall 的權重相同 請參考 F1-score 的[公式](https://en.wikipedia.org/wiki/F1_score) 與下圖的 F2-score 公式圖,試著寫出 F2-Score 的計算函數 ![image](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaUAAAB4CAMAAABl2x3ZAAACIlBMVEX///8AAADh4eG/v7/7+/v29vbx8fH8/Pz4+Pjo6OgvLy/s7OyMjIzz8/Pq6uq...
github_jupyter
## PSRC Linear Regression ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt % matplotlib inline import seaborn as sns from seaborn.linearmodels import corrplot,symmatplot #from sklearn.linear_model import LogisticRegression #from sklearn.utils import shuffle from sklearn.model_selection impor...
github_jupyter
``` import os import importlib os.chdir('../app') import preprocessing.preglobal as pg import task_lib as tl import fit_lib as fl importlib.reload(fl) importlib.reload(tl) tl.execute_tasks() # RUN AFTER TASKS ARE ADDED TO SPAWN TASKS ## MLE FITS - done mle_fit_params = { 'fit_book_notfixed':{ 'fitparameter...
github_jupyter
# Train Eval Baseline for CelebA Dataset --- ## Import Libraries ``` import sys sys.path.append("..") import matplotlib.pyplot as plt %load_ext autoreload %autoreload 2 %matplotlib inline import torch import numpy as np import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.util...
github_jupyter
``` # Erasmus+ ICCT project (2018-1-SI01-KA203-047081) # Toggle cell visibility from IPython.display import HTML tag = HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide() } else { $('div.input').show() } code_show = !code_show } $( document...
github_jupyter
# Soccerstats Predictions v2.0 The changelog from v1.x: * Implement data cleaning pipeline for model predictions. * Load saved model from disk. * Use model to predict data points. ## A. Data Preparation ### 1. Read csv file ``` # load csv data to predict stat_df = sqlContext.read\ .format("com.databricks.spark....
github_jupyter
``` # Hidden TimeStamp import time, datetime st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') print('Last Run: {}'.format(st)) # Hidden Working Directory # Run this cell only once from IPython.display import clear_output %cd ../ clear_output() #PYTEST_VALIDATE_IGNORE_OUTPUT # Hidden Vers...
github_jupyter
# Summary: This notebook contains the soft smoothing figures for Amherst (Figure 2(c)). ## load libraries ``` from __future__ import division import networkx as nx import numpy as np import os from sklearn import metrics from sklearn.preprocessing import label_binarize from sklearn.metrics import confusion_matrix ...
github_jupyter
# Training a DeepSpeech LSTM Model using the LibriSpeech Data At the end of Chapter 16 and into Chapter 17 in the book it is suggested try and build an automatic speech recognition system using the LibriVox corpus and long short term memory (LSTM) models just learned in the Recurrent Neural Network (RNN) chapter. This...
github_jupyter
``` %config IPCompleter.greedy=True # then click ". + tab " simultaniously -> intellisense # $ conda info -e -> shows conda envs # $ conda activate py37 # (py37) pips install jupyter-tabnine ... #press [SHIFT] and [TAB] from within the method parentheses ### intellisense - works perfect!! -> excute in command line wi...
github_jupyter
# Approximate q-learning In this notebook you will teach a __tensorflow__ neural network to do Q-learning. __Frameworks__ - we'll accept this homework in any deep learning framework. This particular notebook was designed for tensorflow, but you will find it easy to adapt it to almost any python-based deep learning fr...
github_jupyter
# Credit Card Fraud Detection Throughout the financial sector, machine learning algorithms are being developed to detect fraudulent transactions. In this project, that is exactly what we are going to be doing as well. Using a dataset of of nearly 28,500 credit card transactions and multiple unsupervised anomaly dete...
github_jupyter
# Assignment 5 ![](https://github.com/rpi-techfundamentals/hm-01-starter/blob/master/notsaved.png?raw=1) **WARNING!!! If you see this icon on the top of your COLAB sesssion, your work is not saved automatically.** **When you are working on homeworks, make sure that you save often. You may find it easier to save in...
github_jupyter
# Shape segmentation The notebooks in this folder replicate the experiments as performed for [CNNs on Surfaces using Rotation-Equivariant Features](https://doi.org/10.1145/3386569.3392437). The current notebook replicates the shape segmentation experiments from section `5.2 Comparisons`. ## Imports We start by impor...
github_jupyter
# Linear Regression We will follow the example given by [scikit-learn](https://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html), and use the [diabetes](https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html) dataset to train and test a linear regressor. We begin by loading the dataset (using only t...
github_jupyter
# stripmap acquisition mode In conventional stripmap Synthetic Aperture Radar(SAR) imaging mode, the radar antenna is fixed to a specific direction, illuminating a single swath of the scene with a fixed squint angle (i.e., the angle between the radar beam and the cross-track direction). The imaging swath width can be ...
github_jupyter
# Stochastic optimization landscape of a minimal MLP In this notebook, we will try to better understand how stochastic gradient works. We fit a very simple non-convex model to data generated from a linear ground truth model. We will also observe how the (stochastic) loss landscape changes when selecting different sa...
github_jupyter
## Day 1: Of Numerical Integration and Python Welcome to Day 1! Today, we start with our discussion of what Numerical Integration is. ### What is Numerical Integration? From the point of view of a theoretician, the ideal form of the solution to a differential equation given the initial conditions, i.e. an initial va...
github_jupyter
``` import numpy as np import pandas as pd import pickle import math import os import matplotlib.pyplot as plt import collections from scipy import stats from sklearn.preprocessing import MinMaxScaler ################### n_f=7 n_node=365 ################### #label - load fact y_area=np.load('data/data_cablearea.npy');p...
github_jupyter
``` %matplotlib inline import cosmo_metric_utils as cmu import pandas as pd import matplotlib.pyplot as plt import numpy as np import matplotlib.colors as colors import matplotlib.cm as cmx from mpl_toolkits.axes_grid1 import make_axes_locatable import os import glob #dist_loc_base = '/media/RESSPECT/data/PLAsTiCC/f...
github_jupyter
``` %load_ext autoreload %autoreload 2 import torch from torch.nn import functional as F from torch import nn from pytorch_lightning.core.lightning import LightningModule import pytorch_lightning as pl import torch.optim as optim import torchvision import torchvision.datasets as datasets import torchvision.transforms ...
github_jupyter
``` import optuna as op import pandas as pd import numpy as np from scipy.spatial.transform import Rotation import seaborn as sns import matplotlib.pyplot as plt sns.set() ``` This is a slightly lower tech process that attempts to align the datasets via procrustes transformations. Each embedding is performed ind...
github_jupyter
## Neral Networks In Pytorch * We're just going to use data from Pytorch's "torchvision." Pytorch has a relatively handy inclusion of a bunch of different datasets, including many for vision tasks, which is what torchvision is for. > Let's visualise the datatets that we can find in `torchvision` ## Imports ``` import...
github_jupyter
``` %%javascript MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "AMS" } } }); ``` # 03. Differential Privacy [Differential privacy](https://www.microsoft.com/en-us/research/publication/differential-privacy/) is a popular mechanism to quantitatively assess the privacy loss of a given probabilistic quer...
github_jupyter
``` %matplotlib inline import pylab as plt import time import sys sys.path.insert(0, '/opt/usr/python/') import astra import numpy as np import pandas as pd def create_test_cube(size): # Create a simple hollow cube phantom cube = np.zeros((size,size,size), dtype='float32') x0 = int(128.*size/1024) x1 =...
github_jupyter
<a href="https://colab.research.google.com/github/unica-ml/ml/blob/master/notebooks/lab05.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Machine Learning - Lab05 ## Neural Networks with PyTorch This notebook provides a brief introduction to PyT...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Generating C Code for the Scalar Wave Equation in Cartesi...
github_jupyter
# BATEMAN’S EQUATIONS: CHAIN OF DECAYS OF 3 NUCLEAR SPECIES ## Import Libraries ``` import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams; rcParams["figure.dpi"] = 300 from matplotlib.ticker import (AutoMinorLocator) plt.style.use('seaborn-bright') plt.rc('font', family='serif') plt.rc('x...
github_jupyter
``` # Copyright 2021 Fagner Cunha # # 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 writ...
github_jupyter
# Linear Regression Linear regression model is one of the simplest regression models. It assumes linear relationship between $X$ and $Y$. The output equation is defined as follows: $$\hat{y} = WX + b$$ The *Advertising data set* (from "*An Introduction to Statistical Learning*", textbook by Gareth James, Robert Tibs...
github_jupyter
# 09 - Beginner Exercises * Lambda --- ## 🍩🍩🍩 1.Create a lambda function that takes an argument $x$ and returns $x^{2}$. Then assign it to the variable Pow. then print Pow(2) , Pow(3) , Pow(1400) . ``` # Write your own code in this cell Pow = ``` ## 🍩🍩🍩 2.Create a lambda function that takes two argument ...
github_jupyter
What's New and Changed in version 2.8.210321 -------------------------------------------- Version 2.8.210321 supports **SAP HANA SPS05** and **SAP HANA Cloud** Enhancement: - Enhanced sql() to enable multiline execution. - Enhanced save() to add append option. - Enhanced diff() to enable negative input. ...
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
# Degree Planner Backend Algorithm ## TODO: * In class Graph, use dict for nodes * In class Graph, finish isCompleted() * Figure out whats wrong with '__str__' * Add all components to Node class (full name, description, etc.) * In Graph, nodesToRemove(), return 2 lists: required, and possible to take * Finish God ``...
github_jupyter
``` #!pip install librosa """import librosa as lib import os import pandas as pd import pylab import numpy as np import librosa.display import glob """ """def convert(filename): sig, fs = lib.load(filename) # make pictures name save_path = filename+'.jpg' pylab.axis('off') # no axis pylab.a...
github_jupyter
``` import sqlite3 import pandas as pd import numpy as np import matplotlib.pyplot as plt import plotly.plotly as py import plotly.graph_objs as go from sklearn.cross_validation import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score from sklearn.cross_va...
github_jupyter
# OpenVaccine: COVID-19 mRNA Vaccine Degradation Prediction In this [Kaggle competition](https://www.kaggle.com/c/stanford-covid-vaccine/overview) we try to develop models and design rules for RNA degradation. As the overview of the competition states: >mRNA vaccines have taken the lead as the fastest vaccine candida...
github_jupyter
## Dataset Directory Structure Parent_Directory (root) | |-----------Images (img_dir) | | | |------------------img1.jpg | |------------------img2.jpg | |------------------.........(and so on) |...
github_jupyter
# How To: Provisioning Data Science Virtual Machine (DSVM) __Notebook Version:__ 1.0<br> __Python Version:__ Python 3.6<br> __Platforms Supported:__<br> - Azure Notebooks Free Compute __Data Source Required:__<br> - no ### Description The sample notebook shows how to provision a Azure DSVM as an alterna...
github_jupyter
<table style="float:left; border:none"> <tr style="border:none; background-color: #ffffff"> <td style="border:none"> <a href="http://bokeh.pydata.org/"> <img src="assets/bokeh-transparent.png" style="width:50px" > </a> ...
github_jupyter
* cookiecutter is too slow to do live ** nbdime, nbval was broken * Too long talking after setup, before notebook * More instructions for what doing while talking * Too much text in notebooks - fine for SOLUTION notebook, but the problem notebooks should be pretty bare Problem/solution. * Need stop/talk points in ...
github_jupyter
``` import requests import datetime import json import time import pandas as pd import numpy as np import warnings warnings.filterwarnings('ignore') import os from datetime import datetime as dt,date,timedelta from smtplib import SMTP import smtplib from pretty_html_table import build_table from email.mime.text import ...
github_jupyter
``` import numpy as np#you usually need numpy #---these are for plots---# import matplotlib matplotlib.use('nbAgg') import matplotlib.pyplot as plt plt.rcParams['font.size']=16 plt.rcParams['font.family']='dejavu sans' plt.rcParams['mathtext.fontset']='stix' plt.rcParams['mathtext.rm']='custom' plt.rcParams['mathtex...
github_jupyter
``` import pandas as pd from sklearn import datasets import matplotlib.pyplot as plt ``` <h2><font color="darkblue">Support Vector Machine</font></h2> <hr/> ### Preliminaries - Linearly separable > Let $ S_0 $ and $ S_1 $ be two sets of points in an $ n $-dimensional Euclidean space. We say $ S_0 $ and $ S_1 $ are l...
github_jupyter