repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
saudijack/unfpyboot
Day_01/00_Lists/01_ListDictionaryTuples-Solutions.ipynb
mit
oldList = [[1,2,3],[4,5,6]] """ Explanation: List - Dictionary - Tuples: Solutions <font color='red'>List</font> Problem 1 Consider the list: End of explanation """ a = oldList[0] print a a.remove(3) b = oldList[1] print b b.remove(5) newList = [] newList.append(a) print newList newList = newList.append(b) print new...
tpin3694/tpin3694.github.io
python/pandas_missing_data.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Title: Missing Data In Pandas Dataframes Slug: pandas_missing_data Summary: Missing Data In Pandas Dataframes Date: 2016-05-01 12:00 Category: Python Tags: Data Wrangling Authors: Chris Albon import modules End of explanation """ raw_data = {'first_name': ['J...
jacobdein/alpine-soundscapes
figures/Figure 3 - noise removal.ipynb
mit
from matplotlib import pyplot %matplotlib inline from matplotlib.patches import Rectangle from matplotlib.lines import Line2D import numpy from scipy.io import wavfile from os import path from datetime import timedelta from django.db import connection from database.models import Sound from database.models import Sit...
ggf84/python-tutorial
Intro_to_Matplotlib.ipynb
mit
# Importing the libraries import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = (10, 8) # Set the figure size for plots # Creating the x-axis array (from 0 to 2pi, step of 0.1) x = np.arange(0, 2*np.pi, 0.1) # Creating the y-axis array y = np.sin(x) # Making the Plot plt.plot(x, y) plt...
folivetti/PIPYTHON
Aula04.ipynb
mit
def DivResto(num, base): """ Retorna o quociente e resto da divisão de num por base """ return num//base, num%base dec = 14 bin = "" # string vazia div, resto = DivResto(dec,2) dec = div bin = str(resto) + bin print(bin) # repete mais uma vez, pois temos outro dígito div, resto = DivResto(dec,2) dec...
liumengjun/cn-deep-learning
tutorials/intro-to-tflearn/TFLearn_Sentiment_Analysis.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w...
nick-youngblut/SIPSim
ipynb/bac_genome/fullCyc/.ipynb_checkpoints/Day1_rep10_noPCR-checkpoint.ipynb
mit
import os import glob import re import nestly %load_ext rpy2.ipython %load_ext pushnote %%R library(ggplot2) library(dplyr) library(tidyr) library(gridExtra) library(phyloseq) ## BD for G+C of 0 or 100 BD.GCp0 = 0 * 0.098 + 1.66 BD.GCp100 = 1 * 0.098 + 1.66 """ Explanation: Goal Extension of Day1_rep10 simulations...
mjuenema/ipython-notebooks
iscpy.ipynb
bsd-2-clause
import iscpy with open('named.conf') as fp: s = fp.read() config = iscpy.ParseISCString(s) type(config) """ Explanation: ISCpy ISCpy a robust ISC config file parser. It has virtually unlimited possibilities for depth and quantity of ISC config files. ISC config files include BIND and DHCP config files among a f...
AllenDowney/ModSimPy
examples/throwingaxe.ipynb
mit
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
GoogleCloudPlatform/practical-ml-vision-book
07_training/07a_ingest.ipynb
apache-2.0
import tensorflow as tf print('TensorFlow version' + tf.version.VERSION) print('Built with GPU support? ' + ('Yes!' if tf.test.is_built_with_cuda() else 'Noooo!')) print('There are {} GPUs'.format(len(tf.config.experimental.list_physical_devices("GPU")))) device_name = tf.test.gpu_device_name() if device_name != '/devi...
Startupsci/data-science-notebooks
python-data-files.ipynb
mit
# For reading/writing CSV files import csv # For listing system file folders from subprocess import check_output # Use with open to ensure file is closed when block ends # The wb flag opens file for writing with open('data/fileops/vehicles.csv', 'wb') as csv_file: # Prepare csv writer wtr = csv.writer(csv_file...
lsanomaly/lsanomaly
lsanomaly/notebooks/static_dynamic.ipynb
mit
import os import numpy as np from pathlib import Path cwd = os.getcwd() os.chdir(Path(cwd).parents[1]) from lsanomaly import LSAnomaly import lsanomaly.notebooks.dynamic as demo """ Explanation: Detection of Cardiac Arrhythmia from ECG Sequence In the posted 1.2 version several demonstrations were included in the di...
jasonding1354/pyDataScienceToolkits_Base
Scikit-learn/.ipynb_checkpoints/(2)choose_a_ml_model-checkpoint.ipynb
mit
from sklearn.datasets import load_iris iris = load_iris() # create X(features) and y(response) X = iris.data y = iris.target """ Explanation: 内容概要 这一节我们介绍以下几个内容: - 我们该怎样选择模型用于监督学习任务? - 我们该如何选择调整得到最好的模型参数? - 我们该如何对测试数据进行预测估计? 1. 使用整个数据集进行训练和测试 这里我们使用手中的整个数据集来训练模型 使用同样的数据集来测试模型,然后评估预测的结果和真实结果的差别 End of explanation """...
chapinb/pythonforensics
jupyter-notebooks/Registry Parsing.ipynb
gpl-2.0
from Registry import Registry from Registry.RegistryParse import ParseException path_to_reg_hive = '../data/system' # The included SYSTEM hive file hive = Registry.Registry(path_to_reg_hive) print(type(hive)) print("Hive Name: ", hive.hive_name()) print("Hive Type: ", hive.hive_type()) # We can also open the hive d...
ZiqianXY/MLEN
src/p0_titanic_survival_exploration/Titanic_Survival_Exploration.ipynb
mit
import numpy as np import pandas as pd # RMS Titanic data visualization code from titanic_visualizations import survival_stats from IPython.display import display %matplotlib inline # Load the dataset in_file = 'titanic_data.csv' full_data = pd.read_csv(in_file) # Print the first few entries of the RMS Titanic data...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session03/Day4/ANTARES/miniAntares_parallel.ipynb
mit
# first we need to construct a client that will interface with our cluster from ipyparallel import Client, require worker = Client() # once we create a client, we can decide how to allocate tasks across the cluster # we've got however many 'engines' you started in the cluster # lets just use all of them lview = worke...
ajul/zerosum
python/examples/wh40k.ipynb
bsd-3-clause
import _initpath import numpy import dataset.csv import dataset.wh40k import zerosum.balance from pandas import DataFrame balance_7 = zerosum.balance.MultiplicativeBalance(dataset.wh40k.wh40k_7_to_wound).optimize() balance_8 = zerosum.balance.MultiplicativeBalance(dataset.wh40k.wh40k_8_to_wound).optimize() labels = ...
dsnair/GCP
datalab/nyc_taxi.ipynb
gpl-3.0
%sql -d standard SELECT * FROM `nyc-tlc.yellow.trips` LIMIT 5 """ Explanation: Datalab Tutorial In this tutorial, we'll do some exploratory data analysis in BigQuery using Datalab. Requirements If you haven't already, you may sign-up for the free GCP trial credit. Before you begin, give this project any name y...
myfunprograms/deep_learning
project1/files/dlnd-your-first-neural-network-instruction.ipynb
gpl-3.0
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
Alex-Ian-Hamilton/solarbextrapolation
docs/auto_examples/plot_gaussian_example_data.ipynb
mit
# Module imports from solarbextrapolation.example_data_generator import generate_example_data, dummyDataToMap """ Explanation: Generating Example Gaussian Boundary Data In this example you will be generating some example data and extrapolate this using the basic potential extrapolator. You can start by importing the n...
opengeostat/pygslib
pygslib/Ipython_templates/.ipynb_checkpoints/draw_raw-checkpoint.ipynb
mit
#general imports import matplotlib.pyplot as plt import pygslib import numpy as np import pandas as pd #make the plots inline %matplotlib inline """ Explanation: PyGSLIB Draw The GSLIb equivalent parameter file is ``` Parameters for DRAW *** START OF PARAMETERS: data/cluster...
delsner/dl-exploration
notebooks/00 - Logistic Regression tensorflow - MNIST.ipynb
mit
# import necessary packages import tensorflow as tf import numpy as np """ Explanation: Import packages End of explanation """ # test tensorflow a = tf.constant(2) b = tf.constant(2) mult = tf.multiply(a,b) sess = tf.Session() sess.run(mult) # initialize weights for feed-forward nn, 300x200 matrice with normal dist...
ddcampayo/ddcampayo.github.io
cursos_previos/Curso_CFD_OS_2019/notebooks/conveccion_1d.ipynb
gpl-3.0
%matplotlib inline import scipy as np from matplotlib import pyplot as plt """ Explanation: Convección en una dimensión End of explanation """ L = 1.0 # longitud del sistema 1D nx = 42 # nodos espaciales dx = L / (nx-2) # sí, quitamos dos nodos ... x = np.linspace( 0 , L , num=nx ) T= 0.1 ...
alephcero/adsProject
olds/testeoModelos.ipynb
gpl-3.0
#get data getEPHdbf('t310') data1 = pd.read_csv('data/cleanDatat310.csv') data2 = categorize.categorize(data1) data3 = schoolYears.schoolYears(data2) data = make_dummy.make_dummy(data3) dataModel = functionsForModels.prepareDataForModel(data) dataModel.head() """ Explanation: NOTAS CALCULAR EN BASE AL MODELO DE C...
DB2-Samples/db2jupyter
Db2 Statistical Functions.ipynb
apache-2.0
%run db2.ipynb """ Explanation: <a id='top'></a> Db2 Statistical Functions Db2 already has a variety of Statistical functions built in. In Db2 11.1, a number of new functions have been added including: COVARIANCE_SAMP - The COVARIANCE_SAMP function returns the sample covariance of a set of number pairs STDDEV_SAMP - ...
besser82/shogun
doc/ipython-notebooks/computer_vision/Scene_classification.ipynb
bsd-3-clause
#import Opencv library import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') try: import cv2 except ImportError: print "You must have OpenCV installed" exit(1) #check the OpenCV version try: v=cv2.__version__ assert (tuple(map(int,v.split(".")))>(2,4,2)) except (AssertionError, Va...
pmgbergen/porepy
tutorials/incompressible_flow_model.ipynb
gpl-3.0
import porepy as pp import numpy as np import inspect """ Explanation: Model classes Setting up a simulation in PorePy requires a certain knowledge of the code - both what objects need to be defined and how to define them. To simplify this task, PorePy exploits encapsulation through Model classes for some common probl...
JAmarel/Phys202
Interact/.ipynb_checkpoints/MatplotlibEx03-checkpoint.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 3 Imports End of explanation """ def well2d(x, y, nx, ny, L=1.0): """Compute the 2d quantum well wave function.""" return (2/L)*np.sin(nx * np.pi * x/L)*np.sin(ny * np.pi * y/L) psi = well2d(np.linspac...
anthonyng2/FX-Trading-with-Python-and-Oanda
Oanda v1 REST-oandapy/09.00 Bonus Materials I.ipynb
mit
import pandas as pd %matplotlib inline import seaborn as sns import oandapy import configparser config = configparser.ConfigParser() config.read('../config/config_v1.ini') account_id = config['oanda']['account_id'] api_key = config['oanda']['api_key'] oanda = oandapy.API(environment="practice", a...
tpin3694/tpin3694.github.io
python/matplotlib_scatterplot_from_pandas.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np """ Explanation: Title: Making A Matplotlib Scatterplot From A Pandas Dataframe Slug: matplotlib_scatterplot_from_pandas Summary: Making A Matplotlib Scatterplot From A Pandas Dataframe Date: 2016-05-01 12:00 Category: Python Tag...
cjcardinale/climlab
docs/source/courseware/Latitude-dependent_grey_radiation.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import climlab from climlab import constants as const model = climlab.GreyRadiationModel(name='Grey Radiation', num_lev=30, num_lat=90) print(model) model.to_xarray() insolation = climlab.radiation.DailyInsolation(domains=model.Ts.domain) model.a...
resendislab/corda
docs/index.ipynb
mit
from corda import reaction_confidence gene_conf = {"gene1": 1, "gene2": 3, "gene4": -1} # missing entries are automatically assigned zeroes rule = "gene1 and gene2 or (gene3 and gene4)" reaction_confidence(rule, gene_conf) """ Explanation: CORDA tutorial Reactions, Genes and confidences In order to start a reconstru...
pmgbergen/porepy
tutorials/grid_structure.ipynb
gpl-3.0
import numpy as np import porepy as pp nx = np.array([3, 2]) g = pp.CartGrid(nx) """ Explanation: The porepy grid structure In this tutorial we investigate the PorePy grid structure, and explain how to access information stored in the grid. Basic grid construction The simplest grids are Cartesian. PorePy can create ...
gdsfactory/gdsfactory
docs/notebooks/plugins/simphony/02_components_SiPANN.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import gdsfactory as gf import gdsfactory.simulation.sipann as gs def pltAttr(x, y, title=None, legend="upper right", save=None): if legend is not None: plt.legend(loc=legend) plt.xlabel(x) plt.ylabel(y) if title is not None: plt.title...
google/starthinker
colabs/segmentology_dv360.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: 1. Install Dependencies First install the libraries needed to execute recipes, this only needs to be done once, then click play. End of explanation """ CLOUD_PROJECT = 'PASTE PROJECT ID HERE' print("Cloud Project Set To: %s" % CLOUD_PROJECT) ...
GoogleCloudPlatform/analytics-componentized-patterns
retail/recommendation-system/bqml-scann/03_create_embedding_lookup_model.ipynb
apache-2.0
!pip install -q -U pip !pip install -q tensorflow==2.2.0 !pip install -q -U google-auth google-api-python-client google-api-core """ Explanation: Part 3: Create a model to serve the item embedding data This notebook is the third of five notebooks that guide you through running the Real-time Item-to-item Recommendation...
BeyondTheClouds/enoslib
docs/apidoc/examples/dask.ipynb
gpl-3.0
from enoslib import * import logging # get some logs logging.basicConfig(level=logging.INFO) """ Explanation: Dask deployment on Grid'5000 This notebook will deploy a Dask cluster on Grid'5000 and launch a simpe computation. Requirements: - A conda[[1]] environment setup on the Grid'5000 frontend with dask install...
ViralLeadership/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
Chapter4_TheGreatestTheoremNeverTold/Chapter4.ipynb
mit
%matplotlib inline import numpy as np from IPython.core.pylabtools import figsize import matplotlib.pyplot as plt figsize(12.5, 5) import pymc as pm sample_size = 100000 expected_value = lambda_ = 4.5 poi = pm.rpoisson N_samples = range(1, sample_size, 100) for k in range(3): samples = poi(lambda_, size=sample_...
google/learned_optimization
docs/notebooks/Part3_Truncation_TruncatedStep.ipynb
apache-2.0
!pip install git+https://github.com/google/learned_optimization.git import numpy as np import jax.numpy as jnp import jax import functools from matplotlib import pylab as plt from learned_optimization.outer_trainers import full_es from learned_optimization.outer_trainers import truncated_pes from learned_optimization...
anntzer/seaborn
doc/docstrings/kdeplot.ipynb
bsd-3-clause
import seaborn as sns; sns.set() tips = sns.load_dataset("tips") sns.kdeplot(data=tips, x="total_bill") """ Explanation: Plot a univariate distribution along the x axis: End of explanation """ sns.kdeplot(data=tips, y="total_bill") """ Explanation: Flip the plot by assigning the data variable to the y axis: End of ...
lizoyu/kaggle-DigitRecognizer
jupyter/Traditional methods - opencv+scikit_learn.ipynb
gpl-3.0
import cv2 import numpy as np from skimage.feature import hog from sklearn.decomposition import PCA from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.svm import SVC from lib.data_utils import get_MNIST_data...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/cmip6/models/giss-e2-1g/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'giss-e2-1g', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: NASA-GISS Source ID: GISS-E2-1G Topic: Atmos Sub-Topics: Dynamical Core, Radia...
tensorflow/docs
site/en/guide/migrate/early_stopping.ipynb
apache-2.0
#@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 agreed to in writing, software # distributed under...
csdms/dakota
examples/hydrotrend-polynomial-chaos-study.ipynb
mit
from dakotathon import Dakota """ Explanation: <img src="http://csdms.colorado.edu/mediawiki/images/CSDMS_high_res_weblogo.jpg"> HydroTrend Study with the Polynomial Chaos Method HydroTrend is a numerical model that creates synthetic river discharge and sediment load time series as a function of climate trends and bas...
ES-DOC/esdoc-jupyterhub
notebooks/cmcc/cmip6/models/cmcc-cm2-hr4/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-hr4', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CMCC Source ID: CMCC-CM2-HR4 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics...
scientific-visualization-2016/ClassMaterials
Week-02/02_python_overview.ipynb
cc0-1.0
import math r = float("4.2") s = math.sin(r) print('hello world! The sin({0}) = {1:0.2f}'.format(r,s)) """ Explanation: <img src='https://www.rc.colorado.edu/sites/all/themes/research/logo.png' style="height:75px"> Python Overview Objectives Review python Introduction to functional concepts Data analysis and visualiz...
willrogers/pytac
jupyter/tutorial.ipynb
apache-2.0
import sys, os # Make the pytac package available from this subdirectory sys.path.append(os.path.join(os.getcwd(), '..')) import pytac """ Explanation: In this tutorial we will go through some of the most common ways of using pytac. The aim is to give you an understanding of the interface and how to find out what is a...
sfegan/calin
examples/iact_data/read and dump calin and ACTL header and event from zfits file.ipynb
gpl-2.0
%pylab inline import calin.iact_data.raw_actl_event_data_source import calin.iact_data.telescope_data_source import json import struct import base64 """ Explanation: Read and dump calin and ACTL header and event calin/examples/iact_data/read and dump calin and ACTL raw header and event from zfits file.ipynb - Stephen ...
rastala/mmlspark
notebooks/samples/303 - Transfer Learning by DNN Featurization - Airplane or Automobile.ipynb
mit
from mmlspark import CNTKModel, ModelDownloader import numpy as np, pandas as pd import os, urllib, tarfile, pickle, array from os.path import abspath from pyspark.sql.functions import col, udf from pyspark.sql.types import * cdnURL = "https://mmlspark.azureedge.net/datasets" # Please note that this is a copy of the ...
fja05680/pinkfish
examples/200.momentum-gem-portfolio/strategy.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt import datetime import pinkfish as pf import strategy # Format price data. pd.options.display.float_format = '{:0.2f}'.format %matplotlib inline pd. set_option('display.max_rows', None) # Set size of inline plots. '''note: rcParams can't be in same cell as import...
agile-geoscience/xlines
notebooks/11_Gridding_map_data.ipynb
apache-2.0
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt """ Explanation: X lines of Python Gridding map data This notebook goes with the Agile Scientific blog post from 8 March 2019. I'm using a small dataset originally from Geoff Bohling at the Kansas Geological Survey. I can no l...
5agado/conversation-analyzer
src/test/textStatsTool.ipynb
apache-2.0
def load_text(filepaths): """ Load text you want to analyse. :param filepaths: list of paths to text files to load :return: single string representing all retrieved text """ text = "" for path in filepaths: with open(path, 'r', encoding='UTF-8') as f: text += "\n"+f.read(...
rxa254/MoodCube
simData.ipynb
bsd-3-clause
%matplotlib inline from __future__ import division import matplotlib.cm as cm from matplotlib import rcParams import matplotlib.pyplot as plt import numpy as np #import os #import scipy.constants as scc from scipy.io import savemat from scipy.stats import rayleigh #import scipy.signal as sig #import sys from timeit im...
atulsingh0/MachineLearning
MasteringML_wSkLearn/02a_Classification.ipynb
gpl-3.0
# import import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures %matplotlib inline X = [[6], [8], [10], [14], [18]] y = [[7], [9], [13], [17.5], [18]] plt.figure() plt.title('Pizza price plotted against diameter') plt...
opesci/devito
examples/compiler/04_iet-B.ipynb
mit
from devito import SpaceDimension, TimeDimension dims = {'i': SpaceDimension(name='i'), 'j': SpaceDimension(name='j'), 'k': SpaceDimension(name='k'), 't0': TimeDimension(name='t0'), 't1': TimeDimension(name='t1')} dims """ Explanation: In this tutorial we will learn how to build, comp...
parcicn/Introduction-python
Intro-Python-ICN-2017.ipynb
gpl-3.0
# ceci est un commentaire, l'interpréteur ne le lit même pas # les commentaires sont destinés au lecteur humain du code source code = 'sesame' #affectation de variable rep = input('Entrez le code : ') #affectation et instruction d'entrée if rep == code: # test et début d'u...
mathause/regionmask
docs/notebooks/create_own_regions.ipynb
mit
import cartopy.crs as ccrs import numpy as np import matplotlib.pyplot as plt import regionmask regionmask.__version__ """ Explanation: Create your own region Creating own regions is straightforward. Import regionmask and check the version: End of explanation """ US1 = np.array([[-100.0, 30], [-100, 40], [-120, 35...
voytekresearch/nsaba
notebooks/demos/Nsaba_Short_Demo.ipynb
mit
#local paths to data ns_path = "/Users/Torben/Documents/ABI analysis/current_data_new/" aba_path = '/Users/Torben/Documents/ABI analysis/normalized_microarray_donor9861/' #initialization methods nsaba.Nsaba.ns_load(ns_path) nsaba.Nsaba.aba_load(aba_path) #Creating Nsaba object and loading previously estimated gene ac...
zzsza/TIL
pytorch/Transfer-Learning.ipynb
mit
data_transforms = { 'train': transforms.Compose([ transforms.RandomSizedCrop(224), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) ]), 'val': transforms.Compose([ transforms.Scale(256), ...
jskDr/keraspp
tf2/ex2_1/PyTorch_nb_ex2_1_ann_mnist_cl.ipynb
mit
# %load /home/sjkim/.jupyter/head.py %matplotlib inline %load_ext autoreload %autoreload 2 from importlib import reload import matplotlib.pyplot as plt import numpy as np import pandas as pd import os #os.environ["CUDA_VISIBLE_DEVICES"]="0" # seaborn #import seaborn as sns #sns.set( style = 'white', font_scale = 1.7...
QuantCrimAtLeeds/PredictCode
examples/Chicago/Check large datasets agree.ipynb
artistic-2.0
import sys, os, csv, lzma import open_cp.sources.chicago as chicago filename = os.path.join("..", "..", "open_cp", "sources", "chicago.csv") filename1 = os.path.join("..", "..", "open_cp", "sources", "chicago1.csv") filename_all = os.path.join("..", "..", "open_cp", "sources", "chicago_all.csv.xz") filename_all1 = os....
fran6w/CoderLaVille
CoderLaVille.ipynb
mit
import pandas as pnd import matplotlib.pylab as plt import matplotlib.patches as mpatches from IPython.display import HTML %matplotlib inline img = plt.imread("rueildigital.jpg") plt.axis('off') plt.imshow(img); """ Explanation: Hackathon de Nanterre 17 octobre 2015 Coder la ville... ... en Python End of explanation ...
tensorflow/quantum
docs/tutorials/barren_plateaus.ipynb
apache-2.0
#@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 agreed to in writing, software # distributed under...
AtmaMani/pyChakras
udemy_ml_bootcamp/Python-for-Data-Visualization/Seaborn/Style and Color.ipynb
mit
import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline tips = sns.load_dataset('tips') """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Style and Color We've shown a few times how to control figure aesthetics in seaborn, but let's now go over it forma...
JQGoh/jqlearning
posts/Pair-Distances.ipynb
gpl-3.0
# Import functions import sys sys.path.append("../") import pandas as pd df1 = pd.read_csv("stations1.csv") df2 = pd.read_csv("stations2.csv") df1.head(10) df2.head(10) """ Explanation: Pair Distances It is a common practice that we try to make use of the available data and combine data sets from different sources ...
bcorlett/Notebooks_Modelling
Corlett_Assign2.ipynb
mit
# Import clusters from scipy import sparse #Allows me to create sparse matrices (i.e. not store all of the zeros in the 'A' matrix) import scipy.sparse.linalg as spla #To solve each time iteration, as my SOR code (below) grows exponentially when attempting to solve with negative values on the right-hand side. from nump...
GoogleCloudPlatform/tensorflow-without-a-phd
tensorflow-mnist-tutorial/keras_05_mnist_batch_norm.ipynb
apache-2.0
BATCH_SIZE = 64 EPOCHS = 10 training_images_file = 'gs://mnist-public/train-images-idx3-ubyte' training_labels_file = 'gs://mnist-public/train-labels-idx1-ubyte' validation_images_file = 'gs://mnist-public/t10k-images-idx3-ubyte' validation_labels_file = 'gs://mnist-public/t10k-labels-idx1-ubyte' """ Explanation:...
yedivanseven/LPDE
LegPolyDE-2D_1.ipynb
gpl-3.0
import matplotlib.pyplot as plt import seaborn as sbn import numpy as np import numpy.polynomial.legendre as npl from scipy.optimize import minimize """ Explanation: ORTHOGONAL POLYNOMIAL DENSITY ESTIMATION Preliminaries Imports End of explanation """ %matplotlib notebook sbn.set_style('white') legend_params = {'l...
osunderdog/PythonLearning
PythonZipExploration.ipynb
gpl-2.0
exlst = ["This", "That", "these", "those", "wit"] exlsv = [8,10,9,4,20] """ Explanation: Studying "starred expressions" in Python Author: Bruce W. Lowther licensed under the GNU General Public License v2.0 Starting with list of strings and a list of numbers. Both equal length. End of explanation """ A,B,C,D,E = ex...
cloudera/ibis
docs/source/user_guide/extending/extending_reduce_expr.ipynb
apache-2.0
import ibis.expr.datatypes as dt import ibis.expr.rules as rlz from ibis.expr.operations import Reduction from ibis.expr.signature import Argument as Arg class LastDate(Reduction): arg = Arg(rlz.column(rlz.date)) where = Arg(rlz.boolean, default=None) output_type = rlz.scalar_like('arg') """ Explanation...
browtayl/cs446-net-comp-bio
homework1/homework1.ipynb
gpl-3.0
import pandas import igraph edge_list = pandas.read_csv('hsmetnet.txt', sep='\t', header=None).values.tolist() graph = igraph.Graph.TupleList(edge_list, directed=True) igraph.summary(graph) """ Explanation: Homework 1 End of explanation """ flatten = lambda l: sum(l, []) vertex_set = set(flatten(edge_list)) isreac...
InsightLab/data-science-cookbook
2020/05-geographic-information-system/Notebook_Geometric_Objects.ipynb
mit
# Import necessary geometric objects from shapely module from shapely.geometry import Point, LineString, Polygon # Create Point geometric object(s) with coordinates point1 = Point(2.2, 4.2) point2 = Point(7.2, -25.1) point3 = Point(9.26, -2.456) point3D = Point(9.26, -2.456, 0.57) """ Explanation: Biblioteca Shapely ...
tritemio/multispot_paper
LCOS_pattern/LCOS Pattern.ipynb
mit
import matplotlib.pyplot as plt import matplotlib as mpl %matplotlib inline #%config InlineBackend.figure_format='retina' # for hi-dpi displays %run patternlib """ Explanation: LCOS Multi-Spot Phase Pattern This notebook shows how to call the function compute_pattern() to generate a multispot LCOS pattern with arbi...
DataPilot/notebook-miner
summary_of_work/6. Probabilistic Model of Nodes.ipynb
apache-2.0
# Necessary imports import os import time from nbminer.notebook_miner import NotebookMiner from nbminer.cells.cells import Cell from nbminer.features.ast_features import ASTFeatures from nbminer.stats.summary import Summary from nbminer.stats.multiple_summary import MultipleSummary #Loading in the notebooks people = ...
CRPropa/CRPropa3
doc/pages/example_notebooks/galactic_backtracking/galactic_backtracking.v4.ipynb
gpl-3.0
from crpropa import * # magnetic field setup B = JF12Field() #seed = 691342 #B.randomStriated(seed) #B.randomTurbulent(seed) # simulation setup sim = ModuleList() sim.add(PropagationCK(B, 1e-4, 0.1 * parsec, 100 * parsec)) obs = Observer() obs.add(ObserverSurface( Sphere(Vector3d(0), 20 * kpc) )) # obs.onDetection(Te...
huajianmao/learning
coursera/deep-learning/5.nlp-sequence-models/week1/Neural machine translation with attention - v2.ipynb
mit
from keras.layers import Bidirectional, Concatenate, Permute, Dot, Input, LSTM, Multiply from keras.layers import RepeatVector, Dense, Activation, Lambda from keras.optimizers import Adam from keras.utils import to_categorical from keras.models import load_model, Model import keras.backend as K import numpy as np from...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/sandbox-3/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-3', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: SANDBOX-3 Topic: Landice Sub-Topic...
tpin3694/tpin3694.github.io
machine-learning/imbalanced_classes_in_svm.ipynb
mit
# Load libraries from sklearn.svm import SVC from sklearn import datasets from sklearn.preprocessing import StandardScaler import numpy as np """ Explanation: Title: Imbalanced Classes In SVM Slug: imbalanced_classes_in_svm Summary: How to handle imbalanced classes in support vector machines in Scikit-Learn Date: ...
Hexiang-Hu/mmds
week3/Quiz-Week3.ipynb
mit
## Solution 1. import numpy as np A = np.array([[0, 0, 1, 0, 0, 1, 0, 0], #A [0, 0, 0, 0, 1, 0, 0, 1], #B [1, 0, 0, 1, 0, 1, 0, 0], #C [0, 0, 1, 0, 1, 0, 1, 0], #D [0, 1, 0, 1, 0, 0, 0, 1], #E [1, 0, 1, 0, 0, 0, 1, 0], #F [0, 0, 0, 1, ...
Mynti207/cs207project
docs/presentation.ipynb
mit
# database parameters ts_length = 100 data_dir = '../db_files' db_name = 'default' dir_path = data_dir + '/' + db_name + '/' # clear file system for testing if not os.path.exists(dir_path): os.makedirs(dir_path) filelist = [dir_path + f for f in os.listdir(dir_path)] for f in filelist: os.remove(f) """ Explan...
ktmud/deep-learning
intro-to-rnns/Anna_KaRNNa_Solution.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
DCPROGS/HJCFIT
exploration/CB.ipynb
gpl-3.0
%matplotlib notebook import numpy as np import matplotlib.pyplot as plt from dcprogs.likelihood import QMatrix tau = 0.2 qmatrix = QMatrix([ [-2, 1, 1, 0], [ 1, -101, 0, 100], [50, 0, -50, 0], [ 0, 5.6, 0, -5.6]], 1) """ Explanation: ...
MATH497project/MATH497-DiabeticRetinopathy
diagnosis_changing_exploratory/diagnosis_changing_exploratory.ipynb
mit
from collections import Counter Counter(df[['mNPDR', 'MNPDR', 'SNPDR', 'PDR']].sum(axis=1)) """ Explanation: There are encounters have more than one diagnosis of DR. End of explanation """ tmp={k:v[['mNPDR', 'MNPDR', 'SNPDR', 'PDR']].sum(axis=0) for k,v in df.groupby('Person_Nbr')} tmp1 = {k:len(v[~v.isin([0])].ind...
ML4DS/ML4all
R7.Regression_Overview/regression_overview.ipynb
mit
# Import some libraries that will be necessary for working with data and displaying plots # To visualize plots in the notebook %matplotlib inline import numpy as np import scipy.io # To read matlab files import pandas as pd # To read data tables from csv files # For plots and graphical results import matplo...
ypeleg/Deep-Learning-Keras-Tensorflow-PyCon-Israel-2017
3.2 RNN and LSTM.ipynb
mit
%matplotlib inline import numpy as np import pandas as pd import theano import theano.tensor as T import keras import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split # -- ...
khalido/nd101
earthquake.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np df = pd.read_csv("data/earthquake-database.csv") print(df.shape) df.head() """ Explanation: build a neural network to predict the magnitude of an Earthquake given the date, time, Latitude, and Longitude as features. This is the ...
apryor6/apryor6.github.io
visualizations/seaborn/notebooks/colors.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.rcParams['figure.figsize'] = (20.0, 10.0) df = pd.read_csv('../../../datasets/movie_metadata.csv') df.head() """ Explanation: seaborn.countplot Bar graphs are useful for displaying relationships between categorical data...
LorenzoBi/courses
TSAADS/tutorial 1/.ipynb_checkpoints/assigment1-checkpoint.ipynb
mit
import numpy as np import scipy.io as sio import matplotlib.pyplot as plt from numpy.fft import fft, ifft %matplotlib inline def estimated_autocorrelation(x): n = len(x) mu, sigma2 = np.mean(x), np.var(x) r = np.correlate(x - mu, x - mu, mode = 'full')[-n:] result = r/(sigma2 * (np.arange(n, 0, -1))) ...
scikit-multilearn/scikit-multilearn
docs/source/modelselection.ipynb
bsd-2-clause
from skmultilearn.dataset import load_dataset X_train, y_train, feature_names, label_names = load_dataset('emotions', 'train') X_test, y_test, _, _ =load_dataset('emotions', 'test') """ Explanation: How to select a classifier This document will guide you through the process of selecting a classifier for your problem....
eds-uga/csci1360-fa16
lectures/L19.ipynb
mit
book = None try: # Good coding practices! f = open("alice.txt", "r") book = f.read() except FileNotFoundError: print("Could not find alice.txt.") else: f.close() print(book[:71]) # Print the first 71 characters. """ Explanation: Lecture 19: Natural Language Processing I CSCI 1360: Foundations for...
dwhswenson/openpathsampling
examples/gromacs/AD_tps_2a_run_flex.ipynb
mit
from __future__ import print_function %matplotlib inline import openpathsampling as paths from openpathsampling.engines import gromacs as ops_gmx """ Explanation: This is file runs the main calculation for the flexible length TPS simulation. It requires the file alanine_dipeptide_tps_equil.nc, which is written in the...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/managed_notebooks/recommender_systems/recommender-system-on-retail-data.ipynb
apache-2.0
PROJECT_ID = "" # Get your Google Cloud project ID from gcloud if not os.getenv("IS_TESTING"): shell_output=!gcloud config list --format 'value(core.project)' 2>/dev/null PROJECT_ID = shell_output[0] print("Project ID: ", PROJECT_ID) """ Explanation: Build a recommender system with retail data on Vertex A...
lrayle/rental-listings-census
src/sfbay_modeling.ipynb
bsd-3-clause
import numpy as np import pandas as pd import os import math import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline DATA_DIR = os.path.join('..','data','urbansim') """ Explanation: Modeling rent prices for the SF Bay Area This notebook will develop a predictive model for rent prices in the Bay Area...
ES-DOC/esdoc-jupyterhub
notebooks/inm/cmip6/models/inm-cm5-0/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'inm', 'inm-cm5-0', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: INM Source ID: INM-CM5-0 Sub-Topics: Radiative Forcings. Properties: 85 (42 re...
makeyourowntextminingtoolkit/makeyourowntextminingtoolkit
A02_svd_applied_to_word_document_matrix.ipynb
gpl-2.0
#import pandas for conviently labelled arrays import pandas # import numpy for SVD function import numpy # import matplotlib.pyplot for visualising arrays import matplotlib.pyplot as plt """ Explanation: SVD Applied to a Word-Document Matrix This notebook applies the SVD to a simple word-document matrix. The aim is to...
GoogleCloudPlatform/asl-ml-immersion
notebooks/tfx_pipelines/cicd/solutions/tfx_cicd_vertex.ipynb
apache-2.0
REGION = "us-central1" PROJECT_ID = !(gcloud config get-value core/project) PROJECT_ID = PROJECT_ID[0] ARTIFACT_STORE = f"gs://{PROJECT_ID}" """ Explanation: CI/CD for TFX pipelines Learning Objectives Develop a CI/CD workflow with Cloud Build to build and deploy TFX pipeline code. Integrate with Github to automatica...
whitead/numerical_stats
unit_9/hw_2018/Homework_9_Key.ipynb
gpl-3.0
import numpy as np x = np.array([1, 4, 7, 11, 34, -3, 5, 7, 5, 2, 3, 13]) ###-------### x[::2] """ Explanation: Homework 9 Key CHE 116: Numerical Methods and Statistics 3/29/2018 Homework Requirements: Write all equations in $\LaTeX$ Simplify all expressions Put comments in your Python code Explain or show your work...
great-expectations/great_expectations
examples/notebooks/Crop_Expectations_With_Reshape.ipynb
apache-2.0
import pandas as pd import great_expectations as ge df = pd.read_csv('../data/FAO-Rice-Production-Asia.csv') """ Explanation: Great Expectations Basics This example will walk through using basic expectations with crop data from the Food and Agricultural Organization of the United States. Data are available here: htt...
bspalding/research_public
lectures/Arbitrage Pricing Theory.ipynb
apache-2.0
import numpy as np import pandas as pd from statsmodels import regression import matplotlib.pyplot as plt """ Explanation: Arbitrage Pricing Theory Arbitrage pricing theory is a major asset pricing theory that relies on expressing the returns using a linear factor model: $$R_i = a_i + b_{i1} F_1 + b_{i2} F_2 + \ldots ...
Xilinx/meta-petalinux
recipes-examples/openamp/openamp-demo-notebooks/apu-start-rpu.ipynb
mit
! date; uname -a; id; pwd; ls -l /lib/firmware/i* /usr/bin/{echo_test,mat_mul_demo,proxy_app} """ Explanation: OpenAMP examples Introduction Implementation details Setup Load Kernel modules Add firmware name Demo: Echo Test Demo: Matrix Multiplication References Introduction <a name="introduction"></a> <img src="p...