repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
hhain/sdap17 | notebooks/solution_ueb01/02_Classification.ipynb | mit | # imports
from sklearn.datasets import make_classification
from sklearn.ensemble import RandomForestClassifier
import time
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Aufgabe 2: Classification
A short test to examine the performance gain when using multiple cores on sklearn's esemble classif... |
tleonhardt/machine_learning | SL3_Neural_Networks.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.special import expit
line = np.linspace(-3, 3, 100)
plt.figure(figsize=(10,8))
plt.plot(line, np.tanh(line), label="tanh")
plt.plot(line, np.maximum(line, 0), label="relu")
plt.plot(line, expit(line), label='sigmoid')
plt.legend(loc="bes... |
jdhp-docs/python_notebooks | nb_dev_python/python_keras_1d_linear_regression.ipynb | mit | import tensorflow as tf
tf.__version__
import keras
keras.__version__
import h5py
h5py.__version__
import pydot
pydot.__version__
"""
Explanation: Basic 1D linear regression with Keras
Install Keras
https://keras.io/#installation
Install dependencies
Install TensorFlow backend: https://www.tensorflow.org/install/
p... |
AutuanLiu/Python | nbs/numba_basic.ipynb | mit | %matplotlib inline
# 多行结果输出支持
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
"""
Explanation: Numba 基础
Numba是一个用于Python数组和数值函数的编译器,它使您能够使用直接用Python编写的高性能函数来加速应用程序
Numba使用LLVM编译器基础结构从纯Python代码生成优化的机器代码。通过一些简单的注释,面向数组和Python的数学代码可以被即时优化,性能与C,C ++和Fortran类似,无需切换... |
tensorflow/docs-l10n | site/ja/addons/tutorials/optimizers_conditionalgradient.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0
# 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 License is d... |
KDD-OpenSource/geox-young-academy | day-3/solutions/solution_david_timo.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
np.random.seed(123541312)
n = 100
z = np.zeros((n))
m = np.zeros((n))
mh = np.zeros((n))
y = np.zeros((n))
C = np.zeros((n))
Ch = np.zeros((n))
K = np.zeros((n))
A = .5
B = .2
C[0] = .4
R = .01
H = 1
zeta = np.random.normal(0, B, n)
nu = np.random.normal(0, R, n)
... |
Ttl/scikit-rf | doc/source/examples/networktheory/Properties of Rectangular Waveguides.ipynb | bsd-3-clause |
%matplotlib inline
import skrf as rf
rf.stylely()
# imports
from scipy.constants import mil,c
from skrf.media import RectangularWaveguide, Freespace
from skrf.frequency import Frequency
import matplotlib as mpl
# plot formating
mpl.rcParams['lines.linewidth'] = 2
# create frequency objects for standard bands
f_... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session02/Day5/ImageVizSolutions.ipynb | mit | import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS
from astropy.visualization import (MinMaxInterval,
LogStretch,
ImageNormalize)
%matplotlib inline
hdu = fits.open('./data/w5.fits')[0]
wcs = WCS(hdu.header)
hdu2 ... |
probml/pyprobml | deprecated/gp_spectral_mixture.ipynb | mit | try:
import tinygp
except ImportError:
%pip install -q tinygp
try:
import optax
except ImportError:
%pip install -q optax
import tinygp
import jax
import jax.numpy as jnp
class SpectralMixture(tinygp.kernels.Kernel):
def __init__(self, weight, scale, freq):
self.weight = jnp.atleast_1d(w... |
TomTranter/OpenPNM | examples/tutorials/Creating a custom phase with pore-scale models.ipynb | mit | import numpy as np
import openpnm as op
pn = op.network.Cubic(shape=[3, 3, 3], spacing=1e-4)
print(pn)
"""
Explanation: Creating a custom fluid using GenericPhase
OpenPNM comes with a small selection of pre-written phases (Air, Water, Mercury). In many cases users will want different options but it is not feasible o... |
chinapnr/python_study | Python 基础课程/Python Basic Lesson 14 - 访问网络.ipynb | gpl-3.0 | # 获得一个网站的信息
import requests
r = requests.get('http://www.huifu.com')
print(r.content)
print(r.headers)
"""
Explanation: Lesson 14 访问网络初步和 requests 包
v1.0.0 2016.11 by David.Yi
v1.1 2020.5 2020.6 edit by David Yi
本次内容要点
requests 包介绍
访问网页
调用接口
思考一下:写个同步数据的软件需要注意哪些方面
requests 包
requests 包是 python 目前最好用的网站内容访问包,设计... |
mne-tools/mne-tools.github.io | 0.20/_downloads/131324ab94fb4e4c09fa41f4692da130/plot_custom_inverse_solver.ipynb | bsd-3-clause | import numpy as np
from scipy import linalg
import mne
from mne.datasets import sample
from mne.viz import plot_sparse_source_estimates
data_path = sample.data_path()
fwd_fname = data_path + '/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif'
ave_fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
cov_fname = data_... |
takahish/deep-learning | first-neural-network/Your_first_neural_network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
WNoxchi/Kaukasos | quantum/grove_QAOA_overview_maxcut_codealong.ipynb | mit | import numpy as np
from grove.pyqaoa.maxcut_qaoa import maxcut_qaoa
from functools import reduce
barbell = [(0,1)] # graph is defined by a list of edges. Edge weights are assumed to be 1.0
steps = 1 # evolution path length ebtween the ref and cost hamiltonians
inst = maxcut_qaoa(barbell, steps=steps) # initializi... |
infilect/ml-course1 | week3/word2vec/notebook/Skip-Grams-Solution.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
magenta/ddsp | ddsp/colab/tutorials/4_core_functions.ipynb | apache-2.0 | # Copyright 2021 Google LLC. 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 applicable law or a... |
dpshelio/2015-EuroScipy-pandas-tutorial | solved - 02 - Data structures.ipynb | bsd-2-clause | s = pd.Series([0.1, 0.2, 0.3, 0.4])
s
"""
Explanation: Data structures
Pandas does this through two fundamental object types, both built upon NumPy arrays: the Series object, and the DataFrame object.
Series
A Series is a basic holder for one-dimensional labeled data. It can be created much as a NumPy array is created... |
dotsdl/msmbuilder | examples/gmrq-model-selection.ipynb | lgpl-2.1 | from __future__ import print_function
import numpy as np
from msmbuilder.example_datasets import load_doublewell
from msmbuilder.cluster import NDGrid
from msmbuilder.msm import MarkovStateModel
from sklearn.pipeline import Pipeline
from sklearn.cross_validation import KFold
"""
Explanation: This example demonstrates ... |
mne-tools/mne-tools.github.io | 0.21/_downloads/03c9d71de135994dbf45db72856a1f9a/plot_mne_inverse_envelope_correlation.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Sheraz Khan <sheraz@khansheraz.com>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.connectivity import envelope_correlation
from mn... |
ptpro3/ptpro3.github.io | Projects/AptListingsAnalysis.ipynb | mit | # imports
import pandas as pd
import dateutil.parser
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_bayes import Multinom... |
GoogleCloudPlatform/practical-ml-vision-book | 09_deploying/09b_rest.ipynb | apache-2.0 | !cat ./vertex_deploy.sh
!./vertex_deploy.sh
"""
Explanation: Predictions using a REST endpoint
In this notebook, we start from an already trained and saved model (as in Chapter 7).
For convenience, we have put this model in a public bucket in gs://practical-ml-vision-book/flowers_5_trained
We deploy this model to a R... |
rdempsey/web-scraping-data-mining-course | week7/2_data_exploration/4. Create Basic Plots.ipynb | mit | # To show matplotlib plots in iPython Notebook we can use an iPython magic function
%matplotlib inline
# Import everything we need
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
"""
Explanation: Create Basic Charts (Plots)
In this notebook we'll be creating a number of... |
maxhutch/sem | Ducts.ipynb | gpl-3.0 | alphs = list(np.linspace(0,pi/2, 16, endpoint=False))
Re=2000;
N = 7
Nl = 257
Nz = 2049
yms = []; y1s = []; y10s = []; zms = []
for alph in alphs:
yl=mesh(alph, Nl)
ym, y1, y10, zm, cm = wall_units(yl,Nz, N,Re)
yms.append(ym)
y1s.append(y1)
y10s.append(y10)
zms.append(zm)
alpha = 0.1
plot_units... |
OceanPARCELS/parcels | parcels/examples/tutorial_NestedFields.ipynb | mit | %matplotlib inline
from parcels import Field, NestedField, FieldSet, ParticleSet, JITParticle, plotTrajectoriesFile, AdvectionRK4
import numpy as np
"""
Explanation: Tutorial on how to combine different Fields into a NestedField object
In some applications, you may have access to different fields that each cover only ... |
google/applied-machine-learning-intensive | content/xx_misc/activation_functions/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... |
tensorflow/model-remediation | docs/min_diff/tutorials/min_diff_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... |
leoferres/prograUDD | labs/17_Funciones.ipynb | mit | def nompropio(texto):
resultado = ""
for i in range(len(texto)):
if i == 0:
resultado += texto[i].upper()
elif texto[i-1] == " ":
resultado += texto[i].upper()
else:
resultado += texto[i].lower()
return resultado
nombre = "jUaN pErEz"
nompropio... |
ES-DOC/esdoc-jupyterhub | notebooks/ipsl/cmip6/models/ipsl-cm6a-lr/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'ipsl-cm6a-lr', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: IPSL
Source ID: IPSL-CM6A-LR
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics... |
JasonMDev/guidedprojects | jupyter-files/GP02.ipynb | mit | csv_list = open("../data/GP02/US_births_1994-2003_CDC_NCHS.csv").read().split("\n")
csv_list[0:10]
"""
Explanation: GP02: Explore U.S. Births
The raw data behind the story Some People Are Too Superstitious To Have A Baby On Friday The 13th, which you can read here.
We'll be working with the data set from the Centers... |
QuantScientist/Deep-Learning-Boot-Camp | day03/0. Preamble.ipynb | mit | !python --version
"""
Explanation: Deep Learning Tutorial with Keras and Tensorflow
<div>
<img style="text-align: left" src="imgs/keras-tensorflow-logo.jpg" width="40%" />
<div>
## Get the Materials
<img src="imgs/github.jpg" />
```shell
git clone https://github.com/ypeleg/Deep-Learning-Keras-Tensorflow-PyCon-I... |
xtr33me/deep-learning | embeddings/Skip-Gram_word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
macks22/gensim | docs/notebooks/topic_coherence-movies.ipynb | lgpl-2.1 | from __future__ import print_function
import re
import os
from scipy.stats import pearsonr
from datetime import datetime
from gensim.models import CoherenceModel
from gensim.corpora.dictionary import Dictionary
"""
Explanation: Benchmark testing of coherence pipeline on Movies dataset
How to find how well coherence... |
flaviostutz/datascience-snippets | kaggle-lung-cancer-approach2/.ipynb_checkpoints/LungCancerDetection-checkpoint.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#import seaborn as sns
import os
import glob
import SimpleITK as sitk
from PIL import Image
from scipy.misc import imread
%matplotlib inline
from IPython.display import clear_output
pd.options.mode.chained_assignment = None
"""
Explanation: ... |
tcmoore3/mbuild | docs/tutorials/tutorial_monolayer.ipynb | mit | import mbuild as mb
from mbuild.examples import Alkane
from mbuild.lib.moieties import Silane
class AlkylSilane(mb.Compound):
"""A silane functionalized alkane chain with one Port. """
def __init__(self, chain_length):
super(AlkylSilane, self).__init__()
alkane = Alkane(chain_length, cap_end... |
Ccaccia73/semimonocoque | 07_CorrectiveSolutions-7nodes-non-symmetric.ipynb | mit | from pint import UnitRegistry
import sympy
import networkx as nx
#import numpy as np
import matplotlib.pyplot as plt
#import sys
%matplotlib inline
from IPython.display import display
"""
Explanation: Semi-Monocoque Theory: corrective solutions
End of explanation
"""
from Section import Section
"""
Explanation: Imp... |
GoogleCloudPlatform/training-data-analyst | quests/serverlessml/05_feateng/labs/feateng_bqml.ipynb | apache-2.0 | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os
PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PROJECT NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# Do not change these
os.environ[... |
WormLabCaltech/mprsq | src/9 Decorrelation Within Pathways.ipynb | mit | # important stuff:
import os
import pandas as pd
import numpy as np
import morgan as morgan
import genpy
import gvars
# Graphics
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib import rc
rc('text', usetex=True)
rc('text', usetex=True)
rc('text.latex', preamble=r'\usepack... |
ES-DOC/esdoc-jupyterhub | notebooks/niwa/cmip6/models/sandbox-3/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'niwa', 'sandbox-3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NIWA
Source ID: SANDBOX-3
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radi... |
getsmarter/bda | module_4/M4_NB1_NetworkX_Introduction.ipynb | mit | # Load relevant libraries.
import networkx as nx
import matplotlib.pylab as plt
%matplotlib inline
import pygraphviz as pgv
import random
from IPython.display import Image, display
"""
Explanation: <div align="right">Python 3.6 Jupyter Notebook</div>
Introduction to NetworkX
Your completion of the notebook exercis... |
sjev/talks | pythonMeetupDec16/slides.ipynb | mit | # matplotlib example
# plot 5-sec data
price = pd.DataFrame.from_csv('data/SPY_20160411205955.csv')
price.close.plot()
# bokeh example
from bokeh.io import output_notebook, show
from bokeh.plotting import figure
from bokeh.charts import Line
output_notebook()
line = Line(price.close, plot_width=800, plot_height=400... |
Hvass-Labs/TensorFlow-Tutorials | 10_Fine-Tuning.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import PIL
import tensorflow as tf
import numpy as np
import os
"""
Explanation: TensorFlow Tutorial #10
Fine-Tuning
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
Introduction
We have previously seen in Tutorials #08 and #09 how to use a pre-trained Neura... |
QasimMuhammad/Ipython_WorkFlow | arundo-take_home_challenge.ipynb | mit |
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn import linear_model
from sklearn import svm
import matplotlib.pyplot as plt
import seaborn as sns
import keras
from keras.models import Sequential
from ... |
bjodah/pyodesys | examples/transformations.ipynb | bsd-2-clause | from __future__ import print_function, division, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
from pyodesys import OdeSys
from pyodesys.symbolic import SymbolicSys, symmetricsys
sp.init_printing()
%matplotlib inline
print(sp.__version__)
"""
Explanation: Solving a transformed s... |
beangoben/HistoriaDatos_Higgs | Dia2/5_Estadistica_Basica.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
"""
Explanation: Un poco de estadística
Antes de meternos a tratar el problema de clasificacion, vamos a ver unas cosas basicas de las gaussianas. Atravez de ellas vamos a entender algunos conceptos de la estadistica y la proba... |
hannorein/variations | Figure5.ipynb | gpl-3.0 | import rebound
import numpy as np
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
"""
Explanation: Figure 5
This notebook recreates Figure 5 in Rein & Tamayo 2016. The figure illustrates the accuracy of second order variational equations compared to finite dif... |
hetland/python4geosciences | materials/6_xarray.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import cartopy
import cmocean.cm as cmo
import pandas as pd
import xarray as xr
"""
Explanation: xarray
xarray expands the utility of the time series analysis package pandas into more than one dimension. It is actively being developed in conjunctio... |
cliburn/sta-663-2017 | scratch/Test17.ipynb | mit | [x*x for x in range(3)]
"""
Explanation: Working with large data sets
Lazy evaluation, pure functions and higher order functions
Lazy and eager evaluation
A list comprehension is eager.
End of explanation
"""
(x*x for x in range(3))
"""
Explanation: A generator expression is lazy.
End of explanation
"""
g = (x*x ... |
clausherther/public | Dirichlet Multinomial Example.ipynb | cc0-1.0 | y = np.asarray([20, 21, 17, 19, 17, 28])
k = len(y)
p = 1/k
n = y.sum()
n, p
"""
Explanation: Dice, Polls & Dirichlet Multinomials
As part of a longer term project to learn Bayesian Statistics, I'm currently reading Bayesian Data Analysis, 3rd Edition by Andrew Gelman, John Carlin, Hal Stern, David Dunson, Aki Vehta... |
KrisCheng/ML-Learning | archive/MOOC/Deeplearning_AI/NeuralNetworksandDeepLearning/BuildingyourDeepNeuralNetworkStepbyStep/Deep+Neural+Network+-+Application+v3.ipynb | mit | import time
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
from dnn_app_utils_v2 import *
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams[... |
brooksandrew/simpleblog | _ipynb/2017-12-01-sleeping-giant-rural-postman-problem.ipynb | mit | import mplleaflet
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
from collections import Counter
# can be found in https://github.com/brooksandrew/postman_problems_examples
from osm2nx import read_osm, haversine
from graph import contract_edges, create_rpp_edgelist
from postman_problems.tes... |
bmeaut/python_nlp_2017_fall | course_material/13_Semantics_2/13_Semantics_2_lab.ipynb | mit | !wget http://sandbox.hlt.bme.hu/~recski/stuff/4a.tgz
"""
Explanation: 12. Semantics 2 - Lab excercise
Improving a baseline Sentiment Analysis algorithm
Below is a small system for training and testing a Support Vector classifier on sentiment analysis data from the 2017 Semeval Task 4a, containing English tweets.
Curre... |
josh-gree/maths-with-python | 06-numpy-plotting.ipynb | mit | x = [1, 2, 3]
y = [4, 9, 16]
print(x+y)
"""
Explanation: A lot of computational algorithms are expressed using Linear Algebra terminology - vectors and matrices. This is thanks to the wide range of methods within Linear Algebra for solving the sort of problems that computers are good at solving!
Within Python, our fir... |
MarkWieczorek/SHTOOLS | examples/notebooks/spherical-harmonic-normalizations.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pyshtools as pysh
pysh.utils.figstyle(rel_width=0.75)
%config InlineBackend.figure_format = 'retina' # if you are not using a retina display, comment this line
lmax = 100
coeffs = pysh.SHCoeffs.from_zeros(lmax)
coeffs.set_coeffs(values=[1]... |
derrowap/MA490-MachineLearning-FinalProject | .ipynb_checkpoints/project-checkpoint.ipynb | mit | data_inorder = pd.read_csv('Data\\adder_inorder_data.csv')
data_inorder = data_inorder[['Steps', 'MSE']]
data_inorder = data_inorder.sort_values(['Steps'])
data_inorder.head(9)
data_rnd_0 = pd.read_csv('Data\\adder_random_0_data.csv')
data_rnd_0 = data_rnd_0[['Steps', 'MSE']]
data_rnd_0 = data_rnd_0.sort_values(['Step... |
ESO-python/ESOPythonTutorials | notebooks/ESO Code Coffee Dec 7, 2015.ipynb | bsd-3-clause | x = StringIO.StringIO()
arr = np.arange(10)
np.savetxt(x,arr, header='test', comments="")
x.seek(0)
print(x.read())
with open('file.txt','w') as f:
f.write(x.getvalue())
%%bash
cat file.txt
"""
Explanation: Q1:
Saving a table to text with a header with no preceding "#"
Also, demo StringIO
End of explanation
"""
... |
dxl0632/deeplearning_nd_udacity | intro-to-tflearn/TFLearn_Digit_Recognition_Solution.ipynb | mit | # Import Numpy, TensorFlow, TFLearn, and MNIST data
import numpy as np
import tensorflow as tf
import tflearn
import tflearn.datasets.mnist as mnist
"""
Explanation: Handwritten Number Recognition with TFLearn and MNIST
In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9.
This... |
Kaggle/learntools | notebooks/python/raw/ex_2.ipynb | apache-2.0 | # SETUP. You don't need to worry for now about what this code does or how it works.
from learntools.core import binder; binder.bind(globals())
from learntools.python.ex2 import *
print('Setup complete.')
"""
Explanation: Functions are powerful. Try writing some yourself.
As before, don't forget to run the setup code b... |
tombstone/models | research/object_detection/colab_tutorials/context_rcnn_tutorial.ipynb | apache-2.0 | !pip install -U --pre tensorflow=="2.*"
!pip install tf_slim
"""
Explanation: Context R-CNN Demo
<table align="left"><td>
<a target="_blank" href="https://colab.sandbox.google.com/github/tensorflow/models/blob/master/research/object_detection/colab_tutorials/context_rcnn_tutorial.ipynb">
<img src="https://www.t... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/List Comprehensions-checkpoint.ipynb | apache-2.0 | # Grab every letter in string
lst = [x for x in 'word']
# Check
lst
"""
Explanation: Comprehensions
In addition to sequence operations and list methods, Python includes a more advanced operation called a list comprehension.
List comprehensions allow us to build out lists using a different notation. You can think of i... |
ghvn7777/ghvn7777.github.io | content/fluent_python/2_1_listcomp.ipynb | apache-2.0 | symbols = "a%b&c$de$"
beyond_ascii = [ord(s) for s in symbols if ord(s) > 50]
beyond_ascii
beyond_ascii = list(filter(lambda c: c > 50, map(ord, symbols)))
beyond_ascii
"""
Explanation: 列表生成式和生成式表达式
我们可以用 map 和 filter 达到 列表生成式的效果
End of explanation
"""
colors = ['black', 'white']
sizes = ['S', 'M', 'L']
tshirts = [... |
Unidata/unidata-python-workshop | notebooks/XArray/XArray Introduction.ipynb | mit | # Convention for import to get shortened namespace
import numpy as np
import xarray as xr
# Create some sample "temperature" data
data = 283 + 5 * np.random.randn(5, 3, 4)
data
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; height:98px;">
<img src="https://raw.githubusercontent.co... |
yandex-load/volta | firmware/arduino_due_1MHz/sync.ipynb | mpl-2.0 | df_r1000 = df.groupby(df.index//1000).mean()
fig = sns.plt.figure(figsize=(16, 6))
ax = sns.plt.subplot()
df_r1000.plot(ax=ax)
"""
Explanation: Группируем по миллисекундам и усредняем:
End of explanation
"""
fig = sns.plt.figure(figsize=(16, 6))
ax = sns.plt.subplot()
df_r1000[:12000].plot(ax=ax)
"""
Explanation: И... |
jtyberg/interactive-insights-workbench | notebook/samples/python/Query_MongoDB.ipynb | bsd-3-clause | import pandas as pd
from pymongo import MongoClient
from bson.objectid import ObjectId
from urth.widgets.widget_channels import channel
"""
Explanation: Query MongoDB Database Collection
This notebook demonstrates how to:
Connect to a MongoDB instance
List the databases for the instance
List the collections for a dat... |
gatmeh/Udacity-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... |
4dsolutions/Python5 | Dimensions of Python.ipynb | mit | from keyword import kwlist
print(", ".join(kwlist))
"""
Explanation: Oregon Curriculum Network <br />
Discovering Math with Python
Five Dimensions of Python
Keywords: basic syntax, reserved terms
Builtins: available on bootup of Python, no import required
Special Names: hooks for tying code to syntax (e.g. obj.attr,... |
jhprinz/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_2b_run_fixed.ipynb | lgpl-2.1 | import openpathsampling as paths
"""
Explanation: This is file runs the main calculation for the fixed length TPS simulation. It requires the file alanine_dipeptide_fixed_tps_traj.nc, which is written in the notebook alanine_dipeptide_fixed_tps_traj.ipynb.
In this file, you will learn:
* how to set up and run a fixed ... |
goodwordalchemy/thinkstats_notes_and_exercises | code/chap12_time_series_analysis.ipynb | gpl-3.0 | transactions = pandas.read_csv('mj-clean.csv', parse_dates=[5])
dailies = timeseries.GroupByQualityAndDay(transactions)
def PlotDailies(dailies):
thinkplot.PrePlot(rows=3)
for i, (name, daily) in enumerate(dailies.items()):
thinkplot.SubPlot(i+1)
title = 'price per gram ($)' if i == 0 else ''
... |
tensorflow/docs-l10n | site/en-snapshot/tensorboard/get_started.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... |
littlewizardLI/Udacity-ML-nanodegrees | Project0-titanic_survival_exploration/titanic_survival_exploration.ipynb | apache-2.0 | import numpy as np
import pandas as pd
# RMS Titanic data visualization code
# 数据可视化代码
from titanic_visualizations import survival_stats
from IPython.display import display
%matplotlib inline
# Load the dataset
# 加载数据集
in_file = 'titanic_data.csv'
full_data = pd.read_csv(in_file)
# Print the first few entries of t... |
cabreraj/sjcc_sacnas | Homework3/hw3.ipynb | mit | !python --version
"""
Explanation: CIS024C - Fall 2017 - Thursday 5:30-9:25pm
Homework 3
Homework 3 covers exercises in String Manipulation.
For a list of features supported in the string module, please refer to this URL https://docs.python.org/2/library/string.html
You will need to download this notebook and use thi... |
zenotech/zPost | ipynb/CYLINDER/CYLINDER.ipynb | bsd-3-clause | remote_data = True
remote_server_auto = True
case_name = 'cylinder'
data_dir='/gpfs/thirdparty/zenotech/home/dstandingford/VALIDATION/CYLINDER'
data_host='dstandingford@vis03'
paraview_cmd='mpiexec /gpfs/cfms/apps/zCFD/bin/pvserver'
if not remote_server_auto:
paraview_cmd=None
if not remote_data:
data_host='... |
robertoalotufo/ia898 | deliver/tutorial-numpy.ipynb | mit | import numpy as np
a = np.array( [2,3,4,-1,-2] )
print('Dimensões: a.shape=', a.shape )
print('Tipo dos elementos: a.dtype=', a.dtype )
print('Imprimindo o array completo:\n a=',a )
"""
Explanation: Introdução ao NumPy
O tipo ndarray
O tipo ndarray, ou apenas array é um arranjo de itens homogêneos de dimensionalidade ... |
ajgpitch/qutip-notebooks | docs/guide/Visualization.ipynb | lgpl-3.0 | %matplotlib inline
import numpy as np
from pylab import *
from qutip import *
"""
Explanation: Visualization of Quantum States and Processes
Contents
Introduction
Fock-Basis Probability Distributions
Quasi-Probability Distributions
Visualizing Operators
Quantum Process Tomography
End of explanation
"""
N = 20
rho_c... |
chungjjang80/FRETBursts | notebooks/Example - 2CDE Method.ipynb | gpl-2.0 | from fretbursts import *
from fretbursts.phtools import phrates
sns = init_notebook(apionly=True)
sns.__version__
# Tweak here matplotlib style
import matplotlib as mpl
mpl.rcParams['font.sans-serif'].insert(0, 'Arial')
mpl.rcParams['font.size'] = 12
%config InlineBackend.figure_format = 'retina'
"""
Explanation: Exa... |
robertclf/FAFT | FAFT_64-points_R2C/nbFAFT128_2D.ipynb | bsd-3-clause | import numpy as np
import ctypes
from ctypes import *
import pycuda.gpuarray as gpuarray
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import math
#To put images inside the notebook
%matplotlib inline
... |
turi-code/tutorials | notebooks/datas_messy_clean_it.ipynb | apache-2.0 | import os
import graphlab as gl
"""
Explanation: <h1>Data's messy - clean it up!</h1>
Data cleaning is a critical process for improving data quality and ultimately the accuracy of machine learning model output. In this notebook we show how the GraphLab Create Data Matching toolkit can be used to get your data shiny c... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-mmh/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-mmh', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-MMH
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy... |
param411singh/inf1340-2015-notebooks | Week 2.ipynb | mit | print("Hello world")
"""
Explanation: Preamble
This software is iPython Notebook. From the command line, change to the directory where your Notebooks (.ipynb) are located and type
ipython notebook
A Notebook contains "cells". Edit a cell by double clicking on it.
Some of the cells, like this one, contains text. The t... |
scottquiring/Udacity_Deeplearning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
phoebe-project/phoebe2-docs | development/examples/spot_transit.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Spot Transit
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
import numpy as np
b = phoebe.default_binary()
"""
Expl... |
phoebe-project/phoebe2-docs | 2.0/tutorials/distance.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Distance
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 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
"""
%matplotlib inline
import phoe... |
AndreySheka/dl_ekb | hw5/Seminar5.ipynb | mit | from __future__ import print_function
from sys import version_info
import matplotlib.pyplot as plt
import numpy as np
import os
import scipy
import theano
import theano.tensor as T
import lasagne
try:
import cPickle as pickle
except ImportError:
import pickle
%matplotlib inline
from scipy.misc import imread... |
dtamayo/reboundx | ipython_examples/IntegrateForce.ipynb | gpl-3.0 | import rebound
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def system():
sim = rebound.Simulation()
sim.G = 4*np.pi**2
sim.add(m=0.93)
sim.add(m=4.5*3.e-7, P=0.571/365.25, e=0.01)
sim.add(m=41.*3.e-7, P=13.34/365.25, e=0.01)
sim.move_to_com()
sim.dt = 0.07*sim.part... |
dsacademybr/PythonFundamentos | Cap08/Notebooks/DSA-Python-Cap08-07-StatsModels.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 8</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Para ... |
sdpython/ensae_teaching_cs | _doc/notebooks/sklearn_ensae_course/05_measuring_prediction_performance.ipynb | mit | # Get the data
from sklearn.datasets import load_digits
digits = load_digits()
X = digits.data
y = digits.target
# Instantiate and train the classifier
from sklearn.neighbors import KNeighborsClassifier
clf = KNeighborsClassifier(n_neighbors=1)
clf.fit(X, y)
# Check the results using metrics
from sklearn import metri... |
ruchika05/demo | Notebook/Anomaly-detection-DSWB.ipynb | epl-1.0 | from pyspark.sql import SQLContext
# adding the PySpark module to SparkContext
sc.addPyFile("https://raw.githubusercontent.com/seahboonsiew/pyspark-csv/master/pyspark_csv.py")
import pyspark_csv as pycsv
# you may need to modify this line if the filename or path is different.
sqlContext = SQLContext(sc)
data = sc.text... |
fjaviersanchez/JupyterTutorial | QuickTutorial.ipynb | mit | # E.g., write/read a table with data
min_x = 0 #Let's assume this is right ascension
max_x = 360
nsamples = 10000
min_y = -90 #Let's assume this is declination
max_y = 90
rnd_x = min_x+(max_x-min_x)*np.random.random(size=nsamples)
rnd_y = np.degrees(np.arcsin(np.sin(np.radians(min_y))+(np.sin(np.radians(max_y))-np.sin(... |
ivannz/crossing_paper2017 | experiments/plots_analysis.ipynb | mit | import os
import re
import time
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
BASE_PATH = "/Volumes/LaCie/from_macHD/Github/crossing_paper2017"
# BASE_PATH = ".."
"""
Explanation: Plots and analysis
End of explanation
"""
def offspring_empirical(Dmnk, levels, laplace=Fal... |
ViralLeadership/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter2_MorePyMC/Chapter2.ipynb | mit | import pymc as pm
parameter = pm.Exponential("poisson_param", 1)
data_generator = pm.Poisson("data_generator", parameter)
data_plus_one = data_generator + 1
"""
Explanation: Chapter 2
This chapter introduces more PyMC syntax and design patterns, and ways to think about how to model a system from a Bayesian perspect... |
ES-DOC/esdoc-jupyterhub | notebooks/pcmdi/cmip6/models/pcmdi-test-1-0/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'pcmdi', 'pcmdi-test-1-0', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: PCMDI
Source ID: PCMDI-TEST-1-0
Topic: Ocean
Sub-Topics: Timestepping Framewor... |
queq/calibpy | docs/ipynb-samples/Rich Output.ipynb | mit | from IPython.display import display
"""
Explanation: Rich Output
In Python, objects can declare their textual representation using the __repr__ method. IPython expands on this idea and allows objects to declare other, rich representations including:
HTML
JSON
PNG
JPEG
SVG
LaTeX
A single object can declare some or a... |
DS-100/sp17-materials | sp17/labs/lab05/lab05.ipynb | gpl-3.0 | # Run this cell to set up the notebook.
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
from client.api.notebook import Notebook
ok = Notebook('lab05.ok')
"""
Explanation: Lab 5: Relational Algebra in Pandas
End of explanation
"""
yo... |
ajaybhat/DLND | Project 1/dlnd-your-first-neural-network.ipynb | apache-2.0 | %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... |
richiebful/scotusbot | .ipynb_checkpoints/JudicialRulings-checkpoint.ipynb | gpl-3.0 | import csv
with open("judicialMetadata.csv", "w+") as metadata:
header = allRecentRecords[0].keys()
writer = csv.DictWriter(metadata, fieldnames=header)
writer.writerows(allRecentRecords)
"""
Explanation: Next block caches metadata for retrieving Supreme Court transcripts into a csv
End of explanation
"""
... |
SimonBiggs/poc-brachyoptimisation | Proof of concept with probability minimisation.ipynb | agpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
%matplotlib inline
from utilities import BasinhoppingWrapper, create_green_cm
green_cm = create_green_cm()
"""
Explanation: Proof of concept
This is a proof of concept for the inclusion of positional... |
kubeflow/pipelines | samples/core/parameterized_tfx_oss/taxi_pipeline_notebook.ipynb | apache-2.0 | !python3 -m pip install pip --upgrade --quiet --user
!python3 -m pip install kfp --upgrade --quiet --user
pip install tfx==1.4.0 tensorflow==2.5.1 --quiet --user
"""
Explanation: TFX pipeline example - Chicago Taxi tips prediction
Overview
Tensorflow Extended (TFX) is a Google-production-scale machine
learning platfor... |
mne-tools/mne-tools.github.io | 0.24/_downloads/c6baf7c1a2f53fda44e93271b91f45b8/50_beamformer_lcmv.ipynb | bsd-3-clause | # Authors: Britta Westner <britta.wstnr@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample, fetch_fsaverage
from mne.beamformer import make_lcmv, apply_lcmv
"""
Explanation: Source reconstruction using an LCM... |
agile-geoscience/gio | docs/userguide/Read_OpendTect_horizons.ipynb | apache-2.0 | import gio
ds = gio.read_odt('data/OdT/3d_horizon/Segment_ILXL_Single-line-header.dat')
ds
ds['twt'].plot()
"""
Explanation: Read OpendTect horizons
The best way to export horizons from OpendTect is with these options:
x/y and inline/crossline
with header (single or multi-line, it doesn't matter)
choose all the att... |
flaviostutz/datascience-snippets | study/udacity-deep-learning/assignment3-regularization.ipynb | mit | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
"""
Explanation: Deep Learning
Assignment 3
Previously in 2_fullyconnected.ipynb, you tra... |
christophe-pouzat/LASCON2016 | AreTwoPSTHsIdentical.ipynb | cc0-1.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
import scipy
import h5py
"""
Explanation: Setting up Python
The analysis presented in the manuscript and detailed next is carried
out with Python 3 (the following code runs and gives identical results
with Python 2). We are g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.