repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Vvkmnn/books | ThinkBayes/06_Decision_Analysis.ipynb | gpl-3.0 | from price import *
import matplotlib.pyplot as plt
player1, player2 = MakePlayers(path='../code')
MakePrice1(player1, player2)
plt.legend();
"""
Explanation: Decision Analysis
The Price is Right problem
On November 1, 2007, contestants named Letia and Nathaniel appeared on
The Price is Right, an American game show. T... |
km-Poonacha/python4phd | Session 1/ipython/Lesson 1 - Data and Types-Worksheet.ipynb | gpl-3.0 | print('The first element is: ', c_list[0])
"""
Explanation: Lesson 1: Data and Types
In this lesson we learn about the basic data types and data structures and play with them a little.
Defines the format by which you input data to a program, modify it and output it in the consol
Data types: integer, float, string an... |
jerkos/cobrapy | documentation_builder/building_model.ipynb | lgpl-2.1 | from cobra import Model, Reaction, Metabolite
# Best practise: SBML compliant IDs
cobra_model = Model('example_cobra_model')
reaction = Reaction('3OAS140')
reaction.name = '3 oxoacyl acyl carrier protein synthase n C140 '
reaction.subsystem = 'Cell Envelope Biosynthesis'
reaction.lower_bound = 0. # This is the defaul... |
JoseGuzman/myIPythonNotebooks | Stochastic_systems/Conditional Probability.ipynb | gpl-2.0 | %pylab inline
# conf is a dictionay with the recording configurations
conf ={
'pairs': 495.,
'triplets': 96.,
'quadruples': 135.,
'quintuples': 120.,
'sextuples': 118.,
'septuples': 66.,
'octuples': 72.
}
# syn is a dictionary with the number of connections found
syn ={
... |
nlooije/pythreejs | examples/Examples.ipynb | bsd-3-clause | ball = Mesh(geometry=SphereGeometry(radius=1), material=LambertMaterial(color='red'), position=[2,1,0])
scene = Scene(children=[ball, AmbientLight(color=0x777777), make_text('Hello World!', height=.6)])
c = PerspectiveCamera(position=[0,5,5], up=[0,0,1], children=[DirectionalLight(color='white',
... |
ocean-color-ac-challenge/evaluate-pearson | evaluation-participant-a.ipynb | apache-2.0 | w_412 = 0.56
w_443 = 0.73
w_490 = 0.71
w_510 = 0.36
w_560 = 0.01
"""
Explanation: E-CEO Challenge #3 Evaluation
Weights
Define the weight of each wavelength
End of explanation
"""
run_id = '0000000-150625115710650-oozie-oozi-W'
run_meta = 'http://sb-10-16-10-55.dev.terradue.int:50075/streamFile/ciop/run/participant-... |
deep-learning-indaba/practicals2017 | practical3.ipynb | mit | # Import TensorFlow and some other libraries we'll be using.
import datetime
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# Import Matplotlib and set some defaults
from matplotlib import pyplot as plt
plt.ioff()
%matplotlib inline
plt.rcParams['figure.figsize']... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a/td2a_cenonce_session_2A.ipynb | mit | %matplotlib inline
from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.data - Calcul Matriciel, Optimisation
numpy arrays sont la première chose à considérer pour accélérer un algorithme. Les matrices sont présentes dans la plupart des algorithmes et numpy optimise les opérations qui s... |
timstaley/voeventdb | notebooks/notes_on_scoped_session.ipynb | gpl-2.0 | # sm.query(Voevent).count() #<--Raises
"""
Explanation: A sessionmaker does not have a query property - we don't expect it to, after all it's for making sessions, not queries:
End of explanation
"""
regular_session = sm()
regular_session.query(Voevent).count()
"""
Explanation: So, make a session:
End of explanation... |
jamesfolberth/NGC_STEM_camp_AWS | notebooks/data8_notebooks/project1/project1.ipynb | bsd-3-clause | # Run this cell, but please don't change it.
import numpy as np
import math
from datascience import *
# These lines set up the plotting functionality and formatting.
import matplotlib
matplotlib.use('Agg', warn=False)
%matplotlib inline
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
# These lin... |
david-abel/simple_rl | examples/.ipynb_checkpoints/examples_overview-checkpoint.ipynb | apache-2.0 | # Add simple_rl to system path.
import os
import sys
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
sys.path.insert(0, parent_dir)
from simple_rl.agents import QLearningAgent, RandomAgent
from simple_rl.tasks import GridWorldMDP
from simple_rl.run_experiments import run_agents_on_mdp
"""
Explanati... |
arnicas/eyeo_nlp | python/Tokenizing_Stopwords_Freqs.ipynb | cc0-1.0 | import itertools
import nltk
import string
nltk.data.path
nltk.data.path.append("../nltk_data")
nltk.data.path = ['../nltk_data']
"""
Explanation: Intro to low level NLP - Tokenization, Stopwords, Frequencies, Bigrams
Lynn Cherny, arnicas@gmail
End of explanation
"""
ls ../data/books
# the "U" here is for unive... |
cbcoutinho/gravBody2D | AnimationEmbedding.ipynb | gpl-3.0 | %pylab inline
"""
Explanation: Embedding Matplotlib Animations in IPython Notebooks
This notebook first appeared as a
blog post
on
Pythonic Perambulations.
License: BSD
(C) 2013, Jake Vanderplas.
Feel free to use, distribute, and modify with the above attribution.
<!-- PELICAN_BEGIN_SUMMARY -->
I've spent a lot of tim... |
ES-DOC/esdoc-jupyterhub | notebooks/snu/cmip6/models/sandbox-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'snu', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: SNU
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties: 6... |
ZoranPandovski/al-go-rithms | machine_learning/tensorflow/Classification.ipynb | cc0-1.0 | from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
import pandas as pd
CSV_COLUMN_NAMES = ['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth', 'Species']
SPECIES = ['Setosa', 'Versicolor', 'Virginica']
train_path = tf.keras.utils.get_file(
"i... |
radhikapc/foundation-homework | homework_sql/Homework_4-Radhika_graded.ipynb | mit | numbers_str = '496,258,332,550,506,699,7,985,171,581,436,804,736,528,65,855,68,279,721,120'
"""
Explanation: Grade: 10 / 11
Homework #4
These problem sets focus on list comprehensions, string operations and regular expressions.
Problem set #1: List slices and list comprehensions
Let's start with some data. The followi... |
stevetjoa/stanford-mir | exercise_genre_recognition.ipynb | mit | filename_brahms = 'brahms_hungarian_dance_5.mp3'
url = "http://audio.musicinformationretrieval.com/" + filename_brahms
if not os.path.exists(filename_brahms):
urllib.urlretrieve(url, filename=filename_brahms)
"""
Explanation: ← Back to Index
Exercise: Genre Recognition
Goals
Extract features from an audio si... |
arongdari/sparse-graph-prior | notebooks/SimulateSparseGraph.ipynb | mit | from operator import itemgetter
import numpy as np
from scipy.special import gamma
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
from sgp import GGPrnd, BSgraphrnd, GGPgraphrnd
from sgp.GraphUtil import compute_growth_rate, degree_distribution, degree_one_nodes
%matplotlib inline
"""
Explanation:... |
cxhernandez/msmbuilder | examples/Fs-Peptide-command-line.ipynb | lgpl-2.1 | # Work in a temporary directory
import tempfile
import os
os.chdir(tempfile.mkdtemp())
# Since this is running from an IPython notebook,
# we prefix all our commands with "!"
# When running on the command line, omit the leading "!"
! msmb -h
"""
Explanation: Modeling dynamics of FS Peptide
This example shows a typica... |
tpin3694/tpin3694.github.io | python/test_if_an_output_is_close_to_a_value.ipynb | mit | import unittest
import sys
"""
Explanation: Title: Test If Output Is Close To A Value
Slug: test_if_an_output_is_close_to_a_value
Summary: Test if an output is close to a value in Python.
Date: 2016-01-23 12:00
Category: Python
Tags: Testing
Authors: Chris Albon
Interesting in learning more? Here are some good book... |
ioggstream/python-course | python-for-sysadmin/notebooks/01_file_management.ipynb | agpl-3.0 | import os
import os.path
import shutil
import errno
import glob
import sys
"""
Explanation: Path Management
Goal
Normalize paths on different platform
Create, copy and remove folders
Handle errors
Modules
End of explanation
"""
# Be python3 ready
from __future__ import unicode_literals, print_function
"""
Explana... |
marcelomiky/PythonCodes | Coursera/IDSP/Introduction to DS in Python.ipynb | mit | def add_numbers(x,y):
return x+y
a = add_numbers
a(1,2)
x = [1, 2, 4]
x.insert(2, 3) # list.insert(position, item)
x
x = 'This is a string'
print(x[0]) #first character
print(x[0:1]) #first character, but we have explicitly set the end character
print(x[0:2]) #first two characters
x = 'This is a string'
pos ... |
rfinn/LCS | notebooks/galaxies-missing-in-simard11.ipynb | gpl-3.0 | %run ~/Dropbox/pythonCode/LCSanalyzeblue.py
t = s.galfitflag & s.lirflag & s.sizeflag & ~s.agnflag & s.sbflag
galfitnogim = t & ~s.gim2dflag
sum(galfitnogim)
"""
Explanation: Galaxies that are missing from Simard+2011
Summary
* A total of 44 galaxies are not in galfit sample
* 31/44 are not in the SDSS catalog, so t... |
JoseGuzman/myIPythonNotebooks | Dynamic_systems/1st_ODE.ipynb | gpl-2.0 | def diff(p, generation):
"""
Returns the as size of the population as a function of the generation
defined in the following differential equation:
dp/dg = p*(k-p)/tau,
where p is the population size, g is the generation index, k is
the maximal population size (fixed to 1000) and tau a... |
PMEAL/OpenPNM-Examples | PaperRecreations/Wu2010_part_a.ipynb | mit | import openpnm as op
import matplotlib.pyplot as plt
import scipy as sp
import numpy as np
import openpnm.models.geometry as gm
import openpnm.topotools as tt
%matplotlib inline
"""
Explanation: Example: Regenerating Data from
R. Wu et al. / Elec Acta 54 25 (2010) 7394–7403
Import the modules
End of explanation
"""
... |
xpharry/Udacity-DLFoudation | tutorials/tensorboard/Anna KaRNNa.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
flamingbear/ipython-notebooks | notebooks/Sea Ice Min Max Extents.ipynb | mit | !mkdir -p ../data
!wget -P ../data -qN ftp://sidads.colorado.edu/pub/DATASETS/NOAA/G02135/north/daily/data/NH_seaice_extent_final.csv
!wget -P ../data -qN ftp://sidads.colorado.edu/pub/DATASETS/NOAA/G02135/north/daily/data/NH_seaice_extent_nrt.csv
!wget -P ../data -qN ftp://sidads.colorado.edu/pub/DATASETS/NOAA/G02135... |
dato-code/tutorials | dss-2016/recommendation_systems/book-recommender-solutions.ipynb | apache-2.0 | import os
if os.path.exists('books/ratings'):
ratings = gl.SFrame('books/ratings')
items = gl.SFrame('books/items')
users = gl.SFrame('books/users')
else:
ratings = gl.SFrame.read_csv('books/book-ratings.csv')
ratings.save('books/ratings')
items = gl.SFrame.read_csv('books/book-data.csv')
it... |
QuantCrimAtLeeds/PredictCode | notebooks/sepp_2a_testbed.ipynb | artistic-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Crime prediction from Hawkes processes
Here we continue to explore the EM algorithm for Hawkes processes, but now concentrating upon:
Mohler et al. "Randomized Controlled Field Trials of Predictive Policing". Journal of the America... |
gcgruen/homework | foundations-homework/07/homework-07-gruen.ipynb | mit | import pandas as pd
"""
Explanation: Part 1: Animals
1. Import pandas with the right name
End of explanation
"""
import matplotlib as plt
import matplotlib.pyplot as plt
% matplotlib inline
"""
Explanation: 2. Set all graphics from matplotlib to display inline
End of explanation
"""
df = pd.read_csv("07-hw-animal... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/rolling_ls.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pandas_datareader as pdr
import seaborn
import statsmodels.api as sm
from statsmodels.regression.rolling import RollingOLS
seaborn.set_style("darkgrid")
pd.plotting.register_matplotlib_converters()
%matplotlib inline
"""
Explanation: Rolli... |
geoscixyz/gpgLabs | notebooks/dcip/DC_SurveyDataInversion.ipynb | mit | cylinder_app()
"""
Explanation: 1. Understanding currents, fields, charges and potentials
Cylinder app
survey: Type of survey
A: (+) Current electrode location
B: (-) Current electrode location
M: (+) Potential electrode location
N: (-) Potential electrode location
r: radius of cylinder
xc: x location of cylinder... |
ledrui/week4_Ridge_Regression | .ipynb_checkpoints/Overfitting_Demo_Ridge_Lasso-checkpoint.ipynb | mit | import graphlab
import math
import random
import numpy
from matplotlib import pyplot as plt
%matplotlib inline
"""
Explanation: Overfitting demo
Create a dataset based on a true sinusoidal relationship
Let's look at a synthetic dataset consisting of 30 points drawn from the sinusoid $y = \sin(4x)$:
End of explanation
... |
nikbearbrown/Deep_Learning | NEU/Sai_Raghuram_Kothapalli_DL/Autoencoders.ipynb | mit | PATH = "/Users/raghu/Downloads/"
Image(filename = PATH + "autoencoder_schema.jpg", width=500, height=500)
"""
Explanation: Autoencoders
What are Autoencoders?
End of explanation
"""
from keras.layers import Input, Dense
from keras.models import Model
# this is the size of our encoded representations
encoding_dim = ... |
justhalf/jupyter_notebooks | neural_network/CEC-test.ipynb | mit | import math
from IPython.display import Markdown, display
def printmd(string):
display(Markdown(string))
# Embedding
embedding = {}
embedding['a'] = (1.0, 1)
embedding['b'] = (-1, -1)
embedding['('] = (1, 0)
embedding[')'] = (0, 1)
# embedding['a'] = (-1, 0)
# embedding['b'] = (-0.5, 0)
# embedding['('] = (1, 1)... |
tensorflow/docs-l10n | site/en-snapshot/tutorials/distribute/multi_worker_with_estimator.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... |
jorisvandenbossche/geopandas | doc/source/gallery/polygon_plotting_with_folium.ipynb | bsd-3-clause | import geopandas as gpd
import folium
import matplotlib.pyplot as plt
"""
Explanation: Plotting polygons with Folium
This example demonstrates how to plot polygons on a Folium map.
End of explanation
"""
path = gpd.datasets.get_path('nybb')
df = gpd.read_file(path)
df.head()
"""
Explanation: Load geometries
This ex... |
yvesdubief/UVM-ME249-CFD | ME249-Lecture-0.ipynb | gpl-2.0 | %matplotlib inline
# plots graphs within the notebook
%config InlineBackend.figure_format='svg' # not sure what this does, may be default images to svg format
import matplotlib.pyplot as plt #calls the plotting library hereafter referred as to plt
import numpy as np
"""
Explanation: Figure 1. Sketch of a cell (top... |
elan4u/CI-sample | basics.ipynb | gpl-2.0 | # This function will return the Scrabble score of a word
def scrabble_score(word):
#Dictionary of our scrabble scores
score_lookup = {
"a": 1,
"b": 3,
"c": 3,
"d": 2,
"e": 1,
"f": 4,
"g": 2,
"h": 4,
"i": 1,
"j": 8,
"k"... |
jobovy/wendy | examples/WendyScaling.ipynb | mit | def initialize_selfgravitating_disk(N):
totmass= 1.
sigma= 1.
zh= sigma**2./totmass # twopiG = 1. in our units
tdyn= zh/sigma
x= numpy.arctanh(2.*numpy.random.uniform(size=N)-1)*zh*2.
v= numpy.random.normal(size=N)*sigma
v-= numpy.mean(v)
m= numpy.ones_like(x)/N
return (x,v,m,tdyn)
... |
Kyubyong/numpy_exercises | 11_Set_routines.ipynb | mit | import numpy as np
np.__version__
author = 'kyubyong. longinglove@nate.com'
"""
Explanation: Set routines
End of explanation
"""
x = np.array([1, 2, 6, 4, 2, 3, 2])
"""
Explanation: Making proper sets
Q1. Get unique elements and reconstruction indices from x. And reconstruct x.
End of explanation
"""
x = np.a... |
letsgoexploring/beapy-package | .ipynb_checkpoints/beapyExample-checkpoint.ipynb | mit | import numpy as np
import pandas as pd
import urllib
import datetime
import matplotlib.pyplot as plt
%matplotlib inline
%load_ext autoreload
%autoreload 2
import beapy
apiKey = '3EDEAA66-4B2B-4926-83C9-FD2089747A5B'
bea = beapy.initialize(apiKey =apiKey)
"""
Explanation: beapy
beapy is a Python package for obtaining... |
ajgeers/3dracta | data_analysis.ipynb | bsd-2-clause | %matplotlib inline
import os
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
"""
Explanation: Reproducibility of hemodynamic simulations of cerebral aneurysms across imaging modalities 3DRA and CTA
Arjan Geers
This notebook reproduces* the data analysis presented in:
Gee... |
GoogleChromeLabs/dynamic-web-bundle-serving | compression_experiments/js_dataset_compression.ipynb | apache-2.0 | import numpy as np
import json
import matplotlib.pyplot as plt
from tqdm import tqdm
import random
import subprocess
import time
import os
"""
Explanation: Copyright 2020 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); <br>
you may not use this file except in compliance... |
bayesimpact/bob-emploi | data_analysis/notebooks/datasets/bmo/bmo_rome_mapping.ipynb | gpl-3.0 |
import codecs
import os
import pandas as pd
import seaborn as sns
data_path = '../../../data'
"""
Explanation: Author: Valentin Lehuger
Skip the run test because the ROME version has to be updated to make it work in the exported repository. TODO: Update ROME and remove the skiptest flag.
BMO ROME analysis
This note... |
0x4a50/udacity-0x4a50-deep-learning-nanodegree | first-neural-network/Your_first_neural_network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
Leguark/pynoddy | docs/notebooks/Feature-Analysis.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
import sys, os
import matplotlib.pyplot as plt
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of repository to set paths corretly below
rep... |
subhankarb/Machine-Learning-PlayGround | Machine-Learning-Specialization/machine_learning_regression/week2/numpy-tutorial.ipynb | apache-2.0 | import numpy as np # importing this way allows us to refer to numpy as np
"""
Explanation: Numpy Tutorial
Numpy is a computational library for Python that is optimized for operations on multi-dimensional arrays. In this notebook we will use numpy to work with 1-d arrays (often called vectors) and 2-d arrays (often cal... |
wesleybeckner/salty | examples/salty_eScience_chalk_talk.ipynb | mit | import statistics
import requests
import json
import pickle
import salty
import numpy as np
import matplotlib.pyplot as plt
import numpy.linalg as LINA
from scipy import stats
from scipy.stats import uniform as sp_rand
from scipy.stats import mode
from sklearn.linear_model import Lasso
from sklearn.model_selection impo... |
dudektria/notebooks | computational-chemistry/reaction-mechanisms/reaction-mechanisms.ipynb | mit | # Import matplotlib and seaborn (plotting).
# Set parameters for plotting.
%matplotlib inline
import seaborn as sns
sns.set_style("white")
sns.set_context("poster")
sns.set_palette("colorblind", color_codes=True)
"""
Explanation: Things to be done:
1. Calculate Eyring rates between ground and transition states and sto... |
misken/hillmaker | hillmaker/examples/basic_usage_shortstay_unit.ipynb | apache-2.0 | import pandas as pd
import hillmaker as hm
"""
Explanation: Hillmaker - basic usage
In this notebook we'll focus on basic use of Hillmaker for analyzing occupancy in a typical hospital setting. The data is fictitious data from a hospital short stay unit. Patients flow through a short stay unit for a variety of procedu... |
robertoalotufo/ia898 | dev/2017-01-05-RAL+Ferramentas+de+Edicao+HTLM+Notebook.ipynb | mit | from IPython.display import YouTubeVideo
# a talk about IPython at Sage Days at U. Washington, Seattle.
# Video credit: William Stein.
YouTubeVideo('1j_HxD4iLn8')
"""
Explanation: Ferramentas de edição HTML
Este documento ilustra as principais ferramentas para editar o notebook, utilizando células de texto Markdown:
... |
ImAlexisSaez/deep-learning-specialization-coursera | course_1/week_4/assignment_1/building_your_deep_neural_network_step_by_step_v4.ipynb | mit | import numpy as np
import h5py
import matplotlib.pyplot as plt
from testCases_v2 import *
from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['imag... |
tensorflow/docs-l10n | site/en-snapshot/probability/examples/FFJORD_Demo.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
amueller/scipy-2017-sklearn | notebooks/02.Scientific_Computing_Tools_in_Python.ipynb | cc0-1.0 | import numpy as np
# Setting a random seed for reproducibility
rnd = np.random.RandomState(seed=123)
# Generating a random array
X = rnd.uniform(low=0.0, high=1.0, size=(3, 5)) # a 3 x 5 array
print(X)
"""
Explanation: Jupyter Notebooks
You can run a cell by pressing [shift] + [Enter] or by pressing the "play" bu... |
dj2441/Course_NumMethods | InClassAssignment1/error-group-work-template.ipynb | gpl-3.0 | # We can use the formulas you derieved above to calculate the actual numbers
# CODE HERE - Make sure to print out the results
def e_Approx(x):
return (2.718**x)
print("Approximation of e:")
print(e_Approx(1))
#Without using taylor expansion
print("\nHigher precision of e (from numpy):")
print(np.e)
#Absolute Er... |
rishuatgithub/MLPy | torch/PYTORCH_NOTEBOOKS/03-CNN-Convolutional-Neural-Networks/04-CNN-on-Custom-Images.ipynb | apache-2.0 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms, models # add models to the list
from torchvision.utils import make_grid
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib i... |
Autodesk/molecular-design-toolkit | moldesign/_notebooks/Tutorial 1. Making a molecule.ipynb | apache-2.0 | import moldesign as mdt
import moldesign.units as u
"""
Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blank" title="About">About</a> <a href="https://github.com/autodesk/molecular-design-toolkit/issues" target="_blank" title="Issues"... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_object_epochs.ipynb | bsd-3-clause | from __future__ import print_function
import mne
import os.path as op
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: The :class:Epochs <mne.Epochs> data structure: epoched data
End of explanation
"""
data_path = mne.datasets.sample.data_path()
# Load a dataset that contains events
ra... |
phoebe-project/phoebe2-docs | 2.1/tutorials/plotting.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Plotting
This tutorial explains the high-level interface to plotting provided by the Bundle. You are of course always welcome to access arrays and plot manually.
As of PHOEBE 2.1, PHOEBE uses autofig as an intermediate layer for highend functionality to matplotlib.
... |
ES-DOC/esdoc-jupyterhub | notebooks/uhh/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'uhh', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: UHH
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
tensorflow/text | docs/guide/tokenizers.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... |
ds-hwang/deeplearning_udacity | udacity_notebook/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... |
danijel3/ASRDemos | notebooks/MLP_Keras.ipynb | apache-2.0 | import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.optimizers import SGD, Adadelta
from keras.callbacks import RemoteMonitor
"""
Explanation: Simple MLP demo
This notebook demonstrates how to create a simple MLP for recognizing phonemes from speech. To do ... |
printedheart/h2o-3 | h2o-py/demos/H2O_tutorial_medium.ipynb | apache-2.0 | import pandas as pd
import numpy
from numpy.random import choice
from sklearn.datasets import load_boston
import h2o
h2o.init()
# transfer the boston data from pandas to H2O
boston_data = load_boston()
X = pd.DataFrame(data=boston_data.data, columns=boston_data.feature_names)
X["Median_value"] = boston_data.target
X ... |
rishuatgithub/MLPy | torch/PYTORCH_NOTEBOOKS/00-Crash-Course-Topics/01-Crash-Course-Pandas/08-Pandas-Exercises-Solutions.ipynb | apache-2.0 | # CODE HERE
import pandas as pd
"""
Explanation: <a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>
<center><em>Copyright Pierian Data</em></center>
<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>
Pandas Exercises - ... |
meppe/tensorflow-deepq | notebooks/karpathy_game.ipynb | mit | g.plot_reward(smoothing=100)
"""
Explanation: Average Reward over time
End of explanation
"""
g.__class__ = KarpathyGame
np.set_printoptions(formatter={'float': (lambda x: '%.2f' % (x,))})
x = g.observe()
new_shape = (x[:-2].shape[0]//g.eye_observation_size, g.eye_observation_size)
print(x[:-2].reshape(new_shape))
p... |
janpipek/physt | doc/adaptive_histogram.ipynb | mit | # Necessary import evil
import physt
from physt import h1, h2, histogramdd
import numpy as np
import matplotlib.pyplot as plt
# Create an empty histogram
h = h1(None, "fixed_width", bin_width=10, name="People height", axis_name="cm", adaptive=True)
h
"""
Explanation: Adaptive histogram
This type of histogram automati... |
donaghhorgan/COMP9033 | labs/03 - Finding outliers.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
"""
Explanation: Lab 03: Finding outliers
Introduction
This week's lab is focused on outlier detection and data cleaning. At the end of the lab, you should be able to use pandas to:
Create histograms and boxplots to help find outliers visually.
Remove data from a data frame.
Rep... |
csieber/alpha-dataset | notebooks/segments.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pylab as plt
dfsegs = pd.read_csv("../data/videos/CRZbG73SX3s_segments.csv")
"""
Explanation: Video Segments
The following example shows how to read the video segments files:
End of explanation
"""
segment_duration = 5
"""
Explanation: The duration of the se... |
badlands-model/BayesLands | Examples/mountain/mountain.ipynb | gpl-3.0 | from pyBadlands.model import Model as badlandsModel
# Initialise model
model = badlandsModel()
# Define the XmL input file
model.load_xml('test','mountain.xml')
"""
Explanation: Orogenic landscapes modelling
In this example, we simulate landscape evolution in response to two simple climatic scenarios:
+ uniform and ... |
scotthuang1989/Python-3-Module-of-the-Week | concurrency/asyncio/Producing Results Asynchronously.ipynb | apache-2.0 | # %load asyncio_future_event_loop.py
import asyncio
def mark_done(future, result):
print('setting future result to {!r}'.format(result))
future.set_result(result)
event_loop = asyncio.get_event_loop()
try:
all_done = asyncio.Future()
print('scheduling mark_done')
event_loop.call_soon(mark_done,... |
pligor/predicting-future-product-prices | 02_preprocessing/.ipynb_checkpoints/exploration09-price_history_gaussian_process_regressor_clustered_data-checkpoint.ipynb | agpl-3.0 | from __future__ import division
import numpy as np
import pandas as pd
import sys
import math
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import re
import os
import csv
from helpers.outliers import MyOutliers
from skroutz_mobile import SkroutzMobile
from sklearn.ensemble import IsolationForest
import ... |
google/trax | trax/examples/Knowledge_Tracing_Transformer.ipynb | apache-2.0 | # Choose a location for your storage bucket and BigQuery dataset to minimize data egress charges. Once you have
# created them, if you restart your notebook you can run this to see where your colab is running
# and factory reset until you get a location that is near your data.
!curl ipinfo.io
"""
Explanation: Intro... |
thomasyangrenqin/Udacity_Data_Analyst_Nanodegree | P3-Wrangle OpenStreetMap Data/Data wrangling part.ipynb | mit | import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow
OSM_FILE = "/Users/yangrenqin/udacity/P3/san-francisco.osm" # Replace this with your osm file
SAMPLE_FILE = "/Users/yangrenqin/udacity/P3/sample1.osm"
k = 30 # Parameter: take every k-th top level element
def get_element(osm_file, tags=('nod... |
Qumulo/python-notebooks | notebooks/Raw REST examples for the Qumulo API with python.ipynb | gpl-3.0 | import os
import requests
import json
import pprint
# python + ssl on MacOSX is rather noisy against dev clusters
requests.packages.urllib3.disable_warnings()
# set your environment variables or fill in the variables below
API_HOSTNAME = os.environ['API_HOSTNAME'] if 'API_HOSTNAME' in os.environ else '{your-cluster-ho... |
ES-DOC/esdoc-jupyterhub | notebooks/nuist/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nuist', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NUIST
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Ra... |
gaufung/PythonStandardLibrary | Algorithm/Itertools.ipynb | mit | from itertools import chain
for i in chain([1,2,3], ['a', 'b', 'c']):
print(i, end=' ')
from itertools import *
def make_iterables_to_chain():
yield [1, 2, 3]
yield ['a', 'b', 'c']
for i in chain.from_iterable(make_iterables_to_chain()):
print(i, end=' ')
print()
"""
Explanation: 1 Merging and Splitt... |
hfoffani/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... |
mercybenzaquen/foundations-homework | foundations_hw/12/311 time series homework.ipynb | mit | #df = pd.read_csv("small-311-2015.csv")
df = pd.read_csv("311-2014.csv", nrows=200000)
df.head(2)
df.info()
def parse_date (str_date):
return dateutil.parser.parse(str_date)
df['created_dt']= df['Created Date'].apply(parse_date)
df.head(3)
df.info()
"""
Explanation: First, I made a mistake naming the data se... |
boffi/boffi.github.io | dati_2018/03/PieceWise_Exact_Integration.ipynb | mit | T=1.0 # Natural period of the oscillator
w=2*pi # circular frequency of the oscillator
m=1000.0 # oscillator's mass, in kg
k=m*w*w # oscillator stifness, in N/m
z=0.05 # damping ratio over critical
c=2*z*m*w # damping
wd=w*sqrt... |
matmodlab/matmodlab2 | notebooks/MooneyRivlin.ipynb | bsd-3-clause | from bokeh.io import output_notebook
from bokeh.plotting import *
from matmodlab2 import *
from numpy import *
import numpy as np
from plotting_helpers import create_figure
output_notebook()
"""
Explanation: Mooney-Rivlin Hyperelasticity
Overview
A Mooney-Rivlin hyperelastic material is one for which the derivatives o... |
ogaway/Matching-Market | One-to-One.ipynb | gpl-3.0 | # coding: UTF-8
%matplotlib inline
import matchfuncs as mf
"""
Explanation: One-to-One Matching
End of explanation
"""
prop_prefs = [[0, 1, 2],
[0, 2, 1],
[2, 0, 1]]
resp_prefs = [[2, 0, 1],
[2, 0, 1],
[1, 2, 0]]
""... |
arnoldlu/lisa | ipynb/examples/energy_meter/EnergyMeter_HWMON.ipynb | apache-2.0 | import logging
from conf import LisaLogging
LisaLogging.setup()
"""
Explanation: Energy Meter Examples
Linux Kernel HWMon
More details can be found at https://github.com/ARM-software/lisa/wiki/Energy-Meters-Requirements#linux-hwmon.
End of explanation
"""
# Generate plots inline
%matplotlib inline
import os
# Supp... |
tjwei/HackNTU_Data_2017 | Week06/04-Keras-Intro.ipynb | mit | from keras.layers import Dense, Activation
model = Sequential()
model.add(Dense(units=10, input_dim=784))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='sgd',
metrics=['accuracy'])
from IPython.display import SVG, display
from keras.utils.vis_uti... |
plablo09/geo_context | geo_context_pipeline.ipynb | apache-2.0 | import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.cross_validation import train_test_split
from helpers.models import fit_model
from helpers.helpers import make_binary, class_info
# set random state for camparability
random_state = np.random.RandomState(0)
"""
Explanation: Flujo de ... |
lvrzhn/AstroHackWeek2015 | profile_parallel/FasterPython.ipynb | gpl-2.0 | import numpy as np
x = np.random.randn(1000)
"""
Explanation: Make My Python Code Faster
John Parejko, Lia Corrales, Phil Marshall, Andrew Hearin and Your Name Here>
This notebook demonstrates some ways to make your python code go faster.
Step 1: Profile and improve your code
Because how can you optimize something if... |
JasonSanchez/w261 | week12/MIDS-W261-HW-12-TEMPLATE.ipynb | mit | labVersion = 'MIDS_MLS_week12_v_0_9'
"""
Explanation: DATASCI W261: Machine Learning at Scale
W261-1 Fall 2015
Week 12: Criteo CTR Project
November 14, 2015
Student name INSERT STUDENT NAME HERE
Click-Through Rate Prediction Lab
This lab covers the steps for creating a click-through rate (CTR) prediction pipeline... |
seinberg/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... |
psas/lv3.0-recovery | Useful_Misc/Drop_Test_Calculations.ipynb | gpl-3.0 | import math
import sympy
from sympy import Symbol, solve
from scipy.integrate import odeint
from types import SimpleNamespace
import numpy as np
import matplotlib.pyplot as plt
sympy.init_printing()
%matplotlib inline
"""
Explanation: LV3 Recovery Test
This notebook will encompass all calculations regarding the LV3 Re... |
tommyod/abelian | docs/notebooks/fourier_series.ipynb | gpl-3.0 | # Imports related to plotting and LaTeX
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import display, Math
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('pdf', 'png')
def show(arg):
return display(Math(arg.to_latex()))
# Imports related to mathematics
import nu... |
tritemio/multispot_paper | out_notebooks/Multi-spot vs usALEX FRET histogram comparison-out-7d.ipynb | mit | data_id = '17d'
ph_sel_name = "None"
data_id = "7d"
"""
Explanation: Executed: Mon Mar 27 22:24:08 2017
Duration: 10 seconds.
End of explanation
"""
from fretbursts import *
sns = init_notebook()
import os
import pandas as pd
from IPython.display import display, Math
import lmfit
print('lmfit version:', lmfit.__... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/17_Weight_Initialisation/notebooks/weight-initialization/weight_initialization.ipynb | mit | %matplotlib inline
import tensorflow as tf
import helper
from tensorflow.examples.tutorials.mnist import input_data
print('Getting MNIST Dataset...')
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
print('Data Extracted.')
"""
Explanation: Weight Initialization
In this lesson, you'll learn how to fin... |
apryor6/apryor6.github.io | visualizations/seaborn/notebooks/jointplot.ipynb | mit | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
plt.rcParams['figure.figsize'] = (20.0, 10.0)
plt.rcParams['font.family'] = "serif"
"""
Explanation: seaborn.jointplot
Seaborn's jointplot displays a relationship between 2 variables (bivariate) as well as ... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_tf_dics.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.event import make_fixed_length_events
from mne.datasets import sample
from mne.time_frequency import compute_epochs_csd
from mne.beamformer import tf_dics
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = s... |
jseabold/statsmodels | examples/notebooks/regression_plots.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lzip
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.formula.api import ols
plt.rc("figure", figsize=(16,8))
plt.rc("font", size=14)
"""
Explanation: Regression Plots
End of explanation
"""
prestige = sm.datasets.get... |
hershaw/data-science-101 | course/class1/correlation/examples/01 - correlation matrix and heatmap.ipynb | mit | df = x_plus_noise(randomness=0)
sns.heatmap(df.corr(), vmin=0, vmax=1)
df.corr()
"""
Explanation: Correlation Matrix
By calling df.corr() on a full pandas DataFrame will return a square matrix containing all pairs of correlations.
By plotting them as a heatmap, you can visualize many correlations more efficiently.
Cor... |
BDannowitz/polymath-progression-blog | jlab-hackathon/notebooks/04-Multiclass-Classifier.ipynb | gpl-2.0 | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import os
import sys
import numpy as np
import math
"""
Explanation: Multi-Class Classifier on Particle Track Data
End of explanation
"""
track_params = pd.read_csv('../TRAIN/track_parms.csv')
track_params.tail()
"""
Explanation: Get angle val... |
tiagoft/curso_audio | classificador_regras.ipynb | mit | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Classificação por Regras Pré-Definidas
O problema com o qual vamos lidar é o de classificar automaticamente elementos de um conjunto através de suas características mensuráveis. Trata-se, assim, do problema de observar element... |
tyamamot/h29iro | codes/3_Evaluation.ipynb | mit | !pyNTCIREVAL
"""
Explanation: 第3回 情報検索の評価
この演習ページでは,既存のツールを使って各種評価指標を計算する方法について説明します.
参考文献
- 情報アクセス評価方法論 -検索エンジンの進歩のために-, 酒井哲也, コロナ社, 2015.
ライブラリ
この演習では,情報検索におけるさまざまな評価指標を計算するためのツールキットである NTCIREVAL のPython版である pyNTCIREVAL を使用します.
pyNTCIREVAL by 京都大学 加藤 誠 先生
NTCIREVAL by 早稲田大学 酒井 哲也 先生
NTCIREVALの説明を上記ページから引用します.
```... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.