repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/tensorflow/c_batched.ipynb
apache-2.0
import tensorflow.compat.v1 as tf import numpy as np import shutil print(tf.__version__) """ Explanation: <h1> 2c. Refactoring to add batching and feature-creation </h1> In this notebook, we continue reading the same small dataset, but refactor our ML pipeline in two small, but significant, ways: <ol> <li> Refactor t...
ES-DOC/esdoc-jupyterhub
notebooks/thu/cmip6/models/sandbox-2/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'thu', 'sandbox-2', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: THU Source ID: SANDBOX-2 Topic: Aerosol Sub-Topics: Transport, Emissions, Concent...
cavestruz/MLPipeline
notebooks/time_series/sample_time_series.ipynb
mit
import numpy as np from matplotlib import pyplot as plt from astroML.time_series import lomb_scargle, generate_damped_RW from astroML.time_series import ACF_scargle """ Explanation: In this first example, we will explore a simulated lightcurve that follows a damped random walk, which is often used to model variabilit...
SubhankarGhosh/NetworkX
7. Bipartite Graphs (Instructor).ipynb
mit
G = cf.load_crime_network() G.edges(data=True)[0:5] G.nodes(data=True)[0:10] """ Explanation: Introduction Bipartite graphs are graphs that have two (bi-) partitions (-partite) of nodes. Nodes within each partition are not allowed to be connected to one another; rather, they can only be connected to nodes in the othe...
theandygross/TCGA_differential_expression
Notebooks/Figures/Purgatory/DX_screen_figs.ipynb
mit
import NotebookImport from Imports import * import seaborn as sns sns.set_context('paper',font_scale=1.5) sns.set_style('white') """ Explanation: Differential Analysis Import everything from the imports notebook. This reads in all of the expression data as well as the functions needed to analyse differential expressi...
willsa14/ras2las
data/kgs/DownloadLogs_v1.ipynb
mit
elogs = pd.read_csv('temp/ks_elog_scans.txt', parse_dates=True) lases = pd.read_csv('temp/ks_las_files.txt', parse_dates=True) elogs_mask = elogs['KID'].isin(lases['KGS_ID']) # Create mask for elogs both_elog = elogs[elogs_mask] # select items elog that fall in both both_elog_unique = both_elog.drop_duplicates('KID')...
ES-DOC/esdoc-jupyterhub
notebooks/cccr-iitm/cmip6/models/sandbox-3/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-3', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: CCCR-IITM Source ID: SANDBOX-3 Topic: Atmos Sub-Topics: Dynamical Core, Radiati...
CNS-OIST/STEPS_Example
user_manual/source/memb_pot.ipynb
gpl-2.0
from __future__ import print_function # for backward compatibility with Py2 import steps.model as smodel import steps.geom as sgeom import steps.rng as srng import steps.solver as ssolver import steps.utilities.meshio as meshio import numpy import math import time from random import * """ Explanation: Simulating Membr...
beyondvalence/biof509_wtl
Wk10-feature_selection_dimension_reduction_clustering/Wk10-dimensionality-reduction-clustering.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline """ Explanation: Week 10 - Dimensionality reduction and clustering Learning Objectives List options available for dimensionality reduction in scikit-learn Discuss different clustering algorithms Demonstrate clustering in scikit-learn End of explan...
mbeyeler/opencv-machine-learning
notebooks/04.05-Representing-Images.ipynb
mit
import cv2 import matplotlib.pyplot as plt %matplotlib inline img_bgr = cv2.imread('data/lena.jpg') """ Explanation: <!--BOOK_INFORMATION--> <a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: ...
Upward-Spiral-Science/spect-team
Code/Assignment-3/Exploratory_Kmeans_PCA.ipynb
apache-2.0
%matplotlib inline import matplotlib.pyplot as plt print '\nPlot the distributions of unknown columns (BSC, GSC, LDS):' print '\nBSC_1 to BSC_101' bsc = ['BSC_' + str(i) for i in xrange(1, 102)] plot = df_unknowns[bsc].plot(kind='hist', alpha=0.5, legend=None) print '\nPlot several random BSC samples:' fig, axes = ...
aschaffn/phys202-2015-work
assignments/assignment07/AlgorithmsEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import numpy as np """ Explanation: Algorithms Exercise 2 Imports End of explanation """ def find_peaks(a): """Find the indices of the local maxima in a sequence.""" a = np.array(a) s = np.sign(np.diff(a)) d = np.diff(s) ...
qutip/qutip-notebooks
examples/heom/heom-1d-spin-bath-model-ohmic-fitting.ipynb
lgpl-3.0
%pylab inline import contextlib import time import numpy as np from scipy.optimize import curve_fit from qutip import * from qutip.nonmarkov.heom import HEOMSolver, BosonicBath # Import mpmath functions for evaluation of gamma and zeta functions in the expression for the correlation: from mpmath import mp mp.dps...
augfranco/CienciadosDados
Projeto02.ipynb
mit
%%capture #Instalando o tweepy !pip install tweepy """ Explanation: Projeto 2 - Classificador Automático de Sentimento - Augusto Franco e Pedro Isidoro Você foi contratado por uma empresa parar analisar como os clientes estão reagindo a um determinado produto no Twitter. A empresa deseja que você crie um programa que...
mne-tools/mne-tools.github.io
0.18/_downloads/ae1f146de31a4665192262a211d6d103/plot_metadata_epochs.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 mne import numpy as np import matplotlib.pyplot as plt # Load the data from the internet path = mne.datasets.kiloword.data_path() ...
cbuntain/TutorialSocialMediaCrisis
notebooks/T03 - Parsing Twitter Data.ipynb
apache-2.0
jsonString = '{"key": "value"}' # Parse the JSON string dictFromJson = json.loads(jsonString) # Python now has a dictionary representing this data print ("Resulting dictionary object:\n", dictFromJson) # Will print the value print ("Data stored in \"key\":\n", dictFromJson["key"]) # This will cause an error! print ...
mattilyra/gensim
docs/notebooks/gensim_news_classification.ipynb
lgpl-2.1
import os import re import operator import matplotlib.pyplot as plt import warnings import gensim import numpy as np warnings.filterwarnings('ignore') # Let's not pay heed to them right now import nltk nltk.download('stopwords') # Let's make sure the 'stopword' package is downloaded & updated nltk.download('wordnet')...
blue-yonder/tsfresh
notebooks/advanced/05 Timeseries Forecasting (multiple ids).ipynb
mit
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pylab as plt from tsfresh import extract_features, select_features from tsfresh.utilities.dataframe_functions import roll_time_series, make_forecasting_frame from tsfresh.utilities.dataframe_functions import impute try: import pandas_dat...
tata-antares/tagging_LHCb
Analysis-scheme.ipynb
apache-2.0
from IPython.display import Image import pandas """ Explanation: Inclusive B-tagging Authors: Tatiana Likhomanenko (contact) Alexey Rogozhnikov Denis Derkach Data (from working group): real data $B^{\pm} \to J/\psi K^{\pm}$ (RECO 14), 2012 real data $B_d \to J/\psi K^*$ (RECO 14), 2012 (use EPM for assymetry estima...
catherinezucker/dustcurve
Old_Runs/tutorial_6slices.ipynb
gpl-3.0
import emcee from dustcurve import model import seaborn as sns import numpy as np from dustcurve import pixclass import matplotlib.pyplot as plt import pandas as pd import warnings from dustcurve import io from dustcurve import hputils from dustcurve import kdist from dustcurve import globalvars as gv %matplotlib inlin...
jaekookang/useful_bits
Speech/Extract_Pitch_using_Praat/Extract_Pitch.ipynb
mit
import os import numpy as np from subprocess import Popen, PIPE from sys import platform import pdb """ Explanation: Extract fundamental frequency (F0 or pitch) using Python <br> - tested: Python3.6 on Linux and Mac - 2017-09-24 jk Logic: 1) Generate Praat script temporarily within Python script 2) Run the Praat scri...
peterbraden/tensorflow
tensorflow/examples/tutorials/deepdream/deepdream.ipynb
apache-2.0
# boilerplate code import os from cStringIO import StringIO 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 model graph Naive feature visua...
Lstyle1/Deep_learning_projects
autoencoder/Convolutional_Autoencoder.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...
qutip/qutip-notebooks
examples/heom/heom-3-quantum-heat-transport.ipynb
lgpl-3.0
import numpy as np import matplotlib import matplotlib.pyplot as plt %matplotlib inline import qutip as qt from qutip.nonmarkov.heom import HEOMSolver, DrudeLorentzPadeBath, BathExponent from ipywidgets import IntProgress from IPython.display import display # Qubit parameters epsilon = 1 # System operators H1 = e...
zchq88/MyUdacityDeepLearningProject
1/dlnd-your-first-neural-network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
ES-DOC/esdoc-jupyterhub
notebooks/hammoz-consortium/cmip6/models/sandbox-3/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: HAMMOZ-CONSORTIUM Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timeste...
adlyons/AWOT
examples/awot_utilities_intro.ipynb
gpl-2.0
# Load the needed packages import os import matplotlib.pyplot as plt import numpy as np from netCDF4 import Dataset import awot %matplotlib inline """ Explanation: <h2>Introducing miscellaneous utilities in AWOT.</h2> <h4>This notebook will grow over time as utilites are added and I have time to update.</h4> End of ...
scikit-optimize/scikit-optimize.github.io
0.8/notebooks/auto_examples/ask-and-tell.ipynb
bsd-3-clause
print(__doc__) import numpy as np np.random.seed(1234) import matplotlib.pyplot as plt from skopt.plots import plot_gaussian_process """ Explanation: Async optimization Loop Bayesian optimization is used to tune parameters for walking robots or other experiments that are not a simple (expensive) function call. Tim He...
stephensekula/smu-honors-physics
fractals_random/fractal_from_random.ipynb
mit
import pickle,glob import numpy as np import matplotlib.pyplot as plt import pandas as pd %pylab inline """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Generating-Fractal-From-Random-Points---The-Chaos-Game" data-toc-modified-id="Generating-Fractal-From-Random-Points---The-Chaos-Game-1"><sp...
Shatnerz/rhc
connection.ipynb
mit
import sys sys.path.append('/opt/rhc') """ Explanation: Defining outbound connections Start by making sure rhc is in python's path, End of explanation """ import rhc.micro as micro import rhc.async as async """ Explanation: and importing a couple of components. End of explanation """ p=micro.load_connection([ ...
tanghaibao/goatools
notebooks/parents_and_ancestors.ipynb
bsd-2-clause
import os from goatools.obo_parser import GODag # Load a small test GO DAG and all the optional relationships, # like 'regulates' and 'part_of' godag = GODag('../tests/data/i126/viral_gene_silence.obo', optional_attrs={'relationship'}) """ Explanation: How to traverse to GO parents and ancestors Travers...
utensil/julia-playground
py/CGA-galgebra.ipynb
mit
cga3d = Ga(r'e_1 e_2 e_3 e e_{0}',g='1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 -1,0 0 0 -1 0') cga3d.g e1,e2,e3,e,e0 = cga3d.mv() ep = Rational(1,2) * e - e0 ep en = Rational(1,2) * e + e0 en ep**2 en**2 ep|en e0**2 e**2 E = e^e0 E E == ep^en == ep * en E**2 E.rev() == -E E * ep == -en E * en == -ep ep * E ...
lrayle/rental-listings-census
src/Geographically_weight_regression.ipynb
bsd-3-clause
# # TODO: add putty connection too. # #read SSH connection parameters # with open('ssh_settings.json') as settings_file: # settings = json.load(settings_file) # hostname = settings['hostname'] # username = settings['username'] # password = settings['password'] # local_key_dir = settings['local_key_dir'] # c...
tjwei/HackNTU_Data_2017
Week01/01-Numpy.ipynb
mit
# 起手式 import numpy as np """ Explanation: Numpy 介紹 End of explanation """ np.array([1,2,3,4]) x = _ y = np.array([[1.,2,3],[4,5,6]]) y """ Explanation: 建立 ndarray End of explanation """ x.shape y.shape x.dtype y.dtype """ Explanation: 看 ndarray 的第一件事情: shape , dtype End of explanation """ # import matplo...
Who8MyLunch/ipynb_widget_canvas
notebooks/03 - Different Ways to Display an Image.ipynb
mit
from __future__ import print_function, unicode_literals, division, absolute_import import io import IPython from ipywidgets import widgets import PIL.Image from widget_canvas import CanvasImage from widget_canvas.image import read """ Explanation: Image Display Examples End of explanation """ data_image = read('i...
eTomate/ML-TextLearning-Intro
TextLearningSkLearn.ipynb
mit
%%capture !pip install scikit-learn scipy numpy pandas matplotlib import pandas as pd import numpy as np import math %matplotlib inline """ Explanation: Text Learning with sklearn This notebook will give you a short overview over text learning with skLearn. At first we will install and import the required python pac...
SciTools/courses
course_content/cartopy_course/cartopy_intro.ipynb
gpl-3.0
import matplotlib.pyplot as plt import cartopy.crs as ccrs """ Explanation: A First Look at Cartopy (for Iris) Course aims and objectives The aim of the cartopy course is to introduce the cartopy library and highlight of some of its features. The learning outcomes of the cartopy course are as follows. By the end of th...
zhsun/neu-cs5700
network_basics.ipynb
mit
s = 'Hello world!' print(s) print("length is", len(s)) us = 'Hello 世界!' print(us) print("length is", len(us)) """ Explanation: String vs. Bytes Text in Python 3 is always Unicode and is represented by the str type, and binary data is represented by the bytes type. They cannot be mixed. Strings can be encoded to bytes...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex33-View Northeast Pacifc sea surface temperature based on an ensemble empirical mode decomposition.ipynb
mit
%matplotlib inline import xarray as xr from PyEMD import EEMD import numpy as np import pylab as plt plt.rcParams['figure.figsize'] = (9,5) """ Explanation: View Northeast Pacific SST based on an Ensemble Empirical Mode Decomposition The oscillation of sea surface temperature (SST) has substantial impacts on the glo...
metpy/MetPy
v0.11/_downloads/c93092487c8713b537d47b1774b1c063/unit_tutorial.ipynb
bsd-3-clause
import numpy as np from metpy.units import units """ Explanation: Units Tutorial Early in our scientific careers we all learn about the importance of paying attention to units in our calculations. Unit conversions can still get the best of us and have caused more than one major technical disaster, including the crash...
AllenDowney/ProbablyOverthinkingIt
test_scenario_sim.ipynb
mit
from __future__ import print_function, division from thinkbayes2 import Pmf from random import random def flip(p): return random() < p def run_single_simulation(func, iters=1000000): pmf_t = Pmf([0.2, 0.4]) p = 0.1 s = 0.9 outcomes = Pmf() post_t = Pmf() for i in range(iters): t...
carlosclavero/PySimplex
Documentation/Tutorial librería Simplex.py.ipynb
gpl-3.0
from PySimplex import Simplex from PySimplex import rational import numpy as np number="2" print(Simplex.convertStringToRational(number)) number="2/5" print(Simplex.convertStringToRational(number)) # Si recibe algo que no es un string, devuelve None number=2 print(Simplex.convertStringToRational(number)) """ Explan...
poppy-project/pypot
samples/notebooks/QuickStart playing with a PoppyErgo.ipynb
gpl-3.0
from pypot.creatures import PoppyErgo ergo = PoppyErgo() """ Explanation: QuickStart: Playing with a Poppy Ergo (or a PoppyErgoJr) This notebook is still work in progress! Feedbacks are welcomed! In this tutorial we will show how to get started with your PoppyErgo creature. You can use a PoppyErgoJr instead. <img src...
LeeBergstrand/pygenprop
docs/source/_static/tutorial/tutorial.ipynb
apache-2.0
import requests from io import StringIO from pygenprop.results import GenomePropertiesResults, GenomePropertiesResultsWithMatches, \ load_assignment_caches_from_database, load_assignment_caches_from_database_with_matches from pygenprop.database_file_parser import parse_genome_properties_flat_file from pygenprop.ass...
wuafeing/Python3-Tutorial
01 data structures and algorithms/01.03 keep last n items.ipynb
gpl-3.0
from collections import deque q = deque(maxlen = 3) q.append(1) q.append(2) q.append(3) q q.append(4) q q.append(5) q """ Explanation: Previous 1.3 保留最后N个元素 问题 在迭代操作或者其他操作的时候,怎样只保留最后有限几个元素的历史记录? 解决方案 保留有限历史记录正是 collections.deque 大显身手的时候。比如,下面的代码在多行上面做简单的文本匹配, 并返回匹配所在行的前 N 行: ``` python from collections import deque...
ueapy/ueapy.github.io
content/notebooks/2019-02-14-matplotlib-subplots-callum.ipynb
mit
import numpy as np import matplotlib.pyplot as plt """ Explanation: Today we'll be using matplotlib's pyplot to make clearer, prettier figures. First we import packages and generate some data to plot. End of explanation """ plt.rcParams.update({"font.size": 20}) """ Explanation: Pump up the font sizes on plots. Bet...
csc-training/python-introduction
notebooks/examples/5.2 Strings.ipynb
mit
ananasakäämä = "höhö 电脑" print(ananasakäämä) """ Explanation: Strings The most major difference between Python versions 2 and 3 is in string handling. In Python 3 all strings are by default Unicode strings. The Python interpreter expects Python source files to be UTF-8 encoded Unicode strings. What Unicode is beyond ...
sueiras/training
tensorflow/00-Intro_to_tensorflow.ipynb
gpl-3.0
# Header # Basic libraries & options from __future__ import print_function #Basic libraries import numpy as np import tensorflow as tf print('Tensorflow version: ', tf.__version__) import time # Select GPU import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="1" #Show images impo...
sujitpal/polydlot
src/pytorch/11-shape-generation.ipynb
apache-2.0
from __future__ import division, print_function from sklearn.metrics import accuracy_score, confusion_matrix import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import matplotlib as mat import matplotlib.pyplot as plt import os import shutil %matplot...
rasbt/algorithms_in_ipython_notebooks
ipython_nbs/essentials/divide-and-conquer-algorithm-intro.ipynb
gpl-3.0
def linear_search(lst, item): for i in range(len(lst)): if lst[i] == item: return i return -1 lst = [1, 5, 8, 12, 13] for k in [8, 1, 23, 11]: print(linear_search(lst=lst, item=k)) """ Explanation: Introduction to Divide-and-Conquer Algorithms The subfamily of Divide-and-Conquer algor...
dennisobrien/bokeh
examples/howto/Categorical Data.ipynb
bsd-3-clause
from bokeh.io import show, output_notebook from bokeh.models import CategoricalColorMapper, ColumnDataSource, FactorRange from bokeh.plotting import figure output_notebook() """ Explanation: Handling Categorical Data with Bokeh End of explanation """ fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'St...
kwant-project/kwant-tutorial-2016
3.3.MagnetoResistance.ipynb
bsd-2-clause
from types import SimpleNamespace from math import cos, sin, pi %run matplotlib_setup.ipy from matplotlib import pyplot import numpy as np import scipy.stats as reg import kwant lat = kwant.lattice.square() s_0 = np.identity(2) s_z = np.array([[1, 0], [0, -1]]) s_x = np.array([[0, 1], [1, 0]]) s_y = np.array([[0, -...
chainsawriot/pycon2016hk_sklearn
Super_textbook.ipynb
mit
from sklearn.datasets import load_breast_cancer ourdata = load_breast_cancer() print ourdata.DESCR print ourdata.data.shape ourdata.data ourdata.target ourdata.target.shape ourdata.target_names """ Explanation: Textbook examples Fairy tales kind of situation The data has been processed, ready to analysis The lear...
sbussmann/buda-rank
notebooks/Insight Bayesian Workshop/Insight Bayesian Workshop - Artificial Data.ipynb
mit
import pandas as pd import os import numpy as np import pymc3 as pm import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline true_rating = { 'All Stars': 2.0, 'Average': 0.0, 'Just Having Fun': -1.2, } true_index = { 0: 'All Stars', 1: 'Average', 2: 'Just Having Fun', } n_tea...
AllenDowney/ModSimPy
soln/filter_soln.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.py module from modsim import * """ Explanation: Modeling and Simulati...
geo-fluid-dynamics/phaseflow-fenics
tutorials/FEniCS/00-StefanProblem.ipynb
mit
import fenics """ Explanation: Solving the Stefan problem with finite elements This Jupyter notebook shows how to solve a Stefan problem with finite elements using FEniCS. Python packages Import the Python packages for use in this notebook. We use the finite element method library FEniCS. End of explanation """ impo...
albahnsen/PracticalMachineLearningClass
exercises/E20-NeuralNetworksKeras.ipynb
mit
import numpy as np import keras import pandas as pd import matplotlib.pyplot as plt """ Explanation: E20- Neural Networks in Keras Use keras framework to solve the below exercises. End of explanation """ # Import dataset data = pd.read_csv('https://raw.githubusercontent.com/albahnsen/PracticalMachineLearningClass/...
esa-as/2016-ml-contest
Facies_classification.ipynb
apache-2.0
%matplotlib inline import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as colors from mpl_toolkits.axes_grid1 import make_axes_locatable from pandas import set_option set_option("display.max_rows", 10) pd.options.mode.chained_assignment = None filen...
napsternxg/GET17_SNA
notebooks/Twitter.ipynb
gpl-3.0
if not os.path.isfile(TWITTER_CONFIG_FILE): with open(os.path.join(DATA_DIR, "twitter_config.sample.json")) as fp: creds = json.load(fp) for k in sorted(creds.keys()): v = input("Enter %s:\t" % k) creds[k] = v print(creds) with open(TWITTER_CONFIG_FILE, "w+") as fp: ...
DistrictDataLabs/ceb-training
notes/BLS Timeseries Data Exploration.ipynb
mit
# Imports import csv import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from itertools import groupby from operator import itemgetter """ Explanation: BLS Timeseries Data Exploration In this workbook, I've set up a data frame of Bureau of Labor Statistics time series dat...
alexandrnikitin/algorithm-sandbox
courses/DAT256x/Module03/03-05-Transformations Eigenvectors and Eigenvalues.ipynb
mit
import numpy as np v = np.array([1,2]) A = np.array([[2,3], [5,2]]) t = A@v print (t) """ Explanation: Transformations, Eigenvectors, and Eigenvalues Matrices and vectors are used together to manipulate spatial dimensions. This has a lot of applications, including the mathematical generation of 3D comp...
arcyfelix/Courses
17-08-31-Zero-to-Deep-Learning-with-Python-and-Keras/6 Convolutional Neural Networks.ipynb
apache-2.0
import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt """ Explanation: Convolutional Neural Networks Machine learning on images End of explanation """ from keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.load_data('/tmp/mnist.npz') X_train.shape X_test....
tensorflow/docs-l10n
site/en-snapshot/tfx/tutorials/serving/rest_simple.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...
saullocastro/pyNastran
docs/quick_start/demo/op2_pandas_multi_case.ipynb
lgpl-3.0
import os import pandas as pd import pyNastran from pyNastran.op2.op2 import read_op2 pkg_path = pyNastran.__path__[0] model_path = os.path.join(pkg_path, '..', 'models') """ Explanation: Static & Transient DataFrames in PyNastran The iPython notebook for this demo can be found in: - docs\quick_start\demo\op2_pand...
glennrfisher/introduction-to-machine-learning
notebook/Teaching a Computer to Diagnose Cancer.ipynb
mit
import pandas as pd import numpy as np import sklearn.cross_validation import sklearn.neighbors import sklearn.metrics import matplotlib.pyplot as plt import matplotlib.patches as mpatches import seaborn as sns # enable matplotlib mode %matplotlib inline # configure plot readability sns.set_style("white") sns.set_con...
tlkh/Generating-Inference-from-3D-Printing-Jobs
Simple Data Plots (W1 - W4 data).ipynb
mit
import numpy as np import csv %run 'preprocessor.ipynb' #our own preprocessor functions """ Explanation: Simple 2D Plots using Matplotlib These plots are for the data obtained from the cohort classroom printers from Week 1 to Week 4 of Term 2. Import dependencies End of explanation """ with open('data_w1w4.csv', 'r'...
rcrehuet/Python_for_Scientists_2017
notebooks/6_1_linear_regression.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline x = np.arange(10.) y = 5*x+3 np.random.seed(3) y+= np.random.normal(scale=10,size=x.size) plt.scatter(x,y); def lin_reg(x,y): """ Perform a linear regression of x vs y. x, y are 1 dimensional numpy arrays returns alpha and beta for ...
ES-DOC/esdoc-jupyterhub
notebooks/bcc/cmip6/models/sandbox-1/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-1', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: BCC Source ID: SANDBOX-1 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radiat...
NYUDataBootcamp/Materials
Code/notebooks/bootcamp_pandas-summarize.ipynb
mit
import sys # system module import pandas as pd # data package import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module import numpy as np # foundation for Pandas %matplotlib inline ...
gaufung/Data_Analytics_Learning_Note
Data_Analytics_in_Action/pandasIO.ipynb
mit
import numpy as np import pandas as pd csvframe=pd.read_csv('myCSV_01.csv') csvframe # 也可以通过read_table来读写数据 pd.read_table('myCSV_01.csv',sep=',') """ Explanation: Pandas 数据读写 API 读取 | 写入 --- | --- read_csv | to_csv read_excel | to_excel read_hdf | to_hdf read_sql | to_sql read_json | to_json read_html | to_html read...
google-research/computation-thru-dynamics
experimental/notebooks/Contextual Integration RNN Tutorial.ipynb
apache-2.0
# Numpy, JAX, Matplotlib and h5py should all be correctly installed and on the python path. from __future__ import print_function, division, absolute_import import datetime import h5py import jax.numpy as np from jax import random from jax.experimental import optimizers import matplotlib.pyplot as plt import numpy as o...
QuantConnect/Lean
Tests/Research/RegressionTemplates/BasicTemplateResearchPython.ipynb
apache-2.0
import warnings warnings.filterwarnings("ignore") # Load in our startup script, required to set runtime for PythonNet %run ./start.py # Create an instance qb = QuantBook() # Select asset data spy = qb.AddEquity("SPY") """ Explanation: Welcome to The QuantConnect Research Page Refer to this page for documentation ht...
kthouz/NYC_Green_Taxi
NYC Green Taxi.ipynb
mit
# Download the September 2015 dataset if os.path.exists('data_september_2015.csv'): # Check if the dataset is present on local disk and load it data = pd.read_csv('data_september_2015.csv') else: # Download dataset if not available on disk url = "https://s3.amazonaws.com/nyc-tlc/trip+data/green_tripdata_2015-09...
hpparvi/PyTransit
notebooks/roadrunner/roadrunner_model_example_1.ipynb
gpl-2.0
%pylab inline rc('figure', figsize=(13,5)) def plot_lc(time, flux, c=None, ylim=(0.9865, 1.0025), ax=None): if ax is None: fig, ax = subplots() else: fig, ax = None, ax ax.plot(time, flux, c=c) ax.autoscale(axis='x', tight=True) setp(ax, xlabel='Time [d]', ylabel='Flux', xlim=time[[...
hannorein/rebound
ipython_examples/RadialVelocity.ipynb
gpl-3.0
import rebound import emcee # pip install emcee import corner # pip install corner import numpy as np import matplotlib.pyplot as plt """ Explanation: Fitting Radial Velocity Data This example shows how to fit a dynamical model of a star and two planets to a set of radial velocity observations using the N-body integra...
xMyrst/BigData
python/howto/010_Importar_Módulos.ipynb
gpl-3.0
# Importamos solo la función array del modulo numpy from numpy import array a = array( [2,3,4] ) a # Importamos todo el módulo numpy import numpy a = numpy.array( [2,3,4] ) a # Importamos el módulo numpy y le asignamos el alias 'np' # Cuando queramos importar funciones de dicho módulo lo haremos refiri...
mdeff/ntds_2016
toolkit/01_sol_acquisition_exploration.ipynb
mit
# Number of posts / tweets to retrieve. # Small value for development, then increase to collect final data. n = 4000 # 20 """ Explanation: A Python Tour of Data Science: Data Acquisition & Exploration Michaël Defferrard, PhD student, EPFL LTS2 1 Exercise: problem definition Theme of the exercise: understand the impac...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/custom/showcase_custom_image_classification_online.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: Custom training image classification model for online prediction <ta...
permamodel/permamodel
notebooks/Ku_2D.ipynb
mit
import os,sys sys.path.append('../../permamodel/') from permamodel.components import bmi_Ku_component from permamodel import examples_directory import numpy as np %matplotlib inline import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, addcyclic import matplotlib as mpl print examples_directory ...
hashiprobr/redes-sociais
encontro22/small-world.ipynb
gpl-3.0
import sys sys.path.append('..') import socnet as sn import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Encontro 22: Mundos Pequenos Importando as bibliotecas: End of explanation """ from random import random def generate_random_graph(num_nodes, c): g = sn.generate_empty_graph(num_nodes) ...
drvinceknight/gt
nbs/solutions/08-Evolutionary-Game-Theory.ipynb
mit
import sympy as sym x_1 = sym.symbols("x_1") sym.solveset(3 * x_1 - 2 * (1 - x_1), x_1) """ Explanation: Evolutionary game theory - solutions Assume the frequency dependent selection model for a population with two types of individuals: $x=(x_1, x_2)$ such that $x_1 + x_2 = 1$. Obtain all the stable distribution for ...
gregcaporaso/short-read-tax-assignment
ipynb/mock-community/taxonomy-assignment-trimmed-dbs.ipynb
bsd-3-clause
from os.path import join, expandvars from joblib import Parallel, delayed from glob import glob from os import system from tax_credit.framework_functions import (parameter_sweep, generate_per_method_biom_tables, move_results_to_rep...
rrbb014/data_science
fastcampus_dss/2016_05_23/0523_04__누적 분포 함수와 확률 밀도 함수.ipynb
mit
%%tikz \filldraw [fill=white] (0,0) circle [radius=1cm]; \foreach \angle in {60,30,...,-270} { \draw[line width=1pt] (\angle:0.9cm) -- (\angle:1cm); } \draw (0,0) -- (90:0.8cm); """ Explanation: 누적 분포 함수와 확률 밀도 함수 누적 분포 함수(cumulative distribution function)와 확률 밀도 함수(probabiligy density function)는 확률 변수의 분포 즉, 확률 분포를...
makeyourowntextminingtoolkit/makeyourowntextminingtoolkit
A03_svd_applied_to_slightly_bigger_word_document_matrix.ipynb
gpl-2.0
#import pandas for conviently labelled arrays import pandas # import numpy for SVD function import numpy # import matplotlib.pyplot for visualising arrays import matplotlib.pyplot as plt """ Explanation: SVD Applied to a Word-Document Matrix This notebook applies the SVD to a simple word-document matrix. The aim is to...
tensorflow/tpu
tools/colab/bert_finetuning_with_cloud_tpus.ipynb
apache-2.0
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
landlab/landlab
notebooks/tutorials/groundwater/groundwater_flow.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from landlab import RasterModelGrid, imshow_grid from landlab.components import GroundwaterDupuitPercolator, FlowAccumulator from landlab.components.uniform_precip import PrecipitationDistribution """ Explanation: <a href="http://landlab.github.io"><img style="float:...
slowvak/MachineLearningForMedicalImages
notebooks/Module 1.ipynb
mit
%matplotlib inline import os import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import pandas as pd import csv from pandas.tools.plotting import scatter_matrix from sklearn import preprocessing import nibabel as nib """ Explanation: Module 1 - Data Load / Display / Normalizatio...
egentry/lamat-2016-solutions
day2/randomness.ipynb
mit
poisson_samples = np.random.poisson(lam=1.5, size=20) print(poisson_samples) gaussian_samples = np.random.normal(loc=-5.0, scale=2.0, size=20) print(gaussian_samples) """ Explanation: Activity description See: https://docs.google.com/document/d/1COdCXs4K6kAXLcVvYxG3fqS53l2gzbkDvbbTmm8ZF1U/edit?usp=sharing Example gen...
miklevin/pipulate
examples/LESSON08_Selecting-by-Label-with-loc.ipynb
mit
import pandas as pd pd.set_option('display.max_columns', 500) def a1_notation(n): string = "" while n > 0: n, remainder = divmod(n - 1, 26) string = chr(65 + remainder) + string return string # First we create a 30 x 30 DataFrame with both row and column labels. alist = list(range(1, 31))...
theJollySin/python_for_scientists
classes/12_matplotlib/1_line_plots.ipynb
gpl-3.0
import numpy from matplotlib import pyplot %matplotlib inline ### generate some random data xdata = numpy.arange(25) ydata = numpy.random.randn(25) ### initialize the "figure" and "axes" objects fig, ax = pyplot.subplots() line_plot = ax.plot(xdata, ydata) """ Explanation: Line Plots Perhaps the most well-known t...
liganega/Gongsu-DataSci
previous/y2017/W09-numpy-averages/.ipynb_checkpoints/GongSu21_Statistics_Averages-checkpoint.ipynb
gpl-3.0
import numpy as np import pandas as pd from datetime import datetime as dt from scipy import stats """ Explanation: 자료 안내: 여기서 다루는 내용은 아래 사이트의 내용을 참고하여 생성되었음. https://github.com/rouseguy/intro2stats 안내사항 오늘 다루는 내용은 pandas 모듈의 소개 정도로 이해하고 넘어갈 것을 권장한다. 아래 내용은 엑셀의 스프레드시트지에 담긴 데이터를 분석하여 평균 등을 어떻게 구하는가를 알고 있다면 어렵지 않게 이해할 수...
gfeiden/Notebook
Daily/20150821_mass_track_compositions.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np cd /Users/grefe950/evolve/dmestar/trk/ """ Explanation: Diagnostic Checks on Mass Tracks End of explanation """ def loadTrack(filename): return np.genfromtxt(filename, usecols=(0, 1, 2, 3, 4, 5)) """ Explanation: Quick mass track loader End ...
tensorflow/docs-l10n
site/zh-cn/tensorboard/scalars_and_keras.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...
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn
doc/notebooks/automaton.is_equivalent.ipynb
gpl-3.0
import vcsn """ Explanation: automaton.is_equivalent(aut) Whether this automaton is equivalent to aut, i.e., whether they accept the same words with the same weights. Preconditions: - The join of the weightsets is either $\mathbb{B}, \mathbb{Z}$, or a field ($\mathbb{F}2, \mathbb{Q}, \mathbb{Q}\text{mp}, \mathbb{R}$)....
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-3/cmip6/models/sandbox-2/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-2', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: TEST-INSTITUTE-3 Source ID: SANDBOX-2 Topic: Seaice Sub-Topics: Dynami...
mne-tools/mne-tools.github.io
dev/_downloads/98d9662291626be9c938eee7a8fcc9bd/sensor_noise_level.ipynb
bsd-3-clause
# Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD-3-Clause import os.path as op import mne data_path = mne.datasets.sample.data_path() raw_erm = mne.io.read_raw_fif(op.join(data_path, 'MEG', 'sample', 'ernoise_raw.fif'), preload=True) """ Explanation: Show noise ...
ES-DOC/esdoc-jupyterhub
notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1-hr/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-esm2-1-hr', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CNRM-CERFACS Source ID: CNRM-ESM2-1-HR Topic: Seaice Sub-Topics: Dyna...
bryanwweber/PyKED
docs/rcm-example.ipynb
bsd-3-clause
import cantera as ct import numpy as np from pyked import ChemKED """ Explanation: RCM modeling with varying reactor volume This example is available as an ipynb (Jupyter Notebook) file in the main GitHub repository at https://github.com/pr-omethe-us/PyKED/blob/master/docs/rcm-example.ipynb The ChemKED file that will ...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/05_artandscience/labs/a_handtuning.ipynb
apache-2.0
import math import shutil import numpy as np import pandas as pd import tensorflow as tf print(tf.__version__) tf.logging.set_verbosity(tf.logging.INFO) pd.options.display.max_rows = 10 pd.options.display.float_format = '{:.1f}'.format """ Explanation: Hand tuning hyperparameters Learning Objectives: * Use the Line...
hetaodie/hetaodie.github.io
assets/media/uda-ml/supervisedlearning/decision/17/Titanic Solutions-zh.ipynb
mit
# 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 # Pretty display for notebooks %matplotlib inline # Set a random seed import random random.seed(42) # Load the dataset in_file = 'titanic_data.csv' ful...