repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
NORCatUofC/rain
flooding/FEMA and 311 Calls by Zip.ipynb
mit
fig, axs = plt.subplots(1,2) plt.rcParams["figure.figsize"] = [15, 5] fema_approved_zip_df[:20].plot(title='FEMA Data', ax=axs[0], kind='bar',x='zipCode',y='approvedForFemaAssistance') flood_zip_sum[:20].plot(title='FOIA Data', ax=axs[1], kind='bar',x='Zip Code',y='Count Calls') fema_flood_zip = pd.DataFrame() fema_fl...
materialsvirtuallab/matgenb
notebooks/2013-01-01-Basic functionality.ipynb
bsd-3-clause
import pymatgen.core as mg """ Explanation: Introduction This notebook demostrates the core functionality of pymatgen, including the core objects representing Elements, Species, Lattices, and Structures. Written using: - pymatgen==2018.3.13 By convention, we import pymatgen as mg. End of explanation """ si = mg.Ele...
twschiller/frame-analysis
notebooks/Bitcoin Frame Analysis.ipynb
mit
import pandas as pd from pandas.io import gbq import matplotlib.pyplot as plt import math project_id = 'open-synthesis' def make_rules(body): return f""" (REGEXP_CONTAINS({body}, "currency") or REGEXP_CONTAINS({body}, "medium of exchange")) as currency, (REGEXP_CONTAINS({body}, "gold") and not REGEXP_CONTAINS({b...
astarostin/MachineLearningSpecializationCoursera
course3/week4/CookingLDA_PA.ipynb
apache-2.0
import json with open("recipes.json") as f: recipes = json.load(f) print recipes[1] """ Explanation: Programming Assignment Готовим LDA по рецептам Как вы уже знаете, в тематическом моделировании делается предположение о том, что для определения тематики порядок слов в документе не важен; об этом гласит гипотеза...
maxis42/ML-DA-Coursera-Yandex-MIPT
2 Supervised learning/Homework/10 1nn vs random forest/1NN против RandomForest.ipynb
mit
import numpy as np from sklearn.datasets import load_digits from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score """ Explanation: 1NN против RandomForest End of explanation """ #Loading digits dataset digits = load_digits() X = digits.data y = digits.target print(digits.DES...
feststelltaste/software-analytics
notebooks/Calculating Indentation-based Complexity.ipynb
gpl-3.0
import glob file_list = glob.glob("../../linux/**/*.[c|h]", recursive=True) file_list[:5] """ Explanation: Introduction In this blog post, I want to show you a nice complexity metric that works for most major programming languages that we use for our software systems – the indentation-based complexity metric. Ad...
AllenDowney/ProbablyOverthinkingIt
binomial.ipynb
mit
from __future__ import print_function, division %matplotlib inline %precision 6 import matplotlib.pyplot as plt import numpy as np from inspect import getsourcelines def show_code(func): lines, _ = getsourcelines(func) for line in lines: print(line, end='') """ Explanation: The binomial distributi...
lisitsyn/shogun
doc/ipython-notebooks/intro/Introduction.ipynb
bsd-3-clause
%pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') #To import all Shogun classes from shogun import * import shogun as sg """ Explanation: Machine Learning with Shogun By Saurabh Mahindre - <a href="https://github.com/Saurabh7">github.com/Saurabh7</a> as a part of ...
chengwliu/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
Chapter2_MorePyMC/Ch2_MorePyMC_PyMC3.ipynb
mit
import pymc3 as pm with pm.Model() as model: parameter = pm.Exponential("poisson_param", 1) data_generator = pm.Poisson("data_generator", parameter) """ Explanation: Chapter 2 Original content created by Cam Davidson-Pilon Ported to Python 3 and PyMC3 by Max Margenot (@clean_utensils) and Thomas Wiecki (@twie...
phoebe-project/phoebe2-docs
2.1/tutorials/mpi.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" import phoebe """ Explanation: Advanced: Running PHOEBE in MPI Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation...
fastai/fastai
nbs/examples/migrating_pytorch.ipynb
apache-2.0
from migrating_pytorch import * """ Explanation: Tutorial - Migrating from pure PyTorch Incrementally adding fastai goodness to your PyTorch models We're going to use the MNIST training code from the official PyTorch examples, slightly reformatted for space, updated from AdaDelta to AdamW, and converted from a scrip...
harishkrao/Python-for-Data-Analysis
Kaggle-US-Incomes/US Income Analysis Notebook.ipynb
mit
import pandas as pd from pandas import DataFrame, Series """ Explanation: Analysis of U.S. Incomes by Occupation and Gender Notebook by Harish Kesava Rao Use of this dataset should cite the Bureau of Labor Statistics as per their copyright information: The Bureau of Labor Statistics (BLS) is a Federal government agenc...
ajgpitch/qutip-notebooks
examples/landau-zener-stuckelberg.ipynb
lgpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from qutip import * from qutip.ui.progressbar import TextProgressBar as ProgressBar """ Explanation: QuTiP example: Landau-Zener-Stuckelberg inteferometry J.R. Johansson and P.D. Nation For more information about QuTiP see http://qutip.org End of...
GoogleCloudPlatform/asl-ml-immersion
notebooks/supplemental/labs/autoencoder.ipynb
apache-2.0
import glob import os import time import imageio import matplotlib.pyplot as plt import numpy as np import PIL import tensorflow as tf from IPython import display from tensorflow.keras import layers """ Explanation: Convolutional Autoencoder on MNIST dataset Learning Objective 1. Build an autoencoder architecture (co...
ddfabbro/ipython_tutorial
my_notebooks/facial_landmarks.ipynb
mit
import numpy as np #as always import dlib #machine learning library import matplotlib.pyplot as plt #to visualize things from PIL import Image #to manipulate images from urllib.request import urlretrieve #to download our dataset from io import BytesIO # these libraries are used to unzip from zipfile import Zip...
RaspberryJamBe/ipython-notebooks
notebooks/en-gb/101 - Intro - Getting to know Python and using IPython.ipynb
cc0-1.0
5+11 """ Explanation: Hm, Let's get started, shall we? This application is called IPython and can be used to execute Python code (where Python is a programming, language; a way of explaining to a computer what you want it to do for you). Select the cell with the sum below by clicking in it (a green border will appear ...
scottquiring/Udacity_Deeplearning
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 cod...
mne-tools/mne-tools.github.io
0.21/_downloads/f094864c4eeae2b4353a90789dd18b2b/plot_mixed_source_space_inverse.ipynb
bsd-3-clause
# Author: Annalisa Pascarella <a.pascarella@iac.cnr.it> # # License: BSD (3-clause) import os.path as op import matplotlib.pyplot as plt from nilearn import plotting import mne from mne.minimum_norm import make_inverse_operator, apply_inverse # Set dir data_path = mne.datasets.sample.data_path() subject = 'sample' ...
brettavedisian/phys202-2015-work
assignments/assignment10/ODEsEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy.integrate import odeint from IPython.html.widgets import interact, fixed """ Explanation: Ordinary Differential Equations Exercise 2 Imports End of explanation """ def lorentz_derivs(yvec, t, sigma, rho, beta): """Compute the the de...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_mne_dspm_source_localization.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import (make_inverse_operator, apply_inverse, write_inverse_operator) # sphinx_gallery_thumbnail_number = 9 """ Explanation: Source localization with MNE/dSPM/sLORETA The ...
d-k-b/udacity-deep-learning
intro-to-rnns/Anna_KaRNNa_Exercises.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is bas...
whitead/numerical_stats
project/type1_examples/airlines.ipynb
gpl-3.0
#loads the data from the spreadsheet data_part1 = pd.read_excel('Flight Delays Part 1.xlsx') FirstFourMonths = np.array(data_part1['Departure Delay (1-4, 2000)'][0:705]) #Sliced the array because pandas used cells that didn't have data in them SecondFourMonths = np.array(data_part1['Departure Delay (5-8, 2000)'][0:850...
balarsen/pymc_learning
pitch_angle/Cauchy1.ipynb
bsd-3-clause
# generate some data with pm.Model() as model: x = pm.Cauchy(name='x', alpha=0, beta=1) trace = pm.sample(10000, njobs=4) pm.traceplot(trace) sampledat = trace['x'] trace.varnames, trace['x'] sns.distplot(sampledat, kde=False, norm_hist=True) # plt.hist(sampledat, 200, normed=True); plt.yscale('log'); np...
LSSTDESC/Twinkles
examples/notebooks/postage_stamp_generation_inputs.ipynb
mit
import pandas as pd from astropy.io import fits import numpy as np from desc.sims.GCRCatSimInterface import InstanceCatalogWriter from lsst.sims.utils import SpecMap import matplotlib.pyplot as plt from lsst.utils import getPackageDir from lsst.sims.photUtils import Sed, BandpassDict, Bandpass from lsst.sims.catUtils.m...
eds-uga/csci1360e-su17
assignments/A10/A10_Q2.ipynb
mit
import sklearn.svm as svm import numpy as np np.random.seed(13775) X = np.random.random((20, 2)) y = np.random.randint(2, size = 20) m1 = train_svm(X, y, 100.0) assert m1.C == 100.0 np.testing.assert_allclose(m1.coef_, np.array([[ 0.392707, -0.563687]]), rtol=1e-6) import numpy as np np.random.seed(598497) X = np.ra...
pikinder/nn-patterns
examples/all_methods.ipynb
mit
%matplotlib inline import matplotlib import matplotlib.pyplot as plt import numpy as np import os import nn_patterns import nn_patterns.utils.fileio import nn_patterns.utils.tests.networks.imagenet import lasagne import theano import imp eutils = imp.load_source("utils", "./utils.py") """ Explanation: PatternNet and...
telecombcn-dl/2017-cfis
sessions/dream.ipynb
mit
import matplotlib.pyplot as plt %matplotlib inline from keras.applications import vgg16 from keras.layers import Input from dream import * """ Explanation: Deep Dream Deep Dream, or Inceptionism, was introduced by Google in this blogpost. Deep Dream is an algorithm that optimizes an input image so that it maximizes...
oscarmore2/deep-learning-study
gan_mnist/Intro_to_GANs_Solution.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...
rebeccabilbro/machine-learning
notebook/ML Class Session III.ipynb
mit
import matplotlib.pyplot as plt %matplotlib inline import pandas as pd df = pd.read_csv('../data/energy/energy.csv') df.shape df.describe() """ Explanation: Energy Efficiency What can you tell me about the data? End of explanation """ import matplotlib.pyplot as plt %matplotlib inline from pandas.tools.plotting im...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/plots_boxplots.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: Box Plots The following illustrates some options for the boxplot in statsmodels. These include violin_plot and bean_plot. End of explanation """ data = sm.datasets.anes96.load_pandas() party_ID = np.a...
JoeriHermans/ml-scripts
scripts/adverserial-variational-optimization/avo-notebook.ipynb
gpl-3.0
!date """ Explanation: Adverserial Variational Optimization Gilles Louppe & Kayle Cranmer Notebook by Joeri Hermans End of explanation """ import numpy as np import torch import math import matplotlib.mlab as mlab import torch.nn.functional as F import matplotlib.pyplot as plt from torch.autograd import Variable imp...
enakai00/jupyter_ml4se_commentary
Solutions/01-Basic Calculations-solution.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pandas import Series, DataFrame """ Explanation: 関数電卓として利用してみる End of explanation """ data_x = np.linspace(0,1,10) data_y = np.cos(2*np.pi*data_x) plt.plot(data_x, data_y) data_x = np.linspace(0,1,50) data_y = np.cos(2*np.pi*data_x) plt.plo...
computational-class/computational-communication-2016
code/04.PythonCrawlerGovernmentReport.ipynb
mit
import urllib2 from bs4 import BeautifulSoup from IPython.display import display_html, HTML HTML('<iframe src=http://www.hprc.org.cn/wxzl/wxysl/lczf/ width=1000 height=500></iframe>') # the webpage we would like to crawl """ Explanation: 数据抓取: 抓取47年政府工作报告 王成军 wangchengjun@nju.edu.cn 计算传播网 http://computational-co...
ibmsoe/tensorflow
tensorflow/examples/tutorials/deepdream/deepdream.ipynb
apache-2.0
# boilerplate code from __future__ import print_function import os from io import BytesIO import numpy as np from functools import partial import PIL.Image from IPython.display import clear_output, Image, display, HTML import tensorflow as tf """ Explanation: DeepDreaming with TensorFlow Loading and displaying the m...
AstroHackWeek/AstroHackWeek2017
day3/intermediate-docs.ipynb
mit
def do_something(arg1, arg2): """ A short sentence describing what this function does. More description Parameters ---------- arg1 : type1 Description of the parameter ``arg1`` arg2 : type2 Description of the parameter ``arg2`` Returns ------- t...
newworldnewlife/TensorFlow-Tutorials
16_Reinforcement_Learning.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import gym import numpy as np import math """ Explanation: TensorFlow Tutorial #16 Reinforcement Learning (Q-Learning) by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction This tutorial is about so-called Reinforcement Learni...
jorisvandenbossche/2015-EuroScipy-pandas-tutorial
solved - 01-pandas_introduction.ipynb
bsd-2-clause
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt pd.options.display.max_rows = 8 """ Explanation: <!--<img width=700px; src="../img/logoUPSayPlusCDS_990.png"> --> <p style="margin-top: 3em; margin-bottom: 2em;"><b><big><big><big><big>Introduction to Pandas</big></big></big></...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-1/cmip6/models/sandbox-2/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-1', 'sandbox-2', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: TEST-INSTITUTE-1 Source ID: SANDBOX-2 Topic: Ocean Sub-Topics: Timestepp...
tanghaibao/goatools
notebooks/relationships_change_dcnt_values.ipynb
bsd-2-clause
from goatools.base import get_godag godag = get_godag("go-basic.obo", optional_attrs={'relationship'}) go_leafs = set(o.item_id for o in godag.values() if not o.children) """ Explanation: Adding optional relationships changes the dcnt value SYNOPSIS: For GO:0019012, virion, the descendants count dcnt, is: * 0 when u...
fugufisch/hu_bp_python_course
03_advanced/advanced_python_tricks.ipynb
mit
import time t = time.localtime() t.tm_mday """ Explanation: Retrospective Interpreter Basic Calculations Data Structures Control flow Functions Documentation Packages Packages are folders containing Modules. If you are lucky, these modules also work together in a way. The folder needs to contain an __init__.py file...
ctuning/ck-math
script/explore-matrix-size-gemm-libs/explore-matrix-size-gemm-libs-analysis.ipynb
bsd-3-clause
repo_uoa = 'explore-matrix-size-gemm-libs-dvdt-prof-firefly-rk3399-001' """ Explanation: [PUBLIC] CLBlast vs ARM Compute Library on representative matrix sizes Overview Data [for developers] Code [for developers] Table Plot <a id="data"></a> Get the experimental data End of explanation """ import os import sys imp...
paulovn/ml-vm-notebook
vmfiles/IPNB/Examples/a Basic/02 NumPy essentials.ipynb
bsd-3-clause
import numpy as np """ Explanation: NumPy essentials NumPy is a Python library for manipulation of vectors and arrays. We import it just like any Python module: End of explanation """ # From Python lists or iterators n1 = np.array( [0,1,2,3,4,5,6] ) n2 = np.array( range(6) ) # Using numpy iterators n3 = np.arange( 1...
HSE-LaMBDA/modern-technologies-for-ml-and-big-data
lecture2/Sklearn_supervised_1.ipynb
mit
import numpy as np import scipy import sklearn import matplotlib.pyplot as plt %matplotlib inline mnist = np.loadtxt("../data/mnist_train.csv", delimiter=",", skiprows=1) X = mnist[:10000, 1:] y = mnist[:10000, 0] print X.shape def plot_roc_auc(y_score, y_test): from sklearn.metrics import roc_curve, auc ...
tritemio/multispot_paper
out_notebooks/usALEX-5samples-PR-raw-dir_ex_aa-fit-out-all-ph-27d.ipynb
mit
ph_sel_name = "all-ph" data_id = "27d" # ph_sel_name = "all-ph" # data_id = "7d" """ Explanation: Executed: Mon Mar 27 11:37:43 2017 Duration: 8 seconds. usALEX-5samples - Template This notebook is executed through 8-spots paper analysis. For a direct execution, uncomment the cell below. End of explanation """ fr...
AllenDowney/ModSim
soln/chap13.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
pedritomelenas/LMD
Naturales/Naturales.ipynb
mit
isinstance(4,int) isinstance([3,4],int) """ Explanation: Números naturales. Inducción. Recursividad. Naturales En python podemos utilizar isinstance para determinar si un objeto es un entero End of explanation """ def isnatural(n): if not isinstance(n,int): return false return n>=0 isnatural(3) is...
maartenbreddels/ipyvolume
notebooks/demo-0.5.ipynb
mit
fig = ipv.figure() vol_head = ipv.examples.head(max_shape=128); vol_head.ray_steps = 800 """ Explanation: We will render a low resolution scan of a head, which will display quite quickly (since the data size is small). If we want to see a higher resolution, we can zoom in. End of explanation """ ds = ipv.datasets.aq...
Upward-Spiral-Science/spect-team
Code/Assignment-9/SubjectSelectionExperiments.ipynb
apache-2.0
# Standard import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt # Dimensionality reduction and Clustering from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.cluster import MeanShift, estimate_bandwidth from sklearn import manifold, datasets from i...
rasbt/algorithms_in_ipython_notebooks
ipython_nbs/data-structures/singly-linked-list.ipynb
gpl-3.0
class SLLNode(object): def __init__(self, data, next_node=None): self.data = data self.next_node = next_node class SinglyLinkedList(object): def __init__(self, head=None): self.head = head def __repr__(self): s = '' if self.head is not None: curr...
MIT-LCP/mimic-code-sharing
notebooks/emergency-department-exploration.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 from IPython.display import display, HTML # used to print out pretty pandas dataframes import matplotlib.dates as dates import matplotlib.lines as mlines %matplotlib inline plt.style.use('ggplot') # specify user...
ChrisRucker/Samples
CRUCK v1.ipynb
mit
pwd import pandas as pd df = pd.read_csv('data.csv') df.tail() """ Explanation: <hr> <p><center>CHRISTOPHER</center><br><font size="2"><center>ASSOCIATE DATA SCIENTIST</center></font> <br><center>RUCKER</center></p> <hr> <p><font size="6"><em>-</em> LOADDATA <em>-</em></font></p> End of explanation """ modelRati...
amkatrutsa/MIPT-Opt
Spring2020/newton_quasi.ipynb
mit
import numpy as np USE_COLAB = False if USE_COLAB: !pip install git+https://github.com/amkatrutsa/liboptpy import liboptpy.unconstr_solvers as methods import liboptpy.step_size as ss n = 1000 m = 200 x0 = np.zeros((n,)) A = np.random.rand(n, m) * 10 """ Explanation: Метод Ньютона На прошлом семинаре... ...
jseabold/statsmodels
examples/notebooks/interactions_anova.ipynb
bsd-3-clause
%matplotlib inline from urllib.request import urlopen import numpy as np np.set_printoptions(precision=4, suppress=True) import pandas as pd pd.set_option("display.width", 100) import matplotlib.pyplot as plt from statsmodels.formula.api import ols from statsmodels.graphics.api import interaction_plot, abline_plot fr...
4dsolutions/Python5
Sieve of Eratosthenes.ipynb
mit
from IPython.display import YouTubeVideo YouTubeVideo('V08g_lkKj6Q') with open("primes_file.txt", "r") as primes: output = [] for line in primes.readlines()[3:]: # skip first 4 lines if line.strip() == 'end.': break for column in line.split(): num = int(column.strip()) ...
ES-DOC/esdoc-jupyterhub
notebooks/nuist/cmip6/models/sandbox-3/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nuist', 'sandbox-3', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: NUIST Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topics: Tracers. Propertie...
aleph314/K2
Getting and Cleaning Data/cleaning_exercises_all-regular.ipynb
gpl-3.0
import pandas as pd import numpy as np flights = pd.read_csv('flights/flights_sm_raw.csv') airlines = pd.read_csv('flights/airlines.csv') airports = pd.read_csv('flights/airports.csv') f_names = [name.lower() for name in list(flights.columns)] l_names = [name.lower() for name in list(airlines.columns)] p_names = [nam...
calroc/joypy
docs/0. This Implementation of Joy in Python.ipynb
gpl-3.0
import inspect import joy.utils.stack print inspect.getdoc(joy.utils.stack) """ Explanation: Joypy Joy in Python This implementation is meant as a tool for exploring the programming model and method of Joy. Python seems like a great implementation language for Joy for several reasons. We can lean on the Python immu...
rflamary/POT
docs/source/auto_examples/plot_convolutional_barycenter.ipynb
mit
# Author: Nicolas Courty <ncourty@irisa.fr> # # License: MIT License import numpy as np import pylab as pl import ot """ Explanation: Convolutional Wasserstein Barycenter example This example is designed to illustrate how the Convolutional Wasserstein Barycenter function of POT works. End of explanation """ f1 = 1...
StingraySoftware/notebooks
Spectral Timing/Spectral Timing Exploration.ipynb
mit
def load_and_cleanup_events(fname): """Load data and apply GTIs""" events = EventList.read(fname) lc = events.to_lc(dt=1) lc.apply_gtis() plt.figure() plt.plot(lc.time, lc.counts) new_gti = create_gti_from_condition(lc.time, lc.counts > 0, safe_interval=1) lc.gti = new_gti lc.apply_...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/launching_into_ml/solutions/python.BQ_explore_data.ipynb
apache-2.0
# Run the chown command to change the ownership !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Install the Google Cloud BigQuery library !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: Exploratory Data Analysis Using Python and BigQuery Learning Objectives Analyze a Pandas Da...
cloudmesh/book
notebooks/machinelearning/perceptronproblem.ipynb
apache-2.0
# import our packages import numpy as np from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Write your Own Perceptron In our examples, we have seen different algorithms and we could use scikit learn functions to get the paramters. However, do you know how is it implemented? To understand it, we c...
gmaze/guillaumemaze
python/20190501-InverseModel.ipynb
gpl-3.0
import numpy as np """ Explanation: Demonstrate linear inverse model for the heat budget Horizontal heat transports are non-linear terms if one assume that both temperatures and velocities have to be optimized. In order to keep the model as simple as possible, we hypothesized that only velocities require optimization....
flamingbear/ipython-notebooks
notebooks/nsidc0622-valid-ice-polygon-extensions.ipynb
mit
%matplotlib inline from netCDF4 import Dataset import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt """ Explanation: Describe the polygon extensions to the NIC climatology This document demonstrates how we extend the possible ice regions for the nsidc-0622 valid-ice-masks. From our documentatio...
mitchshack/data_analysis_with_python_and_pandas
2- IPython Notebooks and Raw Python Data Analysis/2-1 Raw Python - Maps.ipynb
apache-2.0
from __future__ import print_function x = range(0,10) x """ Explanation: Raw Python - Maps Mapping is basically mapping one value to another one, almost like a dictionary. This is a functional programming concept but can be useful in certain circumstances and will certainly come up in your data analysis career. This...
melissawm/oceanobiopython
Notebooks/Aula_4.ipynb
gpl-3.0
if (2>2): pass else: print("Oi") lista = [1,3,5,7,9] with open("novo.txt", "w") as arquivo: for item in lista: arquivo.write("Elemento: {}\n".format(item)) """ Explanation: Arquivos .csv/.xls Relembrando um pouco da aula passada: End of explanation """ import os os.remove("novo.txt") """ Explan...
MaxPowerWasTaken/MaxPowerWasTaken.github.io
jupyter_notebooks/Pandas Dont Apply _ Vectorize.ipynb
gpl-3.0
import pandas as pd df = pd.read_csv('datasets/quora_kaggle.csv') df.head(3) """ Explanation: "You rarely want to use DataFrame.apply" Tom Augspurger, one of the maintainers of Python's Pandas library for data analysis, has an awesome series of blog posts on writing idiomatic Pandas code. In fact you should probably ...
mne-tools/mne-tools.github.io
stable/_downloads/64e3b6395952064c08d4ff33d6236ff3/evoked_whitening.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD-3-Clause import mne from mne import io from mne.datasets import sample from mne.cov import compute_covariance print(__doc__) """ Explanation: Whitening evoked data with a noise covari...
maxis42/ML-DA-Coursera-Yandex-MIPT
4 Stats for data analysis/Homework/5 test student tests/Test Student tests.ipynb
mit
from __future__ import division import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.ensemble import RandomForestRegressor from scipy import stats from statsmodels.stats.weightstats import CompareMeans, DescrStatsW ...
skidzo/pydy
examples/mass_spring_damper/mass_spring_damper.ipynb
bsd-3-clause
from IPython.display import SVG SVG(filename='mass_spring_damper.svg') """ Explanation: Defining the Problem Here we will derive the equations of motion for the classic mass-spring-damper system under the influence of gravity. The following figure gives a pictorial description of the problem. End of explanation """ ...
alfkjartan/nvgimu
notebooks/Validation.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import nvg.ximu.ximudata as ximudata %matplotlib notebook """ Explanation: Validation of IMU calculations using marker data This notebook assumes that data exists in a database in the hdf5 format. For instructions how to set up the database with data see [../readme.md...
MatteusDeloge/opengrid
notebooks/Demo_Units_and_Conversions.ipynb
apache-2.0
import pandas as pd import charts from opengrid.library import misc, houseprint """ Explanation: This demo notebook shows how units are treated and how to apply unit conversions Opengrid makes use of the python library pint for unit conversions End of explanation """ hp = houseprint.Houseprint() sensors = hp.search...
Leguark/pynoddy
docs/notebooks/Test-Uncertainty-Analysis.ipynb
gpl-2.0
reload(pynoddy.history) reload(pynoddy.output) reload(pynoddy.experiment.uncertainty_analysis) reload(pynoddy) from pynoddy.experiment.uncertainty_analysis import UncertaintyAnalysis # the model itself is now part of the repository, in the examples directory: history_file = os.path.join(repo_path, "examples/fold_dyk...
gaufung/Data_Analytics_Learning_Note
python-statatics-tutorial/basic-theme/python-language/Regex.ipynb
mit
import re m = re.match('foo', 'foo') if m is not None: m.group() m m = re.match('foo', 'bar') if m is not None: m.group() re.match('foo', 'foo on the table').group() # raise attributeError re.match('bar', 'foo on the table').group() """ Explanation: 正则表达式 1 基础部分 管道符号(|)匹配多个正则表达式: at | home 匹配 at,home 匹配任意单一字...
albertfxwang/grizli
examples/Fitting-tools.ipynb
mit
%matplotlib inline import glob import time import os import numpy as np import matplotlib.pyplot as plt import astropy.io.fits as pyfits import drizzlepac import grizli import grizli.stack # Initialize the GroupFLT object we computed with WFC3IR_Reduction. When loaded from save files # doesn't much matter what `r...
diegocavalca/Studies
deep-learnining-specialization/4. Convolutional Neural Networks/resources/Convolution model - Step by Step - v1.ipynb
cc0-1.0
import numpy as np import h5py import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' %load_ext autoreload %autoreload 2 np.random.seed(1) """ Explanation: Convolut...
urgedata/pythondata
pyflux/Dynamic Linear Regression Models in Python.ipynb
mit
sales_df = pd.read_csv('../examples/retail_sales.csv', index_col='date', parse_dates=True) sales_df.head() """ Explanation: Load the data For this work, we're going to use the same retail sales data that we've used before. It can be found in the examples directory of this repository. End of explanation """ sales_df...
DoWhatILove/turtle
programming/python/notebooks/scikit/clustering/plot_segmentation_toy.ipynb
mit
print(__doc__) # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoquaux <gael.varoquaux@normalesup.org> # License: BSD 3 clause import numpy as np import matplotlib.pyplot as plt from sklearn.feature_extraction import image from sklearn.cluster import spectral_clustering l = ...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/mpi-esm-1-2-lr/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'mpi-esm-1-2-lr', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: MPI-M Source ID: MPI-ESM-1-2-LR Topic: Ocnbgchem Sub-Topics: Tracers. ...
tritemio/multispot_paper
usALEX-5samples-PR-raw-AND-gate.ipynb
mit
# data_id = "7d" """ Explanation: usALEX-5samples - Template This notebook is executed through 8-spots paper analysis. For a direct execution, uncomment the cell below. End of explanation """ from fretbursts import * init_notebook() from IPython.display import display """ Explanation: Load software and filenames ...
gmaze/guillaumemaze
argo/index_file/demo_how_to_traverse_argoindex.ipynb
gpl-3.0
import os import pandas as pd import numpy as np from netCDF4 import Dataset, num2date import multiprocessing num_processes = multiprocessing.cpu_count() # In[]: def read_argoindex(index_file): """ Read the Argo detailled index txt file and return it as a Panda Dataframe """ return pd.read_csv(index_file, ...
subhankarb/Machine-Learning-PlayGround
Machine-Learning-Specialization/machine_learning_classification/week1/module-2-linear-classifier-assignment.ipynb
apache-2.0
from __future__ import division import graphlab import math import string """ Explanation: Predicting sentiment from product reviews The goal of this first notebook is to explore logistic regression and feature engineering with existing GraphLab functions. In this notebook you will use product review data from Amazon....
snegirigens/DLND
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:] text.split()[199:205] """ Explanation: TV Script Generation In this project, you'll generate you...
maxis42/ML-DA-Coursera-Yandex-MIPT
5 Data analysis applications/Homework/2 project wage forecast for Russia/wine.ipynb
mit
%pylab inline import pandas as pd from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as plt import warnings from itertools import product def invboxcox(y,lmbda): if lmbda == 0: return(np.exp(y)) else: return(np.exp(np.log(lmbda*y+1)/lmbda)) wine = pd.read_csv('monthly-aust...
phoebe-project/phoebe2-docs
2.3/tutorials/building_a_system.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" import phoebe from phoebe import u # units import numpy as np import matplotlib.pyplot as plt logger = phoebe.logger() b = phoebe.Bundle() """ Explanation: Advanced: Building a System Setup Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this l...
rdhyee/nypl50
build_ebooks_SecondFolio_Issue26.ipynb
apache-2.0
from __future__ import print_function from github_settings import (ry_username, ry_password, username, password, token, GITENBERG_GITHUB_TOKEN, GITENBERG_TRAVIS_ACCESS_TOKEN, ...
P7h/FutureLearn__Learn_to_Code_for_Data_Analysis
Week#4/Week_4_exercises.ipynb
apache-2.0
import sys sys.version import warnings warnings.simplefilter('ignore', FutureWarning) import matplotlib matplotlib.rcParams['axes.grid'] = True # show gridlines by default %matplotlib inline from pandas import * show_versions() """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Exercise-note...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n06_hyperparameter_tuning.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 %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (20.0, 10...
Hyperparticle/deep-learning-foundation
lessons/autoencoder/Convolutional_Autoencoder_Solution.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
rishuatgithub/MLPy
torch/PYTORCH_NOTEBOOKS/04-RNN-Recurrent-Neural-Networks/03-RNN-Exercises-Solutions.ipynb
apache-2.0
# RUN THIS CELL import torch import torch.nn as nn from sklearn.preprocessing import MinMaxScaler import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() df = pd.read_csv('../Data/TimeSeriesD...
GuillaumeDec/machine-learning
deep-lstm-rnn-anomaly-detector/rnn_cloudmle.ipynb
gpl-3.0
!pip install --upgrade tensorflow import tensorflow as tf print tf.__version__ import numpy as np import tensorflow as tf import seaborn as sns import pandas as pd SEQ_LEN = 10 def create_time_series(): freq = (np.random.random()*0.5) + 0.1 # 0.1 to 0.6 ampl = np.random.random() + 0.5 # 0.5 to 1.5 x = np.sin...
keshr3106/ThinkStats2
code/chap03ex.ipynb
gpl-3.0
%matplotlib inline import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') import chap01soln resp = chap01soln.ReadFemResp() """ Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br> Allen Downey Read the female respondent file. End of explanation """ resp_numkdhh = resp....
SylvainCorlay/bqplot
examples/Marks/Pyplot/Image.ipynb
apache-2.0
import os import ipywidgets as widgets import bqplot.pyplot as plt from bqplot import LinearScale image_path = os.path.abspath('../../data_files/trees.jpg') with open(image_path, 'rb') as f: raw_image = f.read() ipyimage = widgets.Image(value=raw_image, format='jpg') ipyimage """ Explanation: The Image Mark Ima...
ChileanVirtualObservatory/DISPLAY
src/experiments/DISPLAY - 2011.0.00419.S 13CH3CN19-18.ipynb
gpl-3.0
file_path = '../data/2011.0.00419.S/sg_ouss_id/group_ouss_id/member_ouss_2013-03-06_id/product/IRAS16547-4247_Jet_13CH3CN19-18.clean.fits' noise_pixel = (15, 4) train_pixels = [(135, 135), (135, 136), (136, 135), (136, 136)] img = fits.open(file_path) meta = img[0].data hdr = img[0].header # V axis naxisv = hdr['NAX...
metpy/MetPy
dev/_downloads/0c4dbfdebeb6fcd2f5364a69f0c6d4a8/Skew-T_Layout.ipynb
bsd-3-clause
import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import add_metpy_logo, Hodograph, SkewT from metpy.units import units """ Explanation: Skew-T with Complex Layout Combine a Skew-T and a hodogra...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/06_structured/3_keras_wd.ipynb
apache-2.0
# change these to try this notebook out BUCKET = 'cloud-training-demos-ml' PROJECT = 'cloud-training-demos' REGION = 'us-central1' import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT os.environ['REGION'] = REGION %%bash if ! gsutil ls | grep -q gs://${BUCKET}/; then gsutil mb -l ${REGION} gs://$...
huiyi1990/maths-with-python
03-loops-control-flow.ipynb
mit
from math import pi def degrees_to_radians(theta_d): """ Convert an angle from degrees to radians. Parameters ---------- theta_d : float The angle in degrees. Returns ------- theta_r : float The angle in radians. """ theta_r = pi / 180.0 *...
davicsilva/dsintensive
notebooks/eda-miniprojects/racial_disc/sliderule_dsi_inferential_statistics_exercise_2.ipynb
apache-2.0
import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: Examining Racial Discrimination in the US Job Market Background Racial discrimination continues to be pervasive in cultures throughout the world. Researchers examined...
abhinavsingh/proxy.py
tutorial/connections.ipynb
bsd-3-clause
from proxy.core.connection import TcpServerConnection from proxy.common.utils import build_http_request from proxy.http.methods import httpMethods from proxy.http.parser import HttpParser, httpParserTypes request = build_http_request( method=httpMethods.GET, url=b'/', headers={ b'Host': b'jaxl.com'...
jdhp-docs/python_notebooks
nb_dev_python/python_scipy_integrate.ipynb
mit
f = lambda x: np.power(x, 2) result = scipy.integrate.quad(f, 0, 3) result """ Explanation: https://docs.scipy.org/doc/scipy-1.3.0/reference/tutorial/integrate.html https://docs.scipy.org/doc/scipy-1.3.0/reference/integrate.html Integrating functions, given callable object (scipy.integrate.quad) See: - https://docs....
flaviocordova/udacity_deep_learn_project
sentiment-rnn/Sentiment_RNN.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...