text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` from time import time import secrets import flickrapi import requests import os import pandas as pd import pickle import logging def get_photos(image_tag): # setup dataframe for data raw_photos = pd.DataFrame(columns=['latitude', 'longitude','farm','server','id','secret']) # initialize api f...
github_jupyter
``` import numpy as np import pandas as pd from os import makedirs from os.path import join, exists #from nilearn.input_data import NiftiLabelsMasker from nilearn.connectome import ConnectivityMeasure from nilearn.plotting import plot_anat, plot_roi import bct #from nipype.interfaces.fsl import InvWarp, ApplyWarp impor...
github_jupyter
# Example Map Plotting ### At the start of a Jupyter notebook you need to import all modules that you will use ``` import pandas as pd import xarray as xr import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import griddata import cartopy import cartopy.crs as ccrs # For plotting ...
github_jupyter
# Description This notebook documents allows the following on a group seven LIFX Tilechain with 5 Tiles laid out horizontaly as following T1 [0] [1] [2] [3] [4] T2 [0] [1] [2] [3] [4] T3 [0] [1] [2] [3] [4] T4 [0] [1] [2] [3] [4] T5 [0] [1] [2] [3] [4] T6 [0] [1] [2] [3] [4] T7 [0] [1] [2] [3] [4...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm ``` # Import Risk INFORM index ``` path = "C:\\batch8_worldbank\\datasets\\tempetes\\INFORM_Risk_2021.xlsx" xl = pd.ExcelFile(path) xl.sheet_names inform_df = xl.parse(xl.sheet_names[2]) inform_df.columns = info...
github_jupyter
# Db2 Jupyter Notebook Extensions Tutorial The SQL code tutorials for Db2 rely on a Jupyter notebook extension, commonly refer to as a "magic" command. The beginning of all of the notebooks begin with the following command which will load the extension and allow the remainder of the notebook to use the %sql magic comm...
github_jupyter
``` import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler df_train = pd.read_excel('wpbc.train.xlsx') df_test = pd.read_excel('wpbc.test.xlsx') train = df_train test = df_test train.shape test.shape train.describe() import seaborn import m...
github_jupyter
# oneDPL- Gamma Correction example #### Sections - [Gamma Correction](#Gamma-Correction) - [Why use buffer iterators?](#Why-use-buffer-iterators?) - _Lab Exercise:_ [Gamma Correction](#Lab-Exercise:-Gamma-Correction) - [Image outputs](#Image-outputs) ## Learning Objectives * Build a sample __DPC++ application__ to p...
github_jupyter
# DECOMON tutorial #3 ## Local Robustness to Adversarial Attacks for classification tasks ## Introduction After training a model, we want to make sure that the model will give the same output for any images "close" to the initial one, showing some robustness to perturbation. In this notebook, we start from a class...
github_jupyter
``` import argparse import copy import sys sys.path.append('../../') import sopa.src.models.odenet_cifar10.layers as cifar10_models from sopa.src.models.odenet_cifar10.utils import * parser = argparse.ArgumentParser() # Architecture params parser.add_argument('--is_odenet', type=eval, default=True, choices=[True, Fals...
github_jupyter
1/14 최초 구현 by 소연 수정 및 테스트 시 본 파일이 아닌 사본 사용을 부탁드립니다. ``` import os, sys from google.colab import drive drive.mount('/content/drive') %cd /content/drive/Shareddrives/KPMG_Ideation import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd from pprint import pprint from krwordra...
github_jupyter
``` from pynq import Overlay from pynq import PL from pprint import pprint pprint(PL.ip_dict) print(PL.timestamp) ol2 = Overlay('base.bit') ol2.download() pprint(PL.ip_dict) print(PL.timestamp) PL.interrupt_controllers PL.gpio_dict a = PL.ip_dict for i,j in enumerate(a): print(i,j,a[j]) a['SEG_rgbled_gpio_Reg'] b =...
github_jupyter
# Capsule Networks (CapsNets) Based on the paper: [Dynamic Routing Between Capsules](https://arxiv.org/abs/1710.09829), by Sara Sabour, Nicholas Frosst and Geoffrey E. Hinton (NIPS 2017). Inspired in part from Huadong Liao's implementation: [CapsNet-TensorFlow](https://github.com/naturomics/CapsNet-Tensorflow). # In...
github_jupyter
<a href="https://colab.research.google.com/github/Anmol42/IDP-sem4/blob/main/notebooks/Sig-mu_vae.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import torch import torchvision import torch.nn as nn import matplotlib.pyplot as plt import torch....
github_jupyter
# Analyzing interstellar reddening and calculating synthetic photometry ## Authors Kristen Larson, Lia Corrales, Stephanie T. Douglas, Kelle Cruz Input from Emir Karamehmetoglu, Pey Lian Lim, Karl Gordon, Kevin Covey ## Learning Goals - Investigate extinction curve shapes - Deredden spectral energy distributions an...
github_jupyter
``` # Checkout www.pygimli.org for more examples %matplotlib inline ``` # 2D ERT modeling and inversion ``` import matplotlib.pyplot as plt import numpy as np import pygimli as pg import pygimli.meshtools as mt from pygimli.physics import ert ``` Create geometry definition for the modelling domain. worldMarker=Tr...
github_jupyter
This page was created from a Jupyter notebook. The original notebook can be found [here](https://github.com/klane/databall/blob/master/notebooks/parameter-tuning.ipynb). It investigates tuning model parameters to achieve better performance. First we must import the necessary installed modules. ``` import itertools imp...
github_jupyter
# PySDDR: An Advanced Tutorial In the beginner's guide only tabular data was used as input to the PySDDR framework. In this advanced tutorial we show the effects when combining structured and unstructured data. Currently, the framework only supports images as unstructured data. We will use the MNIST dataset as a sour...
github_jupyter
``` # Copyright 2021 Google LLC # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. # Author(s): Kevin P. Murphy (murphyk@gmail.com) and Mahmoud Soliman (mjs@aucegypt.edu) ``` <a href="https://opensource.org/licenses/MIT" t...
github_jupyter
# TimeEval shared parameter optimization result analysis ``` # Automatically reload packages: %load_ext autoreload %autoreload 2 # imports import json import warnings import pandas as pd import numpy as np import scipy as sp import plotly.offline as py import plotly.graph_objects as go import plotly.figure_factory as ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#label-identity-hairstyle" data-toc-modified-id="label-identity-hairstyle-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>label identity hairstyle</a></span></li><li><span><a href=...
github_jupyter
``` import numpy as np import pandas as pd ``` ### loading dataset ``` data = pd.read_csv("student-data.csv") data.head() data.shape type(data) ``` ### Exploratory data analysis ``` import matplotlib.pyplot as plt import seaborn as sns a = data.plot() data.info() data.isnull().sum() a = sns.heatmap(data.isnull(),cm...
github_jupyter
<a href="https://colab.research.google.com/github/NataliaDiaz/colab/blob/master/MI203-td2_tree_and_forest.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # TD: prédiction du vote 2016 aux Etats-Unis par arbres de décisions et méthodes ensemblistes ...
github_jupyter
<a href="https://colab.research.google.com/github/Laelapz/Some_Tests/blob/main/BERTimbau.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Tem caracteres em chinês? Pq eles pegam a maior distribuição do dataset??? Tirado do Twitter? (Alguns nomes/sob...
github_jupyter
# The Binomial Distribution This notebook is part of [Bite Size Bayes](https://allendowney.github.io/BiteSizeBayes/), an introduction to probability and Bayesian statistics using Python. Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativ...
github_jupyter
``` # Import libraries import numpy as np import pandas as pd import sklearn as sk import matplotlib import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties # for unicode fonts import psycopg2 import sys import datetime as dt import mp_utils as mp from sklearn.pipeline import Pipeline # use...
github_jupyter
# Fairseq in Amazon SageMaker: Pre-trained English to French translation model In this notebook, we will show you how to serve an English to French translation model using pre-trained model provided by the [Fairseq toolkit](https://github.com/pytorch/fairseq) ## Permissions Running this notebook requires permissions...
github_jupyter
``` import codecs from itertools import * import numpy as np from sklearn import svm from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn import tree from sklearn import model_selection from sklearn.model_selection import train_test_split from sklearn.ensemble impo...
github_jupyter
``` # -*- coding: utf-8 -*- """ EVCで変換する. 詳細 : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580aabf534c4dbb8bc.pdf Converting by EVC. Check detail : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580abf534c4dbb8bc.pdf """ from __future__ import division, print_function import os from shutil imp...
github_jupyter
<CENTER> <header> <h1>Pandas Tutorial</h1> <h3>EuroScipy, Erlangen DE, August 24th, 2016</h3> <h2>Joris Van den Bossche</h2> <p></p> Source: <a href="https://github.com/jorisvandenbossche/pandas-tutorial">https://github.com/jorisvandenbossche/pandas-tutorial</a> </header> </CENTER> Two data files a...
github_jupyter
# Closed-Loop Evaluation In this notebook you are going to evaluate Urban Driver to control the SDV with a protocol named *closed-loop* evaluation. **Note: this notebook assumes you've already run the [training notebook](./train.ipynb) and stored your model successfully (or that you have stored a pre-trained one).** ...
github_jupyter
``` %load_ext autoreload %autoreload 2 from quantumnetworks import MultiModeSystem, plot_full_evolution import numpy as np ``` # Trapezoidal Method ``` # params stored in txt sys = MultiModeSystem(params={"dir":"data/"}) x_0 = np.array([1,0,0,1]) ts = np.linspace(0, 10, 101) X = sys.trapezoidal(x_0, ts) fig, ax = plo...
github_jupyter
___ <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> ___ # Principal Component Analysis Let's discuss PCA! Since this isn't exactly a full machine learning algorithm, but instead an unsupervised learning algorithm, we will just have a lecture on this topic, but no full machine learnin...
github_jupyter
## osumapper: create osu! map using Tensorflow and Colab ### -- For osu!mania game mode -- For mappers who don't know how this colaboratory thing works: - Press Ctrl+Enter in code blocks to run them one by one - It will ask you to upload .osu file and audio.mp3 after the third block of code - .osu file needs to have ...
github_jupyter
<a href="https://colab.research.google.com/github/magenta/ddsp/blob/master/ddsp/colab/tutorials/0_processor.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2020 Google LLC. Licensed under the Apache License, Version 2.0 (the "Licen...
github_jupyter
### Tutorial: Parameterized Hypercomplex Multiplication (PHM) Layer #### Author: Eleonora Grassucci Original paper: Beyond Fully-Connected Layers with Quaternions: Parameterization of Hypercomplex Multiplications with 1/n Parameters. Aston Zhang, Yi Tay, Shuai Zhang, Alvin Chan, Anh Tuan Luu, Siu Cheung Hui, Jie Fu....
github_jupyter
``` import sys import pandas as pd import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt sys.path.append('../Scripts') from Data_Processing import DataProcessing from tensorflow import keras from keras.callbacks import ModelCheckpoint from keras.models import load_model from keras import back...
github_jupyter
# Amazon Fine Food Reviews Analysis Data Source: https://www.kaggle.com/snap/amazon-fine-food-reviews <br> EDA: https://nycdatascience.com/blog/student-works/amazon-fine-foods-visualization/ The Amazon Fine Food Reviews dataset consists of reviews of fine foods from Amazon.<br> Number of reviews: 568,454<br> Numb...
github_jupyter
# Conditional statements - part 1 ## Motivation All the previous programs are based on a pure sequence of statements. After the start of the program the statements are executed step by step and the program ends afterwards. However, it is often necessary that parts of a program are only executed under certain conditio...
github_jupyter
# Using a random forest for demographic model selection In Schrider and Kern (2017) we give a toy example of demographic model selection via supervised machine learning in Figure Box 1. Following a discussion on twitter, Vince Buffalo had the great idea of our providing a simple example of supervised ML in population g...
github_jupyter
#### Copyright 2017 Google LLC. ``` # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interpn import os import config import utils # Read measured profiles measuredDoseFiles10 = ['./Measured/Method3/PDD1_10x10.dat','./Measured/Method3/PDD2_10x10.dat', './Measured/Method3/PROF1_10x10_14mm.dat','....
github_jupyter
``` import numpy as np import theano import theano.tensor as T import lasagne import os #thanks @keskarnitish ``` # Agenda В предыдущем семинаре вы создали (или ещё создаёте - тогда марш доделывать!) {вставьте имя монстра}, который не по наслышке понял, что люди - негодяи и подлецы, которым неведом закон и справедлив...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sklearn import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sns #from viz import viz from bokeh.plotting import figure, show, output_notebook, output_file, save #from functions import ...
github_jupyter
``` # Packages from IPython.display import Image import rasterio from rasterio import windows import skimage import skimage.io as skio import json import skimage.draw import os import sys import pathlib import math import itertools from shutil import copy2 import functools from skimage import exposure import matplotlib...
github_jupyter
# Import packages & Connect the database ``` # Install MYSQL client pip install PyMySQL import sklearn print('The scikit-learn version is {}.'.format(sklearn.__version__)) %load_ext autoreload %autoreload 2 %matplotlib inline import numpy as np import pandas as pd import datetime as dt # Connect to database import p...
github_jupyter
# Archive data The Wellcome archive sits in a collections management system called CALM, which follows a rough set of standards and guidelines for storing archival records called [ISAD(G)](https://en.wikipedia.org/wiki/ISAD(G). The archive is comprised of _collections_, each of which has a hierarchical set of series, s...
github_jupyter
<a href="https://colab.research.google.com/github/lakigigar/Caltech-CS155-2021/blob/main/psets/set1/set1_prob3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Problem 3 Use this notebook to write your code for problem 3 by filling in the sections...
github_jupyter
In this tutorial you'll learn all about **histograms** and **density plots**. # Set up the notebook As always, we begin by setting up the coding environment. (_This code is hidden, but you can un-hide it by clicking on the "Code" button immediately below this text, on the right._) ``` #$HIDE$ import pandas as pd im...
github_jupyter
# IMPORTING THE LIBRARIES ``` import os import pandas as pd import pickle import numpy as np import seaborn as sns from sklearn.datasets import load_files from keras.utils import np_utils import matplotlib.pyplot as plt from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D from keras.layers import Drop...
github_jupyter
``` # Import that good good import sys import os sys.path.append('/Users/kolbt/Desktop/ipython/diam_files') import pandas as pd import matplotlib.pyplot as plt import numpy as np import math from IPython.display import display from collections import OrderedDict pd.options.display.max_rows = 2 import matplotlib.colors...
github_jupyter
# TensorFlow Neural Machine Translation on Cloud TPUs This tutorial demonstrates how to translate text using a LSTM Network from one language to another (from English to German in this case). We will work with a dataset that contains pairs of English-German phrases. Given a sequence of words in English, we train a mod...
github_jupyter
``` # We tweak the style of this notebook a little bit to have centered plots. from IPython.core.display import HTML HTML(""" <style> .output_png { display: table-cell; text-align: center; vertical-align: middle; } </style> """); %matplotlib inline import warnings warnings.filterwarnings('ignore') warning...
github_jupyter
# Notebook Goal & Approach ## Goal For each FERC 714 respondent that reports hourly demand as an electricity planning area, create a geometry representing the geographic area in which that electricity demand originated. Create a separate geometry for each year in which data is available. ## Approach * Use the `eia_co...
github_jupyter
# Part 0: Mining the web Perhaps the richest source of openly available data today is [the Web](http://www.computerhistory.org/revolution/networking/19/314)! In this lab, you'll explore some of the basic programming tools you need to scrape web data. > **Note.** The Vocareum platform runs in a cloud-based environment...
github_jupyter
# Main notebook for battery state estimation ``` import numpy as np import pandas as pd import scipy.io import math import os import ntpath import sys import logging import time import sys from importlib import reload import plotly.graph_objects as go import tensorflow as tf from tensorflow import keras from tensorf...
github_jupyter
``` %matplotlib inline """ The data set in this example represents 1059 songs from various countries obtained from the UCI Machine Learning library. Various features of the audio tracks have been extracted, and each track has been tagged with the latitude and longitude of the capital city of its country of origin. ...
github_jupyter
##### Copyright 2020 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
``` import open3d as o3d import numpy as np import os import sys # monkey patches visualization and provides helpers to load geometries sys.path.append('..') import open3d_tutorial as o3dtut # change to True if you want to interact with the visualization windows o3dtut.interactive = not "CI" in os.environ ``` # RGBD ...
github_jupyter
# Using Interrupts and asyncio for Buttons and Switches This notebook provides a simple example for using asyncio I/O to interact asynchronously with multiple input devices. A task is created for each input device and coroutines used to process the results. To demonstrate, we recreate the flashing LEDs example in the ...
github_jupyter
# Making Simple Plots ## Objectives + Learn how to make a simple 1D plot in Python. + Learn how to find the maximum/minimum of a function in Python. We will use [Problem 4.B.2](https://youtu.be/w-IGNU2i3F8) of the lecturebook as a motivating example. We find that the moment of the force $\vec{F}$ about point A is: $$...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Plot-Validation-and-Train-loss" data-toc-modified-id="Plot-Validation-and-Train-loss-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Plot Validation and Train loss</a></span></li><li><span><a href="#Extra...
github_jupyter
# 6. Hidden Markov Models with Theano and TensorFlow In the last section we went over the training and prediction procedures of Hidden Markov Models. This was all done using only vanilla numpy the Expectation Maximization algorithm. I now want to introduce how both `Theano` and `Tensorflow` can be utilized to accomplis...
github_jupyter
``` # use python eval sometimes. great trickdefining a class and operator overloading import aoc f = open('input.txt') lines = [line.rstrip('\n') for line in f] lines[0] # part 1 def evaluate(line): ans = 0 firstop = None operator = None wait = 0 for i, ch in enumerate(line): if wait > 0: # ...
github_jupyter
# Creating Provenance an Example Using a Python Notebook ``` import prov, requests, pandas as pd, io, git, datetime, urllib from prov.model import ProvDocument ``` ## Initialising a Provenance Document First we use the prov library to create a provenance and initialise it with some relevant namespaces that can be us...
github_jupyter
# Cython in Jupyter notebooks To use cython in a Jupyter notebook, the extension has to be loaded. ``` %load_ext cython ``` ## Pure Python To illustrate the performance difference between a pure Python function and a cython implementation, consider a function that computes the list of the first $k_{\rm max}$ prime ...
github_jupyter
``` !pip install plotly ``` <a href="https://plotly.com/python/" target="_blank">Plotly's</a> Python graphing library makes interactive, publication-quality graphs. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar ch...
github_jupyter
### Mit kellene tudni? #### 1. Megfogalmazni egy programozási problémát <!-- .element: class="fragment" --> #### 1. Számításelmélet értelmét elmagyarázni <!-- .element: class="fragment" --> #### 1. Lebontani egy komplex problémát egyszerűbbekre <!-- .element: class="fragment" --> #### 1. Megérteni egy leírt progr...
github_jupyter
# Módulo 2: Scraping con Selenium ## LATAM Airlines <a href="https://www.latam.com/es_ar/"><img src="https://i.pinimg.com/originals/dd/52/74/dd5274702d1382d696caeb6e0f6980c5.png" width="420"></img></a> <br> Vamos a scrapear el sitio de Latam para averiguar datos de vuelos en funcion el origen y destino, fecha y cabin...
github_jupyter
## RIHAD VARIAWA, Data Scientist - Who has fun LEARNING, EXPLORING & GROWING <h1>2D <code>Numpy</code> in Python</h1> <p><strong>Welcome!</strong> This notebook will teach you about using <code>Numpy</code> in the Python Programming Language. By the end of this lab, you'll know what <code>Numpy</code> is and the <code...
github_jupyter
``` # Let's keep our notebook clean, so it's a little more readable! import warnings warnings.filterwarnings('ignore') %matplotlib inline ``` # Machine learning to predict age from rs-fmri The goal is to extract data from several rs-fmri images, and use that data as features in a machine learning model. We will integ...
github_jupyter
<a href="https://colab.research.google.com/github/bhadreshpsavani/ExploringSentimentalAnalysis/blob/main/SentimentalAnalysisWithGPTNeo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Step1. Import and Load Data ``` !pip install -q pip install gi...
github_jupyter
``` from collections import OrderedDict from collections import namedtuple import numpy as np from scipy import stats # R precision def r_precision(targets, predictions, max_n_predictions=500): # Assumes predictions are sorted by relevance # First, cap the number of predictions predictions = predictions[...
github_jupyter
# Implementing a CGAN for the Iris data set to generate synthetic data ### Import necessary modules and packages ``` import os while os.path.basename(os.getcwd()) != 'Synthetic_Data_GAN_Capstone': os.chdir('..') from utils.utils import * safe_mkdir('experiments') from utils.data_loading import load_raw_dataset imp...
github_jupyter
``` import qiskit import numpy as np, matplotlib.pyplot as plt import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.nqubit, qtm.onequbit, qtm.fubini_study num_qubits = 3 num_layers = 2 psi = 2*np.random.rand(2**num_qubits)-1 psi = psi / np.linalg.norm(psi) qc_origin = qiskit.QuantumCircuit(num_qubits...
github_jupyter
# Collaborative Filtering on Google Analytics Data ### Learning objectives 1. Prepare the user-item matrix and use it with WALS. 2. Train a `WALSMatrixFactorization` within TensorFlow locally and on AI Platform. 3. Visualize the embedding vectors with principal components analysis. ## Overview This notebook demonstra...
github_jupyter
``` import numpy as np from resonance.nonlinear_systems import SingleDoFNonLinearSystem ``` To apply arbitrary forcing to a single degree of freedom linear or nonlinear system, you can do so with `SingleDoFNonLinearSystem` (`SingleDoFLinearSystem` does not support arbitrary forcing...yet). Add constants, a generalize...
github_jupyter
# Fit $k_{ij}$ and $r_c^{ABij}$ interactions parameter of Ethanol and CPME This notebook has te purpose of showing how to optimize the $k_{ij}$ and $r_c^{ABij}$ for a mixture with induced association. First it's needed to import the necessary modules ``` import numpy as np from sgtpy import component, mixture, saft...
github_jupyter
# Mini Project: Temporal-Difference Methods In this notebook, you will write your own implementations of many Temporal-Difference (TD) methods. While we have provided some starter code, you are welcome to erase these hints and write your code from scratch. ### Part 0: Explore CliffWalkingEnv Use the code cell below...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #default_exp data.core #export from fastai.torch_basics import * from fastai.data.load import * #hide from nbdev.showdoc import * ``` # Data core > Core functionality for gathering data The classes here provide functionality for ...
github_jupyter
<img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם חינמי ללימוד תכנות בעברית."> # <span style="text-align: right; direction: rtl; float: r...
github_jupyter
##### 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
## Fundamentals, introduction to machine learning The purpose of these guides is to go a bit deeper into the details behind common machine learning methods, assuming little math background, and teach you how to use popular machine learning Python packages. In particular, we'll focus on the Numpy and PyTorch libraries...
github_jupyter
# The Graph Data Access In this notebook, we read in the data that was generated and saved as a csv from the [TheGraphDataSetCreation](TheGraphDataSetCreation.ipynb) notebook. Goals of this notebook are to obtain: * Signals, states, event and sequences * Volatility metrics * ID perceived shocks (correlated with an...
github_jupyter
``` import pandas as pd import numpy as np import pickle BASEDIR_MIMIC = '/Volumes/MyData/MIMIC_data/mimiciii/1.4' def get_note_events(): n_rows = 100000 icd9_code = pd.read_csv(f"{BASEDIR_MIMIC}/DIAGNOSES_ICD.csv", index_col = None) # create the iterator noteevents_iterator = pd.read_csv( f"{...
github_jupyter
# Make Corner Plots of Posterior Distributions This file allows me to quickly and repeatedly make the cornor plot to examin the results of the MCMC analsys ``` import numpy as np import matplotlib.pyplot as plt import matplotlib import pandas as pd from astropy.table import Table import corner # import seaborn matplo...
github_jupyter
``` import radical.analytics as ra import radical.pilot as rp import radical.utils as ru import radical.entk as re import os from glob import glob import numpy as np from matplotlib import pyplot as plt from matplotlib import cm import csv import pandas as pd import json import matplotlib as mpl mpl.rcParams['text.uset...
github_jupyter
# Running, Debugging, Testing & Packaging ``` !code ./1-helloconnectedworld ``` Let's look at the key parts of our app: **package.json** This defines all contributions: commands, context menus, UI, everything! ```json "activationEvents": [ // Use "*" to start on application start. If contributing comm...
github_jupyter
# Convolutional Autoencoder Sticking with the MNIST dataset, let's improve our autoencoder's performance using convolutional layers. Again, loading modules and the data. ``` %matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import i...
github_jupyter
Practice geospatial aggregations in geopandas before writing them to .py files ``` %load_ext autoreload %autoreload 2 import sys sys.path.append('../utils') import wd_management wd_management.set_wd_root() import geopandas as gp import pandas as pd import requests res = requests.get('https://services5.arcgis.com/GfwWN...
github_jupyter
<a href="https://colab.research.google.com/github/prateekjoshi565/Fine-Tuning-BERT/blob/master/Fine_Tuning_BERT_for_Spam_Classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Install Transformers Library ``` !pip install transformers imp...
github_jupyter
# Run hacked AlphaFold2 on the designed bound states ### Imports ``` %load_ext lab_black # Python standard library from glob import glob import os import socket import sys # 3rd party library imports import dask import matplotlib.pyplot as plt import pandas as pd import pyrosetta import numpy as np import scipy impo...
github_jupyter
<a href="https://colab.research.google.com/github/parshwa1999/Map-Segmentation/blob/master/ResNet_RoadTest.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Segmentation of Road from Satellite imagery ## Importing Libraries ``` import warnings war...
github_jupyter
## Homework 4 Today we'll start by reproducing the DQN and then try improving it with the tricks we learned on the lecture: * Target networks * Double q-learning * Prioritized experience replay * Dueling DQN * Bootstrap DQN ``` import matplotlib.pyplot as plt import numpy as np %matplotlib inline # If you are runni...
github_jupyter
``` dtypes = { 'MachineIdentifier': 'category', 'ProductName': 'category', 'EngineVersion': 'category', 'AppVersion': 'category', ...
github_jupyter
``` import numpy as np import nibabel as nb import matplotlib.pyplot as plt # helper function to plot 3D NIfTI def plot_slice (fname): # Load image img = nb.load (fname) data = img.get_data () # cut in the middle of brain cut = int (data.shape[-1]/2) + 10 # plot data plt.imsh...
github_jupyter
<font size ='3'>*First, let's read in the data and necessary libraries*<font/> ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from mypy import print_side_by_side from mypy import display_side_by_side #https://stackoverflow.com/a/44923103/8067752 %matplotlib inline pd....
github_jupyter
# Appendix Hao Lu 04/04/2020 In this notebook, we simulated EEG data with the method described in the paper by Bharadwaj and Shinn-Cunningham (2014) and analyzed the data with the toolbox proposed in the same paper. The function was modifed so the values of thee variables within the function can be extracted and stu...
github_jupyter
# Statistics ## Introduction In this chapter, you'll learn about how to do statistics with code. We already saw some statistics in the chapter on probability and random processes: here we'll focus on computing basic statistics and using statistical tests. We'll make use of the excellent [*pingouin*](https://pingouin-...
github_jupyter
``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import savefig import cv2 np.set_printoptions(threshold=np.inf) num_images = 3670 dataset = [] for i in range(1, num_images+1): img = cv2.imread("color_images/color_" +str(i) +".jpg" ) dataset.append(np.array...
github_jupyter