repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
mit-eicu/eicu-code
notebooks/patient.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 import getpass import pdvega # for configuring connection from configobj import ConfigObj import os %matplotlib inline # Create a database connection using settings from config file config='../db/config.ini' #...
Jim00000/Numerical-Analysis
2_Systems_Of_Equations.ipynb
unlicense
# Import modules import sys import numpy as np import numpy.linalg import scipy import sympy import sympy.abc from scipy import linalg from scipy.sparse import linalg as slinalg """ Explanation: CHAPTER 2 - Systems Of Equations End of explanation """ def naive_gaussian_elimination(matrix): """ A simple gauss...
gaufung/Data_Analytics_Learning_Note
Scikit_Learning/User_Guide/Generalized_Linear_Models.ipynb
mit
from sklearn import linear_model reg = linear_model.LinearRegression() reg.fit([[0, 0], [1, 2], [2,2]], [0, 1, 2]) reg.coef_ """ Explanation: Generailized Linear Models In mathematical notion. $$\hat{y}(\omega, x)=\omega_0 + \omega_1x_1 + \ldots +\omega_px_p$$ We designate the vector $\omega=(\omega_1,\ldots,\omeg...
kylemede/DS-ML-sandbox
KaggelChallenges/titanic/explore.ipynb
gpl-3.0
import pandas as pd from pandas import Series, DataFrame import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns sns.set_style("whitegrid") # machine learning from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC, LinearSVC from sklearn.ensemble import Ran...
utensil/julia-playground
packages/galgebra.py.ipynb
mit
from sympy import solve,sqrt g = '0 # #,# 0 #,# # 1' necl = Ga('X Y e',g=g) (X,Y,e) = necl.mv() X Y e (X^Y)*(X^Y) L = X^Y^e L B = (L*e).expand().blade_rep() B Bsq = B*B Bsq BsqScalar = Bsq.scalar() BsqScalar (Bsq - BsqScalar).simplify() == 0 BeBr = B*e*B.rev() BeBr B*B L*L (s,c,Binv,M,S,C,alpha) = symbols...
julienchastang/unidata-python-workshop
notebooks/Bonus/Siphon_XARRAY_Cartopy_HRRR.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline # Resolve the latest HRRR dataset from siphon.catalog import get_latest_access_url hrrr_catalog = "http://thredds.ucar.edu/thredds/catalog/grib/NCEP/HRRR/CONUS_2p5km/catalog.xml" latest_hrrr_ncss = get_latest_access_url(hrrr_catalog, "NetcdfSubset"...
Duke-GCB/cwl-freezer
cwl-freezing.ipynb
mit
workflow = parse('/Users/dcl9/Code/python/mmap-cwl/mmap.cwl') """ Explanation: Questions Could this be a CWL compiler? WIll it take a root document and return the whole structure? Can I find the dockerRequirement anywhere in the doc? Can I find the dockerRequirement using the schema? 1. CWL Docker Compiler What does...
rcrehuet/Python_for_Scientists_2017
notebooks/Pandas_Github_Day3.ipynb
gpl-3.0
data_file ='usagov_bitly_data2012-03-16-1331923249.txt' file = open(data_file) file.readline() """ Explanation: Title: Data Analysis with Python: Overview of Pandas Author: Fermín Huarte Larrañaga Created: 2015 Version: 2.0 Date: June 2017 Bibliography This IPython Notebook is based almost completely on: "Python for ...
ds-modules/LINGUIS-110
FormantsUpdated/Assignment.ipynb
mit
# DON'T FORGET TO RUN THIS CELL import math import numpy as np import pandas as pd import seaborn as sns import datascience as ds import matplotlib.pyplot as plt sns.set_style('darkgrid') %matplotlib inline import warnings warnings.filterwarnings('ignore') """ Explanation: Linguistics 110: Vowel Formants Professor S...
StephenHarrington/bitcoin-examples
Regtest_RPC.ipynb
mit
#!/bin/bash #regtest_start_network.sh import os import shutil #os.system("killall --regex bitcoin.*") idir = os.environ['HOME']+'/regtest' if os.path.isdir(idir): shutil.rmtree(idir) os.mkdir(idir) connects = {'17591' : '17592', '17592' : '17591'} for port in connects.keys(): adir = idir+'/'+port os.mkd...
ceos-seo/data_cube_notebooks
notebooks/general/Shapefile_Masking.ipynb
apache-2.0
import sys import os sys.path.append(os.environ.get('NOTEBOOK_ROOT')) import matplotlib.pyplot as plt %matplotlib inline from datacube.utils.aws import configure_s3_access configure_s3_access(requester_pays=True) # Import Data Cube API import utils.data_cube_utilities.data_access_api as dc_api api = dc_api.DataAcc...
zzsza/TIL
python/image processing.ipynb
mit
from PIL import Image import numpy as np def average_hash(fname, size = 16): img = Image.open(fname) img = img.convert('L') # 1을 지정하면 이진화, RGB, RGBA, CMYK 등의 모드도 지원 img = img.resize((size, size), Image.ANTIALIAS) pixel_data = img.getdata() pixels = np.array(pixel_data) pixels = pixels.reshape((...
gVallverdu/cookbook
matplotlibrc.ipynb
gpl-2.0
import matplotlib import matplotlib.style as mpl_style """ Explanation: Matplotlib style sheets This notebook presents how to change the style or appearance of matplotlib plots. In additiopn to the rcParams dictionnary, the matplotlib.style module provides facilities for style sheets utilisation with matplotlib. Look ...
FluVigilanciaBR/fludashboard
Notebooks/Brazilian_epiweek.ipynb
gpl-3.0
from episem import episem """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a data-toc-modified-id="Using-Brazilian-epidemiological-week-definition-1" href="#Using-Brazilian-epidemiological-week-definition"><span class="toc-item-num">1&nbsp;&nbsp;</span>Using Brazilian epidemiological week definition</...
xunilrj/sandbox
courses/IMTx-Queue-Theory/Week2_Lab_MM1.ipynb
apache-2.0
%matplotlib inline from pylab import * lambda_ = 4 mu = 5 ################### # Write a function that computes the probability Pa that the next event # is an arrival (when the system is not empty) def Pa(lambda_,mu): return lambda_/(mu+lambda_) ################### V1 = Pa(lambda_,mu) ...
AllenDowney/ThinkBayes2
soln/chap02.ipynb
mit
import pandas as pd table = pd.DataFrame(index=['Bowl 1', 'Bowl 2']) """ Explanation: Bayes's Theorem Think Bayes, Second Edition Copyright 2020 Allen B. Downey License: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) In the previous chapter, we derived Bayes's Theorem: $$P(A|B) = \frac{P(A) ...
ProfessorKazarinoff/staticsite
content/code/matplotlib_plots/plot_bond_energy.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt # if using a Jupyter notebook, include: %matplotlib inline """ Explanation: Atoms in solid materials like steel and aluminum are held together with chemical bonds. Atoms of solid materials are more stable when they are chemically bonded together, and it takes energy t...
tpin3694/tpin3694.github.io
python/function_basics.ipynb
mit
def print_max(x, y): # if a is larger than b if x > y: # then print this print(x, 'is maximum') # if a is equal to b elif x == y: # print this print(x, 'is equal to', y) # otherwise else: # print this print(y, 'is maximum') """ Explanation: Title:...
mathnathan/notebooks
.ipynb_checkpoints/semantic_similarity_with_tf_hub_universal_encoder-checkpoint.ipynb
mit
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
GoogleCloudPlatform/healthcare
datathon/nusdatathon18/tutorials/image_preprocessing.ipynb
apache-2.0
from google.colab import files from io import BytesIO # Display images. from IPython.display import display from PIL import Image, ImageEnhance """ Explanation: Copyright 2018 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Yo...
MLIME/12aMostra
src/Keras Tutorial.ipynb
gpl-3.0
import util import numpy as np import keras from keras.utils import np_utils X_train, y_train, X_test, y_test = util.load_mnist_dataset() y_train_labels = np.array(util.get_label_names(y_train)) # Converte em one-hot para treino y_train = np_utils.to_categorical(y_train, 10) y_test = np_utils.to_categorical(y_test, 1...
AstroHackWeek/AstroHackWeek2016
notebook-tutorial/notebooks/07-Some_basics.ipynb
mit
# Create a [list] days = ['Monday', # multiple lines 'Tuesday', # acceptable 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', ] # trailing comma is fine! days # Simple for-loop for day in days: print(day) # Double for-loop for day in days: fo...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_decoding_unsupervised_spatial_filter.ipynb
bsd-3-clause
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Asish Panda <asishrocks95@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.decoding import UnsupervisedSpatialFilter from sklearn.decomposition import PCA, FastI...
oscarmore2/deep-learning-study
intro-to-rnns/Anna_KaRNNa_Exercises.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, we'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 bas...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_covariance_whitening_dspm.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os import os.path as op import numpy as np from scipy.misc import imread import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import spm_face from mne.minimum_norm import apply_inverse, make_inverse_o...
NlGG/MachineLearning
.ipynb_checkpoints/nn-checkpoint.ipynb
mit
def example1(x_1, x_2): z = x_1**0.5*x_2*0.5 return z fig = pl.figure() ax = Axes3D(fig) X = np.arange(0, 1, 0.1) Y = np.arange(0, 1, 0.1) X, Y = np.meshgrid(X, Y) Z = example1(X, Y) ax.plot_surface(X, Y, Z, rstride=1, cstride=1) pl.show() """ Explanation: コブ・ダクラス型生産関数と課題文で例に出された関数を用いる。 いずれも定義域は0≤x≤1である。 ...
lin99/NLPTM-2016
4.Docs/word2vec.ipynb
mit
## Loading the model with `gensim` # import wrod2vec model from gensim from gensim.models.word2vec import Word2Vec # load Google News pre-trained network model = Word2Vec.load_word2vec_format('GNvectors.bin', binary=True) """ Explanation: Playing with word2vec Fabio A. González, Universidad Nacional de Colombia Goog...
jshudzina/keras-tutorial
notebooks/02-Yellowstone-visitors-part1.ipynb
apache-2.0
# load and plot dataset from pandas import read_csv from pandas import datetime from matplotlib import pyplot # load dataset def parser(x): return datetime.strptime(x, '%Y-%m-%d') series = read_csv('../data/yellowstone-visitors.csv', header=0, parse_dates=[0], index_col=0, squeeze=True, date_parser=parser) # summar...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-lm/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-lm', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-LM Topic: Landice Sub-Topics: Glaciers, Ice. Properties:...
girving/tensorflow
tensorflow/tools/docker/notebooks/3_mnist_from_scratch.ipynb
apache-2.0
from __future__ import print_function from IPython.display import Image import base64 Image(data=base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAAMYAAABFCAYAAAARv5krAAAYl0lEQVR4Ae3dV4wc1bYG4D3YYJucc8455yCSSIYrBAi4EjriAZHECyAk3rAID1gCIXGRgIvASIQr8UTmgDA5imByPpicTcYGY+yrbx+tOUWpu2e6u7qnZ7qXVFPVVbv2Xutfce+q7hlasmTJktSAXrnn8...
mikekestemont/lot2016
Chapter 9 - Text analysis.ipynb
mit
ls data/arabian_nights """ Explanation: Chapter 9: What we have covered so far (and a bit more) In this chapter, we will work our way through a concise review of the Python functionality we have covered so far. Throughout this chapter, we will work with a interesting, yet not too large dataset, namely the well-known ...
vikasgorur/notebooks
deep-learning/3_regularization.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import numpy as np import tensorflow as tf from six.moves import cPickle as pickle """ Explanation: Deep Learning Assignment 3 Previously in 2_fullyconnected.ipynb, you tra...
GoogleCloudPlatform/mlops-on-gcp
immersion/kubeflow_pipelines/pipelines/labs/lab-02_vertex.ipynb
apache-2.0
from google.cloud import aiplatform REGION = 'us-central1' PROJECT_ID = !(gcloud config get-value project) PROJECT_ID = PROJECT_ID[0] # Set `PATH` to include the directory containing KFP CLI PATH=%env PATH %env PATH=/home/jupyter/.local/bin:{PATH} """ Explanation: Continuous Training with Kubeflow Pipeline and Verte...
phoebe-project/phoebe2-docs
2.0/tutorials/fti.ipynb
gpl-3.0
!pip install -I "phoebe>=2.0,<2.1" """ Explanation: Finite Time of Integration (fti) Setup Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplo...
nbateshaus/chem-search
inchi-split/notebooks/Layer Stats SQL.ipynb
bsd-3-clause
%sql postgresql://localhost/inchi_split \ select count(*) from chembl_export_nonstandard; """ Explanation: Our test set here includes the 1.3 million molecules from ChEMBL20 with MW < 600 that could be successfully processed by the RDKit. We use the Standard InChI that comes with ChEMBL and a non-standard InChI (o...
xiaoxiaoyao/MyApp
PythonApplication1/deeplearning/examples/gan_pytorch.ipynb
unlicense
# Generative Adversarial Networks (GAN) example in PyTorch. # See related blog post at https://medium.com/@devnag/generative-adversarial-networks-gans-in-50-lines-of-code-pytorch-e81b79659e3f#.sch4xgsa9 import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim fro...
davidbrough1/pymks
notebooks/intro.ipynb
mit
import pymks %matplotlib inline %load_ext autoreload %autoreload 2 """ Explanation: Meet PyMKS In this short introduction, we will demonstrate the functionality in PyMKS. We will quantify microstructures using 2-point statistics, predict effective properties using homogenization and predict local properties using lo...
BuzzFeedNews/2015-07-h2-visas-and-enforcement
notebooks/h2-violation-aggregates.ipynb
mit
import pandas as pd import sys sys.path.append("../utils") import loaders """ Explanation: Aggregated H-2 Guest Worker Violations The Python code below loads all WHISARD violations since 2005 (based on the end-date of the violation period); isolates the violations of laws meant to protect H-2 workers; and provides agg...
GoogleCloudPlatform/mlops-on-gcp
immersion/tfx_pipelines/01-walkthrough/labs/lab-01.ipynb
apache-2.0
import absl import os import tempfile import time import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_model_analysis as tfma import tensorflow_transform as tft import tfx from pprint import pprint from tensorflow_metadata.proto.v0 import schema_pb2, statistics_pb2, anomalies_pb2 from t...
cosmolejo/Fisica-Experimental-3
Calculo_Error/Poisson/Poisson.ipynb
gpl-3.0
dado = np.array([5, 3, 3, 2, 5, 1, 2, 3, 6, 2, 1, 3, 6, 6, 2, 2, 5, 6, 4, 2, 1, 3, 4, 2, 2, 5, 3, 3, 2, 2, 2, 1, 6, 2, 2, 6, 1, 3, 3, 3, 4, 4, 6, 6, 1, 2, 2, 6, 1, 4, 2, 5, 3, 6, 6, 3, 5, 2, 2, 4, 2, 2, 4, 4, 3, 3, 1, 2, 6, 1, 3, 3, 5, 4, 6, 6, 4, 2, 5, 6, 1, 4, 5, 4, 3, 5, ...
TomTranter/OpenPNM
examples/simulations/Fickian Diffusion.ipynb
mit
import numpy as np import openpnm as op %matplotlib inline np.random.seed(10) ws = op.Workspace() ws.settings["loglevel"] = 40 np.set_printoptions(precision=5) """ Explanation: Fickian Diffusion One of the main applications of OpenPNM is simulating transport phenomena such as Fickian diffusion, advection diffusion, re...
Bio204-class/bio204-notebooks
inclass-2016-02-22-Confidence-Intervals.ipynb
cc0-1.0
%matplotlib inline import numpy as np import scipy.stats as stats import pandas as pd import matplotlib.pyplot as plt import matplotlib matplotlib.style.use("bmh") np.random.seed(20160222) # setting seed insures reproducability mu, sigma = 10, 2 popn = stats.norm(loc=mu, scale=sigma) ssizes = [25, 50, 100, 200, 400...
bjshaw/phys202-2015-work
assignments/assignment11/OptimizationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Optimization Exercise 1 Imports End of explanation """ def hat(x,a,b): v = -a*x**2+b*x**4 return v assert hat(0.0, 1.0, 1.0)==0.0 assert hat(0.0, 1.0, 1.0)==0.0 assert hat(1.0, 10.0, 1.0)==-9....
no-fire/line-follower
line-follower/src/v1/convnet_regression_circle_and_carpet.ipynb
mit
#Create references to important directories we will use over and over import os, sys #import modules import numpy as np from glob import glob from PIL import Image from tqdm import tqdm from scipy.ndimage import zoom from keras.models import Sequential from keras.metrics import categorical_crossentropy, categorical_a...
perrette/iis
notebooks/examples.ipynb
mit
from scipy.stats import norm, uniform from iis import IIS, Model def mymodel(params): """User-defined model with two parameters Parameters ---------- params : numpy.ndarray 1-D Returns ------- state : float return value (could also be an array) """ return params[0] + param...
blackjax-devs/blackjax
examples/LogisticRegression.ipynb
apache-2.0
import jax import jax.numpy as jnp import jax.random as random import matplotlib.pyplot as plt from sklearn.datasets import make_biclusters import blackjax %config InlineBackend.figure_format = "retina" plt.rcParams["axes.spines.right"] = False plt.rcParams["axes.spines.top"] = False plt.rcParams["figure.figsize"] = ...
pbutenee/ml-tutorial
source/1/recommendation_engine.ipynb
mit
import numpy as np import pandas as pd import sklearn.metrics.pairwise """ Explanation: Recommendation Engine In this tutorial we are going to build a simple recommender system using collaborative filtering. You'll be learning about the popular data analysis package pandas along the way. 1. The import statements End o...
atulsingh0/MachineLearning
MasteringML_wSkLearn/06_Clustering_with_K-Means.ipynb
gpl-3.0
# import from sklearn.cluster import KMeans, MiniBatchKMeans from sklearn.linear_model import LogisticRegression from sklearn import metrics from sklearn.utils import shuffle import mahotas as mh from mahotas.features import surf import glob import numpy as np import matplotlib.pyplot as plt from scipy.spatial.distan...
jbn/vaquero
demo/Module_Demo.ipynb
mit
data = [{'user_name': "Jack", 'user_age': "42.0"}, {'user_name': "Jill", 'user_age': 64}, {'user_name': "Jane", 'user_age': "lamp"}] """ Explanation: This notebook demonstrates vaquero. Let's say you are processing some html files for users. Someone on your team already used css selectors to extract a ...
GoogleCloudPlatform/dfcx-scrapi
examples/template.ipynb
apache-2.0
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
jinntrance/MOOC
coursera/ml-classification/assignments/module-5-decision-tree-assignment-1-blank.ipynb
cc0-1.0
import graphlab graphlab.canvas.set_target('ipynb') """ Explanation: Identifying safe loans with decision trees The LendingClub is a peer-to-peer leading company that directly connects borrowers and potential lenders/investors. In this notebook, you will build a classification model to predict whether or not a loan pr...
arnoldlu/lisa
ipynb/tutorial/02_TestEnvUsage.ipynb
apache-2.0
import logging from conf import LisaLogging LisaLogging.setup() # Execute this cell to enabled devlib debugging statements logging.getLogger('ssh').setLevel(logging.DEBUG) # Other python modules required by this notebook import json import time import os """ Explanation: Tutorial goal This tutorial aims to show how ...
jserenson/Python_Bootcamp
Lists.ipynb
gpl-3.0
# Assign a list to an variable named my_list my_list = [1,2,3] """ Explanation: Lists Earlier when discussing strings we introduced the concept of a sequence in Python. Lists can be thought of the most general version of a sequence in Python. Unlike strings, they are mutable, meaning the elements inside a list can be ...
aam-at/tensorflow
tensorflow/lite/g3doc/tutorials/model_maker_text_classification.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...
skorokithakis/pythess-files
006 - Frank Underwood/schema-presentation/Schema presentation.ipynb
mit
data = { "operation": "upload", # "upload" or "delete" "timeout": 3600, # Optional, how long the sig should be valid for. "md5": "deadbeefetc", # Optional "files": { "5gbCtxlvljhx5-al": { "size": 65536, "shred_date": "2015-05-02T00:00:00Z" # Must be a date from now up...
michaelgat/Udacity_DL
intro-to-tflearn/TFLearn_Sentiment_Analysis-MG.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by bui...
eyadsibai/rep
howto/01-howto-Classifiers.ipynb
apache-2.0
!cd toy_datasets; wget -O MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID.txt import numpy, pandas from rep.utils import train_test_split from sklearn.metrics import roc_auc_score data = pandas.read_csv('toy_datasets/MiniBooNE_PID.txt', sep='\s*', ...
Danghor/Algorithms
Python/Chapter-04/Radix-Sort.ipynb
gpl-2.0
%run Counting-Sort.ipynb """ Explanation: Radix Sort As <em style="color:blue">radix sort</em> is based on <em style="color:blue">counting sort</em>, we have to start our implementation of radix sort by defining the function countingSort that we have already discussed previously. The easiest way to do this is by usin...
erdewit/ib_insync
notebooks/ordering.ipynb
bsd-2-clause
from ib_insync import * util.startLoop() ib = IB() ib.connect('127.0.0.1', 7497, clientId=13) # util.logToConsole() """ Explanation: Ordering Warning: This notebook will place live orders Use a paper trading account (during market hours). End of explanation """ contract = Forex('EURUSD') ib.qualifyContracts(contrac...
zipeiyang/liupengyuan.github.io
chapter4/python爬虫入门.ipynb
mit
import requests from bs4 import BeautifulSoup import re """ Explanation: By liupengyuan[at]pku.edu.cn Project: https://github.com/liupengyuan/ 1. 什么是爬虫 简而言之,爬虫就是一段能够获取互联网信息(数据)的程序/工具。 一般需要通过抓取网页来获取互联网的信息与数据。 网页本身就是一个本文文件,只不过这个文本文件是由特定规则和符号标记的(HTML,超文本标记语言),称为超文本文件,也可称为网页源代码。 这段文本经过浏览器的解析(各类图片视频等在此过程中从网页外部加载),就成为我们日常浏览...
gdsfactory/gdsfactory
docs/notebooks/01_references.ipynb
mit
import numpy as np import gdsfactory as gf gf.config.set_plot_options(show_subports=False) # Create a blank Component p = gf.Component("component_with_polygon") # Add a polygon xpts = [0, 0, 5, 6, 9, 12] ypts = [0, 1, 1, 2, 2, 0] p.add_polygon([xpts, ypts], layer=(2, 0)) # plot the Component with the polygon in it ...
eaton-lab/toytree
docs/6-treenodes.ipynb
bsd-3-clause
import toytree import toyplot import numpy as np # generate a random tree tre = toytree.rtree.unittree(ntips=10, seed=12345) """ Explanation: TreeNode objects The .treenode attribute of ToyTrees allows users to access the underlying TreeNode structure directly. This is where you can traverse the tree and query the pa...
fweik/espresso
doc/tutorials/ferrofluid/ferrofluid_part1.ipynb
gpl-3.0
import espressomd espressomd.assert_features('DIPOLES', 'LENNARD_JONES') from espressomd.magnetostatics import DipolarP3M from espressomd.magnetostatic_extensions import DLC from espressomd.cluster_analysis import ClusterStructure from espressomd.pair_criteria import DistanceCriterion import numpy as np """ Explan...
tarashor/vibrations
py/notebooks/MatricesForPlaneCorrugatedShells1.ipynb
mit
from sympy import * from geom_util import * from sympy.vector import CoordSys3D import matplotlib.pyplot as plt import sys sys.path.append("../") %matplotlib inline %reload_ext autoreload %autoreload 2 %aimport geom_util # Any tweaks that normally go in .matplotlibrc, etc., should explicitly go here %config InlineBa...
mne-tools/mne-tools.github.io
0.19/_downloads/f760cc2f1a5d6c625b1e14a0b05176dd/plot_ecog.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Chris Holdgraf <choldgraf@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat import mne from mne.viz import plot_alignment, snapshot_brain_montage print(__doc__) """ Explanation: Working w...
rustychris/stompy
examples/filtering.ipynb
mit
from stompy import filters, utils import matplotlib.pyplot as plt import numpy as np %matplotlib notebook # Sample data -- all times in hours dt=0.1 x=np.arange(0,100,dt) y=np.random.random(len(x)) target_cutoff=36.0 y_fir=filters.lowpass_fir(y,int(target_cutoff/dt)) y_iir=filters.lowpass(y,dt=dt,cutoff=target_cutof...
espressomd/espresso
doc/tutorials/error_analysis/error_analysis_part2.ipynb
gpl-3.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) import sys import logging logging.basicConfig(level=logging.INFO, stream=sys.stdout) np.random.seed(43) def ar_1_process(n_samples, c, phi, eps): ''' Generate a correlated random sequence with the AR(1...
ctralie/TUMTopoTimeSeries2016
3DShapes.ipynb
apache-2.0
import numpy as np %matplotlib notebook import scipy.io as sio from scipy import sparse import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import sys sys.path.append("pyhks") from HKS import * from GeomUtils import * from ripser import ripser from persim import plot_diagrams, wasserstein from skl...
UWSEDS/short-course
LectureNotes/ExceptionsDebugging.ipynb
mit
X = [1, 2, 3) y = 4x + 3 """ Explanation: When Things Go Wrong: Errors, Exceptions, and Debugging Today we'll cover perhaps one of the most important aspects of using Python: dealing with errors and bugs in code. Three Classes of Errors Types of bugs/errors in code, from the easiest to the most difficult to diagnose:...
AllenDowney/ThinkBayes2
workshop/workshop02soln.ipynb
mit
from __future__ import print_function, division %matplotlib inline import numpy as np from thinkbayes2 import Suite import thinkplot import warnings warnings.filterwarnings('ignore') """ Explanation: Bayesian Statistics Made Simple Code and exercises from my workshop on Bayesian statistics in Python. Copyright 201...
AllenDowney/ModSimPy
notebooks/chap14.ipynb
mit
# Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_assign' # import functions from the modsim.py module from modsim import * """ Explanation: Modeling and Simulati...
jepegit/cellpy
dev_utils/easyplot/EasyPlot_Demo.ipynb
mit
from cellpy.utils import easyplot """ Explanation: Easyplot user guide Easyplot is a submodule found in the utils of cellpy. It takes a list of filenames and plots these corresponding to the users input configuration. Please follow the example below to learn how to use it. 1: Import cellpy and easyplot End of explanat...
IanHawke/maths-with-python
03-loops-control-flow.ipynb
mit
from math import pi def degrees_to_radians(theta_d): """ Convert an angle from degrees to radians. Parameters ---------- theta_d : float The angle in degrees. Returns ------- theta_r : float The angle in radians. """ theta_r = pi / 180.0 *...
kaleoyster/nbi-data-science
Deterioration Curves/(Southeast) Deterioration+Curves++and+Classification+of+Bridges+in+the+Southeast+United+States.ipynb
gpl-2.0
import pymongo from pymongo import MongoClient import time import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import csv """ Explanation: Libraries and Packages End of explanation """ Client = MongoClient("mongodb://bridges:readonly@nbi-mongo.admin/bridge") db = Client.bridg...
ecabreragranado/OpticaFisicaII
Experimento de Young/ExperimentoYoung.ipynb
gpl-3.0
from IPython.display import Image Image(filename="YoungTwoSlitExperiment.JPG") """ Explanation: Experimento de Young End of explanation """ from IPython.display import Image Image(filename="ExperimentoYoung.jpg") """ Explanation: ''The experiments I am about to relate ... may be repeated with great ease, whenever ...
mne-tools/mne-tools.github.io
0.21/_downloads/fa9fcfffc497146dd55d06cee6a5ec68/plot_creating_data_structures.ipynb
bsd-3-clause
import mne import numpy as np """ Explanation: Creating MNE's data structures from scratch MNE provides mechanisms for creating various core objects directly from NumPy arrays. End of explanation """ # Create some dummy metadata n_channels = 32 sampling_rate = 200 info = mne.create_info(n_channels, sampling_rate) pr...
kaizu/ecell4-lectures
lecture2.ipynb
mit
%matplotlib inline from ecell4 import * import matplotlib.pylab as plt import numpy as np import seaborn seaborn.set(font_scale=1.5) import matplotlib as mpl mpl.rc("figure", figsize=(6, 4)) """ Explanation: <p style="text-align:center">Lecture 2. 化学反応回路</p> <p style="text-align:center;font-size:150%;line-height:15...
DOV-Vlaanderen/pydov
docs/notebooks/search_gecodeerde_lithologie.ipynb
mit
%matplotlib inline import inspect, sys # check pydov path import pydov """ Explanation: Example of DOV search methods for interpretations (gecodeerde lithologie) Use cases explained below Get 'gecodeerde lithologie' in a bounding box Get 'gecodeerde lithologie' with specific properties within a distance from a poin...
mangeshjoshi819/ml-learn-python3
Some Advanced Python.ipynb
mit
class Person: ##SCOPE OF CLASS DOWN BELOW institute="IIT" def __init__(self,name,department): self.name=name self.department=department def getName(self): return self.name p=Person("mangesh","physics") p.getName() """ Explanation: Advance Python Define class class variab...
qdev-dk/Majorana
examples/Qcodes example with Alazar ATS9360.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import qcodes as qc import qcodes.instrument.parameter as parameter import qcodes.instrument_drivers.AlazarTech.ATS9360 as ATSdriver from qdev_wrappers.alazar_controllers.ATSChannelController import ATSChannelController from qdev_wrappers.alazar_con...
rcrehuet/Python_for_Scientists_2017
notebooks/extras/Numpy arrays. Data manipulation.ipynb
gpl-3.0
!head ../../data/profasi/n0/rt """ Explanation: Numpy arrays. Data manipulation In this notebook we are going to work with some numerical data that we need to re-format. Profasi is a Monte Carlo code for protein simulation. It can run Parallel Tempering simulations where each replica runs in a processor and exchanges ...
probml/pyprobml
notebooks/book1/15/cnn1d_sentiment_torch.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import math from IPython import display try: import torch except ModuleNotFoundError: %pip install -qq torch import torch from torch import nn from torch.nn import functional as F from torch.utils import data import collections import re import random imp...
joaoandre/algorithms
intro-python-data-science/week2.ipynb
mit
!pip freeze > requirements.txt import pandas as pd pd.Series? animals = ['Tiger', 'Bear', 'Moose'] pd.Series(animals) numbers = [1, 2, 3] pd.Series(numbers) animals = ['Tiger', 'Bear', None] pd.Series(animals) numbers = [1, 2, None] pd.Series(numbers) import numpy as np np.nan == None np.nan == np.nan np.isnan(...
arviz-devs/arviz
doc/source/user_guide/numpyro_refitting.ipynb
apache-2.0
import arviz as az import numpyro import numpyro.distributions as dist import jax.random as random from numpyro.infer import MCMC, NUTS import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats import xarray as xr numpyro.set_host_device_count(4) """ Explanation: Refitting NumPyro models with Arv...
opengeostat/pygslib
pygslib/Ipython_templates/probplt_html.ipynb
mit
#general imports import pygslib """ Explanation: PyGSLIB PPplot End of explanation """ #get the data in gslib format into a pandas Dataframe mydata= pygslib.gslib.read_gslib_file('../data/cluster.dat') true= pygslib.gslib.read_gslib_file('../data/true.dat') true['Declustering Weight'] = 1 """ Explanation: Gettin...
tcstewar/testing_notebooks
Converting non-spiking neurons to spiking neurons.ipynb
gpl-2.0
class LeakyIntegrator: def __init__(self, threshold, tau_rc=20): self.threshold = threshold self.tau_rc = tau_rc self.v = 0 def step(self, J): if self.v > self.threshold: output = self.v - self.threshold else: output = 0 ...
dfm/dfm.io
static/downloads/notebooks/emcee-pymc3.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = "retina" from matplotlib import rcParams rcParams["savefig.dpi"] = 100 rcParams["figure.dpi"] = 100 rcParams["font.size"] = 20 """ Explanation: Title: emcee + PyMC3 Date: 2018-08-21 Category: Data Analysis Slug: emcee-pymc3 Summary: sampling models defined in P...
santanche/java2learn
notebooks/pt/c04components/s03message-bus/1.iot-devices.ipynb
gpl-2.0
publisher = IoT_mqtt_publisher("localhost", 1883) """ Explanation: Instanciando Componente de Publicação de Mensagens no MQTT End of explanation """ sensor_1 = IoT_sensor("1", "temperature", "°C", 20, 26, 2) sensor_2 = IoT_sensor("2", "umidade", "%", 50, 60, 3) sensor_3 = IoT_sensor("3", "temperature", "°C", 28...
4DGenome/Chromosomal-Conformation-Course
Notebooks/01-Mapping.ipynb
gpl-3.0
from pytadbit.mapping.full_mapper import full_mapping """ Explanation: Table of Contents Iterative vs fragment-based mapping Advantages of iterative mapping Advantages of fragment-based mapping Mapping Iterative mapping Fragment-based mapping Iterative vs fragment-based mapping Iterative mapping first proposed b...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_decoding_csp_space.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Romain Trachel <romain.trachel@inria.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ ...
dariox2/CADL
session-0/session-0.ipynb
apache-2.0
4*2 import numpy as np print(np.sin(.5)) print(np.random.random(3)) """ Explanation: Session 0: Preliminaries with Python/Notebook <p class="lead"> Parag K. Mital<br /> <a href="https://www.kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow/info">Creative Applications of Deep Learning w/ Tenso...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_ml/td2a_timeseries.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline """ Explanation: 2A.ml - Séries temporelles Prédictions sur des séries temporelles et autres opérations classiques. End of explanation """ import pyensae.datasource as ds ds.download_data('xavierdupre_sessions.csv', ...
satishkt/ML-Foundations-Coursera
Week4-Clustering/Document retrieval.ipynb
bsd-2-clause
import graphlab """ Explanation: Document retrieval from wikipedia data Fire up GraphLab Create End of explanation """ people = graphlab.SFrame('people_wiki.gl/') """ Explanation: Load some text data - from wikipedia, pages on people End of explanation """ people.head() len(people) """ Explanation: Data contain...
DataReply/persistable
examples/Persistable.ipynb
gpl-3.0
# Persistable Class: from persistable import Persistable # Set a persistable top path: from pathlib import Path LOCALDATAPATH = Path('.').absolute() """ Explanation: Introduction: This material has been used in the past to teach colleagues in our group how to use persistable. The persistable package provides a genera...
gregmedlock/Medusa
docs/machine_learning.ipynb
mit
import medusa from medusa.test import create_test_ensemble ensemble = create_test_ensemble("Staphylococcus aureus") """ Explanation: Applying machine learning to guide ensemble curation An ensemble of models can be though of as a set of feasible hypotheses about how a system behaves. From a machine learning perspecti...
abotero/text-mining-amazon-reviews
final-project-part3and4.ipynb
mit
import numpy as np import pandas as pd import gzip import json import gzip import matplotlib %matplotlib inline import matplotlib.pyplot as plt matplotlib.style.use('ggplot') pd.set_option('display.max_colwidth', -1) #Some functions to handle files def parse(path): with open(path) as data_file: for d...
phungkh/phys202-2015-work
assignments/assignment12/FittingModelsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 1 Imports End of explanation """ a_true = 0.5 b_true = 2.0 c_true = -4.0 """ Explanation: Fitting a quadratic curve For this problem we are going to work with the following mod...
DanielFGomez/Tarea2MetodosAvanzados
Punto2.ipynb
mit
fig,ax=subplots(3,3,figsize=(10, 10)) n=1 for i in range(3): for j in range(3): ax[i,j].scatter(X[:,0],X[:,n],c=Y) n+=1 Xnorm=sklearn.preprocessing.normalize(X) pca=sklearn.decomposition.PCA() pca.fit(Xnorm) fig,ax=subplots(1,3,figsize=(16, 4)) ax[0].scatter(pca.transform(X)[:,0],Y,c=Y) ax[0].s...
ministryofjustice/opg-digi-deps-notebooks
notebooks/Digital Deputyship traffic distribution.ipynb
mit
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Digital Deputyship traffic distribution As we don't have enough data per day to see usage pattern for the site, then we need to be creative. What if we import data from last month, and group it ...
aam-at/tensorflow
tensorflow/python/ops/numpy_ops/g3doc/TensorFlow_NumPy_Text_Generation.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...