repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
nicoguaro/FEM_resources | variational/circular_membrane.ipynb | mit | from __future__ import division, print_function
import numpy as np
from sympy import *
from sympy.plotting import plot3d
from scipy.linalg import eigh
from scipy.special import jn_zeros as Jn_zeros, jn as Jn
import matplotlib.pyplot as plt
init_session()
%matplotlib inline
plt.style.use("seaborn-notebook")
"""
Explan... |
paulovn/ml-vm-notebook | vmfiles/IPNB/Examples/b Graphics/30 Seaborn.ipynb | bsd-3-clause | # The imports
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="darkgrid")
"""
Explanation: Seaborn graphics
Seaborn is a Python library with "a high-level interface for drawing attractive statistical graphics". This notebook includes some ... |
diegocavalca/Studies | books/deep-learning-with-python/5.1-introduction-to-convnets.ipynb | cc0-1.0 | from keras import layers
from keras import models
model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64... |
harmsm/pythonic-science | chapters/00_inductive-python/key/05_lists_key.ipynb | unlicense | some_list = [10,20,30]
print(some_list[2])
some_list = [10,20,30]
print(some_list[0])
some_list = [10,20,30]
print(some_list[-1])
"""
Explanation: Lists
Lists are objects that let you hold on to multiple values at once in a sane and organized fashion.
Introduction
Lists are ordered collections of objects. Objects i... |
psiq/gdsfactory | notebooks/05_sparameters.ipynb | mit | # NBVAL_SKIP
import pp
pp.sp.plot(pp.c.mmi1x2(), keys=['S23m', 'S13m'], logscale=True)
"""
Explanation: Sparameters
gdsfactory provides you with a Lumerical FDTD interface to calculate Sparameters
by default another repo gdslib stores the Sparameters
You can chain the Sparameters to calculate solve of larger
circuit... |
jdvelasq/ingenieria-economica | 11-analisis.ipynb | mit | import cashflows as cf
cflo = cf.cashflow(const_value=[-1000, 400, 360, 320, 280, 240], start=2000)
cflo
## valor presente neto
cf.timevalue(cflo = cflo,
prate = cf.interest_rate([10]*6, start=2000))
## valor futuro neto
cf.timevalue(cflo = cflo,
prate = cf.interest_rate([10]*6, start=200... |
sisnkemp/deep-learning | 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... |
ctzhu/Python_Data_Wrangling | Challenge01.ipynb | cc0-1.0 | # How to read the 'Temp_116760.csv' file?
df_temp.tail()
# How to read the 'Prcp_116760.csv' file and make its index datetime dtype?
df_prcp.head()
# and I want the index to be of date-time, rather than just strings
df_prcp.index.dtype
"""
Explanation: Data Wrangling with Pandas
The are two datasets in CSV format... |
cmmorrow/sci-analysis | docs/bivariate.ipynb | mit | import numpy as np
import scipy.stats as st
from sci_analysis import analyze
%matplotlib inline
# Create x-sequence and y-sequence from random variables.
np.random.seed(987654321)
x_sequence = st.norm.rvs(2, size=2000)
y_sequence = np.array([x + st.norm.rvs(0, 0.5, size=1) for x in x_sequence])
"""
Explanation: Biva... |
ekansa/open-context-jupyter | notebooks/Open Context Measurements.ipynb | mit | # This imports the OpenContextAPI from the api.py file in the
# opencontext directory.
%run '../opencontext/api.py'
"""
Explanation: Open Context Zooarchaeology Measurements
This code gets meaurement data from Open Context to hopefully do some interesting things.
In the example given here, we're retrieving zooarchaeol... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/dev/.ipynb_checkpoints/n02_separating_the_test_set-checkpoint.ipynb | mit | # Basic imports
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
import scipy.optimize as spo
import sys
%matplotlib inline
%pylab inline
pylab.rcParams['figure.figsize'] = (20.0, 10.0)
%load_ext autoreload
%autoreload 2
sys.path.append('../')
"""
Explanation: ... |
mne-tools/mne-tools.github.io | 0.19/_downloads/82590448493c884f52ea0c7ddc5b446b/plot_publication_figure.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Daniel McCloy <dan.mccloy@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable, ImageGrid
import mne
"""
Explanation: Make figures more public... |
mldbai/mldb | container_files/demos/Exploring Favourite Recipes.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection("http://localhost/")
"""
Explanation: Exploring Favourite Recipes
Recipe websites allow you to bookmark certain recipes as "favourites". A student named Jeremy Cohen pulled together a sample of such data for an excellent machine learning project and we'll use his dataset... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_brainstorm_phantom_elekta.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import mne
from mne import find_events, fit_dipole
from mne.datasets.brainstorm import bst_phantom_elekta
from mne.io import read_raw_fif
print(__doc__)
"""
Explanation: Brainstorm Elekta phantom tut... |
dib-lab/SSUsearch | notebooks-pc-linux/ssu-search-Copy1.ipynb | bsd-3-clause | cd ~/Desktop/SSUsearch/
mkdir -p ./workdir
#check seqfile files to process in data directory (make sure you still remember the data directory)
!ls ./data/test/data
"""
Explanation: Set up working directory
End of explanation
"""
Seqfile='./data/test/data/1c.fa'
"""
Explanation: README
This part of pipeline search... |
mne-tools/mne-tools.github.io | 0.19/_downloads/7b0095430c62d9ef92be2dd3af2614f6/plot_30_annotate_raw.ipynb | bsd-3-clause | import os
from datetime import datetime
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)
raw.crop(tmax=60).... |
loujine/musicbrainz-dataviz | 21-discogs_alignment.ipynb | mit | import xml.etree.cElementTree as ET # better for files > 1Gb
#import lxml.etree as ET
parser = ET.iterparse('./discogs_20180401_labels.xml')
for _, item in parser:
if item.tag != 'label':
continue
# print()
# print(item.text)
# print(item.items())
# print(item.getchildren())
# if item.... |
vallis/libstempo | demo/libstempo-toasim-demo.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
from __future__ import print_function
import sys
import numpy as N
import libstempo as T
import libstempo.plot as LP, libstempo.toasim as LT
T.data = T.__path__[0] + '/data/' # example files
print("Python version :",sys.version.split()[0])
print("l... |
luizhsda10/Data-Science-Projectcs | Machine Learning/NLP - Natural Language Processing/NLP (Natural Language Processing) with Python.ipynb | mit | # ONLY RUN THIS CELL IF YOU NEED
# TO DOWNLOAD NLTK AND HAVE CONDA
# WATCH THE VIDEO FOR FULL INSTRUCTIONS ON THIS STEP
# Uncomment the code below and run:
# !conda install nltk #This installs nltk
# import nltk # Imports the library
# nltk.download() #Download the necessary datasets
"""
Explanation: <a href='http... |
madarivi/QuantumDynamics | Notebook/.ipynb_checkpoints/nanowire-checkpoint.ipynb | mit | MoocVideo("GQLfs4i22ms", src_location="2.1-intro")
"""
Explanation: Table of Contents
From Kitaev model to an experiment
Small parameters
The need for spin
Realistic superconducting pairing
Important and useful basis change.
s-wave superconductor with magnetic field
Problem with singlets
How to ... |
Juanlu001/poliastro | docs/source/examples/Going to Mars with Python using poliastro.ipynb | mit | import numpy as np
import astropy.units as u
from astropy import time
from poliastro import iod
from poliastro.bodies import Earth, Mars, Sun
from poliastro.ephem import Ephem
from poliastro.twobody import Orbit
from poliastro.maneuver import Maneuver
from poliastro.util import time_range
import plotly.io as pio
pio... |
BrainIntensive/OnlineBrainIntensive | resources/nipype/nipype_tutorial/notebooks/basic_model_specification.ipynb | mit | from nipype.interfaces.base import Bunch
conditions = ['faces', 'houses', 'scrambled pix']
onsets = [[0, 30, 60, 90],
[10, 40, 70, 100],
[20, 50, 80, 110]]
durations = [[3], [3], [3]]
subject_info = Bunch(conditions=conditions,
onsets=onsets,
durations=dur... |
gcgruen/homework | foundations-homework/05/homework-05-gruen-nyt.ipynb | mit | #API Key: 0c3ba2a8848c44eea6a3443a17e57448
import requests
bestseller_response = requests.get('http://api.nytimes.com/svc/books/v2/lists/2009-05-10/hardcover-fiction?api-key=0c3ba2a8848c44eea6a3443a17e57448')
bestseller_data = bestseller_response.json()
print("The type of bestseller_data is:", type(bestseller_data))
p... |
mne-tools/mne-tools.github.io | 0.20/_downloads/1947e3859a9ecfd32afbd0018a48f74d/plot_cluster_stats_evoked.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.stats import permutation_cluster_test
from mne.datasets import sample
print(__doc__)
"""
Explanation: Permutation F-test on sensor data with 1D cluster level... |
ernestyalumni/MLgrabbag | deep-learning--ud730/Lessons/1_notmnist.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 matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
biosustain/cameo-notebooks | Advanced-SynBio-for-Cell-Factories-Course/Production vs. Growth.ipynb | apache-2.0 | import pandas
pandas.options.display.max_rows = 12
from cameo import models, phenotypic_phase_plane
"""
Explanation: Growth vs. Yield
Load a few packages.
End of explanation
"""
model = models.bigg.e_coli_core.copy()
"""
Explanation: Load a model E. coli central carbon metabolism.
End of explanation
"""
result = ... |
deepmind/mc_gradients | monte_carlo_gradients/variance_numerical_integration.ipynb | apache-2.0 | import numpy as np
import scipy.stats
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
sns.set_context('paper', font_scale=2.0, rc={'lines.linewidth': 2.0})
sns.set_style('whitegrid')
# We use INTEGRATION_LIMIT instead of infinity in integration limits
INTEGRATION_LIMIT = 10.
# Threshold for t... |
mne-tools/mne-tools.github.io | 0.17/_downloads/99e8a7413b1277c668065b7630324d3b/plot_sensors_time_frequency.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequency import tfr_morlet, psd_multitaper
from mne.datasets import somato
"""
Explanation: Frequency and time-frequency sensors analysis
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequ... |
phenology/infrastructure | applications/notebooks/romulo/co_clustering.ipynb | apache-2.0 | #Add all dependencies to PYTHON_PATH
import sys
sys.path.append("/usr/lib/spark/python")
sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip")
sys.path.append("/usr/lib/python3/dist-packages")
#Define environment variables
import os
os.environ["HADOOP_CONF_DIR"] = "/etc/hadoop/conf"
os.environ["PYSPARK_PYTH... |
AllenDowney/ModSim | python/soln/chap01.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/'
... |
vbsteja/code | Python/ML_DL/DL/Neural-Networks-Demystified-master/Part 2 Forward Propagation.ipynb | apache-2.0 | from IPython.display import YouTubeVideo
YouTubeVideo('UJwK6jAStmg')
"""
Explanation: <h1 align = 'center'> Neural Networks Demystified </h1>
<h2 align = 'center'> Part 2: Forward Propagation </h2>
<h4 align = 'center' > @stephencwelch </h4>
End of explanation
"""
#Import code from last time
%pylab inline
from part... |
gronnbeck/udacity-deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
synthicity/activitysim | activitysim/examples/example_estimation/notebooks/07_mand_tour_freq.ipynb | agpl-3.0 | import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
"""
Explanation: Estimating Mandatory Tour Frequency
This notebook illustrates how to re-estimate a single model component for ActivitySim. This process
includes running ActivitySim in estimation mode to read household... |
jcharit1/Amazon-Fine-Foods-Reviews | code/model_building_part_2.ipynb | mit | import os
import pandas as pd
import numpy as np
import scipy as sp
import seaborn as sns
import matplotlib.pyplot as plt
import json
from IPython.display import Image
from IPython.core.display import HTML
retval=os.chdir("..")
clean_data=pd.read_pickle('./clean_data/clean_data.pkl')
clean_data.head()
kept_cols=['h... |
psychemedia/ou-robotics-vrep | robotVM/notebooks/Demo - linetracer.ipynb | apache-2.0 | %run 'Set-up.ipynb'
%run 'Loading scenes.ipynb'
#The following magic command allows us to embed dynamically created charts in the notebook
%matplotlib inline
%run 'vrep_models/lineTracer.ipynb'
"""
Explanation: Grey Lines Light Logging Demo
The scene defined for this activity includes:
the LineTracer robot with a d... |
bosscha/alma-calibrator | notebooks/2mass/12_environment.ipynb | gpl-2.0 | #obj = ["3C 454.3", 343.49062, 16.14821, 1.0]
obj = ["PKS J0006-0623", 1.55789, -6.39315, 1.0]
#obj = ["M87", 187.705930, 12.391123, 1.0]
#### name, ra, dec, radius of cone
obj_name = obj[0]
obj_ra = obj[1]
obj_dec = obj[2]
cone_radius = obj[3]
obj_coord = coordinates.SkyCoord(ra=obj_ra, dec=obj_dec, unit=(u.deg,... |
feststelltaste/software-analytics | demos/20191119_rheinJUG_Duesseldorf/Architecture Governance Example.ipynb | gpl-3.0 | %load_ext cypher
"""
Explanation: Introduction
Software architects have to make sure that the communicated software architecture blueprints exist in the real world. For this, manual inspections as well as automated measurements are needed to avoid surprises.
In this notebook, I want to show how software architects can... |
ssunkara1/bqplot | examples/Marks/Pyplot/Image.ipynb | apache-2.0 | import os
import ipywidgets as widgets
import bqplot.pyplot as plt
from bqplot import *
image_path = os.path.abspath('../data_files/trees.jpg')
with open(image_path, 'rb') as f:
raw_image = f.read()
ipyimage = widgets.Image(value=raw_image, format='jpg')
ipyimage
"""
Explanation: The Image Mark
Image is a Mark ... |
kunaltyagi/SDES | notes/python/p_norvig/word/Fred Buns.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
from __future__ import division, print_function
from collections import Counter, defaultdict
import itertools
import random
random.seed(42)
"""
Explanation: <div style="float:right"><i>Peter Norvig, 15 June 2015</i></div>
Let's Code About Bike Locks
The June 15, 201... |
CUBoulder-ASTR2600/lectures | lecture_18_dicts_strings.ipynb | isc | cityList = ['Oslo', 'London', 'Paris']
tempList = [13, 15.4, 17.5]
"""
Explanation: Dictionaries
A dictionary is a way to store data. It uses a key (usually text like a word or a number) that points to a value. Think of a real dictionary. You look up a word (the key) in the dictionary to find the definition (the value... |
DoWhatILove/turtle | programming/python/notebooks/scikit/clustering/plot_calibration.ipynb | mit | print(__doc__)
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Balazs Kegl <balazs.kegl@gmail.com>
# Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD Style.
import numpy as np
import matplotlib.pyplot as plt
from... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-hh/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-hh', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-HH
Sub-Topics: Radiative Forcings.
Propert... |
DSSG2017/florence | dev/notebooks/FirenzeCard_PathAnalysis_MM-1.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from pylab import *
import igraph as ig # Need to install this in your virtual environment
import psycopg2
from re import sub
import editdist... |
araichev/affordability_nz | notebooks/prepare_geodata.ipynb | mit | # 2001 census area units
path = hp.DATA_DIR/'collected'/'Geographical Table.csv'
f = pd.read_csv(path, dtype={'SAU': str})
f = f.rename(columns={
'SAU': 'au2001',
'SAU.Desc': 'au_name',
'TA': 'territory',
'Region': 'region',
})
del f['Water']
f.head()
# rental area units
path = hp.DATA_DIR/'collected... |
herdiansc/gender_by_mm | gender_classification_by_keras.ipynb | mit | import numpy
import os
import pydot
import graphviz
"""
Explanation: Gender Classification with Keras
This is an experimentation on gender classification using neural network with keras. The classification will be done by building neural network model based on music and movie preferences.
This is an experimentation of... |
bjodah/pyodesys | examples/van_der_pol_interpolation.ipynb | bsd-2-clause | from __future__ import division, print_function
import itertools
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
from pyodesys.symbolic import SymbolicSys
sp.init_printing()
%matplotlib inline
print(sp.__version__)
"""
Explanation: Van der Pol oscillator
We will look at the second order different... |
phoebe-project/phoebe2-docs | 2.3/examples/backends_compare_legacy_jktebop_ellc.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Comparing jktebop and ellc to PHOEBE
In this example script, we'll reproduce Figure 6 from the fitting release paper (Conroy et al. 2020).
<img src="http://phoebe-project.org/images/figures/2020Conroy+_fig6.png" alt="Figure 6" width="800px"/>
Let's first make sure w... |
AllenDowney/ThinkBayes2 | soln/combinatorics.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 and create directories
import os
if not os.path.exists('utils.py'):
!wget https://github.com/AllenDowney/Th... |
bkoz37/labutil | samples/lab1_samples/Ase-structure.ipynb | mit | from ase.spacegroup import crystal
a = 4.5
Na_unitcell = crystal('Na', [(0,0,0)], spacegroup=229, cellpar=[a, a, a, 90, 90, 90])
print('hello')
"""
Explanation: Making and manipulating structures with ASE
For preparing and manipulating crystal structures we will be using the ASE Python library. The documentation is ... |
pierre-rouanet/jupyter-notebook2.0 | Notebook2.0.ipynb | gpl-3.0 | from ipywidgets import interact, fixed
@interact(x=True, y=1.0, z=fixed(20))
def g(x, y, z):
return (x, y, z)
from ipywidgets import interact, fixed
@interact(x={'one': 10, 'two': 20}, y=(-1.0, 10.0, 2.5))
def g(x, y):
return (x, y)
"""
Explanation: Some cool features that you can use with jupyter notebooks... |
tensorflow/docs-l10n | site/zh-cn/hub/tutorials/action_recognition_with_tf_hub.ipynb | apache-2.0 | # 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... |
jupyter-widgets/ipywidgets | docs/source/examples/Output Widget.ipynb | bsd-3-clause | import ipywidgets as widgets
"""
Explanation: Index - Back - Next
Output widgets: leveraging Jupyter's display system
End of explanation
"""
out = widgets.Output(layout={'border': '1px solid black'})
out
"""
Explanation: The Output widget can capture and display stdout, stderr and rich output generated by IPython. ... |
tensorflow/tensor2tensor | tensor2tensor/notebooks/asr_transformer.ipynb | apache-2.0 | problem_name = "librispeech_clean"
asr_problem = problems.problem(problem_name)
encoders = asr_problem.feature_encoders(None)
model_name = "transformer"
hparams_set = "transformer_librispeech_tpu"
hparams = trainer_lib.create_hparams(hparams_set,data_dir=data_dir, problem_name=problem_name)
asr_model = registry.model... |
scotthuang1989/Python-3-Module-of-the-Week | filesystem/io.ipynb | apache-2.0 |
output.write('This goes into the buffer. ')
print('And so does this.', file=output)
# Retrieve the value written
print(output.getvalue())
output.close() # discard buffer memory
# Initialize a read buffer
input = io.StringIO('Inital value for read buffer')
# Read from the buffer
print(input.read())
"""
Explanatio... |
simpeg/simpegmt | notebooks/MT Script-3D_twoHalfspace-simpegMT.ipynb | mit | %%time
es_px = Ainv*rhs_px
es_py = Ainv*rhs_py
# Need to sum the ep and es to get the total field.
e_x = es_px #+ ep_px
e_y = es_py #+ ep_py
"""
Explanation: We are using splu in scipy package. This is bit slow, but on the cluster you can use mumps, which might a lot faster. We can think about having better iterative... |
GoogleCloudPlatform/bigquery-notebooks | notebooks/community/analytics-componetized-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... |
econ-ark/HARK | examples/Interpolation/CubicInterp.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import CubicHermiteSpline
from HARK.interpolation import CubicInterp, CubicHermiteInterp
"""
Explanation: Cubic Interpolation with Scipy
End of explanation
"""
x = np.linspace(0, 10, num=11, endpoint=True)
y = np.cos(-(x ** 2) / 9.0)
dydx = 2... |
eds-uga/csci1360e-su17 | lectures/L10.ipynb | mit | li = ["this", "is", "a", "list"]
print(li)
print(li[1:3]) # Print element 1 (inclusive) to 3 (exclusive)
print(li[2:]) # Print element 2 and everything after that
print(li[:-1]) # Print everything BEFORE element -1 (the last one)
"""
Explanation: Lecture 10: Array Indexing, Slicing, and Broadcasting
CSCI 1360E: Fo... |
JungeAlexander/dl | chapter10_rnn.ipynb | mit | import numpy as np
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Dropout, Embedding, LSTM, Bidirectional
from keras.datasets import imdb
from keras.utils import plot_model
"""
Explanation: Recurrent neural networks (RNNs) in keras
Examples: https://github... |
diego0020/va_course_2015 | AstroML/notebooks/04_iris_clustering.ipynb | mit | # make sure ipython inline mode is activated
%pylab inline
# all of this is taken from the notebook '03_iris_dimensionality.ipynb'
from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import pylab as pl
from itertools import cycle
iris = load_iris()
X = iris.data
y = iris.target
pca = PCA(n_... |
femtotrader/pyfolio | pyfolio/examples/bayesian.ipynb | apache-2.0 | %matplotlib inline
import pyfolio as pf
"""
Explanation: Bayesian performance analysis example in pyfolio
There are also a few more advanced (and still experimental) analysis methods in pyfolio based on Bayesian statistics.
The main benefit of these methods is uncertainty quantification. All the values you saw above,... |
kubeflow/examples | digit_recognition/digit-recognizer-kfp-pipeline.ipynb | apache-2.0 | !pip install --user --upgrade pip
!pip install kfp --upgrade --user --quiet
# confirm the kfp sdk
! pip show kfp
"""
Explanation: Digit Recognizer Kubeflow Pipeline
In this Kaggle competition
MNIST ("Modified National Institute of Standards and Technology") is the de facto “hello world” dataset of computer vision.... |
kbennion/foundations-hw | scraping_form_submissions.ipynb | mit | # Grab the NYT's homepage
response = requests.get("http://nytimes.com")
doc = BeautifulSoup(response.text)
# Snag all of the headlines (h3 tags with 'story-heading' class)
headlines = doc.find_all("h3", {'class': 'story-heading'})
# Getting the headline text out using list comprehensions
# is a lot more fun but I gues... |
chapmanbe/nlm_clinical_nlp | BasicSentenceMarkup.ipynb | mit | import pyConTextNLP.pyConTextGraph as pyConText
import pyConTextNLP.itemData as itemData
import networkx as nx
"""
Explanation: Demonstration of Basic Sentence Markup with pyConTextNLP
pyConTextNLP uses NetworkX directional graphs to represent the markup: nodes in the graph will be the concepts that are identified in ... |
eriksalt/jupyter | Python Quick Reference/Tuples.ipynb | mit | # Create a tuple directly
digits = (0, 1, 'two')
digits
# Create a tuple from a list
digits = tuple([0, 1, 'two'])
digits
# For a single item tuple, a trailing comma is required to tell the intepreter its a tuple
zero = (0,)
zero
"""
Explanation: Python Tuples Reference
Table of contents
<a href="#1.-Creation">Crea... |
BrentDorsey/pipeline | gpu.ml/notebooks/05_Train_Model_Distributed_CPU.ipynb | apache-2.0 | import tensorflow as tf
cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]})
"""
Explanation: Train Model on Distributed Cluster
IMPORTANT: You Must STOP All Kernels and Terminal Session
The GPU is wedged at this point. We need to set it free!!
Define ClusterSpec
End of explanation
"""
... |
google/flax | docs/notebooks/full_eval.ipynb | apache-2.0 | !pip install -q chex einops
# tfds.split_for_jax_process() was added in 4.5.1
!pip install -q tensorflow_datasets -U
# flax.jax_utils.pad_shard_unpad() is only available at HEAD
!pip install -q git+https://github.com/google/flax
import collections
import chex
import einops
import jax
import jax.numpy as jnp
import fl... |
claudiuskerth/PhDthesis | Data_analysis/SNP-indel-calling/dadi/05_2D_models_synthesis.ipynb | mit | import numpy
import sys
sys.path.insert(0, '/home/claudius/Downloads/dadi')
import dadi
from glob import glob
import dill
from utility_functions import *
import pandas as pd
import numpy as np
# turn on floating point division by default, old behaviour via '//'
from __future__ import division
# import 2D unfolded ... |
fvnts/finitedifference | notebooks/sp.ipynb | gpl-3.0 | # --------------------/
%matplotlib inline
# --------------------/
import math
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
from scipy import *
from ipywidgets import *
"""
Explanation: <h1> Quiescent SP </h1>
Quiescent Schrödinger–Poisson initial value problem
\begin{equation}
\left{ \be... |
MidnightPolaris/gtsdb_cnn | GTSDB/GTSDB_RPN_Train.ipynb | mit | import keras
from keras.models import Model, Sequential
from keras.layers import Activation, Dropout, Flatten, Dense, Input
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from keras.layers.merge import Concatenate
from keras.callbacks import ProgbarLogger, ModelCheckpoint, T... |
wasit7/PythonDay | notebook/.ipynb_checkpoints/02 Learn to Code with Python-checkpoint.ipynb | bsd-3-clause | from tutor import check
print('Hello, World!')
# This is a comment, it isn't run as code, but often they are helpful
"""
Explanation: <a href="http://nbviewer.ipython.org/urls/bitbucket.org/amjoconn/watpy-learning-to-code-with-python/raw/3441274a54c7ff6ff3e37285aafcbbd8cb4774f0/notebook/Learn%20to%20Code%20with%20Pyth... |
nproctor/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
from math import sqrt
def soliton(x, t, c, a):
# make x and t arrays (... |
pinga-lab/magnetic-ellipsoid | code/comparison_triaxial_sphere.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
from fatiando import gridder, utils
from fatiando.gravmag import sphere
from fatiando.mesher import Sphere
import triaxial_ellipsoid
from mesher import Triaxial... |
JDFagan/InterviewInPython | interviewcake/stocks_greedy.ipynb | mit | def get_max_profit(stock_prices_yesterday):
max_profit = 0
# go through every time
for outer_time in xrange(len(stock_prices_yesterday)):
# for every time, go through every OTHER time
for inner_time in xrange(len(stock_prices_yesterday)):
# for each pair, find the earlier and... |
NathanYee/ThinkBayes2 | code/report04.ipynb | gpl-2.0 | from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import math
import numpy as np
from thinkbayes2 import Pmf, Cdf, Suite, Joint, EvalNormalPdf, MakeNormalPmf, MakeMixture
import thinkplot
import matplotlib.pyplot as plt
import pandas as pd
"""
Exp... |
jeffzhengye/pylearn | tensorflow_learning/tf2/notebooks/.ipynb_checkpoints/understanding_masking_and_padding-checkpoint.ipynb | unlicense | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
"""
Explanation: Understanding masking & padding
Authors: Scott Zhu, Francois Chollet<br>
Date created: 2019/07/16<br>
Last modified: 2020/04/14<br>
Description: Complete guide to using mask-aware sequence layer... |
vravishankar/Jupyter-Books | Tuples.ipynb | mit | t1 = (1,2,3)
type(t1)
# Tuples can contain mixed object types
t2 = (1,'two',['three','four','five'],{'key':'value'})
print(type(t2))
t2
t2[0]
t2[2][2]
t2[3]['key']
t3 = (1)
t3
t3 = (1,2,3)
t4 = ('a','b')
t3 + t4
t3 * 5
"""
Explanation: Tuples
Tuples can contain an array of objects but they are immutable meaning... |
LorenzoBi/courses | CQD/.ipynb_checkpoints/Project-checkpoint.ipynb | mit | from pylab import *
from copy import deepcopy
from matplotlib import animation, rc
from IPython.display import HTML
%matplotlib inline
rc('text', usetex=True)
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 15}
matplotlib.rc('font', **font)
"""
Explanation: Computational Quantum Dynamics
(... |
mdeff/ntds_2017 | projects/reports/movie_success/TreatAll.ipynb | mit | %matplotlib inline
import configparser
import os
import requests
from tqdm import tqdm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import sparse, stats, spatial
import scipy.sparse.linalg
from sklearn import preprocessing, decomposition
import librosa
import IPython.display as ip... |
qinwf-nuan/keras-js | notebooks/layers/pooling/MaxPooling3D.ipynb | mit | data_in_shape = (4, 4, 4, 2)
L = MaxPooling3D(pool_size=(2, 2, 2), strides=None, padding='valid', data_format='channels_last')
layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
np.random.seed(290)
data_in = 2... |
HackyHour/Goettingen | files/02_HackyHour_2017-03-14/hackyhour-notebook.ipynb | cc0-1.0 | #comments and numbers work normally
1 + 1
#strings too
s = 'hello hacky people'
s
#variables can be assigned and will be known to all cells below this one
a,b = (10,10)
#output without print-statement only works if at the end of a cell
print(a+b)
#functions and classes can be defined like normal
def MyFunction(a,b)... |
mne-tools/mne-tools.github.io | 0.17/_downloads/5c761b4eaf61d9e6642d568c8bc535a2/plot_source_power_spectrum.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, compute_source_psd
print(__doc__)
"""
Explanation: Compute power spect... |
DataPilot/notebook-miner | summary_of_work/9. Bottom Up Exploration.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 = ... |
dmnfarrell/mhcpredict | examples/cockroach.ipynb | apache-2.0 | import os, math, time, pickle, subprocess
from importlib import reload
from collections import OrderedDict
import numpy as np
import pandas as pd
pd.set_option('display.width', 130)
import epitopepredict as ep
from epitopepredict import base, sequtils, plotting, peptutils, analysis
from IPython.display import display, ... |
oditorium/blog | iPython/BayesVsFreq-PartII-Gauss.ipynb | agpl-3.0 | b.mu1 = 5
b.sig1 = 1
b.mu2 = 5
b.sig2 = 1
b.draw()
"""
Explanation: Frequentist vs Bayesian statistics - Part II
We know that in a Bayesian setting the probability of our hypothesis conditional on our data is
$$
P(H|D) \propto P(D|H) \times P(H)
$$
where $P(H)$ is the prior, and $P(D|H)$ is the probability of our data... |
quoniammm/mine-tensorflow-examples | fastAI/deeplearning1/nbs/imagenet_batchnorm.ipynb | mit | from theano.sandbox import cuda
%matplotlib inline
import utils; reload(utils)
from utils import *
from __future__ import print_function, division
"""
Explanation: This notebook explains how to add batch normalization to VGG. The code shown here is implemented in vgg_bn.py, and there is a version of vgg_ft (our fine... |
boffi/boffi.github.io | dati_2015/01/Resonance.ipynb | mit | def x_2z_over_dst(z):
w = 2*pi
# beta = 1, wn =w
wd = w*sqrt(1-z*z)
# Clough Penzien p. 43
A = z/sqrt(1-z*z)
def f(t):
return (cos(wd*t)+A*sin(wd*t))*exp(-z*w*t)-cos(w*t)
return pl.vectorize(f)
"""
Explanation: Resonant excitation
We want to study the behaviour of an undercritically... |
hglanz/phys202-2015-work | assignments/assignment05/InteractEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 2
Imports
End of explanation
"""
def plot_sine1(a, b, step = .01):
x = np.arange(0.0, 4*np.pi, step)
... |
kingb12/languagemodelRNN | report_notebooks/encdec_noing10_bow_200_512_04dra.ipynb | mit | report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04dra/encdec_noing10_bow_200_512_04dra.json'
log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04dra/encdec_noing10_bow_200_512_04dra_logs.json'
import json
import ... |
constantlearning/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter7_BayesianMachineLearning/DontOverfit.ipynb | mit | import gzip
import requests
import zipfile
url = "https://dl.dropbox.com/s/lnly9gw8pb1xhir/overfitting.zip"
results = requests.get(url)
import StringIO
z = zipfile.ZipFile(StringIO.StringIO(results.content))
# z.extractall()
z.extractall()
z.namelist()
d = z.open('overfitting.csv')
d.readline()
import numpy as ... |
flaxandteal/python-course-lecturer-notebooks | .ipynb_checkpoints/A New Treatment for Arthritis-checkpoint.ipynb | mit | with open('data/inflammation-01.csv', 'r') as f:
snippet = f.readlines()[:3]
print(*snippet)
"""
Explanation: First off, an acknowledgement of the usefulness of the Software Carpentry materials, and particularly data, in preparing this session - this course is not, however, affiliated with or endorsed by the Softw... |
metpy/MetPy | v1.1/_downloads/5e50ab42ac6ec7bf58df35e403f36520/Angle_to_Direction.ipynb | bsd-3-clause | import metpy.calc as mpcalc
from metpy.units import units
"""
Explanation: Angle to Direction
Demonstrate how to convert angles to direction strings.
The code below shows how to convert angles into directional text.
It also demonstrates the function's flexibility.
End of explanation
"""
angle_deg = 70 * units('degr... |
chrisfilo/fmri-analysis-vm | analysis/preprocessing/Preprocessing.ipynb | mit | import os, errno
try:
datadir=os.environ['FMRIDATADIR']
assert not datadir==''
except:
datadir='/Users/poldrack/data_unsynced/myconnectome/sub00001'
print 'Using data from',datadir
%matplotlib inline
from nipype.interfaces import fsl, nipy
import nibabel
import numpy
import nilearn.plotting
import matplot... |
zindy/Imaris | tutorials/pull_surfaces.ipynb | apache-2.0 | sl = s.GetSurfaceDataLayout(0)
print(sl)
"""
Explanation: GetSurfaceDataLayout()
Returns the layout of the surface, that is the : public and the size of the return value of GetData().
!! Due to the sub-pixel resolution of the surfaces, the actual minimum and maximum coordinates of the vertices of the triangulated repr... |
scottquiring/Udacity_Deeplearning | first-neural-network/DLND Your first neural network-TFLearn.ipynb | mit | %matplotlib inline
#%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
"""
Explanation: Your first neural network
In this proj... |
folivetti/PIPYTHON | Aula05.ipynb | mit | lista = list(range(1,11))
print(lista) # [1,2,3,4,5,6,7,8,9,10]
print(lista[0]) # primeiro elemento
print(lista[-1]) # último elemento
print(lista[0:3]) # elemento 0, 1 e 2
print(lista[5:2:-1]) # do 5 ao 3, de -1 em -1
"""
Explanation: Introdução à Programação em Python
Manipulação de Listas
Anteriormente, vimos algun... |
PrACiDa/intro_ciencia_de_datos | 03_Manipulación_de_datos_y_Pandas.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn-darkgrid')
import seaborn as sns
import numpy as np
import pandas as pd # asi se suele importar Pandas
"""
Explanation: Manipulación de datos y Pandas
Este notebook es una traducción y adaptación de esta notebook creada por Christopher Fonnesbe... |
mfouesneau/pyphot | examples/svo.ipynb | mit | %matplotlib inline
import pylab as plt
import numpy as np
import sys
sys.path.append('../')
from pyphot import sandbox as pyphot
from pyphot.svo import get_pyphot_filter as get_filter_from_svo
"""
Explanation: pyphot - Interface with SVO filter profile service
http://svo2.cab.inta-csic.es/theory/fps/
If your researc... |
Kaggle/learntools | notebooks/deep_learning/raw/tut8_dropout_and_strides.ipynb | apache-2.0 | from IPython.display import YouTubeVideo
YouTubeVideo('fwNLf4t7MR8', width=800, height=450)
"""
Explanation: Intro
At the end of this lesson, you will understand and know how to use
- Stride lengths to make your model faster and reduce memory consumption
- Dropout to combat overfitting
Both of these techniques are esp... |
ES-DOC/esdoc-jupyterhub | notebooks/niwa/cmip6/models/ukesm1-0-ll/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'niwa', 'ukesm1-0-ll', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NIWA
Source ID: UKESM1-0-LL
Topic: Ocean
Sub-Topics: Timestepping Framework, Advec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.