repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
cjdrake/pyeda | ipynb/Survey.ipynb | bsd-2-clause | a, b, c, d = map(exprvar, 'abcd')
"""
Explanation: Abstract
This paper introduces PyEDA, a Python library for electronic design automation (EDA). PyEDA provides both a high level interface to the representation of Boolean functions,
and blazingly-fast C extensions for fundamental algorithms where performance is essent... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/end-to-end-structured/solutions/3a_bqml_baseline_babyweight.ipynb | apache-2.0 | %%bigquery
-- LIMIT 0 is a free query; this allows us to check that the table exists.
SELECT * FROM babyweight.babyweight_data_train
LIMIT 0
%%bigquery
-- LIMIT 0 is a free query; this allows us to check that the table exists.
SELECT * FROM babyweight.babyweight_data_eval
LIMIT 0
"""
Explanation: LAB 3a: BigQuery ML... |
albahnsen/ML_SecurityInformatics | exercises/05-IntrusionDetection.ipynb | mit | import pandas as pd
pd.set_option('display.max_columns', 500)
import zipfile
with zipfile.ZipFile('../datasets/UNB_ISCX_NSL_KDD.csv.zip', 'r') as z:
f = z.open('UNB_ISCX_NSL_KDD.csv')
data = pd.io.parsers.read_table(f, sep=',')
data.head()
"""
Explanation: Exercise 05
Logistic regression exercise to detect net... |
mathLab/RBniCS | tutorials/12_stokes/tutorial_stokes_2_rb.ipynb | lgpl-3.0 | from dolfin import *
from rbnics import *
from sampling import LinearlyDependentUniformDistribution
"""
Explanation: TUTORIAL 12 - Stokes Equations
Keywords: geometrical parametrization, reduced basis method, mixed formulation, inf sup condition
1. Introduction
This tutorial addresses geometrical parametrization and t... |
deepchem/deepchem | examples/tutorials/Working_With_Datasets.ipynb | mit | !pip install --pre deepchem
"""
Explanation: Working With Datasets
Data is central to machine learning. This tutorial introduces the Dataset class that DeepChem uses to store and manage data. It provides simple but powerful tools for efficiently working with large amounts of data. It also is designed to easily inte... |
mne-tools/mne-tools.github.io | 0.17/_downloads/956c2e52efc7e768d096c7da98299333/plot_stats_cluster_spatio_temporal_2samp.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from scipy import stats as stats
import mne
from mne import spatial_src_connectivity
from mne.stats import spatio_temporal_cluster... |
antoniomezzacapo/qiskit-tutorial | community/terra/qis_adv/single-qubit_quantum_random_access_coding.ipynb | apache-2.0 | # useful math functions
from math import pi
# importing the QISKit
from qiskit import Aer, IBMQ
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
# import basic plot tools
from qiskit.tools.visualization import plot_histogram
# useful additional packages
from qiskit.wrapper.jupyter impo... |
GoogleCloudPlatform/covid-19-open-data | examples/logistic_modeling.ipynb | apache-2.0 | ESTIMATE_DAYS = 3
data_key = 'KR'
date_limit = '2020-03-18'
import pandas as pd
import seaborn as sns
sns.set()
df = pd.read_csv(f'https://storage.googleapis.com/covid19-open-data/v3/location/{data_key}.csv').set_index('date')
"""
Explanation: Logistic Modeling of COVID-19 Confirmed Cases
This notebook explores mode... |
niazangels/CADL | session-3/lecture-3.ipynb | apache-2.0 | # imports
%matplotlib inline
# %pylab osx
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
# Some additional libraries which we'll use just
# to produce some visualizations of our training
from libs.utils import montage
from libs i... |
dcavar/python-tutorial-for-ipython | notebooks/Python Parsing with NLTK and Foma.ipynb | apache-2.0 | import nltk
"""
Explanation: Python Parsing with NLTK and Foma
(C) 2017-2019 by Damir Cavar
Download: This and various other Jupyter notebooks are available from my GitHub repo.
License: Creative Commons Attribution-ShareAlike 4.0 International License (CA BY-SA 4.0)
This is a tutorial related to the discussion of gra... |
geektoni/shogun | doc/ipython-notebooks/neuralnets/rbms_dbns.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import networkx as nx
import shogun as sg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
G = nx.Graph()
pos = {}
for i in range(8):
pos['V'+str(i)] = (i,0)
pos['H'+str(i)] = (i,1)
for j in... |
dprn/CDC15 | Invariants-computation.ipynb | gpl-2.0 | import numpy as np
from numpy import fft
from numpy import linalg as LA
from scipy import ndimage
from scipy import signal
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import os
%matplotlib inline
"""
Explanation: Computation and comparision of the bispectrum and the rotational bispectrum
We show how to... |
samgoodgame/sf_crime | iterations/KK_scripts/KK_development_work/W207_Final_Project_errorAnalysis_updated_08_21_1930.ipynb | mit | # Additional Libraries
%matplotlib inline
import matplotlib.pyplot as plt
# Import relevant libraries:
import time
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import... |
MBARIMike/biofloat | notebooks/save_to_odv.ipynb | mit | from biofloat import ArgoData, converters
from os.path import join, expanduser
ad = ArgoData(cache_file=join(expanduser('~'),'6881StnP_5903891.hdf'), verbosity=2)
wmo_list = ad.get_cache_file_all_wmo_list()
df = ad.get_float_dataframe(wmo_list)
"""
Explanation: Save to Ocean Data View file
Load a biofloat DataFrame, ... |
Jhanelle/Jhanelle_New_Version_of_final_project | bin/Compiled_Codes_for_Final_Project.ipynb | mit | # Identitfy version of software used
pd.__version__
#Identify version of software used
np.__version__
# import libraries
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#stats library
import statsmodels.api as sm
import scipy
#T-test is imported to complete the statistical analysis
from sc... |
retnuh/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/official/custom/custom-tabular-bq-managed-dataset.ipynb | apache-2.0 | import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
# Google Cloud Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = "--user"
! pip install {U... |
certik/climate | CO2 temperature analysis.ipynb | mit | %pylab inline
import urllib
"""
Explanation: Since the current concentrations $N$ of $CO_2$ in the atmosphere is so high, the direct
dependence of the surface temperature $T$ on $N$ should be given approximately by
$$
T = T_0 + \Delta T {\log{N \over N_0} \over \log 2}\quad\quad\quad\text{(1)}
$$
Here $T_0$ is a refer... |
tpin3694/tpin3694.github.io | machine-learning/bag_of_words.ipynb | mit | # Load library
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
"""
Explanation: Title: Bag Of Words
Slug: bag_of_words
Summary: How to encode unstructured text data as bags of words for machine learning in Python.
Date: 2017-09-09 12:00
Category: Machine Learning
Tag... |
mne-tools/mne-tools.github.io | stable/_downloads/33d5dd5786fed13908838e94d55ac785/90_compute_covariance.ipynb | bsd-3-clause | import os.path as op
import mne
from mne.datasets import sample
"""
Explanation: Computing a covariance matrix
Many methods in MNE, including source estimation and some classification
algorithms, require covariance estimations from the recordings.
In this tutorial we cover the basics of sensor covariance computations... |
sraejones/phys202-2015-work | assignments/assignment10/ODEsEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
from IPython.html.widgets import interact, interactive, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def loren... |
chinapnr/python_study | Python 基础课程/Python Basic Lesson 05 - 字典 dict, 元组 tuple.ipynb | gpl-3.0 | # 定义字典
# 访问字典中的 key-value
d = {'Tom': 95, 'Mary': 90, 'Tracy': 92}
print(d)
print(d['Tom'])
# 字典增加元素,直接定义值即可
d['Hugo'] = 85
print(d)
# 修改字典元素的值
d['Tom'] = 97
print(d)
# 字典是否存在某个 key
print('Tom' in d)
# 如果要获得不存在的 key 的 value,可以设置默认值
print(d.get('Tommy',80))
# 去获得不存在的 key 的 value,会报错
print(d['Tommy'])
# 字典删除 ke... |
drvinceknight/cfm | docs/_static/example-coursework/main.ipynb | mit | ### BEGIN SOLUTION
import sympy as sym
x = sym.Symbol("x")
y = 2 * x * (x - 3) * (x - 5)
sym.diff(y, x)
### END SOLUTION
q1_a_answer = _
feedback_text = """Your output is not a symbolic expression.
You are expected to use sympy for this question.
"""
try:
assert q1_a_answer.is_algebraic_expr(), feedback_text
exce... |
chengsoonong/crowdastro | notebooks/50_yan_rgz.ipynb | mit | from pprint import pprint
import sys
from astropy.coordinates import SkyCoord
import h5py
import numpy
import sklearn.neighbors
import seaborn
sys.path.insert(1, '..')
import crowdastro.active_learning.active_crowd as active_crowd
import crowdastro.active_learning.passive_crowd as passive_crowd
import crowdastro.acti... |
planetlabs/notebooks | jupyter-notebooks/analytics/case_study_syria_idp_camps.ipynb | apache-2.0 | import os
# if your Planet API Key is not set as an environment variable, you can paste it below
if os.environ.get('PL_API_KEY', ''):
API_KEY = os.environ.get('PL_API_KEY', '')
else:
API_KEY = 'PASTE YOUR API KEY HERE'
# construct auth tuple for use in the requests library
BASIC_AUTH = (API_KEY, '')
"""
... |
probml/pyprobml | notebooks/book1/14/densenet_jax.ipynb | mit | import jax
import jax.numpy as jnp # JAX NumPy
from jax import lax
import matplotlib.pyplot as plt
import math
from IPython import display
try:
from flax import linen as nn # The Linen API
except ModuleNotFoundError:
%pip install -qq flax
from flax import linen as nn # The Linen API
from flax.training i... |
li-xirong/jingwei | samples/tag-assignment-by-tagvote.ipynb | mit | from instance_based.tagvote import TagVoteTagger
trainCollection = 'train10k'
annotationName = 'concepts130.txt'
feature = 'vgg-verydeep-16-fc7relu'
tagger = TagVoteTagger(collection=trainCollection, annotationName=annotationName, feature=feature, distance='cosine')
"""
Explanation: Image tag assignment by TagVote
A... |
mrustl/flopy | examples/Notebooks/flopy3_external_file_handling.ipynb | bsd-3-clause | import os
import shutil
import flopy
import numpy as np
# make a model
nlay,nrow,ncol = 10,20,5
model_ws = os.path.join("data","external_demo")
if os.path.exists(model_ws):
shutil.rmtree(model_ws)
# the place for all of your hand made and costly model inputs
array_dir = os.path.join("data","array_dir")
if o... |
astarostin/MachineLearningSpecializationCoursera | course6/week5/PageParsing.ipynb | apache-2.0 | import requests
req = requests.get('http://zadolba.li/20160417')
print req
print type(req)
print req.text
"""
Explanation: Пример парсинга страницы сайта
Requests
Для того, чтобы получить html-код страницы нам потребуется библиотека requests:
End of explanation
"""
import bs4
"""
Explanation: Beautiful Soup
Теп... |
iRipVanWinkle/ml | mlcourse_open[solutions]/practice/lesson1_practice_pandas_titanic.ipynb | mit | import numpy as np
import pandas as pd
%matplotlib inline
"""
Explanation: <center>
<img src="../../img/ods_stickers.jpg">
Открытый курс по машинному обучению. Сессия № 2
</center>
Автор материала: программист-исследователь Mail.ru Group, старший преподаватель Факультета Компьютерных Наук ВШЭ Юрий Кашницкий. Материал ... |
Upward-Spiral-Science/team1 | code/data_modeling.ipynb | apache-2.0 | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import urllib2
np.random.seed(1)
url = ('https://raw.githubusercontent.com/Upward-Spiral-Science'
'/data/master/syn-density/output.csv')
data = urllib2.urlopen(url)
csv = np.genfromtxt(data, delimiter=",")[1:] # don't want first row (labels)
... |
mbuchove/analysis-tools-m | pyROOT/CalcCombUL-GrMethod-v2.ipynb | mit | if plot:
fig = plt.figure(figsize=(12, 12))
fig1 = aplpy.FITSFigure(fitsF, figure=fig, subplot=(2,3,1), hdu=5)
fig1.show_colorscale()
standard_setup(fig1)
fig1.set_title("Acceptance")
fig1 = aplpy.FITSFigure(fitsF, figure=fig, subplot=(2,3,2), hdu=7)
fig1.show_colorscale()
standard_se... |
VirtualWatershed/vw-py | examples/isnobal_netcdf/generate_isnobal_nc.ipynb | bsd-2-clause | # first, define our isnobal spatiotemporal parameters
isnobal_params = dict(
# generate a 10x8x(n_timesteps) grid for each variable
nlines=10, nsamps=8,
# with a resolution of 1.0m each; samp is north-south, so it's negative
dline=1.0, dsamp=-1.0,
# set base fake origin (easting, northing) = (442, 8... |
Dans-labs/dariah | static/tools/country_compose/.ipynb_checkpoints/countries-checkpoint.ipynb | mit | EU_FILE = 'europe_countries.csv'
GEO_DIR = 'geojson'
COUNTRIES = 'all_countries.json'
OUTFILE = '../../../client/src/js/helpers/europe.geo.js'
CENTER_PRECISION = 1
import sys, collections, json
"""
Explanation: Building the country information files
The DARIAH app contains a visualization of the number of member coun... |
MIT-LCP/mimic-workshop | temp/02-example-patient-sepsis.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sqlite3
%matplotlib inline
"""
Explanation: Exploring the trajectory of a single patient
Import Python libraries
We first need to import some tools for working with data in Python.
- NumPy is for working with numbers
- Pandas is for analysi... |
johnpfay/environ859 | 06_WebGIS/Notebooks/Bird-Demo-Reuben.ipynb | gpl-3.0 | #Import modules
import requests
from bs4 import BeautifulSoup
#Example URL
theURL = "https://www.hbw.com/species/brown-wood-owl-strix-leptogrammica"
#Get content of the species web page
response = requests.get(theURL)
#Convert to a "soup" object, which BS4 is designed to work with
soup = BeautifulSoup(response.text,... |
LimeeZ/phys292-2015-work | days/day08/Display.ipynb | mit | class Ball(object):
pass
b = Ball()
b.__repr__()
print(b)
"""
Explanation: Display of Rich Output
In Python, objects can declare their textual representation using the __repr__ method.
End of explanation
"""
class Ball(object):
def __repr__(self):
return 'TEST'
b = Ball()
print(b)
"""
Explanatio... |
prakhar2b/Weekend-Projects | gensim/#691.ipynb | mit | index.output_prefix
"""
Explanation: '/home/prakhar/Documents/khg' -- we want user to provide a location inside which we will create a directory named "shard" in which everything will happen. So, just to demonstrate that the code will detect parent directory and create shard directory in it, we are using "../khg"
use ... |
UWPreMAP/PreMAP2015 | Lessons/Python_Plotting.ipynb | mit | # we use matplotlib and specifically pyplot for basic plotting purposes
# the convention is to import this as "plt"
# also import things that will help use read in our data and perform other operations on it
import matplotlib.pyplot as plt
from astropy.io import ascii
import numpy as np
# I'm also using this "magi... |
blua/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 fin... |
tpin3694/tpin3694.github.io | sql/merge_tables.ipynb | mit | # Ignore
%load_ext sql
%sql sqlite://
%config SqlMagic.feedback = False
"""
Explanation: Title: Merge Tables
Slug: merge_tables
Summary: Merge tables in SQL.
Date: 2016-05-01 12:00
Category: SQL
Tags: Basics
Authors: Chris Albon
Note: This tutorial was written using Catherine Devlin's SQL in Jupyter Notebooks libra... |
ffpenaloza/AstroExp | tarea2-2/.ipynb_checkpoints/tarea2.2-checkpoint.ipynb | gpl-3.0 | import numpy as np
from scipy.signal import medfilt
import matplotlib.pyplot as plt
import kplr
%matplotlib inline
client = kplr.API()
koi = client.koi(1274.01)
lcs = koi.get_light_curves(short_cadence=True)
p = 704.2
time, flux, ferr, med = [], [], [], []
for lc in lcs:
with lc.open() as f:
# The ligh... |
antoinecarme/sklearn_explain | doc/sklearn_reason_codes_RandomForest.ipynb | bsd-3-clause | from sklearn import datasets
import pandas as pd
%matplotlib inline
ds = datasets.load_breast_cancer();
NC = 4
lFeatures = ds.feature_names[0:NC]
df_orig = pd.DataFrame(ds.data[:,0:NC] , columns=lFeatures)
df_orig['TGT'] = ds.target
df_orig.sample(6, random_state=1960)
"""
Explanation: Model Explanation for Classif... |
cbare/Etudes | notebooks/fractional-approximations-of-pi.ipynb | apache-2.0 | from math import pi
pi
"""
Explanation: Rational approximations of 𝝿
The fractions 22/7 and 355/113 are good approximations of pi. Let's find more.
End of explanation
"""
pi.as_integer_ratio()
f"{884279719003555/281474976710656:0.48f}"
"""
Explanation: Spoiler alert: Who knew that Python floats have this handy m... |
sergivalverde/MRI_intensity_normalization | Intensity normalization test.ipynb | gpl-3.0 | import os
import numpy as np
import nibabel as nib
from nyul import nyul_train_standard_scale
DATA_DIR = 'data_examples'
T1_name = 'T1.nii.gz'
MASK_name = 'brainmask.nii.gz'
# generate training scans
train_scans = [os.path.join(DATA_DIR, folder, T1_name)
for folder in os.listdir(DATA_DIR)]
mask_scans... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/cmip6/models/access-1-0/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csiro-bom', 'access-1-0', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: ACCESS-1-0
Topic: Seaice
Sub-Topics: Dynamics, Thermody... |
mrcinv/matpy | 03d_iteracija.ipynb | gpl-2.0 | g = lambda x: 2**(-x)
xp = 1 # začetni približek
for i in range(15):
xp = g(xp)
print(xp)
print("Razlika med desno in levo stranjo enačbe je", xp-2**(-xp))
"""
Explanation: ^ gor: Uvod
Reševanje enačb z navadno iteracijo
Pri rekurzivnih zaporedjih smo videli, da za zaporedje, ki zadošča rekurzivni formuli
$$x... |
Ccaccia73/semimonocoque | 03a_Multiconnected_section.ipynb | mit | from pint import UnitRegistry
import sympy
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import sys
%matplotlib inline
from IPython.display import display
"""
Explanation: Semi-Monocoque Theory
End of explanation
"""
from Section import Section
"""
Explanation: Import Section class, which... |
radical-experiments/AIMES-Experience | OSG/analysis/osg_analysis.ipynb | mit | %matplotlib inline
"""
Explanation: Using RADICAL-Analytics with RADICAL-Pilot and OSG Experiments
This notebook illustrates the analysis of two experiments performed with RADICAL-Pilot and OSG. The experiments use 4 1-core pilots and between 8 and 64 compute units (CU). RADICAL-Analytics is used to acquire two data s... |
tensorflow/docs-l10n | site/ja/tutorials/estimator/boosted_trees.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... |
google/applied-machine-learning-intensive | content/00_prerequisites/01_intermediate_python/00-objects.ipynb | apache-2.0 | # 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 the L... |
bioinformatica-corso/lezioni | laboratorio/lezione4-08ott21/esercizio2-soluzione.ipynb | cc0-1.0 | input_file_name = './movies.csv'
n_most_popular = 15 # Parametro N
"""
Explanation: Esercizio 2
Considerare il file movies.csv ottenuto estraendo i primi 1000 record del dataset scaricabile all'indirizzo https://www.kaggle.com/rounakbanik/the-movies-dataset#movies_metadata.csv.
Tale dataset è in formato csv e contien... |
VictorQuintana91/Thesis | notebooks/test/002_pos_tagging-Copy1.ipynb | mit | import pandas as pd
df0 = pd.read_csv("../../data/interim/001_normalised_keyed_reviews.csv", sep="\t", low_memory=False)
df0.head()
# For monitoring duration of pandas processes
from tqdm import tqdm, tqdm_pandas
# To avoid RuntimeError: Set changed size during iteration
tqdm.monitor_interval = 0
# Register `pandas.... |
stevetjoa/stanford-mir | sheet_music_representations.ipynb | mit | ipd.SVG("https://upload.wikimedia.org/wikipedia/commons/2/27/MozartExcerptK331.svg")
ipd.YouTubeVideo('dP9KWQ8hAYk')
"""
Explanation: ← Back to Index
Sheet Music Representations
Music can be represented in many different ways. The printed, visual form of a musical work is called a score or sheet music. For examp... |
sbu-python-summer/python-tutorial | day-2/python-day2-exercises1.ipynb | bsd-3-clause | def four_letter_words(message):
words = message.split()
four_letters = [w for w in words if len(w) == 4]
return four_letters
message = "The quick brown fox jumps over the lazy dog"
print(four_letter_words(message))
"""
Explanation: Q 1 (function practice)
Let's practice functions. Here's a simple functio... |
TomAugspurger/PracticalPandas | Practical Pandas 02 - More Cleaning, More Data, and Merging.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_hdf('data/cycle_store.h5', key='merged')
df.head()
"""
Explanation: This is Part 2 in the Practical Pandas Series, where I work through a data analysis problem from start to finish.
It's a mis... |
tsivula/becs-114.1311 | demos_ch2/demo2_4.ipynb | gpl-3.0 | # Import necessary packages
import numpy as np
from scipy.stats import beta
%matplotlib inline
import matplotlib.pyplot as plt
# add utilities directory to path
import os, sys
util_path = os.path.abspath(os.path.join(os.path.pardir, 'utilities_and_data'))
if util_path not in sys.path and os.path.exists(util_path):
... |
tensorflow/docs-l10n | site/ja/probability/examples/Probabilistic_PCA.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
AllenDowney/ThinkStats2 | homeworks/homework04.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='white')
from utils import decorate
from thinkstats2 import Pmf, Cdf
import thinkstats2
import thinkplot
"""
Explanation: Homework 4
Regression
Allen Downey
MIT License
End of explanation
"... |
karlstroetmann/Artificial-Intelligence | Python/6 Classification/Gradient-Ascent.ipynb | gpl-2.0 | def findMaximum(f, gradF, start, eps):
x = start
fx = f(x)
alpha = 0.1 # learning rate
cnt = 0 # number of iterations
while True:
cnt += 1
xOld, fOld = x, fx
x += alpha * gradF(x)
fx = f(x)
print(f'cnt = {cnt}, f({x}) = {fx}')
print(f'... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160524화_7일차_기초 확률론 3 - 확률 모형 Probability Models(단변수 분포)/1.베르누이 확률 분포.ipynb | mit | theta = 0.6
rv = sp.stats.bernoulli(theta)
rv
xx = [0, 1]
plt.bar(xx, rv.pmf(xx), align="center")
plt.xlim(-1, 2)
plt.ylim(0, 1)
plt.xticks([0, 1], ["X=0", "X=1"])
plt.ylabel("P(x)")
plt.title("pmf of Bernoulli distribution")
plt.show()
"""
Explanation: 베르누이 확률 분포
베르누이 시도
결과가 성공(Success) 혹은 실패(Fail) 두 가지 중 하나로만 나오는 것... |
emalgorithm/Algorithm_Notebooks | Sorting/Sorting.ipynb | gpl-3.0 | # so our plots get drawn in the notebook
%matplotlib inline
from matplotlib import pyplot as plt
from random import randint
from time import clock
# a timer - runs the provided function and reports the
# run time in ms
def time_f(f):
before = clock()
f()
after = clock()
return after - before
# remembe... |
stellaxux/machine-learning-in-python | ch4/handling_categorical_data.ipynb | mit | # create a pandas dataframe with categorical variables to work with
import pandas as pd
df = pd.DataFrame([['green', 'M', 10.1, 'class1'],
['red', 'L', 13.5, 'class2'],
['blue', 'XL', 15.3, 'class1']])
df.columns = ['color', 'size', 'price', 'classlabel']
df
"""
Explanation: Han... |
nberliner/ChordDiagram | Chord Diagrams for Bokeh.ipynb | mit | # Each row defines how many items were "send" to the group specified by the column
# for the "golden image" use case, the matrix should be symmetric
matrix = np.array([[16, 3, 28, 0, 18],
[18, 0, 12, 5, 29],
[ 9, 11, 17, 27, 0],
[19, 0, 31, 11, 12],
... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/sandbox-1/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-1', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: SANDBOX-1
Topic: Atmoschem
Sub-Topics: Transport, ... |
PyladiesMx/Pyladies_ifc | 1. PrimitiveTypes_and_operators/.ipynb_checkpoints/objetos simples y operaciones básicas-checkpoint.ipynb | mit | import turtle
ventana = turtle.Screen()
ventana.bgcolor('lightblue')
ventana.title('Hello Erika!')
erika = turtle.Turtle()
erika.color('blue')
erika.pensize(5)
erika.forward(100)
erika.left(90)
erika.forward(100)
"""
Explanation: Bienvenid@s!!
En la reunión de hoy aprenderemos acerca de python y sus cimientos. Verem... |
terrydolan/lfctrio | lfctrio.ipynb | mit | %%html
<! left align the change log table in next cell >
<style>
table {float:left}
</style>
"""
Explanation: LFC Data Analysis: A Striking Trio
See Terry's blog LFC: A Striking Trio for a discussion of of the data generated by this analysis.
This notebook analyses Liverpool FC's goalscoring data from 1892-1893 to 201... |
chunweixu/Deep-Learning | Time-series/demo_full_notes.ipynb | mit | from IPython.display import Image
from IPython.core.display import HTML
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
Image(url= "https://cdn-images-1.medium.com/max/1600/1*UkI9za9zTR-HL8uM15Wmzw.png")
#hyperparams
num_epochs = 100
total_se... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-ll/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-ll', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-LL
Topic: Aerosol
Sub-Topics: Transport, Emis... |
geoneill12/phys202-2015-work | assignments/assignment03/NumpyEx03.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 3
Imports
End of explanation
"""
def brownian(maxt, n):
"""Return one realization of a Brownian (Wiener) process with n steps... |
jhprinz/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_1b_trajectory.ipynb | lgpl-2.1 | import openpathsampling as paths
"""
Explanation: This notebook is part of the fixed length TPS example. It requires the file alanine_dipeptide_tps_equil.nc, which is written in the notebook alanine_dipeptide_tps_first_traj.ipynb.
In this notebook, you will learn:
* how to set up a FixedLengthTPSNetwork
* how to exten... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/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', 'cccr-iitm', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissi... |
planetlabs/notebooks | jupyter-notebooks/label-data/label_maker_pl_mosaic.ipynb | apache-2.0 | import json
import os
import ipyleaflet as ipyl
import ipywidgets as ipyw
from IPython.display import Image
import numpy as np
"""
Explanation: Creating Labeled Data from a Planet Mosaic with Label Maker
In this notebook, we create labeled data for training a machine learning algorithm. As inputs, we use OpenStreetMa... |
mne-tools/mne-tools.github.io | 0.19/_downloads/ad79868fcd6af353ce922b8a3a2fc362/plot_30_info.ipynb | bsd-3-clause | import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_filt-0-40_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
"""
Explanation: The Info data structure
This tutori... |
mana99/machine-playground | kmeans-image_compression.ipynb | mit | from scipy import misc
pic = misc.imread('media/irobot.png')
"""
Explanation: Image compression with K-means
K-means is a clustering algorithm which defines K cluster centroids in the feature space and, by making use of an appropriate distance function, iteratively assigns each example to the closest cluster centroid ... |
google/automl | efficientnetv2/tfhub.ipynb | apache-2.0 | import itertools
import os
import matplotlib.pylab as plt
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
print('TF version:', tf.__version__)
print('Hub version:', hub.__version__)
print('Phsical devices:', tf.config.list_physical_devices())
def get_hub_url_and_isize(model_name, ckpt_type, ... |
leezu/mxnet | example/bi-lstm-sort/bi-lstm-sort.ipynb | apache-2.0 | import random
import string
import mxnet as mx
from mxnet import gluon, nd
import numpy as np
"""
Explanation: Using a bi-lstm to sort a sequence of integers
End of explanation
"""
max_num = 999
dataset_size = 60000
seq_len = 5
split = 0.8
batch_size = 512
ctx = mx.gpu() if mx.context.num_gpus() > 0 else mx.cpu()
... |
tiagoantao/biopython-notebook | notebooks/11 - Going 3D - The PDB module.ipynb | mit | from Bio.PDB.PDBParser import PDBParser
p = PDBParser(PERMISSIVE=1)
"""
Explanation: Source of the materials: Biopython cookbook (adapted)
<font color='red'>Status: Draft</font>
Going 3D: The PDB module
Bio.PDB is a Biopython module that focuses on working with crystal
structures of biological macromolecules. Among ot... |
jdhp-docs/python-notebooks | notebook_snippets_en.ipynb | mit | %matplotlib notebook
# As an alternative, one may use: %pylab notebook
# For old Matplotlib and Ipython versions, use the non-interactive version:
# %matplotlib inline or %pylab inline
# To ignore warnings (http://stackoverflow.com/questions/9031783/hide-all-warnings-in-ipython)
import warnings
warnings.filterwarnin... |
Python4AstronomersAndParticlePhysicists/PythonWorkshop-ICE | notebooks/07_02_scipy_stats.ipynb | mit | %matplotlib inline
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import pandas as pd
"""
Explanation: scipy stats
This notebook focuses on the use of the scipy.stats module
It is built based on a learn-by-example approach So it only covers a little part of the module's functionalities but ... |
ernestyalumni/MLgrabbag | kaggle/HOG_SVM32.ipynb | mit | def load_feat_vec(patientid,sub_name="stage1_feat"):
f=file("./2017datascibowl/"+sub_name+"/"+patientid+"feat_vec","rb")
arr = np.load(f)
f.close()
return arr
def prepare_inputX(sub_name="stage1_feat_lowres64", ratio_of_train_to_total = 0.4,
ratio_va... |
mne-tools/mne-tools.github.io | 0.20/_downloads/82590448493c884f52ea0c7ddc5b446b/plot_publication_figure.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Daniel McCloy <dan.mccloy@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable, ImageGrid
import mne
"""
Explanation: Make figures more public... |
eriksalt/jupyter | Python Quick Reference/Data Algorithms.ipynb | mit | items = [1, 2, 3]
# Get the iterator
it = iter(items) # Invokes items.__iter__()
# Run the iterator
next(it) # Invokes it.__next__()
next(it)
next(it)
# if you uncomment this line it would throw a StopOperation exception
# next(it)
"""
Explanation: Python Data Algorithms Quick Reference
Table Of Contents
<a href="... |
rishuatgithub/MLPy | tf/Text Classification.ipynb | apache-2.0 | imdb = keras.datasets.imdb
(train_data, train_label),(test_data,test_label) = imdb.load_data(num_words=10000)
"""
Explanation: Import wiki dataset
End of explanation
"""
print("Train data shape:",train_data.shape)
print("Test data shape:",test_data.shape)
print("Train label :",len(train_label))
print("First Imdb ... |
dsacademybr/PythonFundamentos | Cap08/DesafioDSA_Solucao/Missao2/missao2_solucao.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 7</font>
Download: http://github.com/dsacademybr
End of explanation
"""
import ... |
facaiy/book_notes | Mining_of_Massive_Datasets/Large-Scale_Machine_Learning/note.ipynb | cc0-1.0 | #exercise
"""
Explanation: 12 Large-Scale Machine Learning
All algorithms for analysis of data are designed to produce a useful summary of the data, from which decisions are made.
"machine learning" not only summarize our data; they are perceived as learning a model or classifier from the data, and thus discover somet... |
thewtex/TubeTK | examples/Demo-ConvertTubesToPolyData.ipynb | apache-2.0 | import os
import sys
import numpy
import itk
from itk import TubeTK as ttk
"""
Explanation: Convert Tubes To PolyData
This notebook contains a few examples of how to call wrapped methods in itk and ITKTubeTK.
ITK and TubeTK must be installed on your system for this notebook to work. Typically, this is accomplished b... |
eggie5/UCSD-MAS-DSE230 | hmwk2/HW-2.ipynb | mit | import findspark
findspark.init()
import pyspark
sc = pyspark.SparkContext()
# %install_ext https://raw.github.com/cpcloud/ipython-autotime/master/autotime.py
%load_ext autotime
def print_count(rdd):
print 'Number of elements:', rdd.count()
env="local"
files=''
path = "Data/hw2-files.txt"
if env=="prod":
pat... |
martinjrobins/hobo | examples/sampling/population-mcmc.ipynb | bsd-3-clause | import pints
import pints.toy as toy
import pints.plot
import numpy as np
import matplotlib.pyplot as plt
# Load a multi-modal logpdf
log_pdf = pints.toy.MultimodalGaussianLogPDF(
[
[2, 2],
[16, 12],
[24, 24],
],
[
[[1.2, 0.0], [0.0, 1.2]],
[[0.8, 0.2], [0.2, 1.4]],
... |
phobson/paramnormal | docs/tutorial/fitting.ipynb | mit | %matplotlib inline
import warnings
warnings.simplefilter('ignore')
import numpy as np
import matplotlib.pyplot as plt
import seaborn
import paramnormal
clean_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'}
seaborn.set(style='ticks', rc=clean_bkgd)
"""
Explanation: Fitting distributions to data with par... |
revspete/self-driving-car-nd | sem1/p3-behavioural-learning/P3-Behavioural-Cloning.ipynb | mit | import csv
from PIL import Image
import cv2
import numpy as np
import h5py
import os
from random import shuffle
import sklearn
"""
Explanation: Behavioral Cloning Notebook
Overview
This notebook contains project files for the Behavioral Cloning Project.
In this project, I use my knowledge on deep neural networks and... |
mspinaci/deep-learning-examples | Ridiculously overfitting models... or maybe not.ipynb | mit | from __future__ import division, print_function
from matplotlib import pyplot as plt
%matplotlib inline
import bcolz
import numpy as np
import pandas as pd
import os
import theano
import keras
from keras import backend as K
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Flatten, Lam... |
ayushmaskey/ayushmaskey.github.io | jupyter/pandas_moving_window_functions.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
%pylab inline
pylab.rcParams['figure.figsize'] = (19,6)
import numpy as np
import pandas as pd
"""
Explanation: Window function
rolling window --> how did i do last three days --> check everyday
expanding window --> all data equallu relevant --> old or new
End of e... |
takanory/python-machine-learning | Chapter11.ipynb | mit | # 単純な2次元のデータセットを生成する
from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples=150, # サンプル点の総数
n_features=2, # 特徴量の個数
centers=3, # クラスタの個数
cluster_std=0.5, # クラスタ内の標準偏差
shuffle=True, # サンプルをシャッフル
random_sta... |
shawger/uc-dand | P2/UCDAND-P2.ipynb | gpl-3.0 | # Start of code. This block is for imports, global variables, common functions and any setup needed for the investigation
%matplotlib inline
import pandas as pd
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#Set some common formatting
matplotlib.rcParams.update({'font.si... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a_eco/TD2A_Eco_Web_Scraping_corrige.ipynb | mit | import urllib
import bs4
import collections
import pandas as pd
# pour le site que nous utilisons, le user agent de python 3 n'est pas bien passé :
# on le change donc pour celui de Mozilla
req = urllib.request.Request('http://pokemondb.net/pokedex/national',
headers={'User-Agent': 'Moz... |
marioberges/F16-12-752 | projects/chingiw and chengchm/Data building.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import scipy
from scipy import stats
import matplotlib.pyplot as plt
"""
Explanation: Machine Learning Regression for Energy efficiency
Name: Oscar Wang, Chengcheng Mao
Id: chingiw, chengchm
Introduction
Heating load and Cooling load is a good indicator for building energy eff... |
lfairchild/PmagPy | data_files/notebooks/Intro to MagicDataFrames.ipynb | bsd-3-clause | from pmagpy import contribution_builder as cb
from pmagpy import ipmag
import os
import json
import numpy as np
import sys
import pandas as pd
from pandas import DataFrame
from pmagpy import pmag
working_dir = os.path.join("..", "3_0", "Osler")
"""
Explanation: This notebook demonstrates how to use the Python Magic... |
jegibbs/phys202-2015-work | assignments/assignment05/MatplotlibEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 3
Imports
End of explanation
"""
def well2d(x, y, nx, ny, L=1.0):
"""Compute the 2d quantum well wave function."""
# YOUR CODE HERE
raise NotImplementedError()
psi = well2d(np.linspace(0,1,10), np.... |
kit-cel/lecture-examples | ccgbc/ch6_LDPC_Final_Aspects/Repeat_Accumulate.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plot
from ipywidgets import interactive
from scipy.optimize import fsolve
import ipywidgets as widgets
import math
%matplotlib inline
"""
Explanation: Repeat Accumulate Codes on the BEC
This code is provided as supplementary material of the lecture Channel Coding 2 - Ad... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.