code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import random import gym #import math import numpy as np from collections import deque import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Flatten from tensorflow.keras.optimizers import Adam EPOCHS = 1000 THRESHOLD = 10 MONITOR = T...
github_jupyter
# Lesson 5: Tidy Data *Learn to prepare data for visualization and analytics.* ## Instructions This tutorial provides step-by-step training divided into numbered sections. The sections often contain embeded exectable code for demonstration. This tutorial is accompanied by a practice notebook: [L05-Tidy_Data-Practice...
github_jupyter
``` import os import pandas as pd import time import statsmodels.api as sm import sklearn.utils as utils import matplotlib.pyplot as plt %matplotlib inline start_time = time.time() MA_location = {"Greater_Boston_Area" : 0, "Salem" : 0, "Plymouth" : 0, "Waltham" : 0, "Framingham" :...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import glob import sys import argparse as argp change_50_dat = pd.read_csv('/Users/leg2015/workspace/Aagos/Data/Mut_Treat_Change_50_CleanedDataStatFit.csv', index_col="update", float_precision="high") change_0_dat = pd.read...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen...
github_jupyter
## Roadsigns Data Collection # Installing Selenium ``` pip install selenium ``` ### Starting the web driver ``` import selenium from selenium import webdriver # Put the path for your ChromeDriver here DRIVER_PATH = 'D:\Vedanth\proxvision\chromedriver' wd = webdriver.Chrome(executable_path=DRIVER_PATH) wd.get('https...
github_jupyter
``` # -*- coding: utf-7 -*- %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns df_train = pd.read_csv("../data/titanic_train.csv") df_test = pd.read_csv("../data/titanic_test.csv") df_train.head(5) print(df_train.info()) print("-----------------") print(df_t...
github_jupyter
# Noise2Void - 2D Example for SEM data ``` # We import all our dependencies. from n2v.models import N2VConfig, N2V import numpy as np from csbdeep.utils import plot_history from n2v.utils.n2v_utils import manipulate_val_data from n2v.internals.N2V_DataGenerator import N2V_DataGenerator from matplotlib import pyplot as...
github_jupyter
# Deploy model **Important**: Change the kernel to *PROJECT_NAME local*. You can do this from the *Kernel* menu under *Change kernel*. You cannot deploy the model using the *PROJECT_NAME docker* kernel. ``` from azureml.api.schema.dataTypes import DataTypes from azureml.api.schema.sampleDefinition import SampleDefinit...
github_jupyter
# Ejercicios Graphs, Paths & Components Ejercicios básicos de Grafos. ## Ejercicio - Número de Nodos y Enlaces _ (resuelva en código propio y usando la librería NetworkX (python) o iGraph (R)) _ Cuente el número de nodos y enlaces con los siguientes links (asumiendo que el grafo puede ser dirigido Y no dirigido): ...
github_jupyter
<a id="title_ID"></a> # JWST Pipeline Validation Testing Notebook: Calwebb_Image3, Resample step <span style="color:red"> **Instruments Affected**</span>: FGS, MIRI, NIRCam, NIRISS, NIRSpec Tested on MIRI Simulated data ### Table of Contents <div style="text-align: left"> <br> [Introduction](#intro_ID) <br> [Run...
github_jupyter
``` import random, time, ffmpeg import numpy as np from math import ceil import threading import cv2 from datetime import datetime import PIL.Image as Image import tensorflow as tf import os import matplotlib.pyplot as plt model_settings = { # Training settings 'current_epoch': 1, 'max_steps': 1000, 'mo...
github_jupyter
# DiFuMo (Dictionaries of Functional Modes) <div class="alert alert-block alert-danger"> <b>NEW:</b> New in release 0.7.1 </div> ## Outline - <a href="#descr">Description</a> - <a href="#howto">Description</a> - <a href="#closer">Coser look on the object</a> - <a href="#visualize">Visualize</a> <span id="descr"></s...
github_jupyter
# Name Data processing by creating a cluster in Cloud Dataproc # Label Cloud Dataproc, cluster, GCP, Cloud Storage, KubeFlow, Pipeline # Summary A Kubeflow Pipeline component to create a cluster in Cloud Dataproc. # Details ## Intended use Use this component at the start of a Kubeflow Pipeline to create a tempora...
github_jupyter
``` def string_adder(a = "", b = ""): return str(a + " " + b) string_adder(a = "Michael", b = "Akinola") #string_adder() #string_adder("$", "1000") # Define a long_word function that accepts a string. # The function should return a Boolean that reflects whether the string has more than 7 characters. # def long_w...
github_jupyter
``` # Code borrowed from sklean # https://scikit-learn.org/stable/auto_examples/applications/plot_topics_extraction_with_nmf_lda.html # Author: Luke Kumar import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition import LatentDirichle...
github_jupyter
# Tutorial 06: Networks from OpenStreetMap In this tutorial, we discuss how networks that have been imported from OpenStreetMap can be integrated and run in Flow. This will all be presented via the Bay Bridge network, seen in the figure below. Networks from OpenStreetMap are commonly used in many traffic simulators fo...
github_jupyter
<table width="100%"> <tr> <td style="background-color:#ffffff;"> <a href="http://qworld.lu.lv" target="_blank"><img src="../images/qworld.jpg" width="35%" align="left"> </a></td> <td style="background-color:#ffffff;vertical-align:bottom;text-align:right;"> prepared by Abuzer Yak...
github_jupyter
# Walkthrough the NIRCAM imaging WCS pipeline rountrip of values through the coordinate frame transforms ``` import jwst jwst.__version__ from astropy.io import fits from jwst import assign_wcs from jwst.datamodels import image # add in the columns for ra and dec min/max points, translated from the wcs object for now ...
github_jupyter
[![imagenes](imagenes/pythonista.png)](https://pythonista.mx) ## La DB API de Python para bases de datos relacionales. Debido a que existen muy diversos gestores de bases de datos, tanto SQL como no-SQL, la comunidad de Python publicó la [PEP-249](https://www.python.org/dev/peps/pep-0249/), la cual define modelo gené...
github_jupyter
``` # Execute this code block to install dependencies when running on colab try: import torch except: from os.path import exists from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) cuda_output = !ldconfig -...
github_jupyter
# Python Notional Machine Our goal is to refresh ourselves on basics (and some subtleties) associated with Python's data and computational model. Along the way, we'll also use or refresh ourselves on the <b>environment model</b> as a way to think about and keep track of the effect of executing Python code. Specifically...
github_jupyter
![Captura%20de%20tela%202022-02-16%20154604.png](attachment:Captura%20de%20tela%202022-02-16%20154604.png) ``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.model_selection import train_test_split from sklearn.cluster import KMeans from sklearn.decomposition import PCA from scipy....
github_jupyter
``` from crystal_toolkit.helpers.layouts import Columns, Column from crystal_toolkit.settings import SETTINGS from jupyter_dash import JupyterDash from pydefect.analyzer.calc_results import CalcResults from pydefect.analyzer.dash_components.cpd_energy_dash import CpdEnergy2D3DComponent, CpdEnergyOtherComponent from pyd...
github_jupyter
``` import pandas as pd ``` # Read the CSV and Perform Basic Data Cleaning ``` df = pd.read_csv("../data/exoplanet_data.csv") # Drop the null columns where all values are null df = df.dropna(axis='columns', how='all') # Drop the null rows df = df.dropna() df.head() df.tail() df.info() ``` # Select your features (col...
github_jupyter
# V2: SCF optimization with VAMPyR ## V2.1: Hydrogen atom In order to solve the one-electron Schr\"{o}dinger equation in MWs we reformulate them in an integral form [1]. \begin{equation} \phi = -2\hat{G}_{\mu}\hat{V}\phi \end{equation} Where $\hat{V}$ is the potential acting on the system, $\phi$ is the wavefuncti...
github_jupyter
# Predição de atraso de voos https://docs.microsoft.com/en-us/learn/modules/predict-flight-delays-with-python/0-introduction ### Importando o arquivo ``` !curl https://topcs.blob.core.windows.net/public/FlightData.csv -o flightdata.csv import pandas as pd df = pd.read_csv('flightdata.csv') df.head() observacoes, fea...
github_jupyter
``` import os import glob import LatLon import numpy as np import pandas as pd pd.set_option('display.max_rows', 10) # plot %matplotlib inline import matplotlib.pyplot as plt import pylab import seaborn as sns sns.set_style("whitegrid") from pysurvey.plot import setup, legend, icolorbar, density, minmax import geopl...
github_jupyter
``` import pandas as pd import numpy as np ## For plotting import matplotlib.pyplot as plt from matplotlib import style import datetime as dt import seaborn as sns sns.set_style("whitegrid") path = '../Data/dff1.csv' df= pd.read_csv(path, parse_dates=['ds']) # df = df.rename(columns = {"Date":"ds","Close":"y"}) df = ...
github_jupyter
``` !pwd import sys sys.path.append('/workspace') from src.core.db.config import DatabaseEnum from src.core.db.models.pdf_models import Fincen8300Rev4 from src.core.db.models.main_models import EmployeeToDocument from src.core.db.session import DBContext, DbQuery ``` # Read the pdf data into a data source ``` db = Db...
github_jupyter
``` import pandas as pd import numpy as np from datetime import datetime from sqlalchemy import create_engine from dateutil.relativedelta import relativedelta from pricing.service.scoring.lscore import LScoring from plotly.offline import init_notebook_mode, iplot import plotly.graph_objs as go init_notebook_mode(connec...
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
# Módulo 2 - Modelos preditivos e séries temporais # Desafio do Módulo 2 ``` import pandas as pd import numpy as np base = pd.read_csv('https://pycourse.s3.amazonaws.com/banknote_authentication.txt', header=None) base.head() #labels: #variance, skewness, curtosis e entropy) base.columns=['variance', 'skewness', 'curt...
github_jupyter
<a href="https://codeimmersives.com"><img src = "https://www.codeimmersives.com/wp-content/uploads/2019/09/CodeImmersives_Logo_RGB_NYC_BW.png" width = 400> </a> <h1 align=center><font size = 5>Agenda</font></h1> ### <div class="alert alert-block alert-info" style="margin-top: 20px"> 1. [Review](#0)<br> 2. [Panda...
github_jupyter
## High and Low Pass Filters Now, you might be wondering, what makes filters high and low-pass; why is a Sobel filter high-pass and a Gaussian filter low-pass? Well, you can actually visualize the frequencies that these filters block out by taking a look at their fourier transforms. The frequency components of any im...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from matplotlib.pyplot import MultipleLocator complexity = pd.read_csv('C:/Users/34433/Desktop/MFFT/Courses/MFIN7036 NLP/Group project/complexity_220318.csv') ticker_industry = pd.read_excel('C:/Users/34433/Desktop/MFFT/Cou...
github_jupyter
# Build a classification decision tree We will illustrate how decision tree fit data with a simple classification problem using the penguins dataset. <div class="admonition note alert alert-info"> <p class="first admonition-title" style="font-weight: bold;">Note</p> <p class="last">If you want a deeper overview regar...
github_jupyter
<a href="https://colab.research.google.com/github/Andrewzekid/MCExcelAPI/blob/main/ExcelAPI.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import pandas as pd import math import datetime from openpyxl import Workbook def clea...
github_jupyter
<img src="../../images/banners/python-advanced.png" width="600"/> # <img src="../../images/logos/python.png" width="23"/> Python's property(): Add Managed Attributes to Your Classes ## <img src="../../images/logos/toc.png" width="20"/> Table of Contents * [Managing Attributes in Your Classes](#managing_attributes_in...
github_jupyter
--- # Minimizing risks for loan investments - (Keras - Artificial Neural Network) [by Tomas Mantero](https://www.kaggle.com/tomasmantero) --- ### Table of Contents 1. [Overview](#ch1) 1. [Dataset](#ch2) 1. [Exploratory Data Analysis](#ch3) 1. [Data PreProcessing](#ch4) 1. [Categorical Variables and Dummy Variables](...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** ### GOAL : Make a pipeline that finds lane lines on the road for basic understanding of concepts Reflect on your work in a written report --- ## Pipeline : To achieve the first goal to find lane lines I am using canny...
github_jupyter
# Plotting the cheapest and the most expensive houses for sale in Mexico City [elnortescrapper](https://github.com/rafrodriguez/elnortescrapper) is a custom-made Python web scrapper for advertisements of houses for sale in Mexico that are listed in [Avisos de ocasión](http://www.avisosdeocasion.com). It was used to r...
github_jupyter
``` import pandas as pd %pwd node_features_file = "../../generate_node_features/corpus_2020_audience_overlap_level_0_and_1_node_features.csv" edge_file = "../../generate_node_features/combined_data_corpus_2020_level_0_1_df_edges.csv" node_features_df = pd.read_csv(node_features_file, index_col=0) node_features_df.head(...
github_jupyter
# iMCSpec (iSpec+emcee) iMCSpec is a tool which combines iSpec(https://www.blancocuaresma.com/s/iSpec) and emcee(https://emcee.readthedocs.io/en/stable/) into a single unit to perform Bayesian analysis of spectroscopic data to estimate stellar parameters. For more details on the individual code please refer to the lin...
github_jupyter
<a href="https://colab.research.google.com/github/ryanleeallred/DS-Unit-1-Sprint-1-Dealing-With-Data/blob/master/module2-loadingdata/LS_DS_112_Loading_Data_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Practice Loading Datasets This ...
github_jupyter
``` ################################### # Test cell, pyechonest - IO HAVOC ################################### import os import sys sys.path.append(os.environ["HOME"] + "/github/pyechonest") import pyechonest.track as track import pyechonest.artist as artist import pyechonest.util as util import pyechonest.song as son...
github_jupyter
# Amazon Augmented AI (Amazon A2I) integration with Amazon Fraud Detector # Visit https://github.com/aws-samples/amazon-a2i-sample-jupyter-notebooks for all A2I Sample Notebooks 1. [Introduction](#Introduction) 2. [Prerequisites](#Setup) 1. [Workteam](#Workteam) 2. [Notebook Permission](#Notebook-Permission) ...
github_jupyter
# analyzing dense output Timothy Tyree<br> 3.26.2021 ``` # darkmode=True from lib.my_initialization import * # For darkmode plots from jupyterthemes import jtplot jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False) ``` ## plot the collision times ``` #load the example data # os.chdir(nb_dir) # ...
github_jupyter
# Approximating Steel Cased Wells - DC [Lindsey Heagy](http://github.com/lheagy) In this example, we examine the impact of upscaling the well using - the assumption that the well is a solid rod of steel - averaging conductivity such that the $\sigma A$ is the same in both cases These experiments are conducted at DC....
github_jupyter
This notebook contains an example for teaching. # A Simple Case Study using Wage Data from 2015 - proceeding So far we considered many machine learning method, e.g Lasso and Random Forests, to build a predictive model. In this lab, we extend our toolbox by predicting wages by a neural network. ## Data preparation ...
github_jupyter
[@LorenaABarba](https://twitter.com/LorenaABarba) 12 steps to Navier–Stokes ===== *** Did you experiment in Steps [1](./01_Step_1.ipynb) and [2](./02_Step_2.ipynb) using different parameter choices? If you did, you probably ran into some unexpected behavior. Did your solution ever blow up? (In my experience, CFD stud...
github_jupyter
# Likelihood for Retro To calculate the likelihood of a hypothesis $H$ given observed data $\boldsymbol{k}$, we construct the extended likelihood given as: $$\large L(H|\boldsymbol{k}) = \prod_{i\in\text{DOMs}} \frac{\lambda_i^{k_i}} {k_i!} e^{-\lambda_i} \prod_{j\in\text{hits}}p^j(t_j|H)^{k_j}$$ where: * $\lambda_i...
github_jupyter
# Calculadora Purpose of this project is the creation of a simple calculator using python code. ``` def adicao(x,y): return x+y def subtracao(x,y): return x-y def multiplicacao(x,y): return x*y def divisao(x,y): return x/y def escolhadaoperacao(): while True: try: escolha =...
github_jupyter
``` print('Materialisation Data Test') import os import compas from compas.datastructures import Mesh, mesh_bounding_box_xy from compas.geometry import Vector, Frame, Scale HERE = os.getcwd() FILE_I = os.path.join(HERE, 'blocks and ribs_RHINO', 'sessions', 'bm_vertical_equilibrium', 'simple_tripod.rv2') FILE_O1 = os....
github_jupyter
``` import numpy as np import pandas as pd from grn_learn.viz import set_plotting_style import seaborn as sns import matplotlib.pyplot as plt from grn_learn import download_and_preprocess_data from grn_learn import annot_data_trn from grn_learn import train_keras_multilabel_nn from sklearn.model_selection import St...
github_jupyter
## ***Defining the Question*** Provided with the dataset from Nairobi Hospital, your are task to build a model that determines whether or not the patient's symptoms indicate that the patient has hypothyroid. ## ***Metric For Success*** The Metric of Sucess will be to find a decission tree model to determine whether or...
github_jupyter
# Batch Normalization – Lesson 1. [What is it?](#theory) 2. [What are it's benefits?](#benefits) 3. [How do we add it to a network?](#implementation_1) 4. [Let's see it work!](#demos) 5. [What are you hiding?](#implementation_2) # What is Batch Normalization?<a id='theory'></a> Batch normalization was introduced in ...
github_jupyter
``` import logging import os import math from dataclasses import dataclass, field import copy # for deep copy import torch from torch import nn from transformers import RobertaForMaskedLM, RobertaTokenizerFast, TextDataset, DataCollatorForLanguageModeling, Trainer from transformers import TrainingArguments, HfArgumen...
github_jupyter
# Inequality Data Processing (WIID) ## Data Dictionary | Variable | Definition | |--------------------|---------------------...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
download datasetnya https://drive.google.com/file/d/1IX9cWMwzc4v8lLivk19k2LV2JrCj0KD1/view?usp=sharing ``` import pandas as pd import numpy as np df = pd.read_csv('Amazon_Unlocked_Mobile.csv') # df = df.sample(frac=0.1, random_state=10) df.head() df.dropna(inplace=True) df = df[df['Rating'] != 3] df['Positively...
github_jupyter
<h1 align="center">Assignment</h1> <h3 align="center">Faisal Akhtar</h3> <h3 align="center">Roll No.: 17/1409</h3> <h3 align="center">Machine Learning - B.Sc. Hons Computer Science - Vth Semester</h4> ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_...
github_jupyter
# Project: Train a Quadcopter How to Fly Design an agent to fly a quadcopter, and then train it using a reinforcement learning algorithm of your choice! Try to apply the techniques you have learnt, but also feel free to come up with innovative ideas and test them. ## Instructions Take a look at the files in the di...
github_jupyter
# Mask R-CNN - Train on Shapes Dataset This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Resnet101, which would be ...
github_jupyter
## House Prices: Advanced Regression Techniques : Kaggle Competition ### Import Libraries ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ``` ### Import Data ``` df=pd.read_csv('train.csv') df.head() df.shape ``` ### Step1: Check for missing values ``` fig, ax = pl...
github_jupyter
# 1. データサイエンティストによるノートブックでの試行錯誤 データが蓄積され取得できるようになったら、データサイエンティストはEDA(探索的データ解析)を行い、モデルを構築し、評価します。 本ノートブックでは、データサイエンティストによるモデル構築コードを提示します。 以降のノートブックで、作成されたスクリプトのモジュール化を行なっていきます。 ## 実験内容 下記のノートブックと同様の実験を行います。 https://github.com/aws-samples/aws-ml-jp/blob/main/mlops/step-functions-data-science-sdk/model-train-evaluate-...
github_jupyter
**Deep MNIST for Experts** This is an example taken from one of the TensorFlow tutorials: https://www.tensorflow.org/versions/r1.1/get_started/mnist/pros To run this as a docker container on my HP200, I used: ``` nvidia-docker run -it -p 8888:8888 tensorflow/tensorflow:1.5.0-gpu-py3 ``` If you have a newer CPU...
github_jupyter
# Numerical norm bounds for quadrotor For a quadrotor system with state $x = \begin{bmatrix}p_x & p_z & \phi & v_x & v_z & \dot{\phi} \end{bmatrix}^T$ we have \begin{equation} \dot{x} = \begin{bmatrix} v_x \cos\phi - v_z\sin\phi \\ v_x \sin\phi + v_z\cos\phi \\ \dot{\phi} \\ v_z\dot{\phi} - g\sin{\phi} \\ -v_x\dot{...
github_jupyter
# Predicting sentiment from product reviews # Fire up GraphLab Create ``` import graphlab ``` # Read some product review data Loading reviews for a set of baby products. ``` products = graphlab.SFrame('amazon_baby.gl/') ``` # Let's explore this data together Data includes the product name, the review text and th...
github_jupyter
# Expectiminimax Der Vollständigkeits halber der ganze Expectiminimax Algorithmus. <br> Während 1-ply, 2-ply und 3-ply nur den ersten, die ersten beiden, bzw. ersten drei Schritte von Expectiminimax ausgeführt haben, kann man alle mit dem Expectiminmax Algorithmus zusammenfassen. Das erlaubt einem eine saubere Notatio...
github_jupyter
### Honor Track: experience replay There's a powerful technique that you can use to improve sample efficiency for off-policy algorithms: [spoiler] Experience replay :) The catch is that you can train Q-learning and EV-SARSA on `<s,a,r,s'>` tuples even if they aren't sampled under current agent's policy. So here's wha...
github_jupyter
``` import os, json from pathlib import Path from pandas import DataFrame from mpcontribs.client import Client from unflatten import unflatten client = Client() ``` **Load raw data** ``` name = "screening_inorganic_pv" indir = Path("/Users/patrick/gitrepos/mp/mpcontribs-data/ThinFilmPV") files = { "summary": "SUM...
github_jupyter
# Make data and load data explained Global Forest Change dataset https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.6.html is divided into 10x10 degree tiles, each of which comes with six raster files per tile: treecover, gain, data mask, loss year, first and last. All files contain unsigne...
github_jupyter
``` import torch from torch import nn from torch import optim from torchvision.datasets import MNIST from torch.utils.data import TensorDataset, Dataset, DataLoader from tqdm.notebook import tqdm import numpy as np from aijack.defense import VIB, KL_between_normals, mib_loss dim_z = 256 beta = 1e-3 batch_size = 100 sa...
github_jupyter
## 1-2. 量子ビットに対する基本演算 量子ビットについて理解が深まったところで、次に量子ビットに対する演算がどのように表されるかについて見ていこう。 これには、量子力学の性質が深く関わっている。 1. 線型性: 詳しくは第4章で学ぶのだが、量子力学では状態(量子ビット)の時間変化はつねに(状態の重ね合わせに対して)線型になっている。つまり、**量子コンピュータ上で許された操作は状態ベクトルに対する線型変換**ということになる 。1つの量子ビットの量子状態は規格化された2次元複素ベクトルとして表現されるのだったから、 1つの量子ビットに対する操作=線型演算は$2 \times 2$の**複素行列**によって表現される。...
github_jupyter
``` %matplotlib inline from __future__ import absolute_import from __future__ import print_function import matplotlib.pyplot as plt import numpy as np np.random.seed(1337) # for reproducibility from theano import function from keras.datasets import mnist from keras.models import Sequential from keras.layers.core imp...
github_jupyter
<table align="center"> <td align="center"><a target="_blank" href="http://introtodeeplearning.com"> <img src="http://introtodeeplearning.com/images/colab/mit.png" style="padding-bottom:5px;" /> Visit MIT Deep Learning</a></td> <td align="center"><a target="_blank" href="https://colab.research.google.c...
github_jupyter
<a href="https://colab.research.google.com/github/carlomigs/tensortrade/blob/master/examples/migs_TensorTrade_Tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import os import sys import warnings import numpy def warn(*args, **kwargs): ...
github_jupyter
<a href="https://www.bigdatauniversity.com"><img src = "https://ibm.box.com/shared/static/ugcqz6ohbvff804xp84y4kqnvvk3bq1g.png" width = 300, align = "center"></a> <h1 align=center><font size = 5>Lab: Connect to Db2 database on Cloud using Python</font></h1> # Introduction This notebook illustrates how to access a DB...
github_jupyter
<a href="https://colab.research.google.com/github/RajamannarAanjaram/TSAI-Assignment/blob/master/13%20ViT/Cat%20Dogs/CatDogs_TransferLearning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` ! pip install timm ! pip install -q kaggle import timm ...
github_jupyter
``` import os import numpy as np import pandas as pd import jinja2 as jj def mklbl(prefix, n): return ["%s%s" % (prefix, i) for i in range(n)] miindex = pd.MultiIndex.from_product([mklbl('A', 4), mklbl('B', 2), mklbl('C', 4), ...
github_jupyter
$\newcommand{\tensor}[1]{\boldsymbol{#1}}$ $\newcommand{\tensorthree}[1]{\mathbfcal{#1}}$ $\newcommand{\tensorfour}[1]{\mathbb{#1}}$ $\newcommand{\dar}{\, \text{d} a^r}$ $\newcommand{\dvr}{\, \text{d} v^r}$ $\newcommand{\dv}{\, \text{d} v}$ $\newcommand{\dt}{\, \text{d} t}$ $\newcommand{\dthe}{\, \text{d} \theta}$ ...
github_jupyter
``` import pandas as pd import numpy as np import pickle from joblib import dump, load import matplotlib.pyplot as plt def read_data_small(): X_train = pd.read_csv("data_small/X_train_small.csv") X_test = pd.read_csv("data_small/X_test_small.csv") y_train = np.asarray(pd.read_csv("data_small/y_train_small.c...
github_jupyter
``` import numpy import pandas import matplotlib.pyplot import matplotlib.style import copy matplotlib.style.use('ggplot') %matplotlib inline titanic_data = pandas.read_csv('Titanic.csv', index_col=None) ``` How many passengers we know? ``` passengers_num = titanic_data.shape[0] #rows in Titanic.csv table print(pas...
github_jupyter
# TAP Affect This notebook was used as part of the [HETA project](http://heta.io) to experiment with [TAP](https://github.com/heta-io/tap) affect thresholds. It makes use of the [TapCliPy](https://github.com/heta-io/tapclipy) python client for TAP to call the `affectExpressions` query. To use this notebook for your o...
github_jupyter
# Figure 3: Cluster-level consumptions This notebook generates individual panels of Figure 3 in "Combining satellite imagery and machine learning to predict poverty". ``` from fig_utils import * import matplotlib.pyplot as plt import time %matplotlib inline ``` ## Predicting consumption expeditures The parameters ...
github_jupyter
<div align="center"> <h1><strong>Herencia</strong></h1> <strong>Hecho por:</strong> Juan David Argüello Plata </div> ## __Introducción__ <div align="justify"> La relación de herencia facilita la reutilización de código brindando una base de programación para el desarrollo de nuevas clases. </div> ## __1. Sup...
github_jupyter
# Face Recognition for the Happy House Welcome to the first assignment of week 4! Here you will build a face recognition system. Many of the ideas presented here are from [FaceNet](https://arxiv.org/pdf/1503.03832.pdf). In lecture, we also talked about [DeepFace](https://research.fb.com/wp-content/uploads/2016/11/deep...
github_jupyter
# Introduction to pytorch tensors --- Pytorch tensors, work very similar to numpy arrays and you can always convert it to a numpy array or make a numpy array into a torch tensor. The primary difference is that it is located either on your CPU or your GPU and that it contains works with the auto differential software ...
github_jupyter
# 0.0 Notebook Template --*Set the notebook number, describe the background of the project, the nature of the data, and what analyses will be performed.*-- ## Jupyter Extensions Load [watermark](https://github.com/rasbt/watermark) to see the state of the machine and environment that's running the notebook. To make s...
github_jupyter
## In the product wheel, we are trying to use thr transition sheets loss as our standards to reduce the cost ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import numpy as np ``` ## Importing the first dataframe: ordercolor transition report ``` df1 = pd.read_excel('../data/OrderColorTran...
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
``` ############## PLEASE RUN THIS CELL FIRST! ################### # import everything and define a test runner function from importlib import reload from helper import run import bloomfilter, network # Example Bloom Filter from helper import hash256 bit_field_size = 10 bit_field = [0] * bit_field_size h256 = hash256(...
github_jupyter
``` # Update sklearn to prevent version mismatches !pip install sklearn --upgrade # install joblib. This will be used to save your model. # Restart your kernel after installing !pip install joblib import pandas as pd ``` # Read the CSV and Perform Basic Data Cleaning ``` df = pd.read_csv("exoplanet_data.csv") # Dro...
github_jupyter
<a href="https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/Course%201%20-%20Part%204%20-%20Lesson%202%20-%20Notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2019 The TensorFlow Authors. ``` #@title Lic...
github_jupyter
``` # import lib # =========================================================== import csv import pandas as pd from datascience import * import numpy as np import random import time import matplotlib.pyplot as plt %matplotlib inline plt.style.use('fivethirtyeight') import collections import math import sys from tqdm imp...
github_jupyter
<a href="https://colab.research.google.com/github/DataScienceUB/DeepLearningMaster2019/blob/master/6.%20Recurrent%20Neural%20Networks%20I.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Recurrent Neural Networks I Classical neural networks, inclu...
github_jupyter
# Assignment 2 | Programming Logic Reminder: in all of the assignments this semester, the answer is not the only consideration, but also how you get to it. It's OK (suggested even!) to use the internet for help. But you _should_ be able to answer all of these questions using only the programming techniques you have le...
github_jupyter
# Direction of the Gradient When you play around with the thresholding for the gradient magnitude in the previous exercise, you find what you might expect, namely, that it picks up the lane lines well, but with a lot of other stuff detected too. Gradient magnitude is at the heart of Canny edge detection, and is why Ca...
github_jupyter
<center><h1>Improved Graph Laplacian via Geometric Self-Consistency</h1></center> <center>Yu-Chia Chen, Dominique Perrault-Joncas, Marina Meilă, James McQueen. University of Washington</center> <br> <center>Original paper: <a href=https://nips.cc/Conferences/2017/Schedule?showEvent=9223>Improved Graph Laplacian via Ge...
github_jupyter