repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
kescobo/gender-comp-bio | notebooks/xml_parsing.ipynb | gpl-3.0 | import os
print(os.getcwd())
os.chdir("../data/pubdata")
os.listdir()
"""
Explanation: Parsing Pubmed XML file
Data sets can be found here.
Goals
Raw data from pubmed is contained in xml files, and we'd like to extract author and date information into a spreadsheet for easier analysis.
The first thing to do is to m... |
ESSS/notebooks | einsum-notebook.ipynb | mit | import numpy as np
"""
Explanation: Einsum Notebook - Einstein Summation
Einstein Notation
In mathematics, especially in applications of linear algebra to physics, the Einstein notation or Einstein summation convention is a notational convention that implies summation over a set of indexed terms in a formula, thus ach... |
sraejones/phys202-2015-work | assignments/assignment09/IntegrationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy import integrate
"""
Explanation: Integration Exercise 1
Imports
End of explanation
"""
def trapz(f, a, b, N):
"""Integrate the function f(x) over the range [a,b] with N points."""
# YOUR CODE HERE
h = (b-a)/N
n = np.ara... |
divyanshusrivastava/NetworkBio | .ipynb_checkpoints/Assignment_1-checkpoint.ipynb | mit | # Import dependencies
import numpy as np
import pickle
import networkx as nx
import matplotlib.pyplot as plt
"""
Explanation: NETWORK BIOLOGY
Assignment 1
Submitted By:
Divyanshu Srivastava (MT16125)
End of explanation
"""
## Undirected Unweighted Graph
G1 = nx.Graph()
G1.add_edges_from([(1, 2), (1, 3), (3, 4), (5, ... |
samuxiii/notebooks | simpsons/Simpsons_Tensorflow.ipynb | apache-2.0 | class Data:
def __init__(self, train_root_path, test_root_path):
self.TRAIN_ROOT_PATH = train_root_path
self.TRAIN_CHARACTER_NAMES = listdir(train_root_path)
self.TRAIN_NUM_CHARACTERS = len(self.TRAIN_CHARACTER_NAMES)
self.TEST_ROOT_PATH = test_root_path
self.TEST_IMAGE_NAME... |
florent-leclercq/borg_sdss_data_release | borg_sdss_velocity/borg_sdss_velocity.ipynb | gpl-3.0 | import numpy as np
velocity = np.load('borg_sdss_velocity.npz')
"""
Explanation: BORG SDSS data products
borg_sdss_velocity package
Authors: Florent Leclercq, Jens Jasche, Guilhem Lavaux, Benjamin Wandelt, Will Percival
Last update: 09/10/2018
This package contains some of the results obtained by Leclercq et al. (20... |
datanuggets/kaggle_rossmann | data/explore.ipynb | gpl-2.0 | !unzip -o '*.csv.zip'
!rm *.zip
ls
!head train.csv
df = pd.read_csv('train.csv')
for c in df.columns:
v = ["2015-07-31", 'etc.'] if c == 'Date' else np.sort(df[c].unique())
hasna = df[c].isnull().any()
print "{}: {}\n has NA values: {}\n".format(c, v, hasna)
data_types = {
"Store": int,
"DayOfW... |
whitead/numerical_stats | unit_6/hw_2018/Homework_6_Key.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
#3.1
p = [0.2, 0.5, 0.8]
n = np.arange(1, 8)
for i, pi in enumerate(p):
plt.plot(n, pi * (1 - pi)**(n - 1), 'o-', label='$p={}$'.format(pi), color='C{}'.format(i))
plt.axvline(x = 1/ pi, color='C{}'.format(i))
plt.title('Problem 3.1 - ... |
phoebe-project/phoebe2-docs | development/tutorials/irrad_method_horvat.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Lambert Scattering (irrad_method='horvat')
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 # unit... |
Cyb3rWard0g/ThreatHunter-Playbook | docs/notebooks/windows/02_execution/WIN-190410151110.ipynb | gpl-3.0 | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Basic PowerShell Execution
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/04/10 |
| modification date | 2020/09/20 |
| playbook related | [] |
Hyp... |
besser82/shogun | doc/ipython-notebooks/clustering/KMeans.ipynb | bsd-3-clause | from numpy import concatenate, array
from numpy.random import randn
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
num = 200
d1 = concatenate((randn(1,num),10.*randn(1,num)),0)
d2 = concatenate((randn(1,num),10.*randn(1,num)),0)+array([[10.],[0.]])
d3 = concatenate((randn(1,num),10.*randn(1,nu... |
sysid/kg | quora/LoadWeights.ipynb | mit | ### imports
from IPython.core.debugger import Tracer
#Tracer()()
import os, sys, time
### prevent the dying jupyter notebook
stdout = sys.stdout
#sys.stdout = sys.__stdout__ # did not work to restoure print -> console
#sys.stdout = open('keras_output.txt', 'a+')
#sys.stdout = stdout
import sys, os, argparse, loggin... |
xuanhan863/polyglot | notebooks/Sentiment.ipynb | gpl-3.0 | from polyglot.downloader import downloader
print(downloader.supported_languages_table("sentiment2", 3))
from polyglot.text import Text
"""
Explanation: Sentiment
Polyglot has polarity lexicons for 136 languages.
The scale of the words' polarity consisted of three degrees: +1 for positive words, and -1 for negatives w... |
adrianstaniec/deep-learning | 06_image-classification/dlnd_image_classification.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10_location = '/input/cifar-10/python.tar.gz'
if isfile(floyd_cifar10... |
wzxiong/DAVIS-Machine-Learning | homeworks/HW2-soln.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import Ridge, RidgeCV, Lasso, LassoCV, lars_path, LogisticRegression
from sklearn.preprocessing import scale
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib... |
kradams/MIDS-W261-2015-Adams | week11/MIDS-W261-2015-HW10-Week11-Adams.ipynb | mit | %cd ~/Documents/W261/hw10/
import os
import sys
spark_home = os.environ['SPARK_HOME'] = \
'/Users/davidadams/packages/spark-1.5.1-bin-hadoop2.6/'
if not spark_home:
raise ValueError('SPARK_HOME enviroment variable is not set')
sys.path.insert(0,os.path.join(spark_home,'python'))
sys.path.insert(0,os.path.join... |
Linlinzhao/linlinzhao.github.io | _drafts/understanding backward() in Pytorch.ipynb | mit | import torch as T
import torch.autograd
import numpy as np
"""
Explanation: Update for PyTorch 0.4:
Earlier versions used Variable to wrap tensors with different properties. Since version 0.4, Variable is merged with tensor, in other words, Variable is NOT needed anymore. The flag require_grad can be directly set in t... |
whitead/numerical_stats | unit_13/lectures/lecture_2.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, pi, erf
import seaborn
seaborn.set_context("talk")
seaborn.set_style("whitegrid")
import scipy.stats
"""
Explanation: Error Propogation
Unit 13, Lecture 2
Numerical Methods and Statistics
Prof. Andrew White, April 26 2018
Goa... |
newworldnewlife/TensorFlow-Tutorials | 01_Simple_Linear_Model.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
"""
Explanation: TensorFlow Tutorial #01
Simple Linear Model
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
Introduction
This tutorial demonstrates the basic workflow o... |
mavillan/SciProg | 06_profiling/06_actividad.ipynb | gpl-3.0 | import numba
import numexpr as ne
import numpy as np
import matplotlib.pyplot as roberplot
import matplotlib.image as mpimg
%load_ext line_profiler
%load_ext memory_profiler
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.299, 0.587, 0.114])
def image_plot(img):
roberplot.figure(figsize=(10,5))
roberplo... |
coecms/ARCCSSive | examples/arccssive_training.ipynb | apache-2.0 | ! module use /g/data3/hh5/public/modules
! module load conda/analysis27
"""
Explanation: Import CMIP5 from the module and start a session
The latest ARCCSSive stable version is available from the conda analysis27 environment
Anyone can load them both from raijin and the remote desktop.
End of explanation
"""
! exp... |
tuanavu/coursera-university-of-washington | machine_learning/2_regression/assignment/week5/week-5-lasso-assignment-1-blank.ipynb | mit | 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 other solvers). You will:
* Run LASSO with different L1 penalties.
* Choose... |
VVard0g/ThreatHunter-Playbook | docs/notebooks/windows/06_credential_access/WIN-190620024610.ipynb | mit | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Domain DPAPI Backup Key Extraction
Metadata
| Metadata | Value |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/06/20 |
| modification date | 2020/09/20 |
| playbook relate... |
phoebe-project/phoebe2-docs | 2.2/tutorials/animations.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Advanced: Animations
NOTE: this tutorial may take a while to load in a browser as there are many embedded animations.
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installa... |
albahnsen/ML_RiskManagement | exercises/02-Python&Numpy&Pandas.ipynb | mit | from math import pi
def mult_dec_pi(a, b):
# Add the solution here
result = ''
return result
mult_dec_pi(a=2, b=4)
# 20.0
mult_dec_pi(a=5, b=10)
# 45.0
mult_dec_pi(a=14, b=1)
# 9.0
mult_dec_pi(a=6, b=8)
# 10.0
# Bonus
mult_dec_pi(a=16, b=4)
# 'Error'
"""
Explanation: Exercise 02.1
Create a f... |
mathLab/RBniCS | tutorials/12_stokes/tutorial_stokes_1_pod.ipynb | lgpl-3.0 | from dolfin import *
from rbnics import *
from sampling import LinearlyDependentUniformDistribution
"""
Explanation: TUTORIAL 12 - Stokes Equations
Keywords: geometrical parametrization, POD-Galerkin method, mixed formulation, inf sup condition
1. Introduction
This tutorial addresses geometrical parametrization and th... |
dzorlu/sdc | lane_detect/line_detection.ipynb | mit | def define_vertices(img):
imshape = img.shape
vertices = np.array([[(0,imshape[0]), (imshape[1]/2., imshape[0]/2.), (imshape[1],imshape[0])]], dtype=np.int32)
if vertices.shape[1]:
vertices = [vertices]
return vertices
def show_image_transformations(image, masked_image, lines, w_image):
plt... |
ajgpitch/qutip-notebooks | examples/quantum-gates.ipynb | lgpl-3.0 | %matplotlib inline
from IPython.display import Image
from numpy import pi
import numpy as np
from qutip import *
from qutip.qip.operations import *
from qutip.qip.circuit import QubitCircuit, Gate
"""
Explanation: QuTiP example: Quantum Gates and their usage
Author: Anubhav Vardhan (anubhavvardhan@gmail.com)
User-d... |
hiteshagrawal/python | udacity/nano-degree/L1_Starter_Code.ipynb | gpl-2.0 | import unicodecsv
## Longer version of code (replaced with shorter, equivalent version below)
# enrollments = []
# f = open('enrollments.csv', 'rb')
# reader = unicodecsv.DictReader(f)
# for row in reader:
# enrollments.append(row)
# f.close()
def readme(filename):
with open(filename, 'rb') as f:
rea... |
tensorflow/docs-l10n | site/en-snapshot/guide/keras/train_and_evaluate.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... |
mcc-petrinets/formulas | spot/tests/python/product.ipynb | mit | a1 = spot.translate('X(a W b)')
a2 = spot.translate('G(Fc U b)')
prod = spot.product(a1, a2)
horiz(a1.show(), a2.show(), prod.show())
"""
Explanation: Anatomy of a product
In this notebook, we write a Python function that constructs the product of two automata.
This is obviously not a new feature: Spot can already mak... |
myfunprograms/deep_learning | project5/files/dlnd_face_generation_original.ipynb | gpl-3.0 | data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input'
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', data_dir)
"""
Explanation: Face Generation
In this project, you'll use generative adv... |
turbomanage/training-data-analyst | quests/serverlessml/06_feateng_keras/labs/taxifare_fc.ipynb | apache-2.0 | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os, json, math, shutil
import datetime
import numpy as np
import logging
# SET TF ERROR LOG VERBOSITY
logging.getLogger("tensorflow").setLevel(logging.ERROR)
import tensorflow as ... |
dsevilla/bdge | sql/sesion2.ipynb | mit | !pip install pymysql ipython-sql
%load_ext sql
#%config SqlMagic.feedback = False # Evitar que muestre el número de filas
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
%%sql
mysql+pymysql://root:root@mysql/?charset=utf8mb4&local_infile=1
""... |
alfkjartan/control-computarizado | system-identification/notebooks/Parameter estimation with least squares - Homework.ipynb | mit | import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import control
"""
Explanation: Homework 4 - Least-squares parameter estimation
Due Friday October 18 at end-of-day
The model structure used is the so-called ARX (Auto-Regressive with eXogenous input) model:
where $u(k)$ is a known input sign... |
darkrun95/Applied-Data-Science | Introduction to Data Science in Python/Week 2/.ipynb_checkpoints/Assignment2-checkpoint.ipynb | gpl-3.0 | import pandas as pd
df = pd.read_csv('olympics.csv', index_col=0, skiprows=1)
for col in df.columns:
if col[:2]=='01':
df.rename(columns={col:'Gold'+col[4:]}, inplace=True)
if col[:2]=='02':
df.rename(columns={col:'Silver'+col[4:]}, inplace=True)
if col[:2]=='03':
df.rename(columns... |
Orlando-MLDS/GettingStartedWithData | LoadingData.ipynb | mit | #pandas is commonly imported as pd
import pandas as pd
#We'll import the other libraries as needed
"""
Explanation: Getting Started with Data
Example code blocks showing how to load various data types into Python
Designed for Python 3.5+
End of explanation
"""
print("Split on comma as strings")
csv_row = '1,2.0,Thr... |
tensorflow/docs | site/en/guide/random_numbers.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... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160517화_4일차_시각화 Visualization/2.matplotlib의 여러가지 플롯.ipynb | mit | y = [2, 3, 1]
x = np.arange(len(y))
xlabel = ['A', 'B', 'C']
plt.bar(x, y, align='center') #보통은 이 명령어를 쳐야 가운데를 기준으로 x가 정렬, 설정 없으면 left가 디폴트
plt.xticks(x, xlabel);
"""
Explanation: matplotlib의 여러가지 플롯
matplotlib는 기본적인 라인 프롯 이외에도 다양한 챠트/플롯 유형을 지원한다.
바 차트
x, y 데이터 중 하나가 카테고리 값인 경우에는 bar 명령과 barh 명령으로 바 차트(bar chart) 시각화... |
oditorium/blog | iPython/Reportlab2-FromMarkdown.ipynb | agpl-3.0 | from IPython.display import HTML
import markdown as md
l = """LOREM ipsum dolor sit amet, _consectetur_ adipiscing elit. Praesent dignissim orci a leo dapibus semper eget sed
sem. Pellentesque tellus nisl, condimentum nec libero id, __cursus consequat__ lectus. Ut quis nulla laoreet, efficitur
metus sit amet, <strik... |
burnash/neurolearn | scripts/Chang_ML_fMRI_Tutorial.ipynb | mit | # iPython notebook magic commands
%load_ext autoreload
%autoreload 2
%matplotlib inline
#General modules
import os
from os.path import join, basename, isdir
from os import makedirs
import pandas as pd
import matplotlib.pyplot as plt
import time
import pickle
# Supervised Modules
from pyneurovault import api
import ni... |
chapmanbe/nlm_clinical_nlp | DocumentClassificationNLM.ipynb | mit | import pyConTextNLP.pyConTextGraph as pyConText
import pyConTextNLP.itemData as itemData
import pymysql
import numpy as np
import os
import radnlp.io as rio
import radnlp.view as rview
import radnlp.rules as rules
import radnlp.schema as schema
import radnlp.utils as utils
import radnlp.split as split
import radnlp.cl... |
roebius/deeplearning_keras2 | nbs/dogscats-ensemble.ipynb | apache-2.0 | path = "data/dogscats/"
# path = "data/dogscats/sample/"
model_path = path + 'models/'
if not os.path.exists(model_path): os.mkdir(model_path)
batch_size=32
# batch_size=1
batches = get_batches(path+'train', shuffle=False, batch_size=batch_size)
val_batches = get_batches(path+'valid', shuffle=False, batch_size=batch_... |
kwant-project/kwant-tutorial-2016 | 2.1.Discretizing-Hamiltonians-computing-spectra.ipynb | bsd-2-clause | import kwant
"""
Explanation: Discretizing Hamiltonians and computing a spectrum
Tight-binding models
Kwant is designd to work with what commonly is called a "tight-binding" model. In practice, what we mean by that is that the Hamiltonian has a set of discrete degrees of freedom, i.e. that it can be written as
$$
H = ... |
diegocavalca/Studies | books/deep-learning-with-python/6.1-using-word-embeddings.ipynb | cc0-1.0 | from keras.layers import Embedding
# The Embedding layer takes at least two arguments:
# the number of possible tokens, here 1000 (1 + maximum word index),
# and the dimensionality of the embeddings, here 64.
embedding_layer = Embedding(1000, 64)
"""
Explanation: Using word embeddings
This notebook contains the secon... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/feateng/labs/feateng.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install --user apache-beam[gcp]==2.24.0
!pip install --user httplib2==0.12.0
"""
Explanation: <h1> Feature Engineering </h1>
In this notebook, you will learn how to incorporate feature engineering into your pipeline.
<ul>
<li> Working with fea... |
mne-tools/mne-tools.github.io | 0.20/_downloads/ff83425ee773d1d588a6994e5560c06c/plot_mne_dspm_source_localization.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
"""
Explanation: Source localization with MNE/dSPM/sLORETA/eLORETA
The aim of this tutorial is to teach you how to compute and apply a linear
minimum-norm inv... |
Kaggle/learntools | notebooks/sql/raw/ex2.ipynb | apache-2.0 | # Set up feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.sql.ex2 import *
print("Setup Complete")
"""
Explanation: Introduction
Try writing some SELECT statements of your own to explore a large dataset of air pollution measurements.
Run the cell below to set up the feedback sy... |
bkuczenski/lca-tools-datafiles | doc/Generate Manuscript Tables.ipynb | gpl-3.0 | my_files = [os.path.join(catalog_dir, files[k]) for k in (3, 6, 9, 8, 10)] # we love list comprehensions!
my_files
"""
Explanation: Select databases of interest
End of explanation
"""
names = ['EI (u)', 'ELCD', 'GaBi-Pro', 'GaBi-Ext', 'US LCI']
def load_archive(filename):
with gzip.open(filename, 'r') as fp:
... |
rldotai/rlbench | rlbench/off_policy_comparison.ipynb | gpl-3.0 | num_states = 8
gamma = 0.9
true_values = gamma**np.arange(num_states)[::-1]
d_pi = np.ones(num_states)/num_states
D_pi = np.diag(d_pi)
print("True values:")
print(true_values)
print("On-policy distribution:")
print(d_pi)
def compute_value_dct(theta_lst, features):
return [{s: np.dot(theta, x) for s, x in features.... |
SGenheden/lammps | python/examples/ipython/interface_usage_bonds.ipynb | gpl-2.0 | from lammps import IPyLammps
L = IPyLammps()
# 2d circle of particles inside a box with LJ walls
import math
b = 0
x = 50
y = 20
d = 20
# careful not to slam into wall too hard
v = 0.3
w = 0.08
L.units("lj")
L.dimension(2)
L.atom_style("bond")
L.boundary("f f p")
L.lattice("hex", 0.85)
L.region("... |
lenovor/notes-on-dirichlet-processes | 2015-07-30-sampling-from-a-hierarchical-dirichlet-process.ipynb | mit | %matplotlib inline
"""
Explanation: This may be more readable on NBViewer.
End of explanation
"""
from numpy.random import choice
from scipy.stats import beta
class DirichletProcessSample():
def __init__(self, base_measure, alpha):
self.base_measure = base_measure
self.alpha = alpha
... |
amueller/advanced_training | 9.1 Out Of Core Learning.ipynb | bsd-2-clause | # write out some toy data
from sklearn.datasets import load_digits
import cPickle
digits = load_digits()
X, y = digits.data, digits.target
for i in range(10):
cPickle.dump((X[i::10], y[i::10]), open("data/batch_%02d.pickle" % i, "w"), -1)
from sklearn.linear_model import SGDClassifier
sgd = SGDClassifier()
f... |
Microno95/DESolver | docs/examples/numpy/Example 2 - NumPy - Duffing Oscillator.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import desolver as de
import desolver.backend as D
D.set_float_fmt('float64')
"""
Explanation: The Duffing Oscillator
In this notebook we will explore the Duffing Oscillator and attempt to recreate the time traces and phase portraits shown on the Duffing Oscill... |
UWSEDS/LectureNotes | Fall2018/05_Functions/python_functions.ipynb | bsd-2-clause | # Example: We're going to use Pandas dataframes to create a gradebook for this course
import pandas as pd
# Student Rosters:
section_1_students = ['Hao', 'Jennifer', 'Alex']
section_2_students = ['Christa', 'Troy', 'Xin']
# Gradebook columns:
columns = ['raw_grade', 'did_extra_credit', 'final_grade']
# Let's create... |
eng-tools/sfsimodels | examples/example_mesh_w_vary_xy_smooth_surf.ipynb | mit | %gui qt5
from PyQt5.Qt import QApplication
import pyqtgraph as pg
from matplotlib.pyplot import imshow
import matplotlib.pyplot as plt
import sfsimodels as sm
from sfsimodels.num import mesh
import numpy as np
import o3plot
import pyqtgraph.exporters
# start qt event loop
_instance = QApplication.instance()
if not _in... |
mne-tools/mne-tools.github.io | 0.24/_downloads/9d142d98d094666b7fd2d94155f8b3ec/decoding_unsupervised_spatial_filter.ipynb | bsd-3-clause | # Authors: Jean-Remi King <jeanremi.king@gmail.com>
# Asish Panda <asishrocks95@gmail.com>
#
# License: BSD-3-Clause
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.decoding import UnsupervisedSpatialFilter
from sklearn.decomposition import PCA, FastICA... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/hadgem3-gc31-hm/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'hadgem3-gc31-hm', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NERC
Source ID: HADGEM3-GC31-HM
Topic: Aerosol
Sub-Topics: Transport, Emis... |
a-slide/iPython-Notebook | Notebooks/2016_05_23_Epi2_pilot_datasets_analysis_PTM.ipynb | gpl-2.0 | # pycl imports
from pycl import *
#Std lib imports
import datetime
from glob import glob
from pprint import pprint as pp
from os.path import basename
from os import listdir, remove, rename
from os.path import abspath, basename, isdir
from collections import OrderedDict
# Third party import
import numpy as np
import s... |
tensorflow/docs-l10n | site/ko/guide/gpu.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... |
tbereau/auto_martini | examples/02_highlighting.ipynb | gpl-2.0 | import auto_martini as am
import numpy as np
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from IPython.display import Image
import rdkit
from rdkit.Chem import Draw
from rdkit.Chem import AllChem
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import rdMolDraw2D
print(rdkit.__version__)
"""... |
data-cube/agdc-v2-examples | notebooks_ledaps/hyderabad_demo.ipynb | apache-2.0 | %matplotlib inline
from matplotlib import pyplot as plt
import datacube
from datacube.model import Range
from datetime import datetime
dc = datacube.Datacube(app='dc-example')
from datacube.storage import masking
from datacube.storage.masking import mask_valid_data as mask_invalid_data
import pandas
import xarray
impor... |
IBM/differential-privacy-library | notebooks/histograms.ipynb | mit | import numpy as np
from diffprivlib import tools as dp
import matplotlib.pyplot as plt
"""
Explanation: Differentially Private Histograms
Plotting the distribution of ages in Adult
End of explanation
"""
ages_adult = np.loadtxt("https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data",
... |
as595/AllOfYourBases | TIARA/GaussianProcessModelling/NOTEBOOKS/GPMCarbonDioxide.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: ==============================================================================================
‹ GPMIntro.ipynb ›
Copyright (C) ‹ 2017 › ‹ Anna Scaife - anna.scaife@manchester.ac.uk ›
This program is free software: you can redistribute it ... |
evanmiltenburg/python-for-text-analysis | Chapters/Chapter 21 - Tables and Networks.ipynb | apache-2.0 | %matplotlib inline
"""
Explanation: Chapter 20 - Tables and Networks
In the previous chapter we looked into various types of charts and correlations that are useful for scientific analysis in Python. Here, we present two more groups of visualizations: tables and networks. We will spend little attention to these, sinc... |
mne-tools/mne-tools.github.io | 0.23/_downloads/f1d68aba13226287585e777005a39f0a/15_handling_bad_channels.ipynb | bsd-3-clause | import os
from copy import deepcopy
import numpy as np
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.read_raw_fif(sample_data_raw_file, verbose=False)
""... |
whitead/numerical_stats | project/type3_examples/tea.ipynb | gpl-3.0 | T = 373.
T_a = 293.
r = .002
def cooling_eqn(t):
return (T_a + (T - T_a) * np.exp(-r * t)) * 9./5. - 459.67
x = np.array(range(1800))
cooling_plot = plt.plot(x / 60., cooling_eqn(x), label='$T(t) = 298 + 75e^{-.002t}$')
plt.title('Boiled Water Cooling Over Time')
plt.xlabel('Time (min)')
plt.ylabel('Temperature ... |
opengeostat/pygslib | pygslib/Ipython_templates/bicalib_raw.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
import pandas as pd
#make the plots inline
%matplotlib inline
"""
Explanation: PyGSLIB
Bicalib
The GSLIb equivalent parameter file is
```
Parameters for BICALIB
****
START OF PARAMETERS:
... |
pyro-ppl/numpyro | notebooks/source/bayesian_regression.ipynb | apache-2.0 | !pip install -q numpyro@git+https://github.com/pyro-ppl/numpyro
import os
from IPython.display import set_matplotlib_formats
import jax.numpy as jnp
from jax import random, vmap
from jax.scipy.special import logsumexp
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import... |
sfegan/calin | examples/iact_data/read and dump ACTL header and event from zfits file.ipynb | gpl-2.0 | %pylab inline
import calin.iact_data.raw_actl_event_data_source
import json
import struct
import base64
"""
Explanation: Read and dump raw ACTL header and event
calin/examples/iact_data/read and dump ACTL header and event from zfits file.ipynb - Stephen Fegan - 2016-12-12
Copyright 2016, Stephen Fegan sf
... |
Mendelone/forex_trading | Jupyter/BasicQuantBookTemplate.ipynb | apache-2.0 | %matplotlib inline
# Imports
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Jupyter")
AddReference("QuantConnect.Indicators")
from System import *
from QuantConnect import *
from QuantConnect.Data.Market import TradeBar, QuoteBar
from QuantConnect.Jupy... |
tensorflow/docs-l10n | site/ko/guide/keras/custom_layers_and_models.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... |
tcstewar/testing_notebooks | lca/LCA-full-adapt-dual-oja.ipynb | gpl-2.0 | class RectifiedLinearWithThreshold(nengo.RectifiedLinear):
threshold = nengo.params.NumberParam('threshold')
def __init__(self, amplitude=1, threshold=0):
super().__init__(amplitude=amplitude)
self.threshold = threshold
def step_math(self, dt, J, output):
output[...] = self.amplitu... |
HazyResearch/flyingsquid | examples/tutorials/Basics.ipynb | apache-2.0 | from tutorial_helpers import *
L_train, L_dev, Y_dev = synthetic_data_basics()
print(L_train.shape)
print(L_dev.shape)
print(Y_dev.shape)
"""
Explanation: FlyingSquid Basics
In this notebook, we'll use some synthetic data to introduce you to FlyingSquid's API. In this notebook, we'll cover the three steps of the Flyin... |
li-yuntao/SiliconLives | PytorchModels/tutorials/advanced_tutorial.ipynb | gpl-3.0 | # Author: Robert Guthrie
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.optim as optim
torch.manual_seed(1)
"""
Explanation: Advanced: Making Dynamic Decisions and the Bi-LSTM CRF
Dynamic versus Static Deep Learning Toolkits
Pytorch is a dynamic neural network kit. Another example ... |
miykael/nipype_tutorial | notebooks/introduction_jupyter-notebook.ipynb | bsd-3-clause | import pandas as pd
print("Hi! This is a cell. Click on it and press the ▶ button above to run it")
"""
Explanation: <div align="center"><img width="50%" src="https://raw.githubusercontent.com/jupyter/jupyter/master/docs/source/_static/_images/jupyter.png"></div>
Jupyter Notebook
This notebook was adapted from https... |
FlorentSilve/Udacity_ML_nanodegree | projects/finding_donors/finding_donors.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
from time import time
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualization code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Loa... |
blakeflei/IntroScientificPythonWithJupyter | 11 - Gotchas and Optimization.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
%matplotlib inline
# The memory consumption of different types of variables can vary significantly:
num_int = np.array(4, dtype='int8')
print("Memory (bytes) used by the int8 is: ", num_int.nbytes)
num_float = np.array(4, dtype='float')
pri... |
tpin3694/tpin3694.github.io | misc/library_counts.ipynb | mit | import os
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
directory = '/home/tpin3694/Documents/'
python_files = [os.path.join(root, name)
for root, dirs, files in os.walk(directory)
for name in files if name.endswith(('.py'))]
pr... |
vivekec/datascience | tutorials/python/Ipython files/Seaborn - 2. Plotting.ipynb | gpl-3.0 | data0 = np.random.randn(200)
mean, cov = [0, 1], [(1, .5), (.5, 1)]
data1 = np.random.multivariate_normal(mean, cov, 200)
df = pd.DataFrame(data1, columns=["x", "y"])
iris = sns.load_dataset("iris")
titanic = sns.load_dataset("titanic")
tips = sns.load_dataset("tips")
tips["big_tip"] = (tips.tip / tips.total_bill) > ... |
zomansud/coursera | ml-regression/week-3/week-3-polynomial-regression-assignment-blank.ipynb | mit | import graphlab
"""
Explanation: Regression Week 3: Assessing Fit (polynomial regression)
In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will:
* Write a function to take a... |
SlipknotTN/udacity-deeplearning-nanodegree | autoencoder/Convolutional_Autoencoder.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
JasonSanchez/w261 | week5/MIDS-W261-HW-05-TEMPLATE (2).ipynb | mit | import sys, os, re
from mrjob.job import MRJob
class MRJoin(MRJob):
# Performs secondary sort
SORT_VALUES = True
def mapper(self, _, line):
splits = line.rstrip("\n").split("|")
if len(splits) == 2: # country data
symbol = 'A' # make country sort before transaction data
country2digit = spl... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_automl_tabular_binary_classification_batch.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: AutoML training tabular binary classification model for batch prediction
<table ali... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/Advanced Functions Test Solutions.ipynb | apache-2.0 | def word_lengths(phrase):
return list(map(len, phrase.split()))
word_lengths('How long are the words in this phrase')
"""
Explanation: Advanced Functions Test Solutions
For this test, you should use the built-in functions to be able to write the requested functions in one line.
Problem 1
Use map to create a ... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/structured/labs/3b_bqml_linear_transform_babyweight.ipynb | apache-2.0 | %%bash
sudo pip freeze | grep google-cloud-bigquery==1.6.1 || \
sudo pip install google-cloud-bigquery==1.6.1
"""
Explanation: LAB 3b: BigQuery ML Model Linear Feature Engineering/Transform.
Learning Objectives
Create and evaluate linear model with BigQuery's ML.FEATURE_CROSS
Create and evaluate linear model with Bi... |
scikit-optimize/scikit-optimize.github.io | 0.8/notebooks/auto_examples/sklearn-gridsearchcv-replacement.ipynb | bsd-3-clause | print(__doc__)
import numpy as np
np.random.seed(123)
import matplotlib.pyplot as plt
"""
Explanation: Scikit-learn hyperparameter search wrapper
Iaroslav Shcherbatyi, Tim Head and Gilles Louppe. June 2017.
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
Introduction
This example assumes basic familiari... |
Prooffreader/twitter_feminism_analysis | twitter_feminism_analysis.ipynb | mit | import csv
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import re
import requests
import seaborn as sns
import shutil
import time
import urllib.request
from collections import Counter
from textblob import TextBlob
%matplotlib inline
"""
Explanation: The most characteristic words i... |
sysid/nbs | Using-CNN-lesson1.ipynb | mit | %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... |
m2dsupsdlclass/lectures-labs | labs/08_frameworks/Fashion_MNIST_classification.ipynb | mit | import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from matplotlib.cm import get_cmap
from torch.utils.data import TensorDataset, DataLoader
from torchvision import datasets
from torchvision.transforms import transforms
"""
Explanation: Fashion MNIST classification using... |
pligor/predicting-future-product-prices | 04_time_series_prediction/22_price_history_seq2seq-removed_scale.ipynb | agpl-3.0 | from __future__ import division
import tensorflow as tf
from os import path, remove
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper import sho... |
claudiuskerth/PhDthesis | Data_analysis/SNP-indel-calling/dadi/MODIFIED_SPECTRA/01_modified_spectra_synthesis.ipynb | mit | import numpy as np
import sys
sys.path.insert(0, '/home/claudius/Downloads/dadi')
import dadi
from glob import glob
import dill
from utility_functions import *
import pandas as pd
# turn on floating point division by default, old behaviour via '//'
from __future__ import division
%matplotlib inline
import pylab
... |
PYPIT/PYPIT | doc/nb/CalibGroup.ipynb | gpl-3.0 | fitstbl = PypeItMetaData('keck_lris_red', file_list=file_list, background_index=True)
"""
Explanation: Construct the metadata just based on the headers
End of explanation
"""
_ = fitstbl.get_frame_types(flag_unknown=True)
"""
Explanation: Add the frame types as we've always done
End of explanation
"""
cfgs = fits... |
opalbert/mltutorial | notebooks/jupyter/1.Introduction.ipynb | gpl-2.0 | from IPython.display import Image
Image(filename='kernel.png')
"""
Explanation: IPython 3 (jupyter)
Video Toturial: https://www.youtube.com/user/roshanRush
Jupyter is an web-based interactive development environment. It support multiple programming languages like Julia, Octave, Python and R (In alphabetical order).
Up... |
poppy-project/community-notebooks | tutorials-education/poppy-humanoid_poppy-torso__vrep_installation et prise en main/poppy simulé/premier pas avec poppy humanoid en python - 10 choses à savoir.ipynb | lgpl-3.0 | from poppy.creatures import PoppyHumanoid
creature = PoppyHumanoid(simulator='vrep')
"""
Explanation: <img src="png/poppy.png" HEIGHT=200 WIDTH=200 ALIGN=right>
<img src="png/inria.jpg" HEIGHT=150 WIDTH=325 ALIGN=left >
Premiers pas avec une créature
10 choses à savoir sur Poppy Humanoid
Ouvrir l'interface
Instancier... |
Naereen/notebooks | Simulations du jeu de carte Jap-Jap.ipynb | mit | coeur = "♥"
treffle = "♣"
pique = "♠"
carreau = "♦"
couleurs = [coeur, treffle, pique, carreau]
class Carte():
def __init__(self, valeur, couleur):
assert 1 <= valeur <= 13, "Erreur : valeur doit etre entre 1 et 13."
self.valeur = valeur
assert couleur in couleurs, "Erreur : couleur doi... |
xesscorp/pygmyhdl | examples/1_blinker/fastest_easiest_FPGA_blinker_ever.ipynb | mit | from pygmyhdl import *
"""
Explanation: Note: If you're reading this as a static HTML page, you can also get it as an
executable Jupyter notebook here.
The Fastest, Easiest FPGA Blinker, Ever!
Everyone who wants to get started with FPGAs [1] has two thoughts:
"I don't know how to program an FPGA."
"FPGA programming t... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/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', 'cas', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CAS
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Concent... |
saalfeldlab/template-building | python/labelwise_skeleton_distance_analysis.ipynb | bsd-2-clause | # Group by algorithm, then average over mean distances
avg_avg_dists = dist_df.loc[(dist_df.STAT == 'MEAN'),['ALG','VALUE']].groupby(['ALG'],as_index=False).mean()
aads = avg_avg_dists.sort_values('VALUE', ascending=True)
print( 'best by avg_avg is: ',aads.iloc[0]['ALG'])
# Group by algorithm, then average over media... |
Neuroglycerin/neukrill-net-work | notebooks/Transformer Dataset.ipynb | mit | import pylearn2.utils
import pylearn2.config
import theano
import neukrill_net.dense_dataset
import neukrill_net.utils
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import holoviews as hl
%load_ext holoviews.ipython
import sklearn.metrics
cd ..
settings = neukrill_net.utils.Settings("settings.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.