text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
### x lines of Python # 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 `wel...
github_jupyter
<a href="https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/TensorFlow%20Deployment/Course%203%20-%20TensorFlow%20Datasets/Week%202/Examples/Week2ExerciseA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title Licensed un...
github_jupyter
``` %%bash # Download model check-point and module from below repo by pudae: # Check if tf-slim will have densenet121 at some point wget -N https://github.com/pudae/tensorflow-densenet/raw/master/nets/densenet.py wget -N https://ikpublictutorial.blob.core.windows.net/deeplearningframeworks/tf-densenet121.tar.gz tar xz...
github_jupyter
# Nodes From the [Interface](basic_interfaces.ipynb) tutorial, you learned that interfaces are the core pieces of Nipype that run the code of your desire. But to streamline your analysis and to execute multiple interfaces in a sensible order, you have to put them in something that we call a ``Node``. In Nipype, a nod...
github_jupyter
``` interaction_dataframe = ppi_df columns = ['xref_A', 'xref_B'] identifier_series = pd.Series(pd.unique(interaction_dataframe[columns].values.ravel('K'))) ids = identifier_series[identifier_series.str.startswith('ensembl:')] from pathlib import Path import pandas as pd import numpy as np from phppipy.dataprep import...
github_jupyter
# Introduction :label:`chap_introduction` Until recently, nearly every computer program that we interact with daily was coded by software developers from first principles. Say that we wanted to write an application to manage an e-commerce platform. After huddling around a whiteboard for a few hours to ponder the pr...
github_jupyter
(2.1.0)= # 2.1.0 Download ORACC JSON Files Each public [ORACC](http://oracc.org) project has a `zip` file that contains a collection of JSON files, which provide data on lemmatizations, transliterations, catalog data, indexes, etc. The `zip` file can be found at `http://oracc.museum.upenn.edu/[PROJECT]/json/[PROJECT]....
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt def f(theta, t): c1 = -0.2 c2 = 0.2 c3 = 1.2 return np.exp(t * (theta - c1)**2) + np.exp(t * ((theta - c2)**2 +0.1)) + np.exp(t * (theta - c3)**2) def get_optimal_and_minimizer(t, iters, lr, theta_0=0.25): c1 = -0.2 c2 = 0.2 c3 = 1.2 ...
github_jupyter
``` import pandas as pd method_raw_text = pd.read_excel('sents_df.xlsx') ``` # Knowledge Related Sentences in Reviews - Co-Word Network ``` # replace all newlines from dataframe method_raw_text = method_raw_text.replace('\n','', regex=True) method_raw_text = method_raw_text.dropna() import re for line in method_raw_t...
github_jupyter
Nineth exercice: non-Cartesian MR image reconstruction ============================================= In this tutorial we will reconstruct an MRI image from radial undersampled kspace measurements. Let us denote $\Omega$ the undersampling mask, the under-sampled Fourier transform now reads $F_{\Omega}$. Import neuroim...
github_jupyter
## Job Description to Resume Comparator - FreqDist This program compares the words found in a job description to the words in a resume. The current version compares all words and gives a naive percentage match. ``` from nltk import sent_tokenize, word_tokenize, pos_tag from nltk.corpus import stopwords import pandas...
github_jupyter
# Density Profile and IFT of mixture of Hexane + Ethanol and CPME First it's needed to import the necessary modules ``` import numpy as np import matplotlib.pyplot as plt from sgtpy import component, mixture, saftvrmie from sgtpy.equilibrium import bubblePy from sgtpy.sgt import sgt_mix ``` The ternary mixture is c...
github_jupyter
# The Unique Properties of Qubits ``` from qiskit import * from qiskit.visualization import plot_histogram ``` You now know something about bits, and about how our familiar digital computers work. All the complex variables, objects and data structures used in modern software are basically all just big piles of bits. ...
github_jupyter
# Cross Validation > Holdout sets are a great start to model validation. However, using a single train and test set if often not enough. Cross-validation is considered the gold standard when it comes to validating model performance and is almost always used when tuning model hyper-parameters. This chapter focuses on pe...
github_jupyter
# Data Download and Pre-processing ``` %reload_ext autoreload %autoreload 2 %matplotlib inline import yaml import os from usal_echo import bucket, dcm_dir, img_dir, segmentation_dir, model_dir, classification_model from usal_echo.d00_utils.db_utils import * from usal_echo.d01_data.ingestion_dcm import ingest_dcm from...
github_jupyter
``` import numpy as np import sys import matplotlib.pyplot as plt import os import scipy.constants as ct from mpl_toolkits.mplot3d import Axes3D %matplotlib inline Ryd2eV=13.605692 bohr2nm=ct.physical_constants["Bohr radius"][0]*1e9 print bohr2nm plt.rcParams['figure.figsize'] = (14.0, 10.0) def readmps(filename): ...
github_jupyter
# Find hospitals closest to an incident The `network` module of the ArcGIS API for Python can be used to solve different types of network analysis operations. In this sample, we see how to find the hospital that is closest to an incident. ## Closest facility The closest facility solver provides functionality for fin...
github_jupyter
## maggy - MNIST Example --- Created: 24/04/2019 This notebook illustrates the usage of the maggy framework for asynchronous hyperparameter optimization on the famous MNIST dataset. In this specific example we are using random search over three parameters and we are deploying the median early stopping rule in order...
github_jupyter
``` import sys import os import json import numpy as np import glob import copy %matplotlib inline import matplotlib.pyplot as plt import importlib import util_human_model_comparison import util_figures_psychophysics sys.path.append('/packages/msutil') import util_figures def load_results_dict(results_dict_fn, pop_...
github_jupyter
<font size=5>Confusion Matrix</font> <p>When we build models, it is important to assess how good or bad our model is, and how well it performs on unseen data. Several metrics like accuracy, time taken etc. exist to evaluate model performance. We will see some of the most important and useful ones for the same.</p> <p>...
github_jupyter
# Cloud APIs for Computer Vision: Up and Running in 15 Minutes This code is part of [Chapter 8- Cloud APIs for Computer Vision: Up and Running in 15 Minutes ](https://learning.oreilly.com/library/view/practical-deep-learning/9781492034858/ch08.html). ## Get MSCOCO validation image ids with legible text We will devel...
github_jupyter
# Fleet Predictive Maintenance: Part 2. Data Preparation with Data Wrangler 1. [Architecure](0_usecase_and_architecture_predmaint.ipynb#0_Architecture) 1. [Data Prep: Processing Job from Data Wrangler Output](./1_dataprep_dw_job_predmaint.ipynb) 1. [Data Prep: Featurization](./2_dataprep_predmaint.ipynb) 1. [Train, Tu...
github_jupyter
# Purpose This notebook's purpose is to sift through all of the hospital chargemasters and metadata generated via the work already done in [this wonderful repo](https://github.com/vsoch/hospital-chargemaster) (from which I forked my repo). This is where the data engineering for Phase II of this project occurs. For mor...
github_jupyter
``` import numpy as np import random from math import * import time import copy import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F torch.set_default_tensor_type('torch.DoubleTensor') # defination of activation function def activation(x): return x * torch.sigmoid...
github_jupyter
# Renaming CSV Files This notebook renames the CSV files of the ESA project. The filenames in the SQL database are not very descriptive, therefore it was important to change the filenames for a better user experience. The current filenames look something like this: 1059614_14_lattice-v_1.csv In this notebook, we wil...
github_jupyter
``` from local_vars import root_folder data_folder = r"Circles" image_size = 64 batch_size = 20 input_intensity_scaling = 1 / 255.0 import pandas as pd import numpy as np import itertools import os import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from matplotlib import pyplot a...
github_jupyter
# Calculating Thermodynamics Observables with a quantum computer ``` # imports import numpy as np import pandas as pd import matplotlib.pyplot as plt from functools import partial from qiskit.utils import QuantumInstance from qiskit import Aer from qiskit.algorithms import NumPyMinimumEigensolver, VQE from qiskit_na...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt ``` ### 1. Data science formalism ``` from sklearn.datasets import load_iris iris = load_iris() iris.keys() ``` In supervised machine learning, you have some data with the corresponding label for thes...
github_jupyter
``` import numpy as np import cv2 import matplotlib.pyplot as plt import os from pdf2image import convert_from_path import tempfile from sklearn.metrics import confusion_matrix from sklearn.model_selection import train_test_split from sklearn import svm import segment_boards %matplotlib inline def sbw(im): plt.ims...
github_jupyter
``` import numpy as np from scipy.stats import gennorm, norm import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from scipy.stats import binned_statistic def bin_data(data, min_ct=10, num_bins=10, ascending=False, noise=1E-6, ma...
github_jupyter
# Import ``` import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision import torchvision.transforms as transforms from torch.utils.tensorboard import SummaryWriter writer = SummaryWriter('runs/lenet') ``` # Loa...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=2 import tensorflow as tf gpu_devices = tf.config.experimental.list_physical_devices('GPU') if len(gpu_devices)>0: tf.config.experimental.set_memory_growth(gpu_devices[0], Tr...
github_jupyter
``` import os def get_recursive_filenames(directory,upc_to_filenames): for name in os.listdir(directory): path = os.path.join(directory, name) if os.path.isdir(path): get_recursive_filenames(path,upc_to_filenames) else: upc = os.path.basename(os.path.dirname(path)) ...
github_jupyter
INRODUCTION This tutorial will describe a broad overview of the Plotly visualization tool for Python. It is a wrapper based around the matplotlib library. The advantages of using the plotly library is that it has a faster learning curve and lower complexity compared to the matplotlib library. It is suitable for data ...
github_jupyter
# <font color='firebrick'><center>Idx Stats Report</center></font> ### This report provides information from the output of samtools idxstats tool. It outputs the number of mapped reads per chromosome/contig. <br> ``` from IPython.display import display, Markdown from IPython.display import HTML import IPython.core.dis...
github_jupyter
``` # DATA SETUP ''' Note: for more information about our data pre-processing and categorizing into states, see the README in the data folder. We have cited sources for all data used and included a brief description of the states we decided on there.''' import numpy as np import pandas as pd from qubayes_tools import...
github_jupyter
# Vietnam ## Table of contents 1. [General Geography](#1)<br> 1.1 [Soil Resources](#11)<br> 1.2 [Road and Railway Network](#12)<br> 2. [Poverty in Vietnam](#2)<br> 2.1 [The percentage of malnourished children under 5 in 2018 by locality](#21)<br> 2.2 [Proportion of poor households by region from 1998...
github_jupyter
``` import os import matplotlib.pyplot as plt import numpy as np import tensorflow as tf import sonnet as snt from graph_nets import utils_tf from graph_nets import utils_np from graph_nets import graphs from root_gnn.src.generative import mlp_gan as toGan from root_gnn.utils_plot import add_mean_std batch_size = 1...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '1' import numpy as np import tensorflow as tf import json with open('dataset-bpe.json') as fopen: data = json.load(fopen) train_X = data['train_X'] train_Y = data['train_Y'] test_X = data['test_X'] test_Y = data['test_Y'] EOS = 2 GO = 1 vocab_size = 32000 train_Y ...
github_jupyter
``` from flask import Flask import matplotlib.pyplot as plt from flask import Flask, request, render_template import pandas import os import sys from flask import Flask, request, session, g, redirect, url_for, abort, render_template from flaskext.mysql import MySQL from flask_wtf import FlaskForm from wtforms.fields.ht...
github_jupyter
# 02 - Ensembling: Bagging, Boosting and Ensemble <div class="alert alert-block alert-success"> <b>Version:</b> v0.1 <b>Date:</b> 2020-06-09 在这个Notebook中,记录了`Randomforest` `XGBoost` 以及模型组合的实现策略。 </div> <div class="alert alert-block alert-info"> <b>💡:</b> - **环境依赖**: Fastai v2 (0.0.18), XGBoost(1.1.1), sk...
github_jupyter
# Chapter 2: Working With Lists Much of the remainder of this book is dedicated to using data structures to produce analysis that is elegant and efficient. To use the words of economics, you are making a long-term investment in your human capital by working through these exercises. Once you have invested in these fixe...
github_jupyter
# Pretrained Transformers as Universal Computation Engines Demo This is a demo notebook illustrating creating a Frozen Pretrained Transformer (FPT) and training on the Bit XOR task, which converges within a couple minutes. arXiv: https://arxiv.org/pdf/2103.05247.pdf Github: https://github.com/kzl/universal-computati...
github_jupyter
<a href="https://colab.research.google.com/github/Scott-Huston/DS-Unit-1-Sprint-2-Data-Wrangling-and-Storytelling/blob/master/LS_DS_121_Join_and_Reshape_Data.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> _Lambda School Data Science_ # Join and Re...
github_jupyter
# An agent-based model of social support *Joël Foramitti, 10.02.2022* This notebook introduces a simple agent-based model to explore the propagation of social support through a population. ``` import agentpy as ap import networkx as nx import seaborn as sns import matplotlib.pyplot as plt sns.set_theme() ``` The a...
github_jupyter
``` !wget https://datahack-prod.s3.amazonaws.com/train_file/train_LZdllcl.csv -O train.csv !wget https://datahack-prod.s3.amazonaws.com/test_file/test_2umaH9m.csv -O test.csv !wget https://datahack-prod.s3.amazonaws.com/sample_submission/sample_submission_M0L0uXE.csv -O sample_submission.csv import numpy as np import p...
github_jupyter
# TensorFlow2 및 SMDataParallel을 사용한 분산 데이터 병렬 BERT 모델 훈련 SMDataParallel은 Amazon SageMaker의 새로운 기능으로 딥러닝 모델을 더 빠르고 저렴하게 훈련할 수 있습니다. SMDataParallel은 PyTorch, TensorFlow 및 MXNet을 위한 분산 데이터 병렬 훈련 프레임워크입니다. 이 노트북 예제는 [Amazon SageMaker](https://aws.amazon.com/sagemaker/)에서 TensorFlow(버전 2.3.1)와 함께 SMDataParallel을 사용하여 [Ama...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import json ``` ### Read in json line file ``` board_data = [] with open('company-officers-v2.json') as f: for line in f: board_data.append(json.loads(line)) board_data[1] ``` ### Read out board member information and write into ...
github_jupyter
# Density Tree for N-dimensional data and labels The code below implements a **density** tree for non-labelled data. ## Libraries First, some libraries are loaded and global figure settings are made for exporting. ``` import numpy as np import matplotlib.pyplot as plt import os from IPython.core.display import Image,...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys sys.path.insert(0, '../') sys.path.append('/home/arya_03/.envs/objdet/lib/python2.7/site-packages/') import matplotlib matplotlib.use('Agg') from __future__ import division import os import numpy as np import pandas as pd from skimage.io import imread import cv2 from pa...
github_jupyter
# Multi-Layer Perceptron, MNIST --- In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database. The process will be broken down into the following steps: >1. Load and visualize the data 2. Define a neural network 3. Train the model...
github_jupyter
# Agilent 34411A versus Keysight 34465A The following notebook perfoms a benchmarking of the two DMMs. In part one, raw readings of immediate voltages are timed and compared. In part two, actual sweeps are performed with a QDac. ``` %matplotlib notebook import time import matplotlib.pyplot as plt import numpy as np ...
github_jupyter
<small><i>This notebook was originally put together by [Jake Vanderplas](http://www.vanderplas.com) for PyCon 2014. [Peter Prettenhofer](https://github.com/pprett) adapted it for PyCon Ukraine 2014. Source and license info is on [GitHub](https://github.com/pprett/sklearn_pycon2014/).</i></small> # Part 2: Representati...
github_jupyter
Tensor RTに変換された学習済みモデルをつかって自動走行します。 ``` import torch import torchvision CATEGORIES = ['apex'] device = torch.device('cuda') model = torchvision.models.resnet18(pretrained=False) model.fc = torch.nn.Linear(512, 2 * len(CATEGORIES)) model = model.cuda().eval().half() ``` Tensor RT形式のモデルを読み込む。 ``` import torch from t...
github_jupyter
``` #내장 함수 정리 #abs : 절댓값 리턴 num = abs(-5) print(num) #all, any : 참 거짓 리턴 """ +-----------------------------------------+---------+---------+ | | any | all | +-----------------------------------------+---------+---------+ | All Truthy values | True...
github_jupyter
# Build Experiment from tf.layers model Embeds a 3 layer FCN model to predict MNIST handwritten digits in a Tensorflow Experiment. The model is built using the __tf.layers__ API, and wrapped in a custom Estimator, which is then wrapped inside an Experiment. ``` from __future__ import division, print_function from ten...
github_jupyter
# HOW TO ADD A NEW CLASS TO OBJECT DETECTION PIPELINE? ``` ## Uncomment command below to kill current job: #!neuro kill $(hostname) %load_ext autoreload %autoreload 2 import sys sys.path.append('../') from detection.model import get_model from detection.coco_subset import CLS_SELECT, COLORS, N_COCO_CLASSES from detec...
github_jupyter
``` if 0 : %matplotlib inline else : %matplotlib notebook ``` # Import libraries ``` import sys import os module_path = os.path.abspath('.') +"\\_scripts" print(module_path) if module_path not in sys.path: sys.path.append(module_path) from _00_Import_packages_git3 import * from time import sleep from s...
github_jupyter
![](https://ipython.org/_static/IPy_header.png) created by Fernando Perez ( https://www.youtube.com/watch?v=g8xQRI3E8r8 ) ![](https://jupyter.org/assets/jupyterpreview.png) # Prerequisites2 : Python Data Science Environment # Learning Plan ### Lesson 2-1: IPython In this lesson, you learn how to use IPython. ### ...
github_jupyter
This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/data-science-ipython-notebooks). # Data Structure Utilities * slice * range and xrange * bisect * sort * sorted * reversed * enumerate * zip * list comprehensions ## slice Slic...
github_jupyter
# Alternative Models In order to ensure the model used to make predictions for the analysis, I also tried training & testing various other models that were good candidates (based on the characteristics of our data). Specifically, we also tested the following regression models: 1. Linear (Lasso Regularization) 2. Linea...
github_jupyter
## Setup ``` %matplotlib qt from tensorflow.keras.datasets import mnist import matplotlib.pyplot as plt import numpy as np from pathlib import Path import os Path('mnist_distribution').mkdir(exist_ok=True) os.chdir('mnist_distribution') #load MNIST and concatenates train and test data (x_train, _), (x_test, _) = mnist...
github_jupyter
# Plots for litholog paper Using the demo data provided in the `litholog` release, this notebook demonstrates data import, plotting and simple statistics of bed thickness and grain size. ## Import packages ``` import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import scipy....
github_jupyter
This approach checks if some data preprocessing helps on the results. ``` import pandas as pd import re from sklearn.naive_bayes import MultinomialNB from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics import classification_report...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Gena/map_get_center.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="ht...
github_jupyter
# Advanced Matplotlib Concepts Lecture In this lecture we cover some more advanced topics which you won't usually use as often. You can always reference the documentation for more resources! #### Logarithmic scale It is also possible to set a logarithmic scale for one or both axes. This functionality is in fact onl...
github_jupyter
# Computer Vision Nanodegree ## Project: Image Captioning --- In this notebook, you will train your CNN-RNN model. You are welcome and encouraged to try out many different architectures and hyperparameters when searching for a good model. This does have the potential to make the project quite messy! Before subm...
github_jupyter
# EOS 1 image analysis Python code walk-through - This is to explain how the image analysis works for the EOS 1. Python version 2.7.15 (Anaconda 64-bit) - If you are using EOS 1, you can use this code for image analysis after reading through this notebook and understand how it works. - Alternatively, you can also us...
github_jupyter
# Exploration of the modulators and downstream effectors of HDAC6 ``` import time import sys import getpass from collections import defaultdict import bel_repository import bio2bel_hgnc import bio2bel_famplex import pandas as pd import pybel import pybel_jupyter import pybel_tools import hbp_knowledge from pybel.dsl...
github_jupyter
# Development Notebook for extracting icebergs from DEMs by Jessica Scheick Workflow based on previous methods and code developed by JScheick for Scheick et al 2019 *Remote Sensing*. ***Important note about CRS handling*** This code was developed while also learning about Xarray, rioxarray, rasterio, and other Pytho...
github_jupyter
``` import csv from bs4 import BeautifulSoup from selenium import webdriver from datetime import datetime import requests driver=webdriver.Chrome(executable_path="F:\Web_Scraping\chromedriver.exe") url = "https://www.naukri.com/" def get_url(post,location): template="https://in.indeed.com/jobs?q={}&l={}" url=te...
github_jupyter
``` import numpy as np import tensorflow as tf experiment = '_16snap' _04847_img = np.load('4847' + experiment + '-image.npy') _04799_img = np.load('4799' + experiment + '-image.npy') _04820_img = np.load('4820' + experiment + '-image.npy') _05675_img = np.load('5675' + experiment + '-image.npy') _05680_img = np.load(...
github_jupyter
# Homework 1 [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/rhennig/EMA6938/blob/main/Notebooks/Homework1.ipynb) ## Problem 1 (100 points using the rubric) In this problem, we will investigate a polynomial regression model on a 2-dimensional datas...
github_jupyter
# CORONA VIRUS PANDEMIC!🦠 ![](https://techcrunch.com/wp-content/uploads/2020/03/GettyImages-1209679043.jpg) # **What is Corona Virus?[](http://)** Coronavirus disease (COVID-19) is an infectious disease caused by a newly discovered coronavirus. Most people infected with the COVID-19 virus will experience mild to mo...
github_jupyter
## Визуализация данных в Python **Материал подготовила Арина Ситникова** Теперь, когда мы рассмотрели основы препроцессинга данных в Python, используя библиотеки Numpy и Pandas, мы можем перейти к очень интересному, но при этом очень важному блоку, который составляет немалую часть работы специалистов в области data s...
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
# IWI131 Programación ## Diccionarios Un diccionario es una **colección no ordenada** que permite asociar llaves con valores. Utilizando la llave siempre es posible recuperar, de manera eficiente, el valor asociado. - El funcionamiento de diccionarios es similar a cuando se recupera un elemento de una lista usando s...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.cluster import KMeans from sklearn.svm import SVC from sklearn import metrics from mlxtend.plotting import plot_decision_regions from sklearn import preprocessing, metrics...
github_jupyter
<a href="https://colab.research.google.com/github/rudyhendrawn/traditional-dance-video-classification/blob/main/tari_vgg16_lstm_224.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import os import glob from keras_video import VideoFrameGenerator...
github_jupyter
# 1-Getting Started Always run this statement first, when working with this book: ``` from scipy import * from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" ``` ## Numbers ``` 2 ** (2 + 2) 1j ** 2 # A complex number 1. + 3.0j # Another complex number ``` ##...
github_jupyter
# Automatic Suggestion of Constraints In our experience, a major hurdle in data validation is that someone needs to come up with the actual constraints to apply on the data. This can be very difficult for large, real-world datasets, especially if they are very complex and contain information from a lot of different so...
github_jupyter
# Shingling with Jaccard Comparing document similarities where the set of objects is word or character ngrams taken over a sliding window from the document (shingles). The set of shingles is used to determine the document similarity, Jaccard similarity, between a pair of documents. ``` from tabulate import tabulate ...
github_jupyter
# Character Issues ``` s = 'café' len(s) b = s.encode('utf8') b len(b) b.decode('utf8') ``` # Byte Essentials ``` cafe = bytes('café', encoding='utf_8') cafe cafe[0] cafe[:1] cafe_arr = bytearray(cafe) cafe_arr cafe_arr[-1:] bytes.fromhex('31 4B CE A9') import array numbers = array.array('h', [-2, -1, 0, 1, 2]) octe...
github_jupyter
``` # Reload when code changed: %load_ext autoreload %autoreload 2 %pwd import os import sys path = "../" sys.path.append(path) #os.path.abspath("../") print(os.path.abspath(path)) import core import importlib importlib.reload(core) import logging importlib.reload(core) try: logging.shutdown() importlib.reloa...
github_jupyter
<a href="https://colab.research.google.com/github/morcellinus/Python_ML-DL/blob/main/3.Iris_data_classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Iris classification ``` import pandas as pd import numpy as np from sklearn import dat...
github_jupyter
# 4 - Convolutional Sentiment Analysis In the previous notebooks, we managed to achieve a test accuracy of ~85% using RNNs and an implementation of the [Bag of Tricks for Efficient Text Classification](https://arxiv.org/abs/1607.01759) model. In this notebook, we will be using a *convolutional neural network* (CNN) to...
github_jupyter
# Neural networks with PyTorch Next I'll show you how to build a neural network with PyTorch. ``` # Import things like usual %matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import torch import helper import matplotlib.pyplot as plt from torchvision import datasets, transforms ...
github_jupyter
# Simulators ## Introduction This notebook shows how to import *Qiskit Aer* simulator backends and use them to execute ideal (noise free) Qiskit Terra circuits. ``` import numpy as np # Import Qiskit from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import Aer, execute from qiskit.to...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Data-Load" data-toc-modified-id="Data-Load-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Data Load</a></span></li><li><span><a href="#Integrated-Gradients" data-toc-modified-id="Integrated-Gradients-2">...
github_jupyter
# A trip on a lift ### Experiment about the motion in 1D and Data Analysis The motion of a lift can be considered as an example of a motion along a straight line, which we can shortly refer to as **motion in 1D**. The aim of this worked example is that of studying the position, the velocity and the acceleration as a...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns import warnings import statsmodels.formula.api as smf import sklearn from sklearn.linear_model import Lasso import matplotlib.pyplot as plt import sys alpha = 0.7 ``` ### PROJECT INTRODUCTION The World Health Organization (WHO) estimates that each year ...
github_jupyter
# widgets.image_cleaner fastai offers several widgets to support the workflow of a deep learning practitioner. The purpose of the widgets are to help you organize, clean, and prepare your data for your model. Widgets are separated by data type. ``` from fastai.vision import * from fastai.widgets import DatasetFormatt...
github_jupyter
# Harvesting Commonwealth Hansard The proceedings of Australia's Commonwealth Parliament are recorded in Hansard, which is available online through the Parliamentary Library's ParlInfo database. [Results in ParlInfo](https://parlinfo.aph.gov.au/parlInfo/search/summary/summary.w3p;adv=yes;orderBy=_fragment_number,doc_d...
github_jupyter
# Matplotlib ``` import matplotlib.pyplot as plt import numpy as np x = [1,2,3] y = [2,4,6] plt.scatter(x,y) #scatter point on all the mentioned axis plt.show() x = [1,2,3] y = [2,4,6] plt.plot(x,y) #connect the point for me plt.show() x = [1,2,3] y = [2,4,6] plt.plot(x,y) #connect the point for me plt.scatter(x,y) p...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts_aux import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # L...
github_jupyter
# Modul Python Bahasa Indonesia ## Seri Kesembilan ___ Coded by psychohaxer | Version 1.1 (2020.12.24) ___ Notebook ini berisi contoh kode dalam Python sekaligus outputnya sebagai referensi dalam coding. Notebook ini boleh disebarluaskan dan diedit tanpa mengubah atau menghilangkan nama pembuatnya. Selamat belajar dan ...
github_jupyter
# Enumerating BiCliques to Find Frequent Patterns #### KDD 2019 Workshop #### Authors - Tom Drabas (Microsoft) - Brad Rees (NVIDIA) - Juan-Arturo Herrera-Ortiz (Microsoft) #### Problem overview From time to time PCs running Microsoft Windows fail: a program might crash or hang, or you experience a kernel crash leadi...
github_jupyter
## Multinomial Naive Bayes O Multinomial Naive Bayes supõe que os recursos sejam gerados a partir de uma distribuição multinomial simples. A distribuição multinomial descreve a probabilidade de observar contagens entre várias categorias e, portanto, o Multinomial Naive Bayes é mais apropriado para características que r...
github_jupyter
# LCLS Archiver restore These examples show how single snapshots, and time series can be retreived from the archiver appliance. Note that the times must always be in ISO 8601 format, UTC time (not local time). ``` %pylab --no-import-all inline %config InlineBackend.figure_format = 'retina' from lcls_live.archiver im...
github_jupyter
<a href="https://colab.research.google.com/github/jsedoc/ConceptorDebias/blob/master/Experiments/Conceptors/Gradient_Based_Conceptors.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import torch import torch.nn.functional as F from torch import ...
github_jupyter