repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
kubeflow/examples
github_issue_summarization/notebooks/Training.ipynb
apache-2.0
# Ensure that the github-issues-data volume is mounted in /mnt !ls -la /mnt # Set path for data dir %env DATA_DIR=/mnt/github-issues-data # Download the github-issues.zip training data to /mnt/github-issues-data !wget --directory-prefix=${DATA_DIR} https://storage.googleapis.com/kubeflow-examples/github-issue-summari...
jsub10/MLCourse
Notebooks/Systematic-Approach-to-Visualizing-Data.ipynb
mit
# We keep plotting simple and use common packages and defaults import matplotlib.pyplot as plt import seaborn as sns # Set the aesthetics for Seaborn visuals sns.set(context='notebook', style='whitegrid', palette='deep', font='sans-serif', font_scale=1.3, color_codes=True, ...
dimonaks/siman
tutorials/create_vasp_calculation.ipynb
gpl-2.0
from siman import header from siman.header import db from siman.SSHTools import SSHTools from siman.calc_manage import add, res from siman.database import write_database, read_database from siman.set_functions import read_vasp_sets from siman.calc_manage import smart_structure_read %matplotlib inline read_database() # ...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-3/cmip6/models/sandbox-1/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: TEST-INSTITUTE-3 Source ID: SANDBOX-1 Sub-Topics: Radiative Forcin...
timothydmorton/usrp-sciprog
day4/Newton-Method.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np # two parabolae f = lambda x, c: c*x**2 c = 1, 0.5 # initial point x_ = -0.75 y_ = [ f(x_, ci) for ci in c ] # compute gradient and hessian g = [ 2*c[i]*x_ for i in range(2) ] H = [ 2*c[i] for i in range(2) ] # Newton step x__ = [ x_ - 1/H[i]*g[i...
johntanz/ROP
Old Code/EyeDrops160223.ipynb
gpl-2.0
from ROPini import * #Takes a little bit, wait a while. Hour1, Minute1, Hour2, Minute2, Hour3, Minute3 = [int(x) for x in raw_input("Enter times for eye drops here: ").split()] #Syntax should be "HH MM HH MM HH MM" First time, second time, third time all in one line. #No commas or colons. W1 = datetime(Year, Month...
DiXiT-eu/collatex-tutorial
unit8/unit8-collatex-and-XML/CollateX and XML, Part 1.ipynb
gpl-3.0
from collatex import * from lxml import etree import json,re """ Explanation: CollateX and XML, Part 1 David J. Birnbaum (djbpitt@gmail.com, http://www.obdurodon.org), 2015-06-29 This is the first part of multi-part tutorial on processing...
AllenDowney/ThinkBayes2
notebooks/chap13.ipynb
mit
# If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install empiricaldist # Get utils.py from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename...
rileyrustad/pdxapartmentfinder
analysis/Fourth_Analysis.ipynb
mit
import numpy as np import pandas as pd from pandas import DataFrame, Series import json import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: This is my fourth attempt at creating a model using sklearn alogithms In this iteration of analysis we'll be looking...
hanezu/cs231n-assignment
assignment1/.ipynb_checkpoints/features-checkpoint.ipynb
mit
import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' # for auto-reloading extenrnal modu...
dnc1994/MachineLearning-UW
ml-classification/module-8-boosting-assignment-2-solution.ipynb
mit
import graphlab import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Boosting a decision stump The goal of this notebook is to implement your own boosting module. Brace yourselves! This is going to be a fun and challenging assignment. Use SFrames to do some feature engineering. Modify the decision tree...
fastai/fastai
nbs/20a_distributed.ipynb
apache-2.0
#|export @patch def reset(self: DataParallel): "Patch required `reset` call into `DataParallel`" if hasattr(self.module, 'reset'): self.module.reset() #|export class ParallelTrainer(Callback): "Wrap a model `DataParallel` automatically" run_after,run_before = TrainEvalCallback,Recorder def __init__...
computational-class/cjc
code/17.networkx.ipynb
mit
%matplotlib inline import networkx as nx import matplotlib.cm as cm import matplotlib.pyplot as plt import networkx as nx G=nx.Graph() # G = nx.DiGraph() # 有向网络 # 添加(孤立)节点 G.add_node("spam") # 添加节点和链接 G.add_edge(1,2) print(G.nodes()) print(G.edges()) # 绘制网络 nx.draw(G, with_labels = True) """ Explanation: 网络科学理论 ...
eds-uga/cbio4835-sp17
lectures/Lecture15.ipynb
mit
from Bio.Seq import Seq # the submodule structure of biopython is a little awkward s = Seq("GATTACA") print(s) """ Explanation: Lecture 15: BioPython CBIO (CSCI) 4835/6835: Introduction to Computational Biology Overview and Objectives BioPython is a versatile Python package for computational biology, particularly if ...
jasontlam/snorkel
tutorials/crowdsourcing/Crowdsourced_Sentiment_Analysis.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import os import numpy as np from snorkel import SnorkelSession session = SnorkelSession() """ Explanation: Training a Sentiment Analysis LSTM Using Noisy Crowd Labels In this tutorial, we'll provide a simple walkthrough of how to use Snorkel to resolve conflicts i...
CartoDB/cartoframes
docs/guides/06-Data-Services.ipynb
bsd-3-clause
from cartoframes.auth import set_default_credentials set_default_credentials('creds.json') """ Explanation: Data Services You can connect to CARTO Data Services API directly from CARTOframes. This API consists of a set of location-based functions that can be applied to your data to perform geospatial analyses without...
wangzexian/summrerschool2015
rnn_tutorial/simple_rnn.ipynb
bsd-3-clause
%matplotlib inline from synthetic import mackey_glass import matplotlib.pyplot as plt import theano import theano.tensor as T import numpy floatX = theano.config.floatX """ Explanation: This notebook demonstrates how to implement RNNs in Theano First, we import some dependencies: End of explanation """ class Simple...
arborh/tensorflow
tensorflow/compiler/xla/g3doc/tutorials/autoclustering_xla.ipynb
apache-2.0
import tensorflow as tf # Check that GPU is available: cf. https://colab.research.google.com/notebooks/gpu.ipynb assert(tf.test.is_gpu_available()) tf.keras.backend.clear_session() tf.config.optimizer.set_jit(False) # Start with XLA disabled. def load_data(): (x_train, y_train), (x_test, y_test) = tf.keras.dataset...
agile-geoscience/striplog
docs/tutorial/14_Merge_overlapping_striplogs.ipynb
apache-2.0
from striplog import Striplog csv = """Top,Base,Comp Time,Comp Depth 100,200,2,a 110,120,1,b 150,325,3,c 210,225,1,d 300,400,2,e 350,375,3,f """ s = Striplog.from_csv(text=csv) """ Explanation: Merge overlapping striplogs Imagine we have a Striplog with overlapping Interval. We would like to be able to merge the Int...
European-XFEL/h5tools-py
docs/lpd_data.ipynb
bsd-3-clause
from karabo_data import RunDirectory, by_index run = RunDirectory('fxe_example_run/') # Using only the first three trains to keep this example light: run = run.select_trains(by_index[:3]) run.instrument_sources """ Explanation: Accessing LPD data The Large Pixel Detector (LPD) is made of 16 modules which record data...
NeuroDataDesign/seelviz
jon/algorithms/Timing+Pipeline.ipynb
apache-2.0
import analysis3 as a3 reload(a3) import time def time_function(fun, *args): start = time.time(); result = fun(*args); run_time = time.time() - start; minutes = run_time / 60; print('RUN TIME: %f s (%f m)' % (run_time, minutes)); return result; """ Explanation: Running on 4 cores with 30 gb RA...
jdamiani27/DataSciUF-Tutorial-Instructor
DataSciUF Python II - Instructor.ipynb
mit
def download_file(url, local_filename): import requests # stream = True allows downloading of large files; prevents loading entire file into memory r = requests.get(url, stream = True) with open(local_filename, 'wb') as f: for chunk in r.iter_content(chunk_size=1024): if chunk:...
mne-tools/mne-tools.github.io
0.17/_downloads/5d2190fa4d2e36b882cc913879fb6f3b/plot_decoding_time_generalization_conditions.ipynb
bsd-3-clause
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import matplotlib.pyplot as plt from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Stan...
h-mayorquin/time_series_basic
presentations/2016-03-20(Wall Street Columns Nexa - Visualization of Code Vectors).ipynb
bsd-3-clause
import numpy as np import h5py %matplotlib inline import sys sys.path.append("../") """ Explanation: Wall Street Columns Nexa - Visualization of Code Vectors In this notebook we will analyse the distribution of code vectors. What we want to analyse is whether we are able to increase that difference by making proper u...
gautam1858/tensorflow
tensorflow/lite/g3doc/examples/jax_conversion/overview.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...
smharper/openmc
examples/jupyter/unstructured-mesh-part-i.ipynb
mit
from IPython.display import Image import openmc import openmc.lib assert(openmc.lib._dagmc_enabled()) """ Explanation: Unstructured Mesh Tallies in OpenMC In this example we'll look at how to setup and use unstructured mesh tallies in OpenMC. Unstructured meshes are able to provide results over spatial regions of a p...
jsharpna/DavisSML
lectures/lecture4/lecture4.ipynb
mit
import numpy as np import matplotlib.pyplot as plt """ Explanation: Convex Optimization StatML: Lecture 4 Prof. James Sharpnack Reading: "Convex Optimization" Boyd and Vandenberghe Ch. 1 End of explanation """ T = np.linspace(0.01,2*np.pi,100) plt.plot(T,-np.log(T),label='Conv') plt.plot(T,3*np.sin(T),label='Nonconv...
michaelaye/planetpy
notebooks/planetary constants.ipynb
bsd-3-clause
from planetarypy.constants import planets_pretty planets_pretty planets_pretty.dtypes """ Explanation: Quick show on how to use the planetary constants module planets_pretty shows a pretty table with the units included. End of explanation """ from planetarypy.constants import planets planets planets.dtypes """ ...
jiarong/SSUsearch
notebooks-pc-linux/.ipynb_checkpoints/pipeline-dependency-installation-checkpoint.ipynb
bsd-3-clause
cd ~/Desktop/SSUsearch/ mkdir -p ./external_tools cd ./external_tools mkdir -p ./bin """ Explanation: Install dependencies This pipeline requires: HMMER3.1 mothur RDP mcclust python pandas, numpy, scipy, matplotlib, and screed package. This tutorial is made on a 64 bit linux (ubuntu) machine. If you have 32 bit m...
kevinsung/OpenFermion
docs/tutorials/jordan_wigner_and_bravyi_kitaev_transforms.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...
nikodtbVf/aima-si
games.ipynb
mit
from games import (GameState, Game, Fig52Game, TicTacToe, query_player, random_player, alphabeta_player, play_game, minimax_decision, alphabeta_full_search, alphabeta_search, Canvas_TicTacToe) """ Explanation: Games or Adversarial search This notebook serves as supporting mater...
yassineAlouini/ml-experiments
notebooks/linear_regression.ipynb
mit
import pandas as pd import numpy as np import scipy.stats as sps import matplotlib.pyplot as plt %matplotlib inline movies = pd.read_csv('fandango_score_comparison.csv') movies.describe() movies.info() # Check the movie data structure movies.head() """ Explanation: Comparing different movie rating systems In this ...
BrownDwarf/ApJdataFrames
notebooks/Muzic2015.ipynb
mit
%pylab inline import seaborn as sns sns.set_context("notebook", font_scale=1.5) #import warnings #warnings.filterwarnings("ignore") import pandas as pd """ Explanation: ApJdataFrames Muzic2015 Title: SUBSTELLAR OBJECTS IN NEARBY YOUNG CLUSTERS (SONYC) IX: THE PLANETARY-MASS DOMAIN OF CHAMAELEON-I AND UPDATED MASS F...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/discrete_choice_overview.ipynb
bsd-3-clause
import numpy as np import statsmodels.api as sm """ Explanation: Discrete Choice Models Overview End of explanation """ spector_data = sm.datasets.spector.load() spector_data.exog = sm.add_constant(spector_data.exog, prepend=False) """ Explanation: Data Load data from Spector and Mazzeo (1980). Examples follow Gree...
tranlyvu/kaggle
Digit Recognizer/notebook/Digit Recognizer.ipynb
apache-2.0
import pandas as pd train_data=pd.read_csv('/train.csv') train_data.head() train_data.tail() train_data.dtypes train_data.info() """ Explanation: Author : Vu Tran. Other info is on github Kaggle Competition: Digit Recognizer Info from Competition Site Description Evaluation Data Set First attempt: Working with ...
psychemedia/ou-robotics-vrep
robotVM/notebooks/Demo - Square 3 - Loops.ipynb
apache-2.0
for count in range(0,3): print(count) print("And the final value of `count` is", count) """ Explanation: Traverse a Square - Part 3 - Loops Compared to the original programme, the programme that contains the variables is easier to modify. But it still contains a lot of repetition. Let's remind ourselves of it...
lo-co/atm-py
atmPy/for_removal/documentation/HAGiS Analysis.ipynb
mit
import atmPy.instruments.DMA.smps as smps import atmPy.instruments.DMA.dma as dma import pandas as pd from matplotlib.dates import date2num from matplotlib import colors import matplotlib.pyplot as plt from numpy import meshgrid from matplotlib import rc from matplotlib import dates import numpy as np # Plots will be i...
ArdenB/SegmentedRESTREND_pub
NCdemo/CombineRuns.ipynb
mit
import numpy as np import pandas as pd import xarray as xr import bottleneck as bn from scipy import stats import matplotlib.pyplot as plt # import statsmodels.stats.multitest as smsM """ Explanation: Combining paired C3 and C4 runs This section describes a methods to combine TSS-RESTREND attribution runs done assumin...
jmschrei/pomegranate
tutorials/C_Feature_Tutorial_1_Parallelization.ipynb
mit
%matplotlib inline import numpy import matplotlib.pyplot as plt import seaborn; seaborn.set_style('whitegrid') from pomegranate import * numpy.random.seed(0) numpy.set_printoptions(suppress=True) %load_ext watermark %watermark -m -n -p numpy,scipy,pomegranate def create_dataset(n_samples, n_dim, n_classes, alpha=1)...
VVard0g/ThreatHunter-Playbook
docs/notebooks/windows/08_lateral_movement/WIN-190810201010.ipynb
mit
from openhunt.mordorutils import * spark = get_spark() """ Explanation: WMI Win32_Process Class and Create Method for Remote Execution Metadata | Metadata | Value | |:------------------|:---| | collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] | | creation date | 2019/08/10 | | modification date | 20...
seblabbe/MATH2010-Logiciels-mathematiques
ipynb-cours/16-02-16.ipynb
gpl-3.0
5 / 2 from sympy import Rational Rational(5,2) from sympy import S S? type(S(5)) S(5)/2 S('13/2') + S(5)/7 """ Explanation: Chapitres 1 à 4 Quelques ajouts dans les sections déjà vues... 3.1 Nombres rationels Une autre façon de créer un nombre rationnel End of explanation """ from sympy import arg,re,im,I a = ...
graphistry/pygraphistry
demos/demos_databases_apis/neo4j/contributed/Neo4jTwitter.ipynb
bsd-3-clause
# import required dependencies from neo4j.v1 import GraphDatabase, basic_auth from pandas import DataFrame import graphistry # To specify Graphistry account & server, use: # graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com') # For more options, see https://github....
LaurelOak/hydro-teaching-resources
Tutorial-ForLoops-Discharge.ipynb
bsd-3-clause
# Import numerical tools import numpy as np #Import pandas for reading in and managing data import pandas as pd # Import pyplot for plotting import matplotlib.pyplot as plt #Import seaborn (useful for plotting) import seaborn as sns # Magic function to make matplotlib inline; other style specs must come AFTER %matp...
highb/deep-learning
autoencoder/Convolutional_Autoencoder_Solution.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
thehackerwithin/berkeley
code_examples/keras_introduction/Single_layer_keras.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Keras imports from keras.models import Sequential from keras.layers import Dense, Activation from keras.optimizers import SGD """ Explanation: Building and training a single-layer neural network with keras Keras is a high-leve...
fonnesbeck/PyMC3_Oslo
notebooks/c. Bayesian Neural Network.ipynb
cc0-1.0
%matplotlib inline import pymc3 as pm import theano.tensor as T import theano import sklearn import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') from sklearn import datasets from sklearn.preprocessing import scale from sklearn.cross_validation import train_test_split from skl...
pagutierrez/tutorial-sklearn
notebooks-spanish/10-caso_estudio_titanic.ipynb
cc0-1.0
from sklearn.datasets import load_iris iris = load_iris() print(iris.data.shape) """ Explanation: Caso de estudio - Supervivencia en el Titanic Extracción de características Ahora trataremos parte muy importante del aprendizaje automático: la extracción de características cuantitativas a partir de los datos. Con este...
sylvchev/coursIntroPython
tp/SAE03-TP2_io_if_while.ipynb
gpl-3.0
# Exécutez cette cellule ! from IPython.core.display import HTML styles = "<style>\n.travail {\n background-size: 30px;\n background-image: url('https://cdn.pixabay.com/photo/2018/01/04/16/53/building-3061124_960_720.png');\n background-position: left top;\n background-repeat: no-repeat;\n padding-left:...
Diyago/Machine-Learning-scripts
time series regression/ARIMA/usd-rub predicting.ipynb
apache-2.0
# возьмем лог, который "penalize higher values more than smaller values" ts_log = np.log(rub["Adj Close"]) test_stationarity(ts_log) # далее вычтем скользящее среднее moving_avg = pd.rolling_mean(ts_log,50) plt.plot(ts_log) plt.plot(moving_avg, color='red') ts_log_moving_avg_diff = ts_log - moving_avg ts_log_moving_...
ContinuumIO/nbpresent
notebooks/index.ipynb
bsd-3-clause
from IPython.display import * """ Explanation: <i class="fa fa-gift fa-2x text-success"> </i> This is an nbpresent presentation! End of explanation """ SVG("https://www.continuum.io/sites/all/themes/continuum_foundation/images/logos/logo-anaconda.svg") """ Explanation: <i class="fa fa-info-circle fa-2x text-info"> ...
google/starthinker
colabs/dcm.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Report Create a CM report from a JSON definition. License Copyright 2020 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 t...
xpmethod/middlemarch-critical-histories
notebooks/quoted-language.ipynb
gpl-3.0
from collections import Counter import pandas as pd import numpy as np %matplotlib inline from pylab import rcParams import textacy rcParams['figure.figsize'] = 10, 4 import matplotlib.pyplot as plt plt.style.use('ggplot') import spacy nlp = spacy.load('en') """ Explanation: Analysis of quoted language, v2 How is quo...
machinelearningnanodegree/stanford-cs231
solutions/vijendra/assignment3/ImageGradients.ipynb
mit
# As usual, a bit of setup import time, os, json import numpy as np import skimage.io import matplotlib.pyplot as plt from cs231n.classifiers.pretrained_cnn import PretrainedCNN from cs231n.data_utils import load_tiny_imagenet from cs231n.image_utils import blur_image, deprocess_image %matplotlib inline plt.rcParams...
opesci/devito
examples/cfd/06_poisson.ipynb
mit
from examples.cfd import plot_field, init_hat import numpy as np %matplotlib inline # Some variable declarations nx = 50 ny = 50 nt = 100 xmin = 0. xmax = 2. ymin = 0. ymax = 1. dx = (xmax - xmin) / (nx - 1) dy = (ymax - ymin) / (ny - 1) # Initialization p = np.zeros((nx, ny)) pd = np.zeros((nx, ny)) b = np.zer...
google-research/receptive_field
RF_Keras_Applications.ipynb
apache-2.0
from google.colab import drive drive.mount('/content/gdrive') ! mkdir gdrive/MyDrive/rf_keras %cd gdrive/MyDrive/rf_keras ! ls ! git clone https://github.com/google-research/receptive_field.git ! ls %cd receptive_field/ ! ls ! pip install . ! pip install tensorflow """ Explanation: <a href="https://colab.rese...
encima/Comp_Thinking_In_Python
Session_9/9_Sorting Algorithms and Complexity.ipynb
mit
def ins_sort(k): for i in range(1,len(k)): #since we want to swap an item with previous one, we start from 1 j = i #because we need 2 indexes as one will reduce and we do not want to affect i while j > 0 and k[j] < k[j-1]: #j>0 since there is no value to th...
mne-tools/mne-tools.github.io
0.22/_downloads/bc5044f9d3ef1d29067dd6b7d83ceed2/plot_20_visualize_epochs.ipynb
bsd-3-clause
import os import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=120) """ Explanation: Visualizing epo...
sz2472/foundations-homework
homework10/homework10_foundation.ipynb
mit
print(data) data.keys() data['currently'] temperature=str(data['currently']['temperature']) summary=data['currently']['summary'] data['daily'] data['daily'].keys() data['daily']['data'] """ Explanation: Forecasts Part One: Getting data Using the Dark Sky Forecast API at https://developer.forecast.io/, generate ...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_dics_beamformer.ipynb
bsd-3-clause
# Author: Roman Goj <roman.goj@gmail.com> # # License: BSD (3-clause) import mne import matplotlib.pyplot as plt import numpy as np from mne.datasets import sample from mne.time_frequency import csd_epochs from mne.beamformer import dics print(__doc__) data_path = sample.data_path() raw_fname = data_path + '/MEG/s...
AllenDowney/ModSim
python/soln/chap07.ipynb
gpl-2.0
# 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/' ...
bocklund/notebooks
pycalphad/Plot activity.ipynb
mit
from pycalphad import Database, equilibrium, variables as v import numpy as np # Database from Zhou, C., Guo, C., Li, C. & Du, Z. Thermodynamic assessment of the phase equilibria and prediction of glass-forming ability of the Al–Cu–Zr system. J. Non. Cryst. Solids 461, 47–60 (2017). dbf = Database('Al-Cu-Zr_Zhou.TDB')...
DavidObando/carnd
Term3/Labs/ObjectDetection/CarND-Object-Detection-Lab.ipynb
apache-2.0
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from PIL import Image from PIL import ImageDraw from PIL import ImageColor import time from scipy.stats import norm %matplotlib inline plt.style.use('ggplot') """ Explanation: CarND Object Detection Lab Let's get started! End of explanation ""...
ltiao/project-euler
problem-12-highly-divisible-triangular-number.ipynb
unlicense
from six.moves import map, range, reduce def triangle_num(n): "The nth triangle number" return n*(n+1)>>1 triangle_num(7) list(map(triangle_num, range(1, 11))) """ Explanation: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 ...
ES-DOC/esdoc-jupyterhub
notebooks/cmcc/cmip6/models/sandbox-2/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-2', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CMCC Source ID: SANDBOX-2 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balan...
kkkddder/dmc
notebooks/week-4/02-tensorflow ANN for classification.ipynb
apache-2.0
%matplotlib inline import math import random import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from sklearn.datasets import load_boston '''Since this is a classification problem, we will need to represent our targets as one-hot encoding vectors (see previous lab). To do this we will use sciki...
cliburn/sta-663-2017
notebook/04_Strings.ipynb
mit
import requests try: with open('looking_glass.txt') as f: text = f.read() except IOError: url = 'http://www.gutenberg.org/cache/epub/12/pg12.txt' res = requests.get(url) text = res.text with open('looking_glass.txt', 'w') as f: f.write(str(text)) """ Explanation: Strings The proces...
rflamary/POT
docs/source/auto_examples/plot_barycenter_1D.ipynb
mit
# Author: Remi Flamary <remi.flamary@unice.fr> # # License: MIT License import numpy as np import matplotlib.pylab as pl import ot # necessary for 3d plot even if not used from mpl_toolkits.mplot3d import Axes3D # noqa from matplotlib.collections import PolyCollection """ Explanation: 1D Wasserstein barycenter demo ...
macieksmuga/server
scripts/ga4gh_example.ipynb
apache-2.0
baseURL = "http://localhost:8000" client = ga4gh.client.HttpClient(baseURL) """ Explanation: GA4GH IPython Example Notebook This notebook provides an overview of how to call a the GA4GH reference server from an iPython notebook. Before running this notebook: git clone https://github.com/ga4gh/server.git -b develop D...
wuafeing/Python3-Tutorial
01 data structures and algorithms/01.05 implement a priority queue.ipynb
gpl-3.0
import heapq class PriorityQuene: def __init__(self): self._queue = [] self._index = 0 def push(self, item, priority): heapq.heappush(self._queue, (-priority, self._index, item)) self._index += 1 def pop(self): return heapq.heappop(self._queue)[-1] ...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_temporal_whitening.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np from scipy import signal import matplotlib.pyplot as plt import mne from mne.time_frequency import fit_iir_model_raw from mne.datasets import sample print(__doc__) data_path = sample.data_path() r...
matousc89/python-web-tutorials
Unittests.ipynb
mit
def sum_together1(a, b): return a + b """ Explanation: Catching errors and unit tests In this tutorial are few examples how catch error and how to perform unit tests in Python. When you code in Python, keep in mind: Errors should never pass silently. Unless explicitly silenced. (<a href="https://www.python.org/dev...
rflamary/POT
notebooks/plot_OT_L1_vs_L2.ipynb
mit
# Author: Remi Flamary <remi.flamary@unice.fr> # # License: MIT License import numpy as np import matplotlib.pylab as pl import ot import ot.plot """ Explanation: 2D Optimal transport for different metrics 2D OT on empirical distributio with different gound metric. Stole the figure idea from Fig. 1 and 2 in https://...
gaoshuming/udacity
face-generation/dlnd_face_generation.ipynb
mit
data_dir = './data' # FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe" #data_dir = '/input' """ DON'T MODIFY ANYTHING IN THIS CELL """ import helper helper.download_extract('mnist', data_dir) helper.download_extract('celeba', data_dir) """ Explanation: 人脸生成(Face Generation) 在该项目中,你将使用生成式对抗网络(Generative Adversa...
GoogleCloudPlatform/ml-design-patterns
02_data_representation/mixed_representation.ipynb
apache-2.0
import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from tensorflow.keras import Model from tensorflow.keras.layers import Dense, Embedding, Input, Flatten, Conv2D, MaxPooling2D from google.cloud import bigquery """ Explanation: Mixed Input Representations Design Pattern This ...
karlstroetmann/Artificial-Intelligence
Python/3 Games/Tic-Tac-Toe-Bitboard.ipynb
gpl-2.0
gPlayers = [0, 1] """ Explanation: Tic-Tac-Toe via Bitboards This notebook defines the game tic-tac-toe. It is played on a $3 \times 3$ board. There are two players, which are called X and O. Player X starts. Player X always puts an 'X' into an empty field on the board, while player O always puts an 'O' in an empty...
itsjeevs/projectEuler
Euler.ipynb
mit
get_sum = lambda x,y: x+y get_product = lambda x,y: x*y get_substract = lambda x,y: x-y get_division = lambda x,y: x/y is_bigger_than = lambda x,y: x if x>y else y is_smaller_than = lambda x,y: x if x<y else y reduce(get_sum, filter(lambda x: x%3 ==0 or x%5 == 0, range(1,1001))) """ Explanation: 1. Multiples of 3 and...
daniaki/Enrich2
docs/notebooks/min_count.ipynb
gpl-3.0
% matplotlib inline import os.path import numpy as np import pandas as pd import matplotlib.pyplot as plt from enrich2.variant import WILD_TYPE_VARIANT import enrich2.plots as enrich_plot pd.set_option("display.max_rows", 10) # rows shown when pretty-printing """ Explanation: Selecting variants by input library count...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/end_to_end_ml/labs/serving_babyweight.ipynb
apache-2.0
%%bash # Check your project name export PROJECT=$(gcloud config list project --format "value(core.project)") echo "Your current GCP Project Name is: "$PROJECT import os os.environ["BUCKET"] = "your-bucket-id-here" # Recommended: use your project name """ Explanation: Building an App Engine app to serve ML prediction ...
rabernat/pyqg
docs/examples/layered.ipynb
mit
import numpy as np from numpy import pi from matplotlib import pyplot as plt %matplotlib inline import pyqg from pyqg import diagnostic_tools as tools """ Explanation: Fully developed baroclinic instability of a 3-layer flow End of explanation """ L = 1000.e3 # length scale of box [m] Ld = 15.e3 # def...
staeiou/reddit_downvote
games/games-analysis.ipynb
mit
!ls !pip install bokeh import pandas as pd import seaborn as sns from bokeh.charts import TimeSeries, output_file, show %matplotlib inline posts_df = pd.DataFrame.from_csv("reddit_posts_games_201301.csv") posts_df[0:5] posts_df['created'] = pd.to_datetime(posts_df.created_utc, unit='s') posts_df['created_date'] = ...
ga7g08/ga7g08.github.io
_notebooks/2016-03-21-Using-Scipy-KS-test.ipynb
mit
xvals = np.linspace(0, 0.5, 500) args = [0.5, 20] d1 = ss.beta.rvs(args[0], args[1], size=1000) noise = ss.norm.rvs(0.4, 0.1, size=50) d2 = np.append(d1[:len(d1)-len(noise)], noise) fig, (ax1, ax2) = plt.subplots(nrows = 2) ax1.plot(xvals, ss.gaussian_kde(d1).evaluate(xvals), "-k", label="d1") ax1.legend() ...
kubeflow/kfp-tekton-backend
components/gcp/dataproc/submit_sparksql_job/sample.ipynb
apache-2.0
%%capture --no-stderr KFP_PACKAGE = 'https://storage.googleapis.com/ml-pipeline/release/0.1.14/kfp.tar.gz' !pip3 install $KFP_PACKAGE --upgrade """ Explanation: Name Data preparation using SparkSQL on YARN with Cloud Dataproc Label Cloud Dataproc, GCP, Cloud Storage, YARN, SparkSQL, Kubeflow, pipelines, components ...
econchick/pyladies-data
Creating Graphs with Pandas & matplotlib.ipynb
mit
DATA_DIR = "meetup_data" MEMBER_JSON = "pug_members.json" GROUP_DIRS = [d for d in os.listdir(DATA_DIR)] PYLADIES_GROUPS = [] for group in GROUP_DIRS: if os.path.isdir(os.path.join(DATA_DIR, group)): PYLADIES_GROUPS.append(group) def load_group_data(pyladies_group): pyladies_dir = os.path.join(DATA_DIR...
samgoodgame/sf_crime
iterations/.ipynb_checkpoints/Cha_Goodgame_Kao_Moore_W207_Final_Project_updated_08_19_0919-checkpoint.ipynb
mit
# Import relevant libraries: import time import numpy as np import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn import preprocessing from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler from sklearn.naive_bayes import BernoulliNB from sklearn.na...
samstav/scipy_2015_sklearn_tutorial
notebooks/02.2 Supervised Learning - Regression.ipynb
cc0-1.0
x = np.linspace(-3, 3, 100) print(x) y = np.sin(4 * x) + x + np.random.uniform(size=len(x)) plt.plot(x, y, 'o') """ Explanation: Regression In regression we try to predict a continuous output variable. This can be most easily visualized in one dimension. We will start with a very simple toy example. We will create a...
WNoxchi/Kaukasos
FAI_old/conv_test_Asus.ipynb
mit
import theano import os, sys sys.path.insert(1, os.path.join('utils')) from __future__ import print_function, division path = 'data/statefarm/' import utils; reload(utils) from utils import * batch_size=16 vgg = Vgg16() model = vgg.model last_conv_idx = [i for i, l in enumerate(model.layers) if type(l) is Convoluti...
vvishwa/deep-learning
autoencoder/Simple_Autoencoder_Solution.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
limpapud/data_science_tutorials_projects
DataScience_Tutorials/AZ/Pandas_DF_Creation.ipynb
mit
import pandas as pd """ Explanation: Pandas: DataFreym yaratmağın müxtəlif üsulları İlk öncə pandas-da verilənlərin 2D əndazəli forma (sadə dil ilə "cədvəl") daxilində saxlanma vasitəsi və forması olan Dataframe yaratmaqdan başlayaq. Bu dərs tam olaraq müxtəlif mənbələrdən və formalarda əldə edilmiş məlumatı Datafreym...
tpin3694/tpin3694.github.io
machine-learning/effect_of_alpha_on_lasso_regression.ipynb
mit
from sklearn.linear_model import Lasso from sklearn.preprocessing import StandardScaler from sklearn.datasets import load_boston import pandas as pd """ Explanation: Title: Effect Of Alpha On Lasso Regression Slug: effect_of_alpha_on_lasso_regression Summary: The effect of alpha values on lasso regression in Scikit...
jhaber-zz/Charter-school-identities
scripts/analysis_prelim.ipynb
mit
# The keyword categories to help parse website text: mission = ['mission',' vision ', 'vision:', 'mission:', 'our purpose', 'our ideals', 'ideals:', 'our cause', 'cause:', 'goals', 'objective'] curriculum = ['curriculum', 'curricular', 'program', 'method', 'pedagogy', 'pedagogical', 'approach', 'model', 'system', 'stru...
deepfield/ibis
docs/source/notebooks/tutorial/8-More-Analytics-Helpers.ipynb
apache-2.0
import ibis import os hdfs_port = os.environ.get('IBIS_WEBHDFS_PORT', 50070) hdfs = ibis.hdfs_connect(host='quickstart.cloudera', port=hdfs_port) con = ibis.impala.connect(host='quickstart.cloudera', database='ibis_testing', hdfs_client=hdfs) ibis.options.interactive = True """ Explanation: A...
authman/DAT210x
Module4/Module4 - Lab2.ipynb
mit
import math import pandas as pd import matplotlib.pyplot as plt import matplotlib from sklearn import preprocessing # Look pretty... # matplotlib.style.use('ggplot') plt.style.use('ggplot') """ Explanation: DAT210x - Programming with Python for DS Module4- Lab2 End of explanation """ def scaleFeaturesDF(df): ...
DoWhatILove/turtle
programming/python/notebooks/scikit/clustering/document_clustering.ipynb
mit
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com> # Lars Buitinck # License: BSD 3 clause from __future__ import print_function from sklearn.datasets import fetch_20newsgroups from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feat...
carefree0910/MachineLearning
Notebooks/numba/zh-cn/CNN.ipynb
mit
@nb.jit(nopython=True) def jit_conv_kernel2(x, w, rs, n, n_channels, height, width, n_filters, filter_height, filter_width, out_h, out_w): for i in range(n): for j in range(out_h): for p in range(out_w): for q in range(n_filters): for r in range(n_channels): ...
quantumlib/OpenFermion-Cirq
examples/tutorial_2_diagonal_coulomb_trotter.ipynb
apache-2.0
import openfermion # Set parameters of jellium model. wigner_seitz_radius = 5. # Radius per electron in Bohr radii. n_dimensions = 2 # Number of spatial dimensions. grid_length = 2 # Number of grid points in each dimension. spinless = True # Whether to include spin degree of freedom or not. n_electrons = 2 # Number of...
mne-tools/mne-tools.github.io
dev/_downloads/9253528f5ba1c240d3397da64c84a625/90_phantom_4DBTi.ipynb
bsd-3-clause
# Authors: Alex Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import os.path as op import numpy as np from mne.datasets import phantom_4dbti import mne """ Explanation: 4D Neuroimaging/BTi phantom dataset tutorial Here we read 4DBTi epochs data obtained with a spherical phantom using four different...
tensorflow/tfx
docs/tutorials/transform/simple.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...
statsmodels/statsmodels.github.io
v0.12.2/examples/notebooks/generated/statespace_structural_harvey_jaeger.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from IPython.display import display, Latex """ Explanation: Detrending, Stylized Facts and the Business Cycle In an influential article, Harvey and Jaeger (1993) described the use of unobserved comp...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/automl/sdk_automl_tabular_regression_online_bq.ipynb
apache-2.0
import os # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex AI SDK: AutoML training tabular regression model for online prediction using BigQuery <t...
OSGeoLabBp/tutorials
english/data_processing/lessons/nmea.ipynb
cc0-1.0
with open('nmea1.txt') as fp: i = 0 for line in fp: i += 1 print(i) with open('nmea1.txt') as fp: print(len(fp.readlines())) # readlines function reads the whole file into a list line by line """ Explanation: <a href="https://colab.research.google.com/github/OSGeoLabBp/tutorials/blob/master/english/data_...