code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Cordex preprocessing ``` %load_ext autoreload %autoreload 2 import xclim xclim.__version__ import os import intake import xarray as xr import numpy as np from tqdm.notebook import tqdm os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE" xr.set_options(keep_attrs=True) print(np.__version__) print(xr.__version__) import ...
github_jupyter
# Synthetic seismic: wedge We're going to make the famous wedge model, which interpreters can use to visualize the tuning effect. Then we can extend the idea to other kinds of model. ## Make a wedge earth model ``` import matplotlib.pyplot as plt import numpy as np length = 80 # x range depth = 200 # z range ``` ...
github_jupyter
``` #@title Environment Setup import glob BASE_DIR = "gs://download.magenta.tensorflow.org/models/music_vae/colab2" print('Installing dependencies...') !apt-get update -qq && apt-get install -qq libfluidsynth1 fluid-soundfont-gm build-essential libasound2-dev libjack-dev !pip install -q pyfluidsynth !pip install -qU...
github_jupyter
### Counter The `Counter` dictionary is one that specializes for helping with, you guessed it, counters! Actually we used a `defaultdict` earlier to do something similar: ``` from collections import defaultdict, Counter ``` Let's say we want to count the frequency of each character in a string: ``` sentence = 'the...
github_jupyter
# Download Data This notebook downloads the necessary data to replicate the results of our paper on Gender Inequalities on Wikipedia. Note that we use a file named `dbpedia_config.py` where we set which language editions we will we study, as well as where to save and load data files. By [Eduardo Graells-Garrido](htt...
github_jupyter
# Quantum Cryptography: Quantum Key Distribution *** ### Contributors: A.J. Rasmusson, Richard Barney Have you ever wanted to send a super secret message to a friend? Then you need a key to encrypt your message, and your friend needs the same key to decrypt your message. But, how do you send a super secret key to your...
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
_ELMED219-2021_. Alexander S. Lundervold, 10.01.2021. # Natural language processing and machine learning: a small case-study This is a quick example of some techniques and ideas from natural language processing (NLP) and some modern approaches to NLP based on _deep learning_. > Note: we'll take a close look at what ...
github_jupyter
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/affinitydesigner.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # メモ affinity designer を学ぶ ``` %%html <svg width="300" viewBox="0 0 348 316" xmlns="http://www.w3...
github_jupyter
# Pocessing GWO hourly meteorological data **Author: Jun Sasaki Coded on February 13, 2022 Updated on February 14, 2022.**<br> Extract and plot GWO (Ground Weather Observation) hourly data. ``` from metdata import gwo from datetime import datetime import matplotlib.pyplot as plt from matplotlib.ticker import Multipl...
github_jupyter
#### Measures of central tendencies ``` from typing import List daily_minutes = [1,68.77,51.25,52.08,38.36,44.54,57.13,51.4,41.42,31.22,34.76,54.01,38.79,47.59,49.1,27.66,41.03,36.73,48.65,28.12,46.62,35.57,32.98,35,26.07,23.77,39.73,40.57,31.65,31.21,36.32,20.45,21.93,26.02,27.34,23.49,46.94,30.5,33.8,24.23,21.4,27.9...
github_jupyter
``` pip install jupyter-dash pip install dash_daq pip install --ignore-installed --upgrade plotly==4.5.0 ``` At this point, restart the runtime environment for Colab ``` import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt import random import scipy.stats import plotly.express as px ...
github_jupyter
## Problem 1 ___ In this problem, we will build a Multilayer Perceptron (MLP) and train it on the MNIST hand-written digit dataset. ### Summary: ___ [Question 1](#1.1) [Question 2](#1.2) [Question 3](#1.3) [Question 4](#1.4) ___ ### 1. Building the Model <a id='1.1'></a> __________ **1.1) Build an MLP and...
github_jupyter
This Notebook is a short example of how to use the Ising solver implemented using the QAOA algorithm. We start by declaring the import of the ising function. ``` from grove.ising.ising_qaoa import ising from mock import patch ``` This code finds the global minima of an Ising model with external fields of the form $...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import ListedColormap from ml.data import create_lineal_data from ml.visualization import decision_boundary %matplotlib inline ``` # Función de coste y gradiente ## Generación de datos ### Entrenamiento ``` np.random.seed(0) # Para hac...
github_jupyter
**Math - Linear Algebra** *Linear Algebra is the branch of mathematics that studies [vector spaces](https://en.wikipedia.org/wiki/Vector_space) and linear transformations between vector spaces, such as rotating a shape, scaling it up or down, translating it (ie. moving it), etc.* *Machine Learning relies heavily on L...
github_jupyter
``` import pandas as pd import os from tqdm import tqdm from utils import avg, evidence_to_mask, text_len_scatter def to_data_df(df, data_dir): data_df = [] columns = ['text', 'classification', 'rationale' ,'query'] for i in tqdm(range(len(df))): df_row = df.loc[i] doc_id = df_row[...
github_jupyter
# Notebook served by Voilà #### Notebook copied from https://github.com/ChakriCherukuri/mlviz <h2>Gradient Descent</h2> * Given a the multi-variable function $\large {F(x)}$ differentiable in a neighborhood of a point $\large a$ * $\large F(x)$ decreases fastest if one goes from $\large a$ in the direction of the neg...
github_jupyter
# Wrangle & Analyze Data ### (WeRateDogs Twitter Archive) <ul> <li><a href="#intro">Introduction</a></li> <li><a href="#wrangle">Data Wrangling</a></li> <ul> <li><a href="#gather">Gathering Data</a></li> <li><a href="#assess">Assessing Data</a></li> <li><a href="#clean">Cle...
github_jupyter
# Determine derivative of Jacobian from angular velocity to exponential rates Peter Corke 2021 SymPy code to deterine the time derivative of the mapping from angular velocity to exponential coordinate rates. ``` from sympy import * ``` A rotation matrix can be expressed in terms of exponential coordinates (also cal...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/GetStarted/02_adding_data_to_qgis.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_bl...
github_jupyter
# Starbucks Capstone Challenge ## Project Overview This data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Once every few days, Starbucks sends out an offer to users of the mobile app. An offer can be merely an advertisement for a drink or an actual offer such as a dis...
github_jupyter
<table> <tr> <td style="background-color:#ffffff;"><a href="https://qsoftware.lu.lv/index.php/qworld/" target="_blank"><img src="..\images\qworld.jpg" width="70%" align="left"></a></td> <td style="background-color:#ffffff;" width="*"></td> <td style="background-color:#ffffff;vertical-align...
github_jupyter
``` import os import sys import numpy as np import matplotlib.pyplot as plt from scipy import stats import pickle from tqdm.notebook import tqdm from tqdm import trange %matplotlib inline def read_list_of_arrays(filename): A = pickle.load(open(filename, 'rb')) if len(A) == 3: print(A[1][0], A[2][0]...
github_jupyter
``` import torch import argparse import csv import datetime import math import torch.nn as nn from torch.nn.functional import leaky_relu, softmax from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader from collections import Counter from GANutils import * from utils import * ...
github_jupyter
# SP via class imbalance Example [test scores](https://www.brookings.edu/blog/social-mobility-memos/2015/07/29/when-average-isnt-good-enough-simpsons-paradox-in-education-and-earnings/) SImpson's paradox can also occur due to a class imbalance, where for example, over time the value of several differnt subgroups all ...
github_jupyter
``` #写函数,求n个随机整数均值的平方根,整数范围在m与k之间 import random,math def pingfanggeng(): m = int(input('请输入一个大于0的整数,作为随机整数的下界,回车结束。')) k = int(input('请输入一个大于0的整数,作为随机整数的上界,回车结束。')) n = int(input('请输入随机整数的个数,回车结束。')) i=0 total=0 while i<n: total=total+random.randint(m,k) i=i+1 average=total/...
github_jupyter
# `pandas` Part 2: this notebook is a 2nd lesson on `pandas` ## The main objective of this tutorial is to slice up some DataFrames using `pandas` >- Reading data into DataFrames is step 1 >- But most of the time we will want to select specific pieces of data from our datasets # Learning Objectives ## By the end of th...
github_jupyter
# Exp 101 analysis See `./informercial/Makefile` for experimental details. ``` import os import numpy as np from IPython.display import Image import matplotlib import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' import seaborn as sns sns.set_style('ticks') matplotlib....
github_jupyter
# Creating a Linear Cellular Automaton Let's start by creating a linear cellular automaton ![linear-aca2.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAn0AAABFCAYAAAA/xVAkAAAAAXNSR0IArs4c6QAABTd0RVh0bXhmaWxlACUzQ214ZmlsZSUyMGhvc3QlM0QlMjJhcHAuZGlhZ3JhbXMubmV0JTIyJTIwbW9kaWZpZWQlM0QlMjIyMDIxLTA5LTI0VDEyJTNBNDQlM...
github_jupyter
# Try It Yourself There are only three problems in this last set of exercises, but they're all pretty tricky, so be on guard! Run the setup code below before working on the questions. ``` from learntools.core import binder; binder.bind(globals()) from learntools.python.ex7 import * print('Setup complete.') ``` # E...
github_jupyter
# Exercise 4 Hi everyone, today we are going to have an introduction to Machine Learning and Deep Learning, as well as we will work with the Linear/Logistic regression and Correlation. # Part 1: Curve Fitting: ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` Sometimes we are going to fi...
github_jupyter
# Figures for comparison of arrival direction and joint models Here use the output from the `arrival_vs_joint` notebook to plot the figures shown in the paper. <br> <br> *This code is used to produce Figures 6, 7 and 8 (left panel) in Capel & Mortlock (2019).* ``` import numpy as np import h5py import matplotlib as m...
github_jupyter
# Setting up the Data Science Environment One of the largest hurdles beginners face is setting up an environment that they can quickly get up and running and analyzing data. ### Objectives 1. Understand the difference between interactive computing and executing a file 1. Ensure that Anaconda is installed properly wi...
github_jupyter
``` import os, sys, time import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import scipy.sparse import sklearn from sklearn.pipeline import Pipeline from sklearn.model_selection import PredefinedSplit from sklearn.linear_model import LinearRegression, Elas...
github_jupyter
#### stdin and stdout ** skipped** piping data at the command line if you run Python scripts through it. ``` import sys, re sys.argv[0] # sys.argv is the list of command-line arguments # sys.argv[0] is the name of the program itself # sys.argv[1] will be the regex specified at the command line regex = sys.argv[1] fo...
github_jupyter
# **Spotify Data Analysis** --- I want to accomplish 2 things with this project. First, I want to learn how to use the Spotify API. Learning how to use this API serves as a great gateway into the API Universe. The documentation is amazing, the API calls you can make to Spotify, per day, is more than enough for almost ...
github_jupyter
``` from molmap import model as molmodel import molmap import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm from joblib import load, dump tqdm.pandas(ascii=True) import numpy as np import tensorflow as tf import os os.environ["CUDA_VISIBLE_DEVICES"]="1" np.random.seed(123) tf.compat.v1.set_rando...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import geopy.distance as gd from mpl_toolkits.basemap import Basemap from datetime import datetime, timedelta pd.options.mode.chained_assignment = None # from pandarallel import pandarallel vessel_information = pd.read_c...
github_jupyter
# The Discrete-Time Fourier Transform *This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Comunications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*...
github_jupyter
# KakaoBrunch12M KakaoBrunch12M은 [카카오 아레나에서 공개한 데이터](https://arena.kakao.com/datasets?id=2)로 [브런치 서비스](https://brunch.co.kr) 사용자를 통해 수집한 데이터입니다. 이 예제에서는 브런치 데이터에서 ALS를 활용해 특정 글과 유사한 글을 추천하는 예제와 개인화 추천 예제 두 가지를 살펴보겠습니다. ``` import buffalo.data from buffalo.algo.als import ALS from buffalo.algo.options import ALSOption...
github_jupyter
# Interactive Map - Confirmed Cases in the US by State > Interactive Visualizations of The Count and Growth of COVID-19 in the US. - comments: true - author: Asif Imran - categories: [growth, usa, altair, interactive] - image: images/us-growth-state-map.png - permalink: /growth-map-us-states/ ``` #hide import request...
github_jupyter
# 列表List - 一个列表可以储存任意大小的数据集合,你可以理解为他是一个容器 ``` a = [1,2,3,'a',1.0,True,[1,2]] a ``` ## 先来一个例子爽一爽 ![](../Photo/115.png) ## 创建一个列表 - a = [1,2,3,4,5] ``` import numpy as np a = [[1,2],[3,4]] np.array(a) ``` ## 列表的一般操作 ![](../Photo/116.png) ``` a = 'Kim' b = 'im' b in a a = [1,2,'Kim',1.0] b = 'im' b in a a = [1]#列表只能...
github_jupyter
``` %matplotlib inline from matplotlib import pyplot as plt import numpy as np import pandas as pd from pathlib import Path from sklearn.feature_selection import SelectFromModel from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.preprocessing import Stan...
github_jupyter
> **Tip**: Welcome to the Investigate a Dataset project! You will find tips in quoted sections like this to help organize your approach to your investigation. Before submitting your project, it will be a good idea to go back through your report and remove these sections to make the presentation of your work as tidy as ...
github_jupyter
# Análisis de la Movilidad en Bogotá ¿Cuáles son las rutas más críticas de movilidad y sus características en la ciudad de Bogotá? Se toman los datos de la plataforma: https://datos.movilidadbogota.gov.co ``` import pandas as pd import os os.chdir('../data_raw') data_file_list = !ls data_file_list data_file_list[len...
github_jupyter
**Chapter 11 – Training Deep Neural Networks** _This notebook contains all the sample code and solutions to the exercises in chapter 11._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/11_training_deep_neural_networks.ipynb"><img src="h...
github_jupyter
## Imports ``` from bayes_opt import BayesianOptimization import pandas as pd import numpy as np from datetime import timedelta from tqdm import tqdm_notebook as tqdm from sklearn import metrics from sklearn.model_selection import StratifiedKFold import lightgbm as lgb from matplotlib import pyplot as plt #import seab...
github_jupyter
___ <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> ___ # NLP (Natural Language Processing) with Python This is the notebook that goes along with the NLP video lecture! In this lecture we will discuss a higher level overview of the basics of Natural Language Processing, which basical...
github_jupyter
# "The Evolution of Music Industry Sales" > "Deep dive analysis into music industry sales over the past 40 years." - toc:true - branch: master - badges: true - comments: true - author: Karinn Murdock - categories: [fastpages, jupyter] Karinn Murdock 03/14/2022 # The Evolution of Music Industry Sales ## Introductio...
github_jupyter
# Developing an AI application Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli...
github_jupyter
``` import pandas as pd import seaborn as sns desc = pd.read_csv('data/VariableDefinitions.csv') train = pd.read_csv('data/Train.csv') test = pd.read_csv('data/Test.csv') sub = pd.read_csv('data/Samplesubmission.csv') df.loc[1].values desc.drop(['Unnamed: 1'], axis=1, inplace=True) desc.iloc[2:, ].values train.head(2) ...
github_jupyter
``` # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib from matplotlib import rcParams rcParams['font.family'] = 'monospace' #rcParams['font.sans-serif'] = ['Tahoma'] import numpy as np import math import datetime import networkx as nx import os def TodaysDate(): Today = datetime.da...
github_jupyter
# Developing an AI application Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli...
github_jupyter
``` %%html <style> .jp-Cell {max-width: 1024px !important; margin: auto} .jp-Cell-inputWrapper {max-width: 1024px !important; margin: auto} .jp-MarkdownOutput p {text-align: justify;} .jupyter-matplotlib-figure {margin: auto;} </style> %matplotlib widget from pyvisco import inter GUI = inter.Control() `...
github_jupyter
# Numpy (✗) > Makine Öğrenmesi ve Derin Öğrenme için gerekli Numpy konuları. - toc: true - badges: true - comments: true - categories: [jupyter] - image: images/chart-preview.png # Set up ``` import numpy as np # Set seed for reproducibility np.random.seed(seed=1234) ``` # Basics Let's take a took at how to creat...
github_jupyter
<img src="images/usm.jpg" width="480" height="240" align="left"/> # MAT281 - Introducción a Pandas ## Objetivos de la clase * Aprender conceptos básicos de la librería pandas. ## Contenidos * [Pandas](#c1) <a id='c1'></a> ## Pandas <img src="images/pandas.jpeg" width="360" height="240" align="center"/> [Pand...
github_jupyter
# CODE TO PERFORM SIMPLE LINEAR REGRESSION ON FUEL CONSUMPTION DATASET # Dr. Ryan @STEMplicity ![image.png](attachment:image.png) # PROBLEM STATEMENT - You have been hired as a consultant to a major Automotive Manufacturer and you have been tasked to develop a model to predict the impact of increasing the vehicle ho...
github_jupyter
``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns sns.set_style("whitegrid", {'axes.grid' : False}) import joblib import catboost import xgboost as xgb import lightgbm as lgb from category_encoders import BinaryEncoder from sklearn.metric...
github_jupyter
## Tutorial on QAOA Compiler This tutorial shows how to use the QAOA compiler for QAOA circuit compilation and optimization. (https://github.com/mahabubul-alam/QAOA-Compiler). ### Inputs to the QAOA Compiler The compiler takes three json files as the inputs. The files hold the following information: * ZZ-interactions...
github_jupyter
# Session 7: The Errata Review No. 1 This session is a review of the prior six sessions and covering those pieces that were left off. Not necessarily errors, but missing pieces to complete the picture from the series. These topics answer some questions and will help complete the picture of the C# language features d...
github_jupyter
``` """ Made on July 10th, 2019 @author: Theodore Pena @contact: theodore.pena@tufts.edu """ line_color = 'purple' # Color for the 10-panel plots x_Delta = np.log10(54) # In our time units, the time between SDSS and HSC default_Delta_value = -0.0843431604042636 data_path = '/home/tpena01/AGN_variability_project/Simula...
github_jupyter
<a href="https://colab.research.google.com/github/jonkrohn/ML-foundations/blob/master/notebooks/2-linear-algebra-ii.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Linear Algebra II: Matrix Operations This topic, *Linear Algebra II: Matrix Operat...
github_jupyter
![](http://i67.tinypic.com/2jcbwcw.png) ## Classification Classification - predicting the discrete class ($y$) of an object from a vector of input features ($\vec x$). Models used in this notebook include: Logistic Regression, Support Vector Machines, KNN **Author List**: Kevin Li **Original Sources**: http://sci...
github_jupyter
<a href="https://colab.research.google.com/github/davidedomini/stroke_predictions/blob/main/StrokePrediction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Stroke Prediction **Davide Domini** <br> davide.domini@studio.unibo.it<br> <br> Programm...
github_jupyter
# Inference ## Imports & Args ``` import argparse import json import logging import os import random from io import open import numpy as np import math import _pickle as cPickle from scipy.stats import spearmanr from tensorboardX import SummaryWriter from tqdm import tqdm from bisect import bisect import yaml from e...
github_jupyter
``` import datetime import time import json import os import string import requests import sys import traceback import azure.cosmos.cosmos_client as cosmos_client from helpers import keys from helpers import nlp_helper from gremlin_python.driver import client, serializer config = { 'ENDPOINT': keys.cosmos_uri, ...
github_jupyter
# Day 9 - Finding the sum, again, with a running series * https://adventofcode.com/2020/day/9 This looks to be a variant of the [day 1, part 1 puzzle](./Day%2001.ipynb); finding the sum of two numbers in a set. Only now, we have to make sure we know what number to remove as we progres! This calls for a _sliding windo...
github_jupyter
# Intro to matplotlib - plotting in Python Most of this material is reproduced or adapted from https://github.com/jakevdp/PythonDataScienceHandbook The text is released under the [CC-BY-NC-ND license](https://creativecommons.org/licenses/by-nc-nd/3.0/us/legalcode), and code is released under the [MIT license](https:...
github_jupyter
# Campus SEIR Modeling ## Campus infection data The following data consists of new infections reported since August 3, 2020, from diagnostic testing administered by the Wellness Center and University Health Services at the University of Notre Dame. The data is publically available on the [Notre Dame Covid-19 Dashboar...
github_jupyter
``` # dependencies import pandas as pd from sqlalchemy import create_engine, inspect # read raw data csv csv_file = "NYC_Dog_Licensing_Dataset.csv" all_dog_data = pd.read_csv(csv_file) all_dog_data.head(10) # trim data frame to necessary columns dog_data_df = all_dog_data[['AnimalName','AnimalGender','BreedName','Bo...
github_jupyter
# What's this PyTorch business? You've written a lot of code in this assignment to provide a whole host of neural network functionality. Dropout, Batch Norm, and 2D convolutions are some of the workhorses of deep learning in computer vision. You've also worked hard to make your code efficient and vectorized. For the ...
github_jupyter
<a href="https://colab.research.google.com/github/tmbern/DS-Unit-2-Kaggle-Challenge/blob/master/module4-classification-metrics/Unit_2_Sprint_2_Module_4_CLASS-lecture-notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science...
github_jupyter
# test note * jupyterはコンテナ起動すること * テストベッド一式起動済みであること ``` !pip install --upgrade pip !pip install --force-reinstall ../lib/ait_sdk-0.1.7-py3-none-any.whl from pathlib import Path import pprint from ait_sdk.test.hepler import Helper import json # settings cell # mounted dir root_dir = Path('/workdir/root/ait') ait_n...
github_jupyter
# HM2: Numerical Optimization for Logistic Regression. ### Name: [Your-Name?] ## 0. You will do the following: 1. Read the lecture note: [click here](https://github.com/wangshusen/DeepLearning/blob/master/LectureNotes/Logistic/paper/logistic.pdf) 2. Read, complete, and run my code. 3. **Implement mini-batch SGD** ...
github_jupyter
``` %matplotlib inline import math import numpy import pandas import seaborn import matplotlib.pyplot as plt import plot def fmt_money(number): return "${:,.0f}".format(number) def run_pmt(market, pmt_rate): portfolio = 1_000_000 age = 65 max_age = 100 df = pandas.DataFrame(index=range(age, max_age...
github_jupyter
``` import os import json import boto3 import sagemaker import numpy as np from source.config import Config config = Config(filename="config/config.yaml") sage_session = sagemaker.session.Session() s3_bucket = config.S3_BUCKET s3_output_path = 's3://{}/'.format(s3_bucket) print("S3 bucket path: {}".format(s3_output_p...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> *This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pytho...
github_jupyter
### Note * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps. ``` # Dependencies and Setup import pandas as pd # File to Load school_data_to_load = "Resources/schools_complete.csv" student_data_to_load = "Resources/stud...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge...
github_jupyter
``` import pandas as pd import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasRegressor from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn...
github_jupyter
**[CDS-01]** 必要なモジュールをインポートして、乱数のシードを設定します。 ``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt np.random.seed(20160704) tf.set_random_seed(20160704) ``` **[CDS-02]** CIFAR-10 のデータセットをダウンロードします。ダウンロード完了まで少し時間がかかります。 ``` %%bash mkdir -p /tmp/cifar10_data cd /tmp/cifar10_data curl -OL http:...
github_jupyter
``` # - Decide which map to plot # in main notebook code #mapvarnow = 'skj' # choose: skj, bet # - Define constant plot params stipsizenow = 10; stipmarknow = 'o' stipfacecolnow = 'none' stipedgeltcolnow = 'whitesmoke' stipewnow = 0.8 # marker edge width eezfcnow = 'none'; eezlcnow = 'lightgray' #'silver' eezlsnow = '...
github_jupyter
![fifa](./logo_fifa.png) # Ejemplo de simulación numérica ``` import numpy as np from scipy.integrate import odeint from matplotlib import rc import matplotlib.pyplot as plt %matplotlib inline rc("text", usetex=True) rc("font", size=18) rc("figure", figsize=(6,4)) rc("axes", grid=True) ``` ## Problema físico ![esq...
github_jupyter
# 4 データ前処理 ## 4.1 欠損データへの対処 ``` from IPython.core.display import display import pandas as pd from io import StringIO csv_data = '''A,B,C,D 1.0,2.0,3.0,4.0 5.0,6.0,,8.0 10.0,11.0,12.0,''' df = pd.read_csv(StringIO(csv_data)) df # 各特徴量の欠測値をカウント df.isnull().sum() df.values ``` ### 4.1.1 欠測値を持つサンプル/特徴量を取り除く ``` # 欠測値を含...
github_jupyter
REMEMBER: FIRST CREATE A COPY OF THIS FILE WITH A UNIQUE NAME AND DO YOUR WORK THERE. AND MAKE SURE YOU COMMIT YOUR CHANGES TO THE `hw3_submissions` BRANCH. # Assignment 3 | Cleaning and Exploring Data with Pandas <img src="data/scoreCard.jpg" width=250> In this assignment, you will investigate restaurant food safet...
github_jupyter
<a href="https://colab.research.google.com/github/Ipal23/LSTM-Neural-Network-Bitcoin-Stock-prediction/blob/main/Bitcoin_Prediction_with_the_use_of_an_LSTM.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Project 1. The prediction of the Bitcoin Stock...
github_jupyter
# CLX Asset Classification (Supervised) ## Authors - Eli Fajardo (NVIDIA) - Görkem Batmaz (NVIDIA) - Bhargav Suryadevara (NVIDIA) ## Table of Contents * Introduction * Dataset * Reading in the datasets * Training and inference * References # Introduction In this notebook, we will show how to predict the function o...
github_jupyter
![](../docs/banner.png) # Chapter 8: Basic Data Wrangling With Pandas <h2>Chapter Outline<span class="tocSkip"></span></h2> <hr> <div class="toc"><ul class="toc-item"><li><span><a href="#1.-DataFrame-Characteristics" data-toc-modified-id="1.-DataFrame-Characteristics-2">1. DataFrame Characteristics</a></span></li><li...
github_jupyter
``` import sys,os sys.path.append('../') from deep_rl import * import matplotlib.pyplot as plt import torch from tqdm.notebook import trange, tqdm import random import numpy as np import time %load_ext autoreload %reload_ext autoreload %autoreload 2 select_device(0) def dqn_feature(hu=676,**kwargs): generate_tag(kw...
github_jupyter
``` import time import pandas as pd import numpy as np city_con = { 1: ["chicago.csv","Chicago"], 2: ["new_york_city.csv","New York City"], 3: ["washington.csv","Washington"], 4:[0,"Exit"], "NS":[0,"Not selected"] } fltr_choice = { 1:"Month", 2:"Day", 3:"Show all data", 4:"Exit", ...
github_jupyter
``` # installing required module !pip install fuzzy-c-means import cv2 import numpy as np import math import bisect from google.colab.patches import cv2_imshow from skimage import morphology from sklearn.cluster import KMeans from fcmeans import FCM def imadjust(src, tol=1, vin=[0,255], vout=(0,255)): # src : inp...
github_jupyter
``` import pandas as pd pd.set_option('max_colwidth', 400) df_glove_parag = pd.read_csv("../results/final_results_08_03/test_results_glove_preprocessed_reports_08_03.csv") df_glove_no_back_parag = pd.read_csv("../results/final_results_08_03/test_results_glove_no_back_preprocessed_reports_08_03.csv") df_ft_parag = pd.r...
github_jupyter
# Modeling and fitting ## Prerequisites - Knowledge of spectral analysis to produce 1D On-Off datasets, [see the following tutorial](spectrum_analysis.ipynb) - Reading of pre-computed datasets [see the MWL tutorial](analysis_mwl.ipynb) - General knowledge on statistics and optimization methods ## Proposed approach ...
github_jupyter
``` #hide from qbism import * ``` # Tutorial > "Chauncey Wright, a nearly forgotten philosopher of real merit, taught me when young that I must not say necessary about the universe, that we don’t know whether anything is necessary or not. So I describe myself as a bettabilitarian. I believe that we can bet on the beh...
github_jupyter
``` %run ../Python_files/load_dicts.py %run ../Python_files/util.py from util import * import numpy as np from numpy.linalg import inv, matrix_rank import json # # load logit_route_choice_probability_matrix # P = zload('../temp_files/logit_route_choice_probability_matrix_Sioux.pkz') # P = np.matrix(P) # print('rank of...
github_jupyter
``` %matplotlib inline import pandas as pd import matplotlib.pyplot as plt import datetime import pytz import urllib as ur import json ``` ## Funções para auxiliar a manipulação do tempo ``` def convert_datetime_timezone(dt, tz1, tz2): """ Converte uma hora no fuso UTC ou São Paulo para um provável fuso de Va...
github_jupyter
# 5장 ``` import matplotlib matplotlib.rc('font', family="NanumBarunGothicOTF") %matplotlib inline ``` # 5.2 아이리스 데이터셋 ``` import pandas as pd from matplotlib import pyplot as plt import sklearn.datasets def get_iris_df(): ds = sklearn.datasets.load_iris() df = pd.DataFrame(ds['data'], columns=ds['feature...
github_jupyter
In this notebook you can define your own configuration and run the model based on your custom configuration. ## Dataset `dataset_name` is the name of the dataset which will be used in the model. In case of using KITTI, `dataset_path` shows the path to `data_paths` directory that contains every image and its pair path...
github_jupyter
# Case 1. Heart Disease Classification Joona Klemetti 4.2.2018 Cognitive Systems for Health Technology Applications Helsinki Metropolia University of Applied Science # 1. Objectives The aim of this case is learn to manipulate and read data from externals sources using panda’s functions and use keras de...
github_jupyter