code
stringlengths
2.5k
150k
kind
stringclasses
1 value
## Finding entity classes in embeddings In this notebook we're going to use embeddings to find entity classes and how they correlate with other things ``` %matplotlib inline from sklearn import svm from keras.utils import get_file import os import gensim import numpy as np import random import requests import geopan...
github_jupyter
# Denoising Autoencoder Sticking with the MNIST dataset, let's add noise to our data and see if we can define and train an autoencoder to _de_-noise the images. <img src='notebook_ims/autoencoder_denoise.png' width=70%/> Let's get started by importing our libraries and getting the dataset. ``` import torch import n...
github_jupyter
<a href="https://colab.research.google.com/github/neurologic/NeurophysiologyModules/blob/main/Crawdad_Extracell_Intracell_Simultaneous.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Arthropod skeletal muscle compared to vertebrate skeletal muscle...
github_jupyter
## Running Facebook Prophet model for forecasting Statistics Norway data via Statbank API Inspired by [`Eurostat/Prophet`](https://github.com/eurostat/prophet) and [`stats_to_pandas`](https://github.com/hmelberg/stats-to-pandas). Result of internal hackathon at SSB. --------- Facebook has open sourced [`Prophet`](ht...
github_jupyter
# Implementing a Neural Network In this exercise we will develop a neural network with fully-connected layers to perform classification, and test it out on the CIFAR-10 dataset. ``` # A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib ...
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
# MLP 104 ``` from google.colab import drive PATH='/content/drive/' drive.mount(PATH) DATAPATH=PATH+'My Drive/data/' PC_FILENAME = DATAPATH+'pcRNA.fasta' NC_FILENAME = DATAPATH+'ncRNA.fasta' import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import ShuffleSplit from skl...
github_jupyter
``` # Install TensorFlow !pip install tensorflow-gpu try: %tensorflow_version 2.x # Colab only. except Exception: pass import tensorflow as tf print(tf.__version__) print(tf.test.gpu_device_name()) print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU'))) #imports some required libr...
github_jupyter
``` print("hello world") 1 + (3 * 4) + 5 (1 + 3) * (4 + 5) 2**4 temperature = 72.5 print("temperature") print(temperature) type(temperature) day_of_week = 3 type(day_of_week) day = "tuesday" type(day) print(day) whos day_of_week + 1 print(day) print(temperature) day_of_week day_of_week + 1 day_of_week = 4 day_of_week d...
github_jupyter
# Classifying Fashion-MNIST Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9...
github_jupyter
# Week 3 of Introduction to Biological System Design ## Introduction to Modeling Biological Processes ### Ayush Pandey Pre-requisite: If you have installed numpy, scipy, matplotlib, and pandas already, then you are all set to run this notebook. This notebook introduces modeling of biological processes using different...
github_jupyter
# Cross Validation Splitting our datasetes into train/test sets allows us to test our model on unseen examples. However, it might be the case that we got a lucky (or unlucky) split that doesn't represent the model's actual performance. To solve this problem, we'll use a technique called cross-validation, where we use...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Cars-File" data-toc-modified-id="Cars-File-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Cars File</a></span><ul class="toc-item"><li><span><a href="#Data-Preparation" data-toc-modified-id="Data-Prepara...
github_jupyter
## **Analytic Antipodal Grasps** ``` import numpy as np from manipulation import running_as_notebook from pydrake.all import( Variable, sin, cos, Evaluate, Jacobian, atan, MathematicalProgram, Solve, eq ) import matplotlib.pyplot as plt, mpld3 if running_as_notebook: mpld3.enable_notebook() ``` ## Introducti...
github_jupyter
# FloPy ### A quick demo of how to control the ASCII format of numeric arrays written by FloPy load and run the Freyberg model ``` import sys import os import platform import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt # run installed version of flopy or add local path try: import flop...
github_jupyter
### Simple Residual model in Keras This notebook is simply for testing a resnet-50 inspired model built in Keras on a numerical signs dataset. ``` import keras import numpy as np import matplotlib.pyplot as plt from keras import layers from keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalizati...
github_jupyter
``` # Coder_Hussam Qassim # Import the necessary libraries import tensorflow as tf from tensorflow.contrib.layers import fully_connected import numpy as np from tensorflow.examples.tutorials.mnist import input_data # Define the RNN parameters n_steps = 28 n_inputs = 28 n_neurons = 150 n_outputs = 10 # Create the ...
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
## Brown Datathon - Predicting house buying based on Credit Info Data provided by Citizens Bank (Public use available) ### Setting Environment ``` ## Load Basic Package print('PYTHON & PACKAGE VERSION CONTROL') print('----------') import sys #access to system parameters https://docs.python.org/3/library/sys.html pr...
github_jupyter
``` import numpy as np a = np.array([4, 10, 12, 23, -2, -1, 0, 0, 0, -6, 3, -7]) ``` # 1. How many negative numbers are there? ``` neg_a = a[a < 0] #neg_a len(neg_a) ``` # 2. How many positive numbers are there? ``` def pos_a(a): return a[a > 0] #pos_a(a) len(pos_a(a)) ``` # 3. How many even positive numbers...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> _prepared by Abuzer Yakaryilmaz_ ``` # A jupyter notebook is composed by one or more cells. # This notebook is prepared for jupyter notebooks, and the menu items and command buttons may differ in jupy...
github_jupyter
# Easily export jupyter cells to python module https://github.com/fastai/course-v3/blob/master/nbs/dl2/notebook2script.py ``` ! python /tf/src/scripts/notebook2script.py visualization.ipynb %matplotlib inline ! pip install -U scikit-learn #export from exp.nb_clustering import * from exp.nb_evaluation import * import m...
github_jupyter
# UCI Metro dataset ``` import pandas as pd import os from pathlib import Path from config import data_raw_folder, data_processed_folder from timeeval import Datasets import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (20, 10) dataset_collection_name = "Metro" source_folder = Path(data...
github_jupyter
## Practice: Dealing with Word Embeddings Today we gonna play with word embeddings: train our own little embedding, load one from gensim model zoo and use it to visualize text corpora. This whole thing is gonna happen on top of embedding dataset. __Requirements:__ `pip install --upgrade nltk gensim bokeh umap-lea...
github_jupyter
``` import numpy as np import cv2 import mediapipe as mp import tensorflow as tf import time mp_drawing = mp.solutions.drawing_utils mp_drawing_styles = mp.solutions.drawing_styles mp_hands = mp.solutions.hands # load model tflite_save_path = 'model/model.tflite' interpreter = tf.lite.Interpreter(model_path=tflite_save...
github_jupyter
### Rome2Rio #### Importing packages that are neccessary ``` import pandas as pd from pymongo import MongoClient import requests as req import json from itertools import permutations import random import time import json ``` #### All the utility functions are defined below. * They can connect to any DB , given that ...
github_jupyter
# Regression Week 1: Simple Linear Regression In this notebook we will use data on house sales in King County to predict house prices using simple (one input) linear regression. You will: * Use Turi Create SArray and SFrame functions to compute important summary statistics (instead using Pandas and sklearn) * Write a ...
github_jupyter
``` #rede neural para classificação Binária #cria o data set e salva em "meu_data_set.h5" import numpy as np import matplotlib.pyplot as plt import h5py s_p=30 #quantos pontos os dados de entrada tem s_d=80 #quantos exemplos de cada tipo tem meu Dtrain s_t=10 #quantos exemplos de cada tipo para teste p_r = 0.7 #porcent...
github_jupyter
# Rule Scorer Example The Rule Scorer is used to generate scores for a set of rules based on a labelled dataset. ## Requirements To run, you'll need the following: * A rule set (specifically the binary columns of the rules as applied to a dataset). * The binary target column associated with the above dataset. ----...
github_jupyter
``` import warnings warnings.simplefilter(action='ignore') import pandas as pd import numpy as np import matplotlib import statsmodels.api as sm from matplotlib import pyplot as plt from datetime import datetime from statsmodels.tsa.seasonal import seasonal_decompose from statsmodels.tsa.stattools import adfuller, ac...
github_jupyter
``` from transformers import BertModel, BertTokenizer from utils import devdf_generator import pandas as pd import torch import vsm import os %load_ext autoreload %autoreload 2 VSM_HOME = os.path.join('data', 'vsmdata') DATA_HOME = os.path.join('data', 'wordrelatedness') def evaluate_pooled_bert(rel_df, layer, pool_...
github_jupyter
``` from FeatureGenerator import * import ngram import pickle import pandas as pd from nltk.tokenize import sent_tokenize from helpers import * import hashlib class CountFeatureGenerator(FeatureGenerator): def __init__(self, name='countFeatureGenerator'): super(CountFeatureGenerator, self).__init__(name) ...
github_jupyter
# Audiobooks business case ## Preprocessing exercise It makes sense to shuffle the indices prior to balancing the dataset. Using the code from the lesson (below), shuffle the indices and then balance the dataset. At the end of the course, you will have an exercise to create the same machine learning algorithm, wit...
github_jupyter
# Enterprise Deep Learning with TensorFlow: openSAP ## SAP Innovation Center Network ``` Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requ...
github_jupyter
**Strings** If you want to use text in Python, you have to use a **string.** A **string** is created by entering text between **two single or double quotation masks** > print("Python is fun!") > print('Always look on the bright side of life') The delimiter ("or') used for a string doesn't affect how it behaves in ...
github_jupyter
Importando as Dependências ``` import os import copy # os.chdir('corpora') from scripts.anntools import Collection from pathlib import Path import nltk nltk.download('punkt') ``` Leitura de Arquivo ``` c = Collection() for fname in Path("original/training/").rglob("*.txt"): c.load(fname) ``` Acesso a uma instâ...
github_jupyter
# SU Deep Learning with Tensorflow: Python & NumPy Tutorial Python 3 and NumPy will be used extensively throughout this course, so it's important to be familiar with them. One can also check the website's tutorial for further preparation: https://deep-learning-su.github.io/python-numpy-tutorial/ ## Python 3 If yo...
github_jupyter
<a href="https://colab.research.google.com/github/jads-nl/execute-nhs-proms/blob/master/notebooks/3.0-modeling-regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Background to osteoarthritis case study This is day 3 from the [5-day JADS N...
github_jupyter
# How do I create my own dataset? So Caffe2 uses a binary DB format to store the data that we would like to train models on. A Caffe2 DB is a glorified name of a key-value storage where the keys are usually randomized so that the batches are approximately i.i.d. The values are the real stuff here: they contain the ser...
github_jupyter
## Decision Tree ``` from sklearn.tree import DecisionTreeClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import warnings warnings.filterwarnings('ignore') # DecisionTree Classifier 생성 dt_clf = DecisionTreeClassifier(random_state=156) # 불꽃 데이터를 로딩하고, 학습과 테스트 데...
github_jupyter
# Significance Tests with PyTerrier ``` import pyterrier as pt import pandas as pd RUN_DIR='/mnt/ceph/storage/data-in-progress/data-teaching/theses/wstud-thesis-probst/retrievalExperiments/runs-ecir22/' RUN_DIR_MARCO_V2='/mnt/ceph/storage/data-in-progress/data-teaching/theses/wstud-thesis-probst/retrievalExperiments/...
github_jupyter
# End-to-End NLP: News Headline Classifier (Local Version) _**Train a Keras-based model to classify news headlines between four domains**_ This notebook works well with the `Python 3 (TensorFlow 1.15 Python 3.7 CPU Optimized)` kernel on SageMaker Studio, or `conda_tensorflow_p36` on classic SageMaker Notebook Instanc...
github_jupyter
# 5 minutes intro to IPython for ROOT users In this notebook we show how to use inside IPython __ROOT__ (C++ library, de-facto standard in High Energy Physics). This notebook is aimed to help __ROOT__ users. Working using ROOT-way loops is very slow in python and in most cases useless. You're proposed to use `root_...
github_jupyter
``` from onstove.raster import * import rasterio import geopandas as gpd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import matplotlib import numpy as np import psycopg2 from decouple import config import plotly.express as px import pandas as pd import seaborn as sns from sklearn.cluster impor...
github_jupyter
# End-to-End NLP: News Headline Classifier (Local Version) _**Train a Keras-based model to classify news headlines between four domains**_ This notebook works well with the `Python 3 (TensorFlow 1.15 Python 3.7 CPU Optimized)` kernel on SageMaker Studio, or `conda_tensorflow_p36` on classic SageMaker Notebook Instanc...
github_jupyter
# High-level Chainer Example ``` import os os.environ['CHAINER_TYPE_CHECK'] = '0' import sys import numpy as np import math import chainer import chainer.functions as F import chainer.links as L from chainer import optimizers from chainer import cuda from common.params import * from common.utils import * cuda.set_max_...
github_jupyter
# Gases: Perfect and Semiperfect Models In this Notebook we will use `PerfectIdealGas` and `SemiperfectIdealGas` classes from **pyTurb**, to access the thermodynamic properties with a Perfect Ideal Gas or a Semiperfect Ideal Gas approach. Both classes acquire the thermodynamic properties of different species from the ...
github_jupyter
## Animation options In Vizzu you can set the timing and duration of the animation. You can do this either for the whole animation, or for animation groups such as the elements moving along the x-axis or the y-axis, appearing or disappearing or when the coordinate system is changed. Let’s see first a simple example w...
github_jupyter
# General parameters ``` import files import utils import os import models import numpy as np from tqdm.autonotebook import tqdm import pandas as pd from sklearn.preprocessing import OneHotEncoder import datetime import seaborn as sns import matplotlib as mpl from matplotlib.backends.backend_pgf import FigureCanvasPgf...
github_jupyter
# Analyse de texte avec Unix ## Filtrage L’utilitaire `grep` (*file pattern searcher*) associé à l’option `-a` considère les fichiers en paramètres comme de l’ASCII. Il est utile pour rechercher un motif (*pattern*) en utilisant les expressions rationnelles. ```bash # find, in all the TXT files, the lines that conta...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import axes3d import statsmodels.api as sm import statsmodels.formula.api as smf import seaborn as sns %matplotlib inline sns.set(style="white", color_codes=True) ``` # Genotypes simulation a...
github_jupyter
<a href="https://colab.research.google.com/github/lionelsamrat10/machine-learning-a-to-z/blob/main/Deep%20Learning/Convolutional%20Neural%20Networks%20(CNN)/convolutional_neural_network_samrat_with_10_epochs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/...
github_jupyter
# RPLib Problem 0001 - Baseline Provides the baseline version to rankability problem 0001. Focuses on Massey and Colley out of the box without ties or indirect game information. ``` %load_ext autoreload %autoreload 2 %matplotlib inline import copy import os import pandas as pd import numpy as np from scipy.stats im...
github_jupyter
<div align="Right"><font size="1">https://github.com/mrola/jupyter_themes_preview<br>Ola Söderström - 2018</font></div> ----- <p align="center"><font size="6">Jupyter notebook for testing out different themes</font></p> ----- # import libs ``` %matplotlib inline import os import sys import numpy as np import panda...
github_jupyter
# Human numbers ``` from fastai2.basics import * from fastai2.text.all import * from fastai2.callback.all import * bs=64 ``` ## Data ``` path = untar_data(URLs.HUMAN_NUMBERS) path.ls() def readnums(d): return ', '.join(o.strip() for o in open(path/d).readlines()) train_txt = readnums('train.txt'); train_txt[:80] val...
github_jupyter
# Linear regression from scratch Powerful ML libraries can eliminate repetitive work, but if you rely too much on abstractions, you might never learn how neural networks really work under the hood. So for this first example, let's get our hands dirty and build everything from scratch, relying only on autograd and NDAr...
github_jupyter
# Introduction Crypocurrency is a topic that is important to discuss. With the increase in companies accepting cryptocurrency as payment, it is becoming more integral to people's lives. Due to its decentralized and anonymous nature, it eliminates the need for a governing body to dictate its value and relies purely on ...
github_jupyter
... ***CURRENTLY UNDER DEVELOPMENT*** ... ## Simulate Monthly Mean Sea Level using a multivariate-linear regression model based on the annual SST PCs inputs required: * WaterLevel historical data from a tide gauge at the study site * Historical and simulated Annual PCs (*from Notebook 01*) in this notebook: ...
github_jupyter
# Exact GP Regression with Multiple GPUs and Kernel Partitioning In this notebook, we'll demonstrate training exact GPs on large datasets using two key features from the paper https://arxiv.org/abs/1903.08114: 1. The ability to distribute the kernel matrix across multiple GPUs, for additional parallelism. 2. Partiti...
github_jupyter
``` #default_exp data.block #export from fastai2.torch_basics import * from fastai2.data.core import * from fastai2.data.load import * from fastai2.data.external import * from fastai2.data.transforms import * from nbdev.showdoc import * ``` # Data block > High level API to quickly get your data in a `DataBunch` ## T...
github_jupyter
### Import custom modules from current folder ``` import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) import nltk from text_easability_metrics import TextEasabilityMetrics, StanfordNLP from simple_text_representation.classes import T...
github_jupyter
## Purpose: Try different models-- Part5. ### Penalized_SVM. ``` # import dependencies. import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.metrics import classification_report from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.svm import S...
github_jupyter
<a href="https://colab.research.google.com/github/TobyChen320/DS-Unit-4-Sprint-3-Deep-Learning/blob/main/module2-convolutional-neural-networks/Toby's_LS_DS_432_Convolution_Neural_Networks_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <i...
github_jupyter
### 当涉及圆形子数组时,有两种情况。 1、情况1:没有交叉边界的最大子数组总和 2、情况2:具有交叉边界的最大子数组总和 写下一些小写的案例,并考虑案例2的一般模式。 记住为输入数组中的所有元素都为负数做一个角点案例句柄。 <img src='https://assets.leetcode.com/users/brianchiang_tw/image_1589539736.png'> ``` class Solution: def maxSubarraySumCircular(self, A) -> int: array_sum = 0 ...
github_jupyter
# Básico de Python Esta sección, esta pensada para ser una breve introducción al lenguaje de programación *Python* con la intención de conocer los comandos básicos para hacer uso de sus estructuras de datos y las herramientas necesarias que se utilizaran durante el curso. No concideramos que sea un curso formal de pro...
github_jupyter
``` import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import rc from IPython import display import os rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True) path = "rt-polaritydata/rt-polaritydata/" pos_path = os.path.join...
github_jupyter
``` import pandas as pd from sklearn.metrics import classification_report !ls train = pd.read_csv('../Post Processing/data/postproc_train.csv') val = pd.read_csv('../Post Processing/data/postproc_val.csv') test = pd.read_csv('../Post Processing/data/postproc_test.csv') test_gt = pd.read_csv('../../data/english_test_wit...
github_jupyter
# Visualizing CNN Layers --- In this notebook, we load a trained CNN (from a solution to FashionMNIST) and implement several feature visualization techniques to see what features this network has learned to extract. ### Load the [data](http://pytorch.org/docs/stable/torchvision/datasets.html) In this cell, we load in...
github_jupyter
# Customer Churning In this notebook I go through the process of evaluating different Classification Models. I end up using `CatBoost`, as it yielded the highest `recall` of all. ## Disclaimer This notebook doesn't include an EDA nor any other type of analysis, given that I already submitted another [notebook](https...
github_jupyter
# "Text Classification with Roberta - Does a Twitter post actually announce a diasater?" - toc:true - branch: master - badges: true - comments: true - author: Peiyi Hung - categories: [category, project] - image: "images/tweet-class.png" ``` import numpy as np import pandas as pd from fastai.text.all import * import ...
github_jupyter
## COCO dataset validation using Faster-RCNN ``` import json from pathlib import Path import numpy as np import matplotlib.pyplot as plt import cv2 as cv import torch import tqdm import torchvision.datasets as dset from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, fasterrcnn_resnet50_fpn from to...
github_jupyter
<a href="https://colab.research.google.com/github/google/jax-md/blob/main/notebooks/talk_demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title Import & Util !pip install -q git+https://www.github.com/google/jax !pip install -q git+https:...
github_jupyter
# Managing dependencies using containerization ## Topic learning objectives By the end of this topic, students should be able to: 1. Explain what containers are, and why they can be useful for reproducible data analyses 2. Discuss the advantages and limitations of containerization (e.g., Docker) in the context of re...
github_jupyter
<a href="https://colab.research.google.com/github/flower-go/DiplomaThesis/blob/master/sentiment_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Helper code ``` #clone repo !git clone https://github.com/flower-go/DiplomaThesis.git !pip ins...
github_jupyter
# IBM Cloud Pak for Data - Multi-Cloud Virtualization Hands-on Lab ## Introduction Welcome to the IBM Cloud Pak for Data Multi-Cloud Virtualization Hands on Lab. In this lab you analyze data from multiple data sources, from across multiple Clouds, without copying data into a warehouse. This hands-on lab uses live d...
github_jupyter
``` import pandas as pd d = pd.read_csv("YouTube-Spam-Collection-v1/Youtube01-Psy.csv") d.tail() len(d.query('CLASS == 1')) len(d.query('CLASS == 0')) len(d) from sklearn.feature_extraction.text import CountVectorizer vectorizer = CountVectorizer() dvec = vectorizer.fit_transform(d['CONTENT']) dvec analyze = vectorizer...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import xlrd import matplotlib.pyplot as plt import os from sklearn.utils import check_random_state # Generating artificial data. n = 50 XX = np.arange(n) rs = check_random_state(0) YY = rs.randint(-10, 10, size=(n,)) + 2.0 * XX data = np.sta...
github_jupyter
# Jupyter-Specific Functionality While GAP does provide a lot of useful functionality by itself on the command line, it is enhanced greatly by the numerous features that Jupyter notebooks have to offer. This notebook attempts to provide some insight into how Jupyter notebooks can improve the workflow of a user who is a...
github_jupyter
# Kurulum ve Gerekli Modullerin Yuklenmesi ``` from google.colab import drive drive.mount('/content/gdrive') import sys import os import pandas as pd import matplotlib.pyplot as plt import matplotlib import matplotlib.pyplot as plt import numpy as np import nltk import os from nltk import sent_tokenize, word_tokenize ...
github_jupyter
## <small> Copyright (c) 2017-21 Andrew Glassner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
github_jupyter
# PyTorch Basics ``` import torch import numpy as np torch.manual_seed(1234) ``` ## Tensors * Scalar is a single number. * Vector is an array of numbers. * Matrix is a 2-D array of numbers. * Tensors are N-D arrays of numbers. #### Creating Tensors You can create tensors by specifying the shape as arguments. Here...
github_jupyter
# Support Vector Machines Let's create the same fake income / age clustered data that we used for our K-Means clustering example: ``` import numpy as np #Create fake income/age clusters for N people in k clusters def createClusteredData(N, k): np.random.seed(1234) pointsPerCluster = float(N)/k X = [] ...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import tensorflow as tf # run on training variation of powerlaw: # path for fine tuning: !python3 "/content/drive/MyDrive/PhD work/Projects/parameter estimation/Window method Supervised autoencoder with fine tuning/script.py" # path for stage 1: !python3...
github_jupyter
``` import pandas as pd from pandasql import sqldf mysql = lambda q: sqldf(q, globals()) ``` # Group an ID by consecutive dates Calculate the number of consecutive days for a given ID. If there is a gap of days for an ID, we should capture both streaks as different rows ``` df1 = pd.DataFrame({'ID': [1, 1, 1, 1, 2, ...
github_jupyter
<a href="https://colab.research.google.com/github/MHadavand/Lessons/blob/master/ML/NearestNeighbour/Nearest_neighbor_spine.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Nearest neighbor for spine injury classification In this homework notebook ...
github_jupyter
# Getting Started In this tutorial, you will know how to - use the models in **ConvLab-2** to build a dialog agent. - build a simulator to chat with the agent and evaluate the performance. - try different module combinations. - use analysis tool to diagnose your system. Let's get started! ## Environment setup Run th...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from matplotlib import rcParams rcParams['figure.figsize'] = 11.7,8.27 # figure size in inches pd.options.mode.chained_assignment = None # default='warn' pd.set_option('display.max_colwidth', None) pd.set_option('display....
github_jupyter
# Scraping Google Maps with Python [Web scraping](https://en.wikipedia.org/wiki/Web_scraping) is the process of extracting data from web pages using software. There are many [techniques](https://en.wikipedia.org/wiki/Web_scraping#Techniques) to scrape data: computer vision, manual copy and pasting, pattern matching, e...
github_jupyter
# Processes and how to use them Processes in Nengo can be used to describe general functions or dynamical systems, including those with randomness. They can be useful if you want a `Node` output that has a state (like a dynamical system), and they're also used for things like injecting noise into Ensembles so that you...
github_jupyter
# Jetsoncar Rosey V2 Tensorflow 2.0, all in notebook, optimized with RT ``` import tensorflow as tf print(tf.__version__) tf.config.experimental.list_physical_devices('GPU') # If device does not show and using conda env with tensorflow-gpu then try restarting computer # verify the image data directory import os data_...
github_jupyter
``` from __future__ import print_function import os import time import logging import argparse from visdom import Visdom import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.utils.data import DataLoader from torc...
github_jupyter
In this lab, we will optimize the weather simulation application written in C++ (if you prefer to use Fortran, click [this link](../../Fortran/jupyter_notebook/profiling-fortran.ipynb)). Let's execute the cell below to display information about the GPUs running on the server by running the nvaccelinfo command, which ...
github_jupyter
# Transfer learning & fine-tuning **Author:** [fchollet](https://twitter.com/fchollet)<br> **Date created:** 2020/04/15<br> **Last modified:** 2020/05/12<br> **Description:** Complete guide to transfer learning & fine-tuning in Keras. ## Setup ``` import numpy as np import tensorflow as tf from tensorflow import ker...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Sandford+-2020,-Section-3:-Methods" data-toc-modified-id="Sandford+-2020,-Section-3:-Methods-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Sandford+ 2020, Section 3: Methods</a></span><ul class="toc-ite...
github_jupyter
CER024 - Create Controller certificate ====================================== This notebook creates a certificate for the Controller endpoint. It creates a controller-privatekey.pem as the private key and controller-signingrequest.csr as the signing request. The private key is a secret. The signing request (CSR) will...
github_jupyter
<img style="float: center;" src="images/CI_horizontal.png" width="600"> <center> <span style="font-size: 1.5em;"> <a href='https://www.coleridgeinitiative.org'>Website</a> </span> </center> Ghani, Rayid, Frauke Kreuter, Julia Lane, Adrianne Bradford, Alex Engler, Nicolas Guetta Jeanrenaud, Graham Henke...
github_jupyter
# Introduction to sharing interactive Jupyter notebooks ## From the workshop '[Getting Started with Reproducible and Open Research](https://escience-academy.github.io/2020-02-11-Reproducible-and-Open-Research/)' _Date: 11-12 February 2020_ _Author: Sam Nooij_ --- In this example notebook, I will: 1. Load data fro...
github_jupyter
## Part-1: Introduction ``` ## Loading the libraries import spacy # open-source NLP library in Python with several pre-trained models from spacy import displacy # spacy's built-in library to visualise the behavior of the entity recognition model interactively nlp = spacy.load("en_core_web_sm") # Engli...
github_jupyter
``` from datetime import datetime import backtrader as bt import pandas as pd import numpy as np import vectorbt as vbt df = pd.DataFrame(index=[datetime(2020, 1, i + 1) for i in range(9)]) df['open'] = [1, 1, 2, 3, 4, 5, 6, 7, 8] df['high'] = df['open'] + 0.5 df['low'] = df['open'] - 0.5 df['close'] = df['open'] data...
github_jupyter
## Plot difference between 2 30yr means of zonal mean zonal wind in : #### HadGEM3-GC31-MM for selected season (DJF) and over selected latitude range (0-90) ##### Created as part of PAMIP group during CMIP6 hackathon 2021 ##### Created by : Phoebe Hudson / Colin Manning ``` from itertools import chain from glob imp...
github_jupyter