text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Assignment 1: Auto Correct Welcome to the first assignment of Course 2. This assignment will give you a chance to brush up on your python and probability skills. In doing so, you will implement an auto-correct system that is very effective and useful. ## Outline - [0. Overview](#0) - [0.1 Edit Distance](#0-1) -...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score #from sklearn...
github_jupyter
``` import json from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import xgboost as xgb from category_encoders import OneHotEncoder from pandas_profiling import ProfileReport from sklearn.impute import SimpleImputer from sklearn.linear_model import Lo...
github_jupyter
``` ''' This notebook analyzes splicing and cleavage using LRS data. Figures 6 and S7 ''' import os import re import numpy as np import pandas as pd from pandas.api.types import CategoricalDtype import mygene import scipy from plotnine import * import warnings warnings.filterwarnings('ignore') import matplotlib matp...
github_jupyter
<a href="https://colab.research.google.com/github/iamsoroush/DeepEEGAbstractor/blob/master/cv_hmdd_4s_proposed_gap.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title # Clone the repository and upgrade Keras {display-mode: "form"} !git clon...
github_jupyter
# Gallery of examples ![logo_text.png](docs/source/_static/EinsteinPy_trans.png) Here you can browse a gallery of examples using EinsteinPy in the form of Jupyter notebooks. ## [Visualizing advance of perihelion of a test particle in Schwarzschild space-time](docs/source/examples/Visualizing_advance_of_perihelion_of...
github_jupyter
# Third Project - Automated Repair ## Overview ### The Task For the first two submissions we asked you to implement a _Debugger_ as well as an _Input Reducer_. Both of these tools are used to help the developer to locate bugs and then manually fix them. In this project, you will implement a technique of automatic c...
github_jupyter
# Sonic The Hedgehog 1 with Advantage Actor Critic ## Step 1: Import the libraries ``` import time import retro import random import torch import numpy as np from collections import deque import matplotlib.pyplot as plt from IPython.display import clear_output import math %matplotlib inline import sys sys.path.appen...
github_jupyter
# Objected-Oriented Simulation Up to this point we have been using Python generators and shared resources as the building blocks for simulations of complex systems. This can be effective, particularly if the individual agents do not require access to the internal state of other agents. But there are situations where ...
github_jupyter
# 01 - Introduction to numpy: why does numpy exist? You might have read somewhere that Python is "slow" in comparison to some other languages. While generally true, this statement has only little meaning without context. As a scripting language (e.g. simplify tasks such as file renaming, data download, etc.), python i...
github_jupyter
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner"> # Working with Watson Machine Learning - Quality Monitor and Feedback Logging ### Contents - [1.0 Install Python Packages](#setup) - [2.0 Configure Credentials](#credentials) - [3.0 OpenSc...
github_jupyter
this notebook first collect all stats obtained in intial exploration. it will be a big table, indexed by subset, neuron, structure, optimization. # result: I will use k9cX + k6s2 + vanilla as my basis. ``` import h5py import numpy as np import os.path from functools import partial from collections import OrderedDic...
github_jupyter
# Prescient Tutorial ## Getting Started This is a tutorial to demonstration the basic functionality of Prescient. Please follow the installation instructions in the [README](https://github.com/grid-parity-exchange/Prescient/blob/master/README.md) before proceeding. This tutorial will assume we are using the CBC MIP so...
github_jupyter
# Prédiction à l'aide de forêts aléatoires Les forêts aléatoires sont des modèles de bagging ne nécessitant pas beaucoup de *fine tuning* pour obtenir des performances correctes. De plus, ces méthodes sont plus résitances au surapprentissage par rapport à d'autres méthodes. ``` from google.colab import drive drive.mo...
github_jupyter
# Deutsch-Jozsa and Grover with Aqua The Aqua library in Qiskit implements some common algorithms so that they can be used without needing to program the circuits for each case. In this notebook, we will show how we can use the Deutsch-Jozsa and Grover algorithms. ## Detusch-Jozsa To use the Deutsch-Jozsa algorithm,...
github_jupyter
# Facial Keypoint Detection This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ...
github_jupyter
<a href="https://colab.research.google.com/github/enakai00/rl_book_solutions/blob/master/Chapter05/Exercise_5_12.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Exercise 5.12 : Solution ``` import numpy as np from numpy import random import copy ...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 import sys from pathlib import Path sys.path.append(str(Path.cwd().parent)) import numpy as np import pandas as pd import matplotlib.pyplot as plt import plotting from statsmodels.tsa.stattools import adfuller from statsmodels.graphics.tsaplots import plot_acf,...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt from os import listdir, mkdir import numpy as np from shutil import copy2 # reproducible randomness from numpy.random import RandomState df = pd.read_csv('./training_solutions_rev1.csv') print(df.count()) # show total number of samples print(df.head()) # showcase...
github_jupyter
# Ray RLlib - Overview © 2019-2020, Anyscale. All Rights Reserved ![Anyscale Academy](../images/AnyscaleAcademyLogo.png) ## Join Us at Ray Summit 2020! Join us for the [_free_ Ray Summit 2020 virtual conference](https://events.linuxfoundation.org/ray-summit/?utm_source=dean&utm_medium=embed&utm_campaign=ray_summit&...
github_jupyter
# 🌋 Quick Feature Tour [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RelevanceAI/RelevanceAI-readme-docs/blob/v2.0.0/docs/getting-started/_notebooks/RelevanceAI-ReadMe-Quick-Feature-Tour.ipynb) ### 1. Set up Relevance AI Get started using our R...
github_jupyter
![Brazil Flag](http://www.brazil.org.za/brazil-images/brazil-flag.png) ### <center> **Chukwuemeka Mba-Kalu** </center> <center> **Joseph Onwughalu** </center> ### <center> **An Analysis of the Brazilian Economy between 2000 and 2012** </center> #### <center> Final Project In Partial Fulfillment of the Course Requireme...
github_jupyter
``` # Allow us to load `open_cp` without installing import sys, os.path sys.path.insert(0, os.path.abspath(os.path.join("..", ".."))) ``` # Chicago data The data can be downloaded from https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 (see the module docstring of `open_cp.sources.chicago` See also https:...
github_jupyter
# Build and Evaluate a Linear Risk model Welcome to the first assignment in Course 2! ## Outline - [1. Import Packages](#1) - [2. Load Data](#2) - [3. Explore the Dataset](#3) - [4. Mean-Normalize the Data](#4) - [Exercise 1](#Ex-1) - [5. Build the Model](#Ex-2) - [Exercise 2](#Ex-2) - [6. Evaluate the Model...
github_jupyter
# CHEM 1000 - Spring 2022 Prof. Geoffrey Hutchison, University of Pittsburgh ## 1. Functions and Coordinate Sets Chapter 1 in [*Mathematical Methods for Chemists*](http://sites.bu.edu/straub/mathematical-methods-for-molecular-science/) By the end of this session, you should be able to: - Handle 2D polar and 3D spher...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
# Example for an analytical solution of weakly scattering sphere in Python In this example the analytical solution for a weakly scattering sphere is based on Anderson, V. C., "Sound scattering from a fluid sphere", J. Acoust. Soc. America, 22 (4), pp 426-431, July 1950 is computed in it's original form and the simpl...
github_jupyter
# Zipline Pipeline ### Introduction On any given trading day, the entire universe of stocks consists of thousands of securities. Usually, you will not be interested in investing in all the stocks in the entire universe, but rather, you will likely select only a subset of these to invest. For example, you may only wa...
github_jupyter
# Network waterfall generation ``` import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt %matplotlib inline from math import sqrt import re, bisect from colorama import Fore ``` ## Select input file and experiment ID (~10 experiments per file) - ./startup : Application startu...
github_jupyter
# Machine Learning for Telecom with Naive Bayes # Introduction Machine Learning for CallDisconnectReason is a notebook which demonstrates exploration of dataset and CallDisconnectReason classification with Spark ml Naive Bayes Algorithm. ``` from pyspark.sql.types import * from pyspark.sql import SparkSession from s...
github_jupyter
# Recommending products with RetailRocket event logs This IPython notebook illustrates the usage of the [ctpfrec](https://github.com/david-cortes/ctpfrec/) Python package for _Collaborative Topic Poisson Factorization_ in recommender systems based on sparse count data using the [RetailRocket](https://www.kaggle.com/re...
github_jupyter
``` import numpy as np import seaborn as sns import pandas as pd import matplotlib.pyplot as plt plt.rcParams['axes.titlesize'] = 20 plt.rcParams['axes.titleweight'] = 10 ``` ## 1. Dataset Read ``` df = pd.read_csv("haberman.csv") df.head() ``` ## 2. Basic Analysis ``` print("No. of features are in given dataset :...
github_jupyter
# Continuous Control --- In this notebook, you will learn how to use the Unity ML-Agents environment for the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program. ### 1. Start the Environment We begin by importing the ne...
github_jupyter
# Introduction to Python part IV (And a discussion of linear transformations) ## Activity 1: Discussion of linear transformations * Orthogonality also plays a key role in understanding linear transformations. How can we understand linear transformations in terms of a composition of rotations and diagonal matrices? ...
github_jupyter
# 人脸检测 人脸检测,顾名思义,从图像中找到人脸。这是计算机视觉中一个非常经典的物体检测问题。经典人脸检测算法如Viola-Jones算法已经内置在OpenCV中,一度是使用OpenCV实现人脸检测的默认方案。不过OpenCV最新发布的4.5.4版本中提供了一个全新的基于神经网络的人脸检测器。这篇笔记展示了该检测器的使用方法。 ## 准备工作 首先载入必要的包,并检查OpenCV版本。 如果你还没有安装OpenCV,可以通过如下命令安装: ```bash pip install opencv-python ``` ``` import cv2 from PIL import Image print(f"你需要Open...
github_jupyter
<a href="https://colab.research.google.com/github/Eurus-Holmes/PyTorch-Tutorials/blob/master/Training_a__Classifier.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %matplotlib inline ``` Training a Classifier ===================== This is it....
github_jupyter
# Direct Outcome Prediction Model Also known as standardization ``` %matplotlib inline from sklearn.linear_model import LinearRegression from sklearn.ensemble import GradientBoostingRegressor from causallib.datasets import load_smoking_weight from causallib.estimation import Standardization, StratifiedStandardization...
github_jupyter
# Accessing data in a DataSet After a measurement is completed all the acquired data and metadata around it is accessible via a `DataSet` object. This notebook presents the useful methods and properties of the `DataSet` object which enable convenient access to the data, parameters information, and more. For general ov...
github_jupyter
## Interacting with CerebralCortex Data Cerebral Cortex is MD2K's big data cloud tool designed to support population-scale data analysis, visualization, model development, and intervention design for mobile-sensor data. It provides the ability to do machine learning model development on population scale datasets and p...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
``` from fastai.vision.all import * from moving_mnist.models.conv_rnn import * from moving_mnist.data import * if torch.cuda.is_available(): torch.cuda.set_device(1) print(torch.cuda.get_device_name()) ``` # Train Example: We wil predict: - `n_in`: 5 images - `n_out`: 5 images - `n_obj`: up to 3 objects ``...
github_jupyter
``` from __future__ import print_function import keras from keras.models import Sequential, Model, load_model import keras.backend as K import tensorflow as tf import pandas as pd import os import pickle import numpy as np import scipy.sparse as sp import scipy.io as spio import isolearn.io as isoio from scipy.st...
github_jupyter
*** *** # Introduction to Gradient Descent The Idea Behind Gradient Descent 梯度下降 *** *** <img src='./img/stats/gradient_descent.gif' align = "middle" width = '400px'> <img align="left" style="padding-right:10px;" width ="400px" src="./img/stats/gradient2.png"> **如何找到最快下山的路?** - 假设此时山上的浓雾很大,下山的路无法确定; - 假设你摔不死! ...
github_jupyter
# What is probability? A simulated introduction ``` #Import packages import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline sns.set() ``` ## Learning Objectives of Part 1 - To have an understanding of what "probability" means, in both Bayesian and Frequentist ...
github_jupyter
# *Quick, Draw!* GAN In this notebook, we use Generative Adversarial Network code (adapted from [Rowel Atienza's](https://github.com/roatienza/Deep-Learning-Experiments/blob/master/Experiments/Tensorflow/GAN/dcgan_mnist.py) under [MIT License](https://github.com/roatienza/Deep-Learning-Experiments/blob/master/LICENSE)...
github_jupyter
<a href="https://colab.research.google.com/github/AaronGe88inTHU/dreye-thu/blob/master/DataGenerator.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/drive') import numpy as np import cv2 from ...
github_jupyter
# 執行語音轉文字服務操作 ``` import azure.cognitiveservices.speech as speechsdk # Creates an instance of a speech config with specified subscription key and service region. # Replace with your own subscription key and region identifier from here: https://aka.ms/speech/sdkregion speech_key, service_region = "196f2f318dc744049eaf...
github_jupyter
``` import numpy as np import gym import k3d from ratelimiter import RateLimiter from k3d.platonic import Cube from time import time rate_limiter = RateLimiter(max_calls=4, period=1) env = gym.make('CartPole-v0') observation = env.reset() plot = k3d.plot(grid_auto_fit=False, camera_auto_fit=False, grid=(-1,-1,-1,1,1...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib.image as mpimg import pickle import numpy as np import cv2 from moviepy.editor import VideoFileClip import math import glob class Left_Right: last_L_points = [] last_R_points = [] def __init__(self, last_L_points, last_R_points): self.last_L...
github_jupyter
# Getting started ## Installing Python It is recommended that you install the full Anaconda Python 3.8, as it set up your Python environment, together with a bunch of often used packages that you'll use during this course. A guide on installing Anaconda can be found here: https://docs.anaconda.com/anaconda/install/. ...
github_jupyter
``` !pip install efficientnet #import the libraries needed import pandas as pd import numpy as np import os import cv2 from tqdm import tqdm_notebook as tqdm import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from keras_preprocessing.image import ImageDataGenerator from tensorflo...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import seaborn as sns from sklearn import datasets from sklearn import metrics from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier ...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '3' from tensor2tensor.data_generators import problem from tensor2tensor.data_generators import text_problems from tensor2tensor.data_generators import translate from tensor2tensor.layers import common_attention from tensor2tensor.utils import registry from tensor2ten...
github_jupyter
# Preprocess "ROC Stories" for Story Completion ``` %load_ext autoreload %autoreload 2 %matplotlib inline import os import glob import pandas as pd DATAPATH = '/path/to/ROCStories' ROCstory_spring2016 = pd.read_csv(os.path.join(DATAPATH, "ROCStories__spring2016 - ROCStories_spring2016.csv")) ROCstory_winter2017 = pd....
github_jupyter
# Part 2: Introduction to Umami and the `Residual` Class Umami is a package for calculating metrics for use with for Earth surface dynamics models. This notebook is the second notebook in a three-part introduction to using umami. ## Scope of this tutorial Before starting this tutorial, you should have completed [Par...
github_jupyter
``` import pickle as pk import pandas as pd %pylab inline y_dic = pk.load(open("labelDic.cPickle","rb")) X_dic = pk.load(open("vectorDicGDIpair.cPickle","rb")) df = pd.read_csv('dida_v2_full.csv', index_col=0).replace('CO', 1).replace('TD', 0).replace('UK', -1) rd = np.vectorize(lambda x: round(x * 10)/10) essA_change...
github_jupyter
# Operations on word vectors Welcome to your first assignment of this week! Because word embeddings are very computionally expensive to train, most ML practitioners will load a pre-trained set of embeddings. **After this assignment you will be able to:** - Load pre-trained word vectors, and measure similarity usi...
github_jupyter
# Introduction # In this exercise, you'll work through several applications of PCA to the [*Ames*](https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data) dataset. Run this cell to set everything up! ``` # Setup feedback system from learntools.core import binder binder.bind(globals()) from learnto...
github_jupyter
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/> # LinkedIn - Send posts feed to gsheet <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/LinkedIn/LinkedIn_Send_posts_feed_to_gsheet.i...
github_jupyter
``` import numpy as np import matplotlib import matplotlib.pyplot as plt def N_single_qubit_gates_req_Rot(N_system_qubits, set_size): return (2*N_system_qubits+1)*(set_size-1) def N_CNOT_gates_req_Rot(N_system_qubits, set_size): return 2*(N_system_qubits-1)*(set_size-1) def N_cV_gates_req_LCU(N_system_qubits, s...
github_jupyter
<a href="https://colab.research.google.com/github/prithwis/KKolab/blob/main/KK_B2_Hadoop_and_Hive.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ![alt text](https://4.bp.blogspot.com/-gbL5nZDkpFQ/XScFYwoTEII/AAAAAAAAAGY/CcVb_HDLwvs2Brv5T4vSsUcz7O4r...
github_jupyter
# what's the neuron yield across probes, experimenters and recording sites? Anne Urai & Nate Miska, 2020 ``` # GENERAL THINGS FOR COMPUTING AND PLOTTING import pandas as pd import numpy as np import os, sys, time import scipy as sp # visualisation import matplotlib.pyplot as plt import seaborn as sns # ibl specific ...
github_jupyter
# Measurement Error Mitigation ## Introduction The measurement calibration is used to mitigate measurement errors. The main idea is to prepare all $2^n$ basis input states and compute the probability of measuring counts in the other basis states. From these calibrations, it is possible to correct the average result...
github_jupyter
# FINN - Functional Verification of End-to-End Flow ----------------------------------------------------------------- **Important: This notebook depends on the tfc_end2end_example notebook, because we are using models that are available at intermediate steps in the end-to-end flow. So please make sure the needed .onnx...
github_jupyter
``` import tensorflow as tf from tensorflow.compat.v1 import ConfigProto from tensorflow.compat.v1 import InteractiveSession config = ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.5 config.gpu_options.allow_growth = True session = InteractiveSession(config=config) # import the libraries as shown...
github_jupyter
``` from birdcall.data import * from birdcall.metrics import * from birdcall.ops import * import torch import torchvision from torch import nn import numpy as np import pandas as pd from pathlib import Path import soundfile as sf BS = 16 MAX_LR = 1e-3 classes = pd.read_pickle('data/classes.pkl') splits = pd.read_pickl...
github_jupyter
# 作業 : (Kaggle)鐵達尼生存預測 https://www.kaggle.com/c/titanic # 作業1 * 參考範例,將鐵達尼的船票票號( 'Ticket' )欄位使用特徵雜湊 / 標籤編碼 / 目標均值編碼三種轉換後, 與其他數值型欄位一起預估生存機率 ``` # 做完特徵工程前的所有準備 (與前範例相同) import pandas as pd import numpy as np import copy, time from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import cross_val_...
github_jupyter
### What if we buy a share every day at the highest price? ``` import pandas as pd %matplotlib inline import matplotlib.pyplot as plt symbols = ['ABBV','AAPL','ADBE','APD','BRK-B','COST','CTL','DRI','IRM','KIM','MA','MCD','NFLX','NVDA','SO','V','VLO'] dates = ['2018-01-01', '2018-12-31'] data_directory = './data/hist...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
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
# Tutorial 3 of 3: Advanced Topics and Usage **Learning Outcomes** * Use different methods to add boundary pores to a network * Manipulate network topology by adding and removing pores and throats * Explore the ModelsDict design, including copying models between objects, and changing model parameters * Write a custom...
github_jupyter
<a href="https://colab.research.google.com/github/DingLi23/s2search/blob/pipelining/pipelining/exp-cshc/exp-cshc_cshc_1w_ale_plotting.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Experiment Description > This notebook is for experiment \<ex...
github_jupyter
``` from torchvision.models import * import wandb from sklearn.model_selection import train_test_split import os,cv2 import numpy as np import matplotlib.pyplot as plt from torch.optim import * from torch.nn import * import torch,torchvision from tqdm import tqdm device = 'cuda' PROJECT_NAME = 'Musical-Instruments-Imag...
github_jupyter
# (Optional) Testing the Function Endpoint with your Own Audio Clips Instead of using pre-recorded clips we show you in this notebook how to invoke the deployed Function with your **own** audio clips. In the cells below, we will use the [PyAudio library](https://pypi.org/project/PyAudio/) to record a short 1 second...
github_jupyter
![Logo_unad](https://upload.wikimedia.org/wikipedia/commons/5/5f/Logo_unad.png) <font size=3 color="midnightblue" face="arial"> <h1 align="center">Escuela de Ciencias Básicas, Tecnología e Ingeniería</h1> </font> <font size=3 color="navy" face="arial"> <h1 align="center">ECBTI</h1> </font> <font size=2 color="darkor...
github_jupyter
# Import Libraries ``` import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize ``` # Sentences ``` sentence = [("the", "DT"), ("little", "JJ"), ("yellow", "JJ"),("dog", "NN"), ("barked", "VBD"), ("at", "IN"), ("the", "DT"), ("cat", "NN")] sentence2 = "Four score and sev...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.st...
github_jupyter
# Segregation Index Decomposition ## Table of Contents * [Decomposition framework of the PySAL *segregation* module](#Decomposition-framework-of-the-PySAL-*segregation*-module) * [Map of the composition of the Metropolitan area of Los Angeles](#Map-of-the-composition-of-the-Metropolitan-area-of-Los-Angeles) * [Map o...
github_jupyter
#Given a budget of 30 million dollar (or less) and genre, can I predict gross domestic profit using linear regression? ``` %matplotlib inline import pickle from pprint import pprint import pandas as pd import numpy as np from dateutil.parser import parse import math # For plotting import seaborn as sb import matplotli...
github_jupyter
## Import a model from ONNX and run using PyTorch We demonstrate how to import a model from ONNX and convert to PyTorch #### Imports ``` import os import operator as op import warnings; warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np import torch from torch import nn from torch.nn...
github_jupyter
# Building Simple Neural Networks In this section you will: * Import the MNIST dataset from Keras. * Format the data so it can be used by a Sequential model with Dense layers. * Split the dataset into training and test sections data. * Build a simple neural network using Keras Sequential model and Dense layers. * Tra...
github_jupyter
``` from PIL import Image import numpy as np import matplotlib.pyplot as plt from scipy import stats import math %matplotlib inline ``` # Volunteer 1 ## 3M Littmann Data ``` image = Image.open('3Ms.bmp') image x = image.size[0] y = image.size[1] print(x) print(y) matrix = [] points = [] integrated_density = 0 for i...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` Volumetric Analysis =================== Calculate mass properties such as the volume or area of datasets ``` # sphinx_gallery_thumbnail_number = 4 import numpy as np from pyvista import examples ``` Computing mass properties su...
github_jupyter
# Exemplo sobre a correlação cruzada A correlação cruzada é definida por \begin{equation} R_{xy}(\tau)=\int_{-\infty}^{\infty}x(t)y(t+\tau)\mathrm{d} t \tag{1} \end{equation} Considerede um navio a navegar por águas não muito conhecidas. Para navegar com segurança, o navio necessita ter uma noção da profundidade da ...
github_jupyter
``` #Python Basics #Functions in Python #Functions take some inputs, then they produce some outputs #The functions are just a piece of code that you can reuse #You can implement your functions, but in many cases, people reuse other people's functions #in this case, it is important how the function work and how we can i...
github_jupyter
``` #Import section import numpy as np import cv2 import glob import matplotlib.pyplot as plt import pickle %matplotlib inline # Loading camera calibration coefficients(matrix and camera coefficients) from pickle file def getCameraCalibrationCoefficientsFromPickleFile(filePath): cameraCalibration = pickle.load( ope...
github_jupyter
``` import numpy as np import re import pandas as pd from sklearn.preprocessing import StandardScaler, MinMaxScaler from sklearn.decomposition import PCA from sklearn.cluster import KMeans, DBSCAN from sklearn.neighbors import NearestNeighbors from requests import get import unicodedata from bs4 import BeautifulSoup im...
github_jupyter
# Import and convert Neo23x0 Sigma scripts ianhelle@microsoft.com This notebook is a is a quick and dirty Sigma to Log Analytics converter. It uses the modules from sigmac package to do the conversion. Only a subset of the Sigma rules are convertible currently. Failure to convert could be for one or more of these rea...
github_jupyter
``` %matplotlib inline import re import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from numpy import nan from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.wait import WebDriverWait ## create a pandas dataframe...
github_jupyter
``` %pushd ../../ %env CUDA_VISIBLE_DEVICES=3 import json import os import sys import tempfile from tqdm.auto import tqdm import torch import torchvision from torchvision import transforms from PIL import Image import numpy as np torch.cuda.set_device(0) from netdissect import setting segopts = 'netpqc' segmodel, se...
github_jupyter
# How do distributions transform under a change of variables ? Kyle Cranmer, March 2016 ``` %pylab inline --no-import-all ``` We are interested in understanding how distributions transofrm under a change of variables. Let's start with a simple example. Think of a spinner like on a game of twister. <!--<img src="ht...
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
[<img src="https://deepnote.com/buttons/launch-in-deepnote-small.svg">](https://deepnote.com/launch?url=https%3A%2F%2Fgithub.com%2Fgordicaleksa%2Fget-started-with-JAX%2Fblob%2Fmain%2FTutorial_4_Flax_Zero2Hero_Colab.ipynb) <a href="https://colab.research.google.com/github/gordicaleksa/get-started-with-JAX/blob/main/Tut...
github_jupyter
``` import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt plt.style.use('ggplot') import torch print(torch.__version__) import torch.nn as nn import torch.optim as optim import torch.utils.data as data_utils from torch.utils.d...
github_jupyter
``` # Initialize Otter Grader import otter grader = otter.Notebook() ``` ![data-x](https://raw.githubusercontent.com/afo/data-x-plaksha/master/imgsource/dx_logo.png) # In-class Assignment (Feb 9) Run the following two cells to load the required modules and read the data. ``` import pandas as pd import numpy as np ...
github_jupyter
# SLU10 - Classification: Exercise notebook ``` import pandas as pd import numpy as np ``` In this notebook you will practice the following: - What classification is for - Logistic regression - Cost function - Binary classification You thought that you would get away without implementing your ...
github_jupyter
# Railroad Diagrams The code in this notebook helps with drawing syntax-diagrams. It is a (slightly customized) copy of the [excellent library from Tab Atkins jr.](https://github.com/tabatkins/railroad-diagrams), which unfortunately is not available as a Python package. **Prerequisites** * This notebook needs some ...
github_jupyter
``` # Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
github_jupyter
# Distributed Training with Keras ## Import dependencies ``` import tensorflow_datasets as tfds import tensorflow as tf from tensorflow import keras import os print(tf.__version__) ``` ## Dataset - Fashion MNIST ``` #datasets, info = tfds.load(name='mnist', with_info=True, as_supervised=True) #mnist_train, mnist_t...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd ``` Manually Principal Component Analysis ``` #Reading wine data df_wine = pd.read_csv('https://archive.ics.uci.edu/ml/' 'machine-learning-databases/wine/wine.data', header=None) # in the data first...
github_jupyter