text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
<p style="font-size:14px; text-align: right">CoastWatch Python Exercises</p>
# Python Basics: a tutorial for the NOAA Satellite Workshop
> history | uodated May 2021
> owner | NOAA CoastWatch West Coast Node
## In this exercise, you will use Python to download data and metadata from ERDDAP.
### The exercise demo... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_parent" href="https://github.com/giswqs/geemap/tree/master/tutorials/Image/08_gradients.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_parent" href="https://n... | github_jupyter |
TSG094 - Grafana logs
=====================
Steps
-----
### Parameters
```
import re
tail_lines = 2000
pod = None # All
container = "grafana"
log_files = [ "/var/log/supervisor/log/grafana*.log" ]
expressions_to_analyze = []
```
### Instantiate Kubernetes client
```
# Instantiate the Python Kubernetes client in... | github_jupyter |
# Notebook to transform OSeMOSYS output to same format as EGEDA
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
from openpyxl import Workbook
import xlsxwriter
import pandas.io.formats.excel
import glob
import re
# Path for OSeMOSYS output
path_output = '../../data/3_OSeMOSYS_out... | github_jupyter |
```
import numpy as np
import tensorflow as tf
from sklearn.utils import shuffle
import re
import time
import collections
import os
import itertools
from dnc import DNC
from sklearn.cross_validation import train_test_split
def build_dataset(words, n_words, atleast=1):
count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['U... | github_jupyter |
# oneM2M - Subscriptions and Notifications - Notification Server
This notebook runs a small webserver to receive notifications from a CSE.
Please note that it is necessary to run this server in a separate notebook. Please refer to the second notebook on this topic for the requests.
**Note**: The server can only be r... | github_jupyter |
```
!pip install git+https://github.com/kornia/kornia@align_corners=False
!pip install pytorch_metric_learning
%matplotlib inline
%load_ext autoreload
%autoreload 2
import random
import numpy as np
from fastprogress.fastprogress import master_bar, progress_bar
from fastai2.basics import *
from fastcore import *
from f... | github_jupyter |
# Beyond Confounders
## Good Controls
We've seen how adding additional controls to our regression model can help identify causal effect. If the control is a confounder, adding it to the model is not just nice to have, but is a requirement. When the unwary see this, a natural response is to throw whatever he can meas... | github_jupyter |
# 07 Uncertainty Analysis
accuracy of pressure transducer $\pm 0.25 \%$ FS or $\pm 0.25 \%$ of reading.
Full scale 0-100 bar:
$\pm 0.25 \%$ of reading, and I read 1 bar, $u_P = 0.0025 \times P$, ie, 0.0025 bar. If $P = 10$ bar, $u_P = 0.025$ bar.
$\pm 0.25 \%$ FS (full scale), independent of $P$ measured, $u_P = 0... | github_jupyter |
```
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
```
## Load data
```
with open('data/anna.txt', 'r') as f:
text = f.read()
text[:100]
```
## Tokenization
We create a couple dictionaries to convert the characters to and from integers. Encoding the characters as integers m... | github_jupyter |
```
import numpy as np
import pandas as pd
from sklearn import tree
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from mlxtend.plotting import plot_confusion_matrix
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
#==========================================... | github_jupyter |
```
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
a_df = pd.read_csv("A.dat",header=None, index_col=None)
vs_df = pd.read_csv("vocabulary_size.dat",header=None, index_col=None)
#vs = vs_df.values.T[0]
#name='tcga [$<>=%.0f$, $\sigma=%.0f$]'%(np.average(vs),np.std(vs))
#vs=np.random.uniform... | github_jupyter |
# Pubtrends-experimental
Experimental notebook for hypothesis testing and development purposes.
```
from Bio import Entrez
Entrez.email = 'os@jetbrains.com'
QUERY = '((Aging) NOT (Review[Publication Type])) AND (("2015"[Date - Publication] : "2018"[Date - Publication]))'
handle = Entrez.esearch(db='pubmed', retmax='1... | github_jupyter |
# DSA Annotation
Digital Slide Archive (DSA) is an open-source web application where users can annotate regional and point annotations on the high power slide viewer. Luna Pathology CLIs pull the different annotation types from DSA, and save the annotations in GeoJSON format along with metadata. In this notebook, we w... | github_jupyter |
# Convolutional versus Dense layers in neural networks - Part 1
# Design, optimization and performance of the two networks
Convolutional layers in deep neural networks are known to have a dense (perceptron) equivalent. However, the topology of the convolutional layers is enforcing a parameter sharing: instead of copy... | github_jupyter |
EQE512 MATRIX METHODS IN STRUCTURAL ANALYSIS
---
<h3 align="center">Week 05 - Visualization of the Parametric Analysis Computations </h3>
<h4 align="center">Dr. Ahmet Anıl Dindar (adindar@gtu.edu.tr)</h3>
<h4 align="center">2020 Fall </h4>
---
**This week :**
1. Matrix Definition
2. Matrix in Python
3. Mat... | github_jupyter |
```
%matplotlib inline
import netCDF4 as nc
import numpy as np
import pandas as pd
import geopandas
from shapely.geometry import Point
import matplotlib.pyplot as plt
import xarray as xr
from mpl_toolkits.basemap import Basemap
# PG modules
from country_bounding_boxes import country_bounding_boxes
debug = True
def... | github_jupyter |
# About This Notebook
This notebook is based on https://www.kaggle.com/konradb/model-train-efficientnet & https://www.kaggle.com/konradb/model-infer-efficientnet, with a final score of 8.90 achieved in the BMS competition.
# Import Libraries
```
import os
import re
import gc
import cv2
import timm
import time
import... | github_jupyter |
## Earth Analytics Homework - Use Time Series Data with Python

https://github.com/earthlab/earth-analytics-lessons/blob/master/courses/earth-analytics-python/03-intro-to-python-and-time-series-data/2018-02-05-intro-to-python-time-series-data-landing-page.ipynb
## Things that we want to check
... | github_jupyter |
```
%matplotlib inline
```
# Faces dataset decompositions
This example applies to `olivetti_faces_dataset` different unsupervised
matrix decomposition (dimension reduction) methods from the module
:py:mod:`sklearn.decomposition` (see the documentation chapter
`decompositions`) .
```
print(__doc__)
# Authors: Vlad... | github_jupyter |
# nornir_rich
nornir_rich plugin is a combination of a processor to get additional detail for results and related functions. By default all results are output to stdout without requiring and print_result statements.
The processor constructor has some options related to keeping track of timing, screen width and whethe... | github_jupyter |
### Lecture 04:
**Backpropagation**: Algorithm to caculate gradient for all the weights in the network with several weights.
* It uses the `Chain Rule` to calcuate the gradient for multiple nodes at the same time.
* In pytorch this is implemented using a `variable` data type and `loss.backward()` method to get the... | github_jupyter |
```
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
for dirname, _, filenames in os.walk('Data/Identify_Dance_Dataset/'):
for filename in filenames:
print(os.path.join(dirname, filename))
import tensorflow as tf
import matplotlib.pyplot ... | github_jupyter |
# `Member`: Retrospective
## What was the goal and intended behavior?
I wanted to mimic how `typing` annotations were used to try and document `Enum` members, potentially also giving them default values of their member names
For example, something like the following:
```python
class myEnum:
SUNDAY:Member
MON... | github_jupyter |
# Лекция 5: Квантили, доверительные интервалы и распределения, производные от нормального.
### Пример для узнаваемости продукта:
Представим, что вы сделали некий новый продукт, например специальный вид матраца для качественного сна, и хотите выяснить, насколько хорошо людям ваш продукт известен. Можно определить бина... | github_jupyter |
```
%matplotlib inline
import numpy as np
import pandas as pd
import scipy
import sklearn
import spacy
import matplotlib.pyplot as plt
import seaborn as sns
import re
from nltk.corpus import gutenberg, stopwords
from collections import Counter
```
Supervised NLP requires a pre-labelled dataset for training and testing... | github_jupyter |
# Using the datapackage-reader
```
%matplotlib inline
import os
import pandas as pd
import pkg_resources as pkg
import pprint
from pyomo.opt import SolverFactory
from oemof.solph import EnergySystem, Model
from oemof.tabular.facades import TYPEMAP
import oemof.tabular.tools.postprocessing as pp
from oemof.tabular i... | github_jupyter |
# Visualizing GSD File
In this example, we will use `fresnel` to visualize a gsd file. We will color the particles & bonds by types, as well as visualize the simulation box.
We will need the [gsd](https://gsd.readthedocs.io/en/stable/) package to run this example.
```
import fresnel
import gsd.hoomd
import numpy as ... | github_jupyter |
```
import numpy as np
import pandas as pd
import csv
import datetime
import re
import os
import glob
# Change here for every participant
DATA_FOLDER = 'T:/lab-study/20191206_HW-105-V3'
# VIDEO FILES: list of all 4 video files (one for each phase)
video_paths = glob.glob(DATA_FOLDER + '/output/video/*.flv_camera_front... | github_jupyter |
### Лекция 5. Шаблоны
<br />
##### Какая идея стоит за шаблонами
Ранее мы познакомились с возможностью перегрузки функций. Давайте вспомним её на примере swap:
```c++
// поменять местами два int
void my_swap(int& a, int& b)
{
int tmp = a;
a = b;
b = tmp;
}
// поменять местами два short
void my_swap... | github_jupyter |
```
%matplotlib inline
import pandas as pd
import numpy as np
import cytoolz as tlz
from plotnine import *
```
Reading the data
```
auto_df = pd.read_csv('data/ISLR_Auto.csv')
auto_df.head()
```
Understanding the data types in the dataset
```
auto_df.info()
```
The first 6 rows of the `auto_df` dataset shows that... | github_jupyter |
```
import os
import tensorflow as tf
import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
import glob
classes = np.array(['ayam_bakar', 'ayam_crispy', 'bakso', 'gado2', 'ikan_bakar', 'mie_goreng', 'nasi_goreng', 'pecel_lele', 'pizza', 'rendang', 'sate', 'soto', 'sushi'])
n... | github_jupyter |
# EMSRb / EMSRb-MR example
In this example, we demonstrate the calculation of booking limits using both the traditional __EMSRb__ algorithm and the more recent __EMSRb-MR__ algorithm. MR stands for marginal revenue transformation - this transformation (also called "fare transformation") transforms the demands and pric... | github_jupyter |
```
'''
Trains a spatio-temporal NN model on deep squat movement from the KIMORE dataset acquired with Kinect v2 sensor
For a detailed explanation of the data and the model please see the article
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.models... | github_jupyter |
```
#IMPORT SEMUA LIBARARY
#IMPORT LIBRARY PANDAS
import pandas as pd
#IMPORT LIBRARY UNTUK POSTGRE
from sqlalchemy import create_engine
import psycopg2
#IMPORT LIBRARY CHART
from matplotlib import pyplot as plt
from matplotlib import style
#IMPORT LIBRARY BASE PATH
import os
import io
#IMPORT LIBARARY PDF
from fpdf im... | github_jupyter |
```
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.cross_validation import KFold
from sklearn.metrics import mean_absolute_error
from random import randint
from gplearn.genetic import SymbolicRegressor, SymbolicTransformer
from sklearn.utils import check_random_state
train = pd.read_csv('./d... | github_jupyter |
```
%load_ext watermark
%watermark -p torch,pytorch_lightning,torchmetrics,matplotlib
```
The three extensions below are optional, for more information, see
- `watermark`: https://github.com/rasbt/watermark
- `pycodestyle_magic`: https://github.com/mattijn/pycodestyle_magic
- `nb_black`: https://github.com/dnanhkhoa/... | github_jupyter |
# NYC Open Data Buildings-related Datasets
## NYC on Socrata
- [Address Points](https://data.cityofnewyork.us/City-Government/NYC-Address-Points/g6pj-hd8k) geodata.
- [Primary Land Use Tax Lot Output (PLUTO)](https://data.cityofnewyork.us/City-Government/Primary-Land-Use-Tax-Lot-Output-PLUTO-/64uk-42ks) is the data un... | github_jupyter |
# High-performance Simulation with Kubernetes
This tutorial will describe how to set up high-performance simulation using a
TFF runtime running on Kubernetes. The model is the same as in the previous
tutorial, **High-performance simulations with TFF**. The only difference is that
here we use a worker pool instead of a... | github_jupyter |
# Tutorial to invoke SHAP explainers via aix360
There are two ways to use [SHAP](https://github.com/slundberg/shap) explainers after installing aix360:
- [Approach 1 (aix360 style)](#approach1): SHAP explainers can be invoked in a manner similar to other explainer algorithms in aix360 via the implemented wrapper clas... | github_jupyter |
# Clustering Samples
Script to cluster and label all the samples of all the studies (given by their geo id)
@authors: nLp ATTACK Luis, Arun, Claire, and Karsten
April 01 2019--April 05 2019
## Import modules and dependencies
```
import pandas as pd
import numpy as np
import sklearn.cluster
import distance # first,... | github_jupyter |
```
%pylab inline
import examples as eg
import numpy as np
from numpy import *
import dionysus
```
The circular coordinates pipeline for examining different smoothness cost-functions:
Step 1. Getting the point cloud
Step 2. Computing the Vietoris-Rips filtration and its cohomology
Step 3. Selecting the Co... | github_jupyter |
# Natural Language Processing
**Natural Language Processing (NLP)** is a confluence of Artificial Intelligence and Linguistics which tries to enable computers to understand natural language data, including text, speech, etc. Tasks like [Speech Recognition](https://en.wikipedia.org/wiki/Speech_recognition), [Machine Tra... | github_jupyter |
```
import os
import sys
ngames_path = os.path.abspath(os.path.join(os.getcwd(), '../../..', 'ngames'))
sys.path.append(ngames_path)
import matplotlib.pyplot as plt
from extensivegames import ExtensiveFormGame, plot_game
from build import build_full_game
```
# Default configuration
Both fishers start at the shore. Th... | github_jupyter |
<br>
<img src="https://github.com/cms-opendata-education/cms-jupyter-materials-finnish/blob/master/Kuvat/CMSlogo_color_label_1024_May2014.png?raw=true" align="right" width="100px" title="CMS projektin oma logo">
<img src="https://github.com/cms-opendata-education/cms-jupyter-materials-finnish/blob... | github_jupyter |
## Practice: Sequence to Sequence for Neural Machne Translation.
*This notebook is based on [open-source implementation](https://github.com/bentrevett/pytorch-seq2seq/blob/master/1%20-%20Sequence%20to%20Sequence%20Learning%20with%20Neural%20Networks.ipynb) of seq2seq NMT in PyTorch.*
We are going to implement the mod... | github_jupyter |
```
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
%matplotlib inline
h = tf.constant("Hello")
w = tf.constant("World")
hw = h + w
print("hw: ", hw)
... | github_jupyter |
# demo_02_segment_glas_patches
A demonstration of running the GlaS set through HistoSegNet and evaluating the results qualitatively and quantitatively.
## Setup
```
%matplotlib inline
import hsn_v1
import pandas as pd
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from hsn_v1.adp import Atlas
f... | github_jupyter |
```
import numpy as np
import laspy as lp
import pptk
from pyproj import Proj, transform
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
from sklearn.cluster import DBSCAN
from scipy import stats
import scipy
import seaborn as sns
from sklearn.mixture import GaussianMixture
def diagnost... | github_jupyter |
# Tic-Tac-Toe Endgame Data Set Arm Identefication
# Importing the important libraries
```
import pandas as pd
import numpy
import sys
%matplotlib inline
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
import numpy as np
import time
import sklearn
from IPython.display import set_matplotl... | github_jupyter |
```
import numpy as np
from numpy import loadtxt
import pylab as pl
from IPython import display
from RcTorch import *
from matplotlib import pyplot as plt
from scipy.integrate import odeint
%matplotlib inline
# pip install rctorch==0.7162
#this method will ensure that the notebook can use multiprocessing on jupyterhub ... | github_jupyter |
<img src="../images/aeropython_logo.png" alt="AeroPython" style="width: 300px;"/>
# Introducción a IPython y Jupyter Notebook
*En esta clase haremos una rápida introducción al lenguaje Python y al intérprete IPython, así como a su Notebook. Veremos como ejecutar un script y cuáles son los tipos y estructuras básicas ... | github_jupyter |
# Doom-Health: REINFORCE Monte Carlo Policy gradients
In this notebook we'll implement an agent <b>that try to survive in Doom environment by using a Policy Gradient architecture.</b> <br>
Our agent playing Doom:
<img src="assets/projectw4.gif" style="max-width: 600px;" alt="Policy Gradient with Doom"/>
# You can... | github_jupyter |
# Bias
### Goals
In this notebook, you're going to explore a way to identify some biases of a GAN using a classifier, in a way that's well-suited for attempting to make a model independent of an input. Note that not all biases are as obvious as the ones you will see here.
### Learning Objectives
1. Be able to distin... | github_jupyter |
```
from util import *
from proofs import *
from perf_data import *
from proofs_analysis import *
from dataclasses import replace
x1e32_8GiB = ZigZag(security=filecoin_security_requirements, instance=ec2_x1e32_xlarge, partitions=8)
x1e32_64GiB = ZigZag(security=filecoin_security_requirements, instance=x1e32_xlarge_64, ... | github_jupyter |
## Python Conditions and If statements
Python supports the usual logical conditions from mathematics:
Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
These conditions can be used in several ways, most commonly in "if statements" and ... | github_jupyter |
## loading an image
```
from PIL import Image
im = Image.open("lena.png")
```
## examine the file contents
```
from __future__ import print_function
print(im.format, im.size, im.mode)
```
- The *format* attribute identifies the source of an image. If the image was not read from a file, it is set to None.
- The *si... | github_jupyter |
```
import torch
from torch.autograd import grad
import torch.nn as nn
from numpy import genfromtxt
import torch.optim as optim
import matplotlib.pyplot as plt
import torch.nn.functional as F
sidr_data = genfromtxt('sidr_100_pts.csv', delimiter=',') #in the form of [t,S,I,D,R]
torch.manual_seed(1234)
%%time
PATH = '... | github_jupyter |
# Final Project - TicTacToe
## The game
Tic-tac-toe (American English), noughts and crosses (British English), or Xs and Os is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagon... | github_jupyter |
# Independent g x 2 cross table
Alternative of z-test and chi-square test
```
# Enable the commands below when running this program on Google Colab.
# !pip install arviz==0.7
# !pip install pymc3==3.8
# !pip install Theano==1.0.4
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot ... | github_jupyter |
##### Copyright 2020 The TensorFlow Probability Authors.
Licensed under the Apache License, Version 2.0 (the "License");
```
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(1234)
df_1 = pd.DataFrame({'A': ['a', 'b', 'c', 'd']*5,
'B': np.random.randn(20),
'C': np.random.randint(7, size=20)})
df_2 = pd.read_csv('../data/p... | github_jupyter |
# Week 6
## In-Class Activity Workbook
## Learning Objectives
### In this notebook you will learn and practice:
<br>Section 1: <a id='Section 1'></a>[Section 1: Dictionary Fundamentals](#Section-1)
<br>Section 2: <a id='Section 2'></a>[Section 2: Working with Dictionaries](#Section-2)
<br>Section 3: <a id='Section 3... | github_jupyter |
# Running Tune experiments with ZOOpt
In this tutorial we introduce ZOOpt, while running a simple Ray Tune experiment. Tune’s Search Algorithms integrate with ZOOpt and, as a result, allow you to seamlessly scale up a ZOOpt optimization process - without sacrificing performance.
Zeroth-order optimization (ZOOpt) does... | github_jupyter |
STAT 453: Deep Learning (Spring 2020)
Instructor: Sebastian Raschka (sraschka@wisc.edu)
Course website: http://pages.stat.wisc.edu/~sraschka/teaching/stat453-ss2020/
GitHub repository: https://github.com/rasbt/stat453-deep-learning-ss20
---
```
%load_ext watermark
%watermark -a 'Sebastian Raschka' -v -p mat... | github_jupyter |
```
import math
import random
from typing import Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm_notebook as tqdm
%matplotlib inline
from generative_playground.models.losses.wasserstein_loss import ... | github_jupyter |
### import libraries
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import re
from sklearn.preprocessing import PolynomialFeatures
from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing import PolynomialFeatures
from sklearn.preprocessing import Rob... | github_jupyter |
TSG010 - Get configuration contexts
===================================
Description
-----------
Get the kubernetes contexts
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windo... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="fig/cover-small.jpg">
*This notebook contains an excerpt from the [Whirlwind Tour of Python](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jake... | github_jupyter |
# [Sequence to Sequence (seq2seq) Recurrent Neural Network (RNN) for Time Series Forecasting](https://github.com/guillaume-chevalier/seq2seq-signal-prediction)
***Note: You can find here the accompanying [seq2seq RNN forecasting presentation's slides](https://drive.google.com/drive/folders/1U0xQMxVespjQilMhYW4mDxN02Iw... | github_jupyter |
# Crowdsourcing Tutorial
In this tutorial, we'll provide a simple walkthrough of how to use Snorkel in conjunction with crowdsourcing to create a training set for a sentiment analysis task.
We already have crowdsourced labels for about half of the training dataset.
The crowdsourced labels are fairly accurate, but do n... | github_jupyter |
<a href="https://colab.research.google.com/github/CanopySimulations/canopy-python-examples/blob/master/loading_worksheet_study_data.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Upgrade Runtime
This cell ensures the runtime supports `asyncio` as... | github_jupyter |
```
import torch
from torch import nn
from tqdm.auto import tqdm
from torchvision import transforms
from torchvision.datasets import MNIST
from torchvision.utils import make_grid
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
torch.manual_seed(0)
def show_tensor_images(image_tensor, num_images=... | github_jupyter |
```
# -*- coding: utf-8 -*-
# This work is part of the Core Imaging Library (CIL) developed by CCPi
# (Collaborative Computational Project in Tomographic Imaging), with
# substantial contributions by UKRI-STFC and University of Manchester.
# Licensed under the Apache License, Version 2.0 (the "License");
# ... | github_jupyter |
<a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/GCP_CC_TPU_Pod_Slice_JAX.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# Hints from :
# https://medium.com/analytics-vidhya/how-to-access-files-from-... | github_jupyter |
```
# Importing libraries
import pandas as pd
import numpy as np
import os
import math
from sklearn.metrics import mean_squared_error
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from datetime import datetime
import seaborn as sns
from scipy import stats
import statsmodels.api as sm
from statsmodels... | github_jupyter |
# Load the Pretrained Model and the dataset
We use ernie-2.0-en as the model and SST-2 as the dataset for example. More models can be found in [PaddleNLP Model Zoo](https://paddlenlp.readthedocs.io/zh/latest/model_zoo/transformers.html#transformer).
Obviously, PaddleNLP is needed to run this notebook, which is easy to... | github_jupyter |
<a href="https://colab.research.google.com/github/satyajitghana/TSAI-DeepNLP-END2.0/blob/main/07_Seq2Seq/SST_Redo/SST_Dataset_Augmentation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Stanford Sentiment TreeBank Dataset
```
! pip install pytor... | github_jupyter |
```
import io
from os import path
from os import walk
from packagedcode.debian_copyright import parse_copyright_file
from scancode_analyzer.license_analyzer import LicenseDetectionIssue
from scancode_analyzer.summary import SummaryLicenseIssues
from scancode_analyzer.analyzer_plugin import from_license_match_object
fr... | github_jupyter |
# How to Build a Recommeder System from Scratch
## By Jill Cates
# Agenda
1. What is a recommender system?
1. Why do we need recommender systems?
1. How does it work?
1. Collaborative Filtering
1. Content-based Filtering
1. Tutorial using MovieLens dataset
# What is a Recommender System?
- an application of mach... | github_jupyter |
---
# Visualisation based on CSPP portifolio as a whole
## Visualisation 1: Number of (non-)green bonds in CSPP portifolio by time
### 1. Preparation and Import Data
**Finally `ggplot`!**
- Python has a module `plotnine` that supports `ggplot` kernel!
`%pip install plotnine`
**1.1 Load modules and dataset*... | github_jupyter |
```
from __future__ import print_function
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.lines as lines
import os
import sys
sys.path.append(... | github_jupyter |
# The Ocean Grid
Working with model output on the ocean grid, with its rotated pole, presents an additional challenge. You cannot use the standard python packages to do this, and must use the `geog0121` virtual environment instead.
### Import packages and define functions for calculations
```
'''Import packages for ... | github_jupyter |
```
import functools
import itertools
import os
import anndata
import networkx as nx
import numpy as np
import pandas as pd
import scanpy as sc
from matplotlib import rcParams
from networkx.algorithms.bipartite import biadjacency_matrix
import scglue
scglue.plot.set_publication_params()
rcParams["figure.figsize"] = (... | github_jupyter |
# Shares of the 1903 Prize in Physics
You want to examine the laureates of the 1903 prize in physics and how they split the prize. Here is a query without projection:
db.laureates.find_one({"prizes": {"$elemMatch": {"category": "physics", "year": "1903"}}})
Which projection(s) will fetch ONLY the laureates' full names... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

# Showc... | github_jupyter |
# Homework 7
Unlike previous homework assignments, this homework is **completed as a group** and **submitted on CCLE.** In other words, it's similar to an extended Discussion Activity.
## Problem 0
It is highly recommended that you work with your group to fully complete the previous Discussion assignments related to... | github_jupyter |
# Inference and Validation
Now that you have a trained network, you can use it for making predictions. This is typically called **inference**, a term borrowed from statistics. However, neural networks have a tendency to perform *too well* on the training data and aren't able to generalize to data that hasn't been seen... | github_jupyter |
```
import os
import glob
import uuid
import datetime
import warnings
from itertools import product
from multiprocessing import Pool
import tqdm
import pyart
import netCDF4
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl
import grid
warnings.simplefilter('ignore')
def update_metadata(gnrl_meta... | github_jupyter |
# WorkFlow
## Classes
## Load the data
## Test Modelling
## Modelling
**<hr>**
## Classes
```
NAME = "change the conv2d"
BATCH_SIZE = 32
import os
import cv2
import torch
import numpy as np
def load_data(img_size=112):
data = []
index = -1
labels = {}
for directory in os.listdir('./data/'):
... | github_jupyter |
# Lecture 03 - Booleans and Conditionals
## Booleans
Python has a type **`bool`** which can take on one of two values: **`True`** and **`False`**.
```
x = True
print(x)
print(type(x))
```
Rather than putting `True` or `False` directly in our code, we usually get boolean values from **Boolean Operators**. These are ... | github_jupyter |
```
import sys
sys.path.append('../')
import os
import gc
import torch
import psutil
import pickle
import numpy as np
import pandas as pd
import torch.nn as nn
from sklearn import metrics
from collections import Counter
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from torchvision import mod... | github_jupyter |
```
% matplotlib inline
import pandas as pd
from dateutil.relativedelta import relativedelta
import statsmodels.formula.api as sm
import requests
import pickle
from user_object import User
```
### Feature extraction
Our measures of user activity over a time span include:
1. number of edits in all namespaces
2. number... | github_jupyter |
<div>
<a href="https://www.audiolabs-erlangen.de/fau/professor/mueller"><img src="data_layout/PCP_Teaser.png" width=100% style="float: right;" alt="PCP Teaser"></a>
</div>
# Get Started
This notebook gives a short introduction on how to start interacting with the PCP notebooks.
<ul>
<li><a href='#github'>Downlo... | github_jupyter |
```
try:
from openmdao.utils.notebook_utils import notebook_mode
except ImportError:
!python -m pip install openmdao[notebooks]
```
# PETScKrylov
PETScKrylov is an iterative linear solver that wraps the linear solution methods found in PETSc via petsc4py.
The default method is "fgmres", or the Flexible Genera... | github_jupyter |
```
import numpy as np, pandas as pd
from pygeocoder import Geocoder
import time
import json
import matplotlib.pyplot as plt
%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
```
Do the following for db and db2 location, they are two different samples.
```
#define database path
path='http://blog.c... | github_jupyter |
Calculate synthetics from the **Marmousi 2** model © 2019- Kajetan Chrapkiewicz.
#### Notebook config
```
import sys
sys.path.append("/work/n03/n03/shared/mpaulat-software/FullwavePy")
# %load /work/n03/n03/shared/mpaulat-software/FullwavePy/fullwavepy/config/jupyter.py
from fullwavepy import * # Load modules importe... | github_jupyter |
# Importing Data
> There is no data science without data.
>
> \- A wise person
## Applied Review
### Fundamentals and Data in Python
* Python stores its data in **variables** - words that you choose to represent values you've stored
* This is done using **assignment** - you assign data to a variable
### Packages/M... | github_jupyter |
## PS3-2 KL divergence and Maximum Likelihood
#### (a) Nonnegativity
For any $P$, $Q$,
\begin{align*}
D_{KL} (P \Vert Q) & = H(P, Q) - H(P) \\
& = - \sum_{x \in \mathcal{X}} P(x) \log Q(x) - \big( - \sum_{x \in \mathcal{X}} P(x) \log P(x) \big) \\
& = - \sum_{x \in \mathcal{X}} ... | github_jupyter |
# Conversational AI
Think about how often you communicate with other people through instant messaging, social media, email, or other online technologies. For many of us, it's our go-to form of contact. When you have a question at work, you might reach out to a colleague using a chat message, which you can use on mob... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.