text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` %%sh pip -q install sagemaker stepfunctions --upgrade # Enter your role ARN workflow_execution_role = '' import boto3 import sagemaker import stepfunctions from stepfunctions import steps from stepfunctions.steps import TrainingStep, ModelStep, EndpointConfigStep, EndpointStep, TransformStep, Chain from stepfuncti...
github_jupyter
# Module 10 - Regression Algorithms - Linear Regression Welcome to Machine Learning (ML) in Python! We're going to use a dataset about vehicles and their respective miles per gallon (mpg) to explore the relationships between variables. The first thing to be familiar with is the data preprocessing workflow. Data need...
github_jupyter
<a href="https://colab.research.google.com/github/isaacmg/task-vt/blob/biobert_finetune/drug_treatment_extraction/notebooks/BioBERT_RE.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Finetuning BioBERT for RE This is a fine-tuning notebook that we...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt from sqlalchemy import inspect ``` # Reflect Tables into SQLAlchemy ORM ``` import sqlalchemy from sqlalchemy.ext.automap import automap_base fr...
github_jupyter
# Mislabel detection using influence function with all of layers on Cifar-10, ResNet ### Author [Neosapience, Inc.](http://www.neosapience.com) ### Pre-train model conditions --- - made mis-label from 1 percentage dog class to horse class - augumentation: on - iteration: 80000 - batch size: 128 #### cifar-10 train d...
github_jupyter
``` import os os.chdir('..') os.chdir('..') print(os.getcwd()) import rsnapsim as rss import numpy as np os.chdir('rsnapsim') os.chdir('interactive_notebooks') import numpy as np import matplotlib.pyplot as plt import time poi_strs, poi_objs, tagged_pois,raw_seq = rss.seqmanip.open_seq_file('../gene_files/H2B_with...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
``` import pandas as pd import os import glob raw_data_path = os.path.join('data', 'raw') clean_filename = os.path.join('data', 'clean', 'data.csv') ``` # Read data ``` all_files = glob.glob(raw_data_path + "/top_songs_with_lyrics.csv") raw_data = pd.concat(pd.read_csv(f) for f in all_files) raw_data.head() ``` # Pr...
github_jupyter
``` %%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?fa...
github_jupyter
``` import pandas as pd import numpy as np from matplotlib import pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.metrics import roc_curve from sklearn.metrics import auc from sklearn.metri...
github_jupyter
## CIFAR 10 ``` %matplotlib inline %reload_ext autoreload %autoreload 2 ``` You can get the data via: wget http://pjreddie.com/media/files/cifar.tgz **Important:** Before proceeding, the student must reorganize the downloaded dataset files to match the expected directory structure, so that there is a dedicat...
github_jupyter
# 1. Very simple 'programs' ## 1.1 Running Python from the command line In order to test pieces of code we can run Python from the command line. In this Jupyter Notebook we are going to simulate this. You can type the commands in the fields and execute them.<br> In the field type:<br> `print('Hello, World')`<br> Then p...
github_jupyter
## Install packages and connect to Oracle ``` sc.install_pypi_package("sqlalchemy") sc.install_pypi_package("pandas") sc.install_pypi_package("s3fs") sc.install_pypi_package("cx_Oracle") sc.install_pypi_package("fsspec") from sqlalchemy import create_engine engine = create_engine('oracle://CMSDASHADMIN:4#X9#Veut#KSsU#...
github_jupyter
# Generative Spaces (ABM) In this workshop we will lwarn how to construct a ABM (Agent Based Model) with spatial behaviours, that is capable of configuring the space. This file is a simplified version of Generative Spatial Agent Based Models. For further information, you can find more advanced versions here: * [Objec...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@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.o...
github_jupyter
# Pre-procesamiento de datos ![image.png](attachment:a70264d0-d460-4c9e-bee9-fd86c37a94b5.png) ## Candidaturas elegidas Principales transformaciones: - Selección de atributos - Tratamiento de valores faltantes ``` import glob import nltk import re import pandas as pd from string import punctuation df_deputadas_1...
github_jupyter
``` import torch from dataset import load_dataset from basic_unet import UNet import matplotlib.pyplot as plt from rise import RISE from pathlib import Path from plot_utils import plot_image_row from skimage.feature import canny batch_size = 1 device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") trai...
github_jupyter
<a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Evaluating_TrOCR_base_handwritten_on_the_IAM_test_set.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Set-up environment ``` !pip install -q gi...
github_jupyter
``` import os, sys import torch from transformers import BertModel, BertConfig from greenformer import auto_fact from itertools import chain from os import path import sys def count_param(module, trainable=False): if trainable: return sum(p.numel() for p in module.parameters() if p.requires_grad) else:...
github_jupyter
# Implementing a one-layer Neural Network We will illustrate how to create a one hidden layer NN We will use the iris data for this exercise We will build a one-hidden layer neural network to predict the fourth attribute, Petal Width from the other three (Sepal length, Sepal width, Petal length). ``` import matpl...
github_jupyter
# From batch to online ## A quick overview of batch learning If you've already delved into machine learning, then you shouldn't have any difficulty in getting to use incremental learning. If you are somewhat new to machine learning, then do not worry! The point of this notebook in particular is to introduce simple no...
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 pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np %matplotlib inline data_label = pd.read_csv("data(with_label).csv") ``` ### 30 day death age ``` fig = plt.figure(figsize=(12,6)) sns.set_style('darkgrid') ax = sns.violinplot(x="thirty_days", hue="gender", y="age",data=d...
github_jupyter
# Logic: `logic.py`; Chapters 6-8 This notebook describes the [logic.py](https://github.com/aimacode/aima-python/blob/master/logic.py) module, which covers Chapters 6 (Logical Agents), 7 (First-Order Logic) and 8 (Inference in First-Order Logic) of *[Artificial Intelligence: A Modern Approach](http://aima.cs.berkele...
github_jupyter
``` # Copyright 2021 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 writi...
github_jupyter
# Classification algorithms In the context of record linkage, classification refers to the process of dividing record pairs into matches and non-matches (distinct pairs). There are dozens of classification algorithms for record linkage. Roughly speaking, classification algorithms fall into two groups: - **supervised...
github_jupyter
# Deep Matrix Factorisation Matrix factorization with deep layers ``` import sys sys.path.append("../") import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd from IPython.display import SVG, display import matplotlib.pyplot as plt import seaborn as sns from reco.preprocess import ...
github_jupyter
# AdaDelta compared to AdaGrad Presented during ML reading group, 2019-11-12. Author: Ivan Bogdan-Daniel, ibogdanidaniel@gmail.com ``` #%matplotlib notebook %matplotlib inline import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D print(f'Numpy version: ...
github_jupyter
# Exploratory Data Analysis of AllenSDK ``` # Only for Colab #!python -m pip install --upgrade pip #!pip install allensdk ``` ## References - [[AllenNB1]](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/visual_behavior_ophys_data_access.html) Download data using the AllenSDK or directly from our Amazon...
github_jupyter
# Consumption Equivalent Variation (CEV) 1. Use the model in the **ConsumptionSaving.pdf** slides and solve it using **egm** 2. This notebooks estimates the *cost of income risk* through the Consumption Equivalent Variation (CEV) We will here focus on the cost of income risk, but the CEV can be used to estimate the ...
github_jupyter
# Facial Expression Recognizer ``` #The OS module in Python provides a way of using operating system dependent functionality. #import os # For array manipulation import numpy as np #For importing data from csv and other manipulation import pandas as pd #For displaying images import matplotlib.pyplot as plt import m...
github_jupyter
2017 Machine Learning Practical University of Edinburgh Georgios Pligoropoulos - s1687568 Coursework 4 (part 7) ### Imports, Inits, and helper functions ``` jupyterNotebookEnabled = True plotting = True coursework, part = 4, 7 saving = True if jupyterNotebookEnabled: #%load_ext autoreload %reload_ext aut...
github_jupyter
``` import re import json import pandas as pd import numpy as np from collections import deque ``` ## Process dataset ``` base_folder = "../movies-dataset/" movies_metadata_fn = "movies_metadata.csv" credits_fn = "credits.csv" links_fn = "links.csv" ``` ## Process movies_metadata data structure/schema ``` metadat...
github_jupyter
``` import sympy as sp import numpy as np x = sp.symbols('x') p = sp.Function('p') l = sp.Function('l') poly = sp.Function('poly') p3 = sp.Function('p3') p4 = sp.Function('p4') ``` # Introduction Last time we have used Lagrange basis to interpolate polynomial. However, it is not efficient to update the interpolating ...
github_jupyter
``` import numpy as np, pandas as pd, matplotlib.pyplot as plt import os import seaborn as sns sns.set() root_path = r'C:\Users\54638\Desktop\Cannelle\Excel handling' input_path = os.path.join(root_path, "input") output_path = os.path.join(root_path, "output") %%time # this line magic function should always be put on ...
github_jupyter
# fuzzy_pandas examples These are almost all from [Max Harlow](https://twitter.com/maxharlow)'s [awesome NICAR2019 presentation](https://docs.google.com/presentation/d/1djKgqFbkYDM8fdczFhnEJLwapzmt4RLuEjXkJZpKves/) where he demonstrated [csvmatch](https://github.com/maxharlow/csvmatch), which fuzzy_pandas is based on....
github_jupyter
<h1>Demand forecasting with BigQuery and TensorFlow</h1> In this notebook, we will develop a machine learning model to predict the demand for taxi cabs in New York. To develop the model, we will need to get historical data of taxicab usage. This data exists in BigQuery. Let's start by looking at the schema. ``` impo...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge...
github_jupyter
# Deterministic point jet ``` import matplotlib.pyplot as plt import pandas as pd import numpy as np import matplotlib.pylab as pl ``` \begin{equation} \partial_t \zeta = \frac{\zeta_{jet}}{\tau} - \mu \zeta + \nu_\alpha \nabla^{2\alpha} - \beta \partial_x \psi - J(\psi, \zeta) \zeta \end{equation} Here $\zeta_...
github_jupyter
# Building Autonomous Trader using mt5se ## How to setup and use mt5se ### 1. Install Metatrader 5 (https://www.metatrader5.com/) ### 2. Install python package Metatrader5 using pip #### Use: pip install MetaTrader5 ... or Use sys package ### 3. Install python package mt5se using pip #### Use: pip install mt5se ...
github_jupyter
<a href="https://colab.research.google.com/github/Lambda-School-Labs/bridges-to-prosperity-ds-d/blob/SMOTE_model_building%2Ftrevor/notebooks/Modeling_off_original_data_smote_gridsearchcv.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> This notebook ...
github_jupyter
##### Copyright 2019 The TensorFlow Hub Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` # Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. ...
github_jupyter
<a href="https://cognitiveclass.ai"><img src = "https://ibm.box.com/shared/static/9gegpsmnsoo25ikkbl4qzlvlyjbgxs5x.png" width = 400> </a> <h1 align=center><font size = 5>Waffle Charts, Word Clouds, and Regression Plots</font></h1> ## Introduction In this lab, we will learn how to create word clouds and waffle charts...
github_jupyter
<h2>Factorization Machines - Movie Recommendation Model</h2> Input Features: [userId, moveId] <br> Target: rating <br> ``` import numpy as np import pandas as pd # Define IAM role import boto3 import re import sagemaker from sagemaker import get_execution_role # SageMaker SDK Documentation: http://sagemaker.readthed...
github_jupyter
# The overview of the basic approaches to solving the Uplift Modeling problem <br> <center> <a href="https://colab.research.google.com/github/maks-sh/scikit-uplift/blob/master/notebooks/RetailHero_EN.ipynb"> <img src="https://colab.research.google.com/assets/colab-badge.svg"> </a> <br> <b><a hr...
github_jupyter
``` s = 'abc' s.upper() # L E G B # local # enclosing # global # builtins globals() globals()['s'] s.upper() dir(s) s.title() x = 'this is a bunch of words to show to people' x.title() for attrname in dir(s): print attrname, s.attrname for attrname in dir(s): print attrname, getattr(s, attrname) s.upper getattr...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. **IMPORTANT NOTE:** This notebook is designed to run as a Colab. Click the button on top that says, `Open in Colab`, to run this notebook as a Colab. Running the notebook on your local machine might result in some of the code blocks throwing errors. ``` #@title Licensed un...
github_jupyter
``` # ############################################### # ########## Default Parameters ################# # ############################################### start = '2016-06-16 22:00:00' end = '2016-06-18 00:00:00' pv_nominal_kw = 5000 # There are 3 PV locations hardcoded at node 7, 8, 9 inverter_sizing = 1.05 inverter_q...
github_jupyter
<a href="https://colab.research.google.com/github/ymoslem/OpenNMT-Tutorial/blob/main/2-NMT-Training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Install OpenNMT-py 2.x !pip3 install OpenNMT-py ``` # Prepare Your Datasets Please make sure y...
github_jupyter
``` try: from openmdao.utils.notebook_utils import notebook_mode except ImportError: !python -m pip install openmdao[notebooks] ``` # NonlinearBlockGS NonlinearBlockGS applies Block Gauss-Seidel (also known as fixed-point iteration) to the components and subsystems in the system. This is mainly used to solve ...
github_jupyter
``` #remove 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 ).ready(code_toggle); </script> Promijeni vidljivost ...
github_jupyter
## Search algorithms within Optuna In this notebook, I will demo how to select the search algorithm with Optuna. We will compare the use of: - Grid Search - Randomized search - Tree-structured Parzen Estimators - CMA-ES We can select the search algorithm from the [optuna.study.create_study()](https://optuna.readth...
github_jupyter
## Duplicated features ``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split ``` ## Read Data ``` data = pd.read_csv('../UNSW_Train.csv') data.shape # check the presence of missing data. # (there are no missing data in this dataset) [col for col in data.columns if data[col]....
github_jupyter
# Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help familiarize you with functions we'll need. **Instructions:** - You will be using Python 3. - Avoid using for-loops and while-lo...
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: Generate a list of primes. * [Constraints](#Constraints) * [Test Cases](#Test-Cases) * [Algorithm](#Algor...
github_jupyter
``` from __future__ import print_function import matplotlib.pyplot as plt %matplotlib inline import SimpleITK as sitk print(sitk.Version()) from myshow import myshow # Download data to work on %run update_path_to_download_script from downloaddata import fetch_data as fdata OUTPUT_DIR = "Output" ``` This section of t...
github_jupyter
# BUSINESS ANALYTICS You are the business owner of the retail firm and want to see how your company is performing. You are interested in finding out the weak areas where you can work to make more profit. What all business problems you can derive by looking into the data? ``` # Importing certain libraries import pandas...
github_jupyter
## Introduction In real world, there exists many huge graphs that can not be loaded in one machine, such as social networks and citation networks. To deal with such graphs, PGL develops a Distributed Graph Engine Framework to support graph sampling on large scale graph networks for distributed GNN training. In thi...
github_jupyter
# "[ML] What's the difference between a metric and a loss?" - toc:true - branch: master - badges: false - comments: true - author: Peiyi Hung - categories: [learning, machine learning] In machine learning, we usually use two values to evaluate our model: a metric and a loss. For instance, if we are doing a binary cla...
github_jupyter
# Canonical correlation analysis in python In this notebook, we will walk through the solution to the basic algrithm of canonical correlation analysis and compare that to the output of implementations in existing python libraries `statsmodels` and `scikit-learn`. ``` import numpy as np from scipy.linalg import sqrtm ...
github_jupyter
``` from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasRegressor import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.model_selection ...
github_jupyter
## Homework 3 and 4 - Applications Using MRJob ``` # general imports import os import re import sys import time import random import numpy as np import pandas as pd import matplotlib.pyplot as plt # tell matplotlib not to open a new window %matplotlib inline # automatically reload modules %reload_ext autoreload %au...
github_jupyter
# Debugging Numba problems ## Common problems Numba is a compiler, if there's a problem, it could well be a "compilery" problem, the dynamic interpretation that comes with the Python interpreter is gone! As with any compiler toolchain there's a bit of a learning curve but once the basics are understood it becomes eas...
github_jupyter
# Introduction to Strings --- This notebook covers the topic of strings and their importance in the world of programming. You will learn various methods that will help you manipulate these strings and make useful inferences with them. This notebook assumes that you have already completed the "Introduction to Data Scie...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Naive Bayes Classifier (Self Made) ### 1. Importing Libraries ``` import numpy as np import matplotlib.pyplot as plt import os import pandas as pd from sklearn.metrics import r2_score from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split from sklearn import preprocessing from...
github_jupyter
``` import numpy as np import pandas as pd import pickle import time import itertools import matplotlib matplotlib.rcParams.update({'font.size': 17.5}) import matplotlib.pyplot as plt %matplotlib inline import sys import os.path sys.path.append( os.path.abspath(os.path.join( os.path.dirname('..') , os.path.pardir ))...
github_jupyter
# Dense Sentiment Classifier In this notebook, we build a dense neural net to classify IMDB movie reviews by their sentiment. ``` #load watermark %load_ext watermark %watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplotlib,nltk,sklearn,tensorflow,theano,mxnet,chainer,seaborn,keras,tflearn,bokeh,gensim ...
github_jupyter
# Basics of the DVR calculations with Libra ## Table of Content <a name="TOC"></a> 1. [General setups](#setups) 2. [Mapping points on multidimensional grids ](#mapping) 3. [Functions of the Wfcgrid2 class](#wfcgrid2) 4. [Showcase: computing energies of the HO eigenstates](#ho_showcase) 5. [Dynamics: computed with SOF...
github_jupyter
# Predicting the Outcome of Cricket Matches ## Introduction In this project, we shall build a model which predicts the outcome of cricket matches in the Indian Premier League using data about matches and deliveries. ### Data Mining: * Season : 2008 - 2015 (8 Seasons) * Teams : DD, KKR, MI, RCB, KXIP, RR, CSK (7...
github_jupyter
Let's load the data from the csv just as in `dataset.ipynb`. ``` import pandas as pd import numpy as np raw_data_file_name = "../dataset/fer2013.csv" raw_data = pd.read_csv(raw_data_file_name) ``` Now, we separate and clean the data a little bit. First, we create an array of only the training data. Then, we create a...
github_jupyter
# Step 2 - Data Wrangling Raw Data in Local Data Lake to Digestable Data Loading, merging, cleansing, unifying and wrangling Oracle OpenWorld & CodeOne Session Data from still fairly raw JSON files in the local datalake. The gathering of raw data from the (semi-)public API for the Session Catalog into a local data ...
github_jupyter
Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks. - Author: Sebastian Raschka - GitHub Repository: https://github.com/rasbt/deeplearning-models ``` %load_ext watermark %watermark -a 'Sebastian Raschka' -v -p tensorflow,numpy `...
github_jupyter
# SQL TO KQL Conversion (Experimental) The `sql_to_kql` module is a simple converter to KQL based on [moz_sql_parser](https://github.com/DrDonk/moz-sql-parser). It is an experimental feature built to help us convert a few queries but we thought that it was useful enough to include in MSTICPy. You must have msticpy in...
github_jupyter
<a href="https://colab.research.google.com/github/oferbaharav/tally-ai-ds/blob/eda/Ofer_Spacy_NLP.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import boto3 import dask.dataframe as dd #from sagemaker import get_execution_role import pandas as...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #all_slow #export from fastai.basics import * from fastai.learner import Callback #hide from nbdev.showdoc import * #default_exp callback.azureml ``` # AzureML Callback Track fastai experiments with the azure machine learning plat...
github_jupyter
``` #Importing necessary dependencies import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns pd.set_option('display.max_columns',None) df=pd.read_excel('Data_Train.xlsx') df.head() df.shape ``` ## Exploratory data analysis First we will try to find the missing values and we will ...
github_jupyter
# Multiple Qubits & Entangled States Single qubits are interesting, but individually they offer no computational advantage. We will now look at how we represent multiple qubits, and how these qubits can interact with each other. We have seen how we can represent the state of a qubit using a 2D-vector, now we will see ...
github_jupyter
# A Transformer based Language Model from scratch > Building transformer with simple building blocks - toc: true - branch: master - badges: true - comments: true - author: Arto - categories: [fastai, pytorch] ``` #hide import sys if 'google.colab' in sys.modules: !pip install -Uqq fastai ``` In this notebook i'm...
github_jupyter
## <span style="color:purple">ArcGIS API for Python: Real-time Person Detection</span> <img src="../img/webcam_detection.PNG" style="width: 100%"></img> ## Integrating ArcGIS with TensorFlow Deep Learning using the ArcGIS API for Python This notebook provides an example of integration between ArcGIS and deep learnin...
github_jupyter
``` import tensorflow as tf config = tf.compat.v1.ConfigProto( gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.8), ) config.gpu_options.allow_growth = True session = tf.compat.v1.Session(config=config) tf.compat.v1.keras.backend.set_session(session) import os import warnings warnings.filterw...
github_jupyter
# Notebook to be used to Develop Display of Results ``` from importlib import reload import pandas as pd import numpy as np from IPython.display import Markdown # If one of the modules changes and you need to reimport it, # execute this cell again. import heatpump.hp_model reload(heatpump.hp_model) import heatpump.hom...
github_jupyter
# Module 5 -- Dimensionality Reduction -- Case Study # Import Libraries **Import the usual libraries ** ``` import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns %matplotlib inline ``` # Data Set : Cancer Data Set Features are computed from a digitized image of a fine needle a...
github_jupyter
## CCNSS 2018 Module 5: Whole-Brain Dynamics and Cognition # Tutorial 2: Introduction to Complex Network Analysis (II) *Please execute the cell bellow in order to initialize the notebook environment* ``` !rm -rf data ccnss2018_students !if [ ! -d data ]; then git clone https://github.com/ccnss/ccnss2018_students; \ ...
github_jupyter
<a href="https://colab.research.google.com/github/dlmacedo/starter-academic/blob/master/3The_ultimate_guide_to_Encoder_Decoder_Models_3_4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %%capture !pip install -qq git+https://github.com/huggingfa...
github_jupyter
# Step1: Create the Python Script In the cell below, you will need to complete the Python script and run the cell to generate the file using the magic `%%writefile` command. Your main task is to complete the following methods for the `PersonDetect` class: * `load_model` * `predict` * `draw_outputs` * `preprocess_outpu...
github_jupyter
# Think Bayes Second Edition Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) ``` # If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = ...
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline from scipy.st...
github_jupyter
# Software Carpentry ### EPFL Library, November 2018 ## Program | | 4 afternoons | 4 workshops | | :-- | :----------- | :---------- | | > | `Today` | `Unix Shell` | | | Thursday 22 | Version Control with Git | | | Tuesday 27 | Python I | | | Thursday 29 | More Python | ## Why did you decide to attend this wo...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # Load ...
github_jupyter
# Simple Go-To-Goal for Cerus The following code implements a simple go-to-goal behavior for Cerus. It uses a closed feedback loop to continuously asses Cerus' state (position and heading) in the world using data from two wheel encoders. It subsequently calculates the error between a given goal location and its curren...
github_jupyter
# Chatbot Tutorial - https://pytorch.org/tutorials/beginner/chatbot_tutorial.html ``` import torch from torch.jit import script, trace import torch.nn as nn from torch import optim import torch.nn.functional as F import csv import random import re import os import unicodedata import codecs from io import open import i...
github_jupyter
# Work with Data Data is the foundation on which machine learning models are built. Managing data centrally in the cloud, and making it accessible to teams of data scientists who are running experiments and training models on multiple workstations and compute targets is an important part of any professional data scien...
github_jupyter
# Part 5: Competing Journals Analysis In this notebook we are going to * Load the researchers impact metrics data previously extracted (see parts 1-2-3) * Get the full publications history for these researchers * Use this new publications dataset to determine which are the most frequent journals the researchers hav...
github_jupyter
# CAMS functions ``` def get_ADS_API_key(): """ Get ADS API key to download CAMS datasets Returns: API_key (str): ADS API key """ keys_path = os.path.join('/', '/'.join( os.getcwd().split('/')[1:3]), 'adc-toolbox', os.path.relpath('data/ke...
github_jupyter
# SARK-110 Time Domain and Gating Example Example adapted from: https://scikit-rf.readthedocs.io/en/latest/examples/networktheory/Time%20Domain.html - Measurements with a 2.8m section of rg58 coax cable not terminated at the end This notebooks demonstrates how to use scikit-rf for time-domain analysis and gating. A...
github_jupyter
# Mouse Bone Marrow - merging annotated samples from MCA ``` import scanpy as sc import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt from matplotlib import rcParams from matplotlib import colors import seaborn as sb import glob import rpy2.rinterface_lib.callbacks import logging ...
github_jupyter
``` # importing the required libraries import os import numpy as np import cv2 import matplotlib.pyplot as plt %matplotlib inline # function for reading the image # this image is taken from a video # and the video is taken from a thermal camera # converting image from BGR to RGB def read_image(image_path): image...
github_jupyter
### Topic Modelling Demo Code #### Things I want to do - - Identify a package to build / train LDA model - Use visualization to explore Documents -> Topics Distribution -> Word distribution ``` !pip install pyLDAvis, gensim import numpy as np import pandas as pd # Visualization import matplotlib.pyplot as plt from m...
github_jupyter