text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import tensorflow as tf import numpy as np import os import time import datetime import manage_data from text_network import TextNetwork from tensorflow.contrib import learn ``` ### Set Parameters ``` # Model Hyperparameters tf.flags.DEFINE_integer("embedding_dim", 128, "Dimensionality of character embedding (d...
github_jupyter
# PLOT Notes # Matplib - generating plots concoiusly 2019.07.12. based on https://dev.to/skotaro/artist-in-matplotlib---something-i-wanted-to-know-before-spending-tremendous-hours-on-googling-how-tos--31oo ## Pyplot and object-oriented API these are two different coding styles to make plots in matplolib, Object-...
github_jupyter
# Control Flow Graph The code in this notebook helps with obtaining the control flow graph of python functions. **Prerequisites** * This notebook needs some understanding on advanced concepts in Python, notably * classes ## Control Flow Graph The class `PyCFG` allows one to obtain the control flow graph. ```...
github_jupyter
``` import numpy as np from scipy import spatial def evaluate_tour_len(x,d): ''' x: solution d: DxD matrix of Euclidean distance ''' L = 0 for i in range(len(x)-1): # print(x[i],x[i+1]) L += d[x[i],x[i+1]] # print(d[x[i],x[i+1]],L) L += d[len(x)-1,0] # print(d[x[l...
github_jupyter
# Setup ``` import sys import os import re import collections import itertools import bcolz import pickle sys.path.append('../../lib') sys.path.append('../') import numpy as np import pandas as pd import gc import random import smart_open import h5py import csv import json import functools import time import string ...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/W2D1-postcourse-bugfix/tutorials/W2D2_LinearSystems/W2D2_Tutorial4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy 2020, Week 2, Day 2, Tuto...
github_jupyter
# Plagiarism Detection Model Now that you've created training and test data, you are ready to define and train a model. Your goal in this notebook, will be to train a binary classification model that learns to label an answer file as either plagiarized or not, based on the features you provide the model. This task wi...
github_jupyter
``` % pylab inline from __future__ import print_function import os.path import pandas import src import sklearn import os import scipy import scipy.stats def fake(*args, **kwargs): print('Fake called with', str(args), str(kwargs)) sys.exit(1) # fake out the create_model so we don't accidentally attempt to crea...
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
``` import tensorflow as tf import keras from keras.applications import DenseNet201 import numpy as np from keras.preprocessing.image import ImageDataGenerator, NumpyArrayIterator from keras.callbacks import EarlyStopping, ModelCheckpoint from sklearn.metrics import confusion_matrix from keras import models, layers, o...
github_jupyter
<a href="https://colab.research.google.com/github/Ramaseshanr/ANLP/blob/master/CosDistance.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # MIT License # Copyright (c) 2019. # from numpy import * from numpy import dot from numpy.linalg impo...
github_jupyter
``` from NewsContent import * from UserContent import * from preprocessing import * from PEGenerator import * import PEGenerator from models import * from utils import * from Encoders import * import os import numpy as np import json import random data_root_path = None embedding_path = None KG_root_path = None popular...
github_jupyter
``` import numpy as np import pandas as pd import math import sklearn from sklearn.cross_validation import cross_val_score from subprocess import check_output from sklearn.metrics import make_scorer, mean_squared_error from sklearn.cross_validation import train_test_split from sklearn.preprocessing import normalize ...
github_jupyter
``` from nltk.book import * text2.common_contexts(["monstrous", "very"]) ``` 1. Try using the Python interpreter as a calculator, and typing expressions like 12 / (4 + 1). ``` 12 / (4 + 1) ``` 2. Given an alphabet of 26 letters, there are 26 to the power 10, or 26 ** 10, ten-letter strings we can form. That works ou...
github_jupyter
# Bring your own data to create a music genre model for AWS DeepComposer --- This notebook is for the <b>Bring your own data to create a music genre model for AWS DeepComposer</b> blog and is associated with the <b> AWS DeepComposer: Train it Again Maestro </b> web series on the <b>A Cloud Guru</b> platform. Th...
github_jupyter
``` import os import re import sklearn import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from collections import Counter from sklearn.metrics import * from sklearn.linear_model import * from sklearn.model_selection import * pd.set_option('display.max_columns', None) # DATA_...
github_jupyter
<a href="https://colab.research.google.com/github/dcshapiro/AI-Feynman/blob/master/AI_Feynman_cleared_output.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # AI Feynman 2.0: Learning Regression Equations From Data ### Clone repository and install ...
github_jupyter
# oneDPL- Gamma Correction example #### Sections - [Gamma Correction](#Gamma-Correction) - [Why use buffer iterators?](#Why-use-buffer-iterators?) - _Lab Exercise:_ [Gamma Correction](#Lab-Exercise:-Gamma-Correction) - [Image outputs](#Image-outputs) ## Learning Objectives * Build a sample __DPC++ application__ to p...
github_jupyter
``` import healpy as hp import numpy as np %matplotlib inline import matplotlib.pyplot as plt import astropy.units as u ``` # White noise NET in Radio-astronomy and Cosmology > Create a white noise map and compare with power spectrum expected from the NET - categories: [cosmology, python, healpy] Noise-Equivalent-Tem...
github_jupyter
**TASK-3 Exploratory Data Analysis - Retail** **IMPORTING THE LIBRARIES** ``` import numpy as np # linear algebra import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline ``` **LOADING THE DATASET** ``` df= pd.read_csv("/content/sample_data/SampleSuperstore.csv") df.head() ``` ...
github_jupyter
# GGS416 Satellite Image Analysis In this tutorial we are going to cover: - Spatial referencing systems. - Satellite image metadata. ## Working with a Coordinate Reference System (CRS) We need to be able to map data points to precise locations across space. Indeed, this underpins our ability to process and analyze s...
github_jupyter
# Regression Week 3: Assessing Fit (polynomial regression) In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will: * Write a function to take an SArray and a degree and retur...
github_jupyter
``` # Import all the necessary files! import os import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import Model # Download the inception v3 weights !wget --no-check-certificate \ https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \ ...
github_jupyter
## Import Libraries and Read Dataset ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap #machine learning libraries from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split, GridSe...
github_jupyter
# LFD Homework 2 Second week homework for the "Learning from Data" course offerd by [Caltech on edX](https://courses.edx.org/courses/course-v1:CaltechX+CS1156x+3T2017). This notebook only contains the simulation / exploration problems. ``` import numpy as np import matplotlib.pyplot as plt import seaborn as sns %mat...
github_jupyter
# Creating the action server In this section, we'll discuss **demo_action_server.py**. The action server receives a goal value that is a number. When the server gets this goal value, it'll start counting from zero to this number. If the counting is complete, it'll successfully finish the action, if it is preempted bef...
github_jupyter
<h1> Create TensorFlow model </h1> This notebook illustrates: <ol> <li> Creating a model using the high-level Estimator API </ol> ``` !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.1 # change these to try this...
github_jupyter
# seq2seq构建写对联AI ### 代码参考:[seq2seq-couplet](https://github.com/wb14123/seq2seq-couplet) ### 问题背景介绍 对联又称对子,对仗工整,平仄协调,是一字一音的汉文语言独特的艺术形式,是中国传统文化瑰宝。对联的上下联有着非常工整的对应关系,我们可以尝试使用神经网络学习对应关系,进而完成对对联任务,而之前提到的seq2seq模型,是非常典型的序列映射学习模型,可以在本场景下使用。 ![](../img/couplet.jpeg) ### seq2seq对对联 ##### \[稀牛学院 x 网易云课程\]《AI工程师(自然语言处理方向)》课程资料 ...
github_jupyter
# Distributed DeepRacer RL training with SageMaker and RoboMaker --- ## Introduction This notebook is an enhanced version of [AWS DeepRacer](https://console.aws.amazon.com/deepracer/home#welcome), for AIDO-3 NeurIPS DeepRacer challenge. The notebook is an expansion of the original [Amazon SageMaker notebook](https:...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/projects/modelingsteps/ModelingSteps_1through4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Modeling Steps 1 - 4 **By Neuromatch Academy** __Conte...
github_jupyter
# Artificial Intelligence Nanodegree ## Convolutional Neural Networks --- In this notebook, we train a CNN to classify images from the CIFAR-10 database. ### 1. Load CIFAR-10 Database ``` import keras from keras.datasets import cifar10 # load the pre-shuffled train and test data (x_train, y_train), (x_test, y_tes...
github_jupyter
``` from __future__ import division, print_function, absolute_import ``` # Introduction to Visualization: Density Estimation and Data Exploration ======== ##### Version 0.1 There are many flavors of data analysis that fall under the "visualization" umbrella in astronomy. Today, by way of example, we will focus on 2 ...
github_jupyter
# Part 9: Train an Encrypted NN on Encrypted Data In this notebook, we're going to use all the techniques we've learned thus far to perform neural network training (and prediction) while both the model and the data are encrypted. Note that Autograd is not *yet* supported for encrypted variables, thus we'll have to ro...
github_jupyter
``` import os import numpy as np import pandas as pd import importlib as imp from tqdm import tqdm, tqdm_notebook import warnings warnings.simplefilter('ignore') pd.options.display.max_columns = 100 ``` - **p01_c.txt**, the knapsack capacity. <br> - **p01_w.txt**, the weights of the objects. <br> - **p01_p.txt**, th...
github_jupyter
We ran a Nadaraya-Watson photo-z algorithm from astroML's implementation trained on four photometry bands from DES's science verification data release. This notebook produces a comparison of the photometric redshift estimates reported by DES (described in Bonnett et al. 2015.), our Nadaraya-Watson redshift estimates b...
github_jupyter
``` import kalman import observation_helpers reload(observation_helpers) def ConstructFilter(csvfile, obs_noise, system_noise, start_obs=2000, stop_obs=2500, dt=.25, dim_u=0): ''' Construct the Kalman filter instance for a cluster of sensors. Parameters ---------- csvfil...
github_jupyter
``` # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
github_jupyter
### GluonTS Callbacks This notebook illustrates how one can control the training with GluonTS Callback's. A callback is a function which gets called at one or more specific hook points during training. You can use predefined GluonTS callbacks like the logging callback TrainingHistory, ModelAveraging or TerminateOnNaN, ...
github_jupyter
``` import math import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F class Encoder(nn.Module): def __init__(self, seq_len, input_size, enc_hid_dim, num_gru, dec_hid_dim, dropout_rate, device, use_pooling=False): super().__init__() self.seq...
github_jupyter
``` import pandas as pd star_wars = pd.read_csv("star_wars.csv", encoding = 'ISO-8859-1') star_wars.head(10) star_wars.columns # Removing NaN rows of RespondentIDs print(star_wars.shape) star_wars = star_wars[pd.notnull(star_wars['RespondentID'])] print(star_wars.shape) yes_no = { "Yes" : True, "No" : False, } ...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Tutorial #2: Deploy an image classification model in Azure Container Instance (ACI) This tutorial is **part two of a two-part tutorial series**. In the [previous tutorial](img-classification-part1-training.ipynb), you traine...
github_jupyter
# Training on CIFAR-10 data ## Define the model We now define the `DeepNN` model and several functions that load and prepare the data. Finally, we arrive at the function `setup_and_train`, that defines, trains and evaluates the model, and takes the following parameters as input: `activation` : Defines activations: C...
github_jupyter
### OkCupid DataSet: Classify using combination of text data and metadata ### Meeting 5, 03- 03- 2020 ### Recap last meeting's decisions: <ol> <p>Meeting 4, 28- 01- 2020</p> <li> Approach 1: </li> <ul> <li>Merge classs 1, 3 and 5</li> <li>Under sample class 6 </li> <li> Merge classes 6, 7, 8</li>...
github_jupyter
# Model Selection, Overfitting and Regularization This tutorial is meant to be a gentle introduction to machine learning concepts. We present a simple polynomial fitting example using a least squares solution, which is a specific case of what is called maximum likelihood, but we will not get into details about this pr...
github_jupyter
## Анализ результатов AB тестирования * проанализировать АБ тест, проведенный на реальных пользователях Яндекса * подтвердить или опровергнуть наличие изменений в пользовательском поведении между контрольной (control) и тестовой (exp) группами * определить характер этих изменений и практическую значимость вводимог...
github_jupyter
``` #|hide #|skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #|all_slow #|default_exp callback.comet #|export from __future__ import annotations import tempfile from fastai.basics import * from fastai.learner import Callback #|hide from nbdev.showdoc import * ``` # Comet.ml > Integratio...
github_jupyter
## Flight Price Prediction ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set() ``` ## Importing Dataset 1. Since data is in form of excel file we have to use pandas read_excel to load the data 2. After loading it is important to check the complete information o...
github_jupyter
### This notebook is used to perform gridsearch on asia dataset ``` %load_ext autoreload %autoreload 2 import numpy as np import pandas as pd from sdgym import benchmark from sdgym import load_dataset from xgboost import XGBClassifier from sklearn.neural_network import MLPClassifier from synthsonic.models.kde_copula_n...
github_jupyter
# Building the Best AND Gate Let's import everything: ``` from qiskit import * from qiskit.tools.visualization import plot_histogram %config InlineBackend.figure_format = 'svg' # Makes the images look nice from qiskit.providers.aer import noise import numpy as np ``` In Problem Set 1, you made an AND gate with quant...
github_jupyter
<img style="float: center;" src="../images/CI_horizontal.png" width="600"> <center> <span style="font-size: 1.5em;"> <a href='https://www.coleridgeinitiative.org'>Website</a> </span> </center> Ghani, Rayid, Frauke Kreuter, Julia Lane, Adrianne Bradford, Alex Engler, Nicolas Guetta Jeanrenaud, Graham He...
github_jupyter
``` %config IPCompleter.greedy = True %config InlineBackend.figure_format = 'retina' %matplotlib inline %load_ext tensorboard import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sn import tensorflow as tf from datetime import datetime pd.set_option('mode.chained_assignment', None)...
github_jupyter
``` import os import glob base_dir = os.path.join('F:/0Sem 7/ML Lab/flower dataset/flowers') daisy_dir = os.path.join(base_dir,'daisy') dandelion_dir = os.path.join(base_dir,'dandelion') rose_dir=os.path.join(base_dir,'rose') sunflower_dir=os.path.join(base_dir,'sunflower') tulip_dir=os.path.join(base_dir,'tulip') dais...
github_jupyter
# Seminar 15 # Conjugate gradient method ## Reminder 1. Newton method 2. Convergence theorem 4. Comparison with gradient descent 5. Quasi-Newton methods ## Linear system vs. unconstrained minimization problem Consider the problem $$ \min_{x \in \mathbb{R}^n} \frac{1}{2}x^{\top}Ax - b^{\top}x, $$ where $A \in \math...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras import seaborn as sns from os.path import join plt.style.use(["seaborn", "thesis"]) plt.rc("figure", figsize=(8,4)) ``` # Dataset ``` from SCFInitialGuess.utilities.dataset import extract_triu_batch, Abstract...
github_jupyter
# Publications markdown generator for academicpages Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter....
github_jupyter
## Extract v4 from Greengenes and build a blast DB ``` %%bash export DATA=~/Data export PAYCHECK_DATA=$DATA/paycheck qiime tools import \ --input-path $DATA/gg_13_8_otus/rep_set/99_otus.fasta \ --output-path $PAYCHECK_DATA/ref/99_otus.qza --type FeatureData[Sequence] qiime feature-classifier extract-reads \ ...
github_jupyter
# First Exploratory Notebook ## Used for Data Exploration in Listings Summary File ``` import pandas as pd import numpy as np import nltk import sklearn import string, re import urllib import seaborn as sbn import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split, GridSearchCV from sklearn...
github_jupyter
# Modeling and Simulation in Python Chapter 9 Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_ass...
github_jupyter
``` import os import sys import numpy as np import pandas as pd from geopy import distance import json import tensorflow as tf import warnings warnings.filterwarnings('ignore') tf.compat.v1.disable_eager_execution() ``` # Declare Current Directory ``` root_path = os.path.abspath(os.path.join('..')) ``` # Read Da...
github_jupyter
##### Copyright 2018 The TF-Agents 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 a...
github_jupyter
# ART1 demo Adaptive Resonance Theory Neural Networks by Aman Ahuja | github.com/amanahuja | twitter: @amanqa ## Overview Reminders: * ART1 accepts binary inputs only. * In this example: * We'll use 10x10 ASCII blocks to demonstrate ### [Load data] ``` import numpy as np data = np.array([" O ", ...
github_jupyter
``` ### MODULE 1 ### Basic Modeling in scikit-learn ``` ``` ### Seen vs. unseen data # The model is fit using X_train and y_train model.fit(X_train, y_train) # Create vectors of predictions train_predictions = model.predict(X_train) test_predictions = model.predict(X_test) # Train/Test Errors train_error = mae(y_tr...
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
<a href="https://colab.research.google.com/github/PWhiddy/jax-experiments/blob/main/nbody.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import jax.numpy as jnp from jax import jit from jax import vmap import jax from numpy import random import...
github_jupyter
# Training with Features From notebook 14, we now have radio features. From notebook 13, we now have astronomical features and potential host galaxies. It's now time to put all of these together into a set of vectors and train a classifier. I'll quickly go over the pipeline up to now. First, make sure you have MongoD...
github_jupyter
**[Introduction to Machine Learning Home Page](https://www.kaggle.com/learn/intro-to-machine-learning)** --- # Introduction Machine learning competitions are a great way to improve your data science skills and measure your progress. In this exercise, you will create and submit predictions for a Kaggle competition. ...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, the lanes on the road are detacted using Canny Edge Dectection and Hough Transform line detection. Meanwhile, I also use HSL color space, grayscaling, color selection ,color selection and Gaussian smoothing to ...
github_jupyter
``` import pandas as pd import numpy as np import re from tqdm import tqdm from common.bio.amino_acid import * pd.set_option('display.max_colwidth', -1) ``` ## Importing original uniprot file ``` #uniprot = pd.read_csv("../data/protein/cgan/data_sources/uniprot_all_not-hetero.tab", sep="\t").drop(["Entry","Entry name...
github_jupyter
attempt 1 ``` from openmmtools.testsystems import HostGuestExplicit hge = HostGuestExplicit() system, positions, topology = hge.system, hge.positions, hge.topology from qmlify.openmm_torch.force_hybridization import HybridSystemFactory from simtk import unit import qmlify qmlify hge.system.getForces() from openmmtools...
github_jupyter
# Customer Churn Analysis This notebook is using customer churn data from Kaggle (https://www.kaggle.com/sandipdatta/customer-churn-analysis) and has been adopted from the notebook available on Kaggle developed by SanD. The notebook will go through the following steps: 1. Import Dataset 2. Analyze the Data ...
github_jupyter
# Batch Job Analysis - Data Prepare - Extract from SMF *Note: for reference only, no input/output sample data file provided* **This sample notebook will demonstrate how to extract Batch Job log data from SMF Type 30 record and prepare for further analytics.** Input data file is n days of SMF Type 30 record collected...
github_jupyter
# Circuits ## Introduction The [Circuit class](../api/circuit.html) represents a circuit of arbitrary topology, consisting of an arbitrary number of N-ports [Networks](../api/network.html) connected together. Like in an electronic circuit simulator, the circuit must have one (or more) `Port` connected to the circuit. ...
github_jupyter
## Power analysis for: Reproducibility of cerebellum atrophy involvement in advanced ET. 1. Working with only MNI dataset will result in underpowered research: posthoc power analysis with alpha=0.05, et=38, nc=32 and effect size 0.61 (obtained from literature median, both 1-sided and 2-sided tests); 2. Incre...
github_jupyter
For classes with mostly new coders, the python section alone will take >75 minutes. Here is how I used 2 days on this: Day 1: Got through try/pair/share and stopped before loops. Day 2: 1. Answer Q&A. Tell them there is participation credit for offering website fixed. 1. Give 3 HW tips: google "csv pandas", look ...
github_jupyter
# NumPy NumPy ist ein Erweiterungsmodul für numerische Berechnungen mit Python. Es beinhaltet grundlegende Datenstrukturen, sprich Matrizen und mehrdimensionale Arrays. Selbst ist NumPy in C umgesetzt worden und bietet mithilfe der Python-Schnittstelle die Möglichkeit Berechnungen schnell durchzuführen. Die Module Sci...
github_jupyter
# Widgets Demonstration As well as providing working code that readers can experiment with, the textbook also provides a number of widgets to help explain specific concepts. This page contains a selection of these as an index. Run each cell to interact with the widget. **NOTE:** You will need to enable interactivity ...
github_jupyter
# CIFAR-10: Part 2 Welcome back! If you have not completed [Part 1](*), please do so before running the code in this notebook. In Part 2 we will assume you have the training and testing lmdbs, as well as the trained model .pb files from Part 1. As you may recall from Part 1, we created the dataset in the form of lmd...
github_jupyter
# Analyze Order Book Data ## Imports & Settings ``` import pandas as pd from pathlib import Path import numpy as np from collections import Counter from time import time from datetime import datetime, timedelta, time import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker...
github_jupyter
<a name="top"></a> <div style="width:1000 px"> <div style="float:right; width:98 px; height:98px;"> <img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_static/unidata_150x150.png" alt="Unidata Logo" style="height: 98px;"> </div> <h1>Siphon Overview</h1> <h3>Unidata Python Workshop</h3> <div...
github_jupyter
# Анализ оттока клиентов в сети фитнес-клубов Сеть фитнес-центров «Культурист-датасаентист» разрабатывает стратегию взаимодействия с клиентами на основе аналитических данных. Распространённая проблема фитнес-клубов и других сервисов — отток клиентов. Для фитнес-центра можно считать, что клиент попал в отток, если за...
github_jupyter
``` %matplotlib inline ``` ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projec...
github_jupyter
``` import pandas as pd import geopandas as gpd import seaborn as sns import matplotlib.pyplot as plt import husl from legendgram import legendgram import mapclassify from matplotlib_scalebar.scalebar import ScaleBar from matplotlib.colors import ListedColormap from random import shuffle from tqdm import tqdm clusters ...
github_jupyter
# Markov Chain Monte Carlo (MCMC) GPflow allows you to approximate the posterior over the latent functions of its models (and over the hyperparameters after setting a prior for those) using Hamiltonian Monte Carlo (HMC). ``` import numpy as np import matplotlib.pyplot as plt import gpflow from gpflow.test_util import...
github_jupyter
<a href="https://colab.research.google.com/github/carvalheirafc/imd0033_2018_2/blob/master/aula26/Lesson_26_Measures_of_Variability.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 1 - The Range So far we've focused entirely on summarizing distrib...
github_jupyter
``` # EOReader Imports import os import xarray as xr from eoreader.reader import Reader from eoreader.products import SensorType from eoreader.bands.alias import * from sertit import display reader = Reader() # Create logger import logging from sertit import logs logs.init_logger(logging.getLogger("eoreader")) # Set ...
github_jupyter
# Neural networks with PyTorch Deep learning networks tend to be massive with dozens or hundreds of layers, that's where the term "deep" comes from. You can build one of these deep networks using only weight matrices as we did in the previous notebook, but in general it's very cumbersome and difficult to implement. Py...
github_jupyter
# Graph Coloring with QAOA using PyQuil and Grove We are going to color a graph using the near-term algorithm QAOA. The canonical example of QAOA was to solve a MaxCut problem, but graph coloring can be seen as a generalization of MaxCut, which is really graph coloring with only k = 2 colors ## Sample problem: Graph ...
github_jupyter
``` import pandas as pd ``` ## Load in the "rosetta stone" file I made this file using QGIS, the open-source mapping software. I loaded in the US Census 2010 block-level shapefile for Cook and DuPage counties in IL and the Chicago police boundaries shapefile [from here](https://data.cityofchicago.org/Public-Safety/Bo...
github_jupyter
``` from typing import Union, Optional, Dict from pathlib import Path import json import pandas as pd from collections import defaultdict def read_file( data_filepath: Union[str, Path], site: str, network: str, inlet: Optional[str] = None, instrument: Optional[str] = "shinyei", ...
github_jupyter
``` !pip install --no-index ../input/global-wheels/numpy-1.20.0-cp37-cp37m-manylinux2010_x86_64.whl --find-links=../input/numpyv3 !pip install --no-index ../input/global-wheels/natsort-7.1.1-py3-none-any.whl --find-links=../input/natsort !pip install --no-index ../input/global-wheels/fastremap-1.11.1-cp37-cp37m-manylin...
github_jupyter
``` # from https://en.wikipedia.org/wiki/Inflation document_text = """ In economics, inflation (or less frequently, price inflation) is a general rise in the price level of an economy over a period of time.[1][2][3][4] When the general price level rises, each unit of currency buys fewer goods and services; consequentl...
github_jupyter
# Control and audit data exploration activities with Amazon SageMaker Studio and AWS Lake Formation This notebook accompanies the blog post "Control and audit data exploration activities with Amazon SageMaker Studio and AWS Lake Formation". The notebook demonstrates how to use SageMaker Studio along with Lake Formatio...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Detect sequential data > Marcos Duarte > Laboratory of Biomechanics and Motor Control ([http://demotu.org/](http://demotu.org/)) > Federal University of ABC, Brazil The function `detect_seq.py` detects initial and final indices of sequential data identical to parameter `value` (default = 0) in the 1D numpy arra...
github_jupyter
**Chapter 4 – Training Linear Models** _This notebook contains all the sample code and solutions to the exercices in chapter 4._ # Setup First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figur...
github_jupyter
# TensorBoard TensorBoard is the tensorflow's visualization tool which can be used to visualize the computation graph. It can also be used to plot various quantitative metrics and results of several intermediate calculations. Using tensorboard, we can easily visualize complex models which would be useful for debugging...
github_jupyter
# LassoLars Regression This Code template is for the regression analysis using a simple LassoLars Regression. It is a lasso model implemented using the LARS algorithm. ### Required Packages ``` import warnings import numpy as np import pandas as pd import seaborn as se import matplotlib.pyplot as plt from s...
github_jupyter
``` #default_exp data #export from timeseries_fastai.imports import * from timeseries_fastai.core import * from fastai.basics import * from fastai.torch_core import * from fastai.vision.data import get_grid ``` # Data > DataBlock API to construct the DataLoaders ``` #hide from nbdev.showdoc import show_doc ``` We wi...
github_jupyter
# Fine-Tuning *RoBERTa-small-bulgarian* For Named-Entity Recognition ``` %%capture !pip install transformers==3.0.2 import torch device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') print('Using device:', device) # Get the dataset !git clone https://github.com/usmiva/bg-ner ``` ## Data Preprocessi...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd from IPython.display import YouTubeVideo from functools import partial YouTubeVideo_formato = partial(YouTubeVideo, modestbranding=1, disablekb=0, width=640, height=360, autoplay=0, rel=0, showin...
github_jupyter