repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
learn1do1/learn1do1.github.io | python_notebooks/Sorting Revisited.ipynb | mit | import random
cards = range(52)
random.shuffle(cards)
print cards
"""
Explanation: Sorting functions in python
Python is useful for exploring algorithms because of its terseness and large set of libraries.
This post will be focused on sorting functions, using a set of shuffled cards (integers) as input and looking at... |
ES-DOC/esdoc-jupyterhub | notebooks/niwa/cmip6/models/sandbox-1/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'niwa', 'sandbox-1', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: NIWA
Source ID: SANDBOX-1
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties:... |
kwinkunks/rainbow | notebooks/Guessing_colourmaps_TSP problem.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from matplotlib.pyplot import imread
from scipy import signal
nx, ny = 100, 100
z = np.random.rand(nx, ny)
sizex, sizey = 30, 30
x, y = np.mgrid[-sizex:sizex+1, -sizey:sizey+1]
g = np.exp(-0.333*(x**2/float(sizex)+y**2/float(sizey)))
f = g/g.sum(... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/08_image_keras/mnist_models.ipynb | apache-2.0 | import os
PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID
BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
MODEL_TYPE = "dnn" # "linear", "dnn", "dnn_dropout", or "cnn"
# Do not change these
os.environ["PROJECT... |
ucsc-astro/coffee | 17_02_23_astropy_quantities/astropy_quantities.ipynb | gpl-3.0 | print(type(u.Msun))
u.Msun
"""
Explanation: Astropy quantities
Astropy quantitites are a great way to handle all sorts of messy unit conversions. Careful unit conversions save lives! https://en.wikipedia.org/wiki/Gimli_Glider
The simplest way to create a new quantity object is multiply or divide a number by a Unit i... |
rubensfernando/mba-analytics-big-data | Python/2016-08-05/aula6-parte5-recuperar.ipynb | mit | import facebook
import simplejson as json
import requests
"""
Explanation: Recuperar posts
Segundo a Graph API v2.3, podemos recuperar:
/{user-id}/home - Retorna o fluxo de todos os posts criados pelo usuário e seus amigos. O que normalmente se encontra no Feed de Noticia.
/{user-id}/feed – inclui tudo que você ... |
inakic/matsoft | Sympy.ipynb | unlicense | from sympy import *
"""
Explanation: Sympy
Sympy je Python biblioteka za simboličku matematiku. Prednost Sympy-ja je što je potpuno napisan u Pythonu (što je katkad i mana). Mi ćemo u nastavku kolegiju obraditi i puno moćniji Sage, koji je CAS u klasi Mathematice i Maplea. No Sage nije biblioteka u Pythonu, već CAS ko... |
antisrdy/el_nino | el_nino.ipynb | mit | def get_mask(X, coords):
return (X.lat <= coords[0]) & (X.lat >= coords[1]) & (X.lon >= coords[2]) & (X.lon <= coords[3])
def get_pacific_data(X, mask):
# Five rectangles to cover pacific from top to bottom
mask1 = (X.lat <= 60) & (X.lat >= 51) & (X.lon >= 140) & (X.lon <= 360 - 165)
mask2 = (X.lat <= ... |
NelisW/ComputationalRadiometry | 03-Introduction-to-Radiometry.ipynb | mpl-2.0 | from IPython.display import display
from IPython.display import Image
from IPython.display import HTML
"""
Explanation: 3 Brief Introduction to Radiometry
This notebook forms part of a series on computational optical radiometry
The date of this document and module versions used in this document are given at the en... |
AEW2015/PYNQ_PR_Overlay | Pynq-Z1/notebooks/Video_PR/RGB_Filter.ipynb | bsd-3-clause | from pynq.drivers.video import HDMI
from pynq import Bitstream_Part
from pynq.board import Register
from pynq import Overlay
Overlay("demo.bit").download()
"""
Explanation: Don't forget to delete the hdmi_out and hdmi_in when finished
RGB Filter Example
In this notebook, we will explore the colors that are used to cr... |
darioizzo/d-CGP | doc/sphinx/notebooks/An_intro_to_dCGPANNs.ipynb | gpl-3.0 | # Initial import
import dcgpy
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
%matplotlib inline
"""
Explanation: Representing an Artificial Neural Network as a Cartesian Genetic Program
(a.k.a dCGPANN)
Neural networks (deep, shallow, convolutional or not) are, after all, computer programs and... |
nikbearbrown/Deep_Learning | NEU/Tejas_Bawaskar _DL/t-SNE.ipynb | mit | dataframe_all = pd.read_csv("https://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv")
num_rows = dataframe_all.shape[0]
print('No. of rows:', num_rows)
dataframe_all.head()
"""
Explanation: Step 1: download the data
End of explanation
"""
#List all fators from our response variable
dataframe_all.clas... |
awhite40/pymks | notebooks/stress_homogenization_2D.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Effective Stiffness
Introduction
This example uses the MKSHomogenizationModel to create a homogenization linkage for the effective stiffness. This example starts with a brief background of the ho... |
Yangqing/caffe2 | caffe2/python/tutorials/Loading_Pretrained_Models.ipynb | apache-2.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
%matplotlib inline
from caffe2.proto import caffe2_pb2
import numpy as np
import skimage.io
import skimage.transform
from matplotlib import pyplot
import os
from caffe2.py... |
Tsiems/machine-learning-projects | In_Class/ICA3_MachineLearning.ipynb | mit | # fetch the dataset
from sklearn.datasets import fetch_kddcup99
from sklearn import __version__ as sklearn_version
print('Sklearn Version:',sklearn_version)
ds = fetch_kddcup99(subset='http')
import numpy as np
# get some of the specifics of the dataset
X = ds.data
y = ds.target != b'normal.'
n_samples, n_features... |
mne-tools/mne-tools.github.io | dev/_downloads/a179627fc73cce931ace004638e9685c/read_inverse.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator
from mne.viz import set_3d_view
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path / 'subjects'
meg_path = data_path /... |
cipri-tom/Swiss-on-Amazon | analyse_swiss_reviews.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import datetime
from ggplot import *
plt.style.use('seaborn-whitegrid')
plt.style.use('seaborn-notebook')
#['grayscale', 'fivethirtyeight', 'seaborn-deep', 'bmh', 'seaborn-poster', 'seaborn-ticks', 'seaborn-dark', 'seaborn-darkgri... |
seg/2016-ml-contest | LA_Team/Facies_classification_LA_TEAM_07.ipynb | apache-2.0 | %%sh
pip install pandas
pip install scikit-learn
pip install tpot
from __future__ import print_function
import numpy as np
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold , StratifiedKFold
from classif... |
Leguark/pynoddy | docs/notebooks/3-Events.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
%matplotlib inline
"""
Explanation: Geological events in pynoddy: organisation and adpatiation
We will here describe how the single geological events of a Noddy history are organised within pynoddy. We will then evaluate i... |
tensorflow/docs | site/en/tutorials/keras/overfit_and_underfit.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... |
gaargly/gaargly.github.io | Lira_Assignment_distribution.ipynb | mit | #codes here for a)
import math
import pandas as pd
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def demo1():
mu, sigma = 0, 0.1
sampleNo = 1000
s = np.random.normal(mu, sigma, sampleNo)
plt.hist(s, bins=100, density=True)
plt.show()
demo1()
"""
Explanation: <a href... |
adfriedm/Geometric-K-Server-Experiments | experiments.ipynb | mit | # Load modules
import sys
from __future__ import print_function
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline
import pandas as pd
from pandas import DataFrame
import time
import random
from pqt import PQTDecomposition
from splice... |
buntyke/TRo2017 | Experiments/Exp6/experiment1.ipynb | mit | # import the modules
import sys
import GPy
import csv
import numpy as np
import cPickle as pickle
import scipy.stats as stats
import sklearn.metrics as metrics
from matplotlib import pyplot as plt
%matplotlib notebook
"""
Explanation: Experiment 6: TRo Journal
In this experiment, the generalization of cloth models t... |
jpilgram/phys202-2015-work | assignments/assignment10/ODEsEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 3
Imports
End of explanation
"""
g = 9.81 # m/s^2
l = 0.5 # length of pendulum... |
tensorflow/docs | site/en/guide/distributed_training.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... |
muneebalam/scrapenhl2 | examples/Shot Rates After Faceoffs.ipynb | mit | team = team_info.team_as_id('WSH')
season = 2017
pbp = teams.get_team_pbp(season, team)
toi = teams.get_team_toi(season, team)
"""
Explanation: The purpose of this script is to generate shot counts for skaters after faceoffs.
For example, CA after 5 and 10 seconds for Nicklas Backstrom after defensive-zone faceoff win... |
zhouqifanbdh/liupengyuan.github.io | chapter1/homework/localization/3-22/201611680049(3).ipynb | mit | name = input('请输入你的姓名')
print('你好',name)
print('请输入出生的月份与日期')
month = int(input('月份:'))
date = int(input('日期:'))
if month == 4:
if date < 20:
print(name, '你是白羊座')
else:
print(name,'你是非常有性格的金牛座')
if month == 5:
if date < 21:
print(name, '你是非常有性格的金牛座')
else:
print... |
googledatalab/notebooks | tutorials/Stackdriver Monitoring/Time-shifted data.ipynb | apache-2.0 | from datalab.stackdriver import monitoring as gcm
# set_datalab_project_id('my-project-id')
"""
Explanation: Time-shifted Data
In this tutorial, we show how to transform the time-series data in the following ways:
* split time-series with a lot of data points into mutiple segments, and
* time shift the above segments... |
nproctor/phys202-2015-work | assignments/assignment05/InteractEx01.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.html import widgets
from IPython.display import display
"""
Explanation: Interact Exercise 01
Import
End of explanation
"""
def print_sum(a, b):
"""Print the sum ... |
zaqwes8811/micro-apps | self_driving/deps/Kalman_and_Bayesian_Filters_in_Python_master/Appendix-G-Designing-Nonlinear-Kalman-Filters.ipynb | mit | from __future__ import division, print_function
%matplotlib inline
#format the book
import book_format
book_format.set_style()
"""
Explanation: Table of Contents
Designing Nonlinear Kalman Filters
End of explanation
"""
import matplotlib.pyplot as plt
circle1=plt.Circle((-4, 0), 5, color='#004080',
... |
taylort7147/udacity-projects | boston_housing/boston_housing.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
import visuals as vs # Supplementary code
from sklearn.cross_validation import ShuffleSplit
# Pretty display for notebooks
%matplotlib inline
# Load the Boston housing dataset
data = pd.read_csv('housing.csv')
prices = data['MEDV']
f... |
antoniomezzacapo/qiskit-tutorial | community/teach_me_qiskit_2018/w_state/W State 3 - Monty Hall Problem Solver.ipynb | apache-2.0 | # useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import time
from pprint import pprint
# importing Qiskit
from qiskit import Aer, IBMQ
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
# import basic plot tools
from qiskit.tools.visualiza... |
Almaz-KG/MachineLearning | ml-for-finance/python-for-financial-analysis-and-algorithmic-trading/02-NumPy/3-Numpy-Operations.ipynb | apache-2.0 | import numpy as np
arr = np.arange(0,10)
arr + arr
arr * arr
arr - arr
# Warning on division by zero, but not an error!
# Just replaced with nan
arr/arr
# Also warning, but not an error instead infinity
1/arr
arr**3
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>... |
satishgoda/learning | python/libs/rxpy/GettingStarted.ipynb | mit | %%bash
pip install rx
"""
Explanation: Getting Started with RxPY
ReactiveX, or Rx for short, is an API for programming with observable event streams. RxPY is a port of ReactiveX to Python. Learning Rx with Python is particularly interesting since Python removes much of the clutter that comes with statically typed lang... |
RogueAstro/keppy | docs/examples/HIP67620_example.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import astropy.units as u
from radial import estimate, dataset
%matplotlib inline
"""
Explanation: The orbital parameters of the binary solar twin HIP 67620
radial is a simple program designed to do a not very trivial task: simulate ra... |
jgdwyer/ML-convection | NN_demo.ipynb | apache-2.0 | from IPython.display import Image
Image('assets/Stephens_and_Bony_2013.png')
"""
Explanation: Using a neural network to emulate the atmospheric convection scheme in a global climate model
(John Dwyer & Paul O'Gorman)
Overview:
Global climate models (GCMs) solve computational fluid PDEs to represent the dynamics and th... |
flohorovicic/pynoddy | docs/notebooks/3-Events.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
%matplotlib inline
"""
Explanation: Geological events in pynoddy: organisation and adpatiation
We will here describe how the single geological events of a Noddy history are organised within pynoddy. We will then evaluate i... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/CovarianceCorrelation.ipynb | mit | %matplotlib inline
import numpy as np
from pylab import *
def de_mean(x):
xmean = mean(x)
return [xi - xmean for xi in x]
def covariance(x, y):
n = len(x)
return dot(de_mean(x), de_mean(y)) / (n-1)
pageSpeeds = np.random.normal(3.0, 1.0, 1000)
purchaseAmount = np.random.normal(50.0, 10.0, 1000)
sca... |
maubarsom/ORFan-proteins | phage_assembly/5_annotation/asm_v1.2/orf_160621/3b_select_reliable_orfs.ipynb | mit | #Load blast hits
blastp_hits = pd.read_csv("2_blastp_hits.tsv",sep="\t",quotechar='"')
blastp_hits.head()
#Filter out Metahit 2010 hits, keep only Metahit 2014
blastp_hits = blastp_hits[blastp_hits.db != "metahit_pep"]
"""
Explanation: 1. Load blast hits
End of explanation
"""
#Assumes the Fasta file comes with the ... |
tomfaulkenberry/MT_flanker | exp2/results/.ipynb_checkpoints/SqueakIntro-checkpoint.ipynb | gpl-2.0 | # For reading data files
import os
import glob
import numpy as np # Numeric calculation
import pandas as pd # General purpose data analysis library
import squeak # For mouse data
# For plotting
import matplotlib.pyplot as plt
%matplotlib inline
# Prettier default settings for plots (optional)
import seaborn
seaborn... |
msadegh97/machine-learning-course | appendix-02-Numpy_Pandas.ipynb | gpl-3.0 | import numpy as np
a = [1,2,3]
a
b = np.array(a)
b
np.arange(1, 10)
np.arange(1, 10, 2)
"""
Explanation: NumPy
NumPy is a Linear Algebra Library for Python.
NumPy’s main object is the homogeneous multidimensional array. It is a table of elements (usually numbers), all of the same type, indexed by a tuple of posi... |
jhprinz/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_1_trajectory.ipynb | lgpl-2.1 | %matplotlib inline
import matplotlib.pyplot as plt
import openpathsampling as paths
import openpathsampling.engines.openmm as peng_omm
from simtk.openmm import app
import simtk.openmm as mm
import simtk.unit as unit
from openmmtools.integrators import VVVRIntegrator
import mdtraj as md
import numpy as np
"""
Explan... |
Apipie/apipie-rails | rel-eng/gem_release.ipynb | apache-2.0 | %autosave 0
%cd ..
"""
Explanation: Release of apipie-rails gem
Requirements
push access to https://github.com/Apipie/apipie-rails
push access to rubygems.org for apipie-rails
sudo yum install python-slugify asciidoc
ensure neither the git push or gem push don't require interractive auth. If you can't use api key or... |
mangecoeur/pineapple | data/examples/python2.7/Execution.ipynb | gpl-3.0 | def f(x):
return 1.0 / x
def g(x):
return x - 1.0
f(g(1.0))
"""
Explanation: Executing Code
In this notebook we'll look at some of the issues surrounding executing
code in the notebook.
Backtraces
When you interrupt a computation, or if an exception is raised but not
caught, you will see a backtrace of what ... |
balarsen/pymc_learning | updating_info/Arb_dist.ipynb | bsd-3-clause | # pymc3.distributions.DensityDist?
import matplotlib.pyplot as plt
import matplotlib as mpl
from pymc3 import Model, Normal, Slice
from pymc3 import sample
from pymc3 import traceplot
from pymc3.distributions import Interpolated
from theano import as_op
import theano.tensor as tt
import numpy as np
from scipy import ... |
leriomaggio/numpy_euroscipy2015 | 01_numpy_basics.ipynb | mit | import numpy as np # naming import convention
"""
Explanation: What is Numpy
NumPy is the fundamental package for scientific computing with Python.
It is a package that provide high-performance vector, matrix and higher-dimensional data structures for Python.
It is implemented in C and Fortran so when calculations ... |
gale320/flexx | examples/notebooks/EuroScipy 2015 demo.ipynb | bsd-2-clause | from flexx.webruntime import launch
rt = launch('http://flexx.rtfd.org', 'xul', title='Test title')
"""
Explanation: This is the demo that I used during the EuroScipy 2015 talk on Flexx.
flexx.webruntime
Launch a web runtime. Can be a browser or something that looks like a desktop app.
End of explanation
"""
from fl... |
CopernicusMarineInsitu/INSTACTraining | PythonNotebooks/PlatformPlots/Read_TimeSeries_3.ipynb | mit | %matplotlib inline
import cf
import netCDF4
import matplotlib.pyplot as plt
"""
Explanation: Reading a file using CF module
The main difference with the previous example is the way we will read the data from the file.
Instead of the netCDF4 module, we will use the cf-python package, which implements the CF data model ... |
saudijack/unfpyboot | Day_02/02_GitDevelopment/VersionControl.ipynb | mit | ls
"""
Explanation: Version control for fun and profit: the tool you didn't know you needed. From personal workflows to open collaboration
Note: this tutorial is based (mostely blantently copied), and therefore owes a lot, to the excellent materials offered in:
Fernando Perez's original notebook
That notbook owed a ... |
ninadhw/ninadhw.github.io | notebooks/getting_started_with_keras.ipynb | cc0-1.0 | #
# Import required packages
#
from keras.models import Sequential
from keras.layers import Dense, Activation
from IPython.display import display, Image
import matplotlib.pyplot as plt
%matplotlib inline
import random
"""
Explanation: Getting started with keras
This tutorial is inspired from https://keras.io
Sequenti... |
anshbansal/anshbansal.github.io | udacity_data_science_notes/intro_data_analysis/lesson_02/Lesson2.ipynb | mit | import pandas as pd
"""
Explanation: Lesson 2: NumPy and Pandas for 1D Data
01 - Introduction
Will get familiar with 2 libraries - numpy and pandas
Writing Data Analysis code will be much easier.
Code runs faster
Analyse one dimensional data
02 - Gapminder Data
The data in this lesson was obtained from the site gapm... |
AEW2015/PYNQ_PR_Overlay | Pynq-Z1/notebooks/examples/opencv_face_detect_webcam.ipynb | bsd-3-clause | from pynq import Overlay
Overlay("base.bit").download()
"""
Explanation: OpenCV Face Detection Webcam
In this notebook, opencv face detection will be applied to webcam images.
To run all cells in this notebook a webcam and HDMI output monitor are required.
References:
https://github.com/Itseez/opencv/blob/master/dat... |
damienstanton/tensorflownotes | 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... |
phobson/statsmodels | examples/notebooks/generic_mle.ipynb | bsd-3-clause | from __future__ import print_function
import numpy as np
from scipy import stats
import statsmodels.api as sm
from statsmodels.base.model import GenericLikelihoodModel
"""
Explanation: Maximum Likelihood Estimation (Generic models)
This tutorial explains how to quickly implement new maximum likelihood models in statsm... |
shareactorIO/pipeline | oreilly.ml/high-performance-tensorflow/notebooks/04_Train_Model_GPU.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow.python.client import timeline
import pylab
import numpy as np
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
tf.logging.set_verbosity(tf.logging.INFO)
tf.reset_default_graph()
num_samples = 100000
from datetime import datetime
version = int(datetime.now(... |
bartdevylder/bikecity-tutorial | index.ipynb | mit | print 'Hello world!'
print range(5)
"""
Explanation: Python for Data Science Workshop @VeloCity
1.1 Jupyter Notebook
Jupyter notebook is often used by data scientists who work in Python. It is loosely based on Mathematica and combines code, text and visual output in one page.
Some relevant short cuts:
* SHIFT + ENTER ... |
parklab/PaSDqc | examples/02_example-basic_PSD/Intro_to_PSDs.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import sys
import PaSDqc
%matplotlib inline
"""
Explanation: Introduction
In this example we load an example bulk, MDA, and MALBAC power spectral densities (PSDs) generated by the command line tool provided in the PaSDqc pac... |
HarshaDevulapalli/foundations-homework | 08/Homework 8 - Dataset - Devulapalli.ipynb | mit | #Starting out the basics.
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
slums= pd.read_csv("hyderabad_slum_master.csv")
slums.head() #The dataset is a spatialised one, hence the_geom column.
"""
Explanation: Homework 8: Dataset: Slums of Hyderabad
The following dataset is a heavily cleane... |
Cairo4/pythonkurs | 03 python II/01 Python II .ipynb | mit | lst = [11,2,34,4,5,5111]
len([11,2,'sort',4,5,5111])
sorted(lst)
lst.sort()
min(lst)
max(lst)
str(1212)
sum([1,2,2])
lst.remove(4)
lst.append(4)
string = 'hello, wie geht Dir?'
string.split(',')
"""
Explanation: Python II
Wiederholung: die wichtigsten Funktion
Viel mächtigere Funktion: Modules und Librarie... |
knowledgeanyhow/notebooks | hacks/Webserver in a Notebook.ipynb | mit | import matplotlib.pyplot as plt
import pandas as pd
import numpy
import io
pd.options.display.mpl_style = 'default'
def plot_random_numbers(n=50):
'''
Plot random numbers as a line graph.
'''
fig, ax = plt.subplots()
# generate some random numbers
arr = numpy.random.randn(n)
ax.plot(arr)
... |
ComputationalModeling/spring-2017-danielak | past-semesters/fall_2016/day-by-day/day21-traveling-salesman-problem/TravelingSalesman_Problem_SOLUTIONS.ipynb | agpl-3.0 | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import display, clear_output
def calc_total_distance(table_of_distances, city_order):
'''
Calculates distances between a sequence of cities.
Inputs: N x N table containing distances between each pair of the N
... |
bcantarel/bcantarel.github.io | bicf_nanocourses/courses/python_1/lectures/introduction_to_pandas_and_dataframes.ipynb | gpl-3.0 | # Import Pandas and Numpy
import pandas as pd
import numpy as np
"""
Explanation: Intoduction to Pandas and Dataframes
<hr>
Venkat Malladi (Computational Biologist BICF)
Agenda
<hr>
Introduction to Pandas
DataSeries
Exercise 1
Exercise 2
Dataframe
Exercise 3
Exercise 4
Exercise 5
Import and Store Data
Summar... |
gklambauer/SelfNormalizingNetworks | getSELUparameters.ipynb | gpl-3.0 | import numpy as np
from scipy.special import erf,erfc
from sympy import Symbol, solve, nsolve
"""
Explanation: Obtain the SELU parameters for arbitrary fixed points
Author: Guenter Klambauer, 2017
tested under Python 3.5
End of explanation
"""
def getSeluParameters(fixedpointMean=0,fixedpointVar=1):
""" Finding ... |
GAMPTeam/vampyre | demos/sparse/sparse_lin_inverse_amp.ipynb | mit | import os
import sys
vp_path = os.path.abspath('../../')
if not vp_path in sys.path:
sys.path.append(vp_path)
import vampyre as vp
"""
Explanation: Sparse Linear Inverse Demo with AMP
In this demo, we illustrate how to use the vampyre package for a simple sparse linear inverse problem. The problem is to estimate... |
marcotcr/lime | doc/notebooks/Tutorial - images - Pytorch.ipynb | bsd-2-clause | import matplotlib.pyplot as plt
from PIL import Image
import torch.nn as nn
import numpy as np
import os, json
import torch
from torchvision import models, transforms
from torch.autograd import Variable
import torch.nn.functional as F
"""
Explanation: Using Lime with Pytorch
In this tutorial we will show how to use L... |
rastala/mmlspark | notebooks/samples/304 - Medical Entity Extraction.ipynb | mit | from mmlspark import CNTKModel, ModelDownloader
from pyspark.sql.functions import udf, col
from pyspark.sql.types import IntegerType, ArrayType, FloatType, StringType
from pyspark.sql import Row
from os.path import abspath, join
import numpy as np
import pickle
from nltk.tokenize import sent_tokenize, word_tokenize
im... |
moustakas/impy | projects/desi/lya/18dec19/mock-contaminants-qso.ipynb | gpl-2.0 | import os
from desiutil.log import get_logger
log = get_logger()
import seaborn as sns
rc = {'font.family': 'serif'}#, 'text.usetex': True}
sns.set(style='ticks', font_scale=1.5, palette='Set2', rc=rc)
%matplotlib inline
"""
Explanation: Mock Target Contaminants - QSO Edition
The purpose of this notebook is to illu... |
kubeflow/kfp-tekton-backend | samples/core/dsl_static_type_checking/dsl_static_type_checking.ipynb | apache-2.0 | !python3 -m pip install 'kfp>=0.1.31' --quiet
"""
Explanation: KubeFlow Pipeline DSL Static Type Checking
In this notebook, we will demo:
Defining a KubeFlow pipeline with Python DSL
Compile the pipeline with type checking
Static type checking helps users to identify component I/O inconsistencies without running t... |
ealogar/curso-python | basic/4_Functions_classes_and_modules.ipynb | apache-2.0 | def spam(): # Functions are declared with the 'def' keyword, its name, parrentheses and a colon
print "spam" # Remeber to use indentation!
spam() # Functions are executed with its name followed by parentheses
"""
Explanation: Functions
Let's declare a function
End of explanation
"""
def eggs(arg1): ... |
seap-udea/interstellar | Figures.ipynb | gpl-3.0 | #Constants
AU=1.465e8
LY=9.4608e12
data=np.loadtxt("cloud-nomult.data")
datan=np.loadtxt("cloud-many.data")
data=np.loadtxt("cloud-many.data")
data=np.loadtxt("cloud.data")
#Elements
qs=data[1:,51]
es=data[1:,52]
if verbose:print("Means: q:",qs.mean()/AU,", e:",es.mean())
if verbose:print("Dispersion: q:",qs.std()/AU... |
tensorflow/federated | docs/tutorials/random_noise_generation.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
kingb12/languagemodelRNN | report_templates/EncDecReportTemplate.ipynb | mit | report_file = 'reports/encdec_200_512_2.json'
log_file = 'logs/encdec_200_512_logs.json'
import json
import matplotlib.pyplot as plt
with open(report_file) as f:
report = json.loads(f.read())
with open(log_file) as f:
logs = json.loads(f.read())
print'Encoder: \n\n', report['architecture']['encoder']
print'Dec... |
robertoalotufo/ia898 | master/dftexamples.ipynb | mit | import sys,os
%matplotlib inline
ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from numpy.fft import fft2
"""
Explanation: Demo dftexamp... |
gururajl/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/Homework Solutions/24. Getting Help (HW).ipynb | mit | x = [ [2] * 3 ] * 3
x[0][0] = "ZZ"
print(*x, sep="\n")
"""
Explanation: Where to Get Help: Homework Assignment
You need to be think a little bit about your search, the better that is the more likely you are to find what you want. Let me give you a real example I stuggled with:
End of explanation
"""
out=[[0]*3]*3
... |
jdhp-docs/python_notebooks | nb_dev_jupyter/notebook_snippets_en.ipynb | mit | %matplotlib notebook
# As an alternative, one may use: %pylab notebook
# For old Matplotlib and Ipython versions, use the non-interactive version:
# %matplotlib inline or %pylab inline
# To ignore warnings (http://stackoverflow.com/questions/9031783/hide-all-warnings-in-ipython)
import warnings
warnings.filterwarnin... |
bzamecnik/ml | snippets/keras/sine_phases_autoencoder.ipynb | mit | %pylab inline
import keras
import numpy as np
import keras
N = 50
# phase_step = 1 / (2 * np.pi)
t = np.arange(50)
phases = np.linspace(0, 1, N) * 2 * np.pi
x = np.array([np.sin(2 * np.pi / N * t + phi) for phi in phases])
print(x.shape)
imshow(x);
plot(x[0]);
plot(x[1]);
plot(x[2]);
from keras.models import Sequent... |
sdpython/ensae_teaching_cs | _doc/notebooks/2a/cffi_linear_regression.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
memo_time = []
import timeit
def unit(x):
if x >= 1: return "%1.2f s" % x
elif x >= 1e-3: return "%1.2f ms" % (x* 1000)
elif x >= 1e-6: return "%1.2f µs" % (x* 1000**2)
elif x >= 1e-9: return "%1.2f ns" % (x* 1000**3)
else:
re... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/reusable_embeddings.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: Reusable Embeddings
Learning Objectives
1. Learn how to use a pre-trained TF Hub text modules to generate sentence vectors
1. Learn how to incorporate a pre-trained TF-Hub module into a Keras model
1. Lea... |
luofan18/deep-learning | tv-script-generation/dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
GoogleCloudPlatform/ml-design-patterns | 02_data_representation/text_embeddings.ipynb | apache-2.0 | import tensorflow as tf
import tensorflow_hub as tfhub
model = tf.keras.Sequential()
model.add(tfhub.KerasLayer("https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1",
output_shape=[20], input_shape=[], dtype=tf.string))
model.summary()
model.predict(["""
Long years ago, we made a tryst... |
usantamaria/iwi131 | ipynb/22-Actividad-DiccionariosYConjuntos/Actividad4.ipynb | cc0-1.0 | # Cargar datos
miembros_fsociety= {
'Eliott': [(2015, 10, 20), 'Seguridad', 'New York',
{'Darlene'}],
'Darlene': [(2013, 3, 22), 'Malware', 'New York',
{'Eliott', 'Cisco'}],
'Cisco': [(2012, 2, 4), 'Sistemas Distribuidos', 'San Francisco',
{'Darlene', 'Romero', 'Eliott'}],
'Mr. Robot... |
CtheDataIO-sdpenaloza/Kaggle-Titanic-Machine-Learning-from-Disaster | Manual-Titanic/Kaggle - Titanic - Manual.ipynb | gpl-3.0 | # Imports for pandas, and numpy
import numpy as np
import pandas as pd
# imports for seaborn to and matplotlib to allow graphing
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="whitegrid")
%matplotlib inline
# import Titanic CSV - NOTE: adjust file path as neccessary
dTitTrain_DF = pd.read_csv... |
intel-analytics/analytics-zoo | apps/variational-autoencoder/using_variational_autoencoder_and_deep_feature_loss_to_generate_faces.ipynb | apache-2.0 | from bigdl.nn.layer import *
from bigdl.nn.criterion import *
from bigdl.optim.optimizer import *
from bigdl.dataset import mnist
import datetime as dt
from glob import glob
import os
import numpy as np
from utils import *
import imageio
image_size = 148
Z_DIM = 100
ENCODER_FILTER_NUM = 32
# we use the vgg16 model, i... |
spacedrabbit/PythonBootcamp | Iterators and Generators Homework.ipynb | mit | def gensquares(N):
for i in range(N):
yield i**2
for x in gensquares(10):
print x
"""
Explanation: Iterators and Generators Homework
Problem 1
Create a generator that generates the squares of numbers up to some number N.
End of explanation
"""
import random
random.randint(1,10)
def rand_num(low,h... |
fabge/fabge.github.io | _notebooks/test.ipynb | apache-2.0 | #hide
import pandas as pd
import altair as alt
"""
Explanation: Example Fastpages Notebook
An example fastpages notebook
toc: True
See fastpages/_notebooks/README.md for a detailed explanation on how to use notebooks with fastpages. This notebook is a demonstration of some of fastpages's capabilities with notebook... |
phoebe-project/phoebe2-docs | 2.3/tutorials/optimizing.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
import phoebe
b = phoebe.default_binary()
"""
Explanation: Advanced: Optimizing Performance with PHOEBE
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"... |
lucasmaystre/choix | notebooks/choicerank-tutorial.ipynb | mit | import choix
import networkx as nx
import numpy as np
%matplotlib inline
"""
Explanation: Using ChoiceRank to understand network traffic
This notebook provides a quick example on how to use ChoiceRank to estimate transitions along the edges of a network based only on the marginal traffic at the nodes.
End of explanat... |
astroumd/GradMap | notebooks/Lectures2017/Lecture1/GradMap_L1.ipynb | gpl-3.0 | ## You can use Python as a calculator:
5*7 #This is a comment and does not affect your code.
#You can have as many as you want.
#No worries.
5+7
5-7
5/7
"""
Explanation: Introduction to "Doing Science" in Python for REAL Beginners
Python is one of many languages you can use for research and HW purposes. In the n... |
SCPSscience/Notebooks | PropertiesofStars.ipynb | mit | # Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Read in data that will be used for the calculations.
# Using pandas read_csv method, we can create a data frame
data = pd.read_csv("https://github.com/adamlamee/CODINGinK12-data/r... |
kgourgou/stochastic-simulations-class | ipython_notebooks/BrownianMotion.ipynb | mit | # Setting up some parameters.
T = 1; # Final time
n = 500; # Number of points to use in discretization
Dt = float(T)/n;
print 'Stepsize =', Dt,'.'
def pathGenerate(npath,n, Dt=0.002):
# Function that generates discrete approximations to a brownian path.
Wiener = np.zeros([n,npath])
for j in xrange(npath... |
moustakas/hizea | doc/nb/massprofiles-sg.ipynb | gpl-2.0 | import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import fitsio
import astropy.units as u
from astropy.io import ascii
from astropy.table import Table
from astropy.cosmology import FlatLambdaCDM
%pylab inline
mpl.rcParams.update({'font.size': 18})
cosmo = FlatLambdaCDM(H0=70, Om0=... |
GoogleCloudPlatform/tensorflow-without-a-phd | tensorflow-rnn-tutorial/old-school-tensorflow/tutorial/00_RNN_predictions_solution.ipynb | apache-2.0 | import numpy as np
import utils_datagen
import utils_display
from matplotlib import pyplot as plt
import tensorflow as tf
print("Tensorflow version: " + tf.__version__)
"""
Explanation: An RNN for short-term predictions
This model will try to predict the next value in a short sequence based on historical data. This ca... |
conversationai/unintended-ml-bias-analysis | archive/unintended_ml_bias/metric_heatmap_example.ipynb | apache-2.0 | model_bias_analysis.plot_auc_heatmap(madlibs_results, models)
"""
Explanation: AUC Heatmap
The heatmap below shows the three AUC-based metrics for two models. Each column is labeled with "MODEL_NAME"_"METRIC_NAME"
Metrics:
* <b>Subgroup AUC</b>: AUC of examples within the identity subgroup.
* <b>Negative Cross AUC</b>... |
udapi/udapi-python | tutorial/01-visualizing.ipynb | gpl-3.0 | !pip3 install --user --upgrade git+https://github.com/udapi/udapi-python.git
"""
Explanation: Introduction
Udapi is an API and framework for processing Universal Dependencies. In this tutorial, we will focus on the Python version of Udapi. Perl and Java versions are available as well, but they are missing some of the... |
GoogleCloudPlatform/ml-design-patterns | 07_responsible_ai/heuristic_benchmark.ipynb | apache-2.0 | %%bigquery
SELECT
bqutil.fn.median(ARRAY_AGG(TIMESTAMP_DIFF(a.creation_date, q.creation_date, SECOND))) AS time_to_answer
FROM `bigquery-public-data.stackoverflow.posts_questions` q
JOIN `bigquery-public-data.stackoverflow.posts_answers` a
ON q.accepted_answer_id = a.id
"""
Explanation: Heuristic Benchmark
This not... |
rashikaranpuria/Machine-Learning-Specialization | Regression/Assignment_four/week-4-ridge-regression-assignment-2-blank.ipynb | mit | import graphlab
"""
Explanation: Regression Week 4: Ridge Regression (gradient descent)
In this notebook, you will implement ridge regression via gradient descent. You will:
* Convert an SFrame into a Numpy array
* Write a Numpy function to compute the derivative of the regression weights with respect to a single feat... |
Cyianor/smc2017 | solutions/code/Python/fheld/exIV.ipynb | mit | import numpy as np
from scipy import stats
from tqdm import tqdm_notebook
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style()
"""
Explanation: SMC2017: Exercise sheet IV
Setup
End of explanation
"""
T = 50
xs_sim = np.zeros((T + 1,))
ys_sim = np.zeros((T,))
# Initial state
x... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/prod/.ipynb_checkpoints/n10_dyna_q_with_predictor_full_training_dyna1-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
from time import time
from sklearn.metrics import r2_score, median_absolute_error
from multiprocessing import Pool
import pickle
%matplotlib inline
%pylab inli... |
AndreySheka/dl_ekb | hw1/Homework 1 (Face Recognition).ipynb | mit | import scipy.io
image_h, image_w = 32, 32
data = scipy.io.loadmat('faces_data.mat')
X_train = data['train_faces'].reshape((image_w, image_h, -1)).transpose((2, 1, 0)).reshape((-1, image_h * image_w))
y_train = data['train_labels'] - 1
X_test = data['test_faces'].reshape((image_w, image_h, -1)).transpose((2, 1, 0)).r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.