text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
<a id='1'></a> # Import modules ``` import keras.backend as K ``` <a id='4'></a> # Model Configuration ``` K.set_learning_phase(0) # Input/Output resolution RESOLUTION = 256 # 64x64, 128x128, 256x256 assert (RESOLUTION % 64) == 0, "RESOLUTION should be 64, 128, 256" # Architecture configuration arch_config = {} arch...
github_jupyter
# Multilayer Perceptron In the previous chapters, we showed how you could implement multiclass logistic regression (also called softmax regression) for classifying images of clothing into the 10 possible categories. To get there, we had to learn how to wrangle data, coerce our outputs into a valid probability distribu...
github_jupyter
# Scoring functions Despite our reservations about treating our predictions as "yes/no" predictions of crime, we can consider using a [Scoring rule](https://en.wikipedia.org/wiki/Scoring_rule). ## References 1. Roberts, "Assessing the spatial and temporal variation in the skill of precipitation forecasts from an NWP...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
# Numerical evaluation of the deflection of the beam Number (code) of assignment: 5R4 Description of activity: H2 & H3 Report on behalf of: name : Pieter van Halem student number (4597591) name : Dennis Dane student number (4592239) Data of student taking the role of contact person: name : Pieter van Halem e...
github_jupyter
``` from pathlib import Path data_path = Path("../data").resolve() book_list = {"唐家三少":["斗罗大陆", "斗罗大陆II绝世唐门", "酒神"], "天蚕土豆":["斗破苍穹", "武动乾坤", "大主宰", "魔兽剑圣异界纵横"], "猫腻":["庆余年", "间客", "将夜", "朱雀记", "择天记"] } ``` ## 数据清洗 1. 全角 --> 半角; 英文统一小写 2. 去除 html tag, 章节名,括号内容,url 链接 (及变体) 3. 重复字、...
github_jupyter
# Model with character recognition - single model Builds on `RNN-Morse-chars-dual` but tries a single model. In fact dit and dah sense could be duplicates of 'E' and 'T' character senses.env, chr and wrd separators are kept. Thus we just drop dit and dah senses from the raw labels. ## Create string Each character in...
github_jupyter
# Uniform longitudinal beam loading ``` %matplotlib notebook import sys sys.path.append('/Users/chall/research/github/rswarp/rswarp/utilities/') import beam_analysis import file_utils from mpl_toolkits.mplot3d import Axes3D import pickle import matplotlib.pyplot as plt from matplotlib.patches import Ellipse def svecpl...
github_jupyter
# Modeling Workbook ``` import numpy as np import pandas as pd import warnings warnings.filterwarnings("ignore") ``` ## Wrangling ``` from preprocessing import spotify_split, scale_data from preprocessing import modeling_prep df = modeling_prep() df.info() df.head(2) df.shape ``` --- ### Split the Data ``` X_train...
github_jupyter
``` #hide !pip install -Uqq fastbook import fastbook fastbook.setup_book() #hide from fastbook import * ``` # Image Classification Now that you understand what deep learning is, what it's for, and how to create and deploy a model, it's time for us to go deeper! In an ideal world deep learning practitioners wouldn't h...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns; sns.set() from sklearn.metrics import confusion_matrix # initiating random number np.random.seed(11) #### Creating the dataset # mean and standard deviation for the x belonging to the first class mu_x1, sigma_x1 = 0, 0.1 # constat to make the second...
github_jupyter
# Ingest Image Data When working on computer vision tasks, you may be using a common library such as OpenCV, matplotlib, or pandas. Once we are moving to cloud and start your machine learning journey in Amazon Sagemaker, you will encounter new challenges of loading, reading, and writing files from S3 to a Sagemaker Not...
github_jupyter
# Algorithms: linear classifier ![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png) This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). ``` import numpy as np import matplotlib.pyplot as plt imp...
github_jupyter
# 1. Installing twint Installing twint will install all related packages (like numpy,etc) that makes twint function properly. ### Upgrading twint For those who already have twint and wish to upgrade it due to certain functionality not working, or any other reasons, run the uninstall command first. Otherwise, for a fr...
github_jupyter
# Machine Learning Engineer Nanodegree ## Supervised Learning ## Project 2: Building a Student Intervention System Welcome to the second project of the Machine Learning Engineer Nanodegree! In this notebook, some template code has already been provided for you, and it will be your job to implement the additional funct...
github_jupyter
# Exp 90 analysis See `./informercial/Makefile` for experimental details. ``` import os import numpy as np from IPython.display import Image import matplotlib import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' import seaborn as sns sns.set_style('ticks') matplotlib.r...
github_jupyter
# Node and Link analysis: Centrality measures Centrality measures are used to appraise the "importance" of the elements of the network. The problem is that "importance" * Is not well-defined * Depends on the domain of the network During this seminar we will consider two node centrality measures: *degree centrality* a...
github_jupyter
<a href="https://colab.research.google.com/github/thomascong121/SocialDistance/blob/master/camera_colibration.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/drive') %%capture !pip install glu...
github_jupyter
# Decimal Такая особенность встречается во многих языках программирования: ``` 1.1 + 2.2 0.1 + 0.1 + 0.1 - 0.3 from decimal import Decimal float(Decimal('1.1') + Decimal('2.2')) float(Decimal('0.1') + Decimal('0.1') + Decimal('0.1') - Decimal('0.3')) ``` # Logging https://habr.com/ru/post/144566/ Когда проект раз...
github_jupyter
Text classification is the task of assigning a set of predefined categories to open-ended text. Text classifiers can be used to organize, structure, and categorize pretty much any kind of text – from documents, medical studies and files, and all over the web.We will classify the text into 9 categories.The 9 categories ...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/contrib/fairness/upload-fairness-dashboard.png) # Upload a Fairness Dashboard to Azure Machine Learning Studio **This ...
github_jupyter
``` import numpy as np import json from scipy import optimize from os import listdir import re import os from os.path import isfile, join import pandas as pd from joblib import Parallel, delayed, dump %matplotlib inline import matplotlib.pyplot as plt from skimage import measure import matplotlib import seaborn as sns...
github_jupyter
# Heaps ## Overview For this assignment you will start by modifying the heap data stucture implemented in class to allow it to keep its elements sorted by an arbitrary priority (identified by a `key` function), then use the augmented heap to efficiently compute the running median of a set of numbers. ## 1. Augmentin...
github_jupyter
<a href="https://colab.research.google.com/github/DingLi23/s2search/blob/pipelining/pipelining/exp-csit/exp-csit_csit_shapley_value.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Experiment Description > This notebook is for experiment \<exp-...
github_jupyter
# How to avoid "SQL injection"? ### using `%s` token ``` def add_input(self, data): connection = self.connect() try: q = "INSERT INTO crimes (description) VALUES (%s);" with connection.cursor() as cur: cur.execute(q) connection.commit() finally: connection.cl...
github_jupyter
# Example charge diagram ``` import os from qcodes import Station, load_or_create_experiment from qcodes.dataset.plotting import plot_dataset from qcodes.dataset.data_set import load_by_run_spec import nanotune as nt from nanotune.tests.mock_classifier import MockClassifer from nanotune.tuningstages.chargediagram i...
github_jupyter
<a href="https://colab.research.google.com/github/WarwickAI/natural-selection-sim/blob/main/Lesson1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <p align="center"> <img width="300" height="300" src="https://amplify-waiplatform-dev-222739-depl...
github_jupyter
# Intro to PyTorch ``` import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.manual_seed(10) V = torch.Tensor([1., 2., 3.]) M = torch.Tensor([[1., 2., 3.], [4.,5.,6.]]) torch.randn((2, 3, 4, 5)).view(12, -1) data = autograd.Variable(torc...
github_jupyter
``` import keras import keras.backend as K from keras.datasets import mnist from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, Bat...
github_jupyter
# Code for Linear Regression ## Importing Data ``` import csv, pandas as pd, numpy as np csvfile = open('aapl.csv', newline='') workbook = csv.reader(csvfile, delimiter=' ', quotechar='|') print(workbook) dates = [] opening_price = [] high_price = [] low_price = [] closing_price = [] volume = [] for row in workbook: ...
github_jupyter
# Step 6: Serve new imported input data from OA into Excel then GDX through WaMDaM #### By Adel M. Abdallah, Dec 2020 Execute the following cells by pressing `Shift-Enter`, or by pressing the play button <img style='display:inline;padding-bottom:15px' src='play-button.png'> on the toolbar above. ### Overview You'll ...
github_jupyter
<a href="https://colab.research.google.com/github/teatime77/xbrl-reader/blob/master/notebook/sklearn.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Matplotlibで日本語が表示できるようにします。 #### IPAフォントをインストールします。 ``` !apt-get -y install fonts-ipafont-goth...
github_jupyter
# Import Python Modules ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import copy ``` # Generate data for Regression In the tree of depth 1 example that we looked at, the model we fit had two terminal nodes and a single feature. He're ...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/NER_LAB.ipynb) # **Detect lab results** To ...
github_jupyter
# 2. Download and preprocess the video In this notebook, we'll download the preprocess the video that we will be applying style transfer to. The output of the tutorial will be the extracted audio file of the video, which will be reused when stitching the video back together, as well as the video separated into individu...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns RESULT_FILE = '../files/results/experimental_results_CECOVEL.csv' results = pd.read_csv(RESULT_FILE, delimiter=";") # Add column with architecture type (TCN or LSTM) results['ARCHITECTURE'] = results['MODEL'].map(lambda x:...
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
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/FeatureCollection/reverse_mask.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank...
github_jupyter
# MedleyDB content analysis and instrumental based remix This notebook contains the MedleyDB instrumental and genre analysis to selection of most representative instrumental families in its musical content. ``` import medleydb as mdb import medleydb.mix import seaborn as sns import pandas as pd import os ``` ## 1. S...
github_jupyter
# Feature Transformation Current state of transformations: - alt: Currently fully transformed via `log(x + 1 - min(x))`. This appears to be acceptable in some circles but doubted in others. - minimum_lap_time: Normalized by raceId, then used imputation by the median for outliers. - average_lap_time: Normalized by rac...
github_jupyter
--- title: "Inference Analysis" date: 2021-04-25 type: technical_note draft: false --- ## Check monitoring analysis Collect statistics, outliers and drift detections from Parquet and Kafka. ``` from hops import hdfs import pyarrow.parquet as pq from hops import kafka from hops import tls from confluent_kafka import ...
github_jupyter
<b>Section One – Image Captioning with Tensorflow</b> ``` # load essential libraries import math import os import tensorflow as tf %pylab inline # load Tensorflow/Google Brain base code # https://github.com/tensorflow/models/tree/master/research/im2txt from im2txt import configuration from im2txt import inference_w...
github_jupyter
``` %reload_ext autoreload %autoreload 2 #export from nb_007a import * ``` # IMDB ## Fine-tuning the LM Data has been prepared in csv files at the beginning 007a, we will use it know. ### Loading the data ``` PATH = Path('../data/aclImdb/') CLAS_PATH = PATH/'clas' LM_PATH = PATH/'lm' MODEL_PATH = LM_PATH/'models' ...
github_jupyter
``` import itertools import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix, f1_score from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split ``` # Load dataset ``` # Get data import pandas as pd from sklea...
github_jupyter
Last updated: June 29th 2016 # Climate data exploration: a journey through Pandas Welcome to a demo of Python's data analysis package called `Pandas`. Our goal is to learn about Data Analysis and transformation using Pandas while exploring datasets used to analyze climate change. ## The story The global goal of thi...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by downloading the client and [reading the primer](https://plotly.com/python/getting-started/). <br>You can set up Plotly to work in [online](https://plotly.com/python/getting-started/#initiali...
github_jupyter
<a href="https://colab.research.google.com/github/barksdaleaz/big_transfer/blob/master/big_transfer_tf2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2020 Google LLC. ``` #@title Licensed under the Apache License, Version 2.0 (the...
github_jupyter
# My Server の Container イメージをリストアする <HR> My Server の Container イメージファイルから、Container イメージを各Notebook Container ホストに配布し、配布したイメージで My Server が起動するように設定します。 # Container イメージファイルを格納するディレクトリの用意 配布元の Container イメージファイルを格納するディレクトリです。 `BACKUP_WORK_DIR`は、`$HOME`からの相対パスです。 ``` BACKUP_WORK_DIR = 'images' import os import os.p...
github_jupyter
# Robot Class In this project, we'll be localizing a robot in a 2D grid world. The basis for simultaneous localization and mapping (SLAM) is to gather information from a robot's sensors and motions over time, and then use information about measurements and motion to re-construct a map of the world. ### Uncertainty A...
github_jupyter
``` import keras keras.__version__ ``` # 영화 리뷰 분류: 이진 분류 예제 이 노트북은 [케라스 창시자에게 배우는 딥러닝](https://tensorflow.blog/%EC%BC%80%EB%9D%BC%EC%8A%A4-%EB%94%A5%EB%9F%AC%EB%8B%9D/) 책의 3장 4절의 코드 예제입니다. 책에는 더 많은 내용과 그림이 있습니다. 이 노트북에는 소스 코드에 관련된 설명만 포함합니다. ---- 2종 분류 또는 이진 분류는 아마도 가장 널리 적용된 머신 러닝 문제일 것입니다. 이 예제에서 리뷰 텍스트를 기반으로 영화 ...
github_jupyter
# Skript to look at SKS Results and make maps ``` #import splitwavepy as sw from obspy import read from obspy.clients.fdsn import Client from obspy import UTCDateTime from IPython.core.display import display, HTML display(HTML("<style>.container { width:75% !important; }</style>")) import matplotlib.pyplot as plt im...
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Mathematics/BudgetAndBankingAssignment/...
github_jupyter
# Transfer learning with `braai` `20200211` nb status: unfinished We will fine-tune `braai` with transfer learning using the ZUDS survey as an example. ``` from astropy.io import fits from astropy.visualization import ZScaleInterval from bson.json_util import loads, dumps import gzip import io from IPython import di...
github_jupyter
Sci-Kit Learn and Yellowbrick's Precision-Recall Curves can help us better understand the precision of our testing. These curves will show the tradeoff between a classifier's precision (the ratio of true positives to the sum of true and false positives) and recall (the ratio of true positives to the sum of true positiv...
github_jupyter
``` %matplotlib notebook import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt plt.cm.Greens([i/10 for i in range(9)]) data = pd.read_csv('iest_experiments.csv') data max_value = data.max().max() + 0.5 min_value = data.min()[1:].min() f = lambda x: f'{x:.4}' cell_text = [] cell_colour...
github_jupyter
``` from __future__ import division,print_function %matplotlib inline %load_ext autoreload %autoreload 2 import sys sys.path.append('../') from tqdm.notebook import tqdm import numpy as np import os import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms, models, datasets...
github_jupyter
# Database Population & Querying ##### Using Pandas & SQLAlchemy to store and retrieve StatsBomb event data --- ``` import requests import pandas as pd import numpy as np from tqdm import tqdm from sqlalchemy import create_engine ``` In this example, we use SQLAlchemy's `create_engine` function to create a tempora...
github_jupyter
#### DS requests results via request/response cycle A user can send a request to the domain owner to access a resource. - The user can send a request by calling the `.request` method on the pointer. - A `reason` needs to be passed on a parameter while requesting access to the data. #### The user selects a dataset a...
github_jupyter
# Modified Triplet Loss : Ungraded Lecture Notebook In this notebook you'll see how to calculate the full triplet loss, step by step, including the mean negative and the closest negative. You'll also calculate the matrix of similarity scores. ## Background This is the original triplet loss function: $\mathcal{L_\mat...
github_jupyter
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cadCAD-org/demos/blob/master/tutorials/robots_and_marbles/robot-marbles-part-3/robot-marbles-part-3.ipynb) # cadCAD Tutorials: The Robot and the Marbles, part 3 In parts [1](../robot-marbles-part-1/rob...
github_jupyter
## IBM Quantum Challenge Fall 2021 # Challenge 4c: Battery revenue optimization with adiabatic quantum computation *Challenge solution write-up by Lukas Botsch* The solution I present in this notebook might not be the most optimized and highest scoring one submitted during the challenge (the final score is just over ...
github_jupyter
# Data visualization with Matpotlib: Scatter plots **Created by: Kirstie Whitaker** **Created on: 29 July 2019** In 2017 Michael Vendetti and I published a paper on *"Neuroscientific insights into the development of analogical reasoning"*. The code to recreate the figures from processed data is available at https://...
github_jupyter
# Live Data The [HoloMap](../reference/containers/bokeh/HoloMap.ipynb) is a core HoloViews data structure that allows easy exploration of parameter spaces. The essence of a HoloMap is that it contains a collection of [Elements](http://build.holoviews.org/reference/index.html) (e.g. ``Image``s and ``Curve``s) that you ...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/JavaScripts/Image/HSVPanSharpening.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_b...
github_jupyter
# Visualizing Overlays of Clusters on Widefield Images During an analysis it is very often useful to overlay clustered localizations on top of widefield images to ensure that the clustering is performed correctly. One may also wish to navigate through the clusters and manually annotate them one-by-one. In this notebo...
github_jupyter
# Random numbers and simulation You will learn how to use a random number generator with a seed and produce simulation results (**numpy.random**, **scipy.stats**), and calcuate the expected value of a random variable through Monte Carlo integration. You will learn how to save your results for later use (**pickle**). F...
github_jupyter
# Disk Health Predictor Usage Demo In this notebook, we will show how you can get started with the [`disk-health-predictor`](https://github.com/aicoe-aiops/disk-health-predictor) python module with just a few lines of code! First we will install it as a package, and then we will pass to it a [`smartctl`](https://linux...
github_jupyter
# Machine Learning and the MNC ![xkcd: Machine Learning](https://imgs.xkcd.com/comics/machine_learning.png) [xkcd: Machine Learning](https://xkcd.com/1838/) ## About this Course ### Premises 1. Many machine learning methods are relevant and useful in a wide range of academic and non-academic disciplines. 1. Mach...
github_jupyter
``` from PIL import Image import numpy as np import os import cv2 import keras from keras.utils import np_utils from keras.models import Sequential from keras.layers import Conv2D,MaxPooling2D,Dense,Flatten,Dropout import pandas as pd import sys %matplotlib inline from scipy.spatial.distance import euclidean as euc imp...
github_jupyter
``` import conf import uuid import sagemaker from sagemaker import get_execution_role role = get_execution_role() print(role) bucket = conf.SESSION_BUCKET sess = sagemaker.Session(default_bucket=bucket) bucket = sess.default_bucket() sess.default_bucket = bucket sess.default_bucket from sagemaker.amazon.amazon_estim...
github_jupyter
# Setup Run below for setup and data loading: ``` if(!require(lme4)){ install.packages("lme4") } library(lme4) library(tidyr) library(dplyr) library(ggplot2) results = read.csv("model_input.csv", header=TRUE, sep=",") nrow(results) rearranged_results <- droplevels(results) data <- mutate(rearranged_results, '...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt ``` # Create data ``` import copy from liegroups import SE2, SO2 params_true = {'T_1_0': SE2.identity(), 'T_2_0': SE2(SO2.identity(), -np.array([0.5, 0])), 'T_3_0': SE2(SO2.identity(), -np.array([1, 0])), ...
github_jupyter
``` import os import numpy as np import pandas as pd from sklearn.experimental import enable_iterative_imputer from sklearn.impute import SimpleImputer from sklearn.impute import IterativeImputer from sklearn.ensemble import ExtraTreesRegressor from sklearn.linear_model import BayesianRidge from sklearn.tree import Dec...
github_jupyter
## Applying mapper to plant gene expression data In this notebook, we will apply mapper algorithm to the gene expression data collected by last year's class.<br> Download all the files from the shared google drive folder into a directory on your computer if you are running jupyter notebooks locally. The data is stored...
github_jupyter
<a href="https://colab.research.google.com/github/WarwickAI/wai203-fin-nlp/blob/main/WAI203_Part_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <p align="center"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAYAAACHjumMAAA...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Tutorials/Keiko/fire_australia.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank...
github_jupyter
# How to Use Anomaly Detectors in Merlion This notebook will guide you through using all the key features of anomaly detectors in Merlion. Specifically, we will explain 1. Initializing an anomaly detection model (including ensembles) 1. Training the model 1. Producing a series of anomaly scores with the model 1. Quan...
github_jupyter
``` artefact_prefix = '2_pytorch' target = 'beer_style' from dotenv import find_dotenv from datetime import datetime import pandas as pd from pathlib import Path import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from category_encoders....
github_jupyter
``` # EDA MOdule importing import shutil shutil.copy('/content/drive/MyDrive/DA_Library/EDA.py','EDA.py') import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns import EDA as eda raw_data = eda.readfile('/content/drive/MyDrive/Ajinkya_Patil_Plant Disease Detection /Processed_data&...
github_jupyter
# Monte Carlo experiments The Monte Carlo method is a way of using random numbers to solve problems that can otherwise be quite complicated. Essentially, the idea is to replace uncertain values with a large list of values, assume those values have no uncertaintly, and compute a large list of results. Analysis of the re...
github_jupyter
Implementation of the paper : https://arxiv.org/abs/1907.10830 Inspired by the corresponding code : https://github.com/znxlwm/UGATIT-pytorch ``` !nvidia-smi -L !pip install --upgrade --force-reinstall --no-deps kaggle from torchvision import transforms from torch.utils.data import DataLoader import torch import torch...
github_jupyter
``` import umap import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"]="0" res_folders=os.listdir('../../results/') #model_folder='/home/mara/multitask_adversarial/results/NCOUNT_822/' CONCEPT=['domain'] import keras keras.__version__ from sklearn.metrics import acc...
github_jupyter
<a href="https://colab.research.google.com/github/AllanWang/Kaggle-Colab/blob/master/Kaggle_Git_Template.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Kaggle + Git + Colab This notebook contains some helper functions to import kaggle data, and ...
github_jupyter
# Part 2 - Advanced text classifiers As seen in the past, we can create models that take advantage of counts of words and tf-idf scores and that yield some pretty accurate predictions. But it is possible to make use of several additional features to improve our classifier. In this learning unit we are going to check h...
github_jupyter
``` %matplotlib inline import os import sys # Modify the path sys.path.append("..") import pandas as pd import yellowbrick as yb import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression, Lasso # yellowbrick.features.importances # Feature importance visualizer # # Author: Benjamin Bengf...
github_jupyter
--- # Safety and Security - Ingest Video Streams To avoid the need for a set of live cameras for this demo, we play back video from a series of JPEG files on disk and write each video frame to SDP. --- ### Import dependencies ``` %load_ext autoreload %autoreload 2 import grpc import imp import pravega.grpc_gateway ...
github_jupyter
# 1. Import libraries ``` #----------------------------Reproducible---------------------------------------------------------------------------------------- import numpy as np import tensorflow as tf import random as rn import os seed=0 os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) rn.seed(seed) #sess...
github_jupyter
# Getting started with TensorFlow (Eager Mode) **Learning Objectives** - Understand difference between Tensorflow's two modes: Eager Execution and Graph Execution - Practice defining and performing basic operations on constant Tensors - Use Tensorflow's automatic differentiation capability ## Introduction **Eag...
github_jupyter
``` import oommfc as oc import discretisedfield as df import numpy as np import matplotlib.pyplot as plt %matplotlib inline import colorsys plt.style.use('styles/lato_style.mplstyle') def convert_to_RGB(hls_color): return np.array(colorsys.hls_to_rgb(hls_color[0] / (2 * np.pi), ...
github_jupyter
# A3: ReactionNetworks demo # Introduction This notebook demonstrates the functionality of the ReactionNetworks module. Classes included here are ReactionNetwork, C13ReactionNetwork and 2SReactionNetwork, which hold stochiometric networks, C13 transition networks and mixed stochiometric 13C transitions networks respe...
github_jupyter
# Autoencoder In this notebook we will ``` from keras.layers import Input, Dense from keras.models import Model import matplotlib.pyplot as plt import matplotlib.colors as mcol from matplotlib import cm def graph_colors(nx_graph): #cm1 = mcol.LinearSegmentedColormap.from_list("MyCmapName",["blue","red"]) #cm1...
github_jupyter
## Is flying safer now than before? ``` %load_ext autoreload %autoreload 2 %matplotlib inline import sqlite3 import pandas as pd import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl from flight_safety.queries import get_events_accidents mpl.rcParams['figure.figsize'] = 10, 6 mpl.rcParams['font...
github_jupyter
<!--NOTEBOOK_HEADER--> *This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks); content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).* <!--NAVIGATION--> < [Structure Refinement](http://nbviewer.jupyter.org/github/RosettaCommons/PyRo...
github_jupyter
``` %matplotlib inline import os, glob, warnings, sys warnings.filterwarnings("ignore", message="numpy.dtype size changed") import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from nltools.data import Brain_Data from nltools.mask import expand_mask, collapse_mask import scipy.s...
github_jupyter
# Chapter 1, Table 1 This notebook explains how I used the Harvard General Inquirer to *streamline* interpretation of a predictive model. I'm italicizing the word "streamline" because I want to emphasize that I place very little weight on the Inquirer: as I say in the text, "The General Inquirer has no special author...
github_jupyter
# Calculations on TiO2 and a monolayer of MoS2 Calculation of TiO2 and a Monolayer of MoS2 with the Fleur code. We converge the systems and calculate a Bandstructure and DOS. Author: Jens Broeder 2017 ``` %load_ext autoreload %autoreload 2 %matplotlib notebook from aiida import load_dbenv, is_dbenv_loaded if not is_...
github_jupyter
# Publications markdown generator for yashpatel5400 Takes a set of bibtex of publications and converts them for use with [yashpatel5400.github.io](yashpatel5400.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html...
github_jupyter
# Tutorial 1: Instatiating a *scenario category* In this tutorial, we will cover the following items: 1. Create *actor categories*, *activity categories*, and *physical thing categories* 2. Instantiate a *scenario category* 3. Show all tags of the *scenario category* 4. Use the `includes` function of a *scenario cate...
github_jupyter
# Input and Output ``` from __future__ import print_function import numpy as np author = "kyubyong. https://github.com/Kyubyong/numpy_exercises" np.__version__ from datetime import date print(date.today()) ``` ## NumPy binary files (NPY, NPZ) Q1. Save x into `temp.npy` and load it. ``` x = np.arange(10) np.save('te...
github_jupyter
``` from sqlalchemy import create_engine import api_keys import pandas as pd import matplotlib.pyplot as plt import numpy as np DB_USER = api_keys.DB_USER DB_PASS = api_keys.DB_PASS DB_URL = api_keys.DB_URL engine = create_engine("mysql+pymysql://{0}:{1}@{2}".format(DB_USER, DB_PASS, DB_URL), echo=True) connection = ...
github_jupyter