text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## Dependencies ``` import json, warnings, shutil, glob from jigsaw_utility_scripts import * from scripts_step_lr_schedulers import * from transformers import TFXLMRobertaModel, XLMRobertaConfig from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses, layers SEED = 0 seed_ev...
github_jupyter
# CS446/546 - Class Session 19 - Correlation networks In this class session we are going to analyze gene expression data from a human bladder cancer cohort. We will load a data matrix of expression measurements of 4,473 genes in 414 different bladder cancer samples. These genes have been selected because they are diff...
github_jupyter
<h1> Time series prediction using RNNs, with TensorFlow and Cloud ML Engine </h1> This notebook illustrates: <ol> <li> Creating a Recurrent Neural Network in TensorFlow <li> Creating a Custom Estimator in tf.contrib.learn <li> Training on Cloud ML Engine </ol> <p> <h3> Simulate some time-series data </h3> Essentia...
github_jupyter
# The Monty Hall problem, with lists For inspiration, see this simulation of [the Monty Hall Problem](../more-simulation/monty_hall) using arrays. We use arrays often in data science, but sometimes, it is more efficient to use Python [lists](../data-types/lists). To follow along in this section, you will also need [...
github_jupyter
# *CoNNear*: A convolutional neural-network model of human cochlear mechanics and filter tuning for real-time applications Python notebook for reproducing the evaluation results of the proposed CoNNear model. ## Prerequisites - First, let us compile the cochlea_utils.c file that is used for solving the transmission ...
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
##### Copyright 2018 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
# Extractive QA to build structured data _This notebook is part of a tutorial series on [txtai](https://github.com/neuml/txtai), an AI-powered semantic search platform._ Traditional ETL/data parsing systems establish rules to extract information of interest. Regular expressions, string parsing and similar methods def...
github_jupyter
# cadCAD Tutorials: The Robot and the Marbles, part 2 In [Part 1](../robot-marbles-part-1/robot-marbles-part-1.ipynb) we introduced the 'language' in which a system must be described in order for it to be interpretable by cadCAD and some of the basic concepts of the library: * State Variables * Timestep * State Update ...
github_jupyter
``` #Toy example: this does not mean anything really, just write out some random returns series and find the maximum level (this was born as a unit test basically, for the logic of a private application). #requires py3.7 scipy==1.1.0 (conda) #requires pyDOE (pip) from dnlcb import DynamicNegativeLowerConfidenceBound fr...
github_jupyter
# Preprocess Docs ``` # load dependency libraries import os import re import pickle from bs4 import BeautifulSoup from bs4.element import Comment from nltk.stem import PorterStemmer from nltk.corpus import stopwords # extracting english stop words stop_words = stopwords.words('english') # Initializing Porter Stemmer ...
github_jupyter
``` import CNN2Head_input import os import tensorflow as tf import numpy as np import BKNetStyle from const import * ''' PREPARE DATA ''' ''' PREPARE DATA ''' smile_train, smile_test = CNN2Head_input.getSmileImage() gender_train, gender_test = CNN2Head_input.getGenderImage() age_train, age_test = CNN2Head_input.getAgeI...
github_jupyter
# High-level RNN MXNet Example ``` import os import sys import numpy as np import mxnet as mx from mxnet.io import DataDesc from common.params_lstm import * from common.utils import * # Force one-gpu os.environ["CUDA_VISIBLE_DEVICES"] = "0" print("OS: ", sys.platform) print("Python: ", sys.version) print("Numpy: ", np...
github_jupyter
# k-Nearest Neighbor (kNN) exercise *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.* ...
github_jupyter
# Intro SQL is the programming language used with databases, and it is an important skill for any data scientist. You'll build your SQL skills in this course apply those skills using BigQuery, a database system that lets you apply SQL to huge datasets. This lesson describes basics about connecting to the database and...
github_jupyter
``` %load_ext memory_profiler ``` # Iterators, generators and itertools ``` for i in range(5): print(i, end=" ") print() for i in (0, 1, 2, 3, 4): print(i, end=" ") print() for i in {0, 1, 2, 3, 4}: print(i, end=" ") list(map(type, (range(5), (0, 1, 2, 3, 4), {0, 1, 2, 3, 4}))) range(5).__sizeof__(), (0, 1, 2, 3, 4)....
github_jupyter
## Notebook 0 - Labeling Languages of Texts For our project, we will be using the Dota dataset: https://www.kaggle.com/romovpa/gosuai-dota-2-game-chats This dataset contains multiple languages that our group cannot interpret. For this case, we will be using the English portion of the dataset. If we have more time by th...
github_jupyter
``` import tensorflow as tf gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.45) tf.enable_eager_execution(config=tf.ConfigProto(gpu_options=gpu_options)) import time from pathlib import Path import matplotlib.pyplot as plt from IPython.display import clear_output from shared import make_dataset, random_ji...
github_jupyter
- title: Cox's Theorem: Establishing Probability Theory - summary: Cox's theorem is the strongest argument for the use of standard probability theory. Here we examine the axioms to establish a firm foundation for the interpretation of probability theory as the unique extension of true-false logic to degrees of belief. ...
github_jupyter
# Example Gawain notebook In this notebook I show how to set up, run, and plot a simple simulation using the gawain plasma physics module. ``` import numpy as np from gawain.main import run_gawain from gawain.io import Reader %matplotlib inline import numpy as np import matplotlib.pyplot as plt from matplotlib impor...
github_jupyter
# Verifying that the matrix DWPC method generates results similar to the Neo4j method The matrix-based DWPC calculation method does not provide results exactly equal to the Neo4j-based method for all metapaths. We would like to verify that these differences in DWPC calculation do not result in significant differences ...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D3_ModelFitting/W1D3_Tutorial3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 3, Tutorial 3 # Model Fittin...
github_jupyter
# Lab Three - Clustering Team Members * Chance Robinson * Dan Crouthamel * Shane Weinstock # Business Understanding 1 _Describe the purpose of the data set you selected (i.e., why was this data collected in the first place?). How will you measure the effectiveness of a good algorithm? Why does your chosen validati...
github_jupyter
## Importing and prepping data ``` import pandas as pd import numpy as np import diff_classifier.aws as aws import diff_classifier.pca as pca import os features = [] remote_folder = 'Gel_studies' #Folder in AWS S3 containing files to be analyzed bucket = 'dtoghani.data' vids = 10 mws = ['5k_PEG', 'PS_COOH', '5k_PEG_NH...
github_jupyter
``` #this allows plots to be displayed inline with the notebook %matplotlib inline ``` Generally, you want to put your import statements at the top of the code, whether in notebooks or code files. These first two import statements bring in the matplotlib plotting library and the numpy library, two core components of ...
github_jupyter
##### Copyright 2019 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
Exercise 2 - Simple Linear Regression === In Exercise 1, we used R within Jupyter Notebooks to load information about chocolate bars, and stored it in a variable named `choc_data`. We checked the structure of `choc_data`, and explored some of the variables we have about chocolate bars using graphs. In this exercise, ...
github_jupyter
##### Copyright 2019 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https:/...
github_jupyter
# Accelerate pretraining of BERT model using ONNX Runtime This notebook contains a walkthrough of using ONNX Runtime in Azure Machine Learning service to pretrain [BERT: Bidirectional Encoder Representations from Transformers](https://arxiv.org/abs/1810.04805) models. This example shows how ONNX Runtime training can ac...
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> # Start-to-Finish Example: $\text{GiRaFFE_HO}$ 1D tests ##...
github_jupyter
# **Multiple Sequence Alignment Workflow** In this notebook the actual multiple sequence alignment (MSA) analysis work flow is explained. ## **Goals** 1. To conduct a MSA on the combined African Insecta data sets listed below >1. **enafroCOI_Under500_data.fasta: 6,715 sequences** >2. **enafroCOI_Over700_data.fasta: 1...
github_jupyter
#### Copyright 2017 Google LLC. 本课程原版地址:https://colab.research.google.com/notebooks/mlcc/multi-class_classification_of_handwritten_digits.ipynb?utm_source=mlcc&utm_campaign=colab-external&utm_medium=referral&utm_content=multiclass-colab&hl=en 采用Apache 2.0协议 # Classifying Handwritten Digits with Neural Networks ![im...
github_jupyter
``` from keras.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape from keras.layers.convolutional import Convolution1D, Convolution2D, MaxPooling2D from keras.utils import np_utils from keras import callbacks import time import logging ...
github_jupyter
``` test_index = 0 ``` #### testing ``` from load_data import * # load_data() ``` ## Loading the data ``` from load_data import * X_train,X_test,y_train,y_test = load_data() len(X_train),len(y_train) len(X_test),len(y_test) ``` ## Test Modelling ``` import torch import torch.nn as nn import torch.optim as optim i...
github_jupyter
# Quantum Machine Learning with Amazon Braket: Binary Classifiers This post details an approach taken by Aioi to build an exploratory quantum machine learning application using Amazon Braket. Quantum machine learning has been defined as "a research area that explores the interplay of ideas from quantum computing and m...
github_jupyter
``` from quchem.Hamiltonian_Generator_Functions import * from quchem.Graph import * ### HAMILTONIAN start Molecule = 'LiH' geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.45))] basis = 'sto-3g' ### Get Hamiltonian Hamilt = Hamiltonian(Molecule, run_scf=1, run_mp2=1, run_cisd=1, run_ccsd=1, run...
github_jupyter
# M² Experimental Design **Scott Prahl** **Mar 2021** The basic idea for measuring M² is simple. Use a CCD imager to capture changing beam profile at different points along the direction of propagation. Doing this accurately is a challenge because the beam must always fit within camera sensor and the measurement l...
github_jupyter
<a href="https://colab.research.google.com/github/darshvaghasia12/Awesome-Web-Art/blob/master/Music_Genre_Classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` pip install python_speech_features from python_speech_features import mfcc ...
github_jupyter
# Convolutional Layer In this notebook, we visualize four filtered outputs (a.k.a. activation maps) of a convolutional layer. In this example, *we* are defining four filters that are applied to an input image by initializing the **weights** of a convolutional layer, but a trained CNN will learn the values of these w...
github_jupyter
##### Copyright 2018 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
## Set Root Directory and Out Directory ``` import os import time ROOT_DIR = os.path.abspath('') OUT_DIR = os.path.join(ROOT_DIR, 'out') if not os.path.exists(OUT_DIR): os.makedirs(OUT_DIR) ``` ## Load WebDriver for Chrome https://sites.google.com/a/chromium.org/chromedriver/downloads ``` DRIVER = os.path.join...
github_jupyter
# Scene Classification ## 3. Build Model-InceptionV3 BatchTrain Top2Layer - Import pkg - Load sample data, only first 1000 objects - Reference: - https://challenger.ai/competitions - https://github.com/jupyter/notebook/issues/2287 **Tensorboard** 1. Input at command: **tensorboard --logdir=./log** 2. Input at brows...
github_jupyter
# Deep Learning & Art: Neural Style Transfer Welcome to the second assignment of this week. In this assignment, you will learn about Neural Style Transfer. This algorithm was created by Gatys et al. (2015) (https://arxiv.org/abs/1508.06576). **In this assignment, you will:** - Implement the neural style transfer alg...
github_jupyter
# Recap We started by learning about permutation importance and partial dependence plots for an overview of what the model has learned. We then learned about SHAP values to break down the components of individual predictions. Now we'll expand on SHAP values, seeing how aggregating many SHAP values can give more deta...
github_jupyter
# NESTS algorithm **Kopuru Vespa Velutina Competition** Purpose: Bring together weather data, geographic data, food availability data, and identified nests in each municipality of Biscay in order to have a dataset suitable for analysis and potential predictions in a Machine Learning model. Outputs: QUEENtrain and QUE...
github_jupyter
# Training Models We will practice training machine learning models for both regression and for classification problems. # 1) Regression Models We will start by fitting regression models. We will download the time series of the GPS station deployed on Montague Island. <img src="AC29_map.png" alt="AC29 GPS stations ...
github_jupyter
# Autoregressive models using a feedforward neural network ## PART 2: Applying the methods to health care time series In this notebook we will use a feedforward neural network to fit a single and ensemble linear and non-linear models to real time series data. <div class="alert alert-info"> 1. Most of the work ...
github_jupyter
<a href="https://colab.research.google.com/github/Dmitri9149/Transformer_From_Scratch/blob/main/Final_Working_Transformer_MXNet_76800_128_22_10_20.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install -U mxnet-cu101==1.7.0 !pip install d2...
github_jupyter
# Support Vector Machine ``` !pip install six !pip install pandas !pip install numpy !pip install sklearn !pip install matplotlib !pip install imbalanced-learn import pandas as pd import numpy as np import sklearn from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix from sklearn.metr...
github_jupyter
# Problem Statement: Given profiles representing fictional customers from an e-commerce company. The profiles contain information about the customer, their orders, their transactions ,what payment methods they used and whether the customer is fraudulent or not. We need to predict the given customer is fraudulent or ...
github_jupyter
``` !rm -Rf HMP_Dataset !git clone https://github.com/wchill/HMP_Dataset #!ls HMP_Dataset/Brush_teeth import os #get list of folders/files in folder HMP_Dataset file_list = os.listdir('HMP_Dataset') #filter list for folders containing data file_list_filtered = [s for s in file_list if '_' in s] import pandas as pd ...
github_jupyter
## Divide y vencerás Este es un método de diseño de algoritmos que se basa en *subdividir* el problema en sub-problemas, resolverlos *recursivamente*, y luego *combinar* las soluciones de los sub-problemas para construir la solución del problema original. Es necesario que los subproblemas tengan la misma estructura qu...
github_jupyter
# Sequence classification model for IMDB Sentiment Analysis (c) Deniz Yuret, 2019 * Objectives: Learn the structure of the IMDB dataset and train a simple RNN model. * Prerequisites: [RNN models](60.rnn.ipynb) ``` # Set display width, load packages, import symbols ENV["COLUMNS"] = 72 using Statistics: mean using IterT...
github_jupyter
$\newcommand{\mb}[1]{\mathbf{ #1 }}$ $\newcommand{\bb}[1]{\mathbb{ #1 }}$ $\newcommand{\bs}[1]{\boldsymbol{ #1 }}$ $\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}$ $\newcommand{\der}[2]{\frac{ \mathrm{d} #1 }{ \mathrm{d} #2 }}$ $\newcommand{\derp}[2]{\frac{ \partial #1 }{ \partial #2 }}$ $\newcommand{\R}{\bb{R}}$ ...
github_jupyter
# Introduction to MLOps ## Environment setup ``` import platform print(f"Python version: {platform.python_version()}") assert platform.python_version_tuple() >= ("3", "6") from IPython.display import YouTubeVideo ``` ## The Machine Learning workflow [![ML workflow by RedHat](images/wiidii_ml_workflow.png)](https:...
github_jupyter
# Gaussian 中的 PUHF/PMP2 结果的重新实现 > 创建时间:2019-08-31,最后修改:2019-09-01 在这一份笔记中,我们将使用 PySCF 的功能与 NumPy 重复 Gaussian 中计算的 PUHF 与 PMP2 能量结果;并对 PUHF 与 PMP2 的推导作简单的说明。 ``` from pyscf import gto, scf, mp ``` ## 参考结果与体系定义 ### Gaussian 结果 在 Gaussian 中,我们使用以下输入卡可以得到 PUHF/PMP2 能量: ``` #p UMP2(Full)/6-31G nosymm H2O 3 4 O 0. ...
github_jupyter
In all our analyses, we used estimations for either simple or logarithmic rates of return. <br/> The formula for simple returns is $$ \frac{P_t - P_{t-1}}{P_{t-1}} ,$$ while the formula for log returns is $$ ln( \frac{P_t}{P_{t-1}} ) .$$ <br/> If our dataset is simply called "data", in Python, we could write the fi...
github_jupyter
## Linear Regression using pytorch Linear regression is one of the must have tools in any data scientists toolkit. It attempts to fit the input data using a solution like: * y is our measured output * X is our input data, there are m measurements each of n values Using linear regression we find coefficients &theta;<...
github_jupyter
# 量子神经网络在自然语言处理中的应用 [![](https://gitee.com/mindspore/mindquantum/raw/master/tutorials/images/view_mindquantum_api.png)](https://mindspore.cn/mindquantum/api/zh-CN/master/index.html)&emsp;[![](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_notebook.png)](https://mindspore-website.obs.cn-north-4.myhua...
github_jupyter
``` import numpy as np import pandas as pd # Code to read csv file into colaboratory: !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials auth.authenticate_user() gauth = GoogleAuth() gauth...
github_jupyter
# T1574.008 - Path Interception by Search Order Hijacking Adversaries may execute their own malicious payloads by hijacking the search order used to load other programs. Because some programs do not call other programs using the full path, adversaries may place their own file in the directory where the calling program ...
github_jupyter
``` import numpy as np import pandas as pd data = pd.read_csv('5_a.csv') data list(data.iloc[:,1]) y_predicted = [0 if i<0.5 else 1 for i in list(data['proba']) ] 0 in y_predicted # confusion matrix import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline def custom_metrics(data): ...
github_jupyter
# Scraping Reddit Data ![](https://www.redditstatic.com/new-icon.png) Using the PRAW library, a wrapper for the Reddit API, everyone can easily scrape data from Reddit or even create a Reddit bot. ``` import praw ``` Before it can be used to scrape data we need to authenticate ourselves. For this we need to creat...
github_jupyter
<a href="https://colab.research.google.com/github/Nutritiousfacts/DS-Unit-2-Regression-Classification/blob/master/module3/Gabe_flomo_assignment_regression_classification_3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science, U...
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
``` %matplotlib inline ``` 배포를 위한 비전 트랜스포머(Vision Transformer) 모델 최적화하기 ================================================================= Authors : `Jeff Tang <https://github.com/jeffxtang>`_, `Geeta Chauhan <https://github.com/gchauhan/>`_ 번역 : `김태영 <https://github.com/Taeyoung96/>`_ 비전 트랜스포머(Vision Transformer)는 자...
github_jupyter
``` !cp drive/My\ Drive/time-series-analysis/london_bike_sharing_dataset.csv . ``` ### Importing libraries ``` import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') import pandas as pd import tensorflow as tf from tensorflow import keras import seaborn as sns from matplotlib import rc from pylab...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D3_ModelFitting/W1D3_Tutorial4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> &nbsp; <a href="https://kaggle.com/kernels/welcome?src=https://r...
github_jupyter
# Intro to Hidden Markov Models (optional) --- ### Introduction In this notebook, you'll use the [Pomegranate](http://pomegranate.readthedocs.io/en/latest/index.html) library to build a simple Hidden Markov Model and explore the Pomegranate API. <div class="alert alert-block alert-info"> **Note:** You are not require...
github_jupyter
.. meta:: :description: A guide which introduces the most important steps to get started with pymoo, an open-source multi-objective optimization framework in Python. .. meta:: :keywords: Multi-objective Optimization, Python, Evolutionary Computation, Optimization Test Problem, Hypervolume # Getting Started In ...
github_jupyter
This notebook creates a VM in the user's project with the airflow scheduler and webserver. A default GCP zone for the VM has been chosen (below). Feel free to change this as desired. ## Airflow Dashboard After successful setup of the Airflow VM, you will be able to view the Airflow Dashboard by creating an ssh tunnel ...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np import glob import os from datetime import datetime import io import csv import shutil import matplotlib.pyplot as plt year = 2017 YEAR_FLAG = 'train' img_folder = '/datadrive/timelapse_images_fast' timeseries_folder = '/datadrive/timeseries_de...
github_jupyter
# Running an example simulation It's all very simple, mostly because this is a simple simulation. First, let's import stuff we'll need later on: ``` import numpy as np from pandemic_sim.simulation import Person, Simulation from pandemic_sim.geometries import RectangleGeometry from pandemic_sim.health_systems import ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from prml.utils.datasets import load_mnist,load_iris from prml.kernel_method import BaseKernelMachine ``` # PCA ``` class PCA(): """PCA Attributes: X_mean (1-D array): mean of data weight (2-D array): proj matrix importance (1...
github_jupyter
when computing the rankings group all cases in same ing snapshot year and call get_edge_data once for each group. Ends up not making it faster... ``` top_directory = '/Users/iaincarmichael/Dropbox/Research/law/law-net/' from __future__ import division import os import sys import time from math import * import copy i...
github_jupyter
<a href="https://colab.research.google.com/github/PacktPublishing/Hands-On-Computer-Vision-with-PyTorch/blob/master/Chapter11/Generating_deep_fakes.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import os if not os.path.exists('Faceswap-Deepfak...
github_jupyter
# Introduction ..... Check to see if jupyter lab uses the correct python interpreter with '!which python'. It should be something like '/opt/anaconda3/envs/[environment name]/bin/python' (on Mac). If not, try this: https://github.com/jupyter/notebook/issues/3146#issuecomment-352718675 ``` !which python ``` # Instal...
github_jupyter
## Using RNNs to add two binary strings ## if two input binary strings say 010 and 011 are given your network should output the sum = 101 - How do you represent the data - Defining a simple recurrent network to model the problem in a seq2seq fashion - Train it on binary strings of a fixed length - Test the network...
github_jupyter
<a href="https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/14_legends.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a> Uncomment the following line to install [geemap](https://geemap.org) if needed. ``` # !pip install geemap imp...
github_jupyter
# Overfitting Figure Generation We're going to generate `n_points` points distributed along a line, remembering that the formula for a line is $y = mx+b$. Modified (slightly) from [here](https://stackoverflow.com/a/35730618/8068638). ``` import numpy as np %matplotlib inline import matplotlib.pyplot as plt n_points = ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#EDA-and-pre-processing" data-toc-modified-id="EDA-and-pre-processing-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>EDA and pre-processing</a></span><ul class="toc-item"><li><span><a href="#Descriptive-s...
github_jupyter
``` import sys sys.path.append('../scripts/') from puddle_world import * import itertools import collections class PolicyEvaluator: def __init__(self, widths, goal, puddles, time_interval, sampling_num, \ puddle_coef=100.0, lowerleft=np.array([-4, -4]).T, upperright=np.array([4, 4]).T): #puddle_c...
github_jupyter
# CORIOLIX REST API Documentation ## EXAMPLE 1: Query the CORIOLIX REST API - Get a list of all REST endpoints ``` """Example script to query the CORIOLIX REST API.""" # Key concepts: # Use the python requests module to query the REST API # Use the python json module to parse and dump the json response # Returns: #...
github_jupyter
# Read Cloud Optimized Geotiffs The following materials are based on [this tutorial](https://geohackweek.github.io/raster/04-workingwithrasters/). Read more from that tutorial until this one get's better updated. - Let's read a Landsat TIF profile from AWS cloud storage: ``` import rasterio import matplotlib.pyplot ...
github_jupyter
# Economics 101B Spring 2018 Pre-Semester Exercises ### Professor DeLong ## Our Computing Environment, Jupyter notebooks This webpage is called a Jupyter notebook. A notebook is a place to write programs and view their results. ### Text cells In a notebook, each rectangle containing text or code is called a *cell*....
github_jupyter
# Dataframe modification ``` import os import pandas as pd import numpy as np filename = '..\Data\dataset_clean.csv' df = pd.read_csv(filename) df_2=df[['Q1','Q4','Q5','Q10','Q16_Part_1','Q16_Part_2','Q16_Part_3','Q16_Part_4','Q16_Part_5','Q16_Part_6','Q16_Part_7','Q16_Part_8','Q16_Part_9','Q16_Part_10','Q18_Part_1',...
github_jupyter
# MLP on Simulated ORFs Start with ORF_MLP_118 which had the simulator bug fix. Evaluate MLP with wide,deep network. Train on copious simulated data. Use uniform but longer RNA lengths: 1500 Run on Alien. 79% accuracy. ``` import time def show_time(): t = time.time() print(time.strftime('%Y-%m-%d %H...
github_jupyter
# Data Upload Tutorial * This notebook is a tutorial on how to upload data using Graphistry's REST API. - Our REST API is designed to be language agnostic. For our Python specific API, please review the other notebooks in <https://github.com/graphistry/pygraphistry> * For permission to upload to our public service...
github_jupyter
## __PPSO__ (Parallel Particle Swarm Optimisation) Now we are going to implement a faster, parallel version of PSO, i.e PPSO Let us first use the code from the [previous notebook](/notebooks/Basic%20PSO.ipynb) ``` %%file particle.py #dependencies import random import math import copy # for array copying import sys ...
github_jupyter
<a href="https://colab.research.google.com/github/google/applied-machine-learning-intensive/blob/master/content/06_other_models/00_decision_trees_and_random_forests/colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### Copyright 2020 Google LLC...
github_jupyter
<a href="https://colab.research.google.com/github/pabair/rl-course-ss21/blob/main/solutions/S6_LunarLander_PolicyBased.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Install Dependencies ``` # source: https://medium.com/coinmonks/landing-a-rocke...
github_jupyter
# Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural network that performs sentiment analysis. >Using an RNN rather than a strictly feedforward network is more accurate since we can include information about the *sequence* of words. Here we'll use a dataset of movie reviews, accomp...
github_jupyter
``` # Building the CNN from keras.models import Sequential from keras.layers import Convolution2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense from keras.models import load_model from keras.callbacks import EarlyStopping # Initializing the CNN classifier = Seque...
github_jupyter
<a href="https://colab.research.google.com/github/graviraja/100-Days-of-NLP/blob/applications%2Fclassification/applications/classification/grammatically_correct_sentence/CoLA%20with%20DistilBERT.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### In...
github_jupyter
# Lecture 2.0.1: Numpy Random and Random Graphs ![IMDB](l2_hangover.jpg) Numpy is not only cool because it permits to handle array quite fast (btw, there is C under the hood), but it also have some submodules able to handle a variety of different math things. We are going to learn about random that may be of use for o...
github_jupyter
# Calculations with PmagPy This notebook demonstrates many of the PmagPy calculation functions such as those that rotate directions, return statistical parameters, and simulate data from specified distributions. ## Guide to PmagPy The notebook is one of a series of notebooks that demonstrate the functionality of Pma...
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 class MosaicDa...
github_jupyter
Classical probability distributions can be written as a stochastic vector, which can be transformed to another stochastic vector by applying a stochastic matrix. In other words, the evolution of stochastic vectors can be described by a stochastic matrix. Quantum states also evolve and their evolution is described by u...
github_jupyter
<h1>IndabaX Tanzania Mobile Banking Prediction Challenge by Tanzania IndabaX 2021 <h1><h2>by XVIII_6@zindi<h2> <h2>OBJECTIVE OF THE CHALLENGE <h2> <h4>The objective of this challenge is to build a machine learning model to predict which individuals across Africa and around the world use mobile or internet banking<h4> ...
github_jupyter
## Learning Objectives - How we can exctract keywords from corpus (collections of texts) using TF-IDF - Explain what is TF-IDF - Applications of keywords exctraction algorithm and Word2Vec ## Review: What are the pre-processings to apply a machine learning algorithm on text data? 1. The text must be parsed to word...
github_jupyter