text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Travelling Salesman Problem (TSP) If we have a list of city and distance between cities, travelling salesman problem is to find out the least sum of the distance visiting all the cities only once. <img src="https://user-images.githubusercontent.com/5043340/45661145-2f8a7a80-bb37-11e8-99d1-42368906cfff.png" width="4...
github_jupyter
# Spark on Tour ## Ejemplo de procesamiento de datos en streaming para generar un dashboard en NRT En este notebook vamos a ver un ejemplo completo de como se podría utilizar la API de streaming estructurado de Spark para procesar un stream de eventos de puntuación en vivo, en el tiempo real, y generar como salida un ...
github_jupyter
# Federated Tensorflow Mnist Tutorial # Long-Living entities update * We now may have director running on another machine. * We use Federation API to communicate with Director. * Federation object should hold a Director's client (for user service) * Keeping in mind that several API instances may be connacted to one D...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import os print(os.getcwd()) os.chdir('/content/drive/My Drive/Colab Notebooks/summarization') print(os.listdir()) import os import numpy as np import pandas as pd import sys import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf from...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/6_freeze_base_network/1.1)%20Understand%20the%20effect%20of%20freezing%20base%20model%20in%20transfer%20learning%20-%201%20-%20mxnet.ipynb" target="_parent"><img src="https://colab.researc...
github_jupyter
``` from nornir import InitNornir nr = InitNornir(config_file="config.yaml") ``` # Executing tasks Now that you know how to initialize nornir and work with the inventory let's see how we can leverage it to run tasks on groups of hosts. Nornir ships a bunch of tasks you can use directly without having to code them yo...
github_jupyter
# 2040 le cap des 100% de voitures électriques *Etude data - Projet 8 - @Nalron (août 2020)*\ *Traitement des données sur Jupyter Notebook (Distribution Anaconda)*\ *Etude réalisée en langage Python* Visualisation des Tableaux de bord: [Tableau Public](https://public.tableau.com/profile/nalron#!/vizhome/ElectricCarsF...
github_jupyter
# Linear Regression ## Setup First, let's set up some environmental dependencies. These just make the numerics easier and adjust some of the plotting defaults to make things more legible. ``` # Python 3 compatability from __future__ import division, print_function from six.moves import range # system functions that...
github_jupyter
# LASSO and Ridge Regression This function shows how to use TensorFlow to solve lasso or ridge regression for $\boldsymbol{y} = \boldsymbol{Ax} + \boldsymbol{b}$ We will use the iris data, specifically: $\boldsymbol{y}$ = Sepal Length, $\boldsymbol{x}$ = Petal Width ``` # import required libraries import matplotlib....
github_jupyter
## Use a Decision Optimization model deployed in Watson Machine Learning This notebook shows you how to create and monitor jobs, and get solutions using the Watson Machine Learning Python Client. This example only applies to Decision Optimization in Watson Machine Learning Local and Cloud Pak for Data/Watson Studio L...
github_jupyter
## Preparation Welcome to the Vectice tutorial notebook! Through this notebook, we will be illustrating how to log the following information into Vectice using the Vectice Python library: - Dataset versions - Model versions - Runs and lineage For more information on the tutorial, please refer to the "Vectice Tutori...
github_jupyter
# Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is based off of Andrej Karpathy's [post on RNNs](http://karpathy.github.io/2015/05/21/rnn-effectiveness/) and [i...
github_jupyter
``` %load_ext autoreload %autoreload 2 """Reloads all functions automatically""" %matplotlib notebook from irreversible_stressstrain import StressStrain as strainmodel import test_suite as suite import graph_suite as plot import numpy as np model = strainmodel('ref/HSRS/22').get_experimental_data() slopes = suite.g...
github_jupyter
# `scinum` example ``` from scinum import Number, Correlation, NOMINAL, UP, DOWN, ABS, REL ``` The examples below demonstrate - [Numbers and formatting](#Numbers-and-formatting) - [Defining uncertainties](#Defining-uncertainties) - [Multiple uncertainties](#Multiple-uncertainties) - [Configuration of correlations](#...
github_jupyter
``` # !wget http://qim.fs.quoracdn.net/quora_duplicate_questions.tsv import tensorflow as tf import re import numpy as np import pandas as pd from tqdm import tqdm import collections from unidecode import unidecode from sklearn.cross_validation import train_test_split def build_dataset(words, n_words): count = [['P...
github_jupyter
# VAE outlier detection on CIFAR10 ## Method The Variational Auto-Encoder ([VAE](https://arxiv.org/abs/1312.6114)) outlier detector is first trained on a batch of unlabeled, but normal (*inlier*) data. Unsupervised training is desireable since labeled data is often scarce. The VAE detector tries to reconstruct the in...
github_jupyter
# Notes: This notebook is used to predict demand of Victoria state (without using any future dataset) ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from tsa_utils import * from statsmodels.tsa.stattools import pacf from sklearn.ensemble import RandomForestRegressor ...
github_jupyter
# Converters for Quadratic Programs Optimization problems in Qiskit's optimization module are represented with the `QuadraticProgram` class, which is generic and powerful representation for optimization problems. In general, optimization algorithms are defined for a certain formulation of a quadratic program and we ne...
github_jupyter
# Object Detection *Object detection* is a form of computer vision in which a machine learning model is trained to classify individual instances of objects in an image, and indicate a *bounding box* that marks its location. Youi can think of this as a progression from *image classification* (in which the model answers...
github_jupyter
# Essential: Static file management with SourceLoader Data pipelines usually interact with external systems such as SQL databases. Using relative paths to find such files is error-prone as the path to the file depends on the file loading it, on the other hand, absolute paths are to restrictive, the path will only work...
github_jupyter
## Simulation Procedures ## The progress of simulation We simulate paired scDNA and RNA data following the procedure as illustrated in supplement (Figure S1). The simulation principle is to coherently generate scRNA and scDNA data from the same ground truth genetic copy number and clonality while also allowing adding...
github_jupyter
## Compile a training set using ASPCAP normalization ``` from utils_h5 import H5Compiler from astropy.io import fits import numpy as np # To create a astroNN compiler instance compiler_aspcap_train = H5Compiler() compiler_aspcap_train.teff_low = 4000 # Effective Temperature Upper compiler_aspcap_train.teff_high = 55...
github_jupyter
``` import os; os.chdir('../') from tqdm import tqdm import pandas as pd import numpy as np from sklearn.neighbors import BallTree %matplotlib inline from urbansim_templates import modelmanager as mm from urbansim_templates.models import MNLDiscreteChoiceStep from urbansim.utils import misc from scripts import datasour...
github_jupyter
# Semantic Text Summarization Here we are using the semantic method to understand the text and also keep up the standards of the extractive summarization. The task is implemnted using the various pre-defined models such **BERT, BART, T5, XLNet and GPT2** for summarizing the articles. It is also comapared with a classic...
github_jupyter
# Importing the libraries ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns ``` # Importing the datasets ``` dataset = pd.read_csv("train_ctrUa4K.csv") dataset2 = pd.read_csv("test_lAUu6dG.csv") dataset = dataset.drop(['Loan_ID'], axis = 1) dataset2 = dataset2.drop(['Lo...
github_jupyter
``` %matplotlib inline ``` Failed Model Fits ================= Example of model fit failures and how to debug them. ``` # Import the FOOOFGroup object from fooof import FOOOFGroup # Import simulation code to create test power spectra from fooof.sim.gen import gen_group_power_spectra # Import FitError, which we wi...
github_jupyter
# Transfer Learning In this notebook, you'll learn how to use pre-trained networks to solved challenging problems in computer vision. Specifically, you'll use networks trained on [ImageNet](http://www.image-net.org/) [available from torchvision](http://pytorch.org/docs/0.3.0/torchvision/models.html). ImageNet is a m...
github_jupyter
``` #cell-width control from IPython.core.display import display, HTML display(HTML("<style>.container { width:80% !important; }</style>")) ``` # Imports ``` #packages import numpy import tensorflow as tf from tensorflow.core.example import example_pb2 #utils import os import random import pickle import struct impor...
github_jupyter
## Dependencies ``` !pip install --quiet /kaggle/input/kerasapplications !pip install --quiet /kaggle/input/efficientnet-git import warnings, glob from tensorflow.keras import Sequential, Model import efficientnet.tfkeras as efn from cassava_scripts import * seed = 0 seed_everything(seed) warnings.filterwarnings('ig...
github_jupyter
# Quantum Machine Learning and TTN Let's look at the Tree Tensor Network as a model for quantum machine learning. ## What you will learn 1. TTN model 2. Optimization ## Install Blueqat ``` !pip install blueqat ``` The model we are going to build is called TTN. The quantum circuit is as follows. <img src="../tutori...
github_jupyter
``` # Importing needed libraries import datetime import pandas as pd # Fetching the data from official site of Ministry of Health and Family Welfare | Government of India try: url = "https://www.mohfw.gov.in/" dfs = pd.read_html(url) for i in range(len(dfs)): df = dfs[i] if (len(df.columns...
github_jupyter
# Artificial Intelligence Nanodegree ## Machine Translation Project In this notebook, sections that end with **'(IMPLEMENTATION)'** in the header indicate that the following blocks of code will require additional functionality which you must provide. Please be sure to read the instructions carefully! ## Introduction I...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import math from scipy import stats import pickle from causality.analysis.dataframe import CausalDataFrame from sklearn.linear_model import LinearRegression import datetime import matplotlib import matplotlib.pyplot as plt matplotlib.rcParams['font.sans-seri...
github_jupyter
``` import git_access,api_access,git2repo import json from __future__ import division import pandas as pd import numpy as np import matplotlib.pyplot as plt import math import networkx as nx import re import git2data import social_interaction access_token = '--' repo_owner = 'jankotek' source_type = 'github_repo' git_u...
github_jupyter
# 数据抓取: > # Beautifulsoup简介 *** 王成军 wangchengjun@nju.edu.cn 计算传播网 http://computational-communication.com # 需要解决的问题 - 页面解析 - 获取Javascript隐藏源数据 - 自动翻页 - 自动登录 - 连接API接口 ``` import urllib2 from bs4 import BeautifulSoup ``` - 一般的数据抓取,使用urllib2和beautifulsoup配合就可以了。 - 尤其是对于翻页时url出现规则变化的网页,只需要处理规则化的url就可以了。 - 以简单的例子是...
github_jupyter
# Library ``` import numpy as np import torch import torch.nn as nn from utils import * from dataset import TossingDataset from torch.utils.data import DataLoader ``` # Model ``` class NaiveMLP(nn.Module): def __init__(self, in_traj_num, pre_traj_num): super(NaiveMLP, self).__init__() self.hidd...
github_jupyter
## Appendix 1: Optional Refresher on the Unix Environment ### A1.1) A Quick Unix Overview In Jupyter, many of the same Unix commands we use to navigate in the regular terminal can be used. (However, this is not true when we write standalone code outside Jupyter.) As a quick refresher, try each of the following: ``` l...
github_jupyter
<h1> Logistic Regression using Spark ML </h1> Set up bucket ``` BUCKET='cloud-training-demos-ml' # CHANGE ME os.environ['BUCKET'] = BUCKET # Create spark session from pyspark.sql import SparkSession from pyspark import SparkContext sc = SparkContext('local', 'logistic') spark = SparkSession \ .builder \ ....
github_jupyter
``` import pandas as pd import warnings import altair as alt from urllib import request import json # fetch & enable a Spanish timeFormat locale. with request.urlopen('https://raw.githubusercontent.com/d3/d3-time-format/master/locale/es-ES.json') as f: es_time_format = json.load(f) alt.renderers.set_embed_options(tim...
github_jupyter
``` %cd ~/NetBeansProjects/ExpLosion/ from notebooks.common_imports import * from gui.output_utils import * from gui.user_code import pairwise_significance_exp_ids query = {'expansions__decode_handler': 'SignifiedOnlyFeatureHandler', 'expansions__vectors__dimensionality': 100, 'expansions__vectors__r...
github_jupyter
# Lussen Looping `for` a `while` ## `for` lussen ``` for i in [0, 1, 2]: print("i is", i) for i in range(0, 3): print("i is", i) for x in [10, 15, 2020]: print("x is", x) ``` ```python for i in ...: print("Gefeliciteerd") ``` Hoe kan dit 10 keer worden uitgevoerd? Hier is een reeks aan oplossingen ...
github_jupyter
``` # Setup directories from pathlib import Path basedir = Path().absolute() libdir = basedir.parent.parent.parent # Other imports import pandas as pd import numpy as np from datetime import datetime from ioos_qc.plotting import bokeh_plot_collected_results from bokeh import plotting from bokeh.io import output_note...
github_jupyter
Early stopping of model simulations =================== For certain distance functions and certain models it is possible to calculate the distance on-the-fly while the model is running. This is e.g. possible if the distance is calculated as a cumulative sum and the model is a stochastic process. For example, Markov Ju...
github_jupyter
### This notebook covers how to get statistics on videos returned for a list of search terms on YouTube with the use of YouTube Data API v3. First go to [Google Developer](http://console.developers.google.com/) and enable YouTube Data API v3 by clicking on the button "+ ENABLE APIS AND SERVICES" and searching for YouT...
github_jupyter
``` from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os.path import sys import time import tensorflow as tf TRAIN_FILE = 'train.tfrecords' def read_and_decode(filename_queue): reader = tf.TFRecordReader() _, serialized_example ...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import numpy as np from numpy.random import default_rng import random import collections import re import tensorflow as tf from tqdm import tqdm max_seq_length_encoder = 512 max_seq_length_decoder = 128 masked_lm_prob = 0.2 max_predictions_per_seq = int(masked_lm_p...
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
# Explore the generated data Here we explore the data that is generated with the [generate-data.ipynb](generate-data.ipynb) notebook. You can either run the simulations or download the data set. See [README.md](README.md) for the download link and instructions. ### Joining the seperate data files of one simulation tog...
github_jupyter
## In this notebook, images and their corresponding metadata are organized. We take note of the actual existing images, combine with available metadata, and scraped follower counts. After merging and dropping image duplicates, we obtain 7702 total images. ``` import pandas as pd import numpy as np import os from PIL i...
github_jupyter
<img src='https://www.iss.nus.edu.sg/Sitefinity/WebsiteTemplates/ISS/App_Themes/ISS/Images/branding-iss.png' width=15% style="float: right;"> <img src='https://www.iss.nus.edu.sg/Sitefinity/WebsiteTemplates/ISS/App_Themes/ISS/Images/branding-nus.png' width=15% style="float: right;"> --- ``` import IPython.display IPy...
github_jupyter
# Sequence to Sequence attention model for machine translation This notebook trains a sequence to sequence (seq2seq) model with two different attentions implemented for Spanish to English translation. The codes are built on TensorFlow Core tutorials: https://www.tensorflow.org/tutorials/text/nmt_with_attention ``` i...
github_jupyter
# QCoDeS Example with DynaCool PPMS This notebook explains how to control the DynaCool PPMS from QCoDeS. For this setup to work, the proprietary `PPMS Dynacool` application (or, alternatively `Simulate PPMS Dynacool`) must be running on some PC. On that same PC, the `server.py` script (found in `qcodes/instrument_dri...
github_jupyter
``` import json import os import random import re from itertools import product import numpy as np import pandas as pd from more_itertools import distinct_combinations from plotnine import * from sklearn import feature_extraction, metrics ROOT_PATH = os.path.dirname(os.path.abspath(os.getcwd())) def inspect_df(df: p...
github_jupyter
``` # default_exp checker ``` # Dependency Checker > A pragmatic way to talk with pypi and find out what dependencies are out of date ``` #hide from nbverbose.showdoc import * ``` ## Dependency Traversing Sometimes, we may want to check the current installed versions of a project's basic dependencies, and further ...
github_jupyter
SPARQL Transformer evaluation ========================= This notebook contains some quantitative measures for the evaluation of SPARQL Transformer. ``` import json import os import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from ipywidgets import FloatProgress from IPython.display i...
github_jupyter
``` #Import the necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream #Variables that contains the user credentials to access Twitter API access_token = "your_access_token" access_token_secret = "your_access_secret_token" consumer_k...
github_jupyter
# hello paddle: 从普通程序走向机器学习程序 **作者:** [PaddlePaddle](https://github.com/PaddlePaddle) <br> **日期:** 2021.12 <br> **摘要:** 这篇示例向你介绍普通程序跟机器学习程序的区别,并带着你用飞桨框架,实现第一个机器学习程序。 ## 一、普通程序跟机器学习程序的逻辑区别 作为一名开发者,你最熟悉的开始学习一门编程语言,或者一个深度学习框架的方式,可能是通过一个hello world程序。 学习飞桨也可以这样,这篇小示例教程将会通过一个非常简单的示例来向你展示如何开始使用飞桨。 机器学习程序跟通常的程序最大的不同是,通常的...
github_jupyter
# Accumulation of roundoof error In this notebook we'll study some effects of accumulation of roundoof error. # Unstable Algorithms We need to solve this integral for $n=1,2,....8$ $$y_n=\int_0^1\frac{x^n}{x+5}$$ We write the equation like this: $$y_n = \frac{1}{n} - 5y_{n-1}$$ $$y_{1}=1-5(y_{0}+\epsilon )=1-5y_{0...
github_jupyter
# Inventory Control with Lead Times and Multiple Suppliers ## Description One potential application of reinforcement learning involves ordering supplies with mutliple suppliers having various lead times and costs in order to meet a changing demand. Lead time in inventory management is the lapse in time between when ...
github_jupyter
``` import numpy as np import pandas as pd import tensorflow as tf from data_process import build_vocab, batch_iter, sentence_to_index from models import LSTM, biLSTM, deepBiLSTM train = pd.read_csv('./data/train-5T.txt', delimiter='\t') test = pd.read_csv('./data/test-1T.txt', delimiter='\t') X_train = train.document ...
github_jupyter
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb) # Nonlinear Filtering ``` #format the book %matplotlib inline from __future__ import division, print_function from book_format import load_style load_style() ``` ## Introduction T...
github_jupyter
# Classifying Business Documents using Deep Learning ## IBM Coursera Advanced Data Science Capstone - Results Demo ## Sumudu Tennakoon ``` import pandas as pd import numpy as np import sys import os import re import matplotlib.pyplot as plt from datetime import date from sklearn.model_selection import train_test_spl...
github_jupyter
# Numpy The basis of most scientific programming in Pyhton is the *numerical Python* library, `numpy`. NumPy gives us many tools - including a fast and efficient data type, the `numpy Array` - for working with numerical data. ## Numpy Array NumPy is built around the `array`. This is a data structure defined in NumP...
github_jupyter
# Ray RLlib - Sample Application: CartPole © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) We were briefly introduced to the `CartPole` example and the OpenAI gym `CartPole-v1` environment ([gym.openai.com/envs/CartPole-v1/](https://gym.openai.com/envs/CartPole-v1/))...
github_jupyter
``` import tensorflow as tf tf.config.experimental.list_physical_devices() tf.test.is_built_with_cuda() ``` # Importing Libraries ``` import numpy as np import pandas as pd from matplotlib import pyplot as plt import os.path as op import pickle import tensorflow as tf from tensorflow import keras from keras.models im...
github_jupyter
# Paper Trends ## Imports ``` %load_ext autoreload %autoreload 2 %aimport %matplotlib inline import os import sys nb_dir = os.path.dirname(os.path.split(os.getcwd())[0]) if nb_dir not in sys.path: sys.path.append(nb_dir) from tqdm import tqdm_notebook as tqdm import pandas as pd from turicreate import SFrame, loa...
github_jupyter
# Residual Networks Welcome to the second assignment of this week! You will learn how to build very deep convolutional networks, using Residual Networks (ResNets). In theory, very deep networks can represent very complex functions; but in practice, they are hard to train. Residual Networks, introduced by [He et al.](h...
github_jupyter
# Training Job in Internet-free Mode If you want to isolate your training data and training container from the rest of the Internet, then you should create the training job in a private subnet. A private subnet is a subnet in your VPC without a route to an Internet Gateway. This means, by default, no inbound calls to ...
github_jupyter
# Algorithm used : ![Sarsa](SarsaAlgo.png) ``` %matplotlib inline import gym import itertools import matplotlib import numpy as np import pandas as pd import sys if "../" not in sys.path: sys.path.append("../") from collections import defaultdict from lib.envs.windy_gridworld import WindyGridworldEnv from lib ...
github_jupyter
``` # Deprecated # packages: random import random # packages: data structure import numpy as np import pandas as pd import astropy.io as io # packages: image generation and plot generation from matplotlib import pyplot as plt # pandas # https://pandas.pydata.org/pandas-docs/stable/tutorials.html # https://pandas.pyda...
github_jupyter
# Chapter 2: Conditional probability ---- ``` import numpy as np ``` ## Simulating the frequentist interpretation Recall that the frequentist interpretation of conditional probability based on a large number `n` of repetitions of an experiment is $P(A|B) ≈ n_{AB}/n_{B}$, where $n_{AB}$ is the number of times that...
github_jupyter
# Building your Deep Neural Network: Step by Step Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a 2-layer Neural Network (with a single hidden layer). This week, you will build a deep neural network, with as many layers as you want! - In this notebook, you will implement all the functio...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np ``` # Text Classification of Movie Reviews ``` from helpers import Timer from sklearn.datasets import load_files reviews_train = load_files("aclImdb/train/") text_train, y_train = reviews_train.data, reviews_train.target print("Number of docum...
github_jupyter
<p style="font-family: Arial; font-size:3.75vw;color:purple; font-style:bold"><br> matplotlib Exercise Notebook </p><br> # Exercise Notebook Instructions ### 1. Important: Only modify the cells which instruct you to modify them - leave "do not modify" cells alone. The code which tests your responses assumes you ha...
github_jupyter
# Variational Inference and Learning in the Big Data Regime Many real-world modelling solutions require fitting models with large numbers of data-points and parameters, which is made convenient recently through software implementing automatic differentiation, but also require uncertainty quantification. Variational in...
github_jupyter
# ML Strategy * Collect more data * Collect more diverse trainign set * Train algorithm longer with gradient descetn * Try adam isntead of gradient descent * Try bigger networks * Try smaller networks * Try dropout * Add L2 regularizatión * Network architecture * Network archicteture - Activvation - \# hidden...
github_jupyter
# Travail Ecrit - Python * Gymnase du Bugnon, site de l'Ours * OC informatique * Sujet : chapitres 1-10 du livre *Pensez en Python* * Mirko Pirona * Date : jeudi 13 novembre 2018 ## **Exercice : expression arithmétique** Initialisez les variables `(a, b, c, x)` avec les valeurs `(2, 3, 4, 5)`. Calculez l'expressio...
github_jupyter
``` # Visualization of the KO+ChIP Gold Standard from: # Miraldi et al. (2018) "Leveraging chromatin accessibility for transcriptional regulatory network inference in Th17 Cells" # TO START: In the menu above, choose "Cell" --> "Run All", and network + heatmap will load # NOTE: Default limits networks to TF-TF edges i...
github_jupyter
# <center> #DHBSI 2016: Computational Text Analysis </center> ## <center> Laura Nelson <br/> <em>Postdoctoral Fellow | Digital Humanities @ Berkeley | Berkeley Institute for Data Science </em> </center> ## <center> Teddy Roland <br/> <em> Coordinator, Digital Humanities @ Berkeley <br/> Lecturer, UC Berkeley </em> ...
github_jupyter
# Data Preprocessing for Topic Monitoring(Facebook) ``` import pandas as pd import numpy as np import re import csv from langdetect import detect import nltk # nltk.download('punkt') # nltk.download('maxent_treebank_pos_tagger') # nltk.download('wordnet') # nltk.download('averaged_perceptron_tagger') # nltk.download('...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys import warnings warnings.filterwarnings("ignore") sys.path.append("../") from modules.data.conll2003.prc import conll2003_preprocess data_dir = "/home/eartemov/ae/work/conll2003/" conll2003_preprocess(data_dir) ``` ## IO markup ### Train ``` from modules.data imp...
github_jupyter
``` import torch from torchvision import transforms import torch.nn.functional as F import torch.nn as nn from PIL import Image import imageio import os from google.colab import drive from google.colab import drive drive.mount('/content/drive') class YOLO(nn.Module): def __init__(self, img_width, row_size): ...
github_jupyter
# Db2 11.5.4 RESTful Programming The following notebook is a brief example of how to use the Db2 11.5.4 RESTful Endpoint service to extend the capabilies of Db2. Programmers can create Representational State Transfer (REST) endpoints that can be used to interact with Db2. Each endpoint is associated with a single SQL...
github_jupyter
# Inference acceleration of `T5` for large batch size / long sequence length / > large models Every week or so, a new impressive few shots learning work taking advantage of autoregressive models is released by some team around the world. Still `LLM` inference is rarely discussed and few projects are focusing on this...
github_jupyter
``` !wget -q https://github.com/CISC-372/Notebook/releases/download/a4/test.csv !wget -q https://github.com/CISC-372/Notebook/releases/download/a4/train.csv # comment your understanding of each function import pandas as pd import csv xy_train_df = pd.read_csv('train.csv') x_test_df = pd.read_csv('test.csv', index_c...
github_jupyter
## Exploratory analysis of the US Airport Dataset This dataset contains data for 25 years[1995-2015] of flights between various US airports and metadata about these routes. Taken from Bureau of Transportation Statistics, United States Department of Transportation. Let's see what can we make out of this! ``` %matplot...
github_jupyter
500 hPa Vorticity Advection =========================== Plot an 500-hPa map with calculating vorticity advection using MetPy calculations. Beyond just plotting 500-hPa level data, this uses calculations from `metpy.calc` to find the vorticity and vorticity advection. Currently, this needs an extra helper function to ...
github_jupyter
``` """ Snowflake Batch Prediction API Snowflake S3 scoring job v1.0 Mike Taveirne (doyouevendata) 3/21/2020 """ import pandas as pd import requests import time from pandas.io.json import json_normalize import snowflake.connector import my_creds #from imp import reload #reload(my_creds) # datarobot parameters API_KEY...
github_jupyter
# Inference and Validation Now that you have a trained network, you can use it for making predictions. This is typically called **inference**, a term borrowed from statistics. However, neural networks have a tendency to perform *too well* on the training data and aren't able to generalize to data that hasn't been seen...
github_jupyter
**Import library** ``` import pandas as pd import numpy as np import calendar from datetime import datetime import time # Standard plotly imports import plotly.express as px import plotly.graph_objects as go import matplotlib.pyplot as plt import seaborn as sns sns.set_context("paper", font_scale=1.3) sns.set_style('w...
github_jupyter
<a href="https://colab.research.google.com/github/ewotawa/secure_private_ai/blob/master/Section_2_Federated_Learning_Final_Project.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Federated Learning Final Project ## Overview * See <a href="https:...
github_jupyter
``` % load_ext autoreload % autoreload 2 % matplotlib inline import matplotlib.pyplot as plt import numpy as np import torch device = 'cuda' if torch.cuda.is_available() else 'cpu' import os, sys opj = os.path.join from tqdm import tqdm from ex_mnist import p from dset import get_dataloader sys.path.append('../../s...
github_jupyter
# Twitter Konversationen zu einem Thema als Netzwerk untersuchen - Aus Twitter-Daten kann man besonders gut Netzwerke basteln. - Dabei können wir frei definieren,wann eigentlich ein Nutzer mit einem anderen verbunden ist. Die gebräuchlichsten Definitionen sind: 1. Nutzer A retweetet Nutzer B (RT plotti was für ein...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt # for plotting import numpy as np # for matrix and vector computations import pandas as pd import seaborn as sns ``` ### Debugging * Python array indices start from zero * Vector/matrix operations work only with numpy arrays.Inspect matrix operations to make sur...
github_jupyter
<a href="https://colab.research.google.com/github/hf2000510/infectious_disease_modelling/blob/master/part_two.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Make sure to open in Colab to see the plots! ### Importing the libraries ``` from scipy.i...
github_jupyter
<a href="https://colab.research.google.com/github/ayulockin/Explore-NFNet/blob/main/Train_Basline_With_Gradient_Clipping.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 🧰 Setups, Installations and Imports ``` %%capture !pip install wandb --upgr...
github_jupyter
# Expression Quality Control (Part 2) This is a template notebook for performing the final quality control on your organism's expression data. This requires a curated metadata sheet. ## Setup ``` import itertools import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from os i...
github_jupyter
# Hyperparams And Distributions This page introduces the hyperparams, and distributions in Neuraxle. You can find [Hyperparams Distribution API here](https://www.neuraxle.org/stable/api/neuraxle.hyperparams.distributions.html), and [Hyperparameter Samples API here](https://www.neuraxle.org/stable/api/neuraxle.hyperpa...
github_jupyter
# Hyperparameter Tuning using SageMaker Tensorflow Container This tutorial focuses on how to create a convolutional neural network model to train the [MNIST dataset](http://yann.lecun.com/exdb/mnist/) using **SageMaker TensorFlow container**. It leverages hyperparameter tuning to kick off multiple training jobs with d...
github_jupyter
``` import numpy as np import os import sys import xarray as xr import scipy.io as sio import matplotlib.pyplot as plt import datetime from dotenv import load_dotenv, find_dotenv # find .env automagically by walking up directories until it's found dotenv_path = find_dotenv() load_dotenv(dotenv_path) src_dir = os.env...
github_jupyter