repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
OSGeoLabBp/tutorials | english/data_processing/lessons/ml_clustering.ipynb | cc0-1.0 | # modules
import sklearn
from numpy import where
from sklearn.datasets import make_classification
from matplotlib import pyplot
"""
Explanation: <a href="https://colab.research.google.com/github/OSGeoLabBp/tutorials/blob/master/english/data_processing/lessons/ml_clustering.ipynb" target="_parent"><img src="https://co... |
CompPhysics/MachineLearning | doc/Programs/ANN/perceptron.ipynb | cc0-1.0 | # Do This: Load in the iris.csv file and plot the data based on the iris classifications
import csv
import matplotlib.pyplot as plt
import numpy as np
sepal_length = []
sepal_width = []
label = []
with open('iris.csv', 'r') as data:
datareader = csv.reader(data, delimiter=',', quotechar='|')
for i,row in enume... |
pacoqueen/ginn | extra/install/ipython2/ipython-5.10.0/examples/IPython Kernel/Background Jobs.ipynb | gpl-2.0 | from IPython.lib import backgroundjobs as bg
import sys
import time
def sleepfunc(interval=2, *a, **kw):
args = dict(interval=interval,
args=a,
kwargs=kw)
time.sleep(interval)
return args
def diefunc(interval=2, *a, **kw):
time.sleep(interval)
raise Exception("Dead... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/ml_ops/stage5/get_started_with_vertex_private_endpoints.ipynb | apache-2.0 | import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
USER_FLAG = ... |
sdpython/actuariat_python | _doc/notebooks/exercices/pyramide_bigarree.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
%matplotlib inline
"""
Explanation: Tracer une pyramide bigarrée
Ce notebook est la réponse à l'exercice proposé lors de l'article de blog qui consiste à afficher des boules de trois couleurs différentes de sorte qu'aucune boule n'est de voisine de la mê... |
wmfschneider/CHE30324 | Homework/HW6-soln.ipynb | gpl-3.0 | import numpy as np
N = 14.0067 # amu
O = 15.999 # amu
mu = N*O/(N+O) # amu
r = 1.15077 # bond length (angstrom)
h = 6.62607E-34 # J*s
hbar = 1.05457E-34 # J*s
NA = 6.02214E23 #molecules/mol
c = 299792458 # m/s
I = mu*r**2 #amu * anstrom^2
print('The moment of inertia is',round(I,2),'amu*angstrom^2.')
B = hbar*... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/TTest.ipynb | mit | import numpy as np
from scipy import stats
A = np.random.normal(25.0, 5.0, 10000)
B = np.random.normal(26.0, 5.0, 10000)
stats.ttest_ind(A, B)
"""
Explanation: T-Tests and P-Values
Let's say we're running an A/B test. We'll fabricate some data that randomly assigns order amounts from customers in sets A and B, with ... |
mommermi/Introduction-to-Python-for-Scientists | notebooks/python_basics_20160909.ipynb | mit | # this is a single line comment
"""
this is a
multi line
comment
"""
"""
Explanation: Python Basics (2016-09-09)
Content
Comments
Data Types
Simple Arithmetics
Strings
Comments
Comments provide important documentation for your code.
End of explanation
"""
a = 5.1
print 'a', type(a)
b = 3
print 'b', type(b)
"""
... |
jrbourbeau/cr-composition | notebooks/fraction-correct.ipynb | mit | %load_ext watermark
%watermark -a 'Author: James Bourbeau' -u -d -v -p numpy,matplotlib,scipy,pandas,sklearn,mlxtend
"""
Explanation: <a id='top'> </a>
End of explanation
"""
from __future__ import division, print_function
from collections import defaultdict
import itertools
import numpy as np
from scipy import inte... |
Ykharo/notebooks | Trabajando_con_R_Python/Trabajando_de_forma_conjunta_con_Python_y_con_R.ipynb | bsd-2-clause | # Importamos pandas y numpy para manejar los datos que pasaremos a R
import pandas as pd
import numpy as np
# Usamos rpy2 para interactuar con R
import rpy2.robjects as ro
# Activamos la conversión automática de tipos de rpy2
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
import matplotlib.pyplot as... |
dwhswenson/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_2b_run_fixed.ipynb | mit | from __future__ import print_function
import openpathsampling as paths
"""
Explanation: Running a fixed-length TPS simulation
This is file runs the main calculation for the fixed length TPS simulation. It requires the file ad_fixed_tps_traj.nc, which is written in the notebook AD_tps_1b_trajectory.ipynb.
In this file,... |
hunterherrin/phys202-2015-work | assignments/assignment04/MatplotlibExercises.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Visualization 1: Matplotlib Basics Exercises
End of explanation
"""
z=np.random.randn(2,10)
x=z[0,:]
x
y=z[1.:]
y
plt.scatter(x, y, s=60)
plt.xlabel('x')
plt.ylabel('y')
plt.title('y vs x')
plt.tight_layout()
plt.grid(True)
plt.y... |
MoonRaker/pvlib-python | docs/tutorials/notebooks/forecast.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
try:
import seaborn as sns
sns.set(rc={"figure.figsize": (12, 6)})
except ImportError:
print('We suggest you install seaborn using conda or pip and rerun this cell')
# built in python modules
from datetime import datetime, timedelta
import os
# python add... |
NervanaSystems/coach | tutorials/3. Implementing a Hierarchical RL Graph.ipynb | apache-2.0 | import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
sys.path.append(module_path + '/rl_coach')
from typing import Union
import numpy as np
from rl_coach.agents.ddpg_agent import DDPGAgent, DDPGAgentParameters, DDPGAlgorithmPara... |
paivaismael/datasets | GHCND.ipynb | mit | data2 = data[(data.TMIN>-9999)]
data3 = data2[(data2.DATE>=20150601) & (data2.DATE<=20150630) & (data2.PRCP>0)]
"""
Explanation: In order to select the stations, we can select the following data from the initial amount:
End of explanation
"""
stations = data2[(data2.STATION=='GHCND:USC00047326') | (data2.STATION=='G... |
BiG-CZ/notebook_data_demo | notebooks/2017-07-04-WOFpy_ulmo.ipynb | bsd-3-clause | %matplotlib inline
import pytz
import matplotlib.pyplot as plt
import pandas as pd
import ulmo
from ulmo.util import convert_datetime
"""
Explanation: Testing WOFpy LBR sample DB
Emilio Mayorga. Run on my conda environment uwapl_em_mc_1aui.
3/5,4/2017. Test Don's Amazon cloud deployment
End of explanation
"""
prin... |
rbiswas4/simlib | example/Demo_TilingClass.ipynb | mit | import opsimsummary as oss
from opsimsummary import Tiling, HealpixTiles
# import snsims
import healpy as hp
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
"""
Explanation: Note For this to work, you will need the lsst.sims stack to be inst... |
qutip/qutip-notebooks | examples/spin-chain.ipynb | lgpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from qutip import *
"""
Explanation: QuTiP example: Dynamics of a Spin Chain
J.R. Johansson and P.D. Nation
For more information about QuTiP see http://qutip.org
End of explanation
"""
def integrate(N, h, Jx, Jy, Jz, psi0, tlist, gamma, solver)... |
doc-E-brown/FacialLandmarkingReview | experiments/Sec3_FeatureExtraction/Viola-Jones.ipynb | gpl-3.0 | import numpy as np
from scipy.misc import imread
from matplotlib import rcParams
from skimage.transform import integral_image
import matplotlib.pyplot as plt
%matplotlib inline
rcParams['figure.figsize'] = (10, 10)
def integral_image(image):
"""Integral image / summed area table.
The integral image contains th... |
jegibbs/phys202-2015-work | days/day08/Display.ipynb | mit | class Ball(object):
pass
b = Ball()
b.__repr__()
print(b)
"""
Explanation: Display of Rich Output
In Python, objects can declare their textual representation using the __repr__ method.
End of explanation
"""
class Ball(object):
def __repr__(self):
return 'TEST'
b = Ball()
print(b)
"""
Explanatio... |
dataworkshop/xgboost | step4.ipynb | mit | import pandas as pd
import xgboost as xgb
import numpy as np
import seaborn as sns
from hyperopt import hp
from hyperopt import hp, fmin, tpe, STATUS_OK, Trials
%matplotlib inline
train = pd.read_csv('bike.csv')
train['datetime'] = pd.to_datetime( train['datetime'] )
train['day'] = train['datetime'].map(lambda x: x.... |
diging/networks | .ipynb_checkpoints/3. Flow control. if, elif, else, and friends-checkpoint.ipynb | gpl-3.0 | import random # Ignore me for now!
"""
Explanation: Programming for Network Research
Erick Peirson, PhD | erick.peirson@asu.edu | @captbarberousse
Last updated 20 January, 2016
0. Introduction.
1. First steps with Python.
2. Objects and types.
3. Flow control: if, elif, else, and friends.
4: Functions and function... |
asimshankar/tensorflow | tensorflow/contrib/eager/python/examples/generative_examples/text_generation.ipynb | apache-2.0 | !pip install unidecode
"""
Explanation: Copyright 2018 The TensorFlow Authors.
Licensed under the Apache License, Version 2.0 (the "License").
Text Generation using a RNN
<table class="tfo-notebook-buttons" align="left"><td>
<a target="_blank" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/... |
BinRoot/TensorFlow-Book | ch10_rnn/Concept02_rnn.ipynb | mit | import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
"""
Explanation: Ch 10: Concept 02
Recurrent Neural Network
Import the relevant libraries:
End of explanation
"""
class SeriesPredictor:
def __init__(self, input_dim, seq_size, hidden_dim=10):
# Hyperparameters
self.in... |
marc-moreaux/Deep-Learning-classes | notebooks/Logistic_regression_colum.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
x_1 = np.array([0,1,0,1,0])
x_2 = np.array([0,1,0,1,1])
def to_img(vec):
matrix = np.ones((5, 3))
matrix[:, 1] = 1-vec
return matrix
fig, axs = plt.subplots(1,2)
axs[0].imshow(to_img(x_1), cmap='gray')
axs[1].imshow(to_img(x_2), cmap='gray')
plt.show()
... |
Neurosim-lab/netpyne | netpyne/tutorials/netpyne-course-2021/import_cells.ipynb | mit | !pwd
"""
Explanation: Importing Cells in NetPyNE
(1) Clone repository and compile mod files
Determine your location in the directory structure
End of explanation
"""
%cd /content/
"""
Explanation: Move to (or stay in) the '/content' directory
End of explanation
"""
!pwd
"""
Explanation: Ensure you are in the cor... |
enbanuel/phys202-2015-work | days/day08/Display.ipynb | mit | class Ball(object):
pass
b = Ball()
b.__repr__()
print(b)
"""
Explanation: Display of Rich Output
In Python, objects can declare their textual representation using the __repr__ method.
End of explanation
"""
class Ball(object):
def __repr__(self):
return 'TEST'
b = Ball()
print(b)
"""
Explanatio... |
deepchem/deepchem | examples/tutorials/Training_a_Generative_Adversarial_Network_on_MNIST.ipynb | mit | !pip install --pre deepchem
import deepchem
deepchem.__version__
"""
Explanation: Training a Generative Adversarial Network on MNIST
In this tutorial, we will train a Generative Adversarial Network (GAN) on the MNIST dataset. This is a large collection of 28x28 pixel images of handwritten digits. We will try to trai... |
Islast/BrainNetworksInPython | tutorials/tutorial.ipynb | mit | import numpy as np
import networkx as nx
import scona as scn
import scona.datasets as datasets
"""
Explanation: scona
scona is a tool to perform network analysis over correlation networks of brain regions.
This tutorial will go through the basic functionality of scona, taking us from our inputs (a matrix of structura... |
CyberCRI/dataanalysis-herocoli-redmetrics | tests/merge.ipynb | cc0-1.0 | keyEN = ['red', 'yellow', 'green', 'blue', 'black']
keyFR1 = ['rouge', 'jaune', 'vert', 'bleu', 'noir']
keyFR2 = ['jaune', 'vert', 'bleu', 'noir', 'rouge']
keyDE = ['gelb', 'gruen', 'blau', 'schwartz', 'rot']
dataENFR = pd.DataFrame({'keyEN' : keyEN, 'keyFR' : keyFR1})
dataENFR
dataFRDE = pd.DataFrame({'keyFR' : keyF... |
bjshaw/phys202-2015-work | assignments/assignment03/ProjectEuler8.ipynb | mit | import numpy as np
d1000 = """
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
622298934233803081353362766142828... |
marburg-open-courseware/gmoc | docs/mpg-if_error_continue/examples/e-03-1_quicksort.ipynb | mit | n = 5
e = 1
for i in range(1, n+1):
e = e * i
#e
def fac(n):
if n <= 1:
return n
return(n * fac(n-1))
d = fac(5)
print(d)
"""
Explanation: Sorting
<hr>
The following examples show two implementations of a quicksort algorithm, one using the Lomot, one using the Horade partitioning approach, a... |
Hvass-Labs/TensorFlow-Tutorials | 05_Ensemble_Learning.ipynb | mit | from IPython.display import Image
Image('images/02_network_flowchart.png')
"""
Explanation: TensorFlow Tutorial #05
Ensemble Learning
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
WARNING!
This tutorial does not work with TensorFlow v. 1.9 due to the PrettyTensor builder API apparently no longer being upd... |
abulbasar/machine-learning | Scikit - 06 Text Processing.ipynb | apache-2.0 | import pandas as pd # Used for dataframe functions
import json # parse json string
import nltk # Natural language toolkit for TDIDF etc.
from bs4 import BeautifulSoup # Parse html string .. to extract text
import re # Regex parser
import numpy as np # Linear algebbra
from sklearn import * # machine learning
import ma... |
bourneli/deep-learning-notes | DAT236x Deep Learning Explained/Lab1_MNIST_DataLoader.ipynb | mit | # Import the relevant modules to be used later
from __future__ import print_function
import gzip
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import os
import shutil
import struct
import sys
try:
from urllib.request import urlretrieve
except ImportError:
from urllib im... |
rcurrie/tumornormal | shapely.ipynb | apache-2.0 | import os
import json
import numpy as np
import pandas as pd
import keras
import matplotlib.pyplot as plt
# fix random seed for reproducibility
np.random.seed(42)
"""
Explanation: Train a binary tumor/normal classifier and explain via Shapely values
Train a neural network on TCGA+TARGET+GTEX gene expression to classi... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/markov_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# NBER recessions
from pandas_datareader.data import DataReader
from datetime import datetime
usrec = DataReader('USREC', 'fred', start=datetime(1947, 1, 1), end=datetime(2013, 4, 1))
"""
Explanatio... |
mne-tools/mne-tools.github.io | 0.21/_downloads/f781cba191074d5f4243e5933c1e870d/plot_find_ref_artifacts.ipynb | bsd-3-clause | # Authors: Jeff Hanna <jeff.hanna@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.datasets import refmeg_noise
from mne.preprocessing import ICA
import numpy as np
print(__doc__)
data_path = refmeg_noise.data_path()
"""
Explanation: Find MEG reference channel artifacts
Use ICA decompos... |
HrantDavtyan/Data_Scraping | Week 3/W3_RegEx_1.ipynb | apache-2.0 | import re
with open("financier.txt","r") as f:
financier = f.readlines()
print financier[2:4]
type(financier)
"""
Explanation: Regular Expressions
A regular expression (RegEx) is a sequence of chatacters that expresses a pattern to be searched withing a longer piece of text. re is a Python library for regular e... |
Zhenxingzhang/AnalyticsVidhya | Articles/Getting_Started_with_BigMart_Sales(AV_Datahacks)/model_building.ipynb | apache-2.0 | import pandas as pd
import numpy as np
%matplotlib inline
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 12, 8
train = pd.read_csv("train_modified.csv")
test = pd.read_csv("test_modified.csv")
print train.shape
train.dtypes
"""
Explanation: Load libraries and data:
The data will be the one export... |
mozilla-services/data-pipeline | reports/update-orphaning/Update orphaning analysis using longitudinal dataset.ipynb | mpl-2.0 | import datetime as dt
import urllib2
import ujson as json
from os import environ
%pylab inline
"""
Explanation: Update orphaning
End of explanation
"""
starttime = dt.datetime.now()
starttime
"""
Explanation: Get the time when this job was started (for debugging purposes).
End of explanation
"""
channel_to_proce... |
aitatanit/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter7_BayesianMachineLearning/DontOverfit.ipynb | mit | import gzip
import requests
import zipfile
url = "https://dl.dropbox.com/s/lnly9gw8pb1xhir/overfitting.zip"
results = requests.get(url)
import StringIO
z = zipfile.ZipFile(StringIO.StringIO(results.content))
# z.extractall()
z.extractall()
z.namelist()
d = z.open('overfitting.csv')
d.readline()
import numpy as ... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/matplotlib/04.10-Customizing-Ticks.ipynb | mit | import matplotlib.pyplot as plt
plt.style.use('classic')
%matplotlib inline
import numpy as np
ax = plt.axes(xscale='log', yscale='log')
ax.grid();
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
This notebook contains an excerpt from the Pyth... |
adriantorrie/adriantorrie.github.io | downloads/notebooks/eoddata/eoddata_web_service_calls_exchange_list.ipynb | mit | %run ../../code/version_check.py
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Summary" data-toc-modified-id="Summary-1"><span class="toc-item-num">1 </span>Summary</a></div><div class="lev1 toc-item"><a href="#Version-Control" data-toc-modified-id="Version-Control-2"><span clas... |
tensorflow/docs-l10n | site/ja/hub/tutorials/bangla_article_classifier.ipynb | apache-2.0 | # Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/mediation_survival.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.stats.mediation import Mediation
"""
Explanation: Mediation analysis with duration data
This notebook demonstrates mediation analysis when the
mediator and outcome are duration variables, modeled
using proportional hazards regression.... |
Hironsan/awesome-embedding-models | notebooks/skip-gram_with_ng.ipynb | mit | # Hyper Parameter Settings
embedding_size = 200
epochs_to_train = 10
num_neg_samples = 5
sampling_factor = 1e-5
window_size = 5
save_path = './word_vectors.txt'
"""
Explanation: Setting Hyperparameters
You set hyperparameters for Skip-gram with negative sampling.
By default, it is set as follows.
End of explanation
""... |
alirsamar/MLND | titanic_survival_exploration/Titanic_Survival_Exploration.ipynb | mit | 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 the RMS Titanic data... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-ll/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-ll', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-LL
Topic: Ocean
Sub-Topics: Timestepping Framewor... |
akokai/chemviewing | notebooks/use-snur-data.ipynb | unlicense | uri = URIBASE + 'uses'
r = requests.get(uri, headers = {'Accept': 'application/json, */*'})
j = json.loads(r.text)
print(len(j))
DataFrame(j)
"""
Explanation: Can we get chemical use classification data?
i.e., lists of chemicals classified by use.
First, get the controlled vocabulary of uses.
End of explanation
"""... |
laurentperrinet/Khoei_2017_PLoSCB | notebooks/control_jobs.ipynb | mit | !ipython3 experiment_fle.py
!ipython3 experiment_speed.py
!ipython3 experiment_contrast.py
!ipython3 experiment_MotionReversal.py
!ipython3 experiment_SI_controls.py
"""
Explanation: controlling jobs locally
This is a set of convenient commands used to control simulations locally.
🏄 running scripts 🏄
End of exp... |
ledeprogram/algorithms | class7/homework/argueso_olaya_7_1.ipynb | gpl-3.0 | import pandas as pd
%matplotlib inline
from sklearn import datasets
from pandas.tools.plotting import scatter_matrix
import matplotlib.pyplot as plt
iris = datasets.load_iris()
iris
x = iris.data[:,:2]
y = iris.target
from sklearn import tree
from sklearn.cross_validation import train_test_split
dt = tree.Decis... |
briennakh/BIOF509 | Wk13/Wk13-Advanced-ML-tasks.ipynb | mit | from sklearn.cross_validation import cross_val_score
from sklearn.datasets import load_iris
from sklearn.ensemble import AdaBoostClassifier
iris = load_iris()
clf = AdaBoostClassifier(n_estimators=100)
scores = cross_val_score(clf, iris.data, iris.target)
scores.mean()
from sklearn.cross_validation import cross_val_s... |
Python4AstronomersAndParticlePhysicists/PythonWorkshop-ICE | notebooks/06_01_pandas.ipynb | mit | # Import libraries
import pandas as pd
import numpy as np
"""
Explanation: This is the notebook for the python pandas dataframe course
The idea of this notebook is to show the power of working with pandas dataframes
Motivation
We usually work with tabular data
We should not handle them with bash commands like: for, sp... |
HazyResearch/snorkel | tutorials/advanced/Parallel_Processing.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
os.environ['SNORKELDB'] = 'postgres:///snorkel'
from snorkel import SnorkelSession
session = SnorkelSession()
"""
Explanation: Parallel Processing in Snorkel
In this notebook, we'll do the same preprocessing as in the introduction tutorial, but using mul... |
godfreyduke/deep-learning | dcgan-svhn/DCGAN_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import tensorflow as tf
!mkdir data
"""
Explanation: Deep Convolutional GANs
In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_forward.ipynb | bsd-3-clause | import mne
from mne.datasets import sample
data_path = sample.data_path()
# the raw file containing the channel location + types
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
# The paths to freesurfer reconstructions
subjects_dir = data_path + '/subjects'
subject = 'sample'
"""
Explanation: Head model a... |
metpy/MetPy | v1.0/_downloads/0eff36d3fdf633f2a71ae3e92fdeb5b8/Simple_Sounding.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, SkewT
from metpy.units import units
# Change default to be better for skew-T
plt.rcParams['figure.figsize'] = (9, 9)
# Upper air data can be... |
jrieke/machine-intelligence-2 | sheet11/sheet11_1.ipynb | mit | from __future__ import division, print_function
import matplotlib.pyplot as plt
%matplotlib inline
import scipy.stats
import numpy as np
import math
from scipy.ndimage import imread
import sys
"""
Explanation: Machine Intelligence II - Team MensaNord
Sheet 11
Nikolai Zaki
Alexander Moore
Johannes Rieke
Georg Hoelger
... |
hetaodie/hetaodie.github.io | assets/media/uda-ml/supervisedlearning/jc/为慈善机构寻找捐助者/charity_finish/charity/finding_donors/finding_donors.ipynb | mit | # TODO:总的记录数
n_records = len(data)
# # TODO:被调查者 的收入大于$50,000的人数
n_greater_50k = len(data[data.income.str.contains('>50K')])
# # TODO:被调查者的收入最多为$50,000的人数
n_at_most_50k = len(data[data.income.str.contains('<=50K')])
# # TODO:被调查者收入大于$50,000所占的比例
greater_percent = (n_greater_50k / n_records) * 100
# 打印结果
print ("To... |
Oli4/lsi-material | Foundations of Information Management/Sheet 4 - SQL queries.ipynb | mit | cur.execute('''SELECT film.title
FROM film, person, participation
WHERE film.genre LIKE '%Thriller%'
AND film.id = participation.film
AND person.id = participation.person
AND participation.function = "director"
AND person.name=... |
fangohr/polygon-finite-difference-mesh-tools | notebooks/example.ipynb | bsd-2-clause | cc = pmt.CartesianCoords(5,5)
print("2D\n")
print("x-coordinate: {}".format(cc.x))
print("y-coordinate: {}".format(cc.y))
print("radial: {}".format(cc.r))
print("azimuth: {}".format(cc.a))
cc3D = pmt.CartesianCoords(1,2,3)
print("\n3D\n")
print("x-coordinate: {}".format(cc3D.x))
print("y-coordinate: {}".... |
phoebe-project/phoebe2-docs | development/tutorials/passbands.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Adding new passbands to PHOEBE
In this tutorial we will show you how to add your own passband to PHOEBE. Adding a custom passband involves:
downloading and setting up model atmosphere tables;
providing a passband transmission function;
defining and registering pass... |
omoju/udacityUd120Lessons | Decision Trees.ipynb | gpl-3.0 | %pylab inline
import sys
from time import time
sys.path.append("../tools/")
sys.path.append("../naive bayes/")
from prep_terrain_data import makeTerrainData
from class_vis import prettyPicture, output_image
import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
### features_train and features_t... |
kingtaurus/cs224d | old_assignments/assignment2/part1-NER.ipynb | mit | import sys, os
from numpy import *
from matplotlib.pyplot import *
%matplotlib inline
matplotlib.rcParams['savefig.dpi'] = 100
%load_ext autoreload
%autoreload 2
"""
Explanation: CS 224D Assignment #2
Part [1]: Deep Networks: NER Window Model
For this first part of the assignment, you'll build your first "deep" netw... |
SuLab/WikidataIntegrator | notebooks/setDescription.ipynb | mit | from wikidataintegrator import wdi_core, wdi_login
import os
import pandas as pd
import pprint
"""
Explanation: This notebook contains code examples for maintaining, extending and updating the Wikipathways bot
load the libraries
End of explanation
"""
def sparql(query, endpoint):
query=query
return wdi_core.... |
mne-tools/mne-tools.github.io | 0.18/_downloads/2e5e89949bd57aecc1ef4e79435a8149/plot_temporal_whitening.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import mne
from mne.time_frequency import fit_iir_model_raw
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
r... |
quantopian/research_public | notebooks/data/quandl.currfx_usdeur/notebook.ipynb | apache-2.0 | # import the dataset
from quantopian.interactive.data.quandl import currfx_usdeur
# Since this data is public domain and provided by Quandl for free, there is no _free version of this
# data set, as found in the premium sets. This import gets you the entirety of this data set.
# import data operations
from odo import ... |
WNoxchi/Kaukasos | FAI02_old/Lesson9/Lesson9_SR_CodeAlong.ipynb | mit | %matplotlib inline
import os; import 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
# Tell TensorFlow to use no more GPU RAM than necessary
limit_mem()
path = '../... |
MaxPowerWasTaken/MaxPowerWasTaken.github.io | jupyter_notebooks/Multiprocessing with Pandas.ipynb | gpl-3.0 | from multiprocessing import Pool, cpu_count
def process_Pandas_data(func, df, num_processes=None):
''' Apply a function separately to each column in a dataframe, in parallel.'''
# If num_processes is not specified, default to minimum(#columns, #machine-cores)
if num_processes==None:
num_proces... |
karthikrangarajan/intro-to-sklearn | archive/Intro_ML_sklearn.ipynb | bsd-3-clause | # Plot settings for notebook
# so that plots show up in notebook
%matplotlib inline
# seaborn here is used for aesthetics.
# here, setting seaborn plot defaults (this can be safely commented out)
import seaborn; seaborn.set()
# Import an example plot from the figures directory
from fig_code import plot_sgd_separator... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Visualization/Pandas Built-in Data Viz/Pandas Built-in Data Visualization.ipynb | mit | import numpy as np
import pandas as pd
%matplotlib inline
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Pandas Built-in Data Visualization
In this lecture we will learn about pandas built-in capabilities for data visualization! It's built-off of matplotlib, but it b... |
andreww/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... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_decoding_csp_eeg.ipynb | bsd-3-clause | # Authors: Martin Billinger <martin.billinger@tugraz.at>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne import Epochs, pick_types, find_events
from mne.channels import read_layout
from mne.io import concatenate_raws, read_raw_edf
from mne.datasets import eegbci
from mne.decodi... |
akseshina/dl_course | seminar_6/hw_sklearn.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
from collections import Counter
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
from sklearn.neighbors import NearestCentroid
import random
import pickle
family_classification_metadata = pd.read_table('../seminar_5/data/family_classification_metadata.ta... |
chengwliu/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter4_TheGreatestTheoremNeverTold/Ch4_LawOfLargeNumbers_PyMC2.ipynb | mit | %matplotlib inline
import numpy as np
from IPython.core.pylabtools import figsize
import matplotlib.pyplot as plt
figsize(12.5, 5)
import pymc as pm
sample_size = 100000
expected_value = lambda_ = 4.5
poi = pm.rpoisson
N_samples = range(1, sample_size, 100)
for k in range(3):
samples = poi(lambda_, size=sample_... |
cgrudz/cgrudz.github.io | teaching/stat_775_2021_fall/activities/activity-2021-08-30.ipynb | mit | import numpy as np
# load the data below specifying the correct path in the load text with the correct commands for a csv file
"""
Explanation: Introduction to Python part III (And a discussion of orthgonality)
Activity 1: Discussion of orthogonality
One of the primary concepts discussed in the review of inner produc... |
halexan/cs231n | assignment1/two_layer_net.ipynb | mit | # A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.neural_net import TwoLayerNet
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloadi... |
adolfoguimaraes/machinelearning | Tensorflow/Tutorial01_IntroducaoTensorflow.ipynb | mit | import tensorflow as tf
tf.__version__
"""
Explanation: Tutorial 1
Esse tutorial tem como objetivo explorar os conceitos básicos do Tensorflow. Detalhes de como instalar o TensorFlow podem ser encontrados em: https://www.tensorflow.org/.
Links de referência para esse material:
Tutorial do Tensorflow
Curso básico do ... |
tomwallis/PsyUtils | psydata_demo.ipynb | mit | import seaborn as sns
import psyutils as pu
%load_ext autoreload
%autoreload 2
%matplotlib inline
sns.set_style("white")
sns.set_style("ticks")
"""
Explanation: Short demo of psydata functions
End of explanation
"""
# load data:
dat = pu.psydata.load_psy_data()
dat.info()
"""
Explanation: I'll demo some function... |
sbyrnes321/tmm | examples.ipynb | mit | from __future__ import division, print_function, absolute_import
from tmm import (coh_tmm, unpolarized_RT, ellips,
position_resolved, find_in_structure_with_inf)
from numpy import pi, linspace, inf, array
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
%matplotlib inline
... |
brian-rose/ClimateModeling_courseware | Lectures/Lecture19 -- Seasonal cycle and heat capacity.ipynb | mit | # Ensure compatibility with Python 2 and 3
from __future__ import print_function, division
"""
Explanation: ATM 623: Climate Modeling
Brian E. J. Rose, University at Albany
Lecture 19: Modeling the seasonal cycle of surface temperature
Warning: content out of date and not maintained
You really should be looking at Th... |
dchud/warehousing-course | lectures/week-11-20151124-redis-intro.ipynb | cc0-1.0 | import redis
"""
Explanation: A brief tour of Redis
A one-hour or less tour of Redis.
tl:dr version:
If you don't have time to read/run this, go to Try Redis and try it yourself.
Redis is a data structure server. Not quite a database, not quite a key-value store.
It is very fast and is a great tool for rapid analysis... |
karlstroetmann/Algorithms | Python/Chapter-07/ArrayMap.ipynb | gpl-2.0 | class ArrayMap:
def __init__(self, n):
self.mArray = [None] * n
def find(self, k):
return self.mArray[k]
def insert(self, k, v):
self.mArray[k] = v
def delete(self, k):
self.mArray[k] = None
def __repr__(self):
result = '{ '
... |
benwaugh/NuffieldProject2016 | notebooks/SimplifiedZZAnalysis.ipynb | mit | from ROOT import TChain, TH1F, TLorentzVector, TCanvas
"""
Explanation: Simplified ZZ analysis
This is based on the ZZ analysis in the ATLAS outreach paper, but including all possible pairs of muons rather than selecting the combination closest to the Z mass.
This time we will use ROOT histograms instead of Matplotlib... |
HarshaDevulapalli/foundations-homework | 14/14 - TF-IDF Homework.ipynb | mit | # If you'd like to download it through the command line...
!curl -O http://www.cs.cornell.edu/home/llee/data/convote/convote_v1.1.tar.gz
# And then extract it through the command line...
!tar -zxf convote_v1.1.tar.gz
"""
Explanation: Homework 14 (or so): TF-IDF text analysis and clustering
Hooray, we kind of figured ... |
fcollonval/coursera_data_visualization | Chi-Square_Test.ipynb | mit | # Magic command to insert the graph directly in the notebook
%matplotlib inline
# Load a useful Python libraries for handling data
import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
import seaborn as sns
import scipy.stats as stats
import matplotlib.pyplot as plt
from IPython.display import Ma... |
empet/Plotly-plots | Plotly-Slice-in-volumetric-data.ipynb | gpl-3.0 | import numpy as np
import plotly.graph_objects as go
from IPython
"""
Explanation: Slice in volumetric data, via Plotly
A volume included in a parallelepiped is described by the values of a scalar field, $f(x,y,z)$, with $x\in[a,b]$, $y\in [c,d]$, $z\in[e,f]$.
A slice in this volume is visualized by coloring the surf... |
Ccaccia73/semimonocoque | 02_Triangular_Section.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
End of explanation
"""
from Section import Section
"""
Explanation: Import Section class, which... |
srcole/qwm | hcmst/process_raw_data.ipynb | mit | import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
pd.options.display.max_columns=1000
"""
Explanation: Data info
Data notes
Wave I, the main survey, was fielded between February 21 and April 2, 2009. Wave 2 was fielded March 12, 2010 to June 8, 2010. Wave... |
AdityaSoni19031997/Machine-Learning | Classifying_datasets/MNIST/mnist-with-keras-for-beginners-99457.ipynb | mit | import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt #for plotting
from collections import Counter
from sklearn.metrics import confusion_matrix
import itertools
import seaborn as sns
from subprocess import check_output
print(check_out... |
jobovy/gaia_tools | examples/make_gaia_query_examples.ipynb | mit | circle = """
--Selections: Cluster RA
1=CONTAINS(POINT('ICRS',gaia.ra,gaia.dec),
CIRCLE('ICRS',{ra:.4f},{dec:.4f},{rad:.2f}))
""".format(ra=230, dec=0, rad=4)
df = make_simple_query(
WHERE=circle, # The WHERE part of the SQL
random_index=1e4, # a shortcut to use the random_index in 'W... |
Luke035/dlnd-lessons | transfer-learning/image-net/Preprocess ImageNet.ipynb | mit | !rm -rf /tmp/ImageNetTrainTransfer
#Import
import pandas as pd
import numpy as np
import os
import tensorflow as tf
import random
from PIL import Image
#Inception preprocessing code from https://github.com/tensorflow/models/blob/master/slim/preprocessing/inception_preprocessing.py
#useful to maintain training dimensio... |
Brett777/Predict-Risk | Automatic Machine Learning.ipynb | apache-2.0 | %%capture
import h2o
from h2o.automl import H2OAutoML
import os
import plotly
import cufflinks
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
plotly.offline.init_notebook_mode(connected=True)
myPlotlyKey = os.environ['SECRET_ENV_BRETTS_PLOTLY_KEY']
py.sign_in(username='br... |
modin-project/modin | examples/tutorial/jupyter/execution/pandas_on_dask/local/exercise_2.ipynb | apache-2.0 | import modin.pandas as pd
import pandas
import time
from IPython.display import Markdown, display
def printmd(string):
display(Markdown(string))
"""
Explanation: <center><h2>Scale your pandas workflows by changing one line of code</h2>
Exercise 2: Speed improvements
GOAL: Learn about common functionality that Mod... |
BenEfrati/ex1 | loan-prediction/HW4.ipynb | mit | %pylab inline
"""
Explanation: Exercise 2: Data Analysis with Python
Based on this great tutorial: https://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-learn-data-science-python-scratch-2/
Our Task: Loan Prediction Practice Problem
From the challange hosted at: https://datahack.analyticsvidhya.com/contest/p... |
jingr1/SelfDrivingCar | AStarSearch/project_notebook.ipynb | mit | # Run this cell first!
from helpers import Map, load_map, show_map
from student_code import shortest_path
%load_ext autoreload
%autoreload 2
"""
Explanation: Implementing a Route Planner
In this project you will use A* search to implement a "Google-maps" style route planning algorithm.
End of explanation
"""
map_1... |
InsightLab/data-science-cookbook | 2020/05-geographic-information-system/Notebook_Geometric_Operations.ipynb | mit | # Import necessary modules
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
# Filepath
fp = r"data/roubos.csv"
# Read the data
data = pd.read_csv(fp, sep=',')
data
"""
Explanation: 1. Geocoding no Geopandas
O Geocoding é o processo de transformar um endereço em coordenadas geográficas (... |
tensorflow/docs-l10n | site/ko/tutorials/load_data/unicode.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... |
daniel-koehn/Theory-of-seismic-waves-II | 05_2D_acoustic_FD_modelling/7_fdac2d_sensitivity_kernels.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 by D. Koehn, notebook sty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.