text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
### Our Mission In this lesson you gained some insight into a number of techniques used to understand how well our model is performing. This notebook is aimed at giving you some practice with the metrics specifically related to classification problems. With that in mind, we will again be looking at the spam dataset ...
github_jupyter
# Mini Web App Finding Similar Members with the Meetup API This notebook will present a little application that uses the Meetup.com API to get member info from the Houston Data Science Meetup group. ## Get your API Key To make this tutorial work, you will need to get an [API key from Meetup][1]. Once you get your key...
github_jupyter
# Week 6 - An introduction to machine learning (Part II) - Exercise and Solution We'll apply some of the material from the previous lectures to recreating the analysis from a [nature machine intelligence](https://www.nature.com/natmachintell/) paper, ["An interpretable mortality prediction model for COVID-19 patients...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # 1D Degenerate Alfven Wave `GiRaFFEfood` Initial Data for ...
github_jupyter
Deep Learning ============= Assignment 2 ------------ Previously in `1_notmnist.ipynb`, we created a pickle with formatted datasets for training, development and testing on the [notMNIST dataset](http://yaroslavvb.blogspot.com/2011/09/notmnist-dataset.html). The goal of this assignment is to progressively train deep...
github_jupyter
# Lecture 7: Load/save and structure data [Download on GitHub](https://github.com/NumEconCopenhagen/lectures-2020) [<img src="https://mybinder.org/badge_logo.svg">](https://mybinder.org/v2/gh/NumEconCopenhagen/lectures-2020/master?urlpath=lab/tree/07/Load_save_and_structure_data.ipynb) 1. [Pandas dataframes](#Pandas...
github_jupyter
``` import pandas as pd import numpy as np import hddm import sys import seaborn as sns import matplotlib.pyplot as plt from scipy import stats %matplotlib inline pd.options.display.max_columns = None #generate data data, params = hddm.generate.gen_rand_data(params={'a': 2, 't': .4, 'v': .5}, ...
github_jupyter
# Bayesian Linear Regression part 4: Plots ![Uncertainty of 5-degree polynomial. It's very high far away from observations, and low close to observations. Now there's another observation far to the right, where the uncertainty pinches around it.](images/2018-01-10-five-degrees-uncertainty-another-point.png) Now I ha...
github_jupyter
``` import pickle as pkl import pandas as pd import imodels import itertools import os from imodels.util.evaluate.compare_models import run_comparison from sklearn.metrics import accuracy_score, f1_score from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier import matplotlib.pyplot as plt from...
github_jupyter
# VERIFICATION TESTING # HER2 One Scanner - Aperio FDA - 5-Fold (80/20) split, No Holdout Set - Truth = Categorical from Mean of 7 continuous scores - Epoch at automatic Stop when loss<.001 change - LeNet model, 10 layers, Dropout (0.7) ``` import numpy as np import pandas as pd import random from keras.callbacks ...
github_jupyter
<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>Introduction to MetPy</h1> <h3>Unidata Python Workshop</h3> <div style="clear...
github_jupyter
<a href="https://colab.research.google.com/github/kirubarajan/roft/blob/master/annotation/analysis/research.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Dataset Loading and Cleaning ``` !pip install fsspec gcsfs !pip install --upgrade matplotl...
github_jupyter
We build a multi-layer perceptron with its hidden layers batch normalized, and contrast it with the version without batch normalization. We train and evaluate both versions of the multi-layer perceptron on MNIST dataset. ``` import os import gzip import numpy as np import matplotlib.pyplot as plt import autodiff as ...
github_jupyter
# References I've made use of some great kernels already - check them out and give them an upvote if any of this is useful! ### Preprocessing - https://www.kaggle.com/christofhenkel/how-to-preprocessing-when-using-embeddings - https://www.kaggle.com/theoviel/improve-your-score-with-text-preprocessing-v2 ### Model...
github_jupyter
(nm_ill_conditioning_roundoff_errors)= # Ill-conditioning and roundoff errors ## Ill-conditioned matrices The conditioning (or lack of, i.e. the ill-conditioning) of matrices we are trying to invert is incredibly important for the success of any algorithm. As long as the matrix is non-singular, i.e. \\(\det(A)\ne 0\...
github_jupyter
``` # nlp with recurrent neural networks # autocheck word complete grammer check translation chatbot # sentiment analysis / character generation # bag of words implementation def bag_of_words(text): # find the words words = text.lower().split(' ') bag = {} vocab = {} word_encoding = 1 for word in words:...
github_jupyter
``` import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger("exchangelib").setLevel(logging.WARNING) ``` # Connecting melusine to an Outlook Exchange mailbox The main use-case for Melusine is **email routing**. Melusine mostly focuses on the Machine Learning aspects of ...
github_jupyter
# BepiColombo First Venus Swingby Hands-On Lesson Virtual SPICE Training for BepiColombo, July 21-22, 2020 ## Overview In this lesson you will develop a series of simple programs that demonstrate the usage of SpiceyPy to compute a variety of different geometric quantities applicable to experiment...
github_jupyter
<table> <tr> <td style="background-color:#ffffff;"> <a href="http://qworld.lu.lv" target="_blank"><img src="..\images\qworld.jpg" width="25%" align="left"> </a></td> <td style="background-color:#ffffff;vertical-align:bottom;text-align:right;"> prepared by <a href="http://abu.lu....
github_jupyter
# **Tugas Besar 2** ## Kelompok 8: 1. 16520289&emsp;Gagas Praharsa Bahar 2. 16520299&emsp;Malik Akbar Hashemi Rafsanjani 3. 16520309&emsp;Alifia Rahmah 4. 16520319&emsp;Ng Kyle ## Sumber data: Trending YouTube Video Statistics (US Videos) - Mitchell J ([Kaggle](https://www.kaggle.com/datasnaek/youtube-new)) ### Data...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import pandas as pd import pycountry import retry import seaborn as sns %matplotlib in...
github_jupyter
``` %%time import malaya isu_kerajaan = [ 'Kenyataan kontroversi Setiausaha Agung Barisan Nasional (BN), Datuk Seri Mohamed Nazri Aziz berhubung sekolah vernakular merupakan pandangan peribadi beliau', 'Timbalan Presiden UMNO, Datuk Seri Mohamad Hasan berkata, kenyataan tersebut tidak mewakili pendirian serta p...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Gena/hillshade.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="https:/...
github_jupyter
# Xopt class, TNK test function This is the class method for running Xopt. TNK function $n=2$ variables: $x_i \in [0, \pi], i=1,2$ Objectives: - $f_i(x) = x_i$ Constraints: - $g_1(x) = -x_1^2 -x_2^2 + 1 + 0.1 \cos\left(16 \arctan \frac{x_1}{x_2}\right) \le 0$ - $g_2(x) = (x_1 - 1/2)^2 + (x_2-1/2)^2 \le 0.5$ ``` fr...
github_jupyter
# 範例 : (Kaggle)房價預測 # [教學目標] - 以下用房價預測資料, 展示特徵篩選的作法 # [範例重點] - 觀察相關係數過濾法的寫作方式(In[2], Out[2], In[4], Out[4]), 以及對線性迴歸與梯度提升機有什麼影響 (In[5]~In[8], Out[5]~Out[8]) - 觀察L1 嵌入法的寫作方式(In[9]~In[11], Out[9]~Out[11]), 以及對線性迴歸與梯度提升機有什麼影響 (In[12], Out[12], In[13], Out[13]) ``` # 做完特徵工程前的所有準備 import pandas as pd import numpy as np ...
github_jupyter
# Galaxy Catalog Plots This notebook reads the [LSST DM galaxy catalog](http://weaklensingdeblending.readthedocs.org/en/latest/catalog.html), calculates some size and shape parameters, and makes plots to summarize the inputs to the `simulate` program. Plots to summarize the `simulate` outputs are generated in a [sepa...
github_jupyter
``` import pandas as pd import numpy as np import sentencepiece as spm import nltk import ast from nltk.tokenize import sent_tokenize from nltk.tokenize import word_tokenize import time ncbi_com_0 = pd.read_csv("data/ncbi_comm_use_000000000000.csv") ncbi_com_1 = pd.read_csv("data/ncbi_comm_use_000000000001.csv") ncbi_n...
github_jupyter
$$ \text{LaTeX command declarations here.} \newcommand{\R}{\mathbb{R}} \renewcommand{\vec}[1]{\mathbf{#1}} $$ # EECS 445: Machine Learning ## Hands On 05: Linear Regression II * Instructor: **Zhao Fu, Valli, Jacob Abernethy and Jia Deng** * Date: September 26, 2016 ### Review: Maximum Likelihood Suppose we have a...
github_jupyter
``` ALPHABET = [' ', 'e', 't', 'a', 'i', 'o', 's', 'n', 'r', 'h', 'l', 'd', 'c', 'm', 'u', 'f', 'g', 'y', 'b', 'w', 'p',\ '.', 'v', ',', 'k', "'", '/', '>', '<', '-', '"', 'j', 'x', ')', '(', '!', 'z', 'q', '0', '1', '?', ':',\ '9', '2', '*', ';', '3', '5', '8', '4', '7', '&', '6', 'é', '\x96', ...
github_jupyter
# 2A.ml - Déterminer la vitesse moyenne des vélib Ce notebook explicite une solution pour calculer la vitesse moyenne des velib sachant qu'on ne connaît que l'état des stations à intervalle réguliers. ``` %matplotlib inline ``` Même si je propose quelques jeux de données, il est possible de créer le sien en s'inspir...
github_jupyter
# LMS filter and ADALINE algorithm In this first project you will implement a Least Mean Square (LMS) error filter by using the Adaptive Linear Neuron (ADALINE) algorithm. This algorithm is a class of adaptive filter used to mimic a desired filter by finding the filter coefficients that relate to producing the least m...
github_jupyter
# Managed Spot Training for XGBoost This notebook shows usage of SageMaker Managed Spot infrastructure for XGBoost training. Below we show how Spot instances can be used for the 'algorithm mode' and 'script mode' training methods with the XGBoost container. [Managed Spot Training](https://docs.aws.amazon.com/sagemak...
github_jupyter
# Child Nutrition Calculator ### Input the required information about child ``` # personal info -> input name, age, gender, height, weight def personalInfoChild(): Name = input("Enter your Name: ") Age = int(input("Enter your Age: ")) Gender = input("Enter your Gender: ") height = float(input...
github_jupyter
``` import numpy as np import pandas as pd from sklearn import linear_model from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold, StratifiedKFold from sklearn.linear_model import LinearRegression from sklearn.linear_model import LogisticRegression from sklearn.ensemble import R...
github_jupyter
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
# DiscreteDP Example: Mine Management **Daisuke Oyama** *Faculty of Economics, University of Tokyo* From Miranda and Fackler, <i>Applied Computational Economics and Finance</i>, 2002, Section 7.6.1 ``` %matplotlib inline import itertools import numpy as np from scipy import sparse import matplotlib.pyplot as plt fr...
github_jupyter
<a href="https://colab.research.google.com/github/Kabongosalomon/Cat-vs-Dog-Classifier/blob/master/Helper_Colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Load My data ``` ! git clone https://github.com/Kabongosalomon/Cat-vs-Dog-Classifier....
github_jupyter
# Logistic Regression with L2 regularization ``` import pandas as pd products = pd.read_csv('amazon_baby_subset.csv') products.head() import json with open('important_words.json', 'r') as f: important_words = json.load(f) important_words = [str(s) for s in important_words] products = products.fillna({'review':''})...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm %matplotlib inline import datetime import cPickle as pickle import csv import numpy as np import random import sys maxInt = sys.maxsize decrement = True while decrement: # decrease the maxInt value by factor 10 # as long as the Overfl...
github_jupyter
## 1. The most Nobel of Prizes <p><img style="float: right;margin:5px 20px 5px 1px; max-width:250px" src="https://s3.amazonaws.com/assets.datacamp.com/production/project_309/img/Nobel_Prize.png"></p> <p>The Nobel Prize is perhaps the worlds most well known scientific award. Except for the honor, prestige and substantia...
github_jupyter
<a href="https://colab.research.google.com/github/agemagician/CodeTrans/blob/main/prediction/single%20task/api%20generation/small_model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Install the library and download the pretrained models ``` pr...
github_jupyter
``` import sys import numpy as np from collections import Counter sys.path.append('../scales_project/') from utils import simulate_EPR from importlib import reload reload(simulate_EPR) simul import matplotlib as mpl def setup_mpl(): mpl.rc('font', size=20) mpl.rcParams['legend.fontsize'] = 'small' mpl.rcPar...
github_jupyter
``` #Adapted from the method described in #Bhatt, Samir, Edward C. Holmes, and Oliver G. Pybus. 2011. “The Genomic Rate of Molecular Adaptation of the Human Influenza A Virus.” Molecular Biology and Evolution 28 (9): 2443–51. #and #Bhatt, Samir, Aris Katzourakis, and Oliver G. Pybus. 2010. “Detecting Natural Selection...
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
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline from scipy.st...
github_jupyter
# Coverage of MultiPLIER LV using _P. aeruginosa_ data The goal of this notebook is to examine why genes were found to be generic. Specifically, this notebook is trying to answer the question: Are generic genes found in more multiplier latent variables compared to specific genes? The PLIER model performs a matrix fac...
github_jupyter
**Exploratory Data Analysis** ``` import pandas as pd import seaborn as sns import numpy as np from rdkit import Chem from rdkit.Chem.Descriptors import MolLogP from tqdm.auto import tqdm from sklearn.preprocessing import StandardScaler from sklearn.manifold import TSNE from umap import UMAP ``` Make Pandas use Seabo...
github_jupyter
# Multi-Class Single-Label classification The natural extension of binary classification is a multi-class classification task. We first approach multi-class single-label classification, which makes the assumption that each example is assigned to one and only one label. We use the *Iris flower* data set, which consist...
github_jupyter
``` import Bio.PDB as PDB import numpy as np import freesasa import glob from Bio.PDB.DSSP import DSSP ``` # Calculate parameters ``` surfaces = [] rsas = [] surface_seq = [] for file in glob.glob("data/training/crystal_structs/*.pdb"): # parse the pdb file p = PDB.PDBParser(QUIET=True) s = p.get...
github_jupyter
``` #@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 agreed to in writing, software # distributed u...
github_jupyter
# Tensor Creation ``` from __future__ import print_function import torch import numpy as np import matplotlib %matplotlib inline import matplotlib.pyplot as plt from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/pytorch_exercises" torch.__version__ np.__version__ ``` NOTE on notati...
github_jupyter
``` %reload_ext nb_black import json import pandas as pd with open("../secrets.json", "r") as f: secrets = json.load(f) import spotipy import spotipy.util as util from spotipy.oauth2 import SpotifyClientCredentials import spotipy.oauth2 as oauth2 CLIENT_ID = secrets["spotify_client_id"] CLIENT_SECRET = secrets["...
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
``` # import required dependencies import sys sys.path.insert(0, '../../../BERT-FAQ/') from shared.utils import load_from_json from shared.utils import dump_to_json from shared.utils import make_dirs from reranker import ReRanker ``` **1. Generating reranked results from Answer (BERT-Q-a)"** ``` # define output path...
github_jupyter
``` """Copyright 2020-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 writing, softwa...
github_jupyter
**Chapter 13 – Loading and Preprocessing Data with TensorFlow** _This notebook contains all the sample code and solutions to the exercises in chapter 13._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/13_loading_and_preprocessing_data....
github_jupyter
# Census Notebook **Authorship**<br /> Original Author: Taurean Dyer<br /> Last Edit: Taurean Dyer, 9/26/2019<br /> **Test System Specs**<br /> Test System Hardware: GV100<br /> Test System Software: Ubuntu 18.04<br /> RAPIDS Version: 0.10.0a - Docker Install<br /> Driver: 410.79<br /> CUDA: 10.0<br /> **Known Worki...
github_jupyter
# 采用机器翻译实现Seq2Seq ``` import sys sys.path.append('../') import collections import d2l import zipfile from d2l.data.base import Vocab import time import torch import torch.nn as nn import torch.nn.functional as F from torch.utils import data from torch import optim ``` ## Seq2Seq的结构 # Sequence to Sequence模型 ### 模型: ...
github_jupyter
# Estimate car price - Introduction to Python wrapper for SAP HANA This notebook is part of a Machine Learning project that is described and available to download on <BR><a href="https://blogs.sap.com/2019/11/05/hands-on-tutorial-machine-learning-push-down-to-sap-hana-with-python/">https://blogs.sap.com/2019/11/05/han...
github_jupyter
``` #from scipy.io import loadmat #import h5py import xarray as xr import numpy as np #PLOTTING import cartopy from mpl_toolkits.axes_grid1.inset_locator import inset_axes import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.colorbar import Colorbar import matplotlib.ticker as mticker...
github_jupyter
# Black Scholes Model In this notebook we illustrate the basic properties of the Black Scholes model. The notebook is structured as follows: 1. Black-Scholes model code 2. Analysis of value function 3. Analysis of Greeks, i.e. sensitivities to model parameters ## Black-Scholes Model Code We use a c...
github_jupyter
``` from argparse import Namespace import contextlib import copy import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from dataclasses import dataclass, field from omegaconf import MISSING, II, open_dict from typing import Any, Optional from fairseq import checkpoint_utils,...
github_jupyter
``` %run -i ../python/common.py UC_SKIPTERMS=True %run -i ../python/ln_preamble.py ``` # SLS Lecture 8 : Writing some simple assembly programs Spend some time writing some very simple assembly programs and learn to use the debugger so that we have enough skills to explore how things work. We will be repeat variou...
github_jupyter
# DSCI 572 Lab 4 ``` import numpy as np import pandas as pd import os from sklearn.model_selection import train_test_split from scipy.signal import convolve2d import matplotlib.pyplot as plt %matplotlib inline ``` To install scikit-image, use ``` conda install -c conda-forge scikit-image ``` or ``` pip install ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt plt.rcParams.update({ "text.usetex": True, "font.family": "sans-serif", "font.sans-serif": ["Helvetica Neue"], "font.size": 28, # "contour.negative_linestyle": 'solid', }) # Define function x_min = -24 x_max = 24 y_min = -13.5 y_max = 13.5 ...
github_jupyter
## 3DCORE with THUX ``` import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.dates as mdates from mpl_toolkits.mplot3d import axes3d from matplotlib.colors import LightSource from matplotlib import cm import heliopy import astropy import datetime from datetime import timedelta import ...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline import kenlm from tqdm import tqdm import fastText import pandas as pd from bleu import * import torch, os #bert classifier from tqdm import trange from pytorch_pretrained_bert.file_utils import PYTORCH_PRETRAINED_BERT_CACHE from pytorch_pretrained_bert.mod...
github_jupyter
## Collaborative filtering using Python Alright, so let's do it! We have some Python code that will use Pandas, and all the various other tools at our disposal, to create movie recommendations with a surprisingly little amount of code. The first thing we're going to do is show you item-based collaborative filt...
github_jupyter
<a id='top'></a> # Log completion by ML regression - Typical and useful Pandas - Data exploration using Matplotlib - Basic steps for data cleaning - **Exercise: Find problem in specific well log data.** - Feature engineering - Setup scikit-learn workflow - Making X and y - Choosing a model - Cl...
github_jupyter
# FairWorkflows execution demo ## Define the steps of your workflow Each step should be its own function. Mark the function as such with the @fairstep decorator. ``` %cd .. from fairworkflows import is_fairworkflow, is_fairstep, FairStep, FairWorkflow @is_fairstep(label='Addition') def add(a:float, b:float) -> float...
github_jupyter
#### Fancy indexing and index tricks NumPy offers more indexing facilities than regular Python sequences. In addition to indexing by integers and slices, as we saw before, arrays can be indexed by arrays of integers and arrays of booleans. ##### Indexing with Arrays of Indices¶ ``` import numpy as np a = np.arange(12...
github_jupyter
``` %matplotlib notebook import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from matplotlib.ticker import ScalarFormatter import math ``` This notebook assumes you have completed the notebook [Introduction of sine waves](TDS_Introduction-sine_waves.ipynb). This notebook follows...
github_jupyter
# ResNet-50 Inference with FINN on Alveo This notebook demonstrates the functionality of a FINN-based, full dataflow ResNet-50 implemented in Alveo U250. The characteristics of the network are the following: - residual blocks at 1-bit weights, 2/4-bit activations - first convolution and last (fully connected) layer ...
github_jupyter
``` import twitter import os import yaml import re import time import tweepy import pandas as pd from textblob import TextBlob from collections import Counter import pickle credentials = yaml.load(open(os.path.expanduser('~/.ssh/api_credentials.yml'))) ``` # Try Tweepy ``` #!/usr/bin/env python # encoding: utf-8 imp...
github_jupyter
## 绘制数组 ``` import matplotlib.pyplot as plt import numpy as np a = np.zeros([2, 3]) print(a) a[0, 0] = 1 a[0, 1] = 2 a[1, 1] = 4 a[1, 2] = 1 plt.imshow(a, interpolation="nearest") # 创建绘图 ``` ## 神经网络框架代码 - 构建一个神经网络类 - 包含3个函数 1. 初始化函数, 设定输入层节点,隐藏节点和输出层节点的数量 2. 训练,学习给定训练集样本后,优化权重 3. 查询,给定输出,从输出节点给出答案 ``` import num...
github_jupyter
``` import numpy as np import tensorflow as tf from tensorflow import keras import pandas as pd import seaborn as sns from pylab import rcParams import matplotlib.pyplot as plt from matplotlib import rc %matplotlib inline %config InlineBackend.figure_format='retina' RANDOM_SEED = 42 np.random.seed(RANDOM_SEED) tf.ran...
github_jupyter
# Chapter 1: Pandas Foundations ## Recipes * [Dissecting the anatomy of a DataFrame](#Dissecting-the-anatomy-of-a-DataFrame) * [Accessing the main DataFrame components](#Accessing-the-main-DataFrame-components) * [Understanding data types](#Understanding-data-types) * [Selecting a single column of data as a Series](#S...
github_jupyter
``` import tensorflow.compat.v2 as tf import tensorflow_datasets as tfds import tensorflow.keras.backend as kb from backwardcompatibilityml import scores from backwardcompatibilityml.tensorflow import helpers as tf_helpers from backwardcompatibilityml.tensorflow.loss.strict_imitation import BCStrictImitationKLDivLoss i...
github_jupyter
<a href="https://colab.research.google.com/github/ashikshafi08/Learning_Tensorflow/blob/main/Experiments/Generator_to_Dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> For this experiment, we'll use a dataset from AI Crowd competition (live n...
github_jupyter
# Machine Translation with Transformer Tutorial from: https://www.tensorflow.org/tutorials/text/transformer ``` import tensorflow_datasets as tfds import tensorflow as tf import time import numpy as np import matplotlib.pyplot as plt examples, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, ...
github_jupyter
``` import glob import xml.etree.ElementTree as ET import re folder="/pi/proto/framework/applications/datamodel/entitydef" inputfilepattern=folder+"/*.xml" files=glob.glob(inputfilepattern) entities=[] for filename in files: print("process {} ..".format(filename)) tree = ET.parse(filename) root = tree.getr...
github_jupyter
# Searching Try running it in a live notebook for animation! * peakSearch * bracketSearch * binarySearch ``` # Reload modules every time code is called. Set autoreload 0 to disable %load_ext autoreload %autoreload 2 import matplotlib.pyplot as plt import numpy as np np.random.seed(0) from lightlab.util.search impor...
github_jupyter
``` %load_ext autoreload %autoreload 2 import datetime import os, sys import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.transforms import Affine2D import pickle import copy as cp import scipy.optimize import casadi as cas PROJECT_PATH = '/home/nbuckman/Dropbox (M...
github_jupyter
# Use a custom parser While many of the parsers included within this libary may be useful, we do not have parsers for **every** dataset out there. If you are interested in adding your own parser (and hopefully contributing that parser to the main repo 😊 ), check out this walkthrough of how to build one! ## What is a...
github_jupyter
# Source reconstruction with lens mass fitting Runs MCMC over lens model parameters, using SLIT to reconstruct the source at each iteration. ``` import os import sys import copy import time import numpy as np import matplotlib.pyplot as plt import astropy.io.fits as pf import pysap import corner import pickle as pkl ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import cvxpy as cp import pandas as pd from tqdm import tqdm plt.rcParams.update({ "text.usetex": True, "font.family": "sans-serif", "font.sans-serif": ["Helvetica Neue"], "font.size": 20, }) np.random.seed(0) # Load data from MNIST dataset (please...
github_jupyter
# Discrete Fourier Transform in Python This notebook is a quick refresher on how to perform FFT in python/scipy. ``` import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import fft ``` We define: - $N$: number of samples - $f_s$: sampling frequency/rate in samples/second ``` N = 1000 f_s = 100 ```...
github_jupyter
# Plot Kmeans clusters stored in a GeoTiff This is a notebook plots the GeoTiffs created out of [kmeans](../stable/kmeans.ipynb). Such GeoTiffs contains the Kmeans cluster IDs. ## Dependencies ``` import sys sys.path.append("/usr/lib/spark/python") sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip") sys...
github_jupyter
# Dynamics 365 Business Central Trouble Shooting Guide (TSG) - Login issues (SaaS) This notebook contains Kusto queries that can help getting to the root cause of a login issue for an environment in the online version of Business Central (SaaS). Each section in the notebook contains links to the TSG part of the auth...
github_jupyter
# Introduction to Glue-Viz **version 0.1** *** By AA Miller (Northwestern CIERA/Adler Planetarium) 03 May 2018 ## Introduction [All of my slides from Tuesday morning] ... that is all ## Glue As a point of review, on Tuesday we learned about ParaView. I'd summarize the major strength of ParaView as providing an i...
github_jupyter
``` %load_ext autoreload %autoreload 2 ``` # Transformer > Training a Timesformer model for UCR video classif. Tbaks to Phil wang (@lucidrains) we have a bunch of attention based models to trian: - `Is Space-Time Attention All You Need for Video Understanding?`: This paper looks pretty cool, as it is the first full...
github_jupyter
# Dive wrapped in a python class ## Implementation - Dive profile is usually shown as a series of depth and time, in `MM:SS` format, points. - Need to convert the latter into decimal minutes, - and convert it to time and current depth. - constructor: initialize the model to ZH-L16C w/ 5-minute compartment, ...
github_jupyter
``` import os, sys import matplotlib.pyplot as plt import numpy as np from sklearn import decomposition, manifold % matplotlib notebook def compute_distance(x,y): x = x / np.linalg.norm(x) y = y / np.linalg.norm(y) return np.linalg.norm(x-y) def compute_xcorr(x,y): return x.dot(y.T).sum() def print_per...
github_jupyter
# Naas - NLP Examples <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/Naas/Naas_NLP_Examples.ipynb" target="_parent"><img src="https://img.shields.io/badge/-Open%20in%20Naas-success?labelColor=000000&logo=data:image/svg+xml;base64,PD...
github_jupyter
``` import os import pandas as pd import sys import numpy as np from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split, StratifiedKFold import tensorflow as tf sys.path.append("../../DNN-RE-new/src") raw_data = pd.read_csv('raw_data/MBdata_33CLINwMiss_1KfGE_1KfCNA.csv') de...
github_jupyter
Arun Das Research Fellow Secure AI and Autonomy Laboratory University of Texas at San Antonio # Rotational Invariance in Convolutional Neural Networks Over the course of history, convolution operation has helped accelerate science and signal processing in a variety of ways. With the advent of deep lea...
github_jupyter
# COVID-19 Exploratory Data Analysis > (Almost) Everything You Want To Know About COVID-19. - author: Devakumar kp - comments: true - categories: [EDA] - permalink: /corona-eda/ - toc: true - image: images/copied_from_nb/covid-eda-2-1.png These visualizations were made by [Devakumar kp](https://twitter.com/imdevskp)....
github_jupyter
``` import numpy as np import pandas as pd from tqdm import tqdm from rdkit import Chem import seaborn as sns from sklearn.cluster import AgglomerativeClustering, DBSCAN, SpectralClustering from scipy.stats import ks_2samp, chisquare, power_divergence import tmap, os from faerun import Faerun from mhfp.encoder impor...
github_jupyter
``` from __future__ import print_function # to use Python 3 features in Python 2 %matplotlib inline import matplotlib as mpl from matplotlib import pyplot as plt import numpy as np from astropy import constants as const ``` # Line Plot ``` def gaussian(x, sigma=2): y = (2*np.pi*sigma**2)**-0.5 * np.exp(- x**2 ...
github_jupyter
# Structure learning with cause2e This notebook shows how ```cause2e``` can be used for learning causal graphs. Structure learning (also called causal discovery) can be performed by the ```discovery.StructureLearner``` after reading data and specifying domain knowledge. If we only want to perform a quick exploratory s...
github_jupyter