text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## 2-1. NISQアルゴリズムとlong-termアルゴリズム 現在発明・発見されている量子アルゴリズムは、実現可能性の観点から2つのグループに大別できる。 一つは**NISQアルゴリズム**、もう一つは**long-termアルゴリズム**である。(これらの単語は一般的ではないので、他の文献を見る際には注意すること。また、**この2つの区別は絶対的なものではなく、解くべき問題の大きさや技術の進歩などによって移り変るものであることに留意されたい。**)それらの代表例を表に示す。 ![2-1](figs/2/quantum_algo_table.png) (VQE = Variational Quantum Eigen...
github_jupyter
``` # --- added to file ---- # Takes in a String, "bucket_name", a string, "remote_folder", # and a list of strings or a single string, "keywords". Gets all # s3 keys for bucket_name/remote_folder. Uses a list convention # to go through keywords (i.e): ['a', 'b', 'c OR d OR e'] will # find all files containing 'a' and...
github_jupyter
# Databolt Flow For data scientists and data engineers, d6tflow is a python library which makes building complex data science workflows easy, fast and intuitive. https://github.com/d6t/d6tflow ## Benefits of using d6tflow [4 Reasons Why Your Machine Learning Code is Probably Bad](https://medium.com/@citynorman/4-rea...
github_jupyter
``` %load_ext autoreload %autoreload 2 cd /Users/martin/Git/estates/src/data/gold from rentals import load_rentals import numpy as np import pandas as pd from sklearn.impute import SimpleImputer from sklearn.compose import ColumnTransformer from sklearn.preprocessing import OneHotEncoder, Binarizer, FunctionTransforme...
github_jupyter
# 3.1 Constants and variables in programs In this notebook, you will learn how to use constants and variables in a robot control program. Once again, you will be creating programs to run in the RoboLab simulator, so load the simulator by running the following code cell: ``` from nbev3devsim.load_nbev3devwidget impor...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns sns.set() from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) print('total train dataset', mnist.train.images.shape[0]) print('total test dataset', mn...
github_jupyter
## Generating partial coherence phase screens for modeling rotating diffusers ``` %pylab %matplotlib inline import SimMLA.fftpack as simfft import SimMLA.grids as grids import SimMLA.fields as fields from numpy.fft import fft, ifft, fftshift, ifftshift from scipy.integrate import simps from scipy.interpolate import...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt # Since there is no column name so lets add that # column 0 to 59 so they will be named as Feature 0,..,Feature 59 # and lets name target column as Class # First lets make a lost of column name new_column_names = [] for i in range(60): new_...
github_jupyter
``` import argparse import csv import matplotlib.pyplot as plt import glob import os import json import seaborn as sns import pandas as pd import mpld3 from IPython import display from process_log import Tags, Log, Epochs leonhard_directory = "../logs/naive_scaling_Nov_15_073912" tags = Tags("tags.hpp") all_names = os....
github_jupyter
Note: It is recommended to run this notebook from an [Azure DSVM](https://docs.microsoft.com/en-us/azure/machine-learning/data-science-virtual-machine/overview) instance. ``` # Useful for being able to dump images into the Notebook import IPython.display as D ``` # Big Picture In the previous notebooks, we tried tog...
github_jupyter
# Intro to profiling Python's dirty little secret is that it can be made to run pretty fast. The bare-metal HPC people will be angrily tweeting at me now, or rather, they would be if they could get their wireless drivers working. Still, there are some things you *really* don't want to do in Python. Nested loops a...
github_jupyter
``` import numpy as np import pandas as pd import scipy.stats as ss closest_collection = "typeIII_submission_collection_closest.csv" hungarian_collection = "typeIII_submission_collection_hungarian.csv" ``` ## How many predicted pKas are matched differently between closest and hungarian algorithms? ``` df_closest = pd...
github_jupyter
# SLU06 - File & String handling Now we're going to test how well you understood the learning notebook. Also, this notebook is going to often require some googling skills. It's very important to learn to google anything you don't remember or don't know how to do. A small hint: list comprehensions might make it easie...
github_jupyter
# Scheduling a Doubles Pickleball Tournament My friend Steve asked for help in creating a schedule for a round-robin doubles pickleball tournament with 8 or 9 players on 2 courts. ([Pickleball](https://en.wikipedia.org/wiki/Pickleball) is a paddle/ball/net game played on a court that is smaller than tennis but larger ...
github_jupyter
# Introduction # In the previous lesson we looked at our first model-based method for feature engineering: clustering. In this lesson we look at our next: principal component analysis (PCA). Just like clustering is a partitioning of the dataset based on proximity, you could think of PCA as a partitioning of the variat...
github_jupyter
# Modelagem magnética 3D de uma esfera ## Importando as bibliotecas ``` import numpy as np import matplotlib.pyplot as plt import sphere_mag ``` ## Gerando os parâmetros do sistema de coordenadas ``` Nx = 100 Ny = 50 area = [-1000.,1000.,-1000.,1000.] shape = (Nx,Ny) x = np.linspace(area[0],area[1],num=Nx) y = np.l...
github_jupyter
``` import numpy as np import pylab as plt import swyft swyft.set_verbosity(0) import torch from scipy import stats %load_ext autoreload %autoreload 2 DEVICE = 'cuda' ``` ## Torus model ``` def model(params, center = np.array([0.6, 0.8])): a, b, c = params['a'], params['b'], params['c'] r = ((a-center[0])**2+...
github_jupyter
<font style="font-size:96px; font-weight:bolder; color:#0040a0"><img src="http://montage.ipac.caltech.edu/docs/M51_logo.png" alt="M" style="float: left; padding: 25px 30px 25px 0px;" /></font> <i><b>Montage</b> Montage is an astronomical image toolkit with components for reprojection, background matching, coaddition a...
github_jupyter
<a href="https://colab.research.google.com/github/JSJeong-me/KOSA-Big-Data_Vision/blob/main/Roboflow_CLIP_Zero_Shot_Cake.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # How to use CLIP Zero-Shot on your own classificaiton dataset This notebook pr...
github_jupyter
- import lib ``` # What version of Python do you have? import sys from collections import Counter import tensorflow.keras import pandas as pd import sklearn as sk from imblearn.over_sampling import SMOTE from imblearn.over_sampling import SMOTENC import tensorflow as tf import seaborn as sns import math import matpl...
github_jupyter
# Measuring Quantum Volume ## Introduction **Quantum Volume (QV)** is a single-number metric that can be measured using a concrete protocol on near-term quantum computers of modest size. The QV method quantifies the largest random circuit of equal width and depth that the computer successfully implements. Quantum com...
github_jupyter
# Retail Demo Store Experimentation Workshop - A/B Testing Exercise In this exercise we will define, launch, and evaluate the results of an A/B experiment using the experimentation framework implemented in the Retail Demo Store project. If you have not already stepped through the **[3.1-Overview](./3.1-Overview.ipynb)...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i> <i>Licensed under the MIT License.</i> # Vowpal Wabbit Deep Dive <center> <img src="https://github.com/VowpalWabbit/vowpal_wabbit/blob/master/logo_assets/vowpal-wabbits-github-logo.png?raw=true" height="30%" width="30%" alt="Vowpal Wabbit"> </center>...
github_jupyter
``` """ Implementation of the CPC baseline based on the code available on https://openreview.net/forum?id=8qDwejCuCN """ import os import random import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.nn as nn os.chdir("../") #Load from parent directory from dat...
github_jupyter
# SPARTA QuickStart ----------------------------------- ## 1. Extracting Radial Velocities ### 1.1 Reading and handling spectra #### `Observations` (class) `Observations` class enables one to load data from a given folder and place it into a TimeSeries object. ``` from sparta import Observations ``` The `ob.Obser...
github_jupyter
# Machine Learning Exercise 7 - K-Means Clustering & PCA This notebook covers a Python-based solution for the seventh programming exercise of the machine learning class on Coursera. Please refer to the [exercise text](https://github.com/jdwittenauer/ipython-notebooks/blob/master/exercises/ML/ex7.pdf) for detailed des...
github_jupyter
# Lab 2: Welcome to Python + Data Structures ## Overview Welcome to your first lab! Labs in CS41 are designed to be your opportunity to experiment with Python and gain hands-on experience with the language. The primary goal of the first half is to ensure that your Python installation process went smoothly, and that ...
github_jupyter
``` import os import sys import pandas as pd from sklearn.model_selection import train_test_split import numpy as np from tensorflow.keras import backend as K from tensorflow.keras.layers import Conv1D, BatchNormalization, GlobalAveragePooling1D, Permute, Dropout, Flatten from tensorflow.keras.layers import Input, Dens...
github_jupyter
# PDP Team 11 Design/Course Prep Planning Meeting ## August 9, 2018 Meeting goal: discuss PDP team 11's current status and plan August activities. [Design notebook](https://docs.google.com/document/d/1iexo2xeYYIVDWD_pfgW4sOA5sRZSStsGNth-_bU_lrU/edit#) [Teaching plan](https://docs.google.com/document/d/1xb4omX9AnZTl...
github_jupyter
``` # testing installation import pandas as pd import matplotlib.pyplot as plt conf = pd.read_csv('sensingbee.conf', index_col='param') import sys, os sys.path.append(conf.loc['GEOHUNTER_PATH','val']) sys.path.append(conf.loc['SOURCE_PATH','val']) import geohunter import sensingbee conf ``` # Data preparation ``...
github_jupyter
# Dingocar Demo This Notebook will take allow you to train a Dingocar (_Donkeycar, down-under_). The model will be trained using data uploaded to your Google Drive. The trained model will be saved in your nominated Google Drive Folder . ## Requirements A zip file of training data. I recomend a zip file because you'...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #default_exp vision.data #export from fastai.torch_basics import * from fastai.data.all import * from fastai.vision.core import * #hide from nbdev.showdoc import * # from fastai.vision.augment import * ``` # Vision data > Helper f...
github_jupyter
``` import cv2 import numpy as np import matplotlib.pyplot as plt import scipy.ndimage def overlay(overlay_img, bg_img, scale, starting_y, starting_x, rotate=False, choice=''): # Rotating image 45 degrees if it has to be rotated if rotate: img = overlay_img overlay_img = scipy.ndimage.rotate(ove...
github_jupyter
### Plotting the ADCP spectra ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` Little tweaks in the matplotlib configuration to make nicer plots ``` plt.rcParams.update({'font.size': 25, 'legend.handlelength' : 2.0 , 'legend.markerscale': 1., 'legend.fontsize' : 20, 'axes.titlesize...
github_jupyter
<img src="interactive_image.png"/> # Interactive image The following interactive widget is intended to allow the developer to explore images drawn with different parameter settings. ``` # preliminaries from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets from jp_doodle im...
github_jupyter
Before running this notebook, it's helpful to `conda install -c conda-forge nb_conda_kernels` `conda install -c conda-forge ipywidgets` and set the kernel to the conda environment in which you installed glmtools (typically, `glmval`) ``` import os %matplotlib inline import numpy as np import matplotlib.pyplot as p...
github_jupyter
``` from PIL import Image import glob from keras.applications.inception_v3 import InceptionV3 from keras.applications.inception_v3 import preprocess_input, decode_predictions from keras.preprocessing import image import numpy as np import json ``` ## Define data path #### You can add multiple file extensions by extend...
github_jupyter
# Exorad 2.0 This Notebook will show you how to use exorad library to build your own pipeline. Before we start, let's silent the exorad logger. ``` import warnings warnings.filterwarnings("ignore") from exorad.log import disableLogging disableLogging() ``` ## Preparing the instrument ### Load the instrument des...
github_jupyter
``` from netCDF4 import Dataset path = '/home/joao/Downloads/' ds = Dataset(path+'OR_ABI-L2-CMIPF-M6C13_G16_s20192781230281_e20192781240001_c20192781240078.nc') import GOES import numpy as np SatHeight = ds.variables['goes_imager_projection'].perspective_point_height SatLon = ds.variables['goes_imager_projection'].lo...
github_jupyter
# Eurostat bioenergy balance 2018 Extract bioenergy related data from an archive containing XLSB files, one for each EU country which contain multiple sheets for each year (1990-2018). Walk through excel files (country spreadsheets) and parse selected variables and fuels for each year (sheet in country's spreadsheet)...
github_jupyter
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb) # Discrete Bayes Filter ``` #format the book %matplotlib inline from __future__ import division, print_function from book_format import load_style load_style() ``` The Kalman filte...
github_jupyter
``` import matplotlib.pyplot as plt import iris import iris.plot as iplt import numpy import iris.coord_categorisation import re %matplotlib inline infile = '/g/data/ua6/DRSv2/CMIP5/CSIRO-Mk3-6-0/rcp85/mon/ocean/r1i1p1/tauuo/latest/tauuo_Omon_CSIRO-Mk3-6-0_rcp85_r1i1p1_200601-210012.nc' cube = iris.load_cube(infile, 's...
github_jupyter
``` import os %env DEVICE = CPU %env MODEL=/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/intel/person-detection-retail-0013/FP32/person-detection-retail-0013.xml """Restricted Zone Notifier.""" """ Copyright (c) 2018 Intel Corporation. Permission is hereby granted, free of charge, to any pers...
github_jupyter
# Wasserstein GAN <img src="https://miro.medium.com/max/3200/1*M_YipQF_oC6owsU1VVrfhg.jpeg" width="800" height="400"> ##### Importing libraries ``` import numpy as np import matplotlib.pyplot as plt from glob import glob from PIL import Image from time import time import pandas as pd import argparse import math imp...
github_jupyter
👇 (Press on the three dots to expand the code) ``` # Code preamble: we'll need some packages to display the information in the notebook. # Feel free to ignore this cell unless you're running the code. import folium # Map visualizations import requests # Basic http requests import json # For handling...
github_jupyter
## 1. Which college majors will pay the bills? <p><img src="https://s3.amazonaws.com/assets.datacamp.com/production/project_584/img/salary.png" width="400" align="center"></p> <p>Wondering if that Philosophy major will really help you pay the bills? Think you're set with an Engineering degree? Choosing a college major ...
github_jupyter
### LSTM Model v2 ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd from utils import split_sequence, get_apple_close_price, plot_series from utils import plot_residual_forecast_error, print_performance_metrics from utils import get_range, difference, inverse_difference from utils import train...
github_jupyter
# Summary: This notebook contains the soft smoothing figures for Swarthmore (Figure 2(a)). ## Load libraries ``` # import packages from __future__ import division import networkx as nx import os import numpy as np from sklearn import metrics from sklearn.preprocessing import label_binarize from sklearn.metrics imp...
github_jupyter
## Required extra package: For hypergraphs: * pip install hypernetx ``` import pandas as pd import numpy as np import igraph as ig import partition_igraph import hypernetx as hnx import pickle import matplotlib.pyplot as plt %matplotlib inline from collections import Counter from functools import reduce import iterto...
github_jupyter
``` import numpy as np import pandas as pd from IPython.display import clear_output from matplotlib import pyplot as plt from matplotlib import style style.use('fivethirtyeight') dftrain = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/train.csv') dfeval = pd.read_csv('https://storage.googleapis.com/tf...
github_jupyter
``` #default_exp basics #export from fastcore.imports import * import builtins from fastcore.test import * from nbdev.showdoc import * from fastcore.nb_imports import * ``` # Basic functionality > Basic functionality used in the fastai library ## Basics ``` # export defaults = SimpleNamespace() # export def ifnone(...
github_jupyter
## Introduction to Exploratory Data Analysis and Visualization In this lab, we will cover some basic EDAV tools and provide an example using _presidential speeches_. ## Table of Contents [ -Step 0: Import modules](#step0) [-Step 1: Read in the speeches](#step1) [-Step 2: Text processing](#step2) -Ste...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np colors=['darkorange', 'crimson', 'darkseagreen', 'navy', 'wheat', 'gray', 'palevioletred', 'gold', 'lightcoral', 'forestgreen', 'cornflowerblue'] participants = ['p{:02}'.format(index) for index in range(15)] # 0 1 2* 3* 4** 5 6 ...
github_jupyter
# Step input, output, and substeps * **Difficulty level**: easy * **Time need to lean**: 10 minutes or less * **Key points**: * Input files are specified with the `input` statement, which defines variable `_input` * Output files are specified with the `output` statement, which defines variable `_output` * Input ...
github_jupyter
**This notebook is an exercise in the [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/cross-validation).** --- In this exercise, you will leverage what you've learned to tune a machine...
github_jupyter
# Intro to Python! Stuart Geiger and Yu Feng for The Hacker Within # Contents ## 1. Installing Python ## 2. The Language - Expressions - List, Tuple and Dictionary - Strings - Functions ## 3. Example: Word Frequency Analysis with Python - Reading text files - Geting and using python packages : wordcloud -...
github_jupyter
# Verifying Kinetics Models: Part 2 - Writing Tests Writing verification tests for kinetics models requires having insights as to the dynamic behavior expected of model variables. This discussion focuses on the concentration of molecules (floating species in ``tellurium``). ``` import numpy as np import tellurium as ...
github_jupyter
# SIF4Sci 使用示例 ## 概述 SIFSci 是一个提供试题切分和标注的模块。它可定制化的将文本切分为令牌(token)序列,为后续试题的向量化做准备。 本文将以下面这道题目(来源自 LUNA 题库)为例,展示 SIFSci 的使用方法。 ![Figure](../../asset/_static/item.png) - 符合 [SIF 格式](https://edunlp.readthedocs.io/en/docs_dev/tutorial/zh/sif.html) 的题目录入格式为: ``` item = { "stem": r"如图来自古希腊数学家希波克拉底所研究的几何图形.此图由三个半圆构...
github_jupyter
# Altair Data Server This notebook shows an example of using the [Altair data server](https://github.com/altair-viz/altair_data_server), a lightweight plugin for [Altair](http://altair-viz.github.io) that lets you efficiently and transparently work with larger datasets. Altair data server can be installed with pip: ...
github_jupyter
# Vanilla Recurrent Neural Network <br> Character level implementation of vanilla recurrent neural network ## Import dependencies ``` import numpy as np import matplotlib.pyplot as plt ``` ## Parameters Initialization ``` def initialize_parameters(hidden_size, vocab_size): ''' Returns: parameters -- a t...
github_jupyter
``` import numpy as np from keras import layers from keras.layers import Input, Add, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D, AveragePooling2D, MaxPooling2D, GlobalMaxPooling2D from keras.models import Model, load_model from keras.preprocessing import image from keras.utils import layer_ut...
github_jupyter
``` import cv2 import numpy as np import matplotlib.pyplot as plt # Resize window to display all image def ResizeWithAspectRatio(image, width=None, height=None, inter=cv2.INTER_AREA): dim = None (h, w) = image.shape[:2] if width is None and height is None: return image if width is None: ...
github_jupyter
# Sonar - Decentralized Model Training Simulation (local) DISCLAIMER: This is a proof-of-concept implementation. It does not represent a remotely product ready implementation or follow proper conventions for security, convenience, or scalability. It is part of a broader proof-of-concept demonstrating the vision of the...
github_jupyter
``` !pip install neural-tangents ``` ## Imports ``` import time import itertools import numpy.random as npr import jax.numpy as np from jax.config import config from jax import jit, grad, random from jax.nn import log_softmax from jax.experimental import optimizers import jax.experimental.stax as jax_stax import ...
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
``` import pandas as pd import numpy as np import scanpy as sc import os from sklearn.cluster import KMeans from sklearn.cluster import AgglomerativeClustering from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import adjusted_mutual_info_score from sklearn.metrics.cluster import homog...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt eth = pd.read_csv("ETH.csv").set_index("Date") rai = pd.read_csv("RAI.csv").set_index('Date') rai.index = pd.to_datetime(rai.index) rai.index = pd.to_datetime(rai.index.date) eth.index = pd.to_datetime(eth.index) prices = pd.concat([eth, rai], a...
github_jupyter
# Dropout Dropout [1] is a technique for regularizing neural networks by randomly setting some features to zero during the forward pass. In this exercise you will implement a dropout layer and modify your fully-connected network to optionally use dropout. [1] [Geoffrey E. Hinton et al, "Improving neural networks by pr...
github_jupyter
## Visualizing-Food-Insecurity-with-Pixie-Dust-and-Watson-Analytics _IBM Journey showing how to visualize US Food Insecurity with Pixie Dust and Watson Analytics._ Often in data science we do a great deal of work to glean insights that have an impact on society or a subset of it and yet, often, we end up not communica...
github_jupyter
# Iterators # 迭代器 > Often an important piece of data analysis is repeating a similar calculation, over and over, in an automated fashion. For example, you may have a table of a names that you'd like to split into first and last, or perhaps of dates that you'd like to convert to some standard format. One of Python's a...
github_jupyter
# 0. Import ``` import torch ``` # 1. Data เราจะสร้างข้อมูลขึ้นมาเป็น Tensor ขนาด 10 Row, 3 Column [เรื่อง Tensor จะอธิบายต่อไป](https://www.bualabs.com/archives/1629/what-is-tensor-element-wise-broadcasting-operations-high-order-tensor-numpy-array-matrix-vector-tensor-ep-1/) ``` z = torch.tensor([ ...
github_jupyter
# PerfForesightConsumerType: Perfect foresight consumption-saving ``` # Initial imports and notebook setup, click arrow to show from copy import copy import matplotlib.pyplot as plt import numpy as np from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType from HARK.utilities import plot_func...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
``` !nvidia-smi !pip --quiet install transformers !pip --quiet install tokenizers from google.colab import drive drive.mount('/content/drive') !cp -r '/content/drive/My Drive/Colab Notebooks/Tweet Sentiment Extraction/Scripts/.' . COLAB_BASE_PATH = '/content/drive/My Drive/Colab Notebooks/Tweet Sentiment Extraction/' M...
github_jupyter
<h1>2b. Machine Learning using tf.estimator </h1> In this notebook, we will create a machine learning model using tf.estimator and evaluate its performance. The dataset is rather small (7700 samples), so we can do it all in-memory. We will also simply pass the raw data in as-is. ``` import tensorflow as tf import p...
github_jupyter
#### Copyright 2017 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 writin...
github_jupyter
# Likelihood based models This notebook will outline the likelihood based approach to training on Bandit feedback. Although before proceeding we will study the output of the simmulator in a little more detail. ``` from numpy.random.mtrand import RandomState from recogym import Configuration from recogym.agents impor...
github_jupyter
# Requirements ``` import numpy as np import pandas as pd ``` # Dataframe We create a very simple dataframe with three columns `alpha`, `beta` and `gamma` as well as and index that is non-trivial. ``` indices = 'ABCDEFGHIJK' df = pd.DataFrame({ 'alpha': [i for i in range(1, 1 + len(indices))], 'beta': [i**...
github_jupyter
``` % matplotlib inline import os import numpy as np import matplotlib.pyplot as plt from keras.utils.np_utils import to_categorical from snntoolbox.datasets.aedat.DVSIterator import DVSIterator, load_event_list, get_frames_from_sequence, extract_batch, next_eventframe_batch data_path = '/home/rbodo/.snntoolbox/Datas...
github_jupyter
``` if len(groups_desc) > 0: markdown_str = ["## Differential feature functioning"] markdown_str.append("This section shows differential feature functioning (DFF) plots " "for all features and subgroups. The features are shown after applying " "transformations (if...
github_jupyter
# Bayesian Probabilistic Matrix Factorization **Published**: November 6, 2020 **Author**: Xinyu Chen [[**GitHub homepage**](https://github.com/xinychen)] **Download**: This Jupyter notebook is at our GitHub repository. If you want to evaluate the code, please download the notebook from the [**transdim**](https://git...
github_jupyter
``` import numpy as np from ctapipe.io import EventSource from ctapipe.io import EventSeeker import matplotlib.pyplot as plt import numpy as np from ctapipe.instrument import CameraGeometry from ctapipe.visualization import CameraDisplay %matplotlib inline plt.rcParams['figure.figsize'] = (16, 9) plt.rcParams['font.si...
github_jupyter
``` import pandas as pd import numpy as np import os from sklearn.model_selection import train_test_split from matplotlib import pyplot as plt from tensorflow.keras.layers import Conv2D, MaxPooling2D, Activation, Dropout, Flatten, Dense from tensorflow.keras.optimizers import Adam from tensorflow.keras.preprocessing.im...
github_jupyter
<img src="../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left"> # _*Quantum Tic-Tac-Toe*_ The latest version of this notebook is available on https://github.com/qiskit/qiskit-tutorial. *** ### Cont...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import warnings warnings.filterwarnings('ignore') df = pd.read_csv("data/Mall_Customers.csv") df.head() print("Size of the data : ", df.shape) from sklearn.cluster import KMeans ``` ### Segmentation usin...
github_jupyter
## Data Source and Description: Creator/Donor: Jeffrey C. Schlimmer (Jeffrey.Schlimmer '@' a.gp.cs.cmu.edu) Sources: 1. 1985 Model Import Car and Truck Specifications, 1985 Ward's Automotive Yearbook. 2. Personal Auto Manuals, Insurance Services Office, 160 Water Street, New York, NY 10038 3. Insurance Collisi...
github_jupyter
``` !unzip spam.zip -d / #importing libraries import numpy as np import random import pandas as pd import sys import os import time import codecs import collections import numpy from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import LSTM from keras.c...
github_jupyter
# 数据集加载总览 `Ascend` `GPU` `CPU` `数据准备` [![在线运行](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_modelarts.png)](https://authoring-modelarts-cnnorth4.huaweicloud.com/console/lab?share-url-b64=aHR0cHM6Ly9taW5kc3BvcmUtd2Vic2l0ZS5vYnMuY24tbm9ydGgtNC5teWh1YXdlaWNsb3VkLmNvbS9ub3RlYm9vay9tb2RlbGFydHMvcHJvZ3...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt datafile = 'data/ex1data1.txt' cols = np.loadtxt(datafile,delimiter=',',usecols=(0,1),unpack=True) #Read in comma separated data #Form the usual "X" matrix and "y" vector X = np.transpose(np.array(cols[:-1])) y = np.transpose(np.array(cols[-1:])) m = y.size # numbe...
github_jupyter
# Welcome to Jupyter! With Jupyter notebooks you can write and execute code, annotate it with Markdownd and use powerful visualization tools all in one document. ## Running code Code cells can be executed in sequence by pressing Shift-ENTER. Try it now. ``` import math from matplotlib import pyplot as plt a=1 b=2 a...
github_jupyter
# Using Deep Learning for Medical Imaging In the United States, it takes an average of [1 to 5 days](https://www.ncbi.nlm.nih.gov/pubmed/29132998) to receive a diagnosis after a chest x-ray. This long wait has been shown to increase anxiety in 45% of patients. In addition, impoverished countries usually lack personnel ...
github_jupyter
# Surname Generation ## Imports ``` import os from argparse import Namespace from collections import Counter import json import re import string import numpy as np import pandas as pd import torch import torch.nn as nn from torch.nn import functional as F import torch.optim as optim from torch.utils.data import Data...
github_jupyter
## Collaborative filtering ``` from fastai.gen_doc.nbdoc import * ``` This package contains all the necessary functions to quickly train a model for a collaborative filtering task. Let's start by importing all we'll need. ``` from fastai.collab import * ``` ## Overview Collaborative filtering is when you're tasked...
github_jupyter
# Aerospike Python Client Tutorial ### Refer to https://www.aerospike.com/docs/client/python/index.html for information on installing the Aerospike Python client. #### Tested with Python 3.7 ``` # IP Address or DNS name for one host in your Aerospike cluster AS_HOST ="127.0.0.1" # Please reach out to us if you do no...
github_jupyter
``` import numpy as np import tensorflow as tf from sklearn.utils import shuffle import re import time import collections import os def build_dataset(words, n_words, atleast=1): count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]] counter = collections.Counter(words).most_common(n_words) counter = [i for...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo...
github_jupyter
``` %matplotlib inline import math import scipy from scipy.stats import * import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.lines as mlines colorDic = {"blue" : "#6599FF", "yellow" : "#FFAD33", "purple": "#683b96", "green" : "#198D6D", "red" : "#FF523F"} colors = list(colorDic....
github_jupyter
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.sandbox.google.com/github/kornia/tutorials/blob/master/source/data_augmenation_segmentation.ipynb) # **Data Augmentation Semantic Segmentation** In this tutorial we will show how we can quickly perform **data augmentation for s...
github_jupyter
# Pandas Pandas ist ein Python-Modul, welches auf Tabellen sowie Tabellenkalkulationsprogrammen (wie es auch MS Excel tut) beruht. Eine besondere Fähigkeit von Pandas ist, dass es direkt CSV-, DSV- und Excel-Dateien einlesen und schreiben kann. Mehr zu Pandas auf der offiziellen Website: http://pandas.pydata.org/ ##...
github_jupyter
``` !pip install pyforest from pyforest import * import warnings !pip install quandl import quandl from pandas import DataFrame !pip install tscv from tscv import GapKFold !pip install backtrader import backtrader as bt from backtrader.feeds import PandasData from sklearn.linear_model import LogisticRegression from skl...
github_jupyter