repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
doudon/pymks_overview | notebooks/elasticity_2D.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
n = 15
from pymks.tools import draw_microstructures
from pymks.datasets import make_delta_microstructures
"""
Explanation: Linear Elasticity in 2D
Introduction
This example provides a demonstration of using PyM... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/automl/showcase_automl_text_classification_batch.ipynb | apache-2.0 | import os
import sys
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install -U google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex client library: AutoML text classification model for batch prediction
<table align="... |
texib/spark_tutorial | 3.AnalysisArticle_HTML-Anwser.ipynb | gpl-2.0 | def parseRaw(json_map):
url = json_map['url']
content = json_map['html']
return (url,content)
"""
Explanation: Parse Json
End of explanation
"""
import json
import pprint
pp = pprint.PrettyPrinter(indent=2)
path = "./pixnet.txt"
all_content = sc.textFile(path).map(json.loads).map(parseRaw)
"""
Explanati... |
matousc89/PPSI | podklady/notebooks/data_formats.ipynb | mit | import json
# ukazkova data
message = [
{"time": 123, "value": 5},
{"time": 124, "value": 6},
{"status": "ok", "finish": [True, False, False]},
]
# zabalit zpravu
js_message = json.dumps(message)
# show result
print(type(js_message))
print(js_message)
"""
Explanation: Skladování dat
JSON
<a href="https... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/tensorboard/get_started.ipynb | apache-2.0 | # Installing the Vertex AI TensorBoard uploader
!python -m pip install google-cloud-aiplatform['tensorboard'] --upgrade
import datetime
import tensorflow as tf
# Clear any logs from previous runs
!rm -rf ./logs/
project_id = "YOUR PROJECT ID"
region = "YOUR REGION"
content_name = "vertex-ai-tb-get-started"
"""
E... |
pylablanche/gcForest | gcForest_tuto.ipynb | mit | from GCForest import gcForest
from sklearn.datasets import load_iris, load_digits
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
"""
Explanation: <h1>gcForest Algorithm</h1>
<p>The gcForest algorithm was suggested in Zhou and Feng 2017 ( https://arxiv.org/abs/1702.0883... |
giserh/pysparkling | docs/demo.ipynb | mit | counts = Context().textFile(
'../README.rst'
).map(
lambda line: ''.join(ch if ch.isalnum() else ' ' for ch in line)
).flatMap(
lambda line: line.split(' ')
).map(
lambda word: (word, 1)
).reduceByKey(
lambda a, b: a + b
)
print(counts.collect())
"""
Explanation: Word Count
End of explanation
"""
... |
ML-KULeuven/socceraction | public-notebooks/EXTRA-build-expected-goals-model.ipynb | mit | import os
import warnings
import tqdm
import numpy as np
import pandas as pd
warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)
%load_ext autoreload
%autoreload 2
import socceraction.spadl as spadl
import socceraction.vaep.features as fs
import socceraction.vaep.labels as lab
"""
Explanatio... |
adamamiller/PS1_star_galaxy | catalog_update/update_classifications.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib import rcParams
from matplotlib.legend import Legend
import seaborn as sns
rcParams["font.family"] = "sans-serif"
rcParams['font.sans-serif'] = ['Deja... |
khalido/nd101 | sentiment_network/Sentiment Classification - Mini Project 2.ipynb | gpl-3.0 | 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()... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/inm-cm4-8/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'inm-cm4-8', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: INM
Source ID: INM-CM4-8
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
mne-tools/mne-tools.github.io | stable/_downloads/09baca5bff98c3be2834792aebba565c/montage_sgskip.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import mne
from mne.channels.montage import get_builtin_montages
from mne.datasets import fetch_fsaverage
from mne.viz import set_3d_title, set_3d_view
"""
Explanatio... |
dcherian/eddyshelf | secondary-vortices.ipynb | mit | # test pymatbridge
#from pymatbridge import Matlab
#mlab = Matlab()
#mlab.start()
%matplotlib inline
%load_ext secnum
%secnum
import numpy as np
import h5py
import netCDF4
import numexpr as ne
from scipy.io import loadmat
from datetime import datetime
import time
from IPython import display
import pylab
import py... |
maojrs/riemann_book | Traffic_variable_speed.ipynb | bsd-3-clause | %matplotlib inline
%config InlineBackend.figure_format = 'svg'
import matplotlib as mpl
mpl.rcParams['font.size'] = 8
figsize =(8,4)
mpl.rcParams['figure.figsize'] = figsize
import matplotlib.pyplot as plt
import numpy as np
from ipywidgets import interact
from ipywidgets import widgets, FloatSlider
from utils import ... |
muniri92/Echo-Pod | Recitation_KMean.ipynb | mit | import pandas
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.cluster import KMeans
from pprint import pprint
TITANIC_TRAIN = 'train.csv'
TITANIC_TEST = 'test.csv'
# t_df refers to titanic_dataframe
t_df = pandas.read_csv(TITANIC_TRAIN, header=0)
"""
Explanation: Objective
Predic... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_home/2020_json_xml.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Tech - JSON - XML
Transmettre l'information d'une machine à une autre, d'un logiciel à un autre, d'une base de données à une autre est un problème récurrent. Le format le plus simple pour des données est le format csv. Ca marche bien pour... |
xpmanoj/content | HW2_solutions.ipynb | mit | %matplotlib inline
from collections import defaultdict
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import rcParams
import matplotlib.cm as cm
import matplotlib as mpl
#colorbrewer2 Dark2 qualitative color table
dark2_colors = [(0.10588235294117647, 0.61960784313... |
Karuntg/SDSS_SSC | Analysis_2020/compSDSS_PS_KTv2.ipynb | gpl-3.0 | # GENERAL PURPOSE PACKAGES
import os
import glob
import tarfile
from urllib.request import urlretrieve
from datetime import date
import timeit
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Import ZI tools
%load_ext autoreload
%autoreload 2
# importing ZI tools:
# import ZItools as zit
#... |
marcinofulus/teaching | ML_SS2017/tf_logistic_equation.ipynb | gpl-3.0 | import pycuda.gpuarray as gpuarray
from pycuda.curandom import rand as curand
from pycuda.compiler import SourceModule
import pycuda.driver as cuda
try:
ctx.pop()
ctx.detach()
except:
print( "No CTX!")
cuda.init()
device = cuda.Device(1)
ctx = device.make_context()
mod = SourceModule("""
__global__... |
parameterspace-ie/eo4a-service-development | notebooks/run_eo4a_service.ipynb | gpl-3.0 | # Required imports from service development module.
from eo4a.development import create_wps, describe_service, list_services, monitor_execution, reload_services
"""
Explanation: Executing EO4Atlantic Services
EO4Atlantic services may be executed locally outside of the platform. This is currently achieved by means of J... |
kevroy314/msl-iposition-pipeline | examples/archived_tests/ActualPointHistograms.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KernelDensity
from scipy.stats.distributions import norm
"""
Explanation: Sampling From a Distribution Using Kernel Density Estimation (KDE)
In the next section, we take our above distributions of points and generate an... |
structurely/csa | examples/travelling_salesman.ipynb | mit | from __future__ import print_function
import math
import random
from pycsa import CoupledAnnealer
try:
xrange
except NameError:
xrange = range
"""
Explanation: CSA applied to the travelling salesman problem (TSP)
This example was adapted from https://github.com/perrygeo/simanneal/blob/master/examples/salesm... |
ctn-waterloo/best-practices | Communication between components - redis.ipynb | mit | import redis
r = redis.StrictRedis(host='localhost')
r.set('key', 'value')
print r.get('key')
"""
Explanation: Communication between components
Purpose: If we are connecting to hardware or otherwise doing something involving multiple computers or even separate processes on the same computer, we need some easy way to... |
ES-DOC/esdoc-jupyterhub | notebooks/mpi-m/cmip6/models/icon-esm-lr/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mpi-m', 'icon-esm-lr', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: MPI-M
Source ID: ICON-ESM-LR
Topic: Landice
Sub-Topics: Glaciers, Ice.
Prope... |
zhuanxuhit/deep-learning | weight-initialization/weight_initialization.ipynb | mit | %matplotlib inline
import tensorflow as tf
import helper
from tensorflow.examples.tutorials.mnist import input_data
print('Getting MNIST Dataset...')
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
print('Data Extracted.')
"""
Explanation: Weight Initialization
In this lesson, you'll learn how to fi... |
gmodena/notebooks | Probabilistic neighbours.ipynb | bsd-3-clause | import scipy.io as sio
nndata = sio.loadmat('/Users/gm/Downloads/BRMLtoolkit/data/NNdata.mat')
nndata
"""
Explanation: In this notebook I'll show probabilistic interpretation of the nearest neighbours algorith as a mixture of Gaussians. Following Barber 2012. First I'll give an example of ... Next, I'll show how to ... |
benlaken/Romania_2016 | remote_netcdf.ipynb | mit | from mpl_toolkits.basemap import Basemap, shiftgrid
from netCDF4 import Dataset, date2index
import time
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from datetime import datetime, timedelta
%matplotlib notebook
"""
Explanation: Working from Remote Geophysical data
Examples o... |
JarronL/pynrc | notebooks/Coronagraph_M210R.ipynb | mit | # Import the usual libraries
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# Enable inline plotting at lower left
%matplotlib inline
import pynrc
from pynrc import nrc_utils # Variety of useful functions and classes
from pynrc.obs_nircam import obs_hci # High-contrast imaging observati... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/sandbox-1/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-1', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: SANDBOX-1
Topic: Ocean
Sub-Topics: Timestepping Framework,... |
quantopian/research_public | notebooks/lectures/Factor_Based_Risk_Management/notebook.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data import Fundamentals
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.factors import CustomFactor, Returns
from q... |
bbfamily/abu | abupy_lecture/4-多支股票择时回测与仓位管理(ABU量化使用文档).ipynb | gpl-3.0 | from __future__ import print_function
from __future__ import division
import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
import sys
# 使用insert 0即只使用github,避免交叉使用了pip安装的abupy,导致的版本不一致问题
s... |
arvkevi/kneed | notebooks/kneedle_algorithm.ipynb | bsd-3-clause | import numpy as np
import scipy
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Python implementation of the Kneedle algorithm
Finding a “Kneedle” in a Haystack: Detecting Knee Points in System Behavior
Ville Satopa, Jeannie Albrecht, David Irwin, and Barath Raghavan
https://www1.icsi.berkeley.edu... |
ComputationalModeling/spring-2017-danielak | past-semesters/spring_2016/day-by-day/day09-random-walks/random_walk_experiment.ipynb | agpl-3.0 | n_trials = 1000 # number of trials (i.e., number of walks)
n_steps = 1000 # number of steps taken during each trial
distances = [] # use this to keep track of distance for each trial
this_trial = 0
# loop over trials
while this_trial < n_trials:
# reset step and distance to zero
this_distance = 0
st... |
mikezawitkowski/fireRiskSF | notebooks/exploratory/0.2-offset-issue-repro.ipynb | mit | from __future__ import division, print_function # always future proof for python3
import pandas as pd
# here is what is meant to be the last 1,000 rows ordered by the close date time
df = pd.read_json('https://data.sfgov.org/resource/wbb6-uh78.json?$order=close_dttm%20DESC&$offset=0&$limit=1000')
df.close_dttm.min()... |
astroumd/GradMap | notebooks/Lectures2017/Lecture3/Lecture 3.ipynb | gpl-3.0 | np.random.rand(5)
"""
Explanation: Random Numbers
Documentation: https://docs.scipy.org/doc/numpy/reference/routines.random.html
Numpy gives us the ability to select random numbers from a variety of different distribution functions (see the np.random documentation for a full list). However, the two most frequently use... |
pombredanne/gensim | docs/notebooks/annoytutorial.ipynb | lgpl-2.1 | #Set up the model and vector that we are using in the comparison
from gensim.similarities.index import AnnoyIndexer
from gensim.models.word2vec import Word2Vec
model = Word2Vec.load("/tmp/leemodel")
model.init_sims()
vector = model.syn0norm[0]
annoy_index = AnnoyIndexer(model, 500)
%%time
#Traditional implementation:... |
tensorflow/docs-l10n | site/es-419/tutorials/keras/regression.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... |
sevo/pewe-presentations | Tutorial - Feature engineering.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
plt.rcParams['figure.figsize'] = 9, 6
from IPython.display import Image
"""
Explanation: Feature engineering
Jakub Ševcech
Obsah
Praca s casom a datumami
Zoskupovanie viacerych pozorovani
Numericke atributy
Norm... |
sot/aimpoint_mon | testing/dynam_offsets/verify_dynamic_offsets.ipynb | bsd-2-clause | # Required imports
from __future__ import division, print_function
import glob
import shelve
from astropy.table import Table
import numpy as np
from Quaternion import Quat
import chandra_aca
from chandra_aca import calc_aca_from_targ, calc_targ_from_aca
import parse_cm
from Ska.engarchive import fetch_sci
from Chandra... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/cmip6/models/fgoals-f3-l/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cas', 'fgoals-f3-l', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CAS
Source ID: FGOALS-F3-L
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Bal... |
aakashm301/Workshop | Refactored_Py_DS_ML_Bootcamp-master/22-Deep Learning/03-Tensorflow with Estimators.ipynb | gpl-3.0 | import pandas as pd
df = pd.read_csv('iris.csv')
df.head()
df.columns = ['sepal_length','sepal_width','petal_length','petal_width','target']
X = df.drop('target',axis=1)
y = df['target'].apply(int)
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Tensorflow with Es... |
jsharpna/DavisSML | 2018_material/labs/2017-hw1.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import LeaveOneOut
from sklearn import linear_model, neighbors
%matplotlib inline
plt.style.use('ggplot')
# dataset path
data_dir = "."
sample_data = pd.read_csv(data_dir+"/hw1.csv", delimiter=',')
sample_data.head()
... |
phoebe-project/phoebe2-docs | development/tutorials/gravb_bol.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Gravity Brightening/Darkening (gravb_bol)
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units... |
cgpotts/cs224u | vsm_02_dimreduce.ipynb | apache-2.0 | __author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2022"
"""
Explanation: Vector-space models: dimensionality reduction
End of explanation
"""
from torch_glove import TorchGloVe
import numpy as np
from np_glove import GloVe
import os
import pandas as pd
import scipy.stats
from torch_autoencoder... |
tuanavu/coursera-university-of-washington | machine_learning/2_regression/assignment/week5/week-5-lasso-assignment-1-exercise.ipynb | mit | import sys
sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages')
import graphlab
"""
Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation)
In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can use ... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-mm/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-mm', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-MM
Sub-Topics: Radiative Forcings.
Properties: 85 (42 ... |
nlgranger/LazyProc | docs/examples/preprocessing_pipeline.ipynb | mpl-2.0 | from PIL import Image, ImageOps
import seqtools
! [[ -f owl.jpg ]] || curl -s "https://cdn.pixabay.com/photo/2017/04/07/01/05/owl-2209827_640.jpg" -o owl.jpg
! [[ -f rooster.jpg ]] || curl -s "https://cdn.pixabay.com/photo/2018/08/26/14/05/hahn-3632299_640.jpg" -o rooster.jpg
! [[ -f duck.jpg ]] || curl -s "https://cd... |
asmith26/courses | deeplearning1/nbs/lesson1.ipynb | apache-2.0 | %matplotlib inline
"""
Explanation: Using Convolutional Neural Networks
Welcome to the first week of the first deep learning certificate! We're going to use convolutional neural networks (CNNs) to allow our computer to see - something that is only possible thanks to deep learning.
Introduction to this week's task: 'Do... |
goddoe/CADL | session-1/session-1.ipynb | apache-2.0 | # First check the Python version
import sys
if sys.version_info < (3,4):
print('You are running an older version of Python!\n\n' \
'You should consider updating to Python 3.4.0 or ' \
'higher as the libraries built for this course ' \
'have only been tested in Python 3.4 and higher.\n'... |
dnc1994/MachineLearning-UW | ml-classification/module-5-decision-tree-assignment-2-solution.ipynb | mit | import graphlab
"""
Explanation: Implementing binary decision trees
The goal of this notebook is to implement your own binary decision tree classifier. You will:
Use SFrames to do some feature engineering.
Transform categorical variables into binary variables.
Write a function to compute the number of misclassified e... |
kwinkunks/axb | NumPy_2D.ipynb | apache-2.0 | import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
%matplotlib inline
def plot_all(m, d, m_est, d_pred):
"""
Helper function for plotting. You can ignore this.
"""
fig = plt.figure(figsize=(10,6))
ax0 = fig.add_subplot(2,2,1)
ax0.imsh... |
PyPSA/PyPSA | examples/notebooks/logging-demo.ipynb | mit | import pypsa, os
import logging
logging.basicConfig(level=logging.ERROR)
network = pypsa.examples.ac_dc_meshed(from_master=True)
out = network.lopf()
"""
Explanation: Demonstrate usage of logging
PyPSA uses the Python standard library logging.
This notebook shows how to use it and control the logging messages from ... |
eds-uga/csci1360-fa16 | lectures/L7.ipynb | mit | x = [51, 65, 56, 19, 11, 49, 81, 59, 45, 73]
"""
Explanation: Lecture 7: Conditionals and Exceptions
CSCI 1360: Foundations for Informatics and Analytics
Overview and Objectives
In this lecture, we'll go over how to make "decisions" over the course of your code depending on the values certain variables take. We'll als... |
dh7/ML-Tutorial-Notebooks | rnn_face_tests/tf-LFW-load-tensor.ipynb | bsd-2-clause | import numpy as np
import tensorflow as tf
"""
Explanation: Tensor Flow to encode LFW set
To learn how to encode a simple image and a GIF
Import needed for Tensorflow
End of explanation
"""
%matplotlib notebook
import matplotlib
import matplotlib.pyplot as plt
from IPython.display import Image
size = 10
tf.reset_... |
jpilgram/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='confusing graph part 1.PNG')
Image(filename='confusing graph part 2.PNG')
Image(filename='confusing graph part 3.PN... |
lee212/simpleazure | ipynb/Tutorial - Modifying a Template in Python.ipynb | gpl-3.0 | from simpleazure import SimpleAzure
import os
os.environ['AZURE_SUBSCRIPTION_ID'] = $sid
os.environ['AZURE_CLIENT_SECRET'] = $password
os.environ['AZURE_TENANT_ID'] = $tid
os.environ['AZURE_CLIENT_ID'] = $cid
saz = SimpleAzure()
vm_sshkey = saz.aqst.get_template('101-vm-sshkey')
"""
Explanation: Modifying a Template... |
Qumulo/python-notebooks | notebooks/File and Data Management.ipynb | gpl-3.0 | import os
import re
import sys
import StringIO
from qumulo.lib.request import RequestError
from qumulo.rest_client import RestClient
# set your environment variables or fill in the variables below
API_HOSTNAME = os.environ['API_HOSTNAME'] if 'API_HOSTNAME' in os.environ else '{your-cluster-hostname}'
API_USER = os... |
mne-tools/mne-tools.github.io | 0.22/_downloads/2784a8d5822ed9797c0330f973573c10/plot_stats_cluster_erp.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import ttest_ind
import mne
from mne.channels import find_ch_adjacency, make_1020_channel_selections
from mne.stats import spatio_temporal_cluster_test
np.random.seed(0)
# Load the data
path = mne.datasets.kiloword.data_path() + '/kword_metadata-epo... |
fionapigott/Data-Science-45min-Intros | neural-networks-101/Neural Networks - Part 1.ipynb | unlicense | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from mlxtend.evaluate import plot_decision_regions
from sklearn.datasets import make_blobs
from sklearn.linear_model import LogisticRegression
samples = 20
X, y = make_blobs(n_samples=samples, n_features=2, cluster_std=0.25,
cent... |
armgilles/presentation | EPSI/I4/Datamining/c2/Explore data 2.ipynb | mit | Image(url="http://i.giphy.com/LY1DH1AMbG0tq.gif")
"""
Explanation: Back to data again
On a commencé à analyser les données de Pokemons et à afficher plusieurs graphiques pour avoir une vision de nos données. Le problème avec les données c'est que dans la vrai vie, les données ne sont pas propre (dirty data)...
Par con... |
phoebe-project/phoebe2-docs | development/tutorials/datasets.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u # units
logger = phoebe.logger()
b = phoebe.default_binary()
"""
Explanation: Datasets
Datasets tell PHOEBE how and at what times to compute the model. In some cases these will include the actual observational data, and in other cases may only ... |
jinntrance/MOOC | coursera/ml-classification/assignments/module-8-boosting-assignment-2-blank.ipynb | cc0-1.0 | import graphlab
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Boosting a decision stump
The goal of this notebook is to implement your own boosting module.
Brace yourselves! This is going to be a fun and challenging assignment.
Use SFrames to do some feature engineering.
Modify the decision tree... |
paulhoule/gastrodon | notebooks/remote/Querying DBpedia.ipynb | mit | import sys
from gastrodon import RemoteEndpoint,QName,ttl,URIRef,inline
import pandas as pd
pd.options.display.width=120
pd.options.display.max_colwidth=100
"""
Explanation: <img src="dbpedia_getting_started.jpg">
Getting started with the DBpedia SPARQL endpoint
In this episode I begin to explore the DBpedia public SP... |
liupengyuan/python_tutorial | chapter4/python爬虫入门.ipynb | mit | import requests
from bs4 import BeautifulSoup
import re
"""
Explanation: By liupengyuan[at]pku.edu.cn
Project: https://github.com/liupengyuan/
1. 什么是爬虫
简而言之,爬虫就是一段能够获取互联网信息(数据)的程序/工具。
一般需要通过抓取网页来获取互联网的信息与数据。
网页本身就是一个本文文件,只不过这个文本文件是由特定规则和符号标记的(HTML,超文本标记语言),称为超文本文件,也可称为网页源代码。
这段文本经过浏览器的解析(各类图片视频等在此过程中从网页外部加载),就成为我们日常浏览... |
bambinos/formulae | docs/notebooks/getting_started.ipynb | mit | import numpy as np
import pandas as pd
from formulae import design_matrices
"""
Explanation: Getting started
formulae requires a working Python interpreter (3.7+) and the libraries NumPy, SciPy and pandas with versions specified in the requirements.txt file.
Assuming a standard Python environment is installed on your... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/e_ai_platform.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import os
PROJECT = 'cloud-training-demos' # REPLACE WITH YOUR PROJECT ID
BUCKET = 'cloud-training-demos-ml' # REPLACE WITH YOUR BUCKET NAME
REGION = 'us-central1' # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# For Python Code
# Model Info
MODEL... |
samuxiii/notebooks | houses/House Prices Clean.ipynb | apache-2.0 | import numpy as np
import pandas as pd
#load the files
train = pd.read_csv('input/train.csv')
test = pd.read_csv('input/test.csv')
data = pd.concat([train, test])
#size of training dataset
train_samples = train.shape[0]
#print some of them
data.head()
# remove the Id feature, because is not useful for price predict... |
samuelsinayoko/kaggle-housing-prices | ols/regression_numerical_features_only.ipynb | mit | dfnum_t2 = pd.read_csv('transformed_dataset_dfnum_t2.csv', index_col=['Dataset','Id'])
dfnum_t2.head()
dfnum_t2.tail()
"""
Explanation: Load numerical data
Generated in notebook data_exploration_numerical_features.ipynb
End of explanation
"""
target = pd.read_csv('../data/train_target.csv')
scaler = sk.preprocess... |
sameera2004/bluesky | examples/Blue Sky Demo.ipynb | bsd-3-clause | from bluesky import Mover, SynGauss, Msg, RunEngine
motor = Mover('motor', ['pos'])
det = SynGauss('det', motor, 'pos', center=0, Imax=1, sigma=1)
"""
Explanation: Blue Sky Run Engine
Contents:
The Run Engine processes messages
There is two-way communication between the message generator and the Run Engine
Control t... |
google-research/google-research | understanding_convolutions_on_graphs/SpectralRepresentations.ipynb | apache-2.0 | #@title License
# 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
# distrib... |
ctroupin/OceanData_NoteBooks | PythonNotebooks/PlatformPlots/Read_TimeSeries_1.ipynb | gpl-3.0 | datafile = "~/CMEMS_INSTAC/INSITU_MED_NRT_OBSERVATIONS_013_035/history/mooring/IR_TS_MO_61198.nc"
import os
datafile = os.path.expanduser(datafile)
"""
Explanation: The goal is to see how we can read the data contained in a netCDF file. Several possibilities will be examined.
Reading a local file
Let's assume we have... |
macks22/gensim | docs/notebooks/sklearn_api.ipynb | lgpl-2.1 | from gensim.sklearn_api import LdaTransformer
"""
Explanation: Using wrappers for Scikit learn API
This tutorial is about using gensim models as a part of your scikit learn workflow with the help of wrappers found at gensim.sklearn_integration
The wrappers available (as of now) are :
* LdaModel (gensim.sklearn_api.lda... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/end-to-end-structured/labs/1a_explore_data_babyweight.ipynb | apache-2.0 | from google.cloud import bigquery
"""
Explanation: LAB 1a: Exploring natality dataset.
Learning Objectives
Use BigQuery to explore natality dataset
Use Vertex AI Notebooks to plot data explorations
Introduction
In this notebook, we will explore the natality dataset before we begin model development and training to ... |
biosustain/cameo-notebooks | Advanced-SynBio-for-Cell-Factories-Course/Genome-scale metabolic reconstruction.ipynb | apache-2.0 | from sympy import Matrix, Eq, var
from cameo import models
model = models.bigg.iJO1366
len(model.reactions)
len(model.metabolites)
len(model.genes)
model.medium
print(model.objective)
"""
Explanation: Genome-scale metabolic reconstruction
End of explanation
"""
S = model.to_array_based_model().S.todense()
S
... |
exe0cdc/PyscesToolbox | example_notebooks/Symca.ipynb | bsd-3-clause | mod = pysces.model('lin4_fb')
mod.doLoad() # this method call is necessary to ensure that future `doLoad` method calls are executed correctly
sc = psctb.Symca(mod)
"""
Explanation: Symca
Symca is used to perform symbolic metabolic control analysis [1] on metabolic pathway models in order to dissect the control propert... |
Kappa-Dev/ReGraph | examples/Tutorial_rules.ipynb | mit | from regraph import NXGraph, Rule, plot_rule
"""
Explanation: Rewriting rules in ReGraph
In the context of ReGraph, by rewriting rules we mean the rules of sesqui-pushout rewriting (see more details here). A rewriting rule consists of the three graphs: $p$ – preserved part, $lhs$ – left hand side, $rhs$ – right hand s... |
GoogleCloudPlatform/cloudml-samples | pytorch/notebooks/Serving PyTorch Models with CMLE Custom Prediction Code.ipynb | apache-2.0 | import sys
# If you are running this notebook in Colab, run this cell and follow the
# instructions to authenticate your GCP account. This provides access to your
# Cloud Storage bucket and lets you submit training jobs and prediction
# requests.
if 'google.colab' in sys.modules:
from google.colab import auth as go... |
SubhankarGhosh/NetworkX | 5. Loading and Visualizing Network Data (Instructor).ipynb | mit | # This block of code checks to make sure that a particular directory is present.
if "divvy_2013" not in os.listdir('datasets/'):
print('Unzip the divvy_2013.zip file in the datasets folder.')
stations = pd.read_csv('datasets/divvy_2013/Divvy_Stations_2013.csv', parse_dates=['online date'], index_col='id', encoding... |
harmsm/pythonic-science | chapters/03_dealing-with-files/01_parsing-a-pdb_key.ipynb | unlicense | #record atom_name chain x y z occupancy atom_type
# | | | | | | | |
#ATOM 1086 CG LYS A 141 -4.812 9.683 2.584 1.00 26.78 N0
# | | | |
# atom_... |
javoweb/deep-learning | intro-to-rnns/RNN Albert Camus.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... |
M-R-Houghton/euroscipy_2015 | scikit_image/lectures/4_segmentation.ipynb | mit | import numpy as np
from matplotlib import pyplot as plt
import skdemo
plt.rcParams['image.cmap'] = 'spectral'
from skimage import io, segmentation as seg, color
url = '../images/spice_1.jpg'
image = io.imread(url)
labels = seg.slic(image, n_segments=18, compactness=10)
skdemo.imshow_all(image, labels.astype(float) /... |
davidrpugh/sfi-complexity-mooc | notebooks/cobweb-models.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import functools
import ipywidgets
import matplotlib.pyplot as plt
import numpy as np
from scipy import optimize
import seaborn as sns
import cobweb
def observed_price(D_inverse, S, expected_price, **params):
"""The observed price of goods in a particular ... |
xiph/rav1e | doc/regress_log-bitrate_wrt_log-quantizer.ipynb | bsd-2-clause | %matplotlib inline
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('svg')
from matplotlib import pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
from glob import glob
import numpy as np
from pprint import pprint
import tarfile
from tqdm import tqdm_notebook
# Klotz, Jerome H. "UPDATING S... |
Kaggle/learntools | notebooks/data_viz_to_coder/raw/tut1.ipynb | apache-2.0 | import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
print("Setup Complete")
"""
Explanation: Welcome to Data Visualization!
In this hands-on course, you'll learn how to take your data visualizations to the next level with seaborn, a ... |
peterwittek/qml-rg | Archiv_Session_Spring_2017/Exercises/11 Markov random field.ipynb | gpl-3.0 | def prep_datas(pic, size):
X=resize(pic,(size,size)) # reduce the size of the image from 100X100 to 32X32. Also flattens the color levels
X=np.reshape(X,size**2) # reshape from 32x32 to a flat 1024 vector
X=np.array(X) # transforms it into an array
for j in range(len(X)): # let's binarized the... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_ica_from_raw.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne.preprocessing import ICA
from mne.preprocessing import create_ecg_epochs, create_eog_epochs
from mne.datasets import sample
"... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodyna... |
loli/medpy | notebooks/Simple binary image processing.ipynb | gpl-3.0 | %matplotlib inline
from medpy.io import load
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
i, h = load("flair.nii.gz")
i[np.random.randint(0, i.shape[0], int(0.05 * i.size)), np.random.randint(0, i.shape[1], int(0.05 * i.size))] = i.min()
i[np.random.randint(0, i.shape[0], int(0.05 * ... |
nbokulich/short-read-tax-assignment | ipynb/cross-validated/evaluate-classification.ipynb | bsd-3-clause | from tax_credit.framework_functions import (novel_taxa_classification_evaluation,
extract_per_level_accuracy)
from tax_credit.eval_framework import parameter_comparisons
from tax_credit.plotting_functions import (pointplot_from_data_frame,
... |
ThomasProctor/Slide-Rule-Data-Intensive | statistics project 2/sliderule_dsi_inferential_statistics_exercise_2.ipynb | mit | import pandas as pd
import numpy as np
from scipy import stats
from math import sqrt
data = pd.io.stata.read_stata('data/us_job_market_discrimination.dta')
black=data[data.race=='b']
white=data[data.race=='w']
"""
Explanation: Examining racial discrimination in the US job market
Background
Racial discrimination con... |
vterron/Taller-Optimizacion-Python-Pyomo | 04_TransportProblem.ipynb | mit | # Import of the pyomo module
from pyomo.environ import *
# Creation of a Concrete Model
model = ConcreteModel()
"""
Explanation: <img src="static/pybofractal.png" alt="Pybonacci" style="width: 200px;"/>
<img src="static/cacheme_logo.png" alt="CAChemE" style="width: 300px;"/>
The Transport Problem
Note: Adapted from... |
JonathanReeve/JonathanReeve.github.io | content/presentations/dataviz-2017/.ipynb_checkpoints/dataviz-workshop-checkpoint.ipynb | gpl-2.0 | # Get the Natural Language Processing Toolkit
import nltk
nltk.download('book') # You only need to run this command once, to get the NLTK book data.
# Get the data science package Pandas
import pandas as pd
# Get the library matplotlib for making pretty charts
import matplotlib
import matplotlib.pyplot as plt
# Ma... |
juditacs/labor | notebooks/pandas_labor_2020.ipynb | lgpl-3.0 | import pandas as pd
if pd.__version__ < '1':
print("WARNING: Pandas version older than 1.0.0: {}".format(pd.__version__))
else:
print("Pandas version OK: {}".format(pd.__version__))
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#YOUR-NAME-(NEPTUN)" data-toc-modified-id="YOUR-NAME-(N... |
timnon/pyschedule | example-notebooks/bike-shop.ipynb | apache-2.0 | from pyschedule import Scenario, solvers, plotters
S = Scenario('bike_paint_shop', horizon=10)
"""
Explanation: Alice and Bob optimize their bike paint shop with pyschedule
Alice and Bob are running a paint shop for bikes where they pimp bikes with fresh colors. Today they have to paint a green and a red bike. To get ... |
xtr33me/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
astro4dev/OAD-Data-Science-Toolkit | Teaching Materials/Programming/Python/Python3Espanol/1_Introduccion/04. Tortugas.ipynb | gpl-3.0 | import turtle # necesitamos un módulo llamado turtle para esta parte
ventana = turtle.Screen() # crea una ventana para dibujar
henry = turtle.Turtle() # crea una tortuga (cursor) que se llama henry
henry.forward(150) # le decimos a henry que avance 150 pasos
henry.left... |
wrightaprilm/squamates | ExploratoryNotebooks/Change_counter.ipynb | mit | import dendropy
import pandas as pd
"""
Explanation: This notebook counts the number of evolutions and reversions in a binary trait on a large phylogenetic tree.
Import the dependencies - Dendropy and Pandas
End of explanation
"""
data = pd.read_csv('../Data/PyronParityData.csv', index_col=0, header=False)
taxa = d... |
taesiri/noteobooks | old:misc/prophecies/Prophecy.ipynb | mit | import pandas as pd
import numpy as np
from fbprophet import Prophet
import time
import seaborn as sns
import matplotlib.pyplot as plt
import datetime
%matplotlib inline
import bs4
bs4.__version__
'4.4.1'
import html5lib
html5lib.__version__
'0.9999999'
# top 15 coins - at the time of writing this!
coins = ['bit... |
char-lie/python_presentations | ctypes/change_integer.ipynb | mit | from ctypes import cdll
"""
Explanation: Basic example
Multiplication of two integer numbers is pretty simple.
Additional information can be found in the documentation.
Write C code
First of all you should open your favourite text editor and write C code there.
Linux
We want to multiply two integers and get integer as... |
GoogleCloudPlatform/ml-design-patterns | 06_reproducibility/bridging_schema.ipynb | apache-2.0 | import pandas as pd
import numpy as np
import seaborn as sns
sns.set(rc={'figure.figsize':(10, 10)})
def set_payment_type(prob):
# 30% of transactions are cash
if prob < 0.3:
return 'Cash'
# stretch the remaining 0.3-1.0 to 0-1
prob = (prob-0.3)/0.7
if prob < 0.1:
return 'Gift'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.