repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
junghao/fdsn | examples/GeoNet_FDSN_demo_clients.ipynb | mit | from obspy.core import UTCDateTime
from obspy.clients.fdsn import Client
arc_client = 'http://service.geonet.org.nz'
# or arc_client = "GEONET"
nrt_client = 'http://service-nrt.geonet.org.nz'
"""
Explanation: GeoNet FDSN webservice with Obspy demo - GeoNet FDSN Clients
GeoNet operates two FDNS wave servers
- An arch... |
spencerchan/ctabus | notebooks/55 Garfield late-afternoon wait and travel time analysis.ipynb | gpl-3.0 | garfield_red_eb = pd.read_csv("../data/processed/trips_and_waits/55/GarfieldRed_eb.csv")
garfield_red_eb["hr_bin"] = pd.cut(garfield_red_eb.decimal_time, np.linspace(0, 24, num=24+1), labels=np.linspace(0, 23, num=24), right=False)
"""
Explanation: Wait/Travel Time Analysis Draft
The question
This project began as an ... |
tensorflow/docs-l10n | site/zh-cn/tutorials/keras/keras_tuner.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... |
PySEE/PyRankine | notebook/RankineCycle83-84.ipynb | mit | from seuif97 import *
# Fix the states
# State1
t1=480
p1=8
h1 =pt2h(p1,t1)
s1=pt2s(p1,t1)
# State 2
p2=0.7
s2=s1
h2 =ps2h(p2,s2)
t2=ps2t(p2,s2)
# State 3
t3=440
p3=p2
h3 =pt2h(p3,t3)
s3 =pt2s(p3,t3)
# State 4
p4=0.008
s4=s3
h4 =ps2h(p4,s4)
t4=ps2t(p4,s4)
# State 5
p5=0.008
t5=px2t(p5,0)
h5=px2h(p5,0)
s5=px2s(p... |
NeuPhysics/aNN | ipynb/vacuum-Copy1.ipynb | mit | # This line configures matplotlib to show figures embedded in the notebook,
# instead of opening a new window for each figure. More about that later.
# If you are using an old version of IPython, try using '%pylab inline' instead.
%matplotlib inline
%load_ext snakeviz
import numpy as np
from scipy.optimize import mi... |
xesscorp/skidl | examples/skywater/skywater.ipynb | mit | import pandas as pd # For data frames.
import matplotlib.pyplot as plt # For plotting.
from skidl.pyspice import * # For describing circuits and interfacing to ngspice.
"""
Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.10 remove duplicates from seq order.ipynb | gpl-3.0 | def dedupe(items):
seen = set()
for item in items:
if item not in seen:
yield item
seen.add(item)
"""
Explanation: Previous
1.10 删除序列相同元素并保持顺序
问题
怎样在一个序列上面保持元素顺序的同时消除重复的值?
解决方案
如果序列上的值都是 hashable 类型,那么可以很简单的利用集合或者生成器来解决这个问题。比如:
End of explanation
"""
a = [1, 5, 2, 1, 9, 1, 5, ... |
deroneriksson/incubator-systemml | samples/jupyter-notebooks/Autoencoder.ipynb | apache-2.0 | !pip show systemml
import pandas as pd
from systemml import MLContext, dml
ml = MLContext(sc)
print(ml.info())
sc.version
"""
Explanation: Autoencoder
This notebook demonstrates the invocation of the SystemML autoencoder script, and alternative ways of passing in/out data.
This notebook is supported with SystemML 0.1... |
Leguark/GeMpy | Prototype Notebook/Sandstone Project_legacy.ipynb | mit | # Setting extend, grid and compile
# Setting the extent
sandstone = GeoMig.Interpolator(696000,747000,6863000,6950000,-20000, 2000,
range_var = np.float32(110000),
u_grade = 9) # Range used in geomodeller
# Setting resolution of the grid
sandstone.set_reso... |
ProfessorKazarinoff/staticsite | content/code/statistics/mean_median_mode_stdev_statistics_module.ipynb | gpl-3.0 | from statistics import mean, median, mode, stdev
test_scores = [60 , 83, 83, 91, 100]
"""
Explanation: In this post, we'll look at a couple of statistics functions in Python. These statistics functions are part of the Python Standard Library in the statistics module. The four functions we'll use in this post are comm... |
mathLab/RBniCS | tutorials/13_elliptic_optimal_control/tutorial_elliptic_optimal_control_2_pod.ipynb | lgpl-3.0 | from dolfin import *
from rbnics import *
"""
Explanation: TUTORIAL 13 - Elliptic Optimal Control
Keywords: optimal control, inf-sup condition, POD-Galerkin
1. Introduction
This tutorial addresses a distributed optimal control problem for the Graetz conduction-convection equation on the domain $\Omega$ shown below:
<i... |
karlstroetmann/Artificial-Intelligence | Python/1 Search/Iterative-Deepening-A-Star-Search.ipynb | gpl-2.0 | def search(start, goal, next_states, heuristic):
limit = heuristic(start, goal)
while True:
print(f'Trying to find a solution of length {limit}.')
Path = dl_search([start], goal, next_states, limit, heuristic)
if isinstance(Path, list):
return Path
limit = Path
"""
E... |
tiagofabre/tiagofabre.github.io | _notebooks/Radial basis function.ipynb | mit | def rbf(inp, out, center):
def euclidean_norm(x1, x2):
return sqrt(((x1 - x2)**2).sum(axis=0))
def gaussian (x, c):
return exp(+1 * pow(euclidean_norm(x, c), 2))
R = np.ones((len(inp), (len(center) + 1)))
for i, iv in enumerate(inp):
for j, jv in enumerate(center):
... |
tensorflow/docs-l10n | site/en-snapshot/lite/guide/signatures.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... |
broundy/udacity | nanodegrees/deep_learning_foundations/unit_1/lesson_11_intro_to_tflearn/Sentiment analysis with TFLearn.ipynb | unlicense | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
"""
Explanation: Sentiment analysis with TFLearn
In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w... |
jmhsi/justin_tinker | data_science/courses/deeplearning1/nbs/lesson4.ipynb | apache-2.0 | ratings = pd.read_csv(path+'ratings.csv')
ratings.head()
len(ratings)
"""
Explanation: Set up data
We're working with the movielens data, which contains one rating per row, like this:
End of explanation
"""
movie_names = pd.read_csv(path+'movies.csv').set_index('movieId')['title'].to_dict()
users = ratings.userId.... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/cmip6/models/miroc-es2l/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'miroc-es2l', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: MIROC
Source ID: MIROC-ES2L
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Tu... |
yunqu/PYNQ | boards/Pynq-Z1/base/notebooks/pmod/pmod_grove_tmp.ipynb | bsd-3-clause | from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
"""
Explanation: Grove Temperature Sensor 1.2
This example shows how to use the Grove Temperature Sensor v1.2. You will also see how to plot a graph using matplotlib. The Grove Temperature sensor produces an analog signal, and requires an ADC.
... |
cliburn/sta-663-2017 | scratch/Lecture04.ipynb | mit | import numpy as np
import numpy.random as npr
x = np.array([1,2,3])
x2 = np.array([[1,2,3],[4,5,6]])
x.max()
np.max(x)
x2.shape
x2.size
x2.dtype
x2.strides
x3 = np.fromstring('1-2-3', sep='-', dtype='int')
x3.dtype
x3
x3.astype('complex')
%%file foo.txt
123-456-789abc
abc234-23-99x
np.fromregex('foo.txt',... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/prod/n10_dyna_q_with_predictor.ipynb | mit | # Basic imports
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
import scipy.optimize as spo
import sys
from time import time
from sklearn.metrics import r2_score, median_absolute_error
from multiprocessing import Pool
import pickle
%matplotlib inline
%pylab inli... |
daler/metaseq | doc/source/example_session_2.ipynb | mit | # Enable in-line plots for this IPython Notebook
%matplotlib inline
"""
Explanation: Example 2: Differential expression scatterplots
This example looks more closely at using the results table part of :mod:metaseq, and highlights the flexibility in plotting afforded by :mod:metaseq.
End of explanation
"""
import meta... |
CUBoulder-ASTR2600/lectures | lecture_09_functions_2.ipynb | isc | from math import exp
# Could avoid this by using our constants.py module!
h = 6.626e-34 # MKS
k = 1.38e-23
c = 3.00e8
def intensity(wave, temp, mydefault=0):
wavelength = wave / 1e10
B = 2 * h * c**2 / (wavelength**5 * (exp(h * c / (wavelength * k * temp)) - 1))
return B
"""
Explanation: Today: More on ... |
jswoboda/SimISR | ExampleNotebooks/SpecEstimator.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import scipy as sp
import scipy.fftpack as scfft
from SimISR.utilFunctions import makesumrule,MakePulseDataRepLPC,spect2acf,acf2spect,CenteredLagProduct
from SimISR.IonoContainer import IonoContainer,MakeTestIonoclass
from ISRSpectrum.ISRSpectrum import ISRSpectrum
imp... |
mromanello/SunoikisisDC_NER | participants_notebooks/Sunoikisis - Named Entity Extraction 1b-G3.ipynb | gpl-3.0 | ########
# NLTK #
########
import nltk
from nltk.tag import StanfordNERTagger
########
# CLTK #
########
import cltk
from cltk.tag.ner import tag_ner
##############
# MyCapytain #
##############
import MyCapytain
from MyCapytain.resolvers.cts.api import HttpCTSResolver
from MyCapytain.retrievers.cts5 import CTS
from M... |
autism-research-centre/Autism-Gradients | 6b_networks-inside-gradients.ipynb | gpl-3.0 | % matplotlib inline
from __future__ import print_function
import nibabel as nib
from nilearn.image import resample_img
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
import os.path
# The following are a progress bar, these are not strictly necessary:
from ipywidgets import FloatP... |
ssanderson/notebooks | quanto/Quantopian_Meetup_Talk_IPython_Notebook.ipynb | apache-2.0 | # This is a python execution cell.
# Anything you could do in a python shell or script, you can do here.
# To execute a cell, type CTRL-Enter.
# You can also type SHIFT-Enter to execute and move to the next cell,
# and you can type OPTION-Enter to execute and insert a new cell below.
def foo():
print "IPython Not... |
scotthuang1989/Python-3-Module-of-the-Week | algorithm/contextlib.ipynb | apache-2.0 | with open('tmp/pymotw.txt', 'wt') as f:
f.write('contents go here')
"""
Explanation: The contextlib module contains utilities for working with context managers and the with statement.
Context Manager API
A context manager is responsible for a resource within a code block, possibly creating it when the block is ent... |
tensorflow/docs-l10n | site/en-snapshot/tfx/tutorials/tfx/template_local.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... |
AllenDowney/ModSim | python/soln/chap06.ipynb | gpl-2.0 | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
mikelseverson/Udacity-Deep_Learning-Nanodegree | dcgan-svhn/DCGAN.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... |
AllenDowney/ProbablyOverthinkingIt | ess.ipynb | mit | from __future__ import print_function, division
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
%matplotlib inline
"""
Explanation: Internet use and religion in Europe
This notebook presents a quick-and-dirty analysis of the association between Internet use and religion in Europe, using... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/automl_for_text_classification.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: AutoML for Text Classification
Learning Objectives
Learn how to create a text classification dataset for AutoML using BigQuery
Learn how to train AutoML to build a text classification model
Learn how to ... |
dereneaton/ipyrad | newdocs/API-analysis/cookbook-window_extracter.ipynb | gpl-3.0 | # conda install ipyrad -c bioconda
# conda install raxml -c bioconda
# conda install toytree -c eaton-lab
import ipyrad.analysis as ipa
import toytree
"""
Explanation: <span style="color:gray">ipyrad-analysis toolkit:</span> window_extracter
View as notebook
Extract all sequence data within a genomic window, concaten... |
elfi-dev/notebooks | quickstart.ipynb | bsd-3-clause | import elfi
"""
Explanation: Quickstart
First ensure you have installed Python 3.5 (or greater) and ELFI. After installation you can start using ELFI:
End of explanation
"""
mu = elfi.Prior('uniform', -2, 4)
sigma = elfi.Prior('uniform', 1, 4)
"""
Explanation: ELFI includes an easy to use generative modeling syntax... |
berlemontkevin/Jupyter_Notebook | Inference_Big_data/Hopfield/Hopfield.ipynb | apache-2.0 |
%%html
<script src="https://cdn.rawgit.com/parente/4c3e6936d0d7a46fd071/raw/65b816fb9bdd3c28b4ddf3af602bfd6015486383/code_toggle.js"></script>
"""
Explanation: TD 3 : Hopfield model : Berlemont Kevin
Hopfield network : An introduction
The Hopfield model , consists of a network of $N$ neurons, labeled by a lower index... |
mspcvsp/cincinnati311Data | Cincinnati311DataEDA.ipynb | gpl-3.0 | from Cincinnati311CSVDataParser import Cincinnati311CSVDataParser
from csv import DictReader
import os
import re
import urllib2
"""
Explanation: Setup Software Environment
End of explanation
"""
data_dir = "./Data"
csv_file_path = os.path.join(data_dir, "cincinnati311.csv")
if not os.path.exists(csv_file_path):
... |
georgetown-analytics/yelp-classification | data_analysis/Basic_Review_Analysis-ed-Copy.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
import json
import pandas as pd
import csv
import os
import re
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn import svm
from sklearn.linear_model import SGDClassifier
from sklear... |
YannickJadoul/Parselmouth | docs/examples/psychopy_experiments.ipynb | gpl-3.0 | # ** Begin Experiment **
import parselmouth
import numpy as np
import random
conditions = ['a', 'e']
stimulus_files = {'a': "audio/bat.wav", 'e': "audio/bet.wav"}
STANDARD_INTENSITY = 70.
stimuli = {}
for condition in conditions:
stimulus = parselmouth.Sound(stimulus_files[condition])
stimulus.scale_intensit... |
ddandur/Twords | jupyter_example_notebooks/Trump Tweets Example.ipynb | mit | import sys
sys.path.append('..')
from twords.twords import Twords
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
# this pandas line makes the dataframe display all text in a line; useful for seeing entire tweets
pd.set_option('display.max_colwidth', -1)
twit = Twords()
# set path to folder th... |
moonbury/pythonanywhere | github/MasteringMatplotlib/mmpl-custom-and-config.ipynb | gpl-3.0 | import matplotlib
matplotlib.use('nbagg')
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from IPython.display import Image
"""
Explanation: Advanced Customization and Configuration
Table of Contents
Introduction
Customization
matplotlib Styles
Subpl... |
dennisproppe/fp_python | fp_lesson_2_partials.ipynb | apache-2.0 | from functools import partial
"""
Explanation: Partials
Partials really help using functional concepts in Python. Using a partial just means executing a function with a partial argument list, which return another function, with the partials arguments alerady "filled".
Can make classes that are just used as attribute c... |
robertoalotufo/ia898 | dev/widgets_ImageProcessing.ipynb | mit | # Stdlib imports
from io import BytesIO
# Third-party libraries
from IPython.display import Image
from ipywidgets import interact, interactive, fixed
import matplotlib as mpl
from skimage import data, filters, io, img_as_float
"""
Explanation: Image Manipulation with skimage
This examples was taken from ipywidgets tu... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/building_production_ml_systems/solutions/0_export_data_from_bq_to_gcs.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
#%load_ext google.cloud.bigquery
import os
from google.cloud import bigquery
"""
Explanation: Exporting data from BigQuery to Google Cloud Storage
In this notebook, we export BigQuery data to GCS so that we can reuse our Keras model that was develop... |
mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/ssd-tpuv3-8/code/ssd/model/tpu/tools/colab/fashion_mnist.ipynb | apache-2.0 | import tensorflow as tf
import numpy as np
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()
# add empty color dimension
x_train = np.expand_dims(x_train, -1)
x_test = np.expand_dims(x_test, -1)
"""
Explanation: Fashion MNIST with Keras and TPUs
<table class="tfo-notebook-buttons" al... |
chapman-phys227-2016s/hw-3-ChinmaiRaman | HW3Notebook.ipynb | mit | p1.loan(6, 10000, 12)
"""
Explanation: Chinmai Raman
Homework 3
A.4 Solving a system of difference equations
Computes the development of a loan over time.
The below function calculates the amount paid per month (the first array) and the amount left to be paid (the second array) at each month of the year at a principal... |
dafrie/lstm-load-forecasting | notebooks/1_entsoe_forecast_only.ipynb | mit | # Model category name used throughout the subsequent analysis
model_cat_id = "01"
# Which features from the dataset should be loaded:
# ['all', 'actual', 'entsoe', 'weather_t', 'weather_i', 'holiday', 'weekday', 'hour', 'month']
features = ['actual', 'entsoe']
# LSTM Layer configuration
# ========================
# S... |
mne-tools/mne-tools.github.io | 0.21/_downloads/59a29cf7eb53c7ab95857dfb2e3b31ba/plot_40_sensor_locations.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.07 keep dict in order.ipynb | gpl-3.0 | from collections import OrderedDict
d = OrderedDict()
d["foo"] = 1
d["bar"] = 2
d["spam"] = 3
d["grok"] = 4
# Outputs "foo 1", "bar 2", "spam 3", "grok 4"
for key in d:
print(key, d[key])
"""
Explanation: Previous
1.7 字典排序
问题
你想创建一个字典,并且在迭代或序列化这个字典的时候能够控制元素的顺序。
解决方案
为了能控制一个字典中元素的顺序,你可以使用 collections 模块中的 OrderedD... |
Hasil-Sharma/Neural-Networks-CS231n | assignment1/features.ipynb | gpl-3.0 | import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
%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-reloading extenrnal modu... |
mne-tools/mne-tools.github.io | 0.20/_downloads/59a29cf7eb53c7ab95857dfb2e3b31ba/plot_40_sensor_locations.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io... |
ChileanVirtualObservatory/DISPLAY | src/experiments/DISPLAY - 2011.0.00419.S O2-28_2_26-28_1_27.ipynb | gpl-3.0 | file_path = '../data/2011.0.00419.S/sg_ouss_id/group_ouss_id/member_ouss_2013-03-06_id/product/IRAS16547-4247_Jet_SO2-28_2_26-28_1_27.clean.fits'
noise_pixel = (15, 4)
train_pixels = [(133, 135),(134, 135),(133, 136),(134, 136)]
img = fits.open(file_path)
meta = img[0].data
hdr = img[0].header
# V axis
naxisv = hdr[... |
sarahmid/programming-bootcamp-v2 | lab5_exercises.ipynb | mit | # run this cell first!
fruits = {"apple":"red", "banana":"yellow", "grape":"purple"}
print fruits["banana"]
"""
Explanation: Programming Bootcamp 2016
Lesson 5 Exercises
Earning points (optional)
Enter your name below.
Email your .ipynb file to me (sarahmid@mail.med.upenn.edu) before 9:00 am on 9/23.
You do not ... |
changshuaiwei/Udc-ML | student_intervention/student_intervention.ipynb | gpl-3.0 | # Import libraries
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics import f1_score
# Read student data
student_data = pd.read_csv("student-data.csv")
print "Student data read successfully!"
#set global seed
global_seed = 0
"""
Explanation: Machine Learning Engineer Nanodegree
Superv... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/09_sequence_keras/poetry.ipynb | apache-2.0 | %%bash
pip freeze | grep tensor
# Choose a version of TensorFlow that is supported on TPUs
TFVERSION='1.13'
import os
os.environ['TFVERSION'] = TFVERSION
%%bash
pip install tensor2tensor==${TFVERSION} gutenberg
# install from sou
#git clone https://github.com/tensorflow/tensor2tensor.git
#cd tensor2tensor
#yes | pi... |
mne-tools/mne-tools.github.io | stable/_downloads/8de61cd59c9d83353f96a413e8484686/compute_mne_inverse_raw_in_label.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import apply_inverse_raw, read_inverse_operator
print(__doc__)
data_path = sample.data_path()
fname_inv = (
data_path / 'MEG' / 's... |
kirichoi/tellurium | examples/notebooks/core/roadrunnerBasics.ipynb | apache-2.0 | from __future__ import print_function
import tellurium as te
te.setDefaultPlottingEngine('matplotlib')
%matplotlib inline
model = """
model test
compartment C1;
C1 = 1.0;
species S1, S2;
S1 = 10.0;
S2 = 0.0;
S1 in C1; S2 in C1;
J1: S1 -> S2; k1*S1;
k1 = 1.0;
end
"""
# load mod... |
sujitpal/polydlot | src/tf-serving/01a-mnist-cnn-keras-in-tf.ipynb | apache-2.0 | from __future__ import division, print_function
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import accuracy_score, confusion_matrix
import numpy as np
import matplotlib.pyplot as plt
import os
import shutil
import tensorflow as tf
%matplotlib inline
DATA_DIR = "../../data"
TRAIN_FILE = os.path... |
nwilbert/async-examples | notebook/aio36.ipynb | mit | import asyncio
loop = asyncio.get_event_loop()
"""
Explanation: asyncio IO Loop
Create an event loop (which automatically becomes the default event loop in the context).
End of explanation
"""
def hello_world():
print('Hello World!')
loop.stop()
loop.call_soon(hello_world)
loop.run_forever()
"""
Explanatio... |
gangadhara691/gangadhara691.github.io | P5 machine_learning/report_p5.ipynb | mit | #!/usr/bin/python
import sys
import pickle
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
from tester import dump_classifier_and_data
### Task 1: Select what features you'll use.
### features_list is a list of strings, each of which is a feature name.
### The first feature ... |
jwyang/joint-unsupervised-learning | matlab/approaches/nmf-deep/Deep-Semi-NMF-master/Deep Semi-NMF.ipynb | mit | %load_ext autoreload
%autoreload 2
%matplotlib inline
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import sklearn
from sklearn.cluster import KMeans
from dsnmf import DSNMF, appr_seminmf
from scipy.io import loadmat
mat = loadmat('PIE_pose27.mat', struct_as_record=False, ... |
unpingco/Python-for-Probability-Statistics-and-Machine-Learning | chapters/probability/notebooks/intro.ipynb | mit | d={(i,j):i+j for i in range(1,7) for j in range(1,7)}
"""
Explanation: Python for Probability, Statistics, and Machine Learning
This chapter takes a geometric view of probability theory and relates it to
familiar concepts in linear algebra and geometry. This approach connects your
natural geometric intuition to the k... |
steven-murray/halomod | devel/halo_exclusion_testing.ipynb | mit | %pylab inline
"""
Explanation: Interactive Tests of Python-Implemented Halo Exclusion
End of explanation
"""
m = np.logspace(10,18,400)
density = m**-2
I = np.outer(np.ones(10),m**-4)
bias = m**2
deltah = 200.0
rhob = 10.**11
r = np.logspace(-1,2,40)
"""
Explanation: First we set up the "test" as it were, hoping to... |
intel-analytics/BigDL | python/orca/colab-notebook/quickstart/keras_lenet_mnist.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... |
vlad17/vlad17.github.io | assets/2020-10-25-linear-degeneracy.ipynb | apache-2.0 | import numpy as np
%matplotlib inline
import scipy.linalg as sla
np.random.seed(1234)
def invdiag(X):
n, p = X.shape
assert p <= n
Q, R, P = sla.qr(X, pivoting=True, mode='economic')
# P is a permutation, so right mul selects columns
# and left mul selects rows, but the indices are
# returned a... |
markvanheeswijk/kryptos | Kryptos.ipynb | mit | def rot(s, key, alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ", direction=1):
keyval = alphabet.find(key)
t = ""
for sc in s:
i = alphabet.find(sc)
t += alphabet[(i + keyval * direction) % len(alphabet)] if i > -1 else sc
return t
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item">... |
mne-tools/mne-tools.github.io | dev/_downloads/2d3a2ce4cdcb2dad9804801c80816516/parcellation.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD-3-Clause
import mne
Brain = mne.viz.get_brain_class()
subjects_dir = mne.datasets.sample.data_path() / 'subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
... |
andmax/gpufilter | python/alg5pe.ipynb | mit | import math
import cmath
import numpy as np
from scipy import ndimage, linalg
from skimage.color import rgb2gray
from skimage.measure import structural_similarity as ssim
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
%matplotlib inline
plt.gray() # to plot gray images using gray scale
... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-2/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-2', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: TEST-INSTITUTE-2
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Tra... |
legacysurvey/pipeline | doc/nb/qa-dr8c-maskbits.ipynb | gpl-2.0 | import os, time
import numpy as np
import fitsio
from glob import glob
import matplotlib.pyplot as plt
from astropy.table import vstack, Table, hstack
"""
Explanation: Maskbits QA in dr8c
End of explanation
"""
MASKBITS = dict(
NPRIMARY = 0x1, # not PRIMARY
BRIGHT = 0x2,
SATUR_G = 0x4,
SAT... |
yunfeiz/py_learnt | quant/sample_code/tushare.ipynb | apache-2.0 | import tushare as ts
import pandas as pd
stock_selected='600699'
df1, data1 = ts.top10_holders(code=stock_selected, gdtype='1')
df1 = df1.sort_values('quarter', ascending=True)
df1.tail(10)
#qts = list(df1['quarter'])
#data = list(df1['props'])
#name = ts.get_realtime_quotes(stock_selected)['name'][0]
"""
Explanati... |
keras-team/keras-io | examples/vision/ipynb/keypoint_detection.ipynb | apache-2.0 | !pip install -q -U imgaug
"""
Explanation: Keypoint Detection with Transfer Learning
Author: Sayak Paul<br>
Date created: 2021/05/02<br>
Last modified: 2021/05/02<br>
Description: Training a keypoint detector with data augmentation and transfer learning.
Keypoint detection consists of locating key object parts. For ex... |
ES-DOC/esdoc-jupyterhub | notebooks/cccma/cmip6/models/sandbox-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: CCCMA
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Propertie... |
PythonFreeCourse/Notebooks | week04/2_Dictionaries.ipynb | mit | items = ['banana', 'apple', 'carrot']
stock = [2, 3, 4]
"""
Explanation: <img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם חינמי ללימוד ת... |
hetland/python4geosciences | examples/numpy.ipynb | mit | import os # this package allows us to use terminal window commands from within python
import numpy as np
"""
Explanation: Numpy example: Reading in and analyzing topography/bathymetry data
End of explanation
"""
d = np.load('../data/cascadia.npz') # data was saved in compressed numpy format
"""
Explanation: Read ... |
muxiaobai/CourseExercises | python/kaggle/competition/house-price/house_price.ipynb | gpl-2.0 | import numpy as np
import pandas as pd
"""
Explanation: 房价预测案例
Step 1: 检视源数据集
End of explanation
"""
train_df = pd.read_csv('../input/train.csv', index_col=0)
test_df = pd.read_csv('../input/test.csv', index_col=0)
"""
Explanation: 读入数据
一般来说源数据的index那一栏没什么用,我们可以用来作为我们pandas dataframe的index。这样之后要是检索起来也省事儿。
有人的地方... |
JakeColtman/BayesianSurvivalAnalysis | Basic Presentation.ipynb | mit | ####Data munging here
###Parametric Bayes
#Shout out to Cam Davidson-Pilon
## Example fully worked model using toy data
## Adapted from http://blog.yhat.com/posts/estimating-user-lifetimes-with-pymc.html
## Note that we've made some corrections
N = 2500
##Generate some random data
lifetime = pm.rweibull( 2, 5, si... |
wcmac/sippycup | sippycup-unit-3.ipynb | gpl-2.0 | from geo880 import geo880_train_examples, geo880_test_examples
print('train examples:', len(geo880_train_examples))
print('test examples: ', len(geo880_test_examples))
print(geo880_train_examples[0])
print(geo880_test_examples[0])
"""
Explanation: <img src="img/sippycup-small.jpg" align="left" style="padding-right: 3... |
supergis/git_notebook | pystart/jupyter_magics.ipynb | gpl-3.0 | %lsmagic
"""
Explanation: IPython的魔法符号-Magics
openthings@163.com
最新的Jupyter Notebook可以混合执行Shell、Python以及Ruby、R等代码!
这一功能将解释型语言的特点发挥到了极致,从而打破了传统语言"运行时"的边界。
IPython是一个非常好用Python控制台,极大地扩展了Python的能力。
因为它不仅是一种语言的运行环境,而且是一个高效率的分析工具。
* 之前任何语言和IDE都是相互独立的,导致工作时需要在不同的系统间切换和拷贝/粘贴数据。
* Magic操作符可以在HTML页面中输入shell脚本以及Ruby等其它语言并混合执行,极... |
MadcowD/cs189 | hw5/hw5.ipynb | mit | import numpy as np
import math
from scipy import stats
"""
Explanation: Homework 5 Random Forests and Decision Trees.
End of explanation
"""
# Based on the standard definition of entropy.
def entropy(data, classes):
entr = 0
for cls in classes:
probi = len(cls)/len(data)
entr += -probi*math.l... |
edeno/Jadhav-2016-Data-Analysis | notebooks/2017_06_09_Spectral Granger.ipynb | gpl-3.0 | time_extent = (0, .250)
num_trials = 500
sampling_frequency = 200
num_time_points = ((time_extent[1] - time_extent[0]) * sampling_frequency) + 1
time = np.linspace(time_extent[0], time_extent[1], num=num_time_points, endpoint=True)
signal_shape = (len(time), num_trials)
np.random.seed(2)
def simulate_arma_model(ar_coe... |
taspinar/siml | notebooks/Machine Learning with Signal Processing techniques.ipynb | mit | from siml.sk_utils import *
from siml.signal_analysis_utils import *
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict, Counter
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
"""
Explanation: This Notebook is accompanied by ... |
Kaggle/learntools | notebooks/data_cleaning/raw/ex3.ipynb | apache-2.0 | from learntools.core import binder
binder.bind(globals())
from learntools.data_cleaning.ex3 import *
print("Setup Complete")
"""
Explanation: In this exercise, you'll apply what you learned in the Parsing dates tutorial.
Setup
The questions below will give you feedback on your work. Run the following cell to set up th... |
hcchengithub/project-k | notebooks/tutor.ipynb | mit | # In case you are not familiar with Jupyter Notebook, click here and press Ctrl+Enter to run this cell.
import projectk as vm
vm
"""
Explanation: An introduction to the project-k FORTH kernel
project-k is a very small FORTH programming language kernel supporting Javascript and Python open-sourced on GitHub https://git... |
tkurfurst/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... |
Kaggle/learntools | notebooks/ml_intermediate/raw/ex2.ipynb | apache-2.0 | # Set up code checking
import os
if not os.path.exists("../input/train.csv"):
os.symlink("../input/home-data-for-ml-course/train.csv", "../input/train.csv")
os.symlink("../input/home-data-for-ml-course/test.csv", "../input/test.csv")
from learntools.core import binder
binder.bind(globals())
from learntools.m... |
Upward-Spiral-Science/claritycontrol | code/a06_test_assumptions.ipynb | apache-2.0 | import os
PATH="/Users/david/Desktop/CourseWork/TheArtOfDataScience/claritycontrol/code/scripts/" # use your own path
os.chdir(PATH)
import clarity as cl # I wrote this module for easier operations on data
import clarity.resources as rs
import csv,gc # garbage memory collection :)
import numpy as np
import matplotl... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/building_production_ml_systems/solutions/3_kubeflow_pipelines_vertex.ipynb | apache-2.0 | !pip3 install --user google-cloud-pipeline-components==0.1.1 --upgrade
"""
Explanation: Vertex pipelines
Learning Objectives:
Use components from google_cloud_pipeline_components to create a Vertex Pipeline which will
1. train a custom model on Vertex AI
1. create an endpoint to host the model
1. upload the tra... |
MarneeDear/softwarecarpentry | python lessons/Fundamentals/Introduction.ipynb | mit | example_variable = "ljhkjhkjkgjkg"
# I can display what is inside example_variable by using
# the print command lets us do this
# try changing the value.
print (example_variable)
"""
Explanation: What is Python and why would I use it?
Python is a programming language.
A programming language is a set words you can... |
pvanheus/swc15nwu-python | Loops.ipynb | gpl-3.0 | number = 5
exponent = 3
result = 1
for _ in range(exponent):
result = result * number
print number
"""
Explanation: Challenge:
Write code using for loop and range() that takes a number and computes its exponent.
E.g. if you have 2 and 3, the answer should be 8. Use print to display the result.
Solution:
Use result... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a/td2a_some_nlp.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.ml - Texte et machine learning
Revue de méthodes de word embedding statistiques (~ NLP) ou comment transformer une information textuelle en vecteurs dans un espace vectoriel (features) ? Deux exercices sont ajoutés à la fin.
End of exp... |
yevheniyc/Python | 1j_NLP_Python/ex04.ipynb | mit | from textblob import TextBlob
sent = "That’s a great starting point for developing custom search, content recommenders, and even AI applications."
blob = TextBlob(sent)
repr(blob)
"""
Explanation: Exercise 04: Noun phrase chunking
Sometimes it's useful to use noun phrase chunking to extract key phrases…
End of expla... |
turbomanage/training-data-analyst | blogs/lightning/2_sklearn.ipynb | apache-2.0 | %pip install cloudml-hypertune
BUCKET = 'cloud-training-demos-ml'
PROJECT = 'cloud-training-demos'
REGION = 'us-central1'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
%%bash
gcloud config set project $PROJECT
gcloud config set compute/region $REGION
%load_ext... |
crawles/spark-nba-analytics | nba_spark.ipynb | mit | %matplotlib inline
import os
import numpy as np
import pandas as pd
import seaborn as sns
from nba_utils import draw_3pt_piechart,plot_shot_chart
from IPython.core.display import display, HTML
from IPython.core.magic import register_cell_magic, register_line_cell_magic, register_line_magic
from matplotlib import pyp... |
biosustain/cameo-notebooks | other/co-factor-swapping.ipynb | apache-2.0 | from cameo import models
model_orig = models.bigg.iJO1366
from cameo.strain_design.heuristic.evolutionary.optimization import CofactorSwapOptimization
from cameo.strain_design.heuristic.evolutionary.objective_functions import product_yield
from cameo.strain_design.heuristic.evolutionary.objective_functions import bio... |
alhamdubello/sc-python | 01-csv-data.ipynb | mit | # Python requets Library lets us get data straight from a URL
import requests
url = "http://climatedataapi.worldbank.org/climateweb/rest/v1/country/cru/tas/year/GBR.csv"
response = requests.get(url)
if response.status_code != 200:
print ('Failed to get data:', response.status_code)
else:
print ('First 100 ch... |
amitkaps/hackermath | Module_1e_logistic_regression.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (10, 6)
pop = pd.read_csv('data/cars_small.csv')
pop.head()
"""
Explanation: Logistic Regression (Classification)
So far we have been looking at regression prob... |
johntanz/ROP | Old Code/Masimo160127.ipynb | gpl-2.0 | #the usual beginning
import pandas as pd
import numpy as np
from pandas import Series, DataFrame
from datetime import datetime, timedelta
from pandas import concat
#define any string with 'C' as NaN
def readD(val):
if 'C' in val:
return np.nan
return val
"""
Explanation: Masimo Analysis
For Pulse Ox. ... |
phoebe-project/phoebe2-docs | 2.3/examples/extinction_BK_binary.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Extinction: B-K Binary
In this example, we'll reproduce Figures 1 and 2 in the extinction release paper (Jones et al. 2020).
"Let us begin with a rather extreme case, a synthetic binary comprised of a hot, B-type main sequence star(M=6.5 Msol,Teff=17000 K,... |
Pittsburgh-NEH-Institute/Institute-Materials-2017 | schedule/week_2/collation/tokenization_normalization_collation.ipynb | gpl-3.0 | from collatex import *
collation = Collation()
collation.add_plain_witness( "A", "The quick brown fox jumped over the lazy dog.")
collation.add_plain_witness( "B", "The brown fox jumped over the dog." )
collation.add_plain_witness( "C", "The bad fox jumped over the lazy dog." )
table = collate(collation)
print(table)
... |
seewhydee/ntuphys_nb | jupyter/jupyter_tutorial/jupyter_tutorial_02.ipynb | gpl-3.0 | %matplotlib inline
from scipy import *
import matplotlib.pyplot as plt
from ipywidgets import interact, FloatSlider
## Definition of the plot_cos function, our "callback function".
def plot_cos(phi):
## Plot parameters
xmin, xmax, nx = 0.0, 10.0, 50
ymin, ymax = -1.2, 1.2
## Plot the figure
x ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.