repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
liam2/larray | doc/source/tutorial/tutorial_sessions.ipynb | gpl-3.0 | %xmode Minimal
from larray import *
"""
Explanation: Working With Sessions
Import the LArray library:
End of explanation
"""
# define some scalars, axes and arrays
variant = 'baseline'
country = Axis('country=Belgium,France,Germany')
gender = Axis('gender=Male,Female')
time = Axis('time=2013..2017')
population = ... |
iAInNet/tensorflow_in_action | _benchmark_vggnet.ipynb | gpl-3.0 | import tensorflow as tf
import numpy as np
import math
import time
from datetime import datetime
import os
tf.__version__
"""
Explanation: VGGNet 是牛津计算机视觉组和Google DeepMind公司的研究员一起研发的深度卷积神经网络。VGGNet探索了卷积神经网络的深度与其性能之间的关系。通过反复堆叠3x3的小型卷积核和2x2的最大池化层,VGGNet成功地构建了16~19层深的卷积神经网络。VGGNet的扩展性很强,迁移到其他图片数据上的泛化性能非常好。结构简洁有效,VGGNet到... |
maxentile/msm-learn | notebooks/Tinkering- milestones.ipynb | mit | from msmbuilder.example_datasets import AlanineDipeptide
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
trajs = AlanineDipeptide().get().trajectories
from msmbuilder.featurizer import DihedralFeaturizer,AtomPairsFeaturizer
n_atoms=trajs[0].n_atoms
pairs = []
for i in range(n_atoms):
for j i... |
markroxor/gensim | docs/notebooks/Word2Vec_FastText_Comparison.ipynb | lgpl-2.1 | import nltk
nltk.download('brown')
# Only the brown corpus is needed in case you don't have it.
# Generate brown corpus text file
with open('brown_corp.txt', 'w+') as f:
for word in nltk.corpus.brown.words():
f.write('{word} '.format(word=word))
# Make sure you set FT_HOME to your fastText directory root... |
batfish/pybatfish | docs/source/notebooks/topology.ipynb | apache-2.0 | bf.set_network('generate_questions')
bf.set_snapshot('aristaevpn')
"""
Explanation: Topology
This caterogy of questions is intended to retrieve the network topology
used by Batfish. This topology is a combination of information in the
snapshot and inference logic (e.g., which interfaces are layer3 neighbors).
Current... |
cgpotts/cs224u | sst_01_overview.ipynb | apache-2.0 | __author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2022"
"""
Explanation: Supervised sentiment: overview of the Stanford Sentiment Treebank
End of explanation
"""
from nltk.tokenize.treebank import TreebankWordDetokenizer
from nltk.tokenize.treebank import TreebankWordTokenizer
import os
import... |
ResidentMario/geoplot | docs/quickstart/quickstart.ipynb | mit | # Configure matplotlib.
%matplotlib inline
# Unclutter the display.
import pandas as pd; pd.set_option('max_columns', 6)
"""
Explanation: Quickstart
geoplot is a geospatial data visualization library designed for data scientists and geospatial analysts that just want to get things done. In this tutorial we will learn... |
samgoodgame/sf_crime | iterations/misc/sf_crime_submission_part_2_updatedWeatherFeatures.ipynb | mit | # Import relevant libraries:
import time
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
from sklearn.naive_bayes import BernoulliNB
from sklearn.na... |
simonres/astropi | altitude.ipynb | gpl-2.0 | def htop(h,units='milibar'):
'''h in m
returns p in Pa'''
k=1
if units=='Pa':
k=1
if units=='mmhg':
k=7.50061683/1000.
if units=='milibar':
k=1./100.
return 101325*k* (1. - 2.25577E-5* h)**5.25588
def ptoh(p,units='milibar'):
'''p in m
returns height in m a... |
maniacalbrain/apscheduler-pymongo-basics | PyMongo Basics.ipynb | mit | from pymongo import MongoClient
client = MongoClient() #connects to the running mongod instance
users = client.test_database.user #creates database "test_database" and collection "user" if they do not already exist
users.remove({}) #Making sure that the collection is empty before I start
"""
Explanation: PyMongo Bas... |
jinntrance/MOOC | coursera/deep-neural-network/quiz and assignments/week 7/Tensorflow+Tutorial.ipynb | cc0-1.0 | import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict
%matplotlib inline
np.random.seed(1)
"""
Explanation: TensorFlow Tutorial
Welcome to this w... |
CyberCRI/dataanalysis-herocoli-redmetrics | v1.52/Tests/3.1 Per session and per user analysis tests.ipynb | cc0-1.0 | %run "../Functions/3. Per session and per user analysis.ipynb"
rmdf152.head()
"""
Explanation: Per session and per user analysis
Analysis of users.
Table of Contents
Preparation
Function tests
User metrics checks
Preparation
<a id=preparation />
End of explanation
"""
testSessionId = "fab3ea03-6ff1-483f-a... |
lknelson/text-analysis-2017 | 04-Dictionaries/01-ChiSquared.ipynb | bsd-3-clause | import pandas
from sklearn.feature_extraction.text import CountVectorizer
text_list = []
#open and read the novels, save them as variables
austen_string = open('../Data/Austen_PrideAndPrejudice.txt', encoding='utf-8').read()
alcott_string = open('../Data/Alcott_GarlandForGirls.txt', encoding='utf-8').read()
#append e... |
dhgarrette/cnn | pyexamples/tutorials/tutorial-1-xor.ipynb | apache-2.0 | # create a model and add the parameters.
m = Model()
m.add_parameters("W", (8,2))
m.add_parameters("V", (1,8))
m.add_parameters("b", (8))
renew_cg() # new computation graph. not strictly needed here, but good practice.
# associate the parameters with cg Expressions
W = parameter(m["W"])
V = parameter(m["V"])
b = para... |
qutip/qutip-notebooks | examples/control-pulseoptim-QFT.ipynb | lgpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import datetime
from qutip import Qobj, identity, sigmax, sigmay, sigmaz, tensor
from qutip.qip.algorithms import qft
import qutip.logging_utils as logging
logger = logging.get_logger()
#Set this to None or logging.WARN for 'quiet' execution
log_lev... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, En... |
jmschrei/pomegranate | examples/naivebayes_hmm_cheating_coin_toss.ipynb | mit | from pomegranate import *
import numpy as np
%pylab inline
"""
Explanation: Naive Bayes Hidden Markov Coin Toss
author: Nicholas Farn [<a href="sendto:nicholasfarn@gmail.com">nicholasfarn@gmail.com</a>]
In this example we will be using a simple Hidden Markov Model to demonstrate how it can be used in a Naive Bayes cla... |
Actla/Creative-Agent | 1995 RDIA.ipynb | bsd-3-clause | #==================================================================
#
# Author: Luca Celotti,
# Supervisor: Jean Rouat,
# PhD student at Universitè de Sherbrooke (Canada)
# Electrical Engineering Department
# funded by CHIST-ERA/FRQNT Québec for IGLU
#
# work finished the 22⋅02⋅2017 in the context of a course on
# R... |
azhurb/deep-learning | transfer-learning/Transfer_Learning_Solution.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
yunqu/PYNQ | boards/Pynq-Z1/base/notebooks/pmod/pmod_dac_adc.ipynb | bsd-3-clause | from pynq.overlays.base import BaseOverlay
from pynq.lib import Pmod_ADC, Pmod_DAC
"""
Explanation: DAC-ADC Pmod Examples using Matplotlib and Widget
Contents
Pmod DAC-ADC Feedback
Tracking the IO Error
Error plot with Matplotlib
Widget controlled plot
Pmod DAC-ADC Feedback
This example shows how to use the PmodDA4 ... |
emjotde/UMZ | Wyklady/10/Sieci neuronowe.ipynb | cc0-1.0 | from IPython.display import YouTubeVideo
YouTubeVideo('cNxadbrN_aI', width=800, height=600)
"""
Explanation: Sieci neuronowe
Metody uczenia
Trochę historii: Perceptron liniowy
Mark 1 perceptron (Frank Rosenblatt, 1957):
* Aparat przeznaczony do rozpoznawania obrazu;
* 400 fotokomórek
* Wagi to potencjometry;
* Wagi a... |
biosustain/marsi | notebooks/2.1 Find metabolites in the database.ipynb | apache-2.0 | Metabolite.get('PMMURAAUARKVCB-CERMHHMHSA-N')
Metabolite.get('SNDPXSYFESPGGJ-SCSAIBSYSA-N')
"""
Explanation: Metabolites are indexed using InChI key.
For example:
1. 2-Deoxy-Glucose: PMMURAAUARKVCB-CERMHHMHSA-N-D
2. Norvaline: SNDPXSYFESPGGJ-SCSAIBSYSA-N
End of explanation
"""
ref = Reference.get(accession="ZINC003... |
fducau/infoVAE | vae1.ipynb | gpl-3.0 | import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(0)
tf.set_random_seed(0)
# Load MNIST data in a format suited for tensorflow.
# The script input_data is available under this URL:
# https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/g... |
Nikea/scikit-xray-examples | demos/time_correlation/partial-multi-tau.ipynb | bsd-3-clause | from skbeam.core.correlation import lazy_one_time
import numpy as np
import time as ttime
import matplotlib.pyplot as plt
%matplotlib notebook
"""
Explanation: Live-updating multi-tau one-time correlation with synthetic and real data
End of explanation
"""
num_levels = 5
num_bufs = 4 # must be even
xdim = 512
ydim ... |
GoogleCloudPlatform/ml-on-gcp | tutorials/tensorflow/bert/BERT_TRT.ipynb | apache-2.0 | paragraph_text = "The Apollo program, also known as Project Apollo, was the third United States human spaceflight program carried out by the National Aeronautics and Space
Administration (NASA), which accomplished landing the first humans on the Moon from 1969 to 1972. First conceived during Dwight D. Eisenhower's adm... |
HazyResearch/snorkel | tutorials/crowdsourcing/Crowdsourced_Sentiment_Analysis.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
import numpy as np
from snorkel import SnorkelSession
session = SnorkelSession()
"""
Explanation: Training a Sentiment Analysis LSTM Using Noisy Crowd Labels
In this tutorial, we'll provide a simple walkthrough of how to use Snorkel to resolve conflicts i... |
mauroalberti/gsf | docs/notebooks/Rasters - geotransform.ipynb | gpl-3.0 | from pygsf.geometries.grids.geotransform import *
gt1 = GeoTransform(1500, 3000, 10, 10)
gt1
"""
Explanation: Geotransforms
May-June, 2018, Mauro Alberti
Last version: 2021-04-24
Last running version: 2021-04-24
1. Examples
End of explanation
"""
ijPixToxyGeogr(gt1, 0, 0)
xyGeogrToijPix(gt1, 1500, 3000)
ijPixTox... |
WoodResourcesGroup/RoundwoodHarvestGHG | biomass_burning.ipynb | mit | sqdb = ut.sqlitedb('fcat_biomass')
"""
Explanation: Some usefull functions and housekeeping
Initalize a sqlite database
End of explanation
"""
def distFromRange(total, maxr = 32, minr = 2):
av = (maxr + minr)/2
stdev = (float(maxr) - float(minr))/4
d_frac = (total-np.floor(total))*np.random.normal(av, s... |
neuro-data-science/neuro_data_science | python/modeling/modeling_data.ipynb | gpl-3.0 | # Load data and pull out important values
data = si.loadmat('../../data/StevensonV2.mat')
# Only keep x, y dimensions, transpose to (trials, dims)
hand_vel = data['handVel'][:2].T
hand_pos = data['handPos'][:2].T
# (neurons, trials)
spikes = data['spikes']
# Remove all times where speeds are very slow
threshold = .01... |
nicoa/showcase | plotting/pokemon_exploration.ipynb | mit | data.head()
"""
Explanation: What is this?
We have a Dataset of Pokemons. They have various values which indicate there strongness, total is simply the sum of these values.
Got this set from https://www.kaggle.com/abcsds/pokemon
Got the swarmplot idea from https://www.kaggle.com/ndrewgele/visualizing-pok-mon-stats-wit... |
tensorflow/docs-l10n | site/ja/federated/tutorials/custom_federated_algorithms_1.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... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/robust_models_1.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lmap
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import statsmodels.api as sm
"""
Explanation: M-Estimators for Robust Linear Modeling
End of explanation
"""
norms = sm.robust.norms
def plot_weights(support, weights_func, xlabels, xt... |
mdda/deep-learning-workshop | notebooks/work-in-progress/2018-09_PianoTranscription/Onsets_and_Frames_mdda.ipynb | mit | #@title Setup Environment
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
print('Copying checkpoint from GCS...')
!rm -r /content/onsets-frames
!mkdir /content/onsets-frames
!gsutil -q -m cp -R gs://magentadata/models/onsets_frames_transcriptio... |
fifabsas/talleresfifabsas | python/Extras/Fisica2/Notebook para F2.ipynb | mit | x = 5
y = 'Hola mundo!'
z = [1,2,3]
"""
Explanation: Programar ¿con qué se come?
La computadora es una gran gran calculadora que permite hacer cualquier tipo de cuenta de las que necesitemos dentro de la Física (y de la vida también) mientras sepamos cómo decirle a la máquina qué cómputos hacer.
La computadora para ha... |
semsturgut/Robotic_ARM | SCS_Documents/ikpy-master/tutorials/ikpy/Inverse Kinematics with ErgoJr.ipynb | gpl-3.0 | import matplotlib.pyplot
%matplotlib notebook
"""
Explanation: Inverse kinematics with the Ergo Junior
In this notebook, we will discover the Inverse Kinematics functionnalities of Pypot + IKPy with an Ergo Jr.
You can see this notebook as the starting point to discover Inverse Kinematics, used with a real (or simulat... |
idekerlab/sdcsb-advanced-tutorial | tutorials/Lesson_0_IPython_Notebook_Basics.ipynb | mit | print('Hello IPython World!')
result1 = 1+1
result2 = 2*3
result2
result1
print('2nd = ' + str(result2))
print('1st = ' + str(result1))
"""
Explanation: SDCSB Tutorial Session
Advanced Cytoscape: Cytoscape, IPython, Docker, and reproducible network data visualization workflows
Friday, 4/17/2015
Lesson 0: Introduct... |
sueiras/training | tensorflow/02-text/03-word_tagging/00_identify_tags_in_airline_database_embedings - SOLVED.ipynb | gpl-3.0 | from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
print(tf.__version__)
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="1"
#Show images
import matplotlib.pyplot as plt
%matplotlib inline
# plt configuration
plt.rcParams['figure.figsize'] =... |
jjehl/community-notebooks | tutorials-education/poppy-humanoid_poppy-torso__vrep_installation et prise en main/poppy simulé/premier pas avec poppy en python - 10 choses à savoir.ipynb | lgpl-3.0 | from poppy.creatures import PoppyHumanoid
creature = PoppyHumanoid(simulator='vrep')
"""
Explanation: <img src="png/poppy.png" HEIGHT=200 WIDTH=200 ALIGN=right>
<img src="png/inria.jpg" HEIGHT=150 WIDTH=325 ALIGN=left >
1 - Ouvrir l'interface
Ouvrir V-REP ou connecter le robot.
Ouvrir Jupyter - ipython vidéo démonstr... |
keras-team/keras-io | examples/audio/ipynb/ctc_asr.ipynb | apache-2.0 | import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import matplotlib.pyplot as plt
from IPython import display
from jiwer import wer
"""
Explanation: Automatic Speech Recognition using CTC
Authors: Mohamed Reda Bouadjenek and Ngoc Dung Huynh... |
Diyago/Machine-Learning-scripts | time series regression/ARIMA/Salary prediction.ipynb | apache-2.0 | import pandas as pd
from scipy import stats
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn
import warnings
from itertools import product
import numpy as np
def invboxcox(y,lmbda):
if lmbda == 0:
return(np.exp(y))
else:
return(np.exp(np.log(lmbda*y+1)/lmbda))
%matplotlib ... |
quole/gensim | docs/notebooks/Word2Vec_FastText_Comparison.ipynb | lgpl-2.1 | import nltk
nltk.download('brown')
# Only the brown corpus is needed in case you don't have it.
# Generate brown corpus text file
with open('brown_corp.txt', 'w+') as f:
for word in nltk.corpus.brown.words():
f.write('{word} '.format(word=word))
# Make sure you set FT_HOME to your fastText directory root... |
deepchem/deepchem | examples/tutorials/Protein_Deep_Learning.ipynb | mit | !curl -Lo conda_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py
import conda_installer
conda_installer.install()
!/root/miniconda/bin/conda info -e
!pip install --pre deepchem
!pip install propy3
"""
Explanation: Protein Deep Learning
by David Ricardo Figueroa Blanco
... |
ledeprogram/algorithms | class9/homework/benzaquen_mercy_9_2.ipynb | gpl-3.0 | import pandas as pd
%matplotlib inline
from sklearn import datasets
from sklearn import tree
from sklearn import metrics
import numpy as np
from sklearn import cross_validation
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import train_test_split
iris = datasets.load_iris()
iris
x... |
edinburghlivinglab/livinglab-hubserver | Extra Resources.ipynb | bsd-3-clause | %%bash
curl http://nbviewer.ipython.org/urls/bitbucket.org/amjoconn/watpy-learning-to-code-with-python/raw/3441274a54c7ff6ff3e37285aafcbbd8cb4774f0/notebook/Learn%20to%20Code%20with%20Python.ipynb > Learn-to-Code-with-Python.ipynb
"""
Explanation: The aim of this notebook is to provide an introduction to the many othe... |
JackDi/phys202-2015-work | assignments/assignment06/InteractEx05.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.html import widgets
from IPython.display import SVG
"""
Explanation: Interact Exercise 5
Imports
Put the standard imports for Matplotlib, Numpy and the IPython widgets in the... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/statespace_varmax.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/')
dta.index = dta.qtr
dta.index.freq = dta.index.inferred_freq
endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dl... |
KshitijT/fundamentals_of_interferometry | 4_Visibility_Space/4_5_2_uv_coverage_improving_your_coverage.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: <a id='beginning'></a> <!--\label{beginning}-->
* Outline
* Glossary
* 4. The Visibility space
* Previous: 4.5.1 UV Coverage: UV tracks
* Next:... |
mlandry1/CarND | CarND-LaneLines-P1/.ipynb_checkpoints/P1-checkpoint.ipynb | mit | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
"""
Explanation: Self-Driving Car Engineer Nanodegree
Project: Finding Lane Lines on the Road
In this project, you will use the tools you learned about in the lesson to ide... |
gcollura/playground | kaggle/titanic/titanic.ipynb | mit | # imports
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.types import *
from pyspark.sql import functions as F
from graphframes import *
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# make graphs beautiful
plt.style.use('ggplot')
pl... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/copula.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import stats
sns.set_style("darkgrid")
sns.mpl.rc("figure", figsize=(8, 8))
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
"""
Explanation: Copula - Multivariate joint distribution
En... |
python-control/python-control | examples/cruise.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from math import pi
import control as ct
"""
Explanation: Cruise control
Richard M. Murray and Karl J. Åström
17 Jun 2019
The cruise control system of a car is a common feedback system encountered in everyday life. The system attempts to maintain a constant velocity i... |
robertoalotufo/ia898 | deliver/Atividade_2_1.ipynb | mit | import numpy as np
import sys,os
ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
"""
Explanation: Criação de imagens sintéticas
Imagens sintéticas são bastante utilizadas nos testes de algoritmos e na geração de
padrões de... |
Pittsburgh-NEH-Institute/Institute-Materials-2017 | schedule/week_2/own-exercises/1_collate-plain-text-exercise.ipynb | gpl-3.0 | from collatex import *
"""
Explanation: Collating with CollateX
First we need to tell Python that we will be needing the Python library that holds the code for CollateX…
End of explanation
"""
collation = Collation()
collation
"""
Explanation: Now we're ready to make a collation object. We do this with the slightly... |
kwant-project/kwant-tutorial-2016 | 1.2.python-refresher.ipynb | bsd-2-clause | for i in range(7):
print(i**2)
"""
Explanation: Quick introduction to Python and Jupyter notebooks
Jupyter notebooks consist of a sequence of cells. Cells can contain code (for example Python), or text. A selected cell can be executed by pressing Shift-Enter.
Powers of numbers
The following cell prints the first... |
QuantCrimAtLeeds/PredictCode | examples/Chicago/Exploring the dataset.ipynb | artistic-2.0 | import open_cp.sources.chicago as chicago
import geopandas as gpd
import sys, os, csv, lzma
filename = os.path.join("..", "..", "open_cp", "sources", "chicago.csv")
filename_all = os.path.join("..", "..", "open_cp", "sources", "chicago_all.csv.xz")
filename_all1 = os.path.join("..", "..", "open_cp", "sources", "chicag... |
csc-training/python-introduction | notebooks/examples/9 - Object oriented programming.ipynb | mit | class Vector2D(object):
"""Represents a 2-dimensional vector"""
def __init__(self, x, y):
self.x = x
self.y = y
"""
Explanation: Objects and exceptions
Object-oriented programming is a widespread paradigm that helps programmers create intuitive layers of abstraction. This example notebook ... |
tata-antares/tagging_LHCb | Stefania_files/track-based-tagging-track-sign-usage.ipynb | apache-2.0 | import pandas
import numpy
from folding_group import FoldingGroupClassifier
from rep.data import LabeledDataStorage
from rep.report import ClassificationReport
from rep.report.metrics import RocAuc
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_curve, roc_auc_score
from utils impo... |
tjwei/HackNTU_Data_2017 | Week06/HW1-CIFAR10.ipynb | mit | import keras
from keras.models import Sequential
from PIL import Image
import numpy as np
import tarfile
# 下載 dataset
url = "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
import os
import urllib
from urllib.request import urlretrieve
def reporthook(a,b,c):
print("\rdownloading: %5.1f%%"%(a*b*100.0/c), ... |
SlipknotTN/udacity-deeplearning-nanodegree | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
adrianoglemos/end_of_day_two | DefensiveProgramming_3.ipynb | mit | def test_range_overlap():
assert range_overlap([(-3.0, 5.0), (0.0, 4.5), (-1.5, 2.0)]) == (0.0, 2.0)
assert range_overlap([ (2.0, 3.0), (2.0, 4.0) ]) == (2.0, 3.0)
assert range_overlap([ (0.0, 1.0), (0.0, 2.0), (-1.0, 1.0) ]) == (0.0, 1.0)
"""
Explanation: # Defensive programming (2)
We have seen the ba... |
spencer2211/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
microsoft/dowhy | docs/source/example_notebooks/dowhy_lalonde_example.ipynb | mit | import os, sys
sys.path.append(os.path.abspath("../../../"))
import dowhy
from dowhy import CausalModel
from rpy2.robjects import r as R
%load_ext rpy2.ipython
#%R install.packages("Matching")
%R library(Matching)
"""
Explanation: DoWhy example on the Lalonde dataset
Thanks to @mizuy for providing this example. Her... |
landlab/landlab | notebooks/tutorials/agent_based_modeling/groundwater/landlab_mesa_groundwater_pumping.ipynb | mit | from landlab import RasterModelGrid, imshow_grid
from landlab.components import GroundwaterDupuitPercolator
import matplotlib.pyplot as plt
"""
Explanation: Coupling a Landlab groundwater with a Mesa agent-based model
This notebook shows a toy example of how one might couple a simple groundwater model (Landlab's Groun... |
NifTK/NiftyNet | demos/module_examples/ImageSampler.ipynb | apache-2.0 | import sys
niftynet_path = '/Users/foo/Documents/Niftynet/'
sys.path.insert(0, niftynet_path)
from niftynet.utilities.download import download
download('mr_ct_regression_model_zoo_data')
!{sys.executable} -m pip install matplotlib
"""
Explanation: This demo presents the usage of NiftyNet's image sampler implemented ... |
karlnapf/shogun | doc/ipython-notebooks/gaussian_process/gaussian_processes.ipynb | bsd-3-clause | %matplotlib inline
# import all shogun classes
from shogun import *
import shogun as sg
import random
import numpy as np
import matplotlib.pyplot as plt
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from math import exp
"""
Explanation: Gaussian Processes in Shogun
By Heiko Strathmann - <a hr... |
seanpue/dtsa2016 | presentation.ipynb | mit | from IPython.display import IFrame
"""
Explanation: Textual Encoding of Hindi-Urdu Poetry for Data-Rich Literary Analysis
@ Digital Textualities of South Asia: A Research Symposium
Department of Asian Studies, University of British Columbia
4 March 2016
A. Sean Pue, Michigan State University
pue@msu.edu
@seanpue
http:... |
california-civic-data-coalition/python-calaccess-notebooks | calaccess-exploration/independent-expenditures.ipynb | mit | import os
import requests
from datetime import datetime
from clint.textui import progress
import pandas
pandas.set_option('display.float_format', lambda x: '%.2f' % x)
pandas.set_option('display.max_columns', None)
import matplotlib.pyplot as plt
import matplotlib.dates as dates
%matplotlib inline
def download_csv_t... |
agiovann/Constrained_NMF | demos/notebooks/demo_caiman_cnmf_3D.ipynb | gpl-2.0 | try:
get_ipython().magic(u'load_ext autoreload')
get_ipython().magic(u'autoreload 2')
print(1)
except:
print('NOT IPYTHON')
from ipyparallel import Client
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
import psutil
from scipy.ndimage.filters import gaussian_filter
import s... |
Leguark/pynoddy | docs/notebooks/Feature-Sampling.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
import sys, os
import matplotlib.pyplot as plt
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of repository to set paths corretly below
rep... |
jhillairet/scikit-rf | doc/source/examples/networksets/Interpolating Network Sets.ipynb | bsd-3-clause | import skrf as rf
import matplotlib.pyplot as plt
import numpy as np
rf.stylely()
"""
Explanation: Interpolating Network Sets
Frequently a set of Networks is recorded while changing some other parameters; like temperature, voltage, current, etc. Once this set of data acquired, it is sometime usefull to estimate the b... |
nproctor/phys202-2015-work | assignments/assignment04/TheoryAndPracticeEx02.ipynb | mit | from IPython.display import Image
"""
Explanation: Theory and Practice of Visualization Exercise 2
Imports
End of explanation
"""
# Add your filename and uncomment the following line:
Image(filename='graph2.JPG')
"""
Explanation: Violations of graphical excellence and integrity
Find a data-focused visualization on ... |
alkaline-ml/pmdarima | examples/stock_market_example.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import pmdarima as pm
print(f"Using pmdarima {pm.__version__}")
"""
Explanation: Stockmarket analysis with pmdarima
This example follows the post on Towards Data Science (TDS), demonstrating the use of pmdarima to simplify tim... |
JaviMerino/lisa | ipynb/android/Android_Workloads.ipynb | apache-2.0 | import logging
reload(logging)
log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'
logging.basicConfig(format=log_fmt)
# Change to info once the notebook runs ok
logging.getLogger().setLevel(logging.INFO)
%pylab inline
import collections
import copy
import json
import os
import pexpect as pe
from time import slee... |
uber/pyro | tutorial/source/gp.ipynb | apache-2.0 | import os
import matplotlib.pyplot as plt
import torch
import pyro
import pyro.contrib.gp as gp
import pyro.distributions as dist
smoke_test = ('CI' in os.environ) # ignore; used to check code integrity in the Pyro repo
assert pyro.__version__.startswith('1.7.0')
pyro.set_rng_seed(0)
"""
Explanation: Gaussian Proce... |
RoebideBruijn/datascience-intensive-course | project/notebooks/lending-club-prediction.ipynb | mit | loans = pd.read_csv('../data/loan.csv')
closed_loans = loans[loans['loan_status'].isin(['Fully Paid', 'Charged Off'])]
print(closed_loans.shape)
round(sum(closed_loans['loan_status']=='Charged Off')/len(closed_loans['loan_status'])*100)
"""
Explanation: Prediction
For investors it's interesting to know which character... |
seg/2016-ml-contest | geoLEARN/Submission_increased_variance.ipynb | apache-2.0 | %matplotlib inline
# to install watermark magic command: pip install ipyext
%load_ext watermark
%watermark -v -p numpy,scipy,pandas,matplotlib,seaborn,sklearn
"""
Explanation: Facies classification using Random Forest
Contest entry by :geoLEARN
Martin Blouin, Lorenzo Perozzi, Antoine Caté <br>
in collaboration with ... |
tpin3694/tpin3694.github.io | machine-learning/lag_a_time_feature.ipynb | mit | # Load library
import pandas as pd
"""
Explanation: Title: Lag A Time Feature
Slug: lag_a_time_feature
Summary: How to lag a dates and times feature for machine learning in Python.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Dates And Times
Authors: Chris Albon
Preliminaries
End of expla... |
eds-uga/csci1360-fa16 | lectures/L3.ipynb | mit | x = 2
"""
Explanation: Lecture 3: Python Variables and Syntax
CSCI 1360: Foundations for Informatics and Analytics
Overview and Objectives
In this lecture, we'll get into more detail on Python variables, as well as language syntax. By the end, you should be able to:
Define variables of string and numerical types, con... |
Cyb3rWard0g/ThreatHunter-Playbook | docs/notebooks/windows/07_discovery/WIN-190725024610.ipynb | gpl-3.0 | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: SAM Registry Hive Handle Request
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/07/25 |
| modification date | 2020/09/20 |
| playbook related | ['... |
evanmiltenburg/python-for-text-analysis | Assignments/ASSIGNMENT-3b.ipynb | apache-2.0 | # Downloading data - you get this for free :-)
import requests
import os
def download_book(url):
"""
Download book given a url to a book in .txt format and return it as a string.
"""
text_request = requests.get(url)
text = text_request.text
return text
book_urls = dict()
book_urls['HuckFin... |
nudomarinero/mltier1 | PanSTARRS_WISE_reddening.ipynb | gpl-3.0 | import numpy as np
from astropy.table import Table
from astropy import units as u
from astropy.coordinates import SkyCoord
from mltier1 import Field
from extinction import FILTER_EXT, get_eb_v
%load_ext autoreload
%autoreload
%pylab inline
field = Field(170.0, 190.0, 45.5, 56.5)
field_full = Field(160.0, 232.0, 42... |
TareasJF/INF393 | T3/Pregunta3.ipynb | mit | import pandas as pd
df_red = pd.read_csv("data/winequality-red.csv",sep=";")
df_white = pd.read_csv("data/winequality-white.csv",sep=";")
# Add the type column
df_red['type'] = 1
df_white['type'] = 0
df = pd.concat([df_red,df_white], axis=0)
df.describe()
"""
Explanation: 3.- Calidad de un vino
El objetivo correspond... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160627월_21일차_PCA Principal Component Analysis/1.벡터 공간.ipynb | mit | a = [1, 2]
plt.annotate('', xy=a, xytext=(0,0), arrowprops=dict(facecolor='black'))
plt.plot(0, 0, 'ro', ms=10)
plt.plot(a[0], a[1], 'ro', ms=10)
plt.text(0.35, 1.15, "$a$", fontdict={"size": 18})
plt.xticks(np.arange(-2, 4))
plt.yticks(np.arange(-1, 4))
plt.xlim(-2.4, 3.4)
plt.ylim(-1.2, 3.2)
plt.show()
"""
Expla... |
gsvijayraajaa/workshop | 8.SVM_Kernel.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (6, 6)
from ipywidgets import interact
"""
Explanation: SVM - Kernel Transforms
One of the condition in the Linear SVM is that the points should be linearly separable. Ho... |
rsterbentz/phys202-2015-work | assignments/assignment03/NumpyEx03.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 3
Imports
End of explanation
"""
def brownian(maxt, n):
"""Return one realization of a Brownian (Wiener) process with n steps... |
subutai/htmresearch | projects/l2_pooling/notebooks/SetMemory_similar_objects.ipynb | agpl-3.0 | import itertools
import random
from collections import deque
from copy import deepcopy
import numpy
from nupic.bindings.math import SparseBinaryMatrix, GetNTAReal
"""
Explanation: First, some code. Scroll down.
End of explanation
"""
def makeSparseBinaryMatrix(numRows, numCols):
"""
Construct a SparseBinar... |
ceos-seo/Data_Cube_v2 | agdc-v2/contrib/notebooks/Catapult Project - Navigating AGDC v2.ipynb | apache-2.0 | import datacube.api
from pprint import pprint
"""
Explanation: Australian Geoscience Datacube API
This notebook describes connecting to the datacube and doing a basic query
End of explanation
"""
dc = datacube.api.API()
"""
Explanation: By default, the API will use the configured database connection found in the co... |
Ttl/scikit-rf | doc/source/examples/metrology/Calibration With Three Receivers.ipynb | bsd-3-clause | from IPython.display import *
SVG('three_receiver_cal/pics/vnaBlockDiagramForwardRotated.svg')
"""
Explanation: Calibration With Three Receivers
Intro
It has long been known that full error correction is possible given a VNA with only three recievers and no internal coaxial switch. However, since no modern VNA empl... |
crocha700/pyspec | examples/example_1d_spec.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import scipy.signal as signal
import seawater as sw
from pyspec import spectrum as spec
"""
Explanation: pyspec example notebook: 1D spectrum
This notebook showcases a basic usage of pyspec for computing 2D spectrum and its associated isotropic ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/feateng/labs/ASL_2.0_bqml_feateng-REVIEW.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 = "cloud-training-demos" # REPLACE WITH YOUR PROJECT NAME
REGION = "us-west1-b" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# Do not change these
os.environ["P... |
park-python/course | lectures/06_Internet/notebook.ipynb | bsd-3-clause | import socket
"""
Explanation: Интернет, сетевые протоколы, клиент-серверные приложения
Requests for Comment (RFCs) публикуются организацией Internet Engineering Task Force (IETF).
End of explanation
"""
import socket
hostname = 'httpbin.org'
addr = socket.gethostbyname(hostname)
print(addr)
import socket
hostname ... |
zzsza/Datascience_School | 03. 파이썬 프로그래밍/05. 파이썬 객체지향 프로그래밍 기초 1.ipynb | mit | h = 10
v = 20
def area(h, v):
return h * v
a = area(h, v)
print(a)
"""
Explanation: 파이썬 객체지향 프로그래밍 기초 1
객체
프로그램이 어떤 작업을 수행하기 위해서는 (1)데이터와 (2)데이터를 조작하는 행위, 두 가지 요소가 필요하다. 일반적으로 데이터는 변수(variable)에 넣어서 사용하고 데이터를 조작하는 일은 함수(function)로 구성해서 쉽게 실행시킬 수 있도록 만들어 놓는다.
객체(object)는 서로 연관된 데이터와 그 데이터를 조작하기 위한 함수를 하나의 집합에 모아놓... |
sz2472/foundations-homework | .ipynb_checkpoints/homework7_billionaire_shengyingzhao-checkpoint.ipynb | mit | recent = df[df['year'] == 2014] #recent is a variable, a variable can be assigned to different things, here it was assigned to a data frame
recent.head()
recent.columns.values
"""
Explanation: What country are most billionaires from? For the top ones, how many billionaires per billion people?
End of explanation
"""
... |
antoniomezzacapo/qiskit-tutorial | community/terra/qis_adv/entangled_measurement.ipynb | apache-2.0 | #Imports useful packages
from itertools import product
import matplotlib.pyplot as plt
%matplotlib inline
# importing Qiskit
from qiskit import Aer, IBMQ
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit import execute, Result
from qiskit.backends.ibmq import least_busy
# useful addit... |
CLEpy/CLEpy-MotM | Kivy/Kivy.ipynb | mit | %%bash
cat hello.kv
%%bash
cat hello.py
%%bash
python hello.py > /dev/null 2>&1
"""
Explanation: Kivy
https://kivy.org
Native UI Framework
Open source
No commercial version
Hardware accelerated
Pythonic
Cross platform (macOS, iOS, Android, Linux, Windows)
Has automated tests
Of Note
Kivy is simple
Not for making ... |
MingChen0919/learning-apache-spark | notebooks/02-data-manipulation/2.7.1-column-expression.ipynb | mit | mtcars = spark.read.csv('../../data/mtcars.csv', inferSchema=True, header=True)
mtcars = mtcars.withColumnRenamed('_c0', 'model')
mtcars.show(5)
"""
Explanation: Column expression
A Spark column instance is NOT a column of values from the DataFrame: when you crate a column instance, it does not give you the actual val... |
johnyquest7/machine-learning-tutorial | Breast_cancer_predict_logist_python3.ipynb | mit | # Importing pandas to read CSV file
import pandas as pd
# Read breast cancer csv file to pandas data frame data
data = pd.read_csv('wisconsin_breast_cancer.csv')
# Display the first 5 rows of the csv file
data.head()
data.shape # It is always a good idea to understand your data
# There are 699 rows and 11 columns ... |
peterchow90/DLND_Projects | Project_2_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'
class DLProgress(tqdm):
last_block = 0
def hoo... |
rcrehuet/Python_for_Scientists_2017 | notebooks/4_0_Functions.ipynb | gpl-3.0 | def heaviside(x):
#finish
#check it
print(heaviside(-5.4), heaviside(7), heaviside(0))
"""
Explanation: Introductory exercices: Functions
Heaviside function
Write a function that returns the Heaviside function.
End of explanation
"""
def prod(x):
"""
sum(iterable) -> value
"""
#Finish
#Test it
... |
essicolo/ecologie-mathematique | 04_Visualisation/4_Visualisation.ipynb | mit | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
"""
Explanation: Visualisation
Lorsque j'aborde un document scientifique, la première chose que je fais après avoir lu le résumé est de regarder les graphiques. Un graphique bien conçu est dense en information, de sorte qu'il met en lumière une inf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.