text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression, Ridge, Lasso from sklearn.metrics import mean_squared_error, r2_score from sklearn.neighbors import KNeighborsRegres...
github_jupyter
# Testing of multimodal speech-vision models **Author:** Ryan Eloff<br> **Contact:** ryan.peter.eloff@gmail.com<br> **Date:** October 2018 Experiments notebook 2. ## Overview *Multimodal one-shot learning* is the problem of learning novel concepts from only *one or a few* examples of features in multiple modalities...
github_jupyter
# Host-guest usage with stk by: Andrew Tarzia # Imports ``` import sys sys.path.append('/usr/local/lib/python3.7/site-packages/') from rdkit import Chem from rdkit.Chem import AllChem as rdkit from collections import defaultdict from rdkit.Chem import rdFMCS from rdkit.Chem import Draw from rdkit.Chem.Draw import ...
github_jupyter
# Name Data preparation using Apache Hive on YARN with Cloud Dataproc # Label Cloud Dataproc, GCP, Cloud Storage, YARN, Hive, Apache # Summary A Kubeflow Pipeline component to prepare data by submitting an Apache Hive job on YARN to Cloud Dataproc. # Details ## Intended use Use the component to run an Apache Hive jo...
github_jupyter
``` import numpy as np from astropy.io import fits from astropy.io.fits import HDUList from astropy.wcs import WCS from numpy import arcsinh import matplotlib.pyplot as plt from astropy.visualization import astropy_mpl_style plt.style.use(astropy_mpl_style) from reproject import reproject_interp from aplpy.rgb import m...
github_jupyter
# Reading the data Keeping only the votes per party. The previous columns are the settlement names, etc <br> Dropping booths with zero votes ``` import numpy as np import pandas as pd df = pd.read_csv('../input/results_by_booth_2015 - english - v3.csv', encoding='iso-8859-1') votes=df.select_dtypes(include=[np.numbe...
github_jupyter
``` import pandas as pd from sklearn.preprocessing import Binarizer, LabelEncoder, OneHotEncoder import numpy as np from sklearn.cross_validation import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn import tree data = pd.read_csv('sales_loss_win...
github_jupyter
介绍如何在pytorch环境下,使用JSMA算法攻击基于ImageNet数据集预训练的alexnet模型。 Jupyter notebook中使用Anaconda中的环境需要单独配置,默认情况下使用的是系统默认的Python环境,以使用advbox环境为例。 首先在默认系统环境下执行以下命令,安装ipykernel。 conda install ipykernel conda install -n advbox ipykernel 在advbox环境下激活,这样启动后就可以在界面上看到advbox了。 python -m ipykernel install --user --name advbox -...
github_jupyter
# Amazon Lex Create CoffeeBot *** Copyright [2017]-[2017] Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at http://aws.amazon.com/apache2.0/ or ...
github_jupyter
# Group Data Analysis PCA 4th Trial - node velocity * Version: '0.0.4' * Date: 2021-05-03 * Author: Jea Kwon * Description: Previously PCA analysis with avatar coordinates, spine aligned on plane. this time using spine aligned on axis ``` from avatarpy import Avatar import os import glob import numpy as np import pa...
github_jupyter
``` number_list = [1.0, 2.0, 3.0, 2.0, 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 4.0, 3.0, 4.0, 2.0, 3.0, 2.0, 1.0, 5.0, 1.0, 2.0, 3.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 5.0, 1.0, 4.0, 3.0, 2.0, 1.0, 2.0, 4.0, 2.0, 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 5.0, 3.0, 5.0, 2.0, 3.0, 4.0, 5...
github_jupyter
# Assignment 2 - Semi-gradient TD with a Neural Network Welcome to Course 3 Programming Assignment 2. In the previous assignment, you implemented semi-gradient TD with State Aggregation for solving a **policy evaluation task**. In this assignment, you will implement **semi-gradient TD with a simple Neural Network** an...
github_jupyter
# Lab Eight - Space Weather With Objects ## *Bootstrap Analysis and Object Oriented Data Analysis* You will learn how to: - Perform bootstrap analysis (or resampling). - Set up a boostrap analysis problem. - Analyze bootstrap outputs. - Plot bootstrap analysis results. - Use styles in Python plots (optional). ...
github_jupyter
# Using a neural network to emulate the atmospheric convection scheme in a global climate model ### (John Dwyer & Paul O'Gorman) ## Overview: Global climate models (GCMs) solve computational fluid PDEs to represent the dynamics and thermodynamics of the atmosphere and ocean. They are important for predicting climate ...
github_jupyter
``` import importlib import os import json import sys import numpy as np import torch import torchvision from PIL import Image from models.gan_visualizer import GANVisualizer from models.utils.utils import loadmodule, getLastCheckPoint, getVal, \ getNameAndPackage, parse_state_name name = "hina" module = "PGAN" ...
github_jupyter
# Using WMLA Elastic Distributed Training via API - a sample notebook <div class="alert alert-block alert-info"> ### Contents - [The big picture](#The-big-picture) - [Changes to your code](#Changes-to-your-code) - [Making dataset available](#Making-dataset-available) - [Set up API end point and log on](#Set-up-API-...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/JavaScripts/Image/Hillshade.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" ...
github_jupyter
<a href="https://colab.research.google.com/github/GiselaCS/Mujeres_Digitales/blob/main/Clase6.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` ``` **CONTINUACION DE LOS EJEMPLOS DEL USO DE LISTA DE COMPRENSION** --- *COMPRENSION DE CONJUNTOS* L...
github_jupyter
``` # Purpose: Perform Feature Selection using Mutual Information for several K-values, save the output # Inputs: Imputed Dataset w/added Homelessness Indicators # Outputs: Several Files named after the K-cutoff used for MI on each outcome of interest # Machine: Laptop, Runtime 45mins x #of K-Values (1 K-Value takes ~4...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn import preprocessing from sklearn.preprocessing import RobustScaler from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import Normalizer from imblearn...
github_jupyter
# Risk and return recap ## Introduction ### Portfolio returns during the crisis ``` # Select portfolio asset prices for the middle of the crisis, 2008-2009 asset_prices = portfolio.loc['2008-01-01':'2009-12-31'] # Plot portfolio's asset prices during this time asset_prices.plot().set_ylabel("Closing Prices, USD") p...
github_jupyter
Import ``` import tensorflow as tf # from PIL import Image import numpy as np from scipy.misc import imread, imresize from imagenet_classes import class_names import os ``` file_path_info ``` #File Path filename_queue_description = tf.train.string_input_producer(['./data/description/v2/coded_data.csv']) filepath_ckp...
github_jupyter
# DB Analysis ## With a few hundred papers in the DB, some experiments can be done on the data. ### 1. Connecting to the DB ``` import mariadb import json with open('../credentials.json', 'r') as crd_json_fd: json_text = crd_json_fd.read() json_obj = json.loads(json_text) credentials = json_obj["Credentials"]...
github_jupyter
# Completing the ML workflow Over the past few tutorials we've seen many aspects of a supervised ML workflow. From loading data to preprocessing, selecting and training a model, optimizing hyperparameters and finally evaluating the model. It's time to put all these together into a complete workflow for supervised ML p...
github_jupyter
# Xente Fraud Detection Challenge <h2 style='bold'>Background:</h2> <p style='font-size:20'> Fraud detection is an important application of machine learning in the financial services sector. This solution will help Xente provide improved and safer service to its customers.The objective of this competition is to create ...
github_jupyter
## Imports ``` import pandas as pd ``` ## Data ``` df_test = pd.read_pickle("../data/interim/Test_extern_git_feat.pickle") df_train = pd.read_pickle("../data/interim/Train_extern_git_feat.pickle") modes = df_train.click_mode.unique() modes.sort() modes df_train[df_train.click_mode == 0].sid[:10] df_train.click_mode ...
github_jupyter
# San Diego Burrito Analytics Scott Cole 23 April 2016 This notebook contains analyses on the burrito ratings in San Diego, including: * How each metric correlates with one another. * Linear model of how each dimension contributes to the overall rating # Default imports ``` %config InlineBackend.figure_format = 'r...
github_jupyter
``` import pandas as pd #先引入后面可能用到的包(package) import numpy as np import matplotlib.pyplot as plt %matplotlib inline #正常显示画图时出现的中文和负号 from pylab import mpl mpl.rcParams['font.sans-serif']=['SimHei'] mpl.rcParams['axes.unicode_minus']=False df = pd.read_excel('PPT图表更新-20200703(1).xlsx',sheet_name = '产品净值') df tmp_df ...
github_jupyter
# Accessing BLS API **Part 3** In this notebook we will see how to access the BLS API to retreive multiple series. ## step 1 - load packages and keys ``` import requests import json %run APIkeys.py ``` ## step 2 - setting up The communication with the API to download multiple series is done through a _POST_ requ...
github_jupyter
``` !curl https://norvig.com/ngrams/count_1w.txt -o count_1w.txt !curl https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt -o top-10000-no-swears.txt with open('top-10000-no-swears.txt', 'r') as f: safe_words = set(list(f.read().splitlines())) len(safe_words) ...
github_jupyter
## Topic Models Dynamic topic models can be used to vizualise the topics of a collection of documents. <br> <img src="https://raw.githubusercontent.com/MaartenGr/BERTopic/master/images/logo.png" width="40%"> Inspired by this notebook: https://colab.research.google.com/drive/1FieRA9fLdkQEGDIMYl0I3MCjSUKVF8C-?usp=shar...
github_jupyter
``` # Uncomment to run the notebook in Colab # ! pip install -q "wax-ml[complete]@git+https://github.com/eserie/wax-ml.git" # ! pip install -q --upgrade jax jaxlib==0.1.70+cuda111 -f https://storage.googleapis.com/jax-releases/jax_releases.html # check available devices import jax print("jax backend {}".format(jax.lib....
github_jupyter
# Support Vector Classification with StandardScaler This Code template is for the Classification task using Support Vector Classifier(SVC) based on the Support Vector Machine algorithm and feature rescaling technique StandardScaler in a pipeline. ### Required Packages ``` !pip install imblearn import warnings impor...
github_jupyter
# Stacking & Successive Halving Random + Search Example ``` %load_ext watermark %watermark -p scikit-learn,mlxtend ``` ## Dataset ``` from sklearn import model_selection from sklearn.model_selection import train_test_split from sklearn import datasets data = datasets.load_breast_cancer() X, y = data.data, data.tar...
github_jupyter
<a href="https://colab.research.google.com/github/geotrush/Neural-Network-Zoo/blob/main/PyTorch/Image%2BVideo%2BAudio-Synthesis/Style-Transfer/Neural%20Style%20Transfer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neural Style Transfer -------...
github_jupyter
# Notebook contents: This notebook contains a lecture. The code for generating plots are found at the of the notebook. Links below. - [presentation](#Session-1b:) - [code for plots](#Code-for-plots) # Session 12: ## Supervised learning, part 2 *Andreas Bjerre-Nielsen* ## Vaaaamos ``` import warnings from sklearn...
github_jupyter
``` import pandas as pd # data package import matplotlib.pyplot as plt # graphics import datetime as dt import numpy as np from census import Census # This is new... import requests, io # internet and input tools import zipfile as zf # zip file tools import os #import weighted...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # MNIST Handwritten Digit Classification using ONNX and AzureML This example shows how to train a model on the MNIST data using PyTorch, save it as an ONNX model, and deploy it as a web service using Azure Machine Learning se...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df["MSSubClass"] = df["MSSubClass"].astype(str) g1 = sns.catplot(x=df["MSSubClass"], y =df["SalePrice"], data = df, kind = "box") g1.set_xticklabels(["2-STORY 1946 & NEWER","1-STORY 1946 & NEWER ALL STYLES","2-STORY 1945 & ...
github_jupyter
## This notebook will create an interactive widget to illustrate network interconnections ``` import numpy as np from pandas import * import networkx as nx import matplotlib.pyplot as plt % matplotlib inline ``` ### Import real gene network (from macular degeneration experiment) Also import the measured dif...
github_jupyter
# 酒駕判決書文字資料清理與結構化 這次專題基於「民眾對於酒駕者的判刑度不理解,社會輿論缺乏針對酒駕修法的背景脈絡」出發,搜集了大量的酒駕判決書,但判決書以文字寫成,刑度、罰金或其他背景分析,都需要經過資料清理與轉化,才能進一步統計。 這次使用的判決書總數量達49萬份,若以人力編碼曠日廢時,且恐面臨編碼員信度考驗。這次我們以正規表達式(regular expression)鎖定文字特徵萃取,以程式掃描文字、輔以人工抽查,以確保分析數據能維持一定的正確性。 本專題以python進行資料整理與分析,這篇notebook會按步驟說明「不能安全駕駛」文字清理使用的regex模式說明,並附上酒駕致人於死、酒駕致人受傷的程式碼。 ## ...
github_jupyter
``` import os import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from keras_preprocessing.image import ImageDataGenerator from keras.callbacks import ModelCheckpoint, EarlyStopping import keras.initializers as KI import keras.layers as KL import keras.losses as KLoss import ten...
github_jupyter
# <b>Introduction<b> In this project, I classify Yelp round-10 review datasets. The reviews contain a lot of metadata that can be mined and used to infer meaning, business attributes, and sentiment. For simplicity, I classify the review comments into two class: either as positive or negative. Reviews that have star hi...
github_jupyter
# <p style="text-align: center;"> Charter school identities and outcomes in the accountability era:<br/> Preliminary results <p style="text-align: center;">April 19th, 2017<br/>By Jaren Haber, PhD Candidate<break/>Dept. of Sociology, UC Berkeley <p style="text-align: center;">![alt text](http://jaypgreene.files.wordpr...
github_jupyter
``` import cv2 import time ``` # Connect to A Webcam ``` video_frames = cv2.VideoCapture(0) # 0: default camera # get frame size from camera frame_width = int(video_frames.get(cv2.CAP_PROP_FRAME_WIDTH)) frame_height = int(video_frames.get(cv2.CAP_PROP_FRAME_HEIGHT)) # initialize writer # fourcc: video codec. DIVX ...
github_jupyter
# Introduction No need to say that the Covid19 crisis is a global challenge that is going to change how we see the world. There is a lot of interest in understanding the internals of virus propagation and several disciplines can be really helpful in this task. There is a lot of data going around and we have really acc...
github_jupyter
``` # created on Dec 24, 2020 # modified on April 14, 2021 # @author: Bo Zhao # @email: zhaobo@uw.edu # @website: https://hgis.uw.edu # @organization: Department of Geography, University of Washington, Seattle # @description: Search existing tweets !python -m pip install tweepy import...
github_jupyter
## SLU08 - Metrics for Regression: Exercise Notebook In this notebook, you will implement: - Mean Absolute Error (MAE) - Mean Squared Error (MSE) - Root Mean Squared Error (RMSE) - Coefficient of Determination (R²) - Adjusted R² - Scikitlearn metrics - Using metrics for k-fold cross valida...
github_jupyter
# Results: Musk1 Scaled <b> MIL </b> <i>stratified k fold Validation</i> is performed. Metrics: <br> - AUC - Accuracie ### Import Libraries ``` import sys,os import warnings os.chdir('/Users/josemiguelarrieta/Documents/MILpy') sys.path.append(os.path.realpath('..')) from sklearn.utils import shuffle impor...
github_jupyter
## Import ``` import os import pandas as pd import numpy as np import ast import re # z test from statsmodels.stats.proportion import proportions_ztest # bayesian bootstrap and vis import matplotlib.pyplot as plt import seaborn as sns import bayesian_bootstrap.bootstrap as bb from astropy.utils import NumpyRNGConte...
github_jupyter
### Introduction to Deep4Rec Brief practical introduction to Deep4Rec. We'll show how to load a dataset and train a model. Check more examples in the [examples folder]()! - Author: Marianne Linhares Monteiro ([github: mari-linhares](https://github.com/mari-linhares/), [twitter: hereismari](https://twitter.com/hereis...
github_jupyter
# Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural network that performs sentiment analysis. >Using an RNN rather than a strictly feedforward network is more accurate since we can include information about the *sequence* of words. Here we'll use a dataset of movie reviews, accomp...
github_jupyter
Input and Variables =================== Now I feel it is time for a really complicated program. Here it is: ``` print("Halt!") s = input("Who Goes there? ") print("You may pass,", s) ``` When **I** ran it here is what **my** screen showed: Of course when you run the program your screen will look different beca...
github_jupyter
# Welly and LAS files Some preliminaries... ``` import numpy as np import matplotlib.pyplot as plt import welly welly.__version__ import lasio lasio.__version__ ``` ## Load a well from LAS Use the `from_las()` method to load a well by passing a filename as a `str`. This is really just a wrapper for `lasio` but i...
github_jupyter
``` from sympy import * from IPython.display import display ``` ### Path length of LoS in galactic ellipsoid We want to calculate the path length of an LoS that intersects an ellipsoid with two identical axes, $1 = \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{b^2}$, which represents an axisymmetric galaxy. The LoS ...
github_jupyter
# Candlestick Harami Cross https://www.investopedia.com/terms/h/haramicross.asp ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import talib import warnings warnings.filterwarnings("ignore") # yahoo finance is used to fetch data import yfinance as yf yf.pdr_override() # input symbol = 'A...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd from matplotlib import pyplot as plt import uqer from uqer import DataAPI as api from QuantLib import * plt.style.use('fivethirtyeight') uqer.Client(token='f1b9bea1d0b4e489c5ab9b69c3e2326a1bee6057af858067dbd1546453f428b2') ``` ## 0. Market Data ----------...
github_jupyter
### How to correlate between IF Ab and transcriptome gene signals? #### This script recreates figure Fig2C in SM-Omics: An automated platform for high-throughput spatial multi-omics; doi: https://doi.org/10.1101/2020.10.14.338418 Expected run time: 1-2 mins \ Expected results: gene-to-protein correlation plot, spatia...
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
## Application: Wage and Education #### Variables: + work - participation in 1975 ? + hoursw - wife's hours of work in 1975 + child6 - number of children less than 6 years old in household + child618 - number of children between ages 6 and 18 in household + agew - wife's age + educw - wife's educational attainment, i...
github_jupyter
# Reading Hydro echo files into Pandas DataFrame hydro (and qual) compile the input files and output an echo file that contains all the input data that goes into the model run. This is a very useful file as it is a direct representation of the input as seen by the model. This is especially important as the input syste...
github_jupyter
``` import numpy as np from baseline import baseline from sample import sample import matplotlib.pyplot as plt %matplotlib inline from sklearn.decomposition import NMF ``` Load our large image and sample a smaller chunk of that image: ``` image = np.load('image2.npy') im = sample(image, 32) im.shape # can we scrol...
github_jupyter
# Example 1.2: Correlation and auto-correlation This example consists of two parts. The first part will look at correlation and present a procedure to generate realizations of correlated Gaussian random variables in Python. The second part will look into how to make realizations of time series with a given auto-correla...
github_jupyter
# Plotting uncertainty In this example we will go over plotting uncertainties in various ways: + y errorbars + x errorbars + x and y errorbars (no covariance) + x and y error-ellipse (covariance) ## Packages being used + `matplotlib`: all the plotting + `pandas`: read in the data table + `numpy` and `scipy`: convert c...
github_jupyter
``` import pandas as pd import numpy as np ``` #### Parcel File ``` parcel_data_path = "C:/Users/etheocharides/Box/Modeling and Surveys/Urban Modeling/Bay Area UrbanSim/PBA50/Final Blueprint runs/Final Blueprint (s24)/BAUS v2.25 - FINAL VERSION/" parcel_data_file = "run182_parcel_data_2050.csv" parcel_data = pd.read_...
github_jupyter
``` import os import pandas as pd import requests import spacy import string from typing import List, Tuple, Union, Callable, Dict, Iterator from collections import defaultdict from difflib import SequenceMatcher from spacy.matcher import Matcher, PhraseMatcher from spacy.tokens import Doc, Token, Span from spacy.match...
github_jupyter
# Getting Started with Exploring Segmentations ## Before you start! - This notebook assumes that shapeworks conda environment has been activated using `conda activate shapeworks` on the terminal. - See [Getting Started with Notebooks](getting-started-with-notebooks.ipynb) for information on setting up your environmen...
github_jupyter
# Data Wrangling Part 2: Data Cleaning and Feature Engineering This is the second part of the series of tutorials on data wrangling. In the first part we started the process of data wrangling on the Titanic dataset, focusing on the EDA aspects. Recall that the point of doing EDA first was to give us a feel of the data...
github_jupyter
``` from __future__ import division import pickle import os import sys import copy import random import types from queue import Queue import numpy as np import gym from gym import spaces from rllab.policies.categorical_gru_policy import CategoricalGRUPolicy from rllab.baselines.linear_feature_baseline import LinearFe...
github_jupyter
``` # Copyright 2021 Google LLC # # 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 writi...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-how-to-use-estimatorstep.png) # How to u...
github_jupyter
# Ready, Steady, Go AI (*Exercises*) This tutorial is a supplement to the paper, **Ready, Steady, Go AI: A Practical Tutorial on Fundamentals of Artificial Intelligence and Its Applications in Phenomics Image Analysis** (*Patterns, 2021*) by Farid Nakhle and Antoine Harfouche Read the accompanying paper [here](https:...
github_jupyter
# 从图片生成数据库 ### 生成`cnn_custom_simple.ipynb`文件里所需的`custom_data.npz`数据文件 ``` import numpy as np import os from scipy.misc import imread, imresize import matplotlib.pyplot as plt %matplotlib inline cwd = os.getcwd() print ("所有python包载入完毕") print ("当前目录为 [%s]" % (cwd) ) ``` ## 配置 ``` # 数据路径 paths = ["data/celebs/Arnold_...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/geemap/tree/master/examples/template/template.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="https://nbvie...
github_jupyter
# Demo: Single Curvelet (Interactive) ``` import numpy as np import matplotlib.pyplot as plt from pyctlops import FDCT2D from ipywidgets import interactive_output, IntSlider, VBox, HBox ``` ### Setup ``` nx = 300 nz = 350 # Create operator DCT = FDCT2D((nx, nz), nbangles_coarse=8) # Create empty structure for cur...
github_jupyter
<a href="https://colab.research.google.com/github/ceos-seo/odc-colab/blob/master/notebooks/02.07.Colab_Vegetation_Phenology_L8.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Downloads the odc-colab Python module and runs it to setup ODC. ``` !wget...
github_jupyter
# Load previous results ``` import pickle with open("results.pkl", "rb") as fh: final_results = pickle.load(fh) ``` # Loading the Corpus ``` from corpora import hulth, scopus, semeval, kp20k from importlib import reload corpus_name = "semeval" if corpus_name == "scopus": df = scopus.load() elif corpus_name =...
github_jupyter
# Optimization Methods Until now, you've always used Gradient Descent to update the parameters and minimize the cost. In this notebook, you will learn more advanced optimization methods that can speed up learning and perhaps even get you to a better final value for the cost function. Having a good optimization algorit...
github_jupyter
# spaCy Tutorial **(C) 2019-2021 by [Damir Cavar](http://damir.cavar.me/)** **Version:** 1.5, January 2021 **Download:** This and various other Jupyter notebooks are available from my [GitHub repo](https://github.com/dcavar/python-tutorial-for-ipython). This is a tutorial related to the L665 course on Machine Learn...
github_jupyter
# Explore harvested text files ``` import os import pandas as pd import fileinput from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from textblob import TextBlob from operator import itemgetter from pathlib import Path import nltk import numpy as np import altair as alt import nltk nltk.dow...
github_jupyter
``` from pandas_datareader import data, wb ##Data reader to read data from web import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline ``` # Data **Name (DataFrame Name)** <input type="checkbox"> Bank of America (BAC) <input type="checkbox...
github_jupyter
## Observations and Insights ``` # Dependencies and Setup import matplotlib.pyplot as plt import pandas as pd import scipy.stats as st import numpy as np # Study data files mouse_metadata_path = "data/Mouse_metadata.csv" study_results_path = "data/Study_results.csv" # Read the mouse data and the study results mouse_...
github_jupyter
## <div align="center"> A Comprehensive ML Workflow for House Prices</div> There are plenty of **courses and tutorials** that can help you learn machine learning from scratch but here in **Kaggle**, I want to predict **House prices** a popular machine learning Dataset as a comprehensive workflow with python package...
github_jupyter
# [ATM 623: Climate Modeling](../index.ipynb) [Brian E. J. Rose](http://www.atmos.albany.edu/facstaff/brose/index.html), University at Albany # Lecture 23: The surface energy balance ## Warning: content out of date and not maintained You really should be looking at [The Climate Laboratory book](https://brian-rose.g...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_03_2_keras.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 3: Introduction to Tenso...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-DL0110EN-SkillsNetwork/Template/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> <h1>Linear Regression Multiple Outputs</h1> <h2>Objective</h2><ul><li> How to creat...
github_jupyter
# ROC Curves and AUC results ### Imports ``` import pandas as pd import numpy as np from sklearn.metrics import accuracy_score, confusion_matrix, roc_curve, auc import pickle import matplotlib.pyplot as plt ``` ### Data import ``` with open('data/y_test.pkl', 'rb') as f: y_test = pickle.load(f) with open('...
github_jupyter
``` import tqdm import numpy as np from matplotlib import pyplot as plt import cv2 as cv import tensorflow as tf from tensorflow.keras.models import * from tensorflow.keras.layers import * from tensorflow.keras.losses import * from tensorflow.keras.optimizers import * from tensorflow.keras import backend as K ### PLO...
github_jupyter
# Optimization Methods Until now, you've always used Gradient Descent to update the parameters and minimize the cost. In this notebook, you will learn more advanced optimization methods that can speed up learning and perhaps even get you to a better final value for the cost function. Having a good optimization algorit...
github_jupyter
# Create and edit synsets This demo shows how to create and edit synsets & relations. A synset is the building block of a WordNet is the synset that expresses a unique concept. The synset (a synonym set) contains, as the name implies, a number of synonym words known as literals. The synset has more properties like a ...
github_jupyter
# Steady-State Growth and Optimal Resource Allocation Griffin Chure - January 26, 2021 ``` import numpy as np import pandas as pd import altair as alt import sympy as sp import panel as pn import param import scipy.stats import diaux.viz pn.extension('vega') colors, palette = diaux.viz.altair_style() ``` In this not...
github_jupyter
# Many Particle Model (MPM) The Many Paticle Model (MPM) of a lithium-ion battery is an extension of the Single Particle Model to account for a continuous distribution of active particle sizes in each electrode $\text{k}=\text{n},\text{p}$. Therefore, many of the same model assumptions hold, e.g., the transport in the...
github_jupyter
# Day 3 of 100 Days of Machine Learning # Python Basics — 4: Functions, Working with functions, Classes, Working with Class, Inheritance ## Content - Functions - How to define a function - Passing value in function - Classes - How to make an instance of class and call methods from class - Inheritance ## Functions ##...
github_jupyter
``` %matplotlib inline import pandas as pd import pandas_datareader as web import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.mlab as mlab from pandas.plotting import register_matplotlib_converters import datetime from tqdm import tqdm import sqlalchemy as db import datetime register_ma...
github_jupyter
# Description GAM/NGAM calculation for consensus iCBI model ## Background In this notebook we train GAM/NGAM parameters using the most comprehensive metabolic flux data set collection we could gather. The GAM represents ATP used in biomass synthesis, and NGAM corresponds to ATP used for maintenance functions. Biomass ...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Removing `if` Statements from Expressions ## Author: Pa...
github_jupyter
``` import numpy as np # useful for many scientific computing in Python import pandas as pd # primary data structure library import folium print('Folium installed and imported!') # define the world map world_map = folium.Map() # display world map world_map # define the world map centered around Canada with a low zoo...
github_jupyter
## Dependencies ``` import json, warnings, shutil from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras.models import Model from tensorflow.keras import optimiz...
github_jupyter
# Automating the MUF This notebook is an example of using the MUF as a scriptable service from python. Requires modifications to the MUF source code to replace the variable Application.StartupPath, as it will be registered as the path to python.exe instead of the MUF application. Written by Aric Sanders 10/2017. This ...
github_jupyter
``` import numpy as np dir_name = './weights_npy/' layer_names = ['block1_conv1', 'block1_conv2', 'block2_conv1', 'block2_conv2', 'block3_conv1', 'block3_conv2', 'block3_conv3', 'block4_conv1', 'block4_conv2', 'block4_conv3', 'bl...
github_jupyter