text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
<a href="https://colab.research.google.com/github/tushar-semwal/fedperf/blob/main/Santiago/Shakespeare/FedAvg.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # FedPerf - Shakespeare + FedAvg algorithm ## Setup & Dependencies Installation ``` %%cap...
github_jupyter
# Visualizing data using matplotlib and seaborn ``` import pandas as pd, csv, os, re import numpy as np #from nltk.stem.porter import PorterStemmer # an approximate method of stemming words #stemmer = PorterStemmer() # FOR VISUALIZATIONS import matplotlib, seaborn as sns import matplotlib.pyplot as plt # Visualizati...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression import pickle data = pd.read_csv("diabetes-pima.csv") data.head(10) # to check if any null value is present data.isnull().values.any() ## c...
github_jupyter
This notebook can be run on mybinder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fgricad-gitlab.univ-grenoble-alpes.fr%2Fai-courses%2Fautonomous_systems_ml/HEAD?filepath=notebooks%2F4_discriminant_analysis) *Taken from scikit-learn example* ``` %matplotlib inline ``` #...
github_jupyter
# Lesson 2 Demo 3: Creating Fact and Dimension Tables with Star Schema ### Walk through the basics of modeling data using Fact and Dimension tables. In this demo, we will:<br> <ol><li>Create both Fact and Dimension tables<li>Show how this is a basic element of the Star Schema. ### Import the library Note: An error ...
github_jupyter
``` import random import torch.nn as nn import torch import time import math import pickle import pandas as pd from pandas import Series, DataFrame from pandarallel import pandarallel pandarallel.initialize(progress_bar=True) import sys import json from sklearn.ensemble import RandomForestClassifier from sklearn.naive_...
github_jupyter
# Web Track Overview ``` import pandas as pd import numpy as np import seaborn as sb def cc_15_jsonl(f): prefix = '/mnt/ceph/storage/data-in-progress/kibi9872/sigir2021/data-13-10-2020/cc15-relevance-transfer/' threshold = 0.82 df = pd.read_json(prefix + f, lines=True) df['urlMatches'] = df['urlMatche...
github_jupyter
# Custom statespace models The true power of the state space model is to allow the creation and estimation of custom models. This notebook shows various statespace models that subclass `sm.tsa.statespace.MLEModel`. Remember the general state space model can be written in the following general way: $$ \begin{aligned}...
github_jupyter
# VacationPy ---- #### Note * Keep an eye on your API usage. Use https://developers.google.com/maps/reporting/gmp-reporting as reference for how to monitor your usage and billing. * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think throug...
github_jupyter
# Parameter Space To run a DYNAMITE model, one must specify a number of parameters for the gravitational potential. The aim of this notebook is to demonstrate how to specify these parameters and to highlight features that we have implemented in order to help you explore parameter space. We'll start as before by read...
github_jupyter
``` %matplotlib inline ``` # Solar Data Processing with Python Part II Now we have a grasp of the basics of python, but the whole reason for downloading python in the first place was to analyze solar data. Let's take a closer look at examples of solar data analysis. We will be using SunPy to access solar data. SunP...
github_jupyter
``` import matplotlib.pyplot as plt %matplotlib notebook import numpy as np import pandas as pd from scipy import interpolate import pickle import xmeos from xmeos import models from xmeos import datamod CONSTS = models.CONSTS analysis_file = 'data/analysis.pkl' with open(analysis_file, 'rb') as f: analysis = pic...
github_jupyter
# Challenge 4: Convolutional Neural Networks Create a Convolutional Neural Network (a deep learning architecture) to classify the gear data. The architecture or design should contain a mix of layers such as convolutional and pooling. Train a model on the training dataset using the deided architecture. You may have to i...
github_jupyter
``` from keras.datasets import imdb from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Embedding, LSTM from keras.layers import Conv1D, Flatten, MaxPooling1D, GlobalMaxPooling1D from keras.preprocessing import sequence, text import numpy as np import os import json ``` # Workarou...
github_jupyter
<a href="https://colab.research.google.com/github/predatorx7/borrows/blob/master/pyai/5_A_Water_Jug.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ![waterjugg.jpg](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICA...
github_jupyter
<a href="https://colab.research.google.com/github/tjwei/NCTU_DeepLearning/blob/master/tf2_tutorial/02_tf2_Basics.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install -U tensorflow-gpu import tensorflow as tf tf.__version__ matrix1 = tf.c...
github_jupyter
# Clean-Label Feature Collision Attacks on a PyTorch Classifier In this notebook, we will learn how to use ART to run a clean-label feature collision poisoning attack on a neural network trained with PyTorch. We will be training our data on a subset of the CIFAR-10 dataset. The methods described are derived from [this...
github_jupyter
``` import joblib import pandas as pd from sklearn.datasets import load_breast_cancer, load_iris, load_boston from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.model_selection import GridSearchCV ``` # Process Dataset Breast Ca...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' # !git pull import tensorflow as tf import malaya_speech import malaya_speech.train from malaya_speech.train.model import fastspeech2 import numpy as np _pad = 'pad' _start = 'start' _eos = 'eos' _punctuation = "!'(),.:;? " _special = '-' _letters = 'ABCDEFGHIJKLMN...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts_aux import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # L...
github_jupyter
# Pooled Classification A common workflow with longitudinal spatial data is to apply the same classification scheme to an attribute over different time periods. More specifically, one would like to keep the class breaks the same over each period and examine how the mass of the distribution changes over these classes i...
github_jupyter
# Determining the proton content with a quantum computer Code at: https://github.com/qiboteam/qibo/tree/master/examples/qPDF. In this tutorial we show how to use the `qPDF` model implemented in Qibo to create a set of Parton Distribution Functions (PDFs), parameterized by a variational quantum circuit. In the context...
github_jupyter
> Copyright 2020 DeepMind Technologies Limited. > > 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 agre...
github_jupyter
# Visualization ## Matplotlib <div style="clear:both"></div> </div> <hr style="height:2px;"> <div style="float:right; width:250 px"><img src="https://matplotlib.org/_static/logo2.png" alt="NumPy Logo" style="height: 150px;"></div> ## Objectives 1. Create a basic line plot. 1. Add labels and grid lines to the plo...
github_jupyter
# Load and Process models This script will load the M models in the collection using cobrapy, and convert them to a normalized format. They will also be exported to the "mat" format used by the COBRA toolbox. This requires [cobrapy](https://opencobra.github.io/cobrapy) version 0.4.0b1 or later. ``` import os import ...
github_jupyter
# Credential Scan on Azure Log Analytics __Notebook Version:__ 1.0<br> __Python Version:__ Python 3.8 - AzureML<br> __Required Packages:__ No<br> __Platforms Supported:__ Azure Machine Learning Notebooks __Data Source Required:__ Log Analytics tables ### Description This notebook provides step-by-step ins...
github_jupyter
# Mask R-CNN - Train on Shapes Dataset This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Resnet101, which would be ...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/pipeline-style-transfer/pipeline-style-transfer-parallel-run.png) # Neura...
github_jupyter
# Print in python ``` import os from IPython.core.display import HTML def load_style(directory = '../', name='customMac.css'): styles = open(os.path.join(directory, name), 'r').read() return HTML(styles) load_style() ``` ## Print Statement The **print** statement can be used in the following differen...
github_jupyter
``` import numpy as np import pandas as pd import os import torch import torchvision import torchsample import psycopg2 import random import re import time import csv import copy from torch.autograd import Variable import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.utils.dat...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt df1 = pd.read_csv(r"E:\EYE DATASET\Training_Labels.csv") df1 df1.columns DR = DIABETIC RETINOPATHY ARMD = AGE RELATED MACULAR DEGENRATION import os import random import cv2 import matplotlib.pyplot as plt df = pd.read_csv("full_df.csv") df df1 c...
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> # ADM Quantities in terms of BSSN Quantities ## Author: Zac...
github_jupyter
# MNIST Example This demo is an adaption of our [first `MNIST` themed demo](mnist_example.ipynb), which computes saliency maps for the models' actual prediction. Here, we only analyze one input sample, but compute saliency maps for all of the model's output neurons, one at a time. # Imports ``` import warnings warn...
github_jupyter
# কোয়ান্টাম কম্পিউটারে ক্লাসিক্যাল কম্পিউটেশন ## বিষয়বস্তু 1. [Introduction](#intro) 2. [Consulting and Oracle](#oracle) 3. [Taking Out the Garbage](#garbage) ## 1। ভূমিকা<a id="intro"></a> কোয়ান্টাম গেটগুলির একটি সর্বজনীন সেট থাকার একটি পরিণতি হল যে কোনও ক্লাসিক্যাল গণনা পুনরুত্পাদন করার ক্ষমতা। আমাদের কেবল বুল...
github_jupyter
# Padding Oracle - When a decrypted CBC ciphertext ends in an invalid pad the web server returns a 403 error code (forbidden request). When the CBC padding is valid, but the message is malformed, the web server returns a 404 error code (URL not found). ``` http://crypto-class.appspot.com/po?er="your ciphertext here" `...
github_jupyter
# Widget Events ## Special events ``` from __future__ import print_function ``` The `Button` is not used to represent a data type. Instead the button widget is used to handle mouse clicks. The `on_click` method of the `Button` can be used to register function to be called when the button is clicked. The doc strin...
github_jupyter
# Hi, Are you in Google Colab? In Google colab you can easily run Optimus. If you not you may want to go here https://colab.research.google.com/github/ironmussa/Optimus/blob/master/examples/10_min_from_spark_to_pandas_with_optimus.ipynb Install Optimus all the dependencies. ``` import sys if 'google.colab' in sys.mod...
github_jupyter
### Outlier Detection using autoencoders-First version ### Using the whole data #### Edgar Acuna #### Abril 2021 ``` import warnings warnings.filterwarnings('ignore') import tensorflow as tf import keras from keras.models import Model, load_model from keras.layers import Input, Dense from keras.callbacks import Model...
github_jupyter
# Intrusion detection on NSL-KDD This is my try with [NSL-KDD](http://www.unb.ca/research/iscx/dataset/iscx-NSL-KDD-dataset.html) dataset, which is an improved version of well-known [KDD'99](http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html) dataset. I've used Python, Scikit-learn and PySpark via [ready-to-run J...
github_jupyter
# Lecture 2b: Introduction to Qiskit **By Adam Fattal** Welcome to the first practical lecture! In this lecture, we will be introducing qiskit, a package developed by IBM Quantum that allows one to simulate and run quantum circuits and much more! This lecture covers only the surface of Qiskit's functionality. For more...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt Jac_type = {1:'Sacado ', 0:'Analytic ', 2:'Numerical '} format_line={'names': ('computation type', 'total time', 'time per sample'), 'formats': ('S30', 'f16', 'f16')} vector= [16, 16, 16, 32, 32, 32, 32 ] team=[2, 4, 8, 1, 2, 4, 8 ] sacado_team_vector = {0:'2x16',...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D2_ModelingPractice/W1D2_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week1, Day 2, Tutorial 2 #Tutorial o...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) # 1.Quickstart Tutorial on Spark NLP - 1 hr This is the 1 hr workshop version of the entire training notebooks : https://github.com/JohnSnowLabs/spark-nlp-workshop/tree/master/tutorials/Certification_Trainings/Public an intro article for Spark NLP:...
github_jupyter
# Week 11 - Regression and Classification In previous weeks we have looked at the steps needed in preparing different types of data for use by machine learning algorithms. ``` import matplotlib.pyplot as plt import numpy as np %matplotlib inline from sklearn import datasets diabetes = datasets.load_diabetes() # De...
github_jupyter
``` import numpy as nmp import pandas as pnd import matplotlib.pyplot as plt import pymc3 as pmc import clonosGP as cln %load_ext autoreload %autoreload 2 %matplotlib inline DATA = pnd.read_csv('data/cll_Rincon_2019_patient1.csv') METRICS = pnd.read_csv('results/cll_Rincon_2019_patient1.csv') nmp.random.seed(42) pmc...
github_jupyter
# Leverage ### Stupidity or genius? Updated 2020-August-28. * This notebook looks at what the last 92 years of daily S&P 500 data has to say about the now well-known intra-day leverage. * Automatic reinvestment of dividends is assumed. ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt ...
github_jupyter
## Exercise 5.03: Visually comparing different tile providers Geoplotlib offers the possibility to switch between several providers of map tiles. This means we can try out different map tile styles that fit our visualization. In this exercise we'll take a look at how easily tile providers can be swapped. #### ...
github_jupyter
``` import keras keras.__version__ ``` # 透過二元分類訓練 IMDB 評論資料 二元分類或稱兩類分類可能是在機器學習中應用最廣泛問題。只要處理的問題只有兩個結果,就可以適用。在這個例子中,我們將根據 IMDB 評論的文本內容將電影評論分為「正面」評論和「負面」評論。 ## 關於 IMDB Dataset 資料集 IMDB Dataset 是來自 Internet 電影數據庫 50,000 條評論文字。他們分為 25,000 條訓練數據和 25,000 條測試數據,每組皆包含包括 50% 的負面評論和 50% 的正面評論。 我們可以直接透過 Keras Datasets 函式庫載入已經...
github_jupyter
``` %matplotlib inline ``` # Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation This is an example of applying :class:`sklearn.decomposition.NMF` and :class:`sklearn.decomposition.LatentDirichletAllocation` on a corpus of documents and extract additive models of the topic struct...
github_jupyter
# Amazon SageMaker와 병렬로 SageMaker 분산 모델을 사용하여 모델 병렬화로 MNIST 훈련 작업 시작 SageMaker 분산 모델 병렬 (SageMaker Distributed Model Parallel, SMP)은 GPU 메모리 제한으로 인해 이전에 학습하기 어려웠던 대규모 딥러닝 모델을 훈련하기 위한 모델 병렬 처리 라이브러리입니다. SageMaker Distributed Model Parallel은 여러 GPU 및 인스턴스에서 모델을 자동으로 효율적으로 분할하고 모델 훈련을 조정하므로 더 많은 매개 변수로 더 큰 모델을 생성하여 예측 정확...
github_jupyter
# The Fuzzing Book ## Sitemap While the chapters of this book can be read one after the other, there are many possible paths through the book. In this graph, an arrow _A_ → _B_ means that chapter _A_ is a prerequisite for chapter _B_. You can pick arbitrary paths in this graph to get to the topics that interest you mo...
github_jupyter
# Random Forest Classifier (RFC) ``` #Importing necessary libraries import numpy as np import pandas as pd import pickle from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.pipeline import Pipeline from sklearn.pipelin...
github_jupyter
# Introduction to climlab and 1D grey radiation models ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt import netCDF4 as nc import climlab ``` # Validate climlab against analytical solution for 2-layer atmosphere ``` # Test in a 2-layer atmosphere col = climlab.GreyRadiationModel(num_lev=2...
github_jupyter
``` import math import time import util import torch import logging import numpy as np from torch import nn import torch.optim as optim from util import DataLoaderS from model import * from model_time_shift import A2GCN logging.basicConfig(level=logging.INFO,#控制台打印的日志级别 filename='logging_ablatio...
github_jupyter
*Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by [Sebastian Raschka](https://sebastianraschka.com). All code examples are released under the [MIT license](https://github.com/rasbt/deep-learning-book/blob/master/LICEN...
github_jupyter
# Title Generation using Recurrent Neural Networks I never know what I should title most things I have written. I hope that by using a corpus of titles, recurrent neural networks (RNNs) can write my titles for me. I thought a fitting title to generate would be something within Machine Learning, so I used [Publish or P...
github_jupyter
# DeepDreaming with TensorFlow >[Loading and displaying the model graph](#loading) >[Naive feature visualization](#naive) >[Multiscale image generation](#multiscale) >[Laplacian Pyramid Gradient Normalization](#laplacian) >[Playing with feature visualzations](#playing) >[DeepDream](#deepdream) This notebook demo...
github_jupyter
``` import os import sys import glob import itertools from IPython.display import Image import matplotlib import matplotlib.pyplot as plt import matplotlib.mlab as mlab from matplotlib.colors import ListedColormap import numpy as np import pandas as pd np.random.seed(1234) %matplotlib inline ``` # Load AML data ...
github_jupyter
# BERT based NER experiment > Tutorial author: 徐欣(<xxucs@zju.edu.cn>) On this demo, we use `BERT` to recognize named entities. We hope this demo can help you understand the process of named entity recognition. This demo uses `Python3`. ## NER **Named-entity recognition** (also known as named entity identification, e...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
github_jupyter
``` import time from termcolor import colored import torch import torch.autograd.profiler as profiler from modules.Swc2d import Swc2d from modules.Dcls2dFull import Dcls2dFull assert torch.cuda.is_available() cuda_device = torch.device("cuda") # device object representing GPU in_channels = 1 out_channels = 1 kerne...
github_jupyter
# Setup ## Instructions 1. Work on a copy of this notebook: _File_ > _Save a copy in Drive_ (you will need a Google account). 2. (Optional) If you would like to do the deep learning component of this tutorial, turn on the GPU with Edit->Notebook settings->Hardware accelerator->GPU 3. Execute the following cell (click...
github_jupyter
``` """ I've never used SQL before, so this is just trial and error for loading things right now. This is just for helping me think and plan the steps. """ print('') import pandas as pd # pd.set_option('display.max_columns', 30) # pd.set_option('display.width', 10000) # pd.set_option('display.expand_frame_repr', False...
github_jupyter
# Tutorial ## [How to do Novelty Detection in Keras with Generative Adversarial Network](https://www.dlology.com/blog/how-to-do-novelty-detection-in-keras-with-generative-adversarial-network-part-2/) | DLology This notebook is for test phase Novelty Detection. To Train the model, run this first. ```bash python models....
github_jupyter
# Lab 07: Stack Applications ## Overview For this assignment you will build on the stack data structure created in class to develop two distinct stack-driven applications. Below is the completed stack implementation from class. While you needn't modify it for this assignment — indeed, all tests run on our end will *...
github_jupyter
### Exercise 1: Create a Numpy array (from a list) ``` import numpy as np lst1=[1,2,3] array1 = np.array(lst1) type(array1) type(lst1) ``` ### Exercise 2: Add two Numpy arrays ``` lst2 = lst1 + lst1 print(lst2) array2 = array1 + array1 print(array2) ``` ### Exercise 3: Mathematical operations on Numpy arrays ``` p...
github_jupyter
# Convert OpenSN data to name,host,type,x,y,z,t,lum Data downloaded from The Open Supernova Catalog https://sne.space on Aug. 20, 2019 ``` import pandas as pd import numpy as np from astropy import units from astropy.coordinates import SkyCoord, Distance from astropy.cosmology import WMAP9 import datetime import mat...
github_jupyter
``` import random import numpy as np import pandas as pd import numpy as np import pandas as pd length = 1000 cols = ["Q", "X", "Y", "Z"] mu = 0 sigma = 5 import pingouin lst_dct = {col:[] for col in cols } for i in range(length): lst_dct["Q"].append(50 + np.random.normal(mu, sigma)) lst_dct["X"].append(5 * ...
github_jupyter
``` %matplotlib notebook # test imports import matplotlib.pyplot as plt import numpy as np import pandas as pd import sklearn print(f"The version of numpy is: {np.__version__}") print(f"The version of pandas is: {pd.__version__}") print(f"The version of scikit-learn is: {sklearn.__version__}") ``` You should see the v...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Goal" data-toc-modified-id="Goal-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Goal</a></span></li><li><span><a href="#Var" data-toc-modified-id="Var-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Va...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/using-mlflow/train-and-deploy-keras-auto-logging/train-and-deploy-keras-auto-logging.png) ## Use MLf...
github_jupyter
<a href="https://colab.research.google.com/github/gyyang/neurogym/blob/master/examples/demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Exploring NeuroGym tasks NeuroGym is a comprehensive toolkit that allows training any network model on ma...
github_jupyter
``` from netCDF4 import Dataset import netCDF4 as netcdf import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mticker import matplotlib as mpl import cmocean as cmo #mapping import cartopy.crs as ccrs import cartopy.feature as cfeature from cartopy.io import shapereader from cartopy.mpl.gridl...
github_jupyter
# Lecture 1.1: Introduction to NumPy & pandas This lecture, we are getting to know the two python libraries at the heart of data analysis: [NumPy](https://numpy.org/) and [pandas](https://pandas.pydata.org/). **Learning goals:** - Explain the difference between NumPy ndarrays, pandas Series, and pandas DataFrames - ...
github_jupyter
# MeshCat Animations MeshCat.jl also provides an animation interface, built on top of the [three.js animation system](https://threejs.org/docs/#manual/introduction/Animation-system). While it is possible to construct animation clips and tracks manually, just as you would in Three.js, it's generally easier to use the M...
github_jupyter
## Summary ---- ## Imports ``` import concurrent.futures import gzip import os import shutil import subprocess from collections import Counter from pathlib import Path import logomaker import matplotlib.pyplot as plt import numpy as np import pandas as pd import proteinsolver import pyarrow as pa import pyarrow.par...
github_jupyter
##### Copyright 2021 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
**This notebook is an exercise in the [Python](https://www.kaggle.com/learn/python) course. You can reference the tutorial at [this link](https://www.kaggle.com/colinmorris/functions-and-getting-help).** --- Functions are powerful. Try writing some yourself. As before, don't forget to run the setup code below befor...
github_jupyter
# Variational Multi-modal Recurrent Graph AutoEncoder In this tuorial, we will go through how to run a Variational Multi-modal Recurrent Graph AutoEncoder (VMR-GAE) model for origin-destination (OD) matrix completion. In particular, we will demonstrate how to train the model and evaluate the completion results. ## Par...
github_jupyter
``` !pip install -q transformers datasets sentencepiece coral_pytorch import torch import torch.nn as nn from torch.functional import F from datasets import Dataset import transformers as ts from transformers import AutoTokenizer , AutoModelForSequenceClassification from transformers import TrainingArguments, Trainer...
github_jupyter
# HW3: Variational Autoencoders ``` import torch import torch.optim as optim import torch.nn as nn from torch.distributions import Normal from itertools import chain from torchlib.generative_model.autoencoder.vae import VAE from torchlib.dataset.utils import create_data_loader from torchlib.utils.distributions import ...
github_jupyter
# Analyzing Real vs. Fake News Article Headlines 📰 Author:<br>[Navraj Narula](http://navierula.github.io)<br><br> Data Source: <br>[Randomly-Collected Fake News Dataset](https://github.com/BenjaminDHorne/fakenewsdata1)<br><br> Resources Consulted: <br>[Text Mining with R](http://tidytextmining.com)<br>[R: Text Classi...
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
# Questions [40marks] * Q1 Who did spend most money for renting? * Q2 Which room does make the most amount of income? * Q3 How many time Jack Jones rent the room? * Q4 How many time Claire Taylor rent each room? * Q5 what is the total income of ALL rooms in June? Between 1st June 2018(inclusive) and 30th June 2018(incl...
github_jupyter
We can use embedding comparison to measure the difference between the representations that neural network models learn. In this notebook, we compare the final-layer embeddings for Imagenet-trained VGG16, VGG19, and InceptionV3 models ``` %load_ext autoreload %autoreload 2 %matplotlib inline import os os.environ["CUDA...
github_jupyter
# Gradient Checking Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking. You are part of a team working to make mobile payments available globally, and are asked to build a deep learning model to detect fraud--whenever someone makes a payment, you w...
github_jupyter
``` import numpy as np import subprocess as sub import SWAT_ReadOut as read from SWAT_Manipulate import rteManipulator from SWAT_Manipulate import bsnManipulator from SWAT_Manipulate import gwManipulator from SWAT_Manipulate import solManipulator from SWAT_Manipulate import mgtManipulator from SWAT_Manipulate import hr...
github_jupyter
``` import numpy as np %matplotlib tk import matplotlib.pyplot as plt import pickle from sklearn import cluster from sklearn import metrics from sympy.solvers import solve import sympy as sym from scipy import optimize class VelocityPlotter(): def __init__(self): personNames = ['person1','person2','person...
github_jupyter
## 一、比较类排序 ### A、交换排序 #### a、冒泡排序 ``` def bubble_sort(List): n = len(List) for i in range(n): for j in range(0, n-i-1): if List[j] > List[j+1]: List[j], List[j+1] = List[j+1], List[j] return List arr = [1, 6, 9, 8, 2, 6, 7, 4, 3] print(bubble_sort(arr)) ``` #### b、快速排...
github_jupyter
``` import numpy as np import sys from scipy.special import expit as sigmoid training_data_path = sys.argv[1] testing_data_path = sys.argv[2] output_path = sys.argv[3] # training_data_path = "../data/devnagri_train.csv" # testing_data_path = "../data/devnagri_test_public.csv" # output_path = "../data/nn/b/cs1160328" ...
github_jupyter
This notebook can be executed in a notebook hosted in KubeFlow. You can find instructions on how to deploy a KubeFlow cluster and how to access the the KubeFlow UI and the hosted notebooks here: https://www.kubeflow.org/docs/pipelines/pipelines-quickstart/ Please install KubeFlow Pipelines SDK using the following com...
github_jupyter
Exercise 9 - Advanced Neural Networks ========== There are many factors that influence how well a neural network might perform. AI practitioners tend to play around with the structure of the hidden layers, the activation functions used, and the optimisation function. In this exercise we will look at how changing thes...
github_jupyter
## Convolutional Neural Networks --- In this notebook, we train an MLP to classify images from the MNIST database. ### 1. Load MNIST Database ``` from keras.datasets import mnist # use Keras to import pre-shuffled MNIST database (X_train, y_train), (X_test, y_test) = mnist.load_data() print("The MNIST database ...
github_jupyter
## EEML2019: ConvNets and Computer Vision Tutorial (PART I) ### Supervised classification, overfitting and inductive biases in convnets, and how to improve models through self-supervision ### by Viorica Patraucean (vpatrauc@gmail.com) * Exercise 1: Implement and train a Resnet-50 classifier using supervised learning;...
github_jupyter
``` cd /content/drive/My\ Drive/lane_follower %tensorflow_version 1.x import tensorflow as tf device_name = tf.test.gpu_device_name() if device_name != '/device:GPU:0': raise SystemError('GPU device not found') print('Found GPU at: {}'.format(device_name)) print(tf.__version__) import cv2 import time import os impor...
github_jupyter
``` from datetime import date import pandas as pd import numpy as np from datetime import datetime, timedelta, date import geopandas as gpd from pathlib import Path import re pd.options.display.max_columns = 100 # data from github jhu,import the lastest data from timeseries df_Counties_confirmed = pd.read_csv( "htt...
github_jupyter
``` %matplotlib inline import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import statsmodels.api as sm from statsmodels.tsa.seasonal import seasonal_decompose from statsmodels.graphics.tsaplots import plot_pacf, plot_acf sns.set_style('darkgrid') df = pd.read_csv('...
github_jupyter
# CMFGEN Database from John Hillier’s CMFGEN, a radiative transfer code designed to solve the radiative transfer and statistical equilibrium equations in spherical geometry. <div class="alert alert-info"> **Note:** In this example, the data was downloaded from the [CMFGEN website](http://kookaburra.phyast.pitt....
github_jupyter
# Exploring different Symbol options in Magics This notebook will help you discover lots of posibilities for plotting symbols on your maps in Magics. Symbol plotting in Magics is the plotting of different types of symbols at selected locations. A symbol in this context is a number (the value at the location), a text ...
github_jupyter
# Unity ML Agents ## Environment Basics This notebook contains a walkthrough of the basic functions of the Python API for Unity ML Agents. For instructions on building a Unity environment, see [here](https://github.com/Unity-Technologies/ml-agents/wiki/Getting-Started-with-Balance-Ball). ### 1. Load dependencies ``` ...
github_jupyter