text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` %matplotlib inline import numpy as np import pandas as pd from scipy import stats as ss from sklearn import metrics from datetime import datetime import matplotlib.pyplot as plt import seaborn as sns plt.rcParams['figure.figsize'] = (30.0, 15.0) !pip install sklearn !pip install bayesian-optimization !pip instal...
github_jupyter
## Google Sentence Piece를 이용해서 Vocab 파일을 만드는 과정 Google SentencePeice와 한국어 위키를 이용해서 Vocab을 만드는 과정에 대한 설명 입니다. [Colab](https://colab.research.google.com/)에서 실행 했습니다. #### 0. Pip Install 필요한 패키지를 pip를 이용해서 설치합니다. ``` !pip install sentencepiece ``` #### 1. Google Drive Mount Colab에서는 컴퓨터에 자원에 접근이 불가능 하므로 Google Drive에 ...
github_jupyter
``` import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import pickle from threshold_functions import abs_sobel_thresh from threshold_functions import mag_thresh from threshold_functions import dir_threshold from threshold_functions import hls_select from threshold_functions i...
github_jupyter
# L1-SVM vs L2-SVM: using the Barrier and SMO algorithms ``` %cd .. import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from collections import Counter import time from sklearn.metrics import confusion_matrix, classification_report from opt.svm import SVC from opt.utils.data_...
github_jupyter
# Python for Psychologists - Session 2 ## Some more on lists, dictionaries, tuples, errors and modules ### More on lists **Adding elements** Last session we learned how to add an element to a list by using ```python my_list.append(element1) ``` to add a single element or ```python my_list.extend([element1, element2...
github_jupyter
``` import pickle import numpy as np import pandas as pd import os import matplotlib.pylab as plt plt.rcParams['font.family'] = 'sans-serif' DATADIR = '../data/' from sklearn.preprocessing import StandardScaler from dispersant_screener.definitions import FEATURES from pypal.models.gpr import predict_coregionalized ...
github_jupyter
# Teil 8 (fortgeführt) - Einleitung für Protokolle ### Kontext Nachdem nun Pläne behandelt wurden, wird es jetzt um ein neues Objekt names Protokoll gehen. Ein Protokoll koordiniert eine Sequenz von Plänen und wendet sie auf entfernten Helfern in einem einzigen Durchgang an. Es ist ein Objekt höchster Ebene und be...
github_jupyter
# Modules To carry out statistical tests in Python, we will be using an external module called [SciPy](https://www.scipy.org/), and to perform statistical modelling we will use the `ols` function from the external module [statsmodels](https://www.statsmodels.org/stable/index.html). To install these modules, launch the ...
github_jupyter
``` from __future__ import print_function from six.moves import range from PIL import Image import sys # dir_path = '~/GANtor-Arts-Center/src/code/main.py' # sys.path.append(dir_path) sys.path.append('../src/code/') import torch.backends.cudnn as cudnn import torch import torch.nn as nn from torch.autograd import Var...
github_jupyter
# Doppler timing tests Benchmark tests for various methods in the ``DopplerMap`` class. ``` # Enable progress bars? TQDM = False %matplotlib inline %run notebook_setup.py import starry starry.config.lazy = False starry.config.quiet = True import starry import numpy as np import matplotlib.pyplot as plt import timeit...
github_jupyter
``` import re import networkx as nx import matplotlib as mpl import matplotlib.pyplot as plt %matplotlib inline mpl.style.use('seaborn-muted') g = nx.DiGraph() state = 0 g.add_node(state) bool(g.nodes) class Token: def __init__(self, token, ignore_case=True, scrub_re='\.'): self.ignore_case ...
github_jupyter
## Get the Data Either use the provided .csv file or (optionally) get fresh (the freshest?) data from running an SQL query on StackExchange: Follow this link to run the query from [StackExchange](https://data.stackexchange.com/stackoverflow/query/675441/popular-programming-languages-per-over-time-eversql-com) to get...
github_jupyter
# Anchor explanations for movie sentiment In this example, we will explain why a certain sentence is classified by a logistic regression as having negative or positive sentiment. The logistic regression is trained on negative and positive movie reviews. ``` import numpy as np from sklearn.feature_extraction.text impo...
github_jupyter
# Tutorial with 1d advection equation Jiawei Zhuang 7/24/2019 (updated 02/13/2020) ``` !pip install git+https://github.com/JiaweiZhuang/data-driven-pdes@fix-beam %tensorflow_version 1.x import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf tf.enable_eager_execution...
github_jupyter
## Homework 3: model free learning ## Part I: On-policy learning and SARSA (3 points) _This notebook builds upon `day10` practice(`qlearning_practice.ipynb`), or to be exact, generating qlearning.py._ The policy we're gonna use is epsilon-greedy policy, where agent takes optimal action with probability $(1-\epsilon)...
github_jupyter
``` #default_exp optimization.gradientgrouplasso #export #loosely inspired by the pyglmnet package from einops import rearrange #import autograd.numpy as np import numpy as np class GradientGroupLasso: def __init__(self, dg_M, df_M, reg_l1s, reg_l2, max_iter,learning_rate, tol, beta0_npm= None): ...
github_jupyter
``` ############## PLEASE RUN THIS CELL FIRST! ################### # import everything and define a test runner function from importlib import reload from helper import run import ecc, helper # Addition/Subtraction example print((11 + 6) % 19) print((17 - 6) % 19) print((8 + 14) % 19) print((4 - 12) % 19) ``` ### Exe...
github_jupyter
# Multiclass logistic regression from scratch If you've made it through our tutorials on linear regression from scratch, then you're past the hardest part. You already know how to load and manipulate data, build computation graphs on the fly, and take derivatives. You also know how to define a loss function, construct...
github_jupyter
# Pokémon Image Embeddings Can you create image embeddings of Pokémon in order to compare them? Let's find out! ``` import requests import os from tqdm.auto import tqdm from imgbeddings import imgbeddings from PIL import Image import logging import numpy as np import pandas as pd logger = logging.getLogger() logger....
github_jupyter
# Introduction to Machine Learning (ML) This tutorial aims to get you familiar with the basis of ML. You will go through several tasks to build some basic regression and classification models. ``` #essential imports import sys sys.path.insert(1,'utils') import numpy as np import matplotlib.pyplot as plt # display plot...
github_jupyter
# Conditional generation via Bayesian optimization in latent space ## Introduction I recently read [Automatic Chemical Design Using a Data-Driven Continuous Representation of Molecules](https://arxiv.org/abs/1610.02415) by Gómez-Bombarelli et. al.<sup>[1]</sup> and it motivated me to experiment with the approaches d...
github_jupyter
``` from sklearn.feature_extraction.text import TfidfTransformer, CountVectorizer, TfidfVectorizer import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline from gensim.summarization import summarize from sklearn.feature_extraction.text import CountVectorizer from...
github_jupyter
``` #https://medium.com/were-are-all-the-ufos-a-in-depth-look-at-ufo-data/where-are-all-the-ufos-a-in-depth-look-at-ufo-data-since-the-early-1900s-94fd3a2e6d95 !pip install plotly==4.8.1 ### load in all csv files ### from google.colab import files uploaded = files.upload() import pandas as pd df1 = pd.read_csv('https:/...
github_jupyter
``` #예제 4-26 회귀선이 있는 산점도 #라이브러리 불러오기 import matplotlib.pyplot as plt import seaborn as sns #seaborn 제공 데이터셋 가져오기 titanic = sns.load_dataset('titanic') #스타일 테마 설정(5가지: darkgrid, whiteegrid, dark, white, ticks) sns.set_style('darkgrid') #그래프 객체 생성(figure에 2개의 서브 플롯 생성) fig=plt.figure(figsize=(15,5)) ax1 = fig.add_su...
github_jupyter
# Analysis of how many mice pass *ephys* and other criteria Luigi Acerbi, Apr 2020 (with inputs from Gaelle Chapuis and Anne Urai) This script performs analyses to check how many mice pass the currenty set criterion for ephys. ``` # Generally useful Python packages import numpy as np import pandas as pd import scipy...
github_jupyter
# labels ``` import vectorbt as vbt import numpy as np import pandas as pd from datetime import datetime, timedelta from numba import njit # Disable caching for performance testing vbt.settings.caching['enabled'] = False close = pd.DataFrame({ 'a': [1, 2, 1, 2, 3, 2], 'b': [3, 2, 3, 2, 1, 2] }, index=pd.Index(...
github_jupyter
# Performing the Hyperparameter tuning **Learning Objectives** 1. Learn how to use `cloudml-hypertune` to report the results for Cloud hyperparameter tuning trial runs 2. Learn how to configure the `.yaml` file for submitting a Cloud hyperparameter tuning job 3. Submit a hyperparameter tuning job to Cloud AI Platform ...
github_jupyter
Unsupervised learning means a lack of labels: we are looking for structure in the data, without having an *a priori* intuition what that structure might be. A great example is clustering, where the goal is to identify instances that clump together in some high-dimensional space. Unsupervised learning in general is a ha...
github_jupyter
``` '''this is a bit of a silly experiment to see what VGG would do given map data (VGG was probably the most successful image recognition neutal net circa 2017) It seems to somewhat think the earth is a coral reef! or maybe a scuba diver! :D this is not all silliness as we can use VGG for 'transfer learning', wherein...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import time df_master = pd.read_csv('PGCB_Demand_Data_2021.csv',parse_dates=True,index_col='date') df_master.head(24) df_master.info() def plot_daily_demand(df,y): ''' It returns the daily load demand vs hour for a specific year. ...
github_jupyter
# Sesion 4 : ## - Biblioteca de Pandas ## - Dataframes de Pandas ########################################################## ## 1. Biblioteca de Pandas Pandas es una biblioteca de Python de análisis y manipulación de datos de alto rendimiento. Define nuevas estructuras de datos basadas en los arrays de la libr...
github_jupyter
As this is currently still in a proof-of-concept phase, only a subset of Vital data structures and algorithms are available via the Python interface, and yet also limited in functionality within Python (e.g. only simple data accessors and manipuators are available. ## Setting up the environment In order to access and ...
github_jupyter
# SGDRegressor with StandardScaler & Power Transformer This Code template is for regression analysis using the SGDRegressor where rescaling method used is StandardScaler and feature transformation is done using PowerTransformer. ### Required Packages ``` import warnings import numpy as np import pandas as pd impo...
github_jupyter
![imagen](../../imagenes/ejercicios.png) # Ejercicio SQL Para este ejercicio usaremos una base de datos del FIFA 20. **Asegúrante que tienes el CSV "FIFA20.csv" en la misma carpeta donde está este Notebook**. Realiza los siguientes apartados: 1. Obtén una tabla con todos los campos 2. Obtén una tabla con los campos "...
github_jupyter
# Introduction to Planning for Self Driving Vehicles In this notebook you are going to train your own ML policy to fully control an SDV. You will train your model using the Lyft Prediction Dataset and [L5Kit](https://github.com/woven-planet/l5kit). **Before starting, please download the [Lyft L5 Prediction Dataset 20...
github_jupyter
# Download the Dataset Download the dataset from this link: https://www.kaggle.com/shanwizard/modest-museum-dataset ## Dataset Description Description of the contents of the dataset can be found here: https://shan18.github.io/MODEST-Museum-Dataset ### Mount Google Drive (Works only on Google Colab) For running the...
github_jupyter
``` import os import urllib import random import warnings import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import seaborn as sns from sklearn import preprocessing, grid_search from sklearn.cross_validation import train_test_split from sklearn.metrics ...
github_jupyter
``` import pickle import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt from sklearn.model_selection import RandomizedSearchCV from sklearn.ensemble import RandomForestClassifier import librosa from sklearn.utils.multiclass import unique_labels #directory to...
github_jupyter
# Chapter 10 - Bet Sizing ## Introduction Your ML algorithm can achieve high accuracy, but if you do not size your bets properly, your investment strategy will inevitably lose money. This notebook contains the worked exercises from the end of chapter 10 of "Advances in Financial Machine Learning" by Marcos López de Pra...
github_jupyter
# English - French Translation In second week of inzva Applied AI program, we are going to create English-French translator. We will create models in different complexity levels. Althought our dataset is not a big one (our corpus is little than a standart storybook) it takes some time to train the models. For this rea...
github_jupyter
# Discrimination Threshold Analysis This is a discrimination threshold analysis on selected better performing decision trees. This was determined in the notebook "Classification Report Selected Decision Trees.ipynb" The data is from the team's "MLTable1" Using Yellowbrick's discrimination threshold. Link: https://w...
github_jupyter
<a href="https://colab.research.google.com/github/gptix/DS-Unit-2-Applied-Modeling/blob/master/module2/Follow_LS_DS10_232.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science *Unit 2, Sprint 3, Module 2* --- # Wrangle ML dat...
github_jupyter
# Keyboard shortcuts In this notebook, you'll get some practice using keyboard shortcuts. These are key to becoming proficient at using notebooks and will greatly increase your work speed. First up, switching between edit mode and command mode. Edit mode allows you to type into cells while command mode will use key p...
github_jupyter
``` import os import torch import torch.nn as nn from torch.nn import functional as F from torch.utils.data import DataLoader from torchvision.datasets import MNIST from torchvision import transforms import pytorch_lightning as pl class ConvNet(pl.LightningModule): def __init__(self): super(ConvNet, self)...
github_jupyter
## Python script used to scrape vehicle complaints information from [www.carcomplaints.com](http://www.carcomplaints.com) website. ``` from collections import OrderedDict from bs4 import BeautifulSoup import urllib.request as request import re url_Honda = 'http://www.carcomplaints.com/Honda/' html_Honda = request.url...
github_jupyter
## General information This kernel is a fork of my Keras kernel. But this one will use Pytorch. I'll gradually introduce more complex architectures. ![](https://pbs.twimg.com/profile_images/1013607595616038912/pRq_huGc_400x400.jpg) ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import se...
github_jupyter
# Distribution Strategy Design Pattern This notebook demonstrates how to use distributed training with Keras. ``` import datetime import os import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow import feature_column as fc # Determine...
github_jupyter
``` import jupyter_addons as ja ja.set_css() ``` ## Network Design with PypeFlow API - Example 3 # Adding Balancing Valves & Control Valves to a Closed Network ## 1. Setting up the `Designer` We will continue to work with the network from the design examples 1 and 2, but now we have modified it into a closed networ...
github_jupyter
# Packaging an Overlay This notebook will demonstrate how to package an Overlay. This notebook depends on the previous three notebooks: 2. [Creating a Vivado HLS Core](2-Creating-A-Vivado-HLS-Core.ipynb) 3. [Building a Vivado Bitstream](3-Building-A-Bitstream.ipynb) 4. [Using an HLS core in PYNQ](4-Using-an-HLS-core-...
github_jupyter
``` import VGG19 from importlib import reload import matplotlib.pyplot as plt # from PatchMatchMxnet import init_nnf, upSample_nnf, avg_vote, propagate, reconstruct_avg,tran_shape import mxnet as mx import copy from utils import * import numpy as np %matplotlib inline # reload(VGG19) # model = VGG19.VGG19() img_A = loa...
github_jupyter
``` # Duplicate of python wrapper tests but going through a trivial reference frame. from jp_doodle import dual_canvas from IPython.display import display from jp_proxy_widget import notebook_test_helpers from canvas_test_helpers import ColorTester validators = notebook_test_helpers.ValidationSuite() c = dual_canvas.D...
github_jupyter
``` import pandas as pd import numpy as np df = pd.read_csv('amazon_baby.csv', dtype={"name": str, "review": str, "rating": np.int32}) df.head() ``` # Build word count vector for each view ``` from sklearn.feature_extraction.text import CountVectorizer df.dropna(inplace=True) vectorizer = CountVectorizer() def word_c...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/AnujArora23/FlightDelayML/blob/master/DTFlightDelayDataset.ipynb) # Flight Delay Prediction (Regression) **NOTE: THIS IS A CONTINUATION OF THE *SGDFlightDelayDataset.ipynb* NOTEBOOK WHICH USES STOCHASTIC GRADIENT DESCENT REGRESSION. THIS PART ONLY CON...
github_jupyter
``` import sys sys.path.append('../..') import torchdyn; from torchdyn.models import *; from torchdyn.datasets import * from pytorch_lightning.loggers import WandbLogger data = ToyDataset() n_samples = 1 << 16 n_gaussians = 7 X, yn = data.generate(n_samples // n_gaussians, 'gaussians', n_gaussians=7, std_gaussians=0....
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import featuretools as ft import lightgbm as lgb import seaborn as sns from sklearn.model_selection import GridSearchCV from sklearn.model_selection import KFold from sklearn.metrics import roc_auc_score from random import sample import pickle ...
github_jupyter
## Exercise 3.8 MLE for the uniform distribution (Source: Kaelbling.) Consider a uniform distribution centered on 0 with width $2a$. The density function is given by $$ p(x)= \frac{1}{2a}I(x\in[-a, a]) $$ - a. Given a data set $x_1,\ldots,x_n$, what is the maximum likelihood estimate of $a$ (call it $\hat{a}$)? - b. ...
github_jupyter
# Tutorial: Introduction to Altair This tutorial is based off the [Altair Tutorial](https://github.com/altair-viz/altair_notebooks). ## Review - The Grammar of Graphics *The Grammar of Graphics*, Wilkinson (2005) uses the following specification: * Data/Variables * Geometry and Aesthetics ## Translating to Altair/...
github_jupyter
# Display objects A `striplog` depends on a hierarchy of objects. This notebook shows the objects related to display: - [Decor](#Decor): One element from a legend — describes how to display a Rock. - [Legend](#Legend): A set of Decors — describes how to display a set of Rocks or a Striplog. <hr /> ## Decor ``` fro...
github_jupyter
# 1. Pandas - 구조화된 데이터의 처리를 지원하는 Python 라이브러리. Python계의 엑셀! ## Pandas란? - 구조화된 데이터의 처리를 지원하는 Python 라이브러리 - 고성능 Array 계산 라이브러리인 Numpy와 통합하여, 강력한 “스프레드시트” 처리 기능을 제공 - Pandas는 Numpy의 wapper. 즉, Numpy의 데이터 타입을 그대로 불러와서 사용할 수 있다. - 인덱싱, 연산용 함수, 전처리 함수 등을 제공함 ``` from pandas import Series, DataFrame import pandas as pd ...
github_jupyter
<a id='contents'></a> # Running QCVV Protocols The main purpose of pyGSTi is to implement QCVV techniques that analyze some, often specific, experimental data to learn about a quantum processor. Each such technique is called a "protocol" in pyGSTi, and this term roughly corresponds to its use in the literature. To r...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Public/5.1_Text_classification_examples_in_SparkML_S...
github_jupyter
``` import keras import keras.backend as K from keras.datasets import mnist from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, Bat...
github_jupyter
#Case Study 1 : Collecting Data from Twitter ** Due Date: February 10, before the class** *------------ **TEAM Members:** Haley Huang Helen Hong Tom Meagher Tyler Reese **Required Readings:** * Chapter 1 and Chapter 9 of the book [Mining the Social Web](http://www.learndatasci.com/wp-content/u...
github_jupyter
# MNIST handwritten digits classification with MLPs In this notebook, we'll train a multi-layer perceptron model to classify MNIST digits using [TensorFlow](https://www.tensorflow.org/) (version $\ge$ 2.0 required) with the [Keras API](https://www.tensorflow.org/guide/keras/overview). First, the needed imports. ``` ...
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
# First Machine Learning Project ## Automate the Data Fetching ``` import os from zipfile import ZipFile def extract_data(name_of_zip="cars", ROOT='C:/Users/VTSB/Desktop/CS Resources/AI Hands-On ML/datasets', extension=".csv.zip", reset_path="C:/Users/VTSB/Desktop/CS Resources/AI Hands-On ML"): os.chdir("C:/Use...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.neighbors import kneighbors_graph, radius_neighbors_graph from sklearn.metrics import pairwise_distances as all_dist import networkx as nx def GeoDist(data, method='K', param=4): n = data.sh...
github_jupyter
### Minimizing KL Divergence Let’s see how we could go about minimizing the KL divergence between two probability distributions using gradient descent. To begin, we create a probability distribution with a known mean (0) and variance (2). Then, we create another distribution with random parameters. ``` import os impo...
github_jupyter
### 20 Newsgroups Dataset http://qwone.com/~jason/20Newsgroups/ The 20 Newsgroups data set is a collection of approximately 20,000 newsgroup documents, partitioned (nearly) evenly across 20 different news group 20news-19997.tar.gz - Original 20 Newsgroups data set 20news-bydate.tar.gz - 20 Newsgroups sorted by date;...
github_jupyter
``` %matplotlib notebook import os import datetime as dt import pickle, joblib # Standard data science libraries import pandas as pd import numpy as np import scipy.stats as ss import scipy.optimize as so import scipy.interpolate as si # Visualization import matplotlib.pyplot as plt import seaborn as sns plt.style...
github_jupyter
# Measuring crop health <img align="right" src="../Supplementary_data/dea_logo.jpg"> * [**Sign up to the DEA Sandbox**](https://docs.dea.ga.gov.au/setup/sandbox.html) to run this notebook interactively from a browser * **Compatibility:** Notebook currently compatible with both the `NCI` and `DEA Sandbox` environments ...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_08_4_bayesian_hyperparameter_opt.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 8:...
github_jupyter
``` %matplotlib inline ``` =============================================== Creating a timeline with lines, dates, and text =============================================== How to create a simple timeline using Matplotlib release dates. Timelines can be created with a collection of dates and text. In this example, we...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D1_RealNeurons/student/W3D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 3, Day 1, Tutorial 2 # Real N...
github_jupyter
# Number of Simulations by Team This notebook explores the number of simulations that were done by team and grouped by their experimental condition. ``` import sys import os.path sys.path.append("../CommonModules") # go to parent dir/CommonModules import Learning2019GTL.Globals as Globals import Learning2019GTL.Da...
github_jupyter
``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
github_jupyter
# LSTM Stock Predictor Using Closing Prices In this notebook, you will build and train a custom LSTM RNN that uses a 10 day window of Bitcoin closing prices to predict the 11th day closing price. You will need to: 1. Prepare the data for training and testing 2. Build and train a custom LSTM RNN 3. Evaluate the perf...
github_jupyter
# 1. Loading and organizing data ``` # loading datasets import pandas as pd # Vertebral Column # dataset for classification between Normal (NO) and Abnormal (AB) vc2c = pd.read_csv('vertebral_column_data/column_2C.dat', delim_whitespace=True, header=None) # dataset for classification between DH (Disk Hernia), Spondyl...
github_jupyter
``` import numpy as np from scipy import fft from scipy.io import loadmat import matplotlib.pyplot as plt whale = loadmat('whale.mat',squeeze_me=True,struct_as_record=True) ``` ## 绘制信号时域和频域波形 ``` whale_data = whale['w'] whale_fs = whale['fs'] t = np.arange(0,len(whale_data)/whale_fs,1/whale_fs) whale_num = len(whale...
github_jupyter
## Telluric correction with `muler` and `gollum` Telluric correction can be complicated, with the right approach depending on one's own science application. In this notebook we demonstrate one uncontroversial, albeit imperfect approach: dividing by an observed A0V standard, and multiplying back by an A0V template. #...
github_jupyter
# Content __1. Exploratory Visualization__ __2. Data Cleaning__ __3. Feature Engineering__ __4. Modeling & Evaluation__ __5. Ensemble Methods__ ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings('ignore') %matplotlib inline ...
github_jupyter
# Analysis - exp64 - Control for opt calculations. ``` import os import csv import numpy as np import torch as th import pandas as pd from glob import glob from pprint import pprint import matplotlib import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' import seaborn a...
github_jupyter
## GeostatsPy: Basic Univariate Statistics and Distribution Plotting for Subsurface Data Analytics in Python ### Michael Pyrcz, Associate Professor, University of Texas at Austin #### [Twitter](https://twitter.com/geostatsguy) | [GitHub](https://github.com/GeostatsGuy) | [Website](http://michaelpyrcz.com) | [Goog...
github_jupyter
# 使用卷积神经网络进行图像分类 **作者:** [PaddlePaddle](https://github.com/PaddlePaddle) <br> **日期:** 2021.12 <br> **摘要:** 本示例教程将会演示如何使用飞桨的卷积神经网络来完成图像分类任务。这是一个较为简单的示例,将会使用一个由三个卷积层组成的网络完成[cifar10](https://www.cs.toronto.edu/~kriz/cifar.html)数据集的图像分类任务。 ## 一、环境配置 本教程基于Paddle 2.2 编写,如果你的环境不是本版本,请先参考官网[安装](https://www.paddlepaddle.org....
github_jupyter
# Artificial Intelligence Nanodegree ## Recurrent Neural Network Projects Welcome to the Recurrent Neural Network Project in the Artificial Intelligence Nanodegree! In this notebook, some template code has already been provided for you, and you will need to implement additional functionality to successfully complete t...
github_jupyter
# Neural Networks as Dynamical Systems ![feedforward](Single_layer_ann.png) A neuronal model is made up of an input vector $\overrightarrow{X}=(x_1,x_2,\ldots, x_n)^T$, A vector of synaptic weights, $W_k=w_{kj}$, $j=1,2,\ldots,n$ a bias $b_k$ and an output $y_k$. The neuron itself is a nonlinear transfer function $\p...
github_jupyter
**Post-Processing Amazon Textract with Location-Aware Transformers** # Part 3: Implementing Human Review > *This notebook works well with the `Python 3 (Data Science)` kernel on SageMaker Studio* In this final notebook, we'll set up the human review component of the OCR pipeline using [Amazon Augmented AI (A2I)](htt...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline from numpy import * from IPython.html.widgets import * import matplotlib.pyplot as plt from IPython.core.display import clear_output ``` # PCA and EigenFaces Demo In this demo, we will go through the basic concepts behind the principal component analysis (PCA...
github_jupyter
# Notebook Basics ## The Notebook dashboard When you first start the notebook server, your browser will open to the notebook dashboard. The dashboard serves as a home page for the notebook. Its main purpose is to display the notebooks and files in the current directory. For example, here is a screenshot of the dashbo...
github_jupyter
# Layers > All the basic layers used keratorch. ``` # default_exp layers # export import numpy as np import torch.nn as nn from fastai.vision import * from fastai import layers from keraTorch.activations import * from functools import partial # export class __inputDimError__(Exception): pass class Layer: def ...
github_jupyter
This flocking example is based on the following colab notebook: https://github.com/google/jax-md/blob/main/notebooks/flocking.ipynb ``` import jax from IPython.display import Image as DisplayImage from evojax import Trainer from evojax.policy import MLPPolicy from evojax.algo import PGPE from evojax.task.flocking i...
github_jupyter
# 25 - Advanced Exercises * Decorators ### Function review exercises ## 🎎🎎🎎 1.assign **```myfuction```** to a new variable, then access the function from that variable and print it using inputs 2 and 3. ``` # Write your own code in this cell def myfunction(a, b): return a + b = myfunction print() ``` ##...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from collections import Counter import re import unicodedata as ud from nltk.corpus import wordnet as wn from nltk.corpus import words as w from nltk.corpus import stopwords from nltk.stem im...
github_jupyter
# Modeling and Simulation in Python Project 1 example Copyright 2018 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value aft...
github_jupyter
``` w = 'w' b = 'b' advisor = 'a' cannon = 'c' elephant = 'e' general = 'g' horse = 'h' pawn = 'p' rock = 'r' start_coords = { w: { advisor: [104,106], cannon: [82, 88], elephant: [103,107], general: [105], horse: [102,108], pawn: [71, 73, 75, 77, 79], rock:...
github_jupyter
#  测试目标检测性能 ``` !pip install gluoncv import gluoncv as gcv import mxnet as mx import os class DetectionDataset(gcv.data.VOCDetection): CLASSES = ['cocacola', 'noodles', 'hand', 'fake'] # Yolo3 need at least 4 classes (https://github.com/apache/incubator-mxnet/pull/17689/files) def __init__(self, root): ...
github_jupyter
``` # Copyright 2019 The TensorFlow Authors All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
github_jupyter
*** # 数据抓取: > # 使用Python编写网络爬虫 *** 王成军 wangchengjun@nju.edu.cn 计算传播网 http://computational-communication.com # 需要解决的问题 - 页面解析 - 获取Javascript隐藏源数据 - 自动翻页 - 自动登录 - 连接API接口 ``` import urllib2 from bs4 import BeautifulSoup ``` - 一般的数据抓取,使用urllib2和beautifulsoup配合就可以了。 - 尤其是对于翻页时url出现规则变化的网页,只需要处理规则化的url就可以了。 - 以简单的例...
github_jupyter
# Задача 2: аппроксимация функции ``` from math import sin, exp def func(x): return sin(x / 5.) * exp(x / 10.) + 5. * exp(-x / 2.) import numpy as np from scipy import linalg arrCoordinates = np.arange(1., 15.1, 0.1) arrFunction = np.array([func(coordinate) for coordinate in arrCoordinates]) ``` ## 1. Сформироват...
github_jupyter