text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# 2 Data Acquisition In this chapter we will discuss data acquisition and data formatting for four online Assyriological projects: [ORACC](http://oracc.org) (2.1), [ETCSL](https://etcsl.orinst.ox.ac.uk/), (2.2) [CDLI](http://cdli.ucla.edu) (2.3) and [BDTNS](http://bdtns.filol.csic.es/) (2.4). The data in [CDLI](http...
github_jupyter
# Text Generation with Neural Networks Import necessary packages for preprocessing, model building, etc. We follow the steps described in the theoretical part of this summer school as follows: 0. Define Reseach Goal (already done) 2. Retrieve Data 3. Prepare Data 4. Explore Data 5. Model Data 6. Present and automate ...
github_jupyter
## Variant of the Blocked Input Model in which the stop process decelerates the go process by a rate that varies across trials ``` import numpy import random import matplotlib.pyplot as plt import matplotlib import seaborn import pandas import matplotlib.patches as patches from matplotlib.ticker import FormatStrFormat...
github_jupyter
# ML Scripts So far, we've done everything inside the Jupyter notebooks but we're going to now move our code into individual python scripts. We will lay out the code that needs to be inside each script but checkout the `API` lesson to see how it all comes together. <div align="left"> <a href="https://github.com/madew...
github_jupyter
# Model Selection, Underfitting, and Overfitting :label:`sec_model_selection` As machine learning scientists, our goal is to discover *patterns*. But how can we be sure that we have truly discovered a *general* pattern and not simply memorized our data? For example, imagine that we wanted to hunt for patterns among ge...
github_jupyter
``` import numpy as np import math import random import pandas as pd import os import matplotlib.pyplot as plt import cv2 import glob import gc from google.colab import files src = list(files.upload().values())[0] open('utils.py','wb').write(src) from utils import * from tqdm import tqdm import pickle from keras.optim...
github_jupyter
# Face Recognition & Verification for Person Identification Inspired by Coursera deeplearning.ai's assignment of programming a face recognition for happy house, I wanted to give it a try implementing a face recognition system by using face detection library(https://github.com/ageitgey/face_recognition) and face_recogn...
github_jupyter
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb) # Installation ``` #format the book %matplotlib inline from __future__ import division, print_function from book_format import load_style load_style() ``` This book is written in J...
github_jupyter
``` import ipywidgets as W from wxyz.jsonld.widget_jsonld import Expand, Compact, Flatten, Frame, Normalize from wxyz.lab.widget_dock import DockBox from wxyz.lab.widget_editor import Editor from wxyz.core.widget_json import JSON flex = lambda x=1: dict(layout=dict(flex=f"{x}")) context = JSON("""{ "@context": { ...
github_jupyter
## Content-Based Filtering Using Neural Networks This notebook relies on files created in the [content_based_preproc.ipynb](./content_based_preproc.ipynb) notebook. Be sure to run the code in there before completing this notebook. Also, we'll be using the **python3** kernel from here on out so don't forget to change...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.decomposition import PCA import matplotlib.pyplot as plt import seaborn as sns from sklearn.preprocessing import scale wines=pd.read_csv("wine.csv") wines wines.describe() wines.info() wines_ary=wines.values wines_ary wines_normal = scale(wines_ary) wines_normal `...
github_jupyter
This notebook contains a bunch of experiments to determine the optimal learning rate value for different optimizers. The reference model is a CNN with 3 convolutional blocks; the dataset is an augmented version of the CBIS dataset. # Environment setup ``` # Connect to Google Drive from google.colab import drive driv...
github_jupyter
### Load Test deployed web application This notebook pulls some images and tests them against the deployed web application. We submit requests asychronously which should reduce the contribution of latency. ``` import asyncio import json import random import urllib.request from timeit import default_timer import aioht...
github_jupyter
# Uncertainty Sampling on the Radio Galaxy Zoo ``` import sys import h5py, numpy, sklearn.neighbors from astropy.coordinates import SkyCoord import matplotlib.pyplot as plt sys.path.insert(1, '..') import crowdastro.train, crowdastro.test TRAINING_H5_PATH = '../training.h5' CROWDASTRO_H5_PATH = '../crowdastro.h5' N...
github_jupyter
# Assignment 1: Numpy RNN Implement a RNN and run BPTT ``` from typing import Dict, Tuple import numpy as np class RNN(object): """Numpy implementation of sequence-to-one recurrent neural network for regression tasks.""" def __init__(self, input_size: int, hidden_size: int, output_size: int): """I...
github_jupyter
<a href="https://colab.research.google.com/github/marixko/Supervised_Learning_Tutorial/blob/master/The_Basics_of_Supervised_Learning_For_Astronomers.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ###**About Google's Colaboratory: ** This is a fre...
github_jupyter
<a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/smc_logreg_tempering.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #SMC for logistic regression We compare data tempering (IBIS) with temperature temper...
github_jupyter
* basic roberta ft: 0.6589791487657798 (thr 0.3) * basic roberta ft (head first): 0.6768011808573329 (thr 0.42) * fine tune roberta on weird clf, then only head on spans, then whole: 0.6853127403287083 (thr 0.32) * ``` from transformers import RobertaTokenizer, RobertaForTokenClassification from transformers import Be...
github_jupyter
# Predicting Credit Card Default with Neural Networks ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os %matplotlib inline ``` ### Back with the credit card default dataset ``` # Loading the dataset DATA_DIR = '../data' FILE_NAME = 'credit_card_default.csv' da...
github_jupyter
# WELL NOTEBOOK ## Well logs visualization &amp; petrophysics Install the the repository reservoirpy from github and import the required packages ``` import os path = os.path.join('/home/santiago/Documents/dev/reservoirpy') import sys sys.path.insert(0,path) import pandas as pd import geopandas as gpd import numpy as...
github_jupyter
# **<div align="center"> Dolby.io Developer Days Media APIs 101 - Getting Started </div>** ### **<div align="center"> Notebook #1: Getting Started</div>** ### Starting with a Raw Audio File We can run code blocks like this in Binder by pressing "Control+Enter". Try it now after clicking the below code block! ``` im...
github_jupyter
# Import ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import matplotlib matplotlib.__version__ np.__version__, pd.__version__ ``` # Dataset: ``` from sklearn.datasets import california_housing data = california_housing.fetch_california_housing() X = data['data'] y = data['target'] col...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys sys.path.append('../docs') from gen_doc.nbdoc import show_doc as sd #export from nb_001b import * import sys, PIL, matplotlib.pyplot as plt, itertools, math, random, collections, torch import scipy.stats, scipy.special from enum import Enum, IntEnum from torch import ...
github_jupyter
### As before, let's find the set of compounds for which both simulations and experimental measurements exist Matt Robinson posted a `moonshot_initial_activity_data.csv` file of the initial activity data: ``` import numpy as np import pandas as pd df_activity = pd.read_csv('../data-release-2020-05-10/moonshot_initia...
github_jupyter
## Model one policy variables This notebook extracts the selected policy variables in the `indicator_list` from IMF and World Bank (wb) data sources, and writes them to a csv file. ``` import warnings import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline warn...
github_jupyter
# Assignment 1 This assignment is to test your understanding of Python basics. Answer the questions and complete the tasks outlined below; use the specific method described, if applicable. In order to get complete points on your homework assigment you have to a) complete this notebook, b) based on your results answer...
github_jupyter
# Sklearn ## sklearn.model_selection документация: http://scikit-learn.org/stable/modules/cross_validation.html ``` from sklearn import model_selection, datasets import numpy as np ``` ### Разовое разбиение данных на обучение и тест с помощью train_test_split ``` iris = datasets.load_iris() train_data, test_data,...
github_jupyter
# Black Litterman with Investor Views Optimization: Oldest Country ETFs # Charts ## 1. Data Fetching ### 1.1 Model configuration ``` import os import sys import datetime as dt import logging import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from hmmlearn import hmm import c...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.data import DataLoader from torch.utils.data import Dataset from torch.utils.tensorboard import SummaryWriter import numpy as np import pandas as p...
github_jupyter
# Testing `TFNoiseAwareModel` We'll start by testing the `textRNN` model on a categorical problem from `tutorials/crowdsourcing`. In particular we'll test for (a) basic performance and (b) proper construction / re-construction of the TF computation graph both after (i) repeated notebook calls, and (ii) with `GridSear...
github_jupyter
``` from scripts.setup_libs import * ``` # [CatBoost](https://github.com/catboost/catboost) Бустинг от Яндекса для категориальных фичей и много чего еще. Для начала настоятельно рекомендуется посмотреть видео. Там идет основная теория по CatBoost ``` from IPython.display import YouTubeVideo YouTubeVideo('UYDwhuyWYS...
github_jupyter
# Homework (16 pts) - Hypothesis Testing ``` import numpy as np import scipy.stats as st import matplotlib.pyplot as plt ``` 1. You measure the duration of high frequency bursts of action potentials under two different experimental conditions (call them conditions A and B). Based on your measured data below, determin...
github_jupyter
# Information Flow In this chapter, we detail how to track information flows in python by tainting input strings, and tracking the taint across string operations. Some material on `eval` exploitation is adapted from the excellent [blog post](https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html) by Ned ...
github_jupyter
## Reinforcement Learning Tutorial -1: Q Learning #### MD Muhaimin Rahman sezan92[at]gmail[dot]com Q learning , can be said one of the most famous -and kind of intuitive- of all Reinforcement learning algorithms. In fact ,the recent all algorithms using Deep learning , are based on the Q learning algorithms. So, to w...
github_jupyter
# Marginalized Gaussian Mixture Model Author: [Austin Rochford](http://austinrochford.com) ``` %matplotlib inline from matplotlib import pyplot as plt import numpy as np import pymc3 as pm import seaborn as sns SEED = 383561 np.random.seed(SEED) # from random.org, for reproducibility ``` Gaussian mixtures are a fle...
github_jupyter
# The Data to see where we got the data go here: https://www.ndbc.noaa.gov/station_history.php?station=42040 ``` import pandas as pd import numpy as np import datetime ``` This is the first set of data from 1995 ``` from utils import read_file, build_median_df df1995 = read_file('data/42040/buoy_data_1995.txt') #all...
github_jupyter
# 基于注意力的神经机器翻译 此笔记本训练一个将波斯语翻译为英语的序列到序列(sequence to sequence,简写为 seq2seq)模型。此例子难度较高,需要对序列到序列模型的知识有一定了解。 训练完此笔记本中的模型后,你将能够输入一个波斯语句子,例如 *"من می دانم."*,并返回其英语翻译 *"I know."* 对于一个简单的例子来说,翻译质量令人满意。但是更有趣的可能是生成的注意力图:它显示在翻译过程中,输入句子的哪些部分受到了模型的注意。 <img src="https://tensorflow.google.cn/images/spanish-english.png" alt="spanish...
github_jupyter
This is from a "Getting Started" competition from Kaggle [Titanic competition](https://www.kaggle.com/c/titanic) to showcase how we can use Auto-ML along with datmo and docker, in order to track our work and make machine learning workflow reprocible and usable. Some part of data analysis is inspired from this [kernel]...
github_jupyter
# Main Code ``` import os import time import numpy as np import redis from IPython.display import clear_output from PIL import Image from io import BytesIO import base64 import json import matplotlib.pyplot as plt from face_detection import get_face from utils import img_to_txt, decode_img, log_error ###############...
github_jupyter
``` from mxnet import nd from mxnet.contrib import text glove_vec = text.embedding.get_pretrained_file_names("glove") print(glove_vec) glove_6b50d = text.embedding.create('glove', pretrained_file_name="glove.6B.50d.txt") word_size = len(glove_6b50d) print(word_size) #词的索引 index = glove_6b50d.token_to_idx['happy'] print...
github_jupyter
# Amortized Neural Variational Inference for a toy probabilistic model Consider a certain number of sensors placed at known locations, $\mathbf{s}_1,\mathbf{s}_2,\ldots,\mathbf{s}_L$. There is a target at an unknown position $\mathbf{z}\in\mathbb{R}^2$ that is emitting a certain signal that is received at the $i$-th...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` Colormap Choices {#colormap_example} ================ Use a Matplotlib, Colorcet, cmocean, or custom colormap when plotting scalar values. ``` from pyvista import examples import pyvista as pv import matplotlib.pyplot as plt fro...
github_jupyter
# Matplotlib and NumPy crash course You may install numpy, matplotlib, sklearn and many other usefull package e.g. via Anaconda distribution. ``` import numpy as np ``` ## NumPy basics ### Array creation ``` np.array(range(10)) np.ndarray(shape=(5, 4)) np.linspace(0, 1, num=20) np.arange(0, 20) np.zeros(shape=(5, ...
github_jupyter
# 虚谷号WebGPIO应用(客户端Python版) 虚谷号和手机(App inventor)如何互动控制? 虚谷号和掌控板如何互动控制? 为了让虚谷号和其他开源硬件、编程语言快速互动,虚谷号的WebGPIO应运而生。简单的说,只要在虚谷号上运行一个python文件,就可以用WebAPI的形式来与虚谷号互动,可以获取虚谷号板载Arduino的所有引脚的电平,也可以控制所有引脚。 ## 1.接口介绍 要在虚谷号上运行“webgpio.py”。也可以将“webgpio.py”文件更名为“main.py”,复制到vvBoard的Python目录,只要一开机,虚谷号就会执行。 下载地址:https://github.com/vv...
github_jupyter
# First BigQuery ML models for Taxifare Prediction In this notebook, we will use BigQuery ML to build our first models for taxifare prediction.BigQuery ML provides a fast way to build ML models on large structured and semi-structured datasets. ## Learning Objectives 1. Choose the correct BigQuery ML model type and sp...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from collections import defaultdict from scipy.optimize import minimize import networkx as nx from networkx.generators.random_graphs import erdos_renyi_graph from IPython.display import Image from qiskit import QuantumCircuit, execute, Aer from qiskit.tools.visu...
github_jupyter
##### Detection and Location Chain **Abstract**: This hackathon project represents our effort to combine our existing machine learning and photogrametry efforts and further combine those efforts with both Cloud and Edge based solutions based upon Xilinx FPGA acceleration. The Trimble team decided that the Xilinx hac...
github_jupyter
# 6 - Pivot Table In this sixth step I'll show you how to reshape your data using a pivot table. This will provide a nice condensed version. We'll reshape the data so that we can see how much each customer spent in each category. ``` import pandas as pd import numpy as np df = pd.read_json("customer_data.json", c...
github_jupyter
## Test Riksdagen SFS dokument * Denna [Jupyter Notebook](https://github.com/salgo60/open-data-examples/blob/master/Riksdagens%20dokument%20SFS.ipynb) * [KU anmälningar](https://github.com/salgo60/open-data-examples/blob/master/Riksdagens%20dokument%20KU-anm%C3%A4lningar.ipynb) * [Motioner](https://github.com/sa...
github_jupyter
<h1>Lists in Python</h1> <p><strong>Welcome!</strong> This notebook will teach you about the lists in the Python Programming Language. By the end of this lab, you'll know the basics list operations in Python, including indexing, list operations and copy/clone list.</p> <h2>Table of Contents</h2> <div class="alert ale...
github_jupyter
``` ! wget http://corpora.linguistik.uni-erlangen.de/someweta/german_web_social_media_2018-12-21.model -P /mnt/data2/ptf from someweta import ASPTagger model = "/mnt/data2/ptf/german_web_social_media_2018-12-21.model" # future versions will have sensible default values asptagger = ASPTagger(beam_size=5, iterations=1...
github_jupyter
``` import glob import warnings import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score from sklearn.discriminant_analysis...
github_jupyter
## Make your own heatmap based on Strava activities This notebook shows you how to create your own heatmap based on your Strava activities. You need to create a Strava API application in order to use their API. Follow the instructions on this page to create your app: <https://medium.com/@annthurium/getting-started-wit...
github_jupyter
# <p style="text-align: center;"> Part Two: Scaling & Normalization </p> ``` from IPython.display import HTML from IPython.display import Image Image(url= "https://miro.medium.com/max/3316/1*yR54MSI1jjnf2QeGtt57PA.png") HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide();...
github_jupyter
# Naive Bayes from scratch ``` import pandas as pd import numpy as np def get_accuracy(x: pd.DataFrame, y: pd.Series, y_hat: pd.Series): correct = y_hat == y acc = np.sum(correct) / len(y) cond = y == 1 y1 = len(y[cond]) y0 = len(y[~cond]) print(f'Class 0: tested {y0}, correctly classified {co...
github_jupyter
## Import dependencies ``` import numpy as np import sys import pandas as pd import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import seaborn as sn import scipy as sp from tqdm import tqdm import glob from fair import * from fair.scripts.data_retrieval impo...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline ``` ### Image Generation from Audio ``` from pathlib import Path from IPython.display import Audio import librosa import librosa.display import matplotlib.pyplot as plt import numpy as np from utils import read_file, transform_path DATA = Path('data') # the...
github_jupyter
### In this lab, we will implement Linear Regression using Least-square Solution. We will use the same example as we did in the class (Slide 18 from the linear regression slides). There are 5 steps. Let's implement them using only numpy step by step. ![linreg_steps](linreg_slide_18.png) ``` import numpy as np ``` We...
github_jupyter
# Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignment, you will implement convolutional (CONV) and pooling (POOL) layers in numpy, including both forward propagation and (optionally) backward propagation. **Notation**: - Superscript $[l]$ denotes an object of the $l...
github_jupyter
# Ciência de dados - Unidade 3 *Por: Débora Azevedo, Eliseu Jayro, Francisco de Paiva e Igor Brandão* ### Objetivos O objetivo desse projeto é explorar os [datasets da UFRN](http://dados.ufrn.br/group/despesas-e-orcamento) contendo informações sobre requisições de material, requisições de manutenção e empenhos sob o...
github_jupyter
# Introduction: Prediction Engineering: Labeling Historical Examples In this notebook, we will develop a method for labeling customer transactions data for a customer churn prediction problem. The objective of labeling is to create a set of historical examples of what we want to predict based on the business need: in ...
github_jupyter
## Reference Data Camp course ## Course Description * A typical organization loses an estimated 5% of its yearly revenue to fraud. * Apply supervised learning algorithms to detect fraudulent behavior similar to past ones,as well as unsupervised learning methods to discover new types of fraud activities. * Deal with ...
github_jupyter
<a href="https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/profiling_tpus_in_colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2018 The TensorFlow Hub Authors. Copyright 2019-2020 Google LLC Licens...
github_jupyter
``` !pip install /home/knikaido/work/Cornell-Birdcall-Identification/data/resnest50-fast-package/resnest-0.0.6b20200701/resnest/ !pip install torch==1.4.0 !pip install opencv-python !pip install slackweb !pip install torchvision==0.2.2 !pip install torch_summary from pathlib import Path import numpy as np import pandas...
github_jupyter
# Generating percentiles for TensorFlow model input features The current TensorFlow model uses histogram-like percentile features, which are kind of a continuous version of one-hot features. For example, if key cutoff points are `[-3, 1, 0, 2, 10]`, we might encode a value `x` as `sigma((x - cutoff) / scale)`. If `si...
github_jupyter
##### Copyright 2018 The AdaNet 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 agre...
github_jupyter
``` import pandas as pd import numpy as np import datetime as datetime #read in last_played_wars csv last_played_wars = pd.read_csv("updated_last_played_wars.csv") # last_played_wars["Participation"] = last_played_wars["Joined Wars"] / last_played_wars["Total Wars"] last_played_wars = last_played_wars[["Name", "Tag"...
github_jupyter
# Pandas ``` import numpy as np import pandas as pd ``` Pandas提供了3种数据类型,分别是`Series`、`DataFrame`和`Panel`。 * `Series`用于保存一维数据 * `DataFrame` 用于保存二维数据 * `Panel`用于保存三维或者可变维数据 ## Series数据结构 `Series`本质上是一个带索引的一维数组。 指定索引: ``` s = pd.Series([1,3,2,4], index=['a', 'b', 'c', 'd']) s.index s.values ``` 默认索引: ``` s = pd.Se...
github_jupyter
<img align="right" src="tf-small.png"/> # Search from MQL These are examples of [MQL](https://shebanq.ancient-data.org/static/docs/MQL-Query-Guide.pdf) queries on [SHEBANQ](https://shebanq.ancient-data.org/hebrew/queries), now expressed as Text-Fabric search templates. For more basic examples, see [searchTutorial](...
github_jupyter
# Scaling up ML using Cloud AI Platform In this notebook, we take a previously developed TensorFlow model to predict taxifare rides and package it up so that it can be run in Cloud AI Platform. For now, we'll run this on a small dataset. The model that was developed is rather simplistic, and therefore, the accuracy of...
github_jupyter
# Going deeper with Tensorflow In this seminar, we're going to play with [Tensorflow](https://www.tensorflow.org/) and see how it helps us build deep learning models. If you're running this notebook outside the course environment, you'll need to install tensorflow: * `pip install tensorflow` should install cpu-only T...
github_jupyter
# Data Science Ex 00 - Preparation 23.02.2021, Lukas Kretschmar (lukas.kretschmar@ost.ch) ## Let's have some Fun with Data Science! Welcome to Data Science. We will use an interactive environment where you can mix text and code, with the awesome feature that you can execute the code. ## Pre-Installation We will wo...
github_jupyter
``` import cv2 as cv from scipy.spatial import distance import numpy as np from collections import OrderedDict ``` ##### Object Tracking Class ``` class Tracker: def __init__(self, maxLost = 30): # maxLost: maximum object lost counted when the object is being tracked self.nextObjectID = 0 ...
github_jupyter
``` import matplotlib.pyplot as plt import os import numpy as np import itertools from glob import glob import pandas as pd from itertools import product import os from annsa.model_classes import f1 from tensorflow.python.keras.models import load_model from pandas import read_csv from sklearn.metrics import auc from...
github_jupyter
# A glimpse into the inner working of a 2 layer Neural network ``` %load_ext autoreload %autoreload 2 import numpy as np from numpy import random as nprand from cs771 import plotData as pd, utils, genSyntheticData as gsd from keras.models import Sequential from keras.layers import Dense as dense from keras import opti...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D2_DynamicNetworks/W3D2_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 3, Day 2, Tutorial 1 # Neuronal ...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
``` from PIL import Image from numpy import * from pylab import * import scipy.misc from scipy.cluster.vq import * import imtools import pickle imlist = imtools.get_imlist('selected_fontimages/') imnbr = len(imlist) with open('font_pca_modes.pkl', 'rb') as f: immean = pickle.load(f) V = pickle.load(f) immatrix ...
github_jupyter
### - Canonical Correlation Analysis btw Cell painting & L1000 - This notebook focus on calculating the canonical coefficients between the canonical variables of Cell painting and L1000 level-4 profiles after applying PCA on them. --------------------------------------------- - The aim of CCA is finding the relation...
github_jupyter
# YOLO on PYNQ-Z1 and Movidius NCS: Webcam example To run this notebook, you need to connect a USB webcam to the PYNQ-Z1 and a monitor to the HDMI output. You'll already need a powered USB hub for the Movidius NCS, so you should have a spare port for the webcam. ### Load required packages ``` from mvnc import mvncapi ...
github_jupyter
``` import os import json def findCaptureSessionDirs(path): session_paths = [] devices = os.listdir(path) for device in devices: sessions = os.listdir(os.path.join(path, device)) for session in sessions: session_paths.append(os.path.join(device, session)) return se...
github_jupyter
# Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language processing. This will come in handy when dealing with things like machine translation....
github_jupyter
``` # 화씨 -> 섭씨로 바꾸기 # categorical 바꾸기 # 날짜 date 형식으로 바꾸기 # NA값 0으로 처리하기 import pandas as pd import numpy as np from datetime import datetime df = pd.read_csv('train.csv',encoding='euc-kr') df.head() df.info() #datetime으로 변환 df['Date'] = pd.to_datetime(df['Date']) df['Year'] =df['Date'].dt.year df['Month'] =df['Date']....
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from rdkit.Chem import MolFromSmiles from rdkit.Chem.Descriptors import ExactMolWt df = pd.read_csv("39_Formose reaction_MeOH.csv")#glucose_dry_impcols.csv print(df.columns) # first get rid of empty lines in the mass list by replacing with '' df...
github_jupyter
### Example Class ``` import datetime # we will use this for date objects class Person: def __init__(self, name, surname, birthdate, address, telephone, email): self.name = name self.surname = surname self.birthdate = birthdate self.address = address self.telephone = tele...
github_jupyter
# pipegraph User Guide ## Rationale [scikit-learn](http://scikit-learn.org/stable/) provides a useful set of data preprocessors and machine learning models. The `Pipeline` object can effectively encapsulate a chain of transformers followed by final model. Other functions, like `GridSearchCV` can effectively use `Pipe...
github_jupyter
# 2. Acquire the Data ## Finding Data Sources There are three place to get onion price and quantity information by market. 1. **[Agmarket](http://agmarknet.nic.in/)** - This is the website run by the Directorate of Marketing & Inspection (DMI), Ministry of Agriculture, Government of India and provides daily price ...
github_jupyter
#Author : Devesh Kumar ## Task 4 : Prediction using Decision Tree Algorithm ___ ## GRIP @ The Sparks Foundation ____ # Role : Data Science and Business Analytics [Batch May-2021] ## Table of Contents<br> > - 1. Introduction. - 2. Importing Libraries. - 3. Fetching and loading data. - 4. Checking for null values. - 5....
github_jupyter
``` # !pip install pandas_datareader keras seaborn # !conda install -y -c conda-forge fbprophet # !pip install pydot graphviz import boto3 import base64 from botocore.exceptions import ClientError from IPython.display import display import pandas_datareader import pandas as pd import numpy as np from keras import Seque...
github_jupyter
# 04 - Full waveform inversion with Devito and scipy.optimize.minimize ## Introduction In this tutorial we show how [Devito](http://www.opesci.org/devito-public) can be used with [scipy.optimize.minimize](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html) to solve the FWI gradient base...
github_jupyter
``` import numpy as np import collections import random import tensorflow as tf def build_dataset(words, n_words): count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]] count.extend(collections.Counter(words).most_common(n_words - 1)) dictionary = dict() for word, _ in count: dictionary[word] ...
github_jupyter
# End-to-End Machine Learning Project In this chapter you will work through an example project end to end, pretending to be a recently hired data scientist at a real estate company. Here are the main steps you will go through: 1. Look at the big picture 2. Get the data 3. Discover and visualize the data to gain insigh...
github_jupyter
``` from utils import * import tensorflow as tf from sklearn.cross_validation import train_test_split import time trainset = sklearn.datasets.load_files(container_path = 'data', encoding = 'UTF-8') trainset.data, trainset.target = separate_dataset(trainset,1.0) print (trainset.target_names) print (len(trainset.data)) p...
github_jupyter
### How To Break Into the Field Now you have had a closer look at the data, and you saw how I approached looking at how the survey respondents think you should break into the field. Let's recreate those results, as well as take a look at another question. ``` import numpy as np import pandas as pd import matplotlib....
github_jupyter
# Reading and writing LAS files This notebook goes with [the Agile blog post](https://agilescientific.com/blog/2017/10/23/x-lines-of-python-load-curves-from-las) of 23 October. Set up a `conda` environment with: conda create -n welly python=3.6 matplotlib=2.0 scipy pandas You'll need `welly` in your environment...
github_jupyter
# DaKanjiRecognizer - Single Kanji CNN : Create dataset ## Setup Import the needed libraries. ``` #std lib import sys import os import random import math import multiprocessing as mp import gc import time import datetime from typing import Tuple, List from shutil import copy from tqdm import tqdm import tensorflow ...
github_jupyter
#### Jupyter notebooks This is a [Jupyter](http://jupyter.org/) notebook using Python. You can install Jupyter locally to edit and interact with this notebook. # Finite difference methods for transient PDE ## Method of Lines Our method for solving time-dependent problems will be to discretize in space first, resul...
github_jupyter
``` import random suits = ('Hearts','Diamonds','Spades','Clubes') ranks = ('Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Jack','Queen','king','Ace') values = {'Two':2,'Three':3,'Four':4,'Five':5,'Six':6, 'Seven':7,'Eight':8,'Nine':9,'Ten':10,'Jack':10,'Queen':10,'king':10,'Ace':11} playing =...
github_jupyter
``` import tensorflow as tf from tensorflow import keras as keras import time import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.image as mpimg from tensorflow.keras.models import Sequential, load_model from tensorflow.keras.layers import Dense, Dropout, Lambda, LayerNormalization fr...
github_jupyter
# Machine Learning Engineer Nanodegree ## Introduction and Foundations ## Project 0: Titanic Survival Exploration In 1912, the ship RMS Titanic struck an iceberg on its maiden voyage and sank, resulting in the deaths of most of its passengers and crew. In this introductory project, we will explore a subset of the RMS ...
github_jupyter