code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Intermediate Lesson on Geospatial Data ## Data, Information, Knowledge and Wisdom <strong>Lesson Developers:</strong> Jayakrishnan Ajayakumar, Shana Crosson, Mohsen Ahmadkhani #### Part 1 of 5 ``` # This code cell starts the necessary setup for Hour of CI lesson notebooks. # First, it enables users to hide and u...
github_jupyter
<a href="https://colab.research.google.com/github/tfrizza/DALL-E-tf/blob/main/tfFlowers_demo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %pip install -q tensorflow_addons !git clone https://github.com/tfrizza/DALL-E-tf.git %cd DALL-E-tf impo...
github_jupyter
``` %matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import sys sys.path.append('.') import utils def f(x): return x * np.cos(np.pi*x) utils.set_fig_size(mpl, (4.5, 2.5)) x = np.arange(-1.0, 2.0, 0.1) fig = plt.figure() sub...
github_jupyter
``` !pip install d2l==0.17.2 # implement several utility functions to facilitate data downloading import hashlib import os import tarfile import zipfile import requests DATA_HUB = dict() DATA_URL = 'http://d2l-data.s3-accelerate.amazonaws.com/' # download function to download a dataset def download(name, cache_dir=os....
github_jupyter
``` #Goal: Have customers narrow their travel searches based on temp and precipitation import pandas as pd import requests import gmaps from config import g_key weather_data_df=pd.read_csv("data/WeatherPy_Database.csv") weather_data_df weather_data_df.dtypes #configure gmaps to use the appropriate key gmaps.configure(...
github_jupyter
``` !pip install lightgbm !pip install xgboost import lightgbm as lgb import pandas as pd from sklearn.metrics import mean_squared_error from sklearn.model_selection import GridSearchCV import xgboost as xgb import zipfile archive = zipfile.ZipFile('test.csv.zip', 'r') test = pd.read_csv(archive.open('test.csv'), sep="...
github_jupyter
## Final Output ``` %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt from statistics import mean, median, variance plt.rcParams['figure.figsize'] = [10, 5] import pprint import math import tabulate def get_overheads(file_name): data = [] with open(file_name, 'r') as results: ...
github_jupyter
## Machine learning sur le titanic ``` import pandas as pd import numpy as np ``` On importe les données ``` titanic = pd.read_csv("./data/titanic_train.csv") titanic.head() ``` On sélectionne les colonnes de x ``` x = titanic.drop(["PassengerId","Survived","Name","Ticket"],axis=1) y = titanic["Survived"] ``` On ...
github_jupyter
# Imporing Libraries and Dataset ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.simplefilter(action="ignore", category=FutureWarning) data_train= pd.read_csv(r"C:\Users\shruti\Desktop\Decodr Session Recording\Project\Decodr Project\Power Plant ...
github_jupyter
# NumPy - 科学计算 ## 一、简介 NumPy是Python语言的一个扩充程序库。支持高级大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。Numpy内部解除了[CPython的GIL](https://www.cnblogs.com/wj-1314/p/9056555.html)(全局解释器锁),运行效率极好,是大量机器学习框架的基础库! NumPy的全名为Numeric Python,是一个开源的Python科学计算库,它包括: - 一个强大的N维数组对象ndrray; - 比较成熟的(广播)函数库; - 用于整合C/C++和Fortran代码的工具包; - 实用的线性代数、傅里叶变换和随机数生...
github_jupyter
# Filling in Missing Values in Tabular Records You can select Run->Run All Cells from the menu to run all cells in Studio (or Cell->Run All in a SageMaker Notebook Instance). ## Introduction Missing data values are common due to omissions during manual entry or optional input. Simple data imputation such as using th...
github_jupyter
Osnabrück University - Machine Learning (Summer Term 2018) - Prof. Dr.-Ing. G. Heidemann, Ulf Krumnack # Exercise Sheet 06 ## Introduction This week's sheet should be solved and handed in before the end of **Sunday, May 20, 2018**. If you need help (and Google and other resources were not enough), feel free to conta...
github_jupyter
``` import numpy as np import pandas as pd from sklearn.model_selection import train_test_split, StratifiedKFold, KFold, StratifiedShuffleSplit from sklearn.preprocessing import StandardScaler import xgboost as xgb from sklearn.metrics import precision_score, recall_score, jaccard_score, roc_auc_score, accuracy_score, ...
github_jupyter
<a href="https://colab.research.google.com/github/mrklees/pgmpy/blob/feature%2Fcausalmodel/examples/Causal_Games.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Causal Games Causal Inference is a new feature for pgmpy, so I wanted to develop a fe...
github_jupyter
``` import sys import os import math import subprocess import pandas as pd import numpy as np from tqdm import tqdm import random import torch import torch.nn as nn #Initialise the random seeds def random_init(**kwargs): random.seed(kwargs['seed']) torch.manual_seed(kwargs['seed']) torch.cuda.manual_seed(k...
github_jupyter
``` import sys import pickle from scipy import signal from scipy import stats import numpy as np from sklearn.model_selection import ShuffleSplit import socket import time import math from collections import OrderedDict import matplotlib.pyplot as plt sys.path.append('D:\Diamond\code') from csp_james_2 import * s...
github_jupyter
# Bounding Box Visualizer ``` try: import cv2 except ImportError: cv2 = None COLORS = [ "#6793be", "#990000", "#00ff00", "#ffbcc9", "#ffb9c7", "#fdc6d1", "#fdc9d3", "#6793be", "#73a4d4", "#9abde0", "#9abde0", "#8fff8f", "#ffcfd8", "#808080", "#808080", "#ffba00", "#6699ff", "#009933", "#1c1c1c", "...
github_jupyter
# Chapter 8 Lists ### 8.1 A list is a sequence ``` # list of integers [10, 20, 30, 40] # list of strings ['frog','toad','salamander','newt'] # mixed list [10,'twenty',30.0,[40, 45]] cheeses = ['Cheddar','Mozzarella','Gouda','Swiss'] numbers = [27, 42] empty = [] print(cheeses, numbers, empty) ``` ### 8.2 Lists are...
github_jupyter
## Creating a column chart for your dashboard In this chapter, you will start to put together your own dashboard. Your first step is to create a basic column chart showing fatalities, injured, and uninjured statistics for the states of Australia over the last 100 years. Instructions 1. In `A1` of `Sheet1`, use a fo...
github_jupyter
## Fibonacci Rabbits Fibonacci considers the growth of an idealized (biologically unrealistic) rabbit population, assuming that: 1. A single newly born pair of rabbits (one male, one female) are put in a field; 2. Rabbits are able to mate at the age of one month so that at the end of its second month a female can prod...
github_jupyter
# Analyze Data Quality with SageMaker Processing Jobs and Spark Typically a machine learning (ML) process consists of few steps. First, gathering data with various ETL jobs, then pre-processing the data, featurizing the dataset by incorporating standard techniques or prior knowledge, and finally training an ML model ...
github_jupyter
<p><font size="6"><b> CASE - Observation data - analysis</b></font></p> > *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:jorisvandenbossche@gmail.com>, <mailto:stijnvanhoey@gmail.com>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)* --- ``` import numpy as np i...
github_jupyter
# Classify Images using Residual Network with 50 layers (ResNet-50) ## Import Turi Create Please follow the repository README instructions to install the Turi Create package. **Note**: Turi Create is currently only compatible with Python 2.7 ``` import turicreate as turi ``` ## Reference the dataset path ``` url =...
github_jupyter
<img src="https://upload.wikimedia.org/wikipedia/commons/4/47/Logo_UTFSM.png" width="200" alt="utfsm-logo" align="left"/> # MAT281 ### Aplicaciones de la Matemática en la Ingeniería ## Módulo 02 ## Laboratorio Clase 06: Desarrollo de Algoritmos ### Instrucciones * Completa tus datos personales (nombre y rol USM) e...
github_jupyter
# requests ## 实例引入 ``` import requests response = requests.get('https://www.baidu.com/') print(type(response)) print(response.status_code) print(type(response.text)) print(response.text) print(response.cookies) ``` ## 各种请求方式 ``` import requests requests.post('http://httpbin.org/post') requests.put('http://httpbin....
github_jupyter
# More To Come. Stay Tuned. !! If there are any suggestions/changes you would like to see in the Kernel please let me know :). Appreciate every ounce of help! **This notebook will always be a work in progress**. Please leave any comments about further improvements to the notebook! Any feedback or constructive criticis...
github_jupyter
### DemIntro02: # Rational Expectations Agricultural Market Model #### Preliminary task: Load required modules ``` from compecon.quad import qnwlogn from compecon.tools import discmoments import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('dark') %matplotlib notebook ``` Generate ...
github_jupyter
``` from numpy import array import datetime as dt from matplotlib import pyplot as plt from sklearn import model_selection from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split import numpy as np import pandas as pd from sklear...
github_jupyter
# Baseline model classification The purpose of this notebook is to make predictions for all six categories on the given dataset using some set of rules. <br>Let's assume that human labellers have labelled these comments based on the certain kind of words present in the comments. So it is worth exploring the comments t...
github_jupyter
# Manual Labeling Data Preparation Generate the pixels that will be used for train, test, and validation. This keeps pixels a certain distance and ensures they're spatially comprehensive. ``` import rasterio import random import matplotlib.pyplot as plt import os import sys import datetime from sklearn.utils import c...
github_jupyter
<a href="https://colab.research.google.com/github/hansong0219/Advanced-DeepLearning-Study/blob/master/UNET/UNET_Build.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import os import sys from tensorflow.keras.layers import Inp...
github_jupyter
``` import torch import torchphysics as tp import math import numpy as np import pytorch_lightning as pl print('Tutorial zu TorchPhysics:') print('https://torchphysics.readthedocs.io/en/latest/tutorial/tutorial_start.html') from IPython.display import Image, Math, Latex from IPython.core.display import HTML Image(file...
github_jupyter
Work looking at https://www.bexar.org/2988/Online-District-Clerk-Criminal-Records ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime %matplotlib inline Bexar_Criminal_AB_df = pd.read_csv(r'http://edocs.bexar.org/cc/DC_cjjorad_a_b.csv',header=0) Bexar_Criminal_C_df = pd.read_csv(...
github_jupyter
# Quantum device tuning via hypersurface sampling **NOTE: DUE TO MULTIPROCESSING PACKAGE THE CURRENT IMPLEMENTATION ONLY WORKS ON UNIX/LINUX OPERATING SYSTEMS [TO RUN ON WINDOWS FOLLOW THIS GUIDE](Resources/Running_on_windows.ipynb)** Quantum devices used to implement spin qubits in semiconductors are challenging to t...
github_jupyter
<a href="https://colab.research.google.com/github/cccaaannn/machine_learning_colab/blob/master/feature_selection/data_mining_hw3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Feature selection methods ![](https://3qeqpr26caki16dnhd19sv6by6v-wpeng...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import itertools import gc import os import sys from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error,mean_absolute_error f...
github_jupyter
# Class Diagrams This is a simple viewer for class diagrams. Customized towards the book. **Prerequisites** * _Refer to earlier chapters as notebooks here, as here:_ [Earlier Chapter](Debugger.ipynb). ``` import bookutils ``` ## Synopsis <!-- Automatically generated. Do not edit. --> To [use the code provided in...
github_jupyter
# Bayesian GAN Bayesian GAN (Saatchi and Wilson, 2017) is a Bayesian formulation of Generative Adversarial Networks (Goodfellow, 2014) where we learn the **distributions** of the generator parameters $\theta_g$ and the discriminator parameters $\theta_d$ instead of optimizing for point estimates. The benefits of the B...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES']='0' from fasterai.visualize import * plt.style.use('dark_background') #Adjust render_factor (int) if image doesn't look quite right (max 64 on 11GB GPU). The default here works for most photos. #It literally just is a number multiplied by 16 to get the square render r...
github_jupyter
``` import warnings warnings.filterwarnings('ignore') %matplotlib inline import pandas as pd import numpy as np import scipy.stats as st from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import cross_val_score import sklearn.metrics as mt import matplotlib.pyplot as plt ...
github_jupyter
# ML Pipeline Preparation Follow the instructions below to help you create your ML pipeline. ### 1. Import libraries and load data from database. - Import Python libraries - Load dataset from database with [`read_sql_table`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_table.html) - Define fea...
github_jupyter
# AutoRec: Rating Prediction with Autoencoders Although the matrix factorization model achieves decent performance on the rating prediction task, it is essentially a linear model. Thus, such models are not capable of capturing complex nonlinear and intricate relationships that may be predictive of users' preferences. ...
github_jupyter
# <span style='color:darkred'> 4 Trajectory Analysis </span> *** **<span style='color:darkred'> Important Note </span>** Before proceeding to the rest of the analysis, it is a good time to define a path that points to the location of the MD simulation data, which we will analyze here. If you successfully ran the MD...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %load_ext autoreload %autoreload 2 from freedom.utils.i3cols_dataloader import load_hits, load_strings import dragoman as dm %load_ext line_profiler plt.rcParams['figure.figsize'] = [12., 8.] plt.rcParams['xtick.labelsize'] = 14 plt.rcParams['ytick.labelsize'] ...
github_jupyter
# Automatic generation of Notebook using PyCropML This notebook implements a crop model. ### Model Cumulttfrom ``` model_cumulttfrom <- function (calendarMoments_t1 = c('Sowing'), calendarCumuls_t1 = c(0.0), cumulTT = 8.0){ #'- Name: CumulTTFrom -Version: 1.0, -Time step: 1 #'- Descripti...
github_jupyter
# Store Item Demand Forecasting Challenge ## Benchmark Models <a href="https://www.kaggle.com/c/demand-forecasting-kernels-only">Link to competition on Kaggle.</a> In this notebook, two simple benchmarking techniques are presented. ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotl...
github_jupyter
``` import requests import requests_cache requests_cache.install_cache('calrecycle') import pandas as pd import time URL = 'https://www2.calrecycle.ca.gov/LGCentral/DisposalReporting/Destination/CountywideSummary' params = {'CountyID': 58, 'ReportFormat': 'XLS'} resp = requests.post(URL, data=params) resp import io def...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D2_HiddenDynamics/student/W3D2_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> &nbsp; <a href="https://kaggle.com/kernels/welcome?src...
github_jupyter
# A tutorial for the whitebox Python package This notebook demonstrates the usage of the **whitebox** Python package for geospatial analysis, which is built on a stand-alone executable command-line program called [WhiteboxTools](https://github.com/jblindsay/whitebox-tools). * Authors: Dr. John Lindsay (https://jblind...
github_jupyter
<a href="https://cognitiveclass.ai/"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Ad/CCLog.png" width="200" align="center"> </a> <h1>Dictionaries in Python</h1> <p><strong>Welcome!</strong> This notebook will teach you about the dictionaries in the Python Pr...
github_jupyter
### gQuant Tutorial First import all the necessary modules. ``` import sys; sys.path.insert(0, '..') import os import warnings import ipywidgets as widgets from gquant.dataframe_flow import TaskGraph warnings.simplefilter("ignore") ``` In this tutorial, we are going to use gQuant to do a simple quant job. The task i...
github_jupyter
# Cuaderno para cargar metadatos Este cuaderno toma un directorio de MinIO con estructura de datos abiertos y crea la definición para Hive-Metastore para cada una de las tablas ## Librerias ``` from minio import Minio import pandas as pd from io import StringIO from io import BytesIO import json from pyhive import ...
github_jupyter
``` import lifelines import pymc as pm import pyBMA import matplotlib.pyplot as plt import numpy as np from math import log from datetime import datetime import pandas as pd %matplotlib inline ``` The first step in any data analysis is acquiring and munging the data An example data set can be found at: https://jak...
github_jupyter
``` import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt train=pd.read_csv('../input/nlp-getting-started/train.csv') test=pd.read_csv('../input/nlp-getting-started/test.csv') sample=pd.read_csv('../input/nlp-getting-started/sample_submission.csv') train.head() train.info() train....
github_jupyter
``` import os import random import shutil from shutil import copyfile import csv root_dir = "ISAFE MAIN DATABASE FOR PUBLIC/" data = "Database/" global_emotion_dir = "emotions_5/" # global_emotion_dir = "emotions/" subject_list = os.path.join(root_dir, data) x = os.listdir(subject_list) csv_file = "ISAFE MAIN DATABASE ...
github_jupyter
<a href="https://colab.research.google.com/github/aljeshishe/FrameworkBenchmarks/blob/master/How_much_samples_is_enough_for_transfer_learning_same_steps_per_epoch_InceptionResNetV2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` pip install kagg...
github_jupyter
``` import numpy as np import pandas as pd import datetime from pandas.tseries.frequencies import to_offset import niftyutils from niftyutils import load_nifty_data import matplotlib.pyplot as plt start_date = datetime.datetime(2005,8,1) end_date = datetime.datetime(2020,9,25) nifty_data = load_nifty_data(start_date...
github_jupyter
``` %matplotlib inline import gym import itertools import matplotlib import numpy as np import sys import sklearn.pipeline import sklearn.preprocessing if "../" not in sys.path: sys.path.append("../") from lib import plotting from sklearn.linear_model import SGDRegressor from sklearn.kernel_approximation import R...
github_jupyter
# Writing Reusable Code using Functions in Python ![](https://i.imgur.com/TvNf5Jp.png) ### Part 4 of "Data Analysis with Python: Zero to Pandas" This tutorial covers the following topics: - Creating and using functions in Python - Local variables, return values, and optional arguments - Reusing functions and using ...
github_jupyter
# Modeling and Simulation in Python Chapter 3 Copyright 2017 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 after an as...
github_jupyter
# Tutorial: PyTorch ``` __author__ = "Ignacio Cases" __version__ = "CS224u, Stanford, Spring 2021" ``` ## Contents 1. [Motivation](#Motivation) 1. [Importing PyTorch](#Importing-PyTorch) 1. [Tensors](#Tensors) 1. [Tensor creation](#Tensor-creation) 1. [Operations on tensors](#Operations-on-tensors) 1. [GPU compu...
github_jupyter
# How to create Popups ## Simple popups You can define your popup at the feature creation, but you can also overwrite them afterwards: ``` import folium m = folium.Map([45, 0], zoom_start=4) folium.Marker([45, -30], popup="inline implicit popup").add_to(m) folium.CircleMarker( location=[45, -10], radius=...
github_jupyter
##### Copyright 2018 The TensorFlow Probability Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of th...
github_jupyter
# Introduction to Python In this lesson we will learn the basics of the Python programming language (version 3). We won't learn everything about Python but enough to do some basic machine learning. <img src="figures/python.png" width=350> # Variables Variables are objects in Python that can hold anything with numb...
github_jupyter
# CHAPTER 14 - Probabilistic Reasoning over Time ### George Tzanetakis, University of Victoria ## WORKPLAN The section number is based on the 4th edition of the AIMA textbook and is the suggested reading for this week. Each list entry provides just the additional sections. For example the Expected reading include ...
github_jupyter
# <span style="color:green"> Numerical Simulation Laboratory (NSL) </span> ## <span style="color:blue"> Numerical exercises 10</span> ### Exercise 10.1 By adapting your Genetic Algorithm code, developed during the Numerical Exercise 9, write a C++ code to solve the TSP with a **Simulated Annealing** (SA) algorithm. ...
github_jupyter
# OpEn Rust Examples: with General Gradient Function In this example, we are going to use a function that can obtain the gradient of any given function. This sort of function was used in relaxed_ik rust version. Now, we are trying to use this approach for [the previous example that we implemented before](https://githu...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Plot style sns.set() %pylab inline pylab.rcParams['figure.figsize'] = (4, 4) # Avoid inaccurate floating values (for inverse matrices in dot product for instance) # See https://stackoverflow.com/questions/24537791/numpy-matrix-inversion-roun...
github_jupyter
# 正则化和模型选择 Regularization and Model Selection 设想现在对于一个学习问题,需要从一组不同的模型中进行挑选。比如多元回归模型 $h_\theta(x)=g(\theta_0+\theta_1x+\theta_2x^2+\cdots+\theta_kx^k)$,如何自动地确定 $k$ 的取值,从而在偏差和方差之间达到较好的权衡?或者对于局部加权线性回归,如何确定带宽 $\tau$ 的值,以及对于 $\ell_1$ 正则化的支持向量机,如何确定参数 $C$ 的值? 为了方便后续的讨论,统一假定有一组有限数量的模型集合 $\mathcal{M}=\{M_1,\cdots,M_d\}$。(推广到...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import os # fp = os.path.join('..\scripts', 'the_hunchback_of_notre_dame.txt ') # # os.listdir('scripts') # chars = np.array([]) # words = np.array([]) # scene_setup = np.array([]) # new_char = True # with open(fp, 'r', encoding='utf-8') as ...
github_jupyter
<a href="https://colab.research.google.com/github/constantinpape/dl-teaching-resources/blob/main/exercises/classification/5_data_augmentation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Data Augmentation on CIFAR10 In this exercise we will us...
github_jupyter
# KFServing Sample In this notebook, we provide two samples for demonstrating KFServing SDK and YAML versions. ### Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ing...
github_jupyter
# "Folio 03: MLP Classifier" > "[ML 3/3] Use Neural Networks for Data Classification with Keras" - toc: true - branch: master - badges: true - image: images/ipynb/mlp_clf_main.png - comments: false - author: Giaco Stantino - categories: [portfolio project, machine learning] - hide: false - search_exclude: true - perma...
github_jupyter
``` !pip install splinter ! pip install bs4 ! pip install datetime import pandas as pd from splinter import Browser from bs4 import BeautifulSoup as bs from datetime import datetime import os import time ! brew cask install chromedriver # Capture path to Chrome Driver & Initialize browser browser = Browser("chrome", he...
github_jupyter
``` # Realize ResAE # The decoder part only have the symmetic sturcture as the encoder, but weights and biase are initialized. # Let's have a try. # Display the result import matplotlib matplotlib.use('Agg') %matplotlib inline import matplotlib.pyplot as plt import utils import Block import os import time import numpy...
github_jupyter
``` %autosave 0 ``` # 4. Evaluation Metrics for Classification In the previous session we trained a model for predicting churn. How do we know if it's good? ## 4.1 Evaluation metrics: session overview * Dataset: https://www.kaggle.com/blastchar/telco-customer-churn * https://raw.githubusercontent.com/alexeygrigor...
github_jupyter
# DSCI 525 - Web and Cloud Computing ***Milestone 3:*** This milestone aims to set up your spark cluster and develop your machine learning to deploy in the cloud for the next milestone. ## Milestone 3 checklist : - [ ] Setup your EMR cluster with Spark, Hadoop, JupyterEnterpriseGateway, JupyterHub 1.1.0, and Livy. ...
github_jupyter
# Prospect Theory and Cumulative Prospect Theory Agent Demo The PTAgent and CPTAgent classes reproduce patterns of choice behavior described by Kahneman & Tverski's survey data in their seminal papers on Prospect Theory and Cumulative Prospect Theory. These classes expresses valuations of single lottery inputs, or exp...
github_jupyter
# 神经网络的训练 作者:杨岱川 时间:2019年12月 github:https://github.com/DrDavidS/basic_Machine_Learning 开源协议:[MIT](https://github.com/DrDavidS/basic_Machine_Learning/blob/master/LICENSE) 参考文献: - 《深度学习入门》,作者:斋藤康毅; - 《深度学习》,作者:Ian Goodfellow 、Yoshua Bengio、Aaron Courville。 - [Keras overview](https://tensorflow.google.cn/guide/keras...
github_jupyter
# AEJxLPS (Auroral electrojets SECS) > Abstract: Access to the AEBS products, SECS type. This notebook uses code from the previous notebook to build a routine that is flexible to plot either the LC or SECS products - this demonstrates a prototype quicklook routine. ``` %load_ext watermark %watermark -i -v -p virescli...
github_jupyter
``` %load_ext autoreload %autoreload 2 from allennlp.commands.evaluate import * from kb.include_all import * from allennlp.nn import util as nn_util from allennlp.common.tqdm import Tqdm import torch import warnings warnings.filterwarnings("ignore") archive_file = "knowbert_wiki_wordnet_model" cuda_device = -1 # line =...
github_jupyter
``` import torch from torch import nn, optim from torch.utils.data import DataLoader, Dataset from torchvision import datasets, transforms from torchvision.utils import make_grid import matplotlib from matplotlib import pyplot as plt import seaborn as sns from IPython import display import torchsummary as ts import num...
github_jupyter
``` # this is a little trick to make sure the the notebook takes up most of the screen: from IPython.display import HTML display(HTML("<style>.container { width:90% !important; }</style>")) # Recommendation to leave the logging config like this, otherwise you'll be flooded with unnecessary info import logging logging....
github_jupyter
# <center>Dataset Anaylsis</center> ``` %%html <style> body { font-family: "Apple Script", cursive, sans-serif; } </style> ``` _importing necessary libraries of Data Science_ ``` import numpy as np import pandas as pd import cv2 from matplotlib import pyplot as plt import os ``` _making a function for showing i...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import torch from torch import nn as nn from math import factorial import random import torch.nn.functional as F import numpy as np import seaborn as sn import pandas as pd import os from os.path import join import glob from math import factorial ttype = torch.cud...
github_jupyter
<a id="ndvi_std_top"></a> # NDVI STD Deviations from an established average z-score. <hr> # Notebook Summary * A baseline for each month is determined by measuring NDVI over a set time * The data cube is used to visualize at NDVI anomalies over time. * Anomalous times are further explored and visualization sol...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np # This is a custom matplotlib style that I use for most of my charts country_data = pd.read_csv('C:/Users/user/Desktop/test.csv') country_data ``` 圖中顯示2016到2017入境各個國家人數 多數國家在2017人數皆些微成長 ``` fig = plt.figure(figsize=(15, 7)...
github_jupyter
# Generative Adversarial Network In this notebook, we'll be building a generative adversarial network (GAN) trained on the MNIST dataset. From this, we'll be able to generate new handwritten digits! GANs were [first reported on](https://arxiv.org/abs/1406.2661) in 2014 from Ian Goodfellow and others in Yoshua Bengio'...
github_jupyter
# DAPA Tutorial #3: Timeseries - Sentinel-2 ## Load environment variables Please make sure that the environment variable "DAPA_URL" is set in the `custom.env` file. You can check this by executing the following block. If DAPA_URL is not set, please create a text file named `custom.env` in your home directory with th...
github_jupyter
``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os import gc import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline pal = sns.color_palette() df_train = pd.read_csv('train.csv') df_train.head() print('Total number of question pairs...
github_jupyter
``` # default_exp models.OmniScaleCNN ``` # OmniScaleCNN > This is an unofficial PyTorch implementation by Ignacio Oguiza - oguiza@gmail.com based on: * Rußwurm, M., & Körner, M. (2019). Self-attention for raw optical satellite time series classification. arXiv preprint arXiv:1910.10536. * Official implementation: h...
github_jupyter
# Natural Language Processing - Unsupervised Topic Modeling with Reddit Posts ###### This project dives into multiple techniques used for NLP and subtopics such as dimensionality reduction, topic modeling, and clustering. 1. [Google BigQuery](#Google-BigQuery) 1. [Exploratory Data Analysis (EDA) & Preprocessing](#Exp...
github_jupyter
# Forecasting in Statsmodels This notebook describes forecasting using time series models in Statsmodels. **Note**: this notebook applies only to the state space model classes, which are: - `sm.tsa.SARIMAX` - `sm.tsa.UnobservedComponents` - `sm.tsa.VARMAX` - `sm.tsa.DynamicFactor` ``` %matplotlib inline import num...
github_jupyter
``` import pandas as pd import numpy as np from bayes_opt import BayesianOptimization from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import cross_val_score from Data_Processing import DataProcessing from sklearn.metrics import mean_squared_error from sklearn.model_selection import train...
github_jupyter
``` from keras.layers import Input, Dense, merge from keras.models import Model from keras.layers import Convolution2D, MaxPooling2D, Reshape, BatchNormalization from keras.layers import Activation, Dropout, Flatten, Dense def default_categorical(): img_in = Input(shape=(120, 160, 3), name='img_in') ...
github_jupyter
# Notebook to visualize location data ``` import csv # count the number of Starbucks in DC with open('starbucks.csv') as file: csvinput = csv.reader(file) acc = 0 for record in csvinput: if 'DC' in record[3]: acc += 1 print( acc ) def parse_locations(csv_iterator,state=''): ...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
### Calculating intensity in an inclined direction $\cos\theta \neq 1$ For this first part we are going to use our good old FALC model and calculate intensity in direction other than $\mu = 1$. This is also an essential part of scattering problems! ### We will assume that we are dealing with continuum everywhere! ...
github_jupyter
# Working with code cells In this notebook you'll get some experience working with code cells. First, run the cell below. As I mentioned before, you can run the cell by selecting it the click the "run cell" button above. However, it's easier to run it by pressing **Shift + Enter** so you don't have to take your hands...
github_jupyter