repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
mne-tools/mne-tools.github.io | stable/_downloads/4a4a8e5bd5ae7cafea93a04d8c0a0d00/psf_ctf_vertices_lcmv.ipynb | bsd-3-clause | # Author: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.beamformer import make_lcmv, make_lcmv_resolution_matrix
from mne.minimum_norm import get_cross_talk
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path / 'subjects'
meg_... |
arcyfelix/Courses | 17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/01-Python-Crash-Course/.ipynb_checkpoints/Python Crash Course Exercises -checkpoint.ipynb | apache-2.0 | price = 300
"""
Explanation: Python Crash Course Exercises
This is an optional exercise to test your understanding of Python Basics. The questions tend to have a financial theme to them, but don't look to deeply into these tasks themselves, many of them don't hold any significance and are meaningless. If you find this... |
ctuning/ck-math | script/explore-clblast-matrix-size/clblast-client-single-configuration-analysis.ipynb | bsd-3-clause | import os
import sys
import json
import re
"""
Explanation: [PUBLIC] Analysis of CLBlast client multiple sizes
<a id="overview"></a>
Overview
This Jupyter Notebook analyses the performance that CLBlast (single configuaration) achieves across a range of sizes.
<a id="data"></a>
Get the experimental data from DropBox
N... |
phasedchirp/Assorted-Projects | exercises/SlideRule-DS-Intensive/Inferential Statistics/sliderule_dsi_inferential_statistics_exercise_1.ipynb | gpl-2.0 | %matplotlib inline
from matplotlib import pyplot as plot
import pandas as pd
from scipy import stats
from statsmodels.api import qqplot
import numpy as np
df = pd.read_csv('data/human_body_temperature.csv')
# adding temp in degrees celsius
df['tempC'] = df.temperature.apply(lambda x: (x-32)*(5/9.))
"""
Explanation: ... |
jerkos/cobrapy | documentation_builder/loopless.ipynb | lgpl-2.1 | from matplotlib.pylab import *
%matplotlib inline
import cobra.test
from cobra import Reaction, Metabolite, Model
from cobra.flux_analysis.loopless import construct_loopless_model
from cobra.solvers import get_solver_name
"""
Explanation: Loopless FBA
The goal of this procedure is identification of a thermodynamicall... |
rdhyee/nypl50 | travis_encrypt.ipynb | apache-2.0 | from Crypto.PublicKey import RSA
import base64
from github_settings import SSH_KEY_PASSWORD
my_public_key = RSA.importKey(
open('/Users/raymondyee/.ssh/id_rsa.pub', 'r').read())
my_private_key = RSA.importKey(open('/Users/raymondyee/.ssh/id_rsa','r').read(),
passphrase=SSH_KEY_PASSWORD)
messag... |
Ciaran1981/geospatial-learn | example_notebooks/PointCloudClassification.ipynb | gpl-3.0 | from geospatial_learn import learning as ln
incloud = "/path/to/Llandinam.ply"
"""
Explanation: A workflow for classifying a point cloud using point features
The following example will run through the functions to classify a point cloud based on the point neighborhood attributes. This is a very simple example but thi... |
cfcdavidchan/Deep-Learning-Foundation-Nanodegree | intro-to-tflearn/TFLearn_Digit_Recognition.ipynb | mit | # Import Numpy, TensorFlow, TFLearn, and MNIST data
import numpy as np
import tensorflow as tf
import tflearn
import tflearn.datasets.mnist as mnist
"""
Explanation: Handwritten Number Recognition with TFLearn and MNIST
In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9.
This... |
HCsoft-RD/shaolin | examples/Brainstorming -merging paramnb with shaolin.ipynb | agpl-3.0 | import param
import paramnb
def hello(x):
print("Hello %s" % x)
class BaseClass(param.Parameterized):
x = param.Parameter(default=3.14,doc="X position")
y = param.Parameter(default="Not editable",constant=True)
string_value = param.String(defau... |
jayme-anchante/Python-presentations | Salário dos professores e qualidade da educação no Brasil.ipynb | mit | # Começamos importando as bibliotecas a serem utilizadas:
import numpy as np
import pandas as pd
import seaborn as sns; sns.set()
%matplotlib inline
# Importando os microdados do arquivo .zip:
rs = pd.read_table('/mnt/part/Data/RAIS/2014/RS2014.zip', sep = ';', encoding = 'cp860', decimal = ',')
rs.head() # mostra ... |
pygeo/pycmbs | demo/dataset_comparison.ipynb | mit | # read in the data
from pycmbs.data import Data
h_file = 'hoaps-g.t63.m01.rain.1987-2008_monmean.nc'
m_file = 'pr_Amon_MPI-ESM-LR_amip_r1i1p1_197901-200812_2000-01-01_2007-09-30_T63_monmean.nc'
hoaps = Data(h_file, 'rain', read=True)
model = Data(m_file, 'pr', read=True, scale_factor=86400.) # note the scale factor ... |
mbway/Bayesian-Optimisation | prototypes/Optimisation.ipynb | gpl-3.0 | f = lambda x: x * np.cos(x)
x = np.linspace(0, 12, 100)
y = f(x)
plt.figure(figsize=(16,8))
plt.plot(x, y, 'g-')
plt.margins(0.1, 0.1)
plt.xlabel('x')
plt.ylabel('cost')
plt.show()
ranges = {
'x' : np.linspace(0, 12, 100)
}
class TestEvaluator(op.LocalEvaluator):
def test_config(self, config):
#time.s... |
IBMDecisionOptimization/docplex-examples | examples/mp/jupyter/progress.ipynb | apache-2.0 | from docplex.mp.model import Model
def build_hearts(r, **kwargs):
# initialize the model
mdl = Model('love_hearts_%d' % r, **kwargs)
# the dictionary of decision variables, one variable
# for each circle with i in (1 .. r) as the row and
# j in (1 .. i) as the position within the row
idx =... |
atulsingh0/MachineLearning | ML_UoW/Course00_MLFoundation/Deep Features for Image Classification.ipynb | gpl-3.0 | import graphlab
"""
Explanation: Using deep features to build an image classifier
Fire up GraphLab Create
End of explanation
"""
image_train = graphlab.SFrame('image_train_data/')
image_test = graphlab.SFrame('image_test_data/')
"""
Explanation: Load a common image analysis dataset
We will use a popular benchmark d... |
MingChen0919/learning-apache-spark | notebooks/07-natural-language-processing/nlp-information-extraction.ipynb | mit | from pyspark import SparkContext
sc = SparkContext(master = 'local')
from pyspark.sql import SparkSession
spark = SparkSession.builder \
.appName("Python Spark SQL basic example") \
.config("spark.some.config.option", "some-value") \
.getOrCreate()
"""
Explanation: NLP Information Extrac... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_creating_data_structures.ipynb | bsd-3-clause | from __future__ import print_function
import mne
import numpy as np
"""
Explanation: Creating MNE-Python's data structures from scratch
End of explanation
"""
# Create some dummy metadata
n_channels = 32
sampling_rate = 200
info = mne.create_info(32, sampling_rate)
print(info)
"""
Explanation: Creating :class:Info... |
parthasen/java-R | DS_ML_Jan4.ipynb | gpl-3.0 | def hurst(data):
tau, lagvec = [], []
# Step through the different lags
for lag in range(2,20):
# Produce price different with lag
pp = np.subtract(data[lag:],data[:-lag])
# Write the different lags into a vector
lagvec.append(lag)
# Calculate the variance of the... |
peterwittek/qml-rg | Archiv_Session_Spring_2017/Tutorials/Advanced_Data_Science.ipynb | gpl-3.0 | from __future__ import print_function
import matplotlib.pyplot as plt
import os
import pandas as pd
import re
import seaborn as sns
try:
from urllib2 import Request, urlopen
except ImportError:
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
%matplotlib inline
"""
Explanation: 1. Intr... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/text_models/labs/text_generation.ipynb | apache-2.0 | import os
import time
import numpy as np
import tensorflow as tf
"""
Explanation: Text generation with an RNN
Learning Objectives
Learn how to generate text using a RNN
Create training examples and targets for text generation
Build a RNN model for sequence generation using Keras Subclassing
Create a text generator a... |
GoogleCloudPlatform/ml-design-patterns | 05_resilience/continuous_eval.ipynb | apache-2.0 | # change these to try this notebook out
PROJECT = 'munn-sandbox'
BUCKET = 'munn-sandbox'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['TFVERSION'] = '2.1'
import shutil
import pandas as pd
import tensorflow as tf
from google.cloud import bigquery
from tensorflow.keras.utils imp... |
msramalho/pyhparser | examples/Pyhparser.ipynb | mit | # To install the most recent version
!pip install git+https://github.com/msramalho/pyhparser --upgrade
"""
Explanation: Installing Pyhparser
Pyhparser.
End of explanation
"""
from pyhparser import Pyhparser, readFile
"""
Explanation: Import pyhparser
And one useful function that comes with it (readFile)
End of exp... |
RaspberryJamBe/ipython-notebooks | notebooks/en-gb/104 - Remote door bell - Using a cloud API to send messages.ipynb | cc0-1.0 | APPKEY = "******"
"""
Explanation: Requirements
For this excercise you need a (free) account at http://www.realtime.co/; if you create an account and start a "Realtime Messaging Free" subscription, you can put its "Application Key" in the variable below. This key will then be used in the communications we'll set up fu... |
tritemio/FRETBursts | notebooks/FRETBursts - us-ALEX smFRET burst analysis.ipynb | gpl-2.0 | from fretbursts import *
"""
Explanation: FRETBursts - μs-ALEX smFRET burst analysis
This notebook is part of a tutorial series for the FRETBursts burst analysis software.
In this notebook, we present a typical FRETBursts
workflow for μs-ALEX smFRET burst analysis.
Briefly, we show how to perform background estimat... |
tum-pbs/PhiFlow | docs/Staggered_Grids.ipynb | mit | # !pip install --quiet phiflow
from phi.flow import *
grid = StaggeredGrid(0, extrapolation.BOUNDARY, x=10, y=10)
grid.values
"""
Explanation: Staggered grids
Staggered grids are a key component of the marker-and-cell (MAC) method [Harlow and Welch 1965].
They sample the velocity components not at the cell centers b... |
seblabbe/MATH2010-Logiciels-mathematiques | NotesDeCours/15-fonctions.ipynb | gpl-3.0 | from __future__ import division, print_function # Python 3
"""
Explanation: $$
\def\CC{\bf C}
\def\QQ{\bf Q}
\def\RR{\bf R}
\def\ZZ{\bf Z}
\def\NN{\bf N}
$$
Fonctions def
End of explanation
"""
def FONCTION( PARAMETRES ):
INSTRUCTIONS
"""
Explanation: Une fonction rassemble un ensemble d'instructions qui perm... |
pombredanne/gensim | docs/notebooks/Corpora_and_Vector_Spaces.ipynb | lgpl-2.1 | import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
Explanation: Tutorial 1: Corpora and Vector Spaces
See this gensim tutorial on the web here.
Don’t forget to set:
End of explanation
"""
from gensim import corpora
documents = ["Human machine interface for... |
n-witt/MachineLearningWithText_SS2017 | exercises/solutions/2 Matplotlib.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
y = np.cos(x), np.cos(x + 1), np.cos(x + 2)
names = ['Signal 1', 'Signal 2', 'Signal 3']
"""
Explanation: 1. Reproduce this figure
<img src="images/exercise_1-1.png">
Here's the data and some code to get you started.
End of explanation
"""... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/tsa_arma_1.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from statsmodels.graphics.tsaplots import plot_predict
from statsmodels.tsa.arima_process import arma_generate_sample
from statsmodels.tsa.arima.model import ARIMA
np.random.seed(12345)
"""
Explanation: Autoregressive Moving Average (ARMA): Artificial data
E... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/labs/quickstart.ipynb | apache-2.0 | # Install required packages.
!pip install -q tensorflow-recommenders
!pip install -q --upgrade tensorflow-datasets
"""
Explanation: Working with TensorFlow Recommenders: Quickstart
Learning Objectives
Read the data and build vocabularies.
Define a model.
Create and train a model.
Introduction
In this tutorial, you b... |
phanrahan/magmathon | notebooks/tutorial/coreir/Combinational and Sequential.ipynb | mit | import magma as m
import inspect
import fault
from hwtypes import BitVector
"""
Explanation: In this notebook we will discuss the combinational and sequential syntaxes in more detail. See https://magma.readthedocs.io/en/latest/circuit_definitions/ for the full documentation
End of explanation
"""
@m.circuit.combina... |
mamrehn/machine-learning-tutorials | ipynb/[python] cheatsheet.ipynb | cc0-1.0 | sentence = 'the quick brown fox jumps over the lazy dog'
words = sentence.split()
word_lengths = [len(word) for word in words if 'the' != word]
print(word_lengths)
"""
Explanation: First Steps with Python
Source: learnpython.org
List comprehensions
End of explanation
"""
def foo(first, second, third, *therest):
... |
rsterbentz/phys202-2015-work | assignments/assignment08/InterpolationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set_style('white')
from scipy.interpolate import griddata
"""
Explanation: Interpolation Exercise 2
End of explanation
"""
x = np.array([-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-4,-4,-3,-3,-2,-2,-1,-1,0,0,0,1,1,2,2,3,3,4,4,5,5,... |
UWashington-Astro300/Astro300-A17 | Python_ReadingData.ipynb | mit | import os
"""
Explanation: Reading Data
Python has a large number of different ways to read data from external files.
Python supports almost any type of file you can think of, from simple text files to complex binary formats.
In this class we are going to mainly use the pakages Astropy and Pandas to load extrnal fil... |
anujjamwal/learning | cs231n/Lecture-2.ipynb | mit | import numpy as np
import matplotlib.pylab as plt
import math
from scipy.stats import mode
%matplotlib inline
from sklearn.datasets import fetch_mldata
from sklearn.model_selection import train_test_split
mnist = fetch_mldata('MNIST original', data_home='../data')
mnist.data.shape
X = np.append(np.ones((mnist.data.... |
leriomaggio/numpy_euroscipy2015 | 07_ubiquitous_numpy.ipynb | mit | from IPython.core.display import Image, display
display(Image(filename='images/iris_setosa.jpg'))
print("Iris Setosa\n")
display(Image(filename='images/iris_versicolor.jpg'))
print("Iris Versicolor\n")
display(Image(filename='images/iris_virginica.jpg'))
print("Iris Virginica")
"""
Explanation: Ubiquitous NumPy
I ca... |
eniltonangelim/data-science | m4ml/Exercicios-Cap01/Exercicios01.ipynb | mit | from math import pi, sqrt
from random import sample
from collections import Counter
x = 2
y = 5
def soma(x, y): print(x+y)
def subtrair(x, y): print(x-y)
def multi(x, y): print(x*y)
def dividir(x, y): print (x/y)
soma(x, y)
subtrair(x, y)
multi(x, y)
dividir(x, y)
"""
Explanation: <font color='blue'>Data Science Ac... |
BrentDorsey/pipeline | gpu.ml/notebooks/06a_Train_Model_XLA_GPU.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow.python.client import timeline
import pylab
import numpy as np
import os
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
tf.logging.set_verbosity(tf.logging.INFO)
"""
Explanation: Train Model with XLA_GPU (and CPU*)
Some operations do not have XLA_GPU equivale... |
lknelson/text-analysis-2017 | 04-Dictionaries/00-DictionaryMethod_ExerciseSolutions.ipynb | bsd-3-clause | #import the necessary packages
import pandas
import nltk
from nltk import word_tokenize
import string
#read the Music Reviews corpus into a Pandas dataframe
df = pandas.read_csv("../Data/BDHSI2016_music_reviews.csv", encoding='utf-8', sep = '\t')
df['body'] = df['body'].apply(lambda x: ''.join([i for i in x if not i.i... |
vaxherra/vaxherra.github.io | _files/bacterial_names/RNNs_KERAS.ipynb | mit | import keras
from keras.layers import Concatenate,Dense,Embedding
rnn_num_units = 64
embedding_size = 16
#Let's create layers for our recurrent network
#Note: we create layers but we don't "apply" them yet
embed_x = Embedding(n_tokens,embedding_size) # an embedding layer that converts character ids into embeddings
#... |
yl565/statsmodels | examples/notebooks/formulas.ipynb | bsd-3-clause | from __future__ import print_function
import numpy as np
import statsmodels.api as sm
"""
Explanation: Formulas: Fitting models using R-style formulas
Since version 0.5.0, statsmodels allows users to fit statistical models using R-style formulas. Internally, statsmodels uses the patsy package to convert formulas and d... |
robblack007/clase-metodos-numericos | Practicas/P5/Practica 5 - Interpolacion.ipynb | mit | from matplotlib.pyplot import plot
"""
Explanation: Graficación
Antes que nada, tenemos que aprender a graficar en Python, lo manera mas fácil de graficar es usando la función plot de la libería matplotlib, asi que importamos esta función:
End of explanation
"""
plot([0,1], [2,3])
"""
Explanation: y la usamos como ... |
google/compass | packages/propensity/01.eda_ga.ipynb | apache-2.0 | # Uncomment to install required python modules
# !sh ../utils/setup.sh
# Add custom utils module to Python environment
import os
import sys
sys.path.append(os.path.abspath(os.pardir))
import pandas as pd
from gps_building_blocks.cloud.utils import bigquery as bigquery_utils
from utils import eda_ga
from utils impor... |
harrywang/pgm | course-s2016/bn-student.ipynb | mit | from pgmpy.models import BayesianModel
student_model = BayesianModel()
"""
Explanation: This is the program for a student Bayesian network
End of explanation
"""
student_model.add_nodes_from(['difficulty', 'intelligence', 'grade', 'sat', 'letter'])
student_model.nodes()
student_model.add_edges_from([('difficulty',... |
tensorflow/workshops | extras/archive/00_test_install.ipynb | apache-2.0 | import tensorflow as tf
print("You have version %s" % tf.__version__)
"""
Explanation: You can press shift + enter to quickly advance through each line of a notebook. Try it!
Check that you have a recent version of TensorFlow installed, v1.3 or higher.
End of explanation
"""
%matplotlib inline
import pylab
import nu... |
fluentpython/pythonic-api | pythonic-api-notebook.ipynb | mit | s = 'Fluent'
L = [10, 20, 30, 40, 50]
print(list(s)) # list constructor iterates over its argument
a, b, *middle, c = L # tuple unpacking iterates over right side
print((a, b, c))
for i in L:
print(i, end=' ')
"""
Explanation: Pythonic APIs: the workshop notebook
Tutorial overview
Introduction
A simple but f... |
vipmunot/Data-Science-Course | Data Visualization/Lab 5/w05_Vipul_Munot.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
sns.set_style('white')
%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
"""
Explanation: W5 Lab Assignment
This lab covers some fundamental plots of 1-D data.
End of explanation
"""
print( np.random.ra... |
ml6973/Course | assignment/Vaidyanathan.N-Girish/assign-04-girishvat123.ipynb | apache-2.0 | #find out for different iterations to find out the optimal iterations
iter1=10000
iter2=15000
iter3=26000
learningRate = tf.train.exponential_decay(learning_rate=0.0008,
global_step= 1,
decay_steps=trainX.shape[0],
... |
amueller/scipy-2017-sklearn | notebooks/06.Supervised_Learning-Regression.ipynb | cc0-1.0 | x = np.linspace(-3, 3, 100)
print(x)
rng = np.random.RandomState(42)
y = np.sin(4 * x) + x + rng.uniform(size=len(x))
plt.plot(x, y, 'o');
"""
Explanation: Supervised Learning Part 2 -- Regression Analysis
In regression we are trying to predict a continuous output variable -- in contrast to the nominal variables we ... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/BJKST_enonce.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - BJKST - calculer le nombre d'éléments distincts
Comment calculer le nombre d'éléments distincts d'un ensemble de données quand celui-ci est trop grand pour tenir en mémoire. C'est ce que fait l'algorithme BJKST.
End of explanati... |
dolittle007/dolittle007.github.io | notebooks/lasso_block_update.ipynb | gpl-3.0 | %pylab inline
from matplotlib.pylab import *
from pymc3 import *
import numpy as np
d = np.random.normal(size=(3, 30))
d1 = d[0] + 4
d2 = d[1] + 4
yd = .2*d1 +.3*d2 + d[2]
"""
Explanation: Lasso regression with block updating
Sometimes, it is very useful to update a set of parameters together. For example, variable... |
omoju/udacityUd120Lessons | Evaluation Metrics.ipynb | gpl-3.0 |
import pickle
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
data_dict = pickle.load(open("../final_project/final_project_dataset.pkl", "r") )
### first element is our labels, any added elements are predictor
### features. Keep this the same for the mini-project,... |
qkitgroup/qkit | qkit/doc/notebooks/VirtualAWG_basics.ipynb | gpl-2.0 | testsample = sample.Sample()
testsample.readout_tone_length = 200e-9 # length of the readout tone
testsample.clock = 1e9 # sample rate of your physical awg/pulse generator
testsample.tpi = 100e-9 # duration of a pi-pulse
testsample.tpi2 = 50e-9 # duration of a pi/2-pulse
testsample.iq_frequency = 20e6 # iq_frequency fo... |
andrzejkrawczyk/python-course | workshops/Gr1-2018/Zadania.ipynb | apache-2.0 | max_num("9512983", 1) # "9"
max_num("9512983", 3) # "998"
max_num("9512983", 7) # "9512983"
"""
Explanation: <center><h3>1. Napisz funkcje, która zwraca maksymalną zadaną liczbę ze stringa, składającą się z kolejnych liczb</h3></center>
End of explanation
"""
POST = {
u"page[1][1]['id']": [u'baloes_bd_8_1'],
... |
mattilyra/gensim | docs/notebooks/soft_cosine_tutorial.ipynb | lgpl-2.1 | # Initialize logging.
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
Explanation: Finding similar documents with Word2Vec and Soft Cosine Measure
Soft Cosine Measure (SCM) is a promising new tool in machine learning that allows us to submit a query and re... |
quinterojs/US-Bicycle-Commuting-Analysis | Bicycle Commuting and Public Health in the United States.ipynb | mit | # Libraries
import pandas as pd
import numpy as np
from scipy import stats
from sklearn import preprocessing
number = preprocessing.LabelEncoder()
import statsmodels.api as sm
import seaborn as sns
sns.set(style='white', context='talk')
p = sns.color_palette('husl', 8)
import matplotlib.pyplot as plt
plt.rcParams[... |
javierarilos/deep-learning-ud | 2_fullyconnected.ipynb | apache-2.0 | # 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
from six.moves import range
"""
Explanation: Deep Learning
Assignment 2
Previously in 1_n... |
karlstroetmann/Formal-Languages | ANTLR4-Python/LR-Parser-Generator/Shift-Reduce-Parser-Pure.ipynb | gpl-2.0 | import re
"""
Explanation: A Shift-Reduce Parser for Arithmetic Expressions
In this notebook we implement a simple recursive descend parser for arithmetic expressions.
This parser will implement the following grammar:
$$
\begin{eqnarray}
\mathrm{expr} & \rightarrow & \mathrm{expr}\;\;\texttt{'+'}\;\;\mathrm... |
nntisapeh/intro_programming | notebooks/lists_tuples.ipynb | mit | students = ['bernice', 'aaron', 'cody']
for student in students:
print("Hello, " + student.title() + "!")
"""
Explanation: Lists and Tuples
In this notebook, you will learn to store more than one valuable in a single variable. This by itself is one of the most powerful ideas in programming, and it introduces a nu... |
NYUDataBootcamp/Projects | MBA_S16/Freedman-CEO_Birthdays.ipynb | mit | import numpy as np #importing numpy
import pandas as pd #importing pandas
from bs4 import BeautifulSoup #importing Beautiful Soup
import requests
import html5lib #importing html5lib, as per Pandas read_html request
import re
"""
Explanation: Investigating the Relationship Between Birth Month and Business Success
By A... |
ShinjiKatoA16/UCSY-sw-eng | Python-tips-print.ipynb | mit | # print hh:mm:ss
hh = 1
mm = 2
ss = 3
# simple
print(hh,':',mm,':',ss, sep='')
# smarter
print(hh,mm,ss, sep=':')
# format method
print('{}:{}:{}'.format(hh,mm,ss))
# format method length=2 leading-0
print('{:02}:{:02}:{:02}'.format(hh,mm,ss))
# Print colxrow=col*row
col = 2
row = 3
# it's possible to specify th... |
GoogleCloudPlatform/training-data-analyst | quests/serverlessml/01_explore/solution/explore_data.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install tensorflow==2.1 --user
"""
Explanation: Explore and create ML datasets
In this notebook, we will explore data corresponding to taxi rides in New York City to build a Machine Learning model in support of a fare-estimation tool. The idea is... |
davidthomas5412/PanglossNotebooks | MassLuminosityProject/IntegralsAndSamples_2017_03_11.ipynb | mit | % load_ext autoreload
% autoreload 2
% matplotlib inline
from bigmali.grid import Grid
from bigmali.likelihood import BiasedLikelihood
from bigmali.prior import TinkerPrior
from bigmali.hyperparameter import get
import pandas as pd
data = pd.read_csv('/Users/user/Code/PanglossNotebooks/MassLuminosityProject/mock_dat... |
DB2-Samples/db2jupyter | Db2 Using Prepared Statements.ipynb | apache-2.0 | %run db2.ipynb
"""
Explanation: Db2 Jupyter: Using Prepared Statements
Normal the %sql magic command is used to execute SQL commands immediately to get a result. If this statement needs to be executed multiple times with different variables, the process is inefficient since the SQL statement must be recompiled every t... |
alexandrnikitin/algorithm-sandbox | courses/DAT256x/Module03/03-02-Vector Multiplication.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import math
v = np.array([2,1])
w = 2 * v
print(w)
# Plot w
origin = [0], [0]
plt.grid()
plt.ticklabel_format(style='sci', axis='both', scilimits=(0,0))
plt.quiver(*origin, *w, scale=10)
plt.show()
"""
Explanation: Vector Multiplication
Vector m... |
mayankjohri/LetsExplorePython | Section 1 - Core Python/Chapter 05 - Data Types Part - 2/5.2 Advance Data Types.ipynb | gpl-3.0 | import collections
# from collections import ChainMap
a = {'a': 'A', 'c': 'C'}
b = {'b': 'B', 'c': 'D'}
m = collections.ChainMap(a, b)
print('Individual Values')
print('a = {}'.format(m['a']))
print('b = {}'.format(m['b']))
print('c = {}'.format(m['c']))
print("-"*20)
print(type(m.keys()))
print('Keys = {}'.format(... |
GoogleCloudPlatform/cloudml-samples | notebooks/scikit-learn/custom-prediction-routine-scikit-learn.ipynb | apache-2.0 | PROJECT_ID = "<your-project-id>" #@param {type:"string"}
! gcloud config set project $PROJECT_ID
"""
Explanation: Creating a custom prediction routine with scikit-learn
<table align="left">
<td>
<a href="https://cloud.google.com/ml-engine/docs/scikit/custom-prediction-routine-scikit-learn">
<img src="https... |
sbg/Mitty | docs/alignment-accuracy-mq-plots.ipynb | apache-2.0 | # From SO: https://stackoverflow.com/a/28073228/2512851
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascr... |
antoniomezzacapo/qiskit-tutorial | community/games/Hello_Qiskit.ipynb | apache-2.0 | print("Hello! I'm a code cell")
"""
Explanation: <img src="../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left">
Hello Qiskit
Click here to run this notebook in your browser using Binder.
The latest ... |
fdmazzone/Ecuaciones_Diferenciales | examenes/.ipynb_checkpoints/GruposLie-checkpoint.ipynb | gpl-2.0 | from sympy import *
init_printing() #muestra símbolos más agradab
R=lambda n,d: Rational(n,d)
"""
Explanation: <h2> Ejercicios varios relacionados con grupos de Lie </h2>
End of explanation
"""
x,y,a,b,c,d,e,f=symbols('x,y,a,b,c,d,e,f',real=true)
#cargamos la función
F=x*y**4/3-R(2,3)*y/x+R(1,3)/x**3/y**2
F
"""
Exp... |
yuhao0531/dmc | notebooks/week-2/03 - Introduction to Python - Functions and Objects.ipynb | apache-2.0 | def addFunction(inputNumber):
result = inputNumber + 2
return result
"""
Explanation: So far, we have seen how we can use variables in Python to store different kinds of data, and how we can use 'flow control' structures such as conditionals and loops to change the order or the way in which lines of code get e... |
kriete/cie5703_notebooks | week_7_spatial_variograms.ipynb | mit | from rpy2.robjects.packages import importr
from rpy2.robjects import r
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: This is a python / R implementation for spatial analysis of radar rainfall fields. All courtesy for the R code implementation goes to Marc ... |
manipopopo/tensorflow | tensorflow/contrib/eager/python/examples/pix2pix/pix2pix_eager.ipynb | apache-2.0 | # Import TensorFlow >= 1.10 and enable eager execution
import tensorflow as tf
tf.enable_eager_execution()
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import PIL
from IPython.display import clear_output
"""
Explanation: Copyright 2018 The TensorFlow Authors.
Licensed under the Apache Lice... |
fantasycheng/udacity-deep-learning-project | 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... |
ethen8181/machine-learning | keras/text_classification/keras_pretrained_embedding.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', '..', 'notebook_format'))
from formats import load_style
load_style(plot_style=False)
os.chdir(path)
# 1. magic for inline plot
# 2. magic to print vers... |
d-meiser/cold-atoms | examples/Doppler Cooling.ipynb | gpl-3.0 | class GaussianBeam(object):
"""A laser beam with a Gaussian intensity profile."""
def __init__(self, S0, x0, k, sigma):
"""Construct a Gaussian laser beam from position, direction, and width.
S0 -- Peak intensity (in units of the saturation intensity).
x0 -- A location on t... |
tmadlener/phys_utils | python/docs/cov_signal_from_mixed.ipynb | gpl-3.0 | import sympy as sp
sp.init_printing()
C_S = sp.Symbol('C_S')
C_B = sp.Symbol('C_B')
C = sp.Symbol('C')
p = sp.Symbol('p', real=True)
mu = sp.Symbol('mu', commutative=False)
muT = sp.Symbol('mu^T', commutative=False)
mu_B = sp.Symbol('mu_B', commutative=False)
mu_BT = sp.Symbol('mu_B^T', commutative=False)
"""
Explana... |
jseabold/statsmodels | examples/notebooks/tsa_arma_1.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from statsmodels.graphics.tsaplots import plot_predict
from statsmodels.tsa.arima_process import arma_generate_sample
from statsmodels.tsa.arima.model import ARIMA
np.random.seed(12345)
"""
Explanation: Autoregressive Moving Average (ARMA): Artificial data
E... |
tclaudioe/Scientific-Computing | SC1/07_Polynomial_Interpolation_1D.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
from functools import reduce
import matplotlib as mpl
mpl.rcParams['font.size'] = 14
mpl.rcParams['axes.labelsize'] = 20
mpl.rcParams['xtick.labelsize'] = 14
mpl.rcParams['ytick.labelsize'] = 14
%matplotlib inline
from ipywidgets import interact, fix... |
varnion/sabesPy | G1Errou.ipynb | bsd-3-clause | from sabesPy import getData
import pandas as pd
df = pd.DataFrame([getData('2014-03-14'), getData('2015-03-14')])
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns ## só pra deixar o matplotlib com o estilo bonitão do seaborn ;)
sns.set_context("talk")
sns.set_style("darkgrid"... |
clemaitre58/power-profile | notebook/metrics/example_aerobic_modeling.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from skcycling.data_management import Rider
from skcycling.metrics import aerobic_meta_model
from skcycling.utils.fit import log_linear_model
from skcycling.utils.fit import linear_model
from datetime import date
"""
Explanation: Aerobic metabo... |
robertoalotufo/ia898 | src/histogram.ipynb | mit | import numpy as np
def histogram(f):
return np.bincount(f.ravel())
"""
Explanation: Function histogram
Synopse
Image histogram.
h = histogram(f)
f: Input image. Pixel data type must be integer.
h: Output, integer vector.
Description
This function computes the number of occurrence of each pixel value.
The ... |
Luke035/dlnd-lessons | gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
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')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
fluxcapacitor/source.ml | jupyterhub.ml/notebooks/train_deploy/zz_under_construction/tensorflow/optimize/03a_Train_Model_GPU.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow.python.client import timeline
import pylab
import numpy as np
import os
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
tf.logging.set_verbosity(tf.logging.INFO)
"""
Explanation: Train Model with GPU (and CPU*)
CPU is still used to store variables that we are... |
oditorium/blog | iPython/FridayPuzzle.ipynb | agpl-3.0 | import time
def timer():
start = time.time()
def f(report=False):
elapsed = time.time() - start
if report:
print ("time elapsed %5.3f" % elapsed)
return elapsed
return f
"""
Explanation: Friday Puzzle
Question
What numbers that can not be written in the form $i_4 * 4 + ... |
SamLau95/nbinteract | notebooks/Using_Interact.ipynb | bsd-3-clause | from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
"""
Explanation: Using Interact
The interact function (ipywidgets.interact) automatically creates user interface (UI) controls for exploring code and data interactively. It is the eas... |
qkitgroup/qkit | qkit/doc/notebooks/IV_curve.ipynb | gpl-2.0 | import numpy as np
from uncertainties import ufloat, umath, unumpy as unp
from scipy import signal as sig
import matplotlib.pyplot as plt
import qkit
qkit.start()
from qkit.analysis.IV_curve import IV_curve as IVC
ivc = IVC()
"""
Explanation: Transport measurement data analysis
This is an example notebook for the an... |
geodocker/geodocker-jupyter-geopyspark | notebooks/Pine Habitat.ipynb | apache-2.0 | import geopyspark as gps
from pyspark import SparkContext
"""
Explanation: This tutorial will show you how to find the suitable habitat range for Bristlecone pine using GeoPySpark
This tutorial will focus on GeoPySpark functionality, but you can find more resources and tutorials about GeoNotebooks here.
Suitability an... |
jaduimstra/nilmtk | notebooks/experimental/test_num_states_co_fhmm.ipynb | apache-2.0 | ds.set_window(start='2014-04-01 00:00:00', end='2014-05-01 00:00:00')
elec
fridge_elecmeter = elec['fridge']
fridge_elecmeter
fridge_mg = MeterGroup([fridge_elecmeter])
co.train(fridge_mg)
co.model
"""
Explanation: Reducing time window
End of explanation
"""
num_states_dict = {fridge_elecmeter:2}
co = Combina... |
ToqueWillot/M2DAC | FDMS/TME_Dataiku/kaggle_whats_cooking/Model_V7.ipynb | gpl-2.0 | # -*- coding: utf-8 -*-
"""
Explanation: FDMS TME3
Kaggle How Much Did It Rain? II
Florian Toque & Paul Willot
End of explanation
"""
# from __future__ import exam_success
from __future__ import absolute_import
from __future__ import print_function
# Standard imports
%matplotlib inline
import os
import sklearn
i... |
BinRoot/TensorFlow-Book | ch04_classification/Concept01_linear_regression_classification.ipynb | mit | %matplotlib inline
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Ch 04: Concept 01
Linear regression for classification (just for demonstrative purposes)
Import the usual libraries:
End of explanation
"""
x_label0 = np.random.normal(5, 1, 10)
x_label1 = np.random.normal(... |
y2ee201/Deep-Learning-Nanodegree | sentiment-rnn/Sentiment RNN Solution.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment_network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment_network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
pyReef-model/pyReefCore | Tests/case2/run-case2.ipynb | gpl-3.0 | from pyReefCore.model import Model
"""
Explanation: ReefCore library
pyReef-Core is a deterministic, one-dimensional (1-D) numerical model, that simulates the vertical coralgal growth patterns observed in a drill core, as well as the physical, environmental processes that effect coralgal growth.
The model is capable ... |
dbouquin/AstroHackWeek2015 | day3-machine-learning/09.3 - Trees and Forests.ipynb | gpl-2.0 | %matplotlib nbagg
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Trees and Forests
End of explanation
"""
from plots import plot_tree_interactive
plot_tree_interactive()
"""
Explanation: Decision Tree Classification
End of explanation
"""
from plots import plot_forest_interactive
plot_forest_... |
science-of-imagination/nengo-buffer | Project/trained_mental_scaling_testing.ipynb | gpl-3.0 | import nengo
import numpy as np
import cPickle
import matplotlib.pyplot as plt
from matplotlib import pylab
import matplotlib.animation as animation
"""
Explanation: Testing the trained weight matrices (not in an ensemble)
End of explanation
"""
#Weight matrices generated by the neural network after training
#Maps ... |
reychil/project-alpha-1 | code/utils/misc/BART_Data_Beginning.ipynb | bsd-3-clause | from __future__ import absolute_import, division, print_function
import numpy as np
import numpy.linalg as npl
import matplotlib.pyplot as plt
import nibabel as nib
import pandas as pd # new
import os # new
# the last one is a major thing for ipython notebook, don't include in regular python code
%matplotlib inline
... |
PyClass/PyClassLessons | guest-talks/20180108-graph-dynamic-algorithms/algorithms.ipynb | mit | def fib(n):
if n < 0:
raise Exception("Index was negative. Cannot have a negative index in a series")
if n < 2:
return n
return fib(n-1) + fib(n-2)
fib(25)
def fib(n):
if n < 0:
raise Exception("Index was negative. Cannot have a negative index in a seri... |
AlexGascon/playing-with-keras | #3 - Improving text generation/3.1 - Randomizing our prediction.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import LSTM
from keras.callbacks import ModelCheckpoint
from keras.utils import np_utils
-
# Load the network weights
filename = "weights-improvement... |
yinime/yinime.github.com | _posts/MCM-aufgabe1.ipynb | mit | import random
print("Eine Zufallszahl r =", random.random())
print("Eine Floge von Zufallszahlen ist")
for i in range(10):
print(random.random())
print("Falls 'seed' festgesetzt worden ist, wird die erste Zufallszahl wegen der Algorithmen des bestimmten Generators festgestellt.")
random.seed(100)
random.random()
... |
nehal96/Deep-Learning-ND-Exercises | Intro to TensorFlow/intro-to-tensorflow-notes.ipynb | mit | import tensorflow as tf
# Create TensorFlow object called tensor
hello_constant = tf.constant('Hello World!')
with tf.Session() as sess:
# Run the tf.constant operatin in the session
output = sess.run(hello_constant)
print(output)
"""
Explanation: Intro to TensorFlow
Hello, Tensor World!
End of explanati... |
dataventures/workshops | 1/2 - KNN.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# m is a percent
def split(data, m):
df_shuffled = data.iloc[np.random.permutation(len(data))]
df_training = df_shuffled[:int(m/100.0*len(data))]
df_test = df_shuffled[int(m/100.0*len(data)):]
return df_training, df_test
#k near... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.