repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
jinzishuai/learn2deeplearn | deeplearning.ai/C4.CNN/week4_SpecialApps/hw/Face Recognition/Face Recognition for the Happy House - v1.ipynb | gpl-3.0 | from keras.models import Sequential
from keras.layers import Conv2D, ZeroPadding2D, Activation, Input, concatenate
from keras.models import Model
from keras.layers.normalization import BatchNormalization
from keras.layers.pooling import MaxPooling2D, AveragePooling2D
from keras.layers.merge import Concatenate
from kera... |
jalexvig/tensorflow | tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb | apache-2.0 | # Install TensorFlow; note that Colab notebooks run remotely, on virtual
# instances provided by Google.
!pip install -U -q tf-nightly
import os
import time
import tensorflow as tf
from tensorflow.contrib import autograph
import matplotlib.pyplot as plt
import numpy as np
import six
from google.colab import widgets... |
metpy/MetPy | v1.1/_downloads/6535033cff935ab2c434cdad6eb5b4f7/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from metpy.calc import wind_components
from metpy.cbook import get_test_data
from metpy.interpolate import interpolate_to_grid, remove_nan_obse... |
sdss/marvin | docs/sphinx/tutorials/notebooks/Marvin_Results.ipynb | bsd-3-clause | # set up and run the query
from marvin.tools.query import Query
q = Query(search_filter='nsa.z < 0.1', return_params=['absmag_g_r', 'nsa.elpetro_th50_r'])
r = q.run()
# repr the results
r
"""
Explanation: Marvin Results
This tutorial explores some basics of how to handle results of your Marvin Query. Much of this in... |
DJCordhose/ai | notebooks/tensorflow/embeddings.ipynb | mit | # Based on
# https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/6.2-understanding-recurrent-neural-networks.ipynb
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
print(tf.__version__)
from ... |
mjones01/NEON-Data-Skills | tutorials-in-development/python-api/download_abby_tos_woody_veg_data_tutorial.ipynb | agpl-3.0 | import requests, urllib, os
"""
Explanation: Get packages and set up
This tutorial contains code and instructions for downloading NEON data via the
API, using the data product DP1.10098.001 - Woody Plant Vegetation Structure
as an example. It follows a similar workflow to the online tutorial
<a href="https://www.ne... |
a-mt/dev-roadmap | docs/!ml/notebooks/PCA.ipynb | mit | from sklearn.decomposition import PCA
pca = PCA(n_components=2)
res = pca.fit_transform(df_norm)
res
# Singular values
pca.singular_values_.round(2)
# Eigenvalues
pca.explained_variance_.round(2)
# Eigenvalues/eigenvalues.sum()
pca.explained_variance_ratio_.round(2)
# Eigenvectors
pca.components_
plt.bar(['PC1', ... |
fionapigott/Data-Science-45min-Intros | vector-spaces/vector-spaces_pt1.ipynb | unlicense | import copy
try:
import ujson as json
except ImportError:
import json
import math
import operator
import random
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from numpy.linalg import norm as np_norm
import matplotlib.pyplot as plt
import pandas as pd
from scipy.spatial import distance as spd
i... |
cjcardinale/climlab | docs/source/courseware/Soundings_from_Observations_and_RCE_Models.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
ncep_url = "https://psl.noaa.gov/thredds/dodsC/Datasets/ncep.reanalysis.derived/"
ncep_air = xr.open_dataset( ncep_url + "pressure/air.mon.1981-2010.ltm.nc", decode_times=False)
level = ncep_air.level
lat = ncep_air.lat
"""
Exp... |
oscaribv/pyaneti | pyaneti_extras/.ipynb_checkpoints/toy_model1-checkpoint.ipynb | gpl-3.0 | from __future__ import print_function, division, absolute_import
#Import the multi-GP class from the mgp.py file, all the magic is there
import numpy as np
from pyaneti_extras.citlalatonac import citlalatonac, create_times
star = citlalatonac(tmin=0,tmax=50,amplitudes=[0.005,0.05,0.05,0.0,0.005,-0.05],
... |
CLEpy/CLEpy-MotM | Tweepy/Tweepy.ipynb | mit | # Load keys, secrets, settings
import os
ENV = os.environ
CONSUMER_KEY = ENV.get('IOTX_CONSUMER_KEY')
CONSUMER_SECRET = ENV.get('IOTX_CONSUMER_SECRET')
ACCESS_TOKEN = ENV.get('IOTX_ACCESS_TOKEN')
ACCESS_TOKEN_SECRET = ENV.get('IOTX_ACCESS_TOKEN_SECRET')
USERNAME = ENV.get('IOTX_USERNAME')
USER_ID = ENV.get('IOTX_USER... |
saudijack/unfpyboot | Day_01/01_Advanced_Python/03_LambdaFunction-Solutions.ipynb | mit | words = 'The quick brown fox jumps over the lazy dog'.split()
print words
stuff = []
for w in words:
stuff.append([w.upper(), w.lower(), len(w)])
for i in stuff:
print i
"""
Explanation: Lambda Function and More
<u>Problem 1</u>
End of explanation
"""
stuff = map(lambda w: [w.upper(), w.lower(), len(w)],wor... |
nholtz/structural-analysis | matrix-methods/frame2d/05-test-frame-6b.ipynb | cc0-1.0 | from IPython import display
display.SVG('data/frame-6b.d/frame-6b.svg')
from Frame2D import Frame2D
f6b = Frame2D('frame-6b')
"""
Explanation: Example 6-b
In this example, all input data is given directly in the notebook cells below. The data is given
in CSV form precisely as would be given in data files. For each... |
galtay/tensorflow_examples | 01_linear_regression.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.contrib import keras
from sklearn import datasets
from sklearn import linear_model
import statsmodels.api as sm
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
"""
Explanation: Imports
End of explanation
"""
Nsam... |
phoebe-project/phoebe2-docs | 2.3/tutorials/reflection_heating.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Reflection and Heating
For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering.
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/solutions/tfdv_basic_spending.ipynb | apache-2.0 | !pip install pyarrow==5.0.0
!pip install numpy==1.19.2
!pip install tensorflow-data-validation
"""
Explanation: Introduction to TensorFlow Data Validation
Learning Objectives
Review TFDV methods
Generate statistics
Visualize statistics
Infer a schema
Update a schema
Introduction
This lab is an introduction to Tenso... |
sraejones/phys202-2015-work | days/day12/Integration.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Numerical Integration
Learning Objectives: Learn how to numerically integrate 1d and 2d functions that are represented as Python functions or numerical arrays of data using scipy.integrate.
This lesson was orgi... |
ajdawson/python_for_climate_scientists | course_content/notebooks/cis_introduction.ipynb | gpl-3.0 | # Ensure I don't use any local plugins. Set it to a readable folder with no Python files to avoid warnings.
%env CIS_PLUGIN_HOME=/Users/watson-parris/Pictures
from cis import read_data, read_data_list, get_variables
get_variables('../resources/WorkshopData2016/Aeronet/920801_150530_Brussels.lev20')
aeronet_aot_500 =... |
geektoni/shogun | doc/ipython-notebooks/neuralnets/neuralnets_digits.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from scipy.io import loadmat
import shogun as sg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
# load the dataset
dataset = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat'))
Xall = dataset['da... |
mrcinv/matpy | 00_uvod.ipynb | gpl-2.0 | 1+1
"""
Explanation: << nazaj: Predgovor
Uvod
Preden se lotimo trenja matematičnih orehov s kladivom imenovanim Python, si moramo pripraviti primerno okolje.
Dokumenti so napisani v obliki Jupyter notebook, ki je interaktivno okolje za Python, v katerem lahko združujemo programsko kodo in besedilo. Dokumente lahko pr... |
squishbug/DataScienceProgramming | DataScienceProgramming/04-Pandas-Data-Tables/Ten-Minute-Tutorial.ipynb | cc0-1.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Pandas
pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with “relational” or “labeled” data both easy and intuitive. It aims to be the fundamental high-level building bloc... |
facaiy/book_notes | deep_learning/Regularization_for_Deep_Learning/note.ipynb | cc0-1.0 | show_image("fig7_2.png")
"""
Explanation: Chapter 7 Regularization for Deep Learning
the best fitting model is a large model that has been regularized appropriately.
7.1 Parameter Norm Penalties
\begin{equation}
\tilde{J}(\theta; X, y) = J(\theta; X, y) + \alpha \Omega(\theta)
\end{equation}
where $\Omega(\theta)$... |
giacomov/3ML | examples/basic_test.ipynb | bsd-3-clause | from threeML import *
import matplotlib.pyplot as plt
%matplotlib inline
%matplotlib notebook
"""
Explanation: <center><img src="http://identity.stanford.edu/overview/images/emblems/SU_BlockStree_2color.png" width="200" style="display: inline-block"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/... |
sthuggins/phys202-2015-work | assignments/assignment05/.ipynb_checkpoints/InteractEx02-checkpoint.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 2
Imports
End of explanation
"""
def plot_sine1(a, b):
for x in range(0, 4*np.pi, np.dtype(float)):
... |
NYUDataBootcamp/Materials | Code/notebooks/bootcamp_timeseries_update.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
%matplotlib inline
plt.style.use("ggplot")
# quandl package
import... |
drcgw/bass | BASS v2.0.ipynb | gpl-3.0 | from BASS import *
"""
Explanation: Welcome to BASS!
Version: Beta 2.0
Created by Abigail Dobyns and Ryan Thorpe
BASS: Biomedical Analysis Software Suite for event detection and signal processing.
Copyright (C) 2015 Abigail Dobyns
This program is free software: you can redistribute it and/or modify
it under the term... |
Hyperparticle/deep-learning-foundation | lessons/sentiment-network/Sentiment_Classification_Projects.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
sdpython/pyquickhelper | _doc/notebooks/javascript_extension.ipynb | mit | from pyquickhelper.ipythonhelper import install_notebook_extension, get_installed_notebook_extension
"""
Explanation: Javascript extension for a notebook
Play with Javascript extensions.
End of explanation
"""
install_notebook_extension()
"""
Explanation: We install extensions in case it was not done before:
End of... |
McIntyre-Lab/papers | fear_ase_2016/scripts/cis_summary/maren_equations_summary_jmf2.ipynb | lgpl-3.0 | # Set-up default environment
%run '../ipython_startup.py'
# Import additional libraries
import sas7bdat as sas
import cPickle as pickle
import statsmodels.formula.api as smf
from ase_cisEq import marenEq
from ase_cisEq import marenPrintTable
from ase_normalization import meanCenter
from ase_normalization import q3No... |
NlGG/MachineLearning | .ipynb_checkpoints/PSO_discre-checkpoint.ipynb | mit | %matplotlib inline
import numpy as np
import pylab as pl
import math
from sympy import *
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
def TSP_map(N): #100×100の正方格子内にN個の点を配置する関数
TSP_map = []
X = [i for i in range(100)]
Y = [i for i in ran... |
silburt/rebound2 | ipython_examples/FourierSpectrum.ipynb | gpl-3.0 | import rebound
import numpy as np
sim = rebound.Simulation()
sim.units = ('AU', 'yr', 'Msun')
sim.add("Sun")
sim.add("Jupiter")
sim.add("Saturn")
"""
Explanation: Fourier analysis & resonances
A great benefit of being able to call rebound from within python is the ability to directly apply sophisticated analysis tools... |
robblack007/clase-dinamica-robot | Practicas/.ipynb_checkpoints/Practica 5 - Modelado de Robots-checkpoint.ipynb | mit | from scipy.integrate import odeint
from numpy import linspace
"""
Explanation: Modelado de Robots
Recordando la práctica anterior, tenemos que la ecuación diferencial que caracteriza a un sistema masa-resorte-amoritguador es:
$$
m \ddot{x} + c \dot{x} + k x = F
$$
y revisamos 3 maneras de obtener el comportamiento de... |
CalPolyPat/phys202-2015-work | assignments/assignment09/IntegrationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import integrate
"""
Explanation: Integration Exercise 2
Imports
End of explanation
"""
def integrand(x, a):
return 1.0/(x**2 + a**2)
def integral_approx(a):
# Use the args keyword argument to feed extra a... |
mitdbg/modeldb | client/workflows/demos/census-end-to-end-local-data-example.ipynb | mit | # restart your notebook if prompted on Colab
try:
import verta
except ImportError:
!pip install verta
"""
Explanation: Logistic Regression with Grid Search (scikit-learn)
<a href="https://colab.research.google.com/github/VertaAI/modeldb/blob/master/client/workflows/demos/census-end-to-end-local-data-example.ip... |
google/applied-machine-learning-intensive | content/06_other_models/05_svm/colab.ipynb | apache-2.0 | # 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 the L... |
SonneSun/self_driving_car_projects | 1_Finding_Lane_Lines.ipynb | apache-2.0 | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
#reading in an image
image = mpimg.imread('video_test/frame219.jpg')
#printing out some stats and plotting
print('This image is:', type(image), 'with dimesions:', image.shap... |
domluna/cgt_tutorials | neural net - digits.ipynb | mit | randinds = np.random.permutation(len(digits.target))
# shuffle the values
from sklearn.utils import shuffle
data, targets = shuffle(digits.data, digits.target, random_state=0)
# scale the data
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler().fit(data)
data_scaled = scaler.transform(data)
fr... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/awi-cm-1-0-mr/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'awi-cm-1-0-mr', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: AWI
Source ID: AWI-CM-1-0-MR
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics... |
EmuKit/emukit | notebooks/Emukit-tutorial-parallel-eval-of-obj-fun.ipynb | apache-2.0 | ### General imports
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
### --- Figure config
colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS)
LEGEND_SIZE = 15
TITLE_SIZE = 25
AXIS_SIZE = 15
FIG_SIZE = (12,8)
"""
Explanation: Bayesian optimization wi... |
bdestombe/flopy-1 | examples/Notebooks/flopy3_LoadSWRBinaryData.ipynb | bsd-3-clause | %matplotlib inline
from IPython.display import Image
import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import flopy
print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('matplotlib version: {}'.format(mpl.__version__))
print('flopy version: {}'.forma... |
TiKeil/Master-thesis-LOD | notebooks/Figure_7.4_Coefficients.ipynb | apache-2.0 | import os
import sys
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
from visualize import drawCoefficient
import buildcoef2d
"""
Explanation: Coefficients for tests
For our numerical simulations, we use four different diffusion coefficients. These coefficients are presented in the following.... |
metpy/MetPy | v0.8/_downloads/sigma_to_pressure_interpolation.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
from netCDF4 import Dataset, num2date
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, add_timestamp
from metpy.units import units
"""
Explanation: Sigma to Pressure I... |
daniel-koehn/Theory-of-seismic-waves-II | 08_1D_visco_elastic_SH_modelling/4_1D_visc_SH_FD_modelling.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 by D. Koehn, notebook styl... |
OCPython/meetup-2017-10-mongodb | jupyter_notebooks/02_pymongo_aggregation.ipynb | mit | # import pymongo
from pymongo import MongoClient
from pprint import pprint
# Create client
client = MongoClient('mongodb://localhost:32768')
# Connect to database
db = client['fifa']
# Get collection
my_collection = db['player']
"""
Explanation: Aggregation (via pymongo)
End of explanation
"""
def print_docs(pipe... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session14/Day3/IntroductionToVariationalAutoencoders_solutions.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from torchvision.transforms import Normalize
"""
Explanation: <a href="https://colab.research.google.com/github/VMBoehm/ML... |
ValFadeev/ihaskell-notebooks | notebooks/functional_python.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from random import random, randint, choice
from itertools import cycle, ifilter, imap, islice, izip, starmap, tee
from collections import defaultdict
from operator import add, mul
from pymonad.Maybe import *
from pymonad.Reader import *
"""
Explanat... |
AEW2015/PYNQ_PR_Overlay | docs/source/5_programming_onboard.ipynb | bsd-3-clause | from pynq import Overlay
from pynq.board import LED
from pynq.board import RGBLED
from pynq.board import Switch
from pynq.board import Button
Overlay("base.bit").download()
"""
Explanation: Programming PYNQ-Z1's onboard peripherals
LEDs, switches and buttons
PYNQ-Z1 has the following on-board LEDs, pushbuttons and sw... |
WenboTien/Crime_data_analysis | exploratory_data_analysis/UCIrvine_Crime_data_analysis.ipynb | mit | df = pd.read_csv('../datasets/UCIrvineCrimeData.csv');
df = df.replace('?',np.NAN)
features = [x for x in df.columns if x not in ['fold', 'state', 'community', 'communityname', 'county'
,'ViolentCrimesPerPop']]
"""
Explanation: Read the CSV
We use pandas read_csv(path/to/... |
tensorflow/docs | site/en/r1/tutorials/eager/custom_layers.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... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/03_01/Final/Creating Series.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
"""
Explanation: Series
Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers,
Python objects, etc.). The axis labels are collectively referred to as the index.
documentation: http://pandas.pydata.org/pandas-docs/sta... |
SciTools/courses | course_content/iris_course/8.Final_Exercise.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import iris
import iris.plot as iplt
"""
Explanation: Iris introduction course
8. Final Exercise
This exercise draws on various aspects of Iris's functionality that were introduced in the course.
Once you have attempted the exercise, you can check your answers with the provided sample s... |
liebannam/pipes | examples/Pipe_tutorial.ipynb | gpl-3.0 | from IPython.display import Image
Image("/Users/anna/Desktop/export_inp.png", width=720, height=450)
"""
Explanation: <p> Introduces the **PyNetwork** class used to set up and run simulations <p>
<p> An instance of this **PyNetwork** class is a conceptual representation of a water distribution network. To create an i... |
seg/2016-ml-contest | esaTeam/esa_Submission01a.ipynb | apache-2.0 | # Import
from __future__ import division
get_ipython().magic(u'matplotlib inline')
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['figure.figsize'] = (20.0, 10.0)
inline_rc = dict(mpl.rcParams)
from classification_utilities import make_facies_log_plot, make_multi_facies_log_plot
import pandas a... |
gte620v/PythonTutorialWithJupyter | exercises/solutions/Ex3-Stock_Data_solutions.ipynb | mit | import pandas as pd
from pandas_datareader import data, wb
import datetime
# We will look at stock prices over the past year, starting at January 1, 2016
start = datetime.datetime(2016,1,1)
end = datetime.date.today()
# Let's get Apple stock data; Apple's ticker symbol is AAPL
# First argument is the series we wan... |
yl565/statsmodels | examples/notebooks/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... |
LocalGroupAstrostatistics2015/MCMC | MCMC tutorial (worksheet).ipynb | mit | name = "YOUR NAME HERE"
print("Hello {0}!".format(name))
"""
Explanation: Practical MCMC in Python
by Dan Foreman-Mackey
A worksheet for the Local Group Astrostatistics workshop at the University of Michigan, June 2015.
Introduction
In this notebook, we'll implement a Markov Chain Monte Carlo (MCMC) algorithm and dem... |
ewulczyn/talk_page_abuse | src/analysis/Prevalence and Efficacy of Moderation.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
from load_utils import *
# Load scored diffs and moderation event data
d = load_diffs()
df_block_events, df_blocked_user_... |
ueapy/ueapy.github.io | content/notebooks/2017-03-10-regex.ipynb | mit | import re
"""
Explanation: A regular expression (regex, RE) is a sequence of characters that define a search pattern. Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings. For example, search engines use regular expressions to find matches to your query as ... |
gregcaporaso/short-read-tax-assignment | ipynb/runtime/compute-runtimes.ipynb | bsd-3-clause | from os.path import join, expandvars
from joblib import Parallel, delayed
from tax_credit.framework_functions import (runtime_make_test_data,
runtime_make_commands,
clock_runtime)
## project_dir should be the directory where you'v... |
NathanYee/ThinkBayes2 | code/.ipynb_checkpoints/chap09mine-checkpoint.ipynb | gpl-2.0 | from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import math
import numpy as np
from thinkbayes2 import Pmf, Cdf, Suite, Joint
import thinkplot
"""
Explanation: Think Bayes: Chapter 9
This notebook presents code and exercises from Think Bayes, sec... |
rescu/brainstorm | chapter0.ipynb | mit | #addition
print 4+3
#subtraction
print 4-3
#multiplication
print 4*3
#exponentiation
print 4**3
#division
print 4/3
"""
Explanation: Chapter 0-Introduction
Often when we think of scientists conducting an experiment, we think of laboratories filled with beakers and whirring machines. However, especially in physics, the... |
gully/adrasteia | notebooks/adrasteia_05-03_DR2_variability_catalog_rotational_modulation.ipynb | mit | # %load /Users/obsidian/Desktop/defaults.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
! du -hs ../data/dr2/Gaia/gdr2/vari_rotation_modulation/csv
df0 = pd.read_csv('../data/dr2/Gaia/gdr2/vari_rotation_modulation/csv/VariRot... |
phoebe-project/phoebe2-docs | development/tutorials/constraints_hierarchies.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Advanced: Constraints and Changing Hierarchies
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
"""
import phoebe
from phoebe import u # ... |
thundergolfer/Insults | insults/exploration/model/non_personal_insults.ipynb | gpl-3.0 | %matplotlib inline
# Ugly Python PATH hack to import insults from notebook
import os
import sys
nb_dir = os.path.split(os.getcwd())[0]
if nb_dir not in sys.path:
sys.path.append(nb_dir)
from insults.core import Insults
"""
Explanation: Non-personal Insults
This model was designed and training to detect personal ... |
hfoffani/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
awellis/state-space-models | notebooks/state-space-model-v2.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
# sns.set(rc={"figure.figsize": (16, 12)})
sns.set_style('white')
sns.set_style('ticks')
sns.set_context("paper")
%config InlineBackend.figure_format = 'retina'
# %qtconsole --colors=linux
import numpy as np
import pymc3 as pm
import theano.tens... |
zerothi/ts-tbt-sisl-tutorial | TB_05/run.ipynb | gpl-3.0 | graphene = sisl.geom.graphene(orthogonal=True)
"""
Explanation: In this example you will learn how to make use of the periodicity of the electrodes.
As seen in TB 4 the transmission calculation takes a considerable amount of time. In this example we will redo the same calculation, but speed it up (no approximations ma... |
IST256/learn-python | content/lessons/10-HTTP/Slides.ipynb | mit | x = { 'a' : [1,2,3,4], 'b' : 'rta', 'c': { 'r' : 3, 't' : 2} }
print( type(x['a']) )
"""
Explanation: IST256 Lesson 10
HTTP and Network Programming
Assigned Readings From
https://ist256.github.io/spring2021/readings/Web-APIs-In-Python.html
Links
Participation: https://poll.ist256.com
In-Class Questions: ZOOM CHAT... |
bambinos/bambi | docs/notebooks/t-test.ipynb | mit | import arviz as az
import bambi as bmb
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
az.style.use("arviz-darkgrid")
np.random.seed(1234)
"""
Explanation: Comparison of two means (T-test)
End of explanation
"""
a = np.random.normal(6, 2.5, 160)
b = np.random.normal(8, 2, 120)
df = pd.DataFra... |
kbennion/foundations-hw | 07-notebook-and-data/.ipynb_checkpoints/Homework7-checkpoint.ipynb | mit | %matplotlib inline
print(df['gender'].value_counts())
df.groupby('gender')['networthusbillion'].mean()
df.groupby('gender')['sourceofwealth'].value_counts()
"""
Explanation: What country are most billionaires from? For the top ones, how many billionaires per billion people?
Who are the top 10 richest billionaires?
... |
hypergravity/cham_hates_python | exercise/gaussian_fitting_using_python.ipynb | mit | from lmfit.models import GaussianModel
# initialize the gaussian model
gm = GaussianModel()
# take a look at the parameter names
print gm.param_names
# I get RuntimeError since my numpy version is a little old
# guess parameters
par_guess = gm.guess(n,x=xpos)
# fit data
result = gm.fit(n, par_guess, x=xpos, method='le... |
QuantStack/quantstack-talks | 2018-11-14-PyParis-widgets/notebooks/5.ipyvolume.ipynb | bsd-3-clause | import ipyvolume
import numpy as np
ds = ipyvolume.datasets.aquariusA2.fetch()
ipyvolume.quickvolshow(ds.data, lighting=True)
"""
Explanation: <center><h1>ipyvolume</h1></center>
Repository: https://github.com/maartenbreddels/ipyvolume
Installation:
conda install -c conda-forge ipyvolume
Volume rendering
End of expla... |
ComputationalModeling/spring-2017-danielak | past-semesters/spring_2016/day-by-day/day07-modeling-viral-load/day07-in_class_activity.ipynb | agpl-3.0 | # Make plots inline
%matplotlib inline
# Make inline plots vector graphics instead of raster graphics
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('pdf', 'svg')
# import modules for plotting and data analysis
import matplotlib.pyplot as plt
import numpy as np
import pandas
"""
Explanatio... |
infilect/ml-course1 | keras-notebooks/ANN/3.5-classifying-movie-reviews.ipynb | mit | from keras.datasets import imdb
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000)
"""
Explanation: Classifying movie reviews: a binary classification example
This notebook contains the code samples found in Chapter 3, Section 5 of Deep Learning with Python. Note that the original ... |
obulpathi/datascience | scikit/Chapter 6/OneHotEncoder.ipynb | apache-2.0 | X = np.array([[15.9, 1], # from Tokyo
[21.5, 2], # from New York
[31.3, 0], # from Paris
[25.1, 2], # from New York
[63.6, 1], # from Tokyo
[14.4, 1], # from Tokyo
])
y = np.array([0, 1, 1, 1, 0, 0])
# Don't do this!
from sklearn.line... |
computational-class/computational-communication-2016 | code/18.network analysis of tianya bbs.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
dtt = []
with open('/Users/chengjun/github/cjc2016/data/tianya_bbs_threads_network.txt', 'r') as f:
for line in f:
pnum, link, time, author_id, author, content = line.replace('\n', '').split('\t')
dtt.append([pnum, link, time, author_id, author, co... |
InsightLab/data-science-cookbook | 2019/12-spark/12-spark-intro/bruno_mourao_spark1.ipynb | mit | from random import *
from math import sqrt
inside=0
n=1000
for i in range(0,n):
x=random()
y=random()
if sqrt(x*x+y*y)<=1:
inside+=1
pi=4*inside/n
print(pi)
from random import *
from math import sqrt
def soma(a,b): return a+b
def area(x,y):return 1 if sqrt(x*x+y*y)<=1 else 0
def mapfunction(z):
... |
JasonNK/udacity-dlnd | 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... |
musketeer191/job_analytics | .ipynb_checkpoints/dups_filter-checkpoint.ipynb | gpl-3.0 | df = df.sort_values(['employer_name', 'doc'])
print('# posts bf filtering dups: %d' %df.shape[0])
df.head(10)
df = df.drop_duplicates(['employer_name', 'doc'])
print('# posts after filtering dups: %d' %df.shape[0])
df.head(10)
df = df.reset_index()
df.head()
df.to_csv(SKILL_DAT + 'uniq_doc_index.csv', index=False)... |
NifTK/NiftyNet | demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb | apache-2.0 | import os,sys
niftynet_path=r'path/to/NiftyNet'
os.chdir(niftynet_path)
"""
Explanation: PROMISE12 prostate segmentation demo
Preparation:
1) Make sure you have set up the PROMISE12 data set. If not, download it from https://promise12.grand-challenge.org/ (registration required) and run data/PROMISE12/setup.py
2) Mak... |
michael-isaev/cse6040_qna | PythonQnA_8_comprehensions.ipynb | apache-2.0 | from numpy.random import randint
import matplotlib.pyplot as plt
%matplotlib inline
S = randint(low=0, high=11, size=15) # 10 random integers b/w 0 and 10
def f(x):
"""
Dummy function - returns identity
"""
return x
"""
Explanation: Reading, and writing, comprehension(s)
Before we delve into the topi... |
awwong1/nd101 | dlnd-project-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... |
fevangelista/wicked | tutorials/01-Basics.ipynb | mit | import wicked as w
from IPython.display import display, Math, Latex
def latex(expr):
"""Function to render any object that has a member latex() function"""
display(Math(expr.latex()))
"""
Explanation: Basics of Wick&d
Loading the module
To use wick&d you will have to first import the module wicked. Here we ab... |
CCBatIIT/AlGDock | Example/test_fractional_GB.ipynb | mit | # This is probably due to a unit conversion in a multiplicative prefactor
# This multiplicative prefactor is based on nanometers
r_min = 0.14
r_max = 1.0
print (1/r_min - 1/r_max)
# This multiplicative prefactor is based on angstroms
r_min = 1.4
r_max = 10.0
print (1/r_min - 1/r_max)
"""
Explanation: Igrid[atomI] ap... |
kirichoi/tellurium | examples/notebooks/core/tellurium_plotting.ipynb | apache-2.0 | from __future__ import print_function
import tellurium as te
te.setDefaultPlottingEngine('matplotlib')
%matplotlib inline
r = te.loada('''
model feedback()
// Reactions:http://localhost:8888/notebooks/core/tellurium_export.ipynb#
J0: $X0 -> S1; (VM1 * (X0 - S1/Keq1))/(1 + X0 + S1 + S4^h);
J1: S1 -> S2; (10 ... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/sandbox-2/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CMCC
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: 85 (42 ... |
sdpython/teachpyx | _doc/notebooks/python/tarabiscote.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Exercices expliqués de programmation
Quelques exercices autour de la copie de liste, du temps de calcul, de l'héritage.
End of explanation
"""
def somme(tab):
l = tab[0]
for i in range(1, len(tab)):
l += tab [i]
retu... |
irfani/Jenis-Kelamin | Gender Prediction.ipynb | apache-2.0 | import pandas as pd # pandas is a dataframe library
df = pd.read_csv("./data/data-pemilih-kpu.csv", encoding = 'utf-8-sig')
#dimensi dataset terdiri dari 13137 baris dan 2 kolom
df.shape
#melihat 5 baris pertama dataset
df.head(5)
#melihat 5 baris terakhir dataset
df.tail(5)
"""
Explanation: Mempred... |
Phylliade/poppy-inverse-kinematics | tutorials/Quickstart.ipynb | gpl-2.0 | import ikpy.chain
import numpy as np
import ikpy.utils.plot as plot_utils
"""
Explanation: IKpy Quickstart
Requirements
First, you need to install IKPy (see installations instructions).
You also need a URDF file.
By default, we use the files provided in the resources folder of the IKPy repo.
Import the IKPy module :
E... |
prasants/pyds | 03.All_about_Numbers.ipynb | mit | a = 1
print(a)
print(type(a))
b = 2.0
print(b)
print(type(b))
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Ints-and-Floats" data-toc-modified-id="Ints-and-Floats-1"><span class="toc-item-num">1 </span>Ints and Floats</a></div><div class="lev2 toc-item"><a href="#Case-Study-1:-... |
stevenydc/2015lab1 | Lab1-babypython_original.ipynb | mit | # The %... is an iPython thing, and is not part of the Python language.
# In this case we're just telling the plotting library to draw things on
# the notebook, instead of on a separate window.
%matplotlib inline
#this line above prepares IPython notebook for working with matplotlib
# See all the "as ..." contructs? ... |
bokeh/bokeh | examples/howto/notebook_comms/Numba Image Example.ipynb | bsd-3-clause | from timeit import default_timer as timer
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import GlyphRenderer, LinearColorMapper
from bokeh.io import push_notebook
from numba import jit, njit
from ipywidgets import interact
import numpy as np
import scipy.misc
output_notebook()
"""
Expla... |
philipmat/presentations | python/snoop_and_better_exceptions.ipynb | mit | ROMAN = [
(1000, "M"),
( 900, "CM"),
( 500, "D"),
( 400, "CD"),
( 100, "C"),
( 90, "XC"),
( 50, "L"),
( 40, "XL"),
( 10, "X"),
( 9, "IX"),
( 5, "V"),
( 4, "IV"),
( 1, "I"),
]
def to_roman(number: int):
result = ""
for (arabic, roman) in ROMAN:
... |
dolittle007/dolittle007.github.io | notebooks/gaussian-mixture-model-advi.ipynb | gpl-3.0 | %matplotlib inline
import theano
theano.config.floatX = 'float64'
import pymc3 as pm
from pymc3 import Normal, Metropolis, sample, MvNormal, Dirichlet, \
DensityDist, find_MAP, NUTS, Slice
import theano.tensor as tt
from theano.tensor.nlinalg import det
import numpy as np
import matplotlib.pyplot as plt
import se... |
quantumlib/Cirq | docs/qudits.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... |
CodeNeuro/notebooks | worker/notebooks/bolt/tutorials/stacking.ipynb | mit | from bolt import ones
a = ones((100, 5), sc)
"""
Explanation: Stacking (with an example using scikit-learn)
When we construct a distributed 2D array in Bolt, we by default represent the values as one-dimensional arrays. While this is useful and generic, for some applications it is preferable to stack the values into ... |
HCsoft-RD/shaolin | examples/Automatic-dashboard-creation.ipynb | agpl-3.0 | from shaolin import KungFu
dashb = KungFu(int_slider=4, text="moco", dropdown=['Hello','World'],float_slider=(2.,10.,1.),box='2r')
dashb.widget
"""
Explanation: How to create dashboards using shaolin KungFu
1.1 Widgets defined as keyword arguments
It is possible to instantiate widgets by instantiating a KungFu object.... |
ck-quantuniversity/cntk_pyspark | CNTK_model_scoring_on_Spark_walkthrough.ipynb | mit | from cntk import load_model
import findspark
findspark.init('/root/spark-2.1.0-bin-hadoop2.6')
import os
import numpy as np
import pandas as pd
import pickle
import sys
from pyspark import SparkFiles
from pyspark import SparkContext
from pyspark.sql.session import SparkSession
sc =SparkContext()
spark = SparkSession(sc... |
psiq/gdsfactory | notebooks/10_YAML_component.ipynb | mit | import pp
yaml = """
instances:
mmi_long:
component: mmi1x2
settings:
width_mmi: 4.5
length_mmi: 10
mmi_short:
component: mmi1x2
settings:
width_mmi: 4.5
length_mmi: 5
"""
c = pp.component_from_yaml(yaml)
pp.show(c)
pp.plotgds(c)
c.instances
c.instance... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/PCA.ipynb | mit | from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import pylab as pl
from itertools import cycle
iris = load_iris()
numSamples, numFeatures = iris.data.shape
print(numSamples)
print(numFeatures)
print(list(iris.target_names))
"""
Explanation: Principal Component Analysis
PCA is a dimension... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.