repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
jseabold/statsmodels | examples/notebooks/glm_formula.ipynb | bsd-3-clause | import statsmodels.api as sm
import statsmodels.formula.api as smf
star98 = sm.datasets.star98.load_pandas().data
formula = 'SUCCESS ~ LOWINC + PERASIAN + PERBLACK + PERHISP + PCTCHRT + \
PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF'
dta = star98[['NABOVE', 'NBELOW', 'LOWINC', 'PERASIAN', 'PE... |
NGSchool2016/ngschool2016-materials | jupyter/slebedeva/NGSchool_python_USERS.ipynb | gpl-3.0 | %pylab inline
"""
Explanation: Set the matplotlib magic to notebook enable inline plots.
End of explanation
"""
import subprocess
import matplotlib.pyplot as plt
import random
import numpy as np
"""
Explanation: Calculate the Nonredundant Read Fraction (NRF)
SAM format example:
SRR585264.8766235 0 1 ... |
markovg/nest-simulator | doc/model_details/HillTononiModels.ipynb | gpl-2.0 | import sys
import math
import numpy as np
import pandas as pd
import scipy.optimize as so
import scipy.integrate as si
import matplotlib.pyplot as plt
import nest
%matplotlib inline
plt.rcParams['figure.figsize'] = (12, 3)
"""
Explanation: The Hill-Tononi Neuron and Synapse Models
Hans Ekkehard Plesser, NMBU/FZ Jülic... |
d00d/quantNotebooks | Notebooks/quantopian_research_public/notebooks/lectures/Universe_Selection/notebook.ipynb | unlicense | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from quantopian.pipeline.classifiers.morningstar import Sector
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.research import run_pipeline
from quantopian.pipeline.data import mo... |
mathewzilla/redcard | Crowdstorming_visualisation.ipynb | mit | # IMPORTING LIBRARIES
print "importing libraries"
import pandas as pd # for dealing with csv import
import numpy as np # arrays and other matlab like manipulation
import os # for joining paths and fil... |
phoebe-project/phoebe2-docs | development/tutorials/spots.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Advanced: Spots
For an introduction features in general, see the features tutorial.
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
... |
AllenDowney/ModSimPy | soln/chap04soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import functions from the modsim library
from modsim import *
"""
Explanation: Modeling and Simulation... |
bspalding/research_public | lectures/drafts/How To - Computing Risk Ratios.ipynb | apache-2.0 | # Import libraries
import numpy as np
from statsmodels import regression
import statsmodels.api as sm
import matplotlib.pyplot as plt
import math
# Get data for the specified period and stocks
start = '2014-01-01'
end = '2015-01-01'
asset = get_pricing('TSLA', fields='price', start_date=start, end_date=end)
benchmark ... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/.ipynb_checkpoints/MeanMedianMode-checkpoint.ipynb | mit | import numpy as np
incomes = np.random.normal(27000, 15000, 10000)
np.mean(incomes)
"""
Explanation: Mean, Median, Mode, and introducing NumPy
Mean vs. Median
Let's create some fake income data, centered around 27,000 with a normal distribution and standard deviation of 15,000, with 10,000 data points. (We'll discuss... |
ssunkara1/bqplot | examples/Marks/Object Model/GridHeatMap.ipynb | apache-2.0 | np.random.seed(0)
data = np.random.randn(10, 10)
"""
Explanation: Get Data
End of explanation
"""
col_sc = ColorScale()
grid_map = GridHeatMap(color=data, scales={'color': col_sc})
Figure(marks=[grid_map], padding_y=0.0)
"""
Explanation: Basic Heat map
End of explanation
"""
x_sc, y_sc, col_sc = OrdinalScale(), ... |
Housebeer/Natural-Gas-Model | Data Analytics/.ipynb_checkpoints/Fitting curve-checkpoint.ipynb | mit | import pandas as pd
import numpy as np
from scipy.optimize import leastsq
import pylab as plt
N = 1000 # number of data points
t = np.linspace(0, 4*np.pi, N)
data = 3.0*np.sin(t+0.001) + 0.5 + np.random.randn(N) # create artificial data with noise
guess_mean = np.mean(data)
guess_std = 3*np.std(data)/(2**0.5)
guess_p... |
mne-tools/mne-tools.github.io | 0.23/_downloads/b11aa17d34c637b8e89ed78c8bdf13e4/eeglab_head_sphere.ipynb | bsd-3-clause | # Authors: Mikołaj Magnuski <mmagnuski@swps.edu.pl>
#
# License: BSD (3-clause)
import numpy as np
from matplotlib import pyplot as plt
import mne
print(__doc__)
"""
Explanation: How to plot topomaps the way EEGLAB does
If you have previous EEGLAB experience you may have noticed that topomaps
(topoplots) generated ... |
lawa42/Sputtering | Sputter yield.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: this is for ipyhton only
End of explanation
"""
# These are imported by Sputter funcs already but it doesn't harm to import tham again
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from math import log as ln
from itertools import cycle # used to create a l... |
matousc89/PPSI | podklady/notebooks/matplotlib.ipynb | mit | # inline plots
%matplotlib inline
# import matplotlib as plt acronym
import matplotlib.pylab as plt
# import numpy as np acronym
import numpy as np
"""
Explanation: Zobrazování dat s knihovnou Matplolib
Matplotlib je knihovna napsaná v Pythonu pro vizualizování dat různými způsoby. Jedná se o nejpoužívanější knihovn... |
JackDi/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
manahl/PyBloqs | docs/source/table_formatting.ipynb | lgpl-2.1 | %%capture
import pybloqs as abl
from pybloqs import Block
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(4,4), index=['a','b','c','d'], columns = ['aa','bb','cc','dd'])
df.index.name = 'ABC'
Block(df)
"""
Explanation: HTML Tables and Table Formatting
Creating a HTML Table from pandas.DataFrame... |
michaelaye/planet4 | notebooks/catalog_stats.ipynb | isc | %matplotlib ipympl
import seaborn as sns
sns.set()
sns.set_context('paper')
sns.set_palette('colorblind')
from planet4 import io, stats, markings, plotting, region_data
from planet4.catalog_production import ReleaseManager
fans = pd.read_csv("/Users/klay6683/Dropbox/data/planet4/p4_analysis/P4_catalog_v1.0/P4_catalog... |
kit-cel/wt | mloc/ch4_Autoencoders/BinaryAutoencoder_AWGN.ipynb | gpl-2.0 | import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from ipywidgets import interactive
import ipywidgets as widgets
device = 'cuda' if torch.cuda.is_available() else 'cpu'
print("We are using the following device for learning:",device)
""... |
Naereen/notebooks | Testing_the_lolviz_Python_module.ipynb | mit | %load_ext watermark
%watermark -v -m -p lolviz
from lolviz import *
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Testing-lolviz" data-toc-modified-id="Testing-lolviz-1"><span class="toc-item-num">1 </span>Testing <a href="https://github.com/parrt/lolviz" target="_blank">lolviz... |
tritemio/multispot_paper | out_notebooks/usALEX-5samples-PR-raw-AND-gate-out-27d.ipynb | mit | ph_sel_name = "None"
data_id = "27d"
# data_id = "7d"
"""
Explanation: Executed: Mon Mar 27 11:36:54 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
"""
from fretbursts import *
ini... |
cmshobe/landlab | notebooks/tutorials/ecohydrology/cellular_automaton_vegetation_DEM/cellular_automaton_vegetation_DEM.ipynb | mit | from __future__ import print_function
%matplotlib inline
import time
import numpy as np
from landlab.io import read_esri_ascii
from landlab import RasterModelGrid as rmg
from landlab import load_params
from Ecohyd_functions_DEM import (Initialize_, Empty_arrays, Create_PET_lookup,
Sav... |
emilioramirez/aacv2016 | lab1/Lab1.ipynb | gpl-3.0 | random_state = np.random.RandomState(12345)
"""
Explanation: Random
End of explanation
"""
dataset_path = abspath('scene_categories')
output_path = 'cache_n_50'
"""
Explanation: Data Preparation
Paths
End of explanation
"""
dataset = load_scene_categories(dataset_path)
n_classes = len(dataset['cname'])
n_images =... |
macks22/gensim | docs/notebooks/doc2vec-lee.ipynb | lgpl-2.1 | import gensim
import os
import collections
import smart_open
import random
"""
Explanation: Doc2Vec Tutorial on the Lee Dataset
End of explanation
"""
# Set file names for train and test data
test_data_dir = '{}'.format(os.sep).join([gensim.__path__[0], 'test', 'test_data'])
lee_train_file = test_data_dir + os.sep +... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/sandbox-2/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'sandbox-2', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: INM
Source ID: SANDBOX-2
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties: 3... |
timzhangau/ml_nano | practice_projects/cnn/transfer-learning/bottleneck_features.ipynb | mit | from keras.applications.vgg16 import preprocess_input
from keras.preprocessing import image
import numpy as np
import glob
img_paths = glob.glob("images/*.jpg")
def path_to_tensor(img_path):
# loads RGB image as PIL.Image.Image type
img = image.load_img(img_path, target_size=(224, 224))
# convert PIL.Imag... |
smharper/openmc | examples/jupyter/post-processing.ipynb | mit | %matplotlib inline
from IPython.display import Image
import numpy as np
import matplotlib.pyplot as plt
import openmc
"""
Explanation: This notebook demonstrates some basic post-processing tasks that can be performed with the Python API, such as plotting a 2D mesh tally and plotting neutron source sites from an eigen... |
tensorflow/docs-l10n | site/en-snapshot/probability/examples/Understanding_TensorFlow_Distributions_Shapes.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
mne-tools/mne-tools.github.io | 0.19/_downloads/7f0f8817512fdcca1eab8f4befa07ff9/plot_metadata_query.ipynb | bsd-3-clause | # Authors: Chris Holdgraf <choldgraf@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os
import pandas as pd
import matplotlib.pyplot as plt
import mne
# First load some data
events = mne.read_events(os.path.join(mne... |
edosedgar/xs-pkg | deep_learning/hw1/homework_main-basic.ipynb | gpl-2.0 | %matplotlib inline
from time import time, sleep
import numpy as np
import matplotlib.pyplot as plt
from IPython import display
import pandas as pd
from time import time
from tqdm import tqdm
"""
Explanation: Homework: Basic Artificial Neural Networks
The goal of this homework is simple, yet an actual implementation ma... |
kingb12/languagemodelRNN | model_comparisons/noing10_BOW_dropout.ipynb | mit | report_files = ["/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04dra/encdec_noing10_bow_200_512_04dra.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04drb/encdec_noing10_bow_200_512_04drb.json", "/Users/bking/IdeaProjects/Langu... |
mne-tools/mne-tools.github.io | 0.23/_downloads/7119b87595b4873e173edd147fee099b/dics_source_power.ipynb | bsd-3-clause | # Author: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Roman Goj <roman.goj@gmail.com>
# Denis Engemann <denis.engemann@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import mne
from mne.datasets import somato
from... |
eriksalt/jupyter | Python Quick Reference/Strings.ipynb | mit | # convert another data type into a string
s = str(42)
s
# convert to a string with 2 decimal places
'{:.2f}'.format(3.14159)
"""
Explanation: Python Strings Quick Reference
Table of contents
<a href="#1.-Converting-To-Strings">Converting To Strings</a>
<a href="#2.-Get-Parts-Of-A-String">Get Parts Of A String</a>
<a... |
nsaunier/CIV8760 | 03-traitement-donnees.ipynb | mit | # exemples de structures finies de données
# chaîne de caractères
s = "Hello"
# booléen
a = True
b = False
b == (not a) # True
# entier
x = 3
# réel
y = 3.4
# classes
class RoadUser:
def __init__(self, position, velocity):
self.name = ''
self.position = position
self.velocity = velo... |
GoogleCloudPlatform/tensorflow-without-a-phd | tensorflow-rnn-tutorial/old-school-tensorflow/tutorial/01_RNN_generator_solution.ipynb | apache-2.0 | import math
import numpy as np
from matplotlib import pyplot as plt
import utils_prettystyle
import utils_batching
import utils_display
import tensorflow as tf
print("Tensorflow version: " + tf.__version__)
"""
Explanation: An RNN model to generate sequences
RNN models can generate long sequences based on past data. T... |
Cristianobam/UFABC | Unidade3-Atividades.ipynb | mit | num = int(input('Número de moedas: '))
div = num // 3
rest = num % 3
print('Cada irmão ganhará {} moeda(s) e Alice ficará com {} moeda(s)'.format(div,rest))
"""
Explanation: Unidade 3 - Atividades
Agora vamos treinar mais alguns problemas com entrada e saída, e mais alguns cálculos
Distribuição de moedas
Alice tem v... |
qingshuimonk/STA663 | docs/VAE_raw.ipynb | mit | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Variational Autoencoder
This scripts contains module for implementing variational autoencoder, the... |
scikit-optimize/scikit-optimize.github.io | dev/notebooks/auto_examples/sampler/initial-sampling-method-integer.ipynb | bsd-3-clause | print(__doc__)
import numpy as np
np.random.seed(1234)
import matplotlib.pyplot as plt
from skopt.space import Space
from skopt.sampler import Sobol
from skopt.sampler import Lhs
from skopt.sampler import Halton
from skopt.sampler import Hammersly
from skopt.sampler import Grid
from scipy.spatial.distance import pdist
... |
as595/AllOfYourBases | CDT-KickOff/TUTORIAL/KeplerLightCurve.ipynb | gpl-3.0 | #%matplotlib inline
"""
Explanation: KeplerLightCurve.ipynb
‹ KeplerLightCurve.ipynb › Copyright (C) ‹ 2017 › ‹ Anna Scaife - anna.scaife@manchester.ac.uk ›
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Found... |
asignor/DANDP3 | DANDP3.ipynb | mit | mapping = {'avenida':'Avenida', #mapping to fix case mispellings, case, abbreviations
u'Al.': 'Alameda',
'Rue': 'Rua',
u'Av.': 'Avenida',
u'Av': 'Avenida',
'RUa': 'Rua',
'R': 'Rua',
'Acost.': 'Acostamento',
'RUA': 'Rua',
... |
tknapen/eyetracking_course | notebooks/pupil/deconvolution.ipynb | mit | times*sample_rate
# times for epoching:
epoch_times = [0, 3] # in seconds
# mean response:
epochs = np.vstack([convolved_signal_noise[int(i)+int(epoch_times[0]*sample_rate):int(i)+int(epoch_times[1]*sample_rate)] for i in times*sample_rate])
mean_response = np.mean(epochs, axis=0)
# plot mean response versus IRF:
ti... |
Danghor/Formal-Languages | Exercises/LaTeX2HTML/LaTeX2HTML.ipynb | gpl-2.0 | with open('example.tex') as f:
data = f.read()
"""
Explanation: Converting $\LaTeX$ to <span style="font-variant:small-caps;">Html</span>
The purpose of the following exercise is to implement a translator from $\LaTeX$ to
MathML. $\LaTeX$ is a document markup language
that is especially well suited to present te... |
info-370/classification | decision-trees/decision-tree-complete.ipynb | mit | # Load packages
import pandas as pd
from sklearn import tree
from __future__ import division
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# Read data
df = pd.read_csv('./data/housing-data.c... |
Aggieyixin/cjc2016 | code/15.network_science.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import networkx as nx
Gu = nx.Graph()
for i, j in [(1, 2), (1, 4), (4, 2), (4, 3)]:
Gu.add_edge(i,j)
nx.draw(Gu, with_labels = True)
"""
Explanation: 网络科学简介
王成军
wangchengjun@nju.edu.cn
计算传播网 http://computational-communication.com
FROM SADDAM HUSSEIN TO NETWOR... |
ES-DOC/esdoc-jupyterhub | notebooks/pcmdi/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: PCMDI
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emission... |
jepegit/cellpy | dev_utils/lookup/cellpy_file_check.ipynb | mit | old_step_table = my_data.dataset.steps.copy()
my_data.make_step_table_new()
new_step_table = my_data.dataset.steps.copy()
mask_current_negative = new_step_table.loc[:, "current_avr"] < -0.0000000000001
mask_discharge_changed = new_step_table.loc[:, "discharge_delta"].abs() > 2.0
mask_current_negative & mask_discharg... |
hannorein/rebound | ipython_examples/Megno.ipynb | gpl-3.0 | def simulation(par):
a, e = par # unpack parameters
sim = rebound.Simulation()
sim.integrator = "whfast"
sim.ri_whfast.safe_mode = 0
sim.dt = 5.
sim.add(m=1.) # Star
sim.add(m=0.000954, a=5.204, M=0.600, omega=0.257, e=0.048)
sim.add(m=0.000285, a=a, M=0.871, omega=1.616, e=e)
sim.mo... |
datamicroscopes/release | examples/titanic.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from microscopes.models import dd as dirichlet_discrete
from microscopes.models import bb as beta_bernoulli
from microscopes.models import gp as gamma_poisson
from microscopes.models import nich as normal_inverse_chisquared
fro... |
ldiary/marigoso | notebooks/simplified_selenium_functions.ipynb | mit | from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://python.org.')
download = browser.find_element_by_link_text('Downloads')
download.click()
download = browser.find_element_by_id('downloads')
ul = download.find_element_by_tag_name('ul')
lis = ul.find_elements_by_tag_name('li')
"""
Explana... |
bryangraham/ipt | Notebooks/Average_Regression_Monte_Carlo_Experiments .ipynb | mit | # Direct Python to plot all figures inline (i.e., not in a separate window)
%matplotlib inline
# Load libraries
import numpy as np
import numpy.linalg
import scipy as sp
import scipy.optimize
import pandas as pd
# Append location of ipt module base directory to system path
# NOTE: only required if permanent install... |
sysid/kg | cac/twcado.ipynb | mit | import random
import time
import sys
stdout = sys.stdout
#sys.stdout = open(CW_DIR+'/keras_output.txt', 'a+')
#sys.stdout = stdout
from glob import glob
import utils
from utils import *
import importlib
importlib.reload(utils)
import twBase
importlib.reload(twBase)
from keras.preprocessing import image
from IPytho... |
namco1992/algorithms_in_python | data_structures/stack.ipynb | mit | class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(self):
... |
kellyrowland/openmc | docs/source/pythonapi/examples/mgxs-part-iii.ipynb | mit | import math
import pickle
from IPython.display import Image
import matplotlib.pylab as pylab
import numpy as np
import openmc
import openmc.mgxs
from openmc.statepoint import StatePoint
from openmc.summary import Summary
from openmc.source import Source
from openmc.stats import Box
import openmoc
import openmoc.proce... |
evanmiltenburg/python-for-text-analysis | Chapters/Chapter 13 - Working with Python files.ipynb | apache-2.0 | import os
cwd = os.getcwd()
cwd_escaped_spaces = cwd.replace(' ', '\ ')
print('cd', cwd_escaped_spaces)
"""
Explanation: Chapter 13 - Working with Python files
In the previous blocks, we've mainly used notebooks to develop and run our Python code. In this chapter, we'll introduce how to create Python modules (.py file... |
anthonyng2/FX-Trading-with-Python-and-Oanda | Oanda v20 REST-oandapyV20/04.00 Order Management.ipynb | mit | import pandas as pd
import oandapyV20
import oandapyV20.endpoints.orders as orders
import configparser
config = configparser.ConfigParser()
config.read('../config/config_v20.ini')
accountID = config['oanda']['account_id']
access_token = config['oanda']['api_key']
client = oandapyV20.API(access_token=access_token)
da... |
Xilinx/PYNQ | boards/Pynq-Z1/base/notebooks/pmod/pmod_pwm.ipynb | bsd-3-clause | from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
"""
Explanation: Pmod PWM
In this notebook, The Pmod PWM driver is exercised. Specifically, An AXI Timer is used to a generate pulse width modulated (PWM) signal.
To see the results of this notebook, you will need a Digilent Analog Discovery ... |
swans-one/pgh-python-generators-presentation | 03-Generator-Expressions.ipynb | mit | numbers = [1, 2, 3, 4, 5, 4, 3, 2, 1]
list_comp = [n for n in numbers if n < 3]
print(list_comp)
gen_exp = (n for n in numbers if n < 3)
print(gen_exp)
"""
Explanation: Generator expressions are like list-comprehensions
Except they don't return a list, they return a generator object. This can have pretty big perform... |
tensorflow/docs-l10n | site/ja/guide/autodiff.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... |
agiovann/Constrained_NMF | demos/notebooks/demo_motion_correction.ipynb | gpl-2.0 | from builtins import zip
from builtins import str
from builtins import map
from builtins import range
from past.utils import old_div
import cv2
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import psutil
import scipy
from skimage.external.tifffile import TiffFile
import sys
import time
impor... |
willettk/insight | notebooks/panama_papers.ipynb | apache-2.0 | %matplotlib inline
# Import packages
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
# Load in data from the Panama Papers ICIJ site (set of CSV files)
addresses = pd.read_csv("Addresses.csv",
dtype={'address':str,
... |
matthewzhenggong/fiwt | workspace_py/.ipynb_checkpoints/RigStaticRollId-Exp36-checkpoint.ipynb | lgpl-3.0 | %run matt_startup
%run -i matt_utils
button_qtconsole()
#import other needed modules in all used engines
#with dview.sync_imports():
# import os
"""
Explanation: Parameter Estimation of RIG Roll Experiments
Setup and descriptions
Without ACM model
Turn on wind tunnel
Only 1DoF for RIG roll movement
Use small-ampl... |
gabll/some-like-it-hoax | logistic-regression/logreg_tests.ipynb | mit | import json
import numpy as np
import pandas as pd
with open('likers.json') as data_file:
data = json.load(data_file)
print('Json length: %s' % len(data))
hoax_pages = {'188189217954979',
'253520844711659',
'199277020680',
'233426770069342',
'68091825232',
... |
Olouge/titanic_survival_exploration | titanic_survival_exploration.ipynb | gpl-3.0 | # Import libraries necessary for this project
import numpy as np
import pandas as pd
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualizations code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Load the dataset
in_file... |
caromedellin/Python-notes | exploratory-data-analysis/.ipynb_checkpoints/DataClean-checkpoint.ipynb | mit | import pandas as pd
import numpy as np
"""
Explanation: Cleaning the Data and creating a sparce matrix
I start by importing the basic libraries and the data from a file.
End of explanation
"""
legislatorsData = pd.read_csv("../data/legislators.csv")
legislatorsData.head()
legislatorsData.columns
legislators = pd.Dat... |
prk327/CoAca | 2_Plotting_Distributions.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# the commonly used alias for seaborn is sns
import seaborn as sns
# set a seaborn style of your taste
sns.set_style("whitegrid")
# data
df = pd.read_csv("./global_sales_data/market_fact.csv")
"""
Explanation: Visualising Distributions of Data
I... |
wtsi-medical-genomics/team-code | python-club/notebooks/regular-expressions.ipynb | gpl-2.0 | pass_regex = 'PASS'
"""
Explanation: Regular Expressions
Daniel Rice
Introduction
Definition
Examples
Exercise 1
Decomposing the syntax
Character classes
Metacharacters
Repetition
Capture groups
Regex's in Python
match
search
Introduction
Definition
A regular expression (also known as a RE, regex, regex pattern,... |
pyrdr/charlas | periodicos-dominicanos/Facebook_News_Scrapper.ipynb | mit | # import some Python dependencies
import urllib.request as urllib2
import json
import datetime
import csv
import time
# Este es mi app id y app secret, cambienlo al suyo pls.
app_id = "175344463016958"
app_secret = "3ab6d67e8ab1f74095b8e4d9e1cff37e"
access_token = app_id + "|" + app_secret
page_id = 'DiarioLibre' ... |
mroberge/HydroCloud | resources/example-Jupyter-Notebook.ipynb | mit | # Import the libraries that we'll be using
import numpy as np
import pandas as pd
import hydropy as hp
# Set the notebook to plot graphs in the output cells.
%matplotlib inline
"""
Explanation: Quick Start with HydroPy!
an example of incorporating HydroCloud into a Jupyter Notebook.
NOTE: HydroPy is not required to u... |
phoebe-project/phoebe2-docs | 2.1/tutorials/grav_redshift.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Gravitational Redshift (rv_grav)
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
"""
%matplo... |
phoebe-project/phoebe2-docs | 2.3/tutorials/MESH.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: 'mesh' Datasets and Options
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
"""
import phoebe
logger = phoebe.logger()
b = phoebe.defa... |
cshallue/models | research/nst_blogpost/4_Neural_Style_Transfer_with_Eager_Execution.ipynb | apache-2.0 | import os
img_dir = '/tmp/nst'
if not os.path.exists(img_dir):
os.makedirs(img_dir)
!wget --quiet -P /tmp/nst/ https://upload.wikimedia.org/wikipedia/commons/d/d7/Green_Sea_Turtle_grazing_seagrass.jpg
!wget --quiet -P /tmp/nst/ https://upload.wikimedia.org/wikipedia/commons/0/0a/The_Great_Wave_off_Kanagawa.jpg
!wge... |
Featuretools/featuretools | docs/source/getting_started/using_entitysets.ipynb | bsd-3-clause | import featuretools as ft
data = ft.demo.load_mock_customer()
transactions_df = data["transactions"].merge(data["sessions"]).merge(data["customers"])
transactions_df.sample(10)
"""
Explanation: Representing Data with EntitySets
An EntitySet is a collection of dataframes and the relationships between them. They are us... |
ledeprogram/algorithms | class6/donow/argueso_olaya_donow6.ipynb | gpl-3.0 | import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import statsmodels.formula.api as smf
"""
Explanation: 1. Import the necessary packages to read in the data, plot, and create a linear regression model
End of explanation
"""
df = pd.read_csv("hanford.csv")
"""
Explanation: 2. Read in the hanfo... |
authman/DAT210x | Module3/Module3 - Lab4.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
# This is new
from pandas.tools.plotting import parallel_coordinates
# Look pretty...
# matplotlib.style.use('ggplot')
plt.style.use('ggplot')
"""
Explanation: DAT210x - Programming with Python for DS
Module3 - Lab4
End of explanation
"""
# .. ... |
marcinofulus/PR2014 | MPI/PR_MPI_game_of_life.ipynb | gpl-3.0 | %%writefile game_of_life_utils.py
import numpy as np
from scipy.signal import convolve2d
def life_step_1(X):
"""Game of life step using generator expressions"""
nbrs_count = sum(np.roll(np.roll(X, i, 0), j, 1)
for i in (-1, 0, 1) for j in (-1, 0, 1)
if (i != 0 or j !=... |
wmfschneider/CHE30324 | Homework/HW7-soln.ipynb | gpl-3.0 | import sympy as sy
import numpy as np
from sympy import *
r = Symbol('r')
I = integrate(exp(-2*r**2)*r**2,(r,0,+oo))
C = sqrt(1/I)
print(latex(simplify(C)))
"""
Explanation: Chem 30324, Spring 2020, Homework 7
Due March 27, 2020
Variations on the hydrogen atom:
The variational principle guarantees that the expectatio... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/supplemental/solutions/object_detection_with_automl.ipynb | apache-2.0 | pip freeze | grep google-cloud-automl==1.0.1 || pip install google-cloud-automl==1.0.1
pip freeze | grep google-cloud-storage==1.27.0 || pip install google-cloud-storage==1.27.0
import os
from google.cloud import automl
import tensorflow as tf
"""
Explanation: <b>Object Detection with AutoML Vision</b>
<br>
<b>Lear... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Concent... |
nadvamir/deep-learning | reinforcement/Q-learning-cart.ipynb | mit | import gym
import tensorflow as tf
import numpy as np
"""
Explanation: Deep Q-learning
In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called Cart-Pole. In this game, a freely swinging p... |
tedwards2412/upper-limit | MLR/An_Exclusive_Guide_to_Exclusion_Limits.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import poisson, norm, chi2
from scipy.optimize import minimize, brentq
import warnings; warnings.simplefilter('ignore') # ignore some numerical errors
"""
Explanation: An Exclusive Guide to Exclusion Limits
In this notebook we will... |
bspalding/research_public | lectures/drafts/Characterizing data - skewness and kurtosis.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
# Plot a normal distribution with mean = 0 and standard deviation = 2
xs = np.linspace(-6,6, 300)
normal = stats.norm.pdf(xs)
plt.plot(xs, normal);
"""
Explanation: Skewness and symmetry
By Evgenia "Jenny" Nitishinskaya and Delaney Granizo... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-ll/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-LL
Topic: Ocean
Sub-Topics: Timestepping Framework, Advec... |
jacobdein/alpine-soundscapes | Regression model - biophony.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
import pandas
import numpy
from os import path
%matplotlib inline
from matplotlib import pyplot
from matplotlib.patches import Rectangle
import seaborn
import mpld3
from mpld3 import plugins
from pymc3 import glm, Model, NUTS, sample, stats, \
fores... |
thesby/CaffeAssistant | tutorial/ipynb/mnist_siamese.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Make sure that caffe is on the python path:
caffe_root = '../../' # this file is expected to be in {caffe_root}/examples/siamese
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
"""
Explanation: Setup
Import Caffe and the usual... |
dchad/malware-detection | mmcc/feature-selection-final.ipynb | gpl-3.0 | # Just import everything we might need, it saves time.
import warnings
import numpy as np
import scipy as sp
import pandas as pd
import sklearn as skl
import matplotlib.pyplot as plt
from time import time
from scipy.stats import randint as sp_randint
from sklearn.metrics import log_loss, confusion_matrix, accuracy_scor... |
RayleighChen/SummerVac | wu/dataAnly.ipynb | gpl-2.0 | train.plot('y', '10', 'scatter')
"""
Explanation: <font color=#DC143C size=4>发现特征10的std跟mean差也差不多十倍,这个特征应该有特别之处,我们来看看到底有什么特别</font>
End of explanation
"""
fig = plt.figure()
ax = Axes3D(fig)
# ax.plot_surface(train.loc[:, 'y'], train.loc[:, '1'], train.loc[:, '2'], rstride=1, cstride=1, cmap='rainbow')
ax.scatter(tr... |
dimarkov/pyBefit | examples/social_influence/test_inference_for_rw_hgf_sgf.ipynb | mit | import numpy as np
from scipy import io
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
sns.set(style = 'white', color_codes = True)
%matplotlib inline
import sys
import os
import os
cwd = os.getcwd()
sys.path.append(cwd[:-len('befit/examples/social_influence')])
"""
Explanation: Here we w... |
balarsen/pymc_learning | Counting/Two pulser.ipynb | bsd-3-clause | %matplotlib inline
from pprint import pprint
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc3 as mc
import spacepy.toolbox as tb
import spacepy.plot as spp
import tqdm
from scipy import stats
import seaborn as sns
sns.set(font_scale=1.5)
# matplotlib.pyplot.rc('fig... |
xtr33me/deep-learning | batch-norm/Batch_Normalization_Lesson.ipynb | mit | # Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"... |
donK23/pyData-Projects | EventDec/event_dec/notebook/0_Cleaning.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Cleaning
Cleaning of provided dataset and enhancement of features
End of explanation
"""
data_f = "../data/events.csv"
raw_data = pd.read_csv(data_f)
print(raw_data.shape)
print(raw_data.dtypes)... |
deercoder/0-PhD | TensorFlow/ex2/ex2.ipynb | mit | import tensorflow as tf
import numpy as np
## ex2_sgd.py
W = tf.Variable([.3], tf.float32)
b = tf.Variable([-.3], tf.float32)
x = tf.placeholder(tf.float32)
# create a linear model, y = w * x + b
linear_model = W * x + b
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
... |
poppy-project/poppy-ergo-jr | software/samples/notebooks/Record, Save and Play Moves on Poppy Ergo Jr.ipynb | gpl-3.0 | from IPython.display import YouTubeVideo
YouTubeVideo('DJHOopBgPqs')
"""
Explanation: Record, Save and Play Moves on Poppy Ergo Jr
This notebook intends to show you how to:
record movements using physical demonstrations,
replay those movements and sequence them,
save them to the hard drive and reload them.
An illus... |
sraejones/phys202-2015-work | assignments/assignment05/MatplotlibEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 3
Imports
End of explanation
"""
def well2d(x, y, nx, ny, L=1.0):
"""Compute the 2d quantum well wave function."""
# YOUR CODE HERE
s=2/L*np.sin((nx*np.pi*x)/L)*np.sin ((ny*np.pi*y)/L)
return s
... |
DruidSmith/Python-Matching-Algorithms | String Comparison.ipynb | apache-2.0 | # Note - these lines added to make it work with shared Jupyter Hub instance,
# modifying the system path so that locally installed modules installed with the shell commands below will be found -
# they would need to be modified for your instance, or to install the modules normally remove the --user param
# import sy... |
jmhsi/justin_tinker | data_science/courses/deeplearning1/nbs/imagenet_batchnorm.ipynb | apache-2.0 | from theano.sandbox import cuda
%matplotlib inline
import utils; reload(utils)
from utils import *
from __future__ import print_function, division
"""
Explanation: This notebook explains how to add batch normalization to VGG. The code shown here is implemented in vgg_bn.py, and there is a version of vgg_ft (our fine... |
jazracherif/algorithms | max-spacing-k-clustering/max-spacing-k-clustering.ipynb | mit | import random
import numpy as np
class union_find_pc(object):
def __init__(self, nodes):
self.leader = [i for i in range(len(nodes))]
self.rank = [0 for i in range(len(nodes))]
self.clusters = set([i for i in range(len(nodes))])
def FIND(self, x):
n = x
... |
oseledets/fastpde2017 | lectures/fenics_overview.ipynb | mit | %matplotlib notebook
from __future__ import print_function
import fenics
import matplotlib.pyplot as plt
"""
Explanation: FEniCS overview
https://fenicsproject.org/
Overview
FEniCS means Finite Elements + Computational Software and 'ni' just "sits nicely in the middle"
Finite elements solver for PDE
Easy-to-use notat... |
MLWave/kepler-mapper | docs/notebooks/Adapters.ipynb | mit | import kmapper
from sklearn import datasets
import networkx as nx
"""
Explanation: Adapters example
Demonstration using the networkx adapter. This example requires installing the networkx library before continuing:
pip install networkx
End of explanation
"""
data = datasets.make_circles(n_samples=1000)[0]
km = kma... |
kgrodzicki/machine-learning-specialization | course-2-regression/notebooks/week-2-multiple-regression-assignment-1-blank2.ipynb | mit | import graphlab
"""
Explanation: Regression Week 2: Multiple Regression (Interpretation)
The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions.
In this notebook you will use data on house sales in King County to predict prices using multiple regressi... |
WNoxchi/Kaukasos | quantum/openfermion-projectq-demo-codealong.ipynb | mit | %matplotlib inline
%reload_ext autoreload
%autoreload 2
"""
Explanation: OpenFermion Project Q Demo
Wayne H Nixalo – 2018/6/26
A codealong of the OpenFermion ProjectQ demo example.
End of explanation
"""
import os
import numpy as np
from scipy.optimize import minimize as scipy_minimize
from openfermion.config imp... |
plopd/music-mining-massive-datasets | tutorials/sheet_03_Exercise_1.ipynb | mit | X = np.array([[-3, -2],[-2, -1], [-1, 0], [0,1], [1,2], [2,3], [-2,-2], [-1,-1], [0,0], [1,1], [2,2], [-2,-3], [-1,-2], [0, -1], [1, 0], [2,1], [3,2]])
mean_X = 1.0/X.shape[0] * np.dot(X.T, np.ones(shape=(X.shape[0],1)))
"""
Explanation: Exercise 1 - Principal Component Analysis
End of explanation
"""
cov_X = 1.0/X... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.