repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
pcuellar/MAS.500 | HW5/notebook-examples-master/example-bs4.ipynb | mit | import requests
r = requests.get('http://www.imdb.com/name/nm0000821') # lets look at Amitabh Bachchan's list of movies
"""
Explanation: Scraping Webpages with BeautifulSoup
Lets try to get a list of all the years of all of Amitabh Bachchan movies! If you don't know, he's kind of the Sean Connery of India.
BeautifulS... |
QuantCrimAtLeeds/PredictCode | examples/Case Study Chicago South Side/SEPP.ipynb | artistic-2.0 | %matplotlib inline
from common import *
datadir = os.path.join("//media", "disk", "Data")
#datadir = os.path.join("..", "..", "..", "..", "..", "Data")
import open_cp.sepp as sepp
import open_cp.predictors
import open_cp.logger
open_cp.logger.log_to_true_stdout()
south_side, points = load_data(datadir)
points.time_r... |
bosscha/alma-calibrator | notebooks/selecting_source/alma_database_selection8.ipynb | gpl-2.0 | resume_sorted3 = sorted(resume, key=lambda data: data[11])
resume_sorted6 = sorted(resume, key=lambda data: data[12])
resume_sorted7 = sorted(resume, key=lambda data: data[13])
res3 = np.array(resume_sorted3)
res6 = np.array(resume_sorted6)
res7 = np.array(resume_sorted7)
plt.figure(figsize=(15,4))
plt.subplot(131)
p... |
IBMDecisionOptimization/docplex-examples | examples/mp/jupyter/mining_pandas.ipynb | apache-2.0 | import pip
REQUIRED_MINIMUM_PANDAS_VERSION = '0.17.1'
try:
import pandas as pd
assert pd.__version__ >= REQUIRED_MINIMUM_PANDAS_VERSION
except:
raise Exception("Version %s or above of Pandas is required to run this notebook" % REQUIRED_MINIMUM_PANDAS_VERSION)
"""
Explanation: Optimizing mining operations
T... |
grokkaine/biopycourse | day1/tutorial.ipynb | cc0-1.0 | # This is a line comment.
"""
A multi-line
comment.
"""
a = None #Just declared an empty object
print(a)
a = 1
print(a)
a = 'abc'
print(a)
b = 3
c = [1, 2, 3]
a = [a, 2, b, 1., 1.2e-5, True] #This is a list.
print(a)
## Python is a dynamic language
a = 1
print(type(a))
print(a)
a = "spam"
print(type(a))
print(a)
a = ... |
SJSlavin/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
def random_line(m, b, sigma, size=10):
"""Create a line y = m*x + b + N(0,si... |
jve2kor/machine-learning-nanodegree | projects/intro-to-tensorflow/intro_to_tensorflow.ipynb | gpl-3.0 | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
Eric89GXL/vispy | examples/ipynb/webgl_example_1.ipynb | bsd-3-clause | import numpy as np
import vispy
import vispy.gloo as gloo
from vispy import app
from vispy.util.transforms import perspective, translate, rotate
# load the vispy bindings manually for the notebook which enables webGL
# %load_ext vispy
n = 100
a_position = np.random.uniform(-1, 1, (n, 3)).astype(np.float32)
a_id = np.... |
chapmanbe/nlm_clinical_nlp | radnlp_demo.ipynb | mit | %matplotlib inline
"""
Explanation: RadNLP
Radiology NLP or
Rad (as in cool) NLP or
[Fill in the Blank] NLP
© Brian E. Chapman, PhD
RadNLP is a package that builds upon the pyConTextNLP algorithm's sentence-level text processing to perform simple document-level classification. The package also contains a number o... |
TomTranter/OpenPNM | examples/simulations/Relative Permeability in 2D.ipynb | mit | import warnings
import scipy as sp
import numpy as np
import openpnm as op
import matplotlib.pyplot as plt
np.set_printoptions(precision=4)
np.random.seed(10)
%matplotlib inline
ws = op.Workspace()
ws.settings["loglevel"] = 40
"""
Explanation: Basic Relative Permeability Example in 2D
This example using invasion perco... |
mne-tools/mne-tools.github.io | 0.23/_downloads/3bb9354e99617f5fdf32e50748fc566d/15_inplace.ipynb | bsd-3-clause | import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
# the preload flag loads the data into memory now
raw = mne.io.read_raw_fif(sample_data_raw_file, preload=True)... |
zomansud/coursera | ml-clustering-and-retrieval/week-5/5_lda_blank.ipynb | mit | import graphlab as gl
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
'''Check GraphLab Create version'''
from distutils.version import StrictVersion
assert (StrictVersion(gl.version) >= StrictVersion('1.8.5')), 'GraphLab Create must be version 1.8.5 or later.'
# import wiki data
wiki = gl.SFr... |
ruifpmaia/foodcontextawarefactmach | AnalyseData/AnalyseResults_kochbar.ipynb | gpl-2.0 | Analyse('kochbar\\Output', ['kochbar_ds.','kochbar_ds2.','kochbar_ds3.','kochbar_ds4.','kochbar_ds5.','kochbar_ds6.','kochbar_ds7.'], 100)
print 'kochbar_ds - Rating + Users + Item\nkochbar_ds2 - Rating + Users + Item + AvgRatUser\nkochbar_ds3 - Rating + Users + Item + AvgRatUser + StdDevUser\nkochbar_ds4 - Rating + Us... |
Microno95/DESolver | docs/examples/pyaudi/Example 5 - PyAudi - High Order Taylor Maps II.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import os
import numpy as np
os.environ['DES_BACKEND'] = 'numpy'
import desolver as de
import desolver.backend as D
from desolver.backend import gdual_double as gdual
T = 1e-3
@de.rhs_prettifier(equ_repr="[vr, -1/r**2 + r*vt**2, vt, -2*vt*vr/r]", md_repr=r"""$... |
zsylvester/notebooks | Exploring_decompaction_with_Python.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import functools
from scipy.optimize import bisect
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
plt.rcParams['mathtext.fontset'] = 'cm'
"""
Explanation: Exploring (de)compaction with Python
Zoltán Sylvester, Bureau of Economic Geology, The University... |
agile-geoscience/welly | tutorial/02_Curves.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import welly
welly.__version__
"""
Explanation: All about curves
Some preliminaries...
End of explanation
"""
from welly import Well
w = Well.from_las('data/P-129_out.LAS')
w.plot()
"""
Explanation: Load a well from LAS
Use the from_las() method to load a well b... |
RoebideBruijn/datascience-intensive-course | exercises/logistic_regression/Mini_Project_Logistic_Regression.ipynb | mit | %matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as sns
sns.set_s... |
chris1610/pbpython | notebooks/Simple_Graphing.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.__version__
"""
Explanation: This (article] [http://pbpython.com/simple-graphing-pandas.html] will walk through how to start doing some simple graphing in pandas.
I am using a new data file that is the same format as my previous article but incl... |
paultheastronomer/OAD-Data-Science-Toolkit | Teaching Materials/Machine Learning/Supervised Learning/Courses/Astrophysical Machine Learning/Part 1/Exercise 3.ipynb | gpl-3.0 | from astropy.io import fits as fits
fitsimage=fits.open('filename.fits')
image=np.flipud(fitsimage[0].data)
"""
Explanation: Exercise 3
We're going to switch gears a little and talk about the astrophysical part of Astrophysical Machine Learning. This exercise will have you examine two different forms of data. The fir... |
kingb12/languagemodelRNN | model_comparisons/noing23_LSTM_v_BOW.ipynb | mit | report_files = ["/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing23_200_512_04drb/encdec_noing23_200_512_04drb.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing23_bow_200_512_04drb/encdec_noing23_bow_200_512_04drb.json"]
log_files = ["/Users/bking/IdeaProjects/... |
goodwordalchemy/thinkstats_notes_and_exercises | code/chap02ex.ipynb | gpl-3.0 | %matplotlib inline
import chap01soln
resp = chap01soln.ReadFemResp()
resp.columns
"""
Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br>
Allen Downey
Read the female respondent file and display the variables names.
End of explanation
"""
import thinkstats2
hist = thinkstats2.Hist(resp.totincr... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-3/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-3', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-3
Sub-Topics: Radiative Forcin... |
JaviMerino/lisa | ipynb/tutorial/07_PerfAnalysis.ipynb | apache-2.0 | import logging
reload(logging)
logging.basicConfig(
format='%(asctime)-9s %(levelname)-8s: %(message)s',
datefmt='%I:%M:%S')
# Enable logging at INFO level
logging.getLogger().setLevel(logging.INFO)
# Execute this cell to report devlib debugging information
logging.getLogger('ssh').setLevel(logging.DEBUG)
# ... |
mbakker7/ttim | pumpingtest_benchmarks/6_test_of_schroth.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from ttim import *
"""
Explanation: Confined Aquifer Test
This test is taken from examples presented in MLU tutorial.
End of explanation
"""
Q = 82.08 #constant discharge in m^3/d
zt0 = -46 #top boundary of upper aquifer in m
z... |
synthicity/activitysim | activitysim/examples/example_estimation/notebooks/08_work_tour_scheduling.ipynb | agpl-3.0 | import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
"""
Explanation: Estimating Work Tour Scheduling
This notebook illustrates how to re-estimate the mandatory tour scheduling component for ActivitySim. This process
includes running ActivitySim in estimation mode to rea... |
mne-tools/mne-tools.github.io | 0.21/_downloads/30d3f995eaa317ef564a8fb6d72c22bf/plot_left_cerebellum_volume_source.ipynb | bsd-3-clause | # Author: Alan Leggitt <alan.leggitt@ucsf.edu>
#
# License: BSD (3-clause)
import mne
from mne import setup_source_space, setup_volume_source_space
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
subject = 'sample'
aseg_fname = subjects_dir + '/sam... |
keras-team/keras-io | guides/ipynb/customizing_what_happens_in_fit.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow import keras
"""
Explanation: Customizing what happens in fit()
Author: fchollet<br>
Date created: 2020/04/15<br>
Last modified: 2020/04/15<br>
Description: Complete guide to overriding the training step of the Model class.
Introduction
When you're doing supervised learning, you... |
fujii-team/Henbun | notebooks/Henbun_structure2.ipynb | apache-2.0 | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import Henbun as hb
"""
Explanation: More about Henbun
In this notebook, we describe more details about Henbun through Variational method.
Libraries to be used.
End of explanation
"""
X = np.linspace(0,6,40).reshape(-1,1)
... |
mndrake/PythonEuler | euler_061_070.ipynb | mit | from euler import timer, Seq, fst, snd
def p061():
values = ([lambda n: n*(n+1)/2, lambda n: n*n, lambda n: n*(3*n-1)/2,
lambda n: n*(2*n-1), lambda n: n*(5*n-3)/2, lambda n: n*(3*n-2)]
>> Seq.mapi(lambda n: n)
>> Seq.collect(lambda (i,fun):
... |
pligor/predicting-future-product-prices | 02_preprocessing/.ipynb_checkpoints/exploration05-price_history_clustering-checkpoint.ipynb | agpl-3.0 | from __future__ import division
import numpy as np
import pandas as pd
import sys
import math
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import re
import os
import csv
from helpers.outliers import MyOutliers
from skroutz_mobile import SkroutzMobile
from sklearn.ensemble import IsolationForest
import ... |
mne-tools/mne-tools.github.io | 0.23/_downloads/1b3716673f2aeae3f2b0c6c336812aba/80_fix_bem_in_blender.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Ezequiel Mikulan <e.mikulan@gmail.com>
# Manorama Kadwani <manorama.kadwani@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import shutil
import mne
data_path = mne.datasets.sample.data_path()
subjects_dir = op.join(data_p... |
intel-analytics/BigDL | python/chronos/use-case/AIOps/AIOps_anomaly_detect_unsupervised_forecast_based.ipynb | apache-2.0 | def get_result_df(y_true_unscale, y_pred_unscale, ano_index, look_back,target_col='cpu_usage'):
"""
Add prediction and anomaly value to dataframe.
"""
result_df = pd.DataFrame({"y_true": y_true_unscale.squeeze(), "y_pred": y_pred_unscale.squeeze()})
result_df['anomalies'] = 0
result_df.loc[resul... |
nehal96/Deep-Learning-ND-Exercises | Sentiment Analysis/Sentiment Analysis with Andrew Trask/3-building-the-nn.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()... |
scientific-visualization-2016/ClassMaterials | Week-03/02_effective_visualizations.ipynb | cc0-1.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import numpy as np
x = np.linspace(-np.pi, np.pi, 256,endpoint=True)
y,z = np.sin(x), np.cos(x)
plt.plot(x,y)
plt.plot(x,z)
plt.show()
"""
Explanation: Designing Effective Visualizations
For any data sets there are many possibilities for mapping... |
rnoxy/cifar10-cnn | Classification_using_HOG_features.ipynb | mit | import myutils
raw_data_training, raw_data_testing = myutils.load_CIFAR_dataset(shuffle=False)
# raw_data_training = raw_data_training[:5000]
class_names = myutils.load_CIFAR_classnames()
n_training = len( raw_data_training )
n_testing = len( raw_data_testing )
print('Loaded CIFAR10 database with {} training and {} ... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/deterministics.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rc("figure", figsize=(16, 9))
plt.rc("font", size=16)
"""
Explanation: Deterministic Terms in Time Series Models
End of explanation
"""
from statsmodels.tsa.deterministic import DeterministicProcess
index = pd.RangeIndex(0, 100)
det_proc = ... |
aje/POT | docs/source/auto_examples/plot_otda_classes.ipynb | mit | # Authors: Remi Flamary <remi.flamary@unice.fr>
# Stanislas Chambon <stan.chambon@gmail.com>
#
# License: MIT License
import matplotlib.pylab as pl
import ot
"""
Explanation: OT for domain adaptation
This example introduces a domain adaptation in a 2D setting and the 4 OTDA
approaches currently supported in ... |
hparik11/Deep-Learning-Nanodegree-Foundation-Repository | gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
WNoxchi/Kaukasos | FAI02_old/Lesson9/L9_neural_sr.ipynb | mit | %matplotlib inline
# import importlib
# import utils2; importlib.reload(utils2)
import os, sys
sys.path.insert(1, os.path.join('../utils'))
from utils2 import *
from scipy.optimize import fmin_l_bfgs_b
from scipy.misc import imsave
from keras import metrics
from vgg16_avg import VGG16_Avg
from bcolz_array_iterator i... |
ReactiveX/RxPY | notebooks/reactivex.io/Part III - Transformation.ipynb | mit | reset_start_time(O.map, title='map') # alias is "select"
# warming up:
d = subs(O.from_((1, 2 , 3)).map(lambda x: x * 2))
rst(O.pluck, title='pluck')
d = subs(O.from_([{'x': 1, 'y': 2}, {'x': 3, 'y': 4}]).pluck('y'))
class Coord:
def __init__(self, x, y):
self.x = x
self.y = y
rst(title='pluck_at... |
adrn/tutorials | notebooks/Coordinates-Intro/Coordinates-Intro.ipynb | cc0-1.0 | # Python standard-library
from urllib.parse import urlencode
from urllib.request import urlretrieve
# Third-party dependencies
from astropy import units as u
from astropy.coordinates import SkyCoord
from IPython.display import Image
"""
Explanation: Coords 1: Getting Started with astropy.coordinates
Authors
Erik Toll... |
michaelbrundage/vowpal_wabbit | python/examples/VW_in_Python.ipynb | bsd-3-clause | from __future__ import print_function
from vowpalwabbit import pyvw
"""
Explanation: This notebook demonstrates the most basic capabilities of the pyvw python->VW interface. The inferface (unlike the rest of VW :P) is extensively documented, so if you are confused, look at the python docs!
Any pyvw application needs t... |
texaspse/blog | media/f16-scientific-python/week2/PythonScientificWS-Week2.ipynb | mit | import pandas as pd
"""
Explanation: Download
Goal of Week 2
This week we will:
Take a look at pandas, an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools
Load in Excel (.xls or .csv) files to use in Python
Managing headers
Read-in only certain columns
... |
ES-DOC/esdoc-jupyterhub | notebooks/inpe/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', 'inpe', 'sandbox-1', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: INPE
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radi... |
jrmontag/Data-Science-45min-Intros | pos-tagging/pos-tagging-accuracy.ipynb | unlicense | from pprint import pprint
"""
Explanation: Outline
Collect some tweets
Annotate the tweets
Calculate the accuracy
Make sure corenlp_pywrap is pip-installed.
End of explanation
"""
# we'll use data from a job that collected tweets about parenting
tweet_bodies = [body for body in open('tweet_bodies.txt')]
# sanity... |
gboeing/pynamical | examples/pynamical-demo-other-models.ipynb | mit | from numba import jit
from pynamical import simulate, cubic_map, singer_map, bifurcation_plot, phase_diagram, phase_diagram_3d
%matplotlib inline
"""
Explanation: Pynamical: demo of the Cubic Map, Singer Map, and Mandelbrot Map
Citation info: Boeing, G. 2016. "Visual Analysis of Nonlinear Dynamical Systems: Chaos, Fra... |
fionapigott/Data-Science-45min-Intros | estimating_classes/estimating-classes.ipynb | unlicense | # Imports
from __future__ import division
import numpy as np
from scipy.misc import comb
from numpy import random as np_random
from collections import Counter
from random import sample, choice
from math import factorial, log, exp
import fileinput
import matplotlib.pyplot as plt
%matplotlib inline
# make a population w... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/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', 'mohc', 'sandbox-3', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: MOHC
Source ID: SANDBOX-3
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection... |
cni/psych204a | mrTutMR.ipynb | gpl-2.0 | %pylab inline
import matplotlib as mpl
mpl.rcParams["figure.figsize"] = (8, 6)
mpl.rcParams["axes.grid"] = True
from IPython.display import display
from ipywidgets import interact,FloatSlider
"""
Explanation: Basic MR
Class: Psych 204a
Tutorial: Basic MR
Duration: 90 minutes
Authors: Originally written in Mat... |
hunterherrin/phys202-2015-work | assignments/assignment05/InteractEx03.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 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
k=(x-c*t-a)*(1/2)*np.sqrt(c)
return(1/2)*c... |
NYUDataBootcamp/Projects | UG_F16/Ho-NBA Clutch.ipynb | mit | #importing data organization and graphics packages
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import scipy.stats as stats
import datetime as dt
import sys
import seaborn as sb
import warnings
print('Today is', dt.date.today())
print('What version ... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/mri-esm2-0/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'mri-esm2-0', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MRI
Source ID: MRI-ESM2-0
Sub-Topics: Radiative Forcings.
Properties: 85 (42 ... |
google/physics-math-tutorials | colabs/Bayesian Specificity and Sensitivity.ipynb | apache-2.0 | #@title Install arviz and update pymc3
!pip install arviz -q
!pip install pymc3 -U -q
"""
Explanation: Copyright 2021 Google LLC
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.or... |
zhouqifanbdh/liupengyuan.github.io | chapter1/homework/localization/3-22/201611590301.ipynb | mit | name = input('请输入您的名字')
print("您好,, name")
birthday = float(input('请输入您的生日,格式:月份.日期'))
if birthday >= 1.20 and birthday <= 2.18:
print(name, '你是非常有个性的水瓶座')
elif birthday >= 2.19 and birthday <= 3.20:
print(name, '你是非常有个性的双鱼座')
elif birthday >= 3.21 and birthday <= 4.19:
... |
phoebe-project/phoebe2-docs | 2.3/tutorials/ui_jupyter.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
import phoebe
from phoebe import u # units
logger = phoebe.logger()
b = phoebe.default_binary()
"""
Explanation: Advanced: Interacting with the UI in Jupyter
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an onlin... |
transcranial/keras-js | notebooks/layers/convolutional/ZeroPadding3D.ipynb | mit | data_in_shape = (3, 5, 2, 2)
L = ZeroPadding3D(padding=(1, 1, 1), data_format='channels_last')
layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
np.random.seed(260)
data_in = 2 * np.random.random(data_in_shap... |
arhik/nupic | src/nupic/frameworks/viz/examples/Demo.ipynb | agpl-3.0 | from nupic.engine import Network, Dimensions
# Create Network instance
network = Network()
# Add three TestNode regions to network
network.addRegion("region1", "TestNode", "")
network.addRegion("region2", "TestNode", "")
network.addRegion("region3", "TestNode", "")
# Set dimensions on first region
region1 = network.... |
msadegh97/machine-learning-course | 01-introduction.ipynb | gpl-3.0 | # importing numpy, pandas & matplotlib
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import random
%matplotlib inline
"""
Explanation: Introduction
End of explanation
"""
# Load Iris dataset
from sklearn.datasets import load_iris
iris = load_iris()
iris.feature_names
print(iris.DESCR)... |
goerlitz/text-mining | python/JSON to CSV.ipynb | apache-2.0 | from pymongo import MongoClient
from jsonpath_rw import jsonpath, parse
import json
import yaml
import pandas as pd
import re
"""
Explanation: About
Extract specific parts from JSON documents and store them as columns in a CSV/TSV for further data analysis.
Prerequesites
A running mongodb instance which holds the JSO... |
jorisvandenbossche/DS-python-data-analysis | notebooks/python_recap/03-functions.ipynb | bsd-3-clause | def the_answer_to_the_universe():
print(42)
the_answer_to_the_universe()
"""
Explanation: Python the basics: functions
DS Data manipulation, analysis and visualization in Python
May/June, 2021
© 2021, Joris Van den Bossche and Stijn Van Hoey (jorisvandenb... |
oyamad/theory16 | lemke_howson/mclennan_tourky_py.ipynb | mit | %matplotlib inline
import time
import numpy as np
import matplotlib.pyplot as plt
import quantecon as qe
from quantecon.compute_fp import _print_after_skip
from quantecon.game_theory import Player, NormalFormGame, lemke_howson
def compute_fixed_point_ig(f, x_init, error_tol=1e-3, max_iter=50, verbose=1,
... |
zhouqifanbdh/liupengyuan.github.io | chapter2/homework/computer/4-12/201411691015.ipynb | mit | def compute_sum(n):
total = 0
for i in range(n):
m = int(input('请输入一个正整数为加数,以回车结束。 '))
total += m
return total
n = int(input('请输入一个正整数为次数,以回车结束。 '))
print ('total=',compute_sum(n))
"""
Explanation: 将前面几章用while循环的习题,用for循环实现,并尽量写成函数......
以前的:
chapter1-task2:
练习2:仿照实践1,写出由用户... |
otavio-r-filho/AIND-Deep_Learning_Notebooks | autoencoder/Simple_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)
"""
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to compres... |
ngcm/summer-academy-2017-basics | basics_B/ObjectOriented/solutions/Classes for Basics B.ipynb | mit | a = 10.1
type(a)
"""
Explanation: <font color='mediumblue'> What are classes?
A way of organising your code
Data is inherently linked to the things you can do with it.
Pros
Can do everything you can do without classes, but idea is to make it easier
Classes encourage code reuse through a concept called "inheritance... |
dseuss/notebooks | Bayesian Optimization.ipynb | unlicense | def target(x):
return np.exp(-(x - 2)**2) + np.exp(-(x - 6)**2/10) + 1/ (x**2 + 1)
x = np.linspace(-2, 10, 1000)
y = target(x)
plt.plot(x, y)
"""
Explanation: Target Function
Lets create a target 1-D function with multiple local maxima to test and visualize how the BayesianOptimization package works. The target ... |
machow/siuba | examples/architecture/006-autocompletion.ipynb | mit | from siuba.siu import _
dir(_)[:6]
"""
Explanation: Siu expression autocompletion: _.cyl.\<tab>
Note: this is document is based on PR 248 by @tmastny, and all the discussion there!
(Drafted on 7 August 2020)
tl;dr. Implementing autocompletion requires 3 components: identifying the DataFrame to complete, understanding... |
random-forests/tensorflow-workshop | archive/zurich/02_quickdraw.ipynb | apache-2.0 | # This is for graph visualization.
from IPython.display import clear_output, Image, display, HTML
def strip_consts(graph_def, max_const_size=32):
"""Strip large constant values from graph_def."""
strip_def = tf.GraphDef()
for n0 in graph_def.node:
n = strip_def.node.add()
n.MergeFrom(n0)
... |
kdestasio/online_brain_intensive | nipype_tutorial/notebooks/basic_interfaces.ipynb | gpl-2.0 | %pylab inline
from nilearn.plotting import plot_anat
plot_anat('/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz', title='original',
display_mode='ortho', dim=-1, draw_cross=False, annotate=False)
"""
Explanation: Interfaces
In Nipype, interfaces are python modules that allow you to use various... |
shirtsgroup/physical-validation | doc/examples/integrator_validation.ipynb | lgpl-2.1 | # enable plotting in notebook
%matplotlib notebook
"""
Explanation: Integrator validation
Note: This notebook can be run locally by cloning the
Github repository.
The notebook is located in doc/examples/integrator_validation.ipynb.
End of explanation
"""
from simulation_results import example_simulations
import phy... |
UWashington-Astro300/Astro300-A17 | Python_Images_FITS.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as fits
plt.style.use('ggplot')
plt.rc('axes', grid=False) # turn off the background grid for images
"""
Explanation: FITS file (Flexible Image Transport System) - Standard Astro Data Format
FITS (Flexible Image Transport... |
inkenbrandt/WellApplication | docs/USGS.ipynb | mit | %matplotlib inline
import pandas as pd
import platform
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from pylab import rcParams
rcParams['figure.figsize'] = 10, 10
"""
Explanation: This notebook uses the Scientific Python (scipy) stack tools to generate flow duration curves from curre... |
rajul/tvb-library | tvb/simulator/demos/surface_deterministic_surface_stimulus.ipynb | gpl-2.0 | from tvb.datatypes.cortex import Cortex
from tvb.datatypes.local_connectivity import LocalConnectivity
from tvb.simulator.lab import *
"""
Explanation: Demonstrate using the simulator for a surface simulation with a surface stimulus
Run time: approximately 7 minutes (workstation circa 2010).
Memory requirement: ~ 1 GB... |
qgoisnard/Exercice-update | 04ex-Buckling.ipynb | mit | %matplotlib inline
from sympy.interactive import printing
printing.init_printing()
from frame import *
import sympy as sp
import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as linalg
class Frame_Buckling(LinearFrame):
def N_local_stress(self,element):
"""
Returns the no... |
csaladenes/csaladenes.github.io | present/bi2/2020/ubb/az_en_jupyter2_mappam/sklearn_tutorial/02.1-Machine-Learning-Intro.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn')
# Import the example plot from the figures directory
from fig_code import plot_sgd_separator
plot_sgd_separator()
"""
Explanation: <small><i>This notebook was put together by Jake Vanderplas. Source and license info is on GitHub.</i></small>... |
TomTranter/OpenPNM | examples/topology/Various Cubic Networks.ipynb | mit | import os
import warnings
import numpy as np
import openpnm as op
np.random.seed(10)
ws = op.Workspace()
ws.settings['loglevel'] = 40
warnings.filterwarnings('ignore')
pn = op.network.Cubic(shape=[10, 10, 10], spacing=1, connectivity=6)
"""
Explanation: Generate Cubic Lattices of Various Shape, Sizes and Topologies
Th... |
ICL-SML/Doubly-Stochastic-DGP | demos/demo_regression_UCI.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(0)
import time
import matplotlib.pyplot as plt
%matplotlib inline
from gpflow.likelihoods import Gaussian
from gpflow.kernels import RBF, White
from gpflow.mean_functions import Constant
from gpflow.models.sgpr import SGPR, GPRFITC
from gpflow.mode... |
czhengsci/veidt | veidt/rfxas/notebooks/example_notebook.ipynb | bsd-3-clause | Fe2O3_spectrum_dataframe = pd.read_pickle('Fe2O3_computational_spectrum.pkl')
Fe2O3_spectrum_dataframe
spectrum_energy = Fe2O3_spectrum_dataframe['x_axis_energy_55eV'].values[0]
spectrum_mu = Fe2O3_spectrum_dataframe['interp_spectrum_55eV'].values[0]
Fe2O3_XANES_object1 = XANES(spectrum_energy, spectrum_mu, absorptio... |
Photon-HDF5/photon_hdf5_reading_examples | python/Reading µs-ALEX data from Photon-HDF5 with h5py.ipynb | mit | from __future__ import division, print_function # only needed on py2
%matplotlib inline
import numpy as np
import h5py
import matplotlib.pyplot as plt
"""
Explanation: Reading µs-ALEX data from Photon-HDF5 with h5py
In this notebook we show how to read a µs-ALEX smFRET measurement stored in
Photon-HDF5 format
using p... |
PyLadiesDC/python-for-journalists | Python_NRT.ipynb | mit | name = "Pepe"
"""
Explanation: Python NRT
(Not a Real Tutorial)
<br>A brief brief tour around</br>
Python 2.7 & Pandas library
Python language
Good language to start programming with
Simple, powerful, mature
Easy to read, intuitive
```
print "how "+"are you?"
how are you?
```
Running Python
From Python consol... |
SnoopJeDi/WoWNPCs | WoW_NPC_analysis.ipynb | mit | import re
from lxml import etree
from matplotlib import pyplot as plt
import numpy as np
%matplotlib inline
import seaborn as sns
"""
Explanation: Analysis of non-player characters (NPCs) in World of Warcraft (WoW)
World of Warcraft (WoW) is a popular online game originally published in 2004 by Blizzard Entertainment.... |
guyk1971/deep-learning | intro-to-rnns/Anna_KaRNNa.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
eecs445-f16/umich-eecs445-f16 | handsOn_lecture19_baum-welch-pgm-inference/handsOn_lecture19_baum-welch-pgm-inference-template.ipynb | mit | import numpy as np
np.set_printoptions(suppress=True)
parts_of_speech = DETERMINER, NOUN, VERB, END = 0, 1, 2, 3
words = THE, DOG, CAT, WALKED, RAN, IN, PARK, END = 0, 1, 2, 3, 4, 5, 6, 7
# transition probabilities
A = np.array([
# D N V E
[0.1, 0.8, 0.1, 0.0], # D: determiner most likely to ... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/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', 'awi', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: 85 (42 re... |
tensorflow/docs-l10n | site/ja/tutorials/images/classification.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... |
phenology/infrastructure | applications/notebooks/laurens/comparisons.ipynb | apache-2.0 | #Add all dependencies to PYTHON_PATH
import sys
sys.path.append("/usr/lib/spark/python")
sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip")
sys.path.append("/usr/lib/python3/dist-packages")
sys.path.append("/data/local/jupyterhub/modules/python")
#Define environment variables
import os
os.environ["HADOOP... |
mne-tools/mne-tools.github.io | 0.19/_downloads/cc11b719732b6d62ff79ced562e2d134/plot_otp.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import mne
import numpy as np
from mne import find_events, fit_dipole
from mne.datasets.brainstorm import bst_phantom_elekta
from mne.io import read_raw_fif
print(__doc__)
"""
Explanation: Plot sensor denoising using ov... |
vicente-gonzalez-ruiz/YAPT | 02-basics/10-exceptions.ipynb | cc0-1.0 | # Note: You must interrupt the kernel (see the menu) in order to simulate <ctrl>+c.
try:
text = input('Please, enter something (or stop the kernel): ')
except:
print('Sorry, something wrong happened :-(')
# This command never should be executed if you didn't provide an input
print('You entered "{}".'.forma... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/Iterators and Generators Homework-checkpoint.ipynb | apache-2.0 | def gensquares(N):
pass
for x in gensquares(10):
print x
"""
Explanation: Iterators and Generators Homework
Problem 1
Create a generator that generates the squares of numbers up to some number N.
End of explanation
"""
import random
random.randint(1,10)
def rand_num(low,high,n):
pass
for num in rand_... |
amueller/sklearn_workshop | 10 - Working With Text Data.ipynb | bsd-2-clause | import pandas as pd
import os
data = pd.read_csv(os.path.join("data", "train.csv"))
len(data)
data
y_train = np.array(data.Insult)
y_train
text_train = data.Comment.tolist()
text_train[6]
data_test = pd.read_csv(os.path.join("data", "test_with_solutions.csv"))
text_test, y_test = data_test.Comment.tolist(), np... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/recommendation_systems/solutions/dcn.ipynb | apache-2.0 | # Installing the necessary libraries.
!pip install -q tensorflow-recommenders
!pip install -q --upgrade tensorflow-datasets
# Importing the necessary modules.
import pprint
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
import tensorflow ... |
Vvkmnn/books | AutomateTheBoringStuffWithPython/lesson34.ipynb | gpl-3.0 | import os
# Define base directory
defaultpath = os.path.expanduser('~/Dropbox/learn/books/Python/AutomateTheBoringStuffWithPython')
#Change directory to files directory if set in default
if (os.getcwd() == defaultpath):
os.chdir('/files')
else:
os.chdir(defaultpath + '/files')
"""
Explanation: Lesson ... |
tanmay987/deepLearning | first-neural-network/Your_first_neural_network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
OceanPARCELS/parcels | parcels/examples/documentation_indexing.ipynb | mit | from parcels import FieldSet
from glob import glob
import numpy as np
from os import path
from datetime import timedelta as delta
"""
Explanation: Documentation on dimensions and indexing in Parcels
Parcels supports Fields on any curvilinear Grid. For velocity Fields (U, V and W), there are some additional restriction... |
seifip/udacity-deep-learning-nanodegree | !P2 - 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... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/iitm-esm/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'iitm-esm', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: IITM-ESM
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Ener... |
landmanbester/fundamentals_of_interferometry | 6_Deconvolution/6_1_sky_models.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
"""
Explanation: Outline
Glossary
6. Deconvolution in Imaging
Previous: 6. Introduction
Next: 6.2 Interative Deconvolution with Point Sources (CLEAN)
Import sta... |
crowd-course/datascience | 5-classification/5.4 - Artificial Neural Networks in Classifying Breast Cancer.ipynb | mit | import pandas as pd # we use this library to import a CSV of cancer tumor data
import numpy as np # we use this library to help us represent traditional Python arrays/lists as matrices/tensors with linear algebra operations
from sknn.mlp import Classifier, Layer # we use this library for the actual neural network code... |
rsignell-usgs/notebook | HOPS/hops_velocity_try.ipynb | mit | from netCDF4 import Dataset
url = ('http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/'
'nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_2015081612_01h.nc')
nc = Dataset(url)
"""
Explanation: The problem: CF compliant readers cannot read HOPS dataset directly.
The solution... |
basp/notes | completing_the_square.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import sympy
from sympy import Integer as I, Rational as R, solve, S, N
import plotutils as pu
%matplotlib inline
"""
Explanation: completing the square
As always, we need our friends.
End of explanation
"""
expr = S('x^2 + 5*x - 18')
solve(expr)
"""
Explanation: ... |
d00d/quantNotebooks | Notebooks/quantopian_research_public/notebooks/lectures/Means/notebook.ipynb | unlicense | # Two useful statistical libraries
import scipy.stats as stats
import numpy as np
# We'll use these two data sets as examples
x1 = [1, 2, 2, 3, 4, 5, 5, 7]
x2 = x1 + [100]
print 'Mean of x1:', sum(x1), '/', len(x1), '=', np.mean(x1)
print 'Mean of x2:', sum(x2), '/', len(x2), '=', np.mean(x2)
"""
Explanation: Measur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.