text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Evaluation of doLLy in Google code jam ``` # Import Core libraries import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.font_manager as font_manager import seaborn as sns from sklearn.metrics import auc # Graphics %matplotlib inline %config InlineBackend....
github_jupyter
``` ''' This notebook categorizes the splicing status of each intron in long read data and calculates CoSE values. Figures 2 and S3 ''' import os import numpy as np import pandas as pd from pandas.api.types import CategoricalDtype import mygene import itertools import scipy import pysam import pybedtools from pybedtoo...
github_jupyter
# Description This notebook computes predicted expression correlations between all genes in the MultiPLIER models. It also has a parameter set for papermill to run on a single chromosome to run in parallel (see under `Settings` below). # Modules ``` %load_ext autoreload %autoreload 2 import numpy as np from scipy.s...
github_jupyter
# Logistic Regression ## Importing the libraries ``` #for debug purpose %qtconsole --style solarized-dark import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` ## Importing the dataset ``` dataset = pd.read_csv('Social_Network_Ads.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, -1].va...
github_jupyter
# Practice Exercise - 04 - Solution ### Question 1: We have two sets given below. Print the set of elements that are present in either set1 or set2 but not both. set1 = {1, 2, 3, 4, 5} <br>set2 = {4, 5, 6, 7} #### Expected Output: {1, 2, 3, 6, 7} ``` set1 = {1, 2, 3, 4, 5} set2 = {4, 5, 6, 7} set1 ^ set2 ``` ##...
github_jupyter
# Tensorflow and Keras Basics Problem: we want to predict the price of the gem stone based on the features 1 and 2. ``` import numpy as np import pandas as pd import seaborn as sns folder_path = 'drive/MyDrive/TensorFlow-Data' file_path = folder_path + '/fake_reg.csv' ``` ## 1) read in your data ``` sns.pairplot...
github_jupyter
--- Debug Pod --- ``` from pathlib import Path model_dir = f'/data/models' model_main = f'sleep_main.py' Path(model_dir).mkdir(exist_ok=True) print("create model directory done.") %%writefile {model_dir}/{model_main} import time time.sleep(6000) print("task done.") import requests from requests.packages.urllib3.exce...
github_jupyter
``` import pandas as pd import numpy as np import datetime as dt import seaborn as sns import matplotlib.pyplot as plt import matplotlib.dates as mdates %matplotlib inline import matplotlib.style as style style.use('seaborn-whitegrid') import os import re # import googlemaps # import time import pickle from collectio...
github_jupyter
# Forward simulation the 1D Magnetotelluric (MT) problem In the [previous notebook](./MT1D_Simulation.ipynb), we walked through how to discretize and solve the 1D Magnetotelluric (MT) problem using a finite difference approach. In this notebook, we will use the numerical simulation to simulate MT data and explore conc...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import time import pickle from pytrends.request import TrendReq pytrend = TrendReq() class Trend: # Required: # import pandas as pd # import pickle # import matplotlib.pyplot as plt # from pytrends.request import TrendReq ...
github_jupyter
# Convolutional Networks So far we have worked with deep fully-connected networks, using them to explore different optimization strategies and network architectures. Fully-connected networks are a good testbed for experimentation because they are very computationally efficient, but in practice all state-of-the-art resu...
github_jupyter
<a href="https://colab.research.google.com/github/53X/53X.github.io/blob/master/Welcome_To_Colaboratory.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <img height="45px" src="https://colab.research.google.com/img/colab_favicon.ico" align="left" hsp...
github_jupyter
Hypothesis Testing ========= Copyright 2015 Allen Downey License: [Creative Commons Attribution 4.0 International](http://creativecommons.org/licenses/by/4.0/) ``` from __future__ import print_function, division import numpy import scipy.stats import matplotlib.pyplot as pyplot from IPython.html.widgets import i...
github_jupyter
<a name="loesung05"></a>Lösung Übung 05 === ``` # 1.a # Funktionskopf mit Definition von Name und # Anzahl der Argumente def rechenfunktion(x, y): # Funktionskörper # Berechnungen summe = x + y differenz = x - y produkt = x * y quotient = x / y # Ausgabe print('summe: {}'.fo...
github_jupyter
<a href="https://colab.research.google.com/github/unicamp-dl/IA025_2022S1/blob/main/ex07/Leonardo_Pacheco.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` nome = 'Leonardo Augusto da Silva Pacheco' print(f'Meu nome é {nome}.') ``` # Exercício: ...
github_jupyter
# Automated Car Detection - All Damage 50 Epochs - this method uses the Resnet model architecture - we train the model and produce weights from our training set - our 'levers' are the number of epochs, and the number of steps per epoch - this method also uses transfer learning. i.e. before we do anything we use weigh...
github_jupyter
# Predicting human wine test preference, Part 3 ## XGBoost The method that we used in the last notebook was boostrap agreggating (bagging). In this method we have 2 randomizing processes which ensure the uniqueness of the tree: 1. Pick a random number of features from the feature vector 2. Pick a random number of sa...
github_jupyter
## Single-cancer holdout dimension reduction analysis Following [this GitHub issue](https://github.com/greenelab/pancancer-evaluation/issues/39) and related discussions in lab meeting, we wanted to look at how separable the data is in the 95% holdout cases where performance isn't decreasing. Our hypothesis is that in ...
github_jupyter
``` import numpy as np import pandas as pd import scipy import matplotlib.pyplot as plt import datetime import math from sklearn.datasets import dump_svmlight_file # initialize spark from pyspark.sql import SparkSession from pyspark.sql import SQLContext from pyspark.ml.regression import RandomForestRegressor from pys...
github_jupyter
``` import os import matplotlib.pyplot as plt from demo.healthcare.histogram_inspection import HistogramInspection from demo.healthcare.missing_embeddings_inspection import MissingEmbeddingInspection from demo.healthcare.lineage_demo_inspection import LineageDemoInspection from mlinspect.inspections.materialize_first_...
github_jupyter
# Data Augmentation for Deep Learning <a href="https://mybinder.org/v2/gh/InsightSoftwareConsortium/SimpleITK-Notebooks/master?filepath=Python%2F70_Data_Augmentation.ipynb"><img style="float: right;" src="https://mybinder.org/badge_logo.svg"></a> This notebook illustrates the use of SimpleITK to perform data augmentat...
github_jupyter
``` import requests import pandas as pd BASE_URL = "https://api.nb.no/ngram/db2" BASE_URL1 = "https://api.nb.no/ngram/db1" pd.options.display.max_rows = 100 def ngram_book(word = ['.'], title = None, period = None, publisher = None, lang=None, city = None, ddk = None, topic = None): """Get a time series for a wo...
github_jupyter
# COMP9417 19T2 Homework 1: Applying Machine Learning _Last revision: Wed Jun 26 17:49:45 AEST 2019_ The aim of this homework is to enable you to **apply** different machine learning algorithms implemented in the Python [scikit-learn](http://scikit-learn.org/stable/index.html) machine learning library on a variety o...
github_jupyter
``` import open3d as o3d import numpy as np import copy import time import os import sys # monkey patches visualization and provides helpers to load geometries sys.path.append('..') import open3d_tutorial as o3dtut # change to True if you want to interact with the visualization windows o3dtut.interactive = not "CI" in...
github_jupyter
``` import os import pandas as pd import numpy as np from matplotlib import pyplot as plt %matplotlib inline csv_directory = os.getcwd()[:-40] + 'dataset\\' dataset = 'features.csv' csv_path = os.path.join(csv_directory, dataset) mydata = pd.read_csv(csv_path, delimiter=';', usecols=['is_featured', 'version', 'tags_num...
github_jupyter
# Introduction ### This project report will include 1. Explanation of the purpose, and background on my project 2. A in-depth explanation of my data merging ## Purpose The purpose of this project report (in notebook form) is to show some exploratory data analysis and data cleaning for this particular project. This pr...
github_jupyter
TSG083 - Run kubectl cluster-info dump ====================================== NOTE: This kubectl command can produce a lot of output, and may take some time (and produce a large notebook!). For Kubernetes clusters that have been up for a long time, consider running this command outside of a notebook. Steps ----- ###...
github_jupyter
#Splunk/Notebook/Graphistry Mashup This notebook shows a different kind of way to explore alerts: * **Exploratory notebook rather than an interactive dashboard.** This simplifies doing & sharing more complicated analysis, and with coming versions, can be quickly converted into a reusable dashboard. * **node-link diagr...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
# Creating a logistic regression to predict absenteeism ## Import the relevant libraries ``` import pandas as pd import numpy as np ``` ## Load the data ``` data_preprocessed = pd.read_csv('Absenteeism_preprocessed.csv') data_preprocessed.head() ``` ## Create the targets ``` data_preprocessed['Absenteeism Time in...
github_jupyter
# Prepare zero-shot split Based on the paper: Bansal, Ankan, et al. "Zero-shot object detection." Proceedings of the European Conference on Computer Vision (ECCV). 2018. ``` import json import numpy as np import torch from maskrcnn_benchmark.config import cfg from maskrcnn_benchmark.modeling.language_backbone.transfo...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU (this may not be needed on your computer) ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=1 ``` ### load packages ``` from tfumap.umap import tfUMAP import tensorflow as tf import numpy as np import matplotlib.pyplot as plt ...
github_jupyter
# 28 - 03 - 2021 ## First draft of our abstract In our first meeting with the group, we discussed about the topic and created a first draft of our abstract. For this, everyone wrote a draft and we combined our results in the end. # 30 - 03 - 2021 ## Preliminary Analysis: exploring the classes of errors I started to...
github_jupyter
##### Copyright 2020 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 pandas as pd from clickhouse_driver import Client %matplotlib inline import matplotlib.pyplot as plt import matplotlib from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import TimeSeriesSplit, GridSearchCV import numpy as np import eli5 matplotlib.rcParams["figure.figsize"] = (1...
github_jupyter
# Computer Vision Learner [`vision.learner`](/vision.learner.html#vision.learner) is the module that defines the [`create_cnn`](/vision.learner.html#create_cnn) method, to easily get a model suitable for transfer learning. ``` from fastai.gen_doc.nbdoc import * from fastai.vision import * ``` ## Transfer learning T...
github_jupyter
# Setup First, let us do some setup. * Create a SageMaker execution role. This role should have access to S3 and permission to create SageMaker HPO jobs. Save the ARN of this role. We need to paste this ARN in the line of code that defines `role` in our Lambda function later. * Create a SQS queue, note the URL of ...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets,transforms from torch.autograd import Variable import matplotlib.pyplot as plt %matplotlib inline is_cuda=False if torch.cuda.is_available(): is_cuda = True transformation = transforms...
github_jupyter
# spaCyTextBlob <a href='https://spacytextblob.netlify.app/'><img src='website/static/img/logo-thumb-circle-250x250.png' align="right" height="139" /></a> A TextBlob sentiment analysis pipeline compponent for spaCy. Version 3.0 is a major version update providing support for spaCy 3.0's new interface for adding pipe...
github_jupyter
``` %matplotlib inline import sys sys.path.insert(0, "../..") import random import deeptrack as dt import deeptrack.extras import numpy as np import skimage.color import matplotlib.pyplot as plt import tensorflow as tf import scipy.io import numpy as np import matplotlib.pyplot as plt crop_size = 40 padding = 32 wave...
github_jupyter
## Primer Design One of the first things anyone learns in a molecular biology lab is how to design primers. The exact strategies vary a lot and are sometimes polymerase-specific. `coral` uses the Klavins' lab approach of targeting a specific melting temperature (Tm) and nothing else, with the exact Tm targeted being b...
github_jupyter
# Python | Pandas DataFrame ### What is Pandas? <b>pandas</b> is a software library written for the Python programming language for data manipulation and analysis. In particular, it offers data structures and operations for manipulating numerical tables and time series. ### What is a Pandas DataFrame? <b>Pandas Dat...
github_jupyter
# Morphological tessellation One of the main features of `momepy` is the ability to generate and analyse morphological tessellation (MT). One can imagine MT like Voronoi tessellation generated around building polygons instead of points. The similarity is not accidental - the core of MT is a Voronoi diagram generated b...
github_jupyter
## Generate blend set ``` import pandas as pd import numpy as np import random from rdkit.Chem import AllChem from rdkit import RDLogger from sklearn.manifold import TSNE from rdkit.Chem import MolFromSmiles, DataStructs, rdMolDescriptors import matplotlib.pyplot as plt import seaborn as sns RDLogger.DisableLog('r...
github_jupyter
# Publications markdown generator for academicpages Takes a set of bibtex of publications and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html...
github_jupyter
``` import os import cv2 import math import warnings import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, fbeta_score from keras import optimizers from keras...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline import os, sys import pandas as pd sys.path.append('..') from pyMultiOmics.constants import * from pyMultiOmics.mapping import Mapper from pyMultiOmics.common import set_log_level_info ``` # Demonstration of pyMultiOmics mapping ## Load the processed Zebrafi...
github_jupyter
# Adams Moulton The Adams Moulton method is an implicit multistep method. This notebook illustrates the 2 step Adams Moulton method for a linear initial value problem. ## Intial Value Problem The general form of the population growth differential equation $$ y^{'}=t-y, \ \ (0 \leq t \leq 2) $$ with the initial condit...
github_jupyter
![qiskit_header.png](attachment:qiskit_header.png) # The IBM Q Account In Qiskit we have an interface for backends and jobs that is useful for running circuits and extending to third-party backends. In this tutorial, we will review the core components of Qiskit’s base backend framework, using the IBM Q account as an ...
github_jupyter
``` #import packages import gym import random import numpy as np import time #invoke the environment env_name = "FrozenLake-v0" # instantiate environment env = gym.make(env_name) # output variables for state and action print("Observation space:", env.observation_space) print("Action space:", env.action_space) #create...
github_jupyter
ERROR: type should be string, got "https://github.com/sn3fru/mensa_quadrant\n\n```\nimport pandas as pd\nimport numpy as np\nfrom sklearn.decomposition import PCA\nfrom math import sqrt\nfrom sklearn.preprocessing import normalize\nfrom sklearn import metrics\nfrom sklearn.cluster import KMeans\nimport matplotlib.pyplot as plt\n\n%matplotlib inline\ndf = pd.read_csv('dados_turma_03.csv', delimiter=';')\ndf.set_index('Nome',inplace=True)\ndf.drop(['Extremismo'], axis=1, inplace=True)\n\ndfn = normalize(df, norm='l2', axis=1, copy=True, return_norm=False)\npca = PCA(n_components=2, svd_solver='full')\npca.fit(dfn)\ndft = pca.transform(dfn)\nfinal = pd.merge(pd.DataFrame(dft),df.reset_index(),how='inner',left_index=True,right_index=True)\nfinal.rename(columns={0:'cp1',1:'cp2'},inplace=True)\nfinal.corr().round(3)\nfinal.reset_index(inplace=True)\ndist = lambda p1, p2: sqrt(((p1-p2)**2).sum())\ndm = np.asarray([[dist(p1, p2) for p2 in final[['cp1','cp2']].values] for p1 in final[['cp1','cp2']].values])\ndistance_matrix = pd.merge(pd.DataFrame(dm),final[['Nome']], how='inner',left_index=True,right_index=True)\ndistance_matrix.set_index('Nome', inplace=True)\ndistance_matrix.columns = list(final['Nome'])\ndistance_matrix.to_excel('distance_matrix.xlsx')\nkmeans = KMeans(init='k-means++', n_clusters=2, n_init=10)\nkmeans.fit(final[['cp1','cp2']])\n\nh = .02 # point in the mesh [x_min, x_max]x[y_min, y_max].\n\n# Plot the decision boundary. For that, we will assign a color to each\nx_min, x_max = final['cp1'].min() - 1, final['cp1'].max() + 1\ny_min, y_max = final['cp2'].min() - 1, final['cp2'].max() + 1\nxx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))\n\n# Obtain labels for each point in mesh. Use last trained model.\nZ = kmeans.predict(np.c_[xx.ravel(), yy.ravel()])\n\n# Put the result into a color plot\nZ = Z.reshape(xx.shape)\nplt.figure(1).set_size_inches(18, 9)\nplt.clf()\nplt.imshow(Z, interpolation='nearest',\n extent=(xx.min(), xx.max(), yy.min(), yy.max()),\n cmap=plt.cm.Paired,\n aspect='auto', origin='lower')\n\nplt.plot(final['cp1'], final['cp2'], 'k.', markersize=2)\n# Plot the centroids as a white X\ncentroids = kmeans.cluster_centers_\nplt.scatter(centroids[:, 0], centroids[:, 1],\n marker='x', s=169, linewidths=3,\n color='w', zorder=10)\n\nplt.title('K-means clustering on the mensan dataset (PCA-reduced data)\\n'\n 'Centroids are marked with white cross')\n\nplt.xlim(-0.4,0.6)\nplt.ylim(-0.2,0.2)\n\nfig, ax = plt.subplots()\n\nfig.set_size_inches(14, 10)\n\ncircle = plt.Circle((0, 0), .11, color='b', fill=False)\nax.add_artist(circle)\n\nfinal.plot('cp1', 'cp2', kind='scatter', ax=ax)\n\nfor k, v in final.set_index('Nome')[['cp1','cp2']].iterrows():\n ax.annotate(k, v)\n```\n\n"
github_jupyter
## Sparse Matrix Example This notebook implements a SENSE Example with sparse interpolation matrices. Sparse matrix-based interpolation is usually slower than table-based interpolation, but can be a bit more accurate, or might be faster for certain problem structures. ### References Fessler, J. A., & Sutton, B. P. (...
github_jupyter
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/chartmathc01matrix.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # メモ 手元にある 基礎からのチャート式数学C の 第1章行列 を読む。 いくつかの数や文字を長方形状に並べ、両側を括弧で囲んだものを行列といい、そのおのお...
github_jupyter
## Midterm Exam ### Brandan Owens and Loan Pham ### Q.1 ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np import string # (a) Set random seed to be 50. np.random.seed(50) np.random.randn(50) # (b) Create a dataframe with four columns of data:-Each column has 26 random integers between -5 and...
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--> < [Visualization with the `PyMOLMover`](http://nbviewer.jupyter.org/github/Rose...
github_jupyter
# Bite Size Bayes Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) ## Review [In the previous notebook](https://colab.research.google.com/github/AllenDowney/BiteSizeBayes/blob/master/03_cookie.ipynb...
github_jupyter
# SageMaker Edge Manager Example 1. [Introduction](#Introduction) 2. [Demo Setup](#Demo-Setup) 1. [Launch EC2 Instance](#Launch-EC2-Instance) 3. [Compile Model using SageMaker Neo](#Compile-Model-using-SageMaker-Neo) 1. [Load pretrained model](#Load-pretrained-model) 6. [Deploy Model using Sagemaker Edge Manag...
github_jupyter
# MSCKF MSCKF全称Multi-State Constraint Kalman Filter(多状态约束下的Kalman滤波器),是一种基于滤波的VIO算法,2007年由Mourikis在《A Multi-State Constraint Kalman Filter for Vision-aided Inertial Navigation》中首次提出。MSCKF在EKF框架下融合IMU和视觉信息,相较于单纯的VO算法,MSCKF能够适应更剧烈的运动、一定时间的纹理缺失等,具有更高的鲁棒性;相较于基于优化的VIO算法(VINS,OKVIS),MSCKF精度相当,速度更快,适合在计算资源有限的嵌入式平台运行。 MSCKF的...
github_jupyter
# Fonctions En programmation, une fonction est une suite d'instructions nommées. Ceci permet d'éviter de devoir réécrire des longues suites d'instructions et les appeler juste en invoquant le nom de la fonction. Nous pouvons ainsi définir la fonction `saluer()` ``` def saluer(): print('Bonjour') print('Comme...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import pandas as pd import pymc3 as pm from scipy.stats import norm, multivariate_normal import random %matplotlib inline df = pd.read_csv(pm.get_data('mastectomy.csv')) df.event = df.event.astype(np.int64) df.metastized = (df.metastized =...
github_jupyter
# 重回帰分析 If you come here without expecting Japanese, please click [Google translated version](https://translate.google.com/translate?hl=&sl=ja&tl=en&u=https%3A%2F%2Fpy4etrics.github.io%2F9_Multiple_Regression.html) in English or the language of your choice. --- ``` import numpy as np from scipy.stats import norm, un...
github_jupyter
**<p style="font-size: 35px; text-align: center">Probability Distributions</p>** ***<center>Miguel Ángel Vélez Guerra</center>*** <hr/> ![Distribuciones](https://4.bp.blogspot.com/-ImwjGBnN9Yg/VuYgbbaNBJI/AAAAAAAAA_o/rdXnY7x6I8svIEsXRcm51-jrj_Lopdb-w/s1600/E2-U3.png) <hr/> <hr/> **<p id="tocheading">Tabla de con...
github_jupyter
``` %reload_ext nb_black import numpy as np import pandas as pd from matplotlib import pyplot as plt import seaborn as sns from pyclustering.cluster.kmedoids import kmedoids from sklearn.cluster import AgglomerativeClustering, DBSCAN from umap import UMAP from sklearn.preprocessing import StandardScaler import prince ...
github_jupyter
# cuML Cheat Sheets sample code (c) 2020 NVIDIA, Blazing SQL Distributed under Apache License 2.0 ## Imports ``` import cudf import cuml import numpy as np import cupy as cp ``` ## Create regression dataset ``` X, y, c = cuml.make_regression( n_samples=10000 , n_targets=1 , n_features=4 , n_inform...
github_jupyter
# Conversational AI Think about how often you communicate with other people through instant messaging, social media, email, or other online technologies. For many of us, it's our go-to form of contact. When you have a question at work, you might reach out to a colleague using a chat message, which you can use on mobil...
github_jupyter
# DART Overview This notebook provides an interactive interface to the DART dataset. ``` %matplotlib inline import json from pathlib import Path from collections import Counter from functools import partial import logging import warnings warnings.filterwarnings("ignore") import pandas as pd import numpy as np import...
github_jupyter
# Custom Entity detection with Textract and Comprehend ## Contents 1. [Background](#Background) 1. [Setup](#Setup) 1. [Data Prep](#Data-Prep) 1. [Textract OCR++](#Textract-OCR++) 1. [Amazon GroundTruth Labeling](#Amazon-GroundTruth-Labeling) 1. [Comprehend Custom Entity Training](#Comprehend-Custom-Entity-Training) 1....
github_jupyter
# QAOA It is almost the same as the VQE algorithm, but we use QAOA-specific ansatz for combinatorial optimization problem. ## What we learn 1. How QAOA works 2. Implement QAOA with a simple example ## Install Blueqat Install Blueqat from pip. ``` !pip install blueqat ``` ---- ## Quantum Adiabatic Computation QAOA ...
github_jupyter
# Probability Author: Vo, Huynh Quang Nguyen ``` import numpy as np import matplotlib.pyplot as plt import seaborn as sb ``` # Acknowledgements: The contents of this note are based on the lecture notes and the materials from the sources listed below: 1. _Essential Math for Data Science_ in 6 Weeks webinar given by D...
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
``` import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters sequence_length = 28 input_size = 28 hidden_size = 128 num_layers = 2 num_classes = 10 batch_size = 100 ...
github_jupyter
### H1-B Visa Wage Prediction. ----- ----- ``` %pwd #import os #os.chdir('E:\ML Project\Project1') import pandas as pd import numpy as np import warnings import collections import seaborn as sns from datetime import datetime from matplotlib import pyplot as plt from sklearn.model_selection import train_test_split fro...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.ticker import numpy as np import pandas as pd import seaborn as sns %matplotlib inline current_working_directory = os.environ.get("PWD") if curr...
github_jupyter
``` import pydicom from glob import glob from random import randint from copy import deepcopy from datetime import datetime import numpy as np import pandas as pd pydicom.config.enforce_valid_values = True pd.set_option('display.max_rows', 500) multi_arc_plan = pydicom.read_file('MVISO_VMATNEWSPLIT.dcm', force=True) b...
github_jupyter
``` import numpy as np import pandas as pd import networkx as nx %matplotlib inline import gspread from oauth2client.service_account import ServiceAccountCredentials import pandas as pd scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] credentials = ServiceAccountCre...
github_jupyter
# Exp 136 analysis See `./informercial/Makefile` for experimental details. ``` import os import numpy as np from pprint import pprint 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_...
github_jupyter
# Flowers Dataset http://www.robots.ox.ac.uk/~vgg/data/flowers/17/ ``` import numpy as np import matplotlib.pyplot as plt import keras # from keras.datasets import cifar10 from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten, Reshape from keras.layers import Conv2D, MaxPool...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #default_exp data.core #export from fastai.torch_basics import * from fastai.data.load import * #hide from nbdev.showdoc import * ``` # Data core > Core functionality for gathering data The classes here provide functionality for ...
github_jupyter
``` import os import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.patches import Ellipse from mpl_toolkits.mplot3d import Axes3D import seaborn as sns import tensorflow as tf if os.getcwd().split(os.sep)[-1] == 'notebook': os.chdir('..') from cma import CMA from notebook.u...
github_jupyter
``` from dask.distributed import Client, LocalCluster if __name__ == "__main__": cluster=LocalCluster(host="tcp://127.0.0.1:2456",dashboard_address="127.0.0.1:2467",n_workers=4) client = Client(cluster) import numpy as np import pandas as pd import xarray as xr import math import dask import skimage.feature im...
github_jupyter
# Example 6: Non-linear PCA A non-linear principal component analysis (NLPCA) is quite similar to the standard PCA model presented in Example 1. The main difference comes from the conditional distribution of $\boldsymbol{x}$. In the NLPCA model, the mean of the normal distribution of $\boldsymbol{x}$ linearly depend...
github_jupyter
<a href="https://colab.research.google.com/github/noahbjohnson/advent-of-code-2020/blob/main/notebooks/Day_Three.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` inputText = [ "......#...........#...#........", ".#.....#...##.......#.....##...", ...
github_jupyter
# Launch into interactive computing interfaces Because Jupyter Books are built with Jupyter notebooks, you can allow users to launch live Jupyter sessions in the cloud directly from your book. This lets readers quickly interact with your content in a traditional coding interface. They do so by clicking a **Launch Butt...
github_jupyter
``` import numpy as np import mccd.mccd_utils as mccd_utils import mccd.utils as utils import mccd.auxiliary_fun as mccd_aux import mccd from astropy.io import fits import random import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib.colors imp...
github_jupyter
# Split Normal Mixture Figure 2 in the [paper](https://arxiv.org/abs/2007.09670). ``` import os import sys os.chdir('..') sys.path.append('..') %config InlineBackend.figure_formats = ['svg'] import matplotlib import matplotlib.pyplot as plt %matplotlib inline import numpy as np from pprint import pprint import ne...
github_jupyter
``` import collections import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats import statsmodels.api as sm np.set_printoptions(suppress=True) cadralazine_data = pd.DataFrame(collections.OrderedDict([ ('time', [2, 4, 6, 8, 10, 24, 28, 32]), ('drug concen...
github_jupyter
# ABT ``` %matplotlib inline import random import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_ind, ttest_rel, mannwhitneyu # Matplotlib plt.style.use('bmh') plt.rcParams['figure.figsize'] = (16, 8) %%capture # R from rpy2.robjects.packages impo...
github_jupyter
# Hyperparameter tuning In the previous section, we did not discuss the parameters of random forest and gradient-boosting. However, there are a couple of things to keep in mind when setting these. This notebook gives crucial information regarding how to set the hyperparameters of both random forest and gradient boost...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Goal" data-toc-modified-id="Goal-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Goal</a></span></li><li><span><a href="#Var" data-toc-modified-id="Var-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Va...
github_jupyter
# Lab 03 : LeNet5 architecture - exercise ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: # mount google drive from google.colab import drive drive.mount('/content/gdrive') # find automatically the path of the folder containing "file_name" : file_name = 'lenet5_exerci...
github_jupyter
___ <a href='https://mp.weixin.qq.com/mp/appmsgalbum?__biz=Mzg2OTU4NzI3NQ==&action=getalbum&album_id=1764511202329624577&scene=126#wechat_redirect'> <img src=../../../../pic/project_logo.jpg></a> ___ # Missing Data 处理 pandas 中缺失数据的便捷方法 ⚠️先说说 None/NaN 的区别 ``` import numpy as np import pandas as pd # Pandas automati...
github_jupyter
``` import os, re, copy, pickle from collections import defaultdict from tqdm import tqdm from functools import partial tqdm = partial(tqdm, position=0, leave=True) import numpy as np import pandas as pd from scipy import linalg, special, stats from sklearn.utils.extmath import stable_cumsum from sklearn import (imp...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib notebook import numpy as np import math import scipy as sp import copy import os import matplotlib.pyplot as plt from libwallerlab.projects.motiondeblur import blurkernel import bluranalysis as analysis # plt.style.use('deblur') ``` ## Blur Len vs Beta ``` # blur_l...
github_jupyter
# Part I. ETL Pipeline for Pre-Processing the Files ## PLEASE RUN THE FOLLOWING CODE FOR PRE-PROCESSING THE FILES #### Import Python packages ``` # Import Python packages import pandas as pd import cassandra import re import os import glob import numpy as np import json import csv ``` #### Creating list of filepat...
github_jupyter
``` #IMPORT SEMUA LIBARARY #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY UNTUK POSTGRE from sqlalchemy import create_engine import psycopg2 #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY BASE PATH import os import io #IMPORT LIBARARY PDF from fpdf im...
github_jupyter
# Identify Fraud from Enron Email [Cédric Campguilhem](https://github.com/ccampguilhem/Udacity-DataAnalyst), November 2017 <a id="Top"> ## Table of contents - [Introduction](#Introduction) - [Project organisation](#Organisation) - [Dataset](#Dataset) - [Downloading dataset](#Download) - [Data exploration](#...
github_jupyter
Heroes Of Pymoli Challange Part 1: I need to import dependencies ``` #Import dependencies import pandas as pd import numpy as np ``` Part 2: I need to Reference the file and import the data to pandas. ``` # Reference the file where the CSV is located HeroesOfPymoli_csv_path = "Resources/purchase_data.csv" # Import...
github_jupyter
# 6. For Loop ## 6.1 Introduction Well, in the first lesson about loops, I said I would put off teaching you the for loop, until we had reached lists. Well, here it is! ## 6.2 The `for` Loop Basically, the `for` loop does something for every value in a list. The way it is set out is a little confusing, but otherwise is...
github_jupyter
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Creative C...
github_jupyter
``` from bs4 import BeautifulSoup from requests import get import pandas as pd import numpy as np from datetime import datetime, timedelta import math import os # Function for remove comma within numbers def removeCommas(string): string = string.replace(',','') return string ``` # Scrap data from worldmeter...
github_jupyter