repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
mne-tools/mne-tools.github.io | stable/_downloads/758680cba517820dcb0b486577bea58f/70_fnirs_processing.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import matplotlib.pyplot as plt
from itertools import compress
import mne
fnirs_data_folder = mne.datasets.fnirs_motor.data_path()
fnirs_cw_amplitude_dir = op.join(fnirs_data_folder, 'Participant-1')
raw_intensity = mne.io.read_raw_nirx(fnirs_cw_amplitude_dir, verbose=True)
ra... |
datitran/Krimskrams | MachineLearning/Backpropagation.ipynb | mit | import numpy as np
"""
Explanation: Backpropagation
End of explanation
"""
"""
Gradient Descent
Example
f(x) = x**4 -3*x**3 + 2
f'(x) = 4*x**3 - 9*x**2
We want f'(x) = 0 - slope is zero / minima
Initial guess: x=4
f'(4) = 112
Second guess: x=-1
f'(-1) = -13
=> f'(4) > 0 => decrease x | f'(-1) < 0 => increase x
... |
phockett/ePSproc | notebooks/methodDev/geometric_method_dev_pt2_170320_v060420.ipynb | gpl-3.0 | # Imports
import numpy as np
import pandas as pd
import xarray as xr
# Special functions
# from scipy.special import sph_harm
import spherical_functions as sf
import quaternion
# Performance & benchmarking libraries
# from joblib import Memory
# import xyzpy as xyz
import numba as nb
# Timings with ttictoc or time
#... |
MartyWeissman/Python-for-number-theory | PwNT Notebook 2.ipynb | gpl-3.0 | def square(x):
answer = x * x
return answer
"""
Explanation: Part 2: Functions in Python
A distinguishing property of programming languages is that the programmer can create their own functions. Creating a function is like teaching the computer a new trick. Typically a function will receive some data as inp... |
metpy/MetPy | v1.0/_downloads/e3a381e26c1f7c055ae74476848708cb/Station_Plot_with_Layout.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import pandas as pd
from metpy.calc import wind_components
from metpy.cbook import get_test_data
from metpy.plots import (add_metpy_logo, simple_layout, StationPlot,
StationPlotLayout, wx_code_map)
fr... |
delsuc/MemoBio2015 | FTICR_1.ipynb | gpl-2.0 | import array
import os.path as op
import numpy as np
import matplotlib as mpl
import matplotlib.pylab as plt
%matplotlib inline
"""
Explanation: Example of processing FT-ICR data
First load some libraries
End of explanation
"""
ls FTICR-Files/ESI_pos_Ubiquitin_000006.d
"""
Explanation: locate the data-set which sh... |
theodoregoetz/wernher | sandbox/remotus_immobilous/002 First Launch.ipynb | gpl-3.0 | linkup = krpc.connect('192.168.1.2', name='First Flight')
import numpy as np
from matplotlib import pyplot, cm
inf = np.inf
isclose = np.isclose
π = np.pi
arctan = np.arctan
sign = np.sign
class Controller(object):
'''Single Axis PID Controller'''
def __init__(self,set_point=0,limits=(-inf,inf),kp=1,ki=0,kd=... |
vzg100/Post-Translational-Modification-Prediction | .ipynb_checkpoints/Phosphorylation Sequence Tests -MLP -dbptm+ELM -scalesTrain-VectorAvr.-phos_stripped-checkpoint.ipynb | mit | from pred import Predictor
from pred import sequence_vector
from pred import chemical_vector
"""
Explanation: Template for test
End of explanation
"""
par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"]
scale = [-1, "standard", "robust", "minmax", "max"]
for i in par:
for j in scale... |
thiagomarques2015/Kaio-machine-learning-human-face-detection | server/analysis/.ipynb_checkpoints/classify_who_is_notebook-checkpoint.ipynb | mit | from data import get_full_data, get_who_is
from matplotlib import pyplot as plt
from sklearn import linear_model
from predicting_who_is import accuracy_score, performance_metric
import pandas as pd
import numpy as np
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementa... |
jdhp-docs/python-notebooks | python_bokeh_en.ipynb | mit | import bokeh
from bokeh.plotting import figure, output_notebook, show
"""
Explanation: Bokeh
<a href="https://colab.research.google.com/github/jdhp-docs/notebooks/blob/master/python_bokeh_en.ipynb"><img align="left" src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab" title="Open and Exec... |
mlund/faunus-notebooks | titration/titrate.ipynb | mit | from __future__ import division, unicode_literals, print_function
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np, pandas as pd
import os.path, os, sys, json, filecmp, copy
plt.rcParams.update({'font.size': 16, 'figure.figsize': [8.0, 6.0]})
try:
workdir
except NameErr... |
AbhilashReddyM/GeometricMultigrid | notebooks/.ipynb_checkpoints/Multigrid-checkpoint.ipynb | mit | import numpy as np
"""
Explanation: The Making of a Preconditioner
by Abhilash Reddy M
This notebook ultimately demonstrates a multigrid preconditioned Krylov solver in python3. The code and more examples are present on github at GeometricMultigrid. The problem solved is the Poisson equation on a rectangular domain wi... |
katelynneese/dmdd | Testing Simulation_AM.ipynb | mit | print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5)
print dmdd.rate_UV.dRdQ(Q = np.asarray([100.]), sigma_si = 75.5)
print dmdd.dRdQ_AM(Q = [100.], sigma_si = 75.5, time = 365)
"""
Explanation: This cell demonstrates that dRdQ_AM has the same value as dRdQ at day 0 and day 365, when the v_lag is = 220.
End of explanatio... |
facaiy/book_notes | Mining_of_Massive_Datasets/Finding_Similar_Items/note.ipynb | cc0-1.0 | #Exercise 3.1.1
logger.setLevel(logging.WARNING)
data = [
set([1, 2, 3, 4]),
set([2, 3, 5, 7]),
set([2, 4, 6]),
]
def Jaccard_similarity_calc(set_a, set_b):
"""calculate the Jaccard similarity of two sets
res = \frac{a \cap b}{a \cup b}
"""
assert isinstance(set_a, set), '{} is n... |
ktmud/deep-learning | intro-to-tflearn/TFLearn_Sentiment_Analysis_Solution.ipynb | mit | 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... |
gojomo/gensim | docs/notebooks/topic_network.ipynb | lgpl-2.1 | !pip install plotly>=2.0.16 # 2.0.16 need for support 'hovertext' argument from create_dendrogram function
from gensim.models.ldamodel import LdaModel
from gensim.corpora import Dictionary
import pandas as pd
import re
from gensim.parsing.preprocessing import remove_stopwords, strip_punctuation
import numpy as np
""... |
jsvine/pdfplumber | examples/notebooks/ag-energy-roundup-curves.ipynb | mit | import pdfplumber
print(pdfplumber.__version__)
"""
Explanation: Demo: Extracting curve data from PDFs
The notebook demonstrates how to extract curve objects from PDFs using pdfplumber.
End of explanation
"""
report = pdfplumber.open("../pdfs/ag-energy-round-up-2017-02-24.pdf").pages[0]
im = report.to_image()
im
"... |
liganega/Gongsu-DataSci | notebooks/GongSu12_CSV_File_Data_Visualization.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: CSV 파일 다루기와 데이터 시각화
주요 내용
데이터 분석을 위해 가장 기본적으로 할 수 있고, 해야 하는 일이 데이터 시각화이다.
데이터를 시각화하는 것은 어렵지 않지만, 적합한 시각화를 만드는 일은 매우 어려우며,
많은 훈련과 직관이 요구된다.
여기서는 데이터를 탐색하여 얻어진 데이터를 시각화하는 기본적인 방법 네 가지를 배운다.
선그래프
막대그래프
히스토그램
산점도
오늘이 주요 예제
서울과 수도권의 1949년부터 2010년까지 인구증... |
akseshina/dl_course | seminar_1/homework_task2.ipynb | gpl-3.0 | mnist = input_data.read_data_sets('../data/mnist', one_hot=True)
"""
Explanation: Step 1: Read in data<br>
using TF Learn's built in function to load MNIST data to the folder data/mnist
End of explanation
"""
X = tf.placeholder(tf.float32, shape=[None, 784], name='features')
Y = tf.placeholder(tf.int32, shape=[None... |
python-visualization/folium | examples/plugin-Search.ipynb | mit | import geopandas
states = geopandas.read_file(
"https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json",
driver="GeoJSON",
)
cities = geopandas.read_file(
"https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_populated_places_simple.geojson",
driver="G... |
statkraft/shyft-doc | notebooks/grid-pp/ordinary_kriging_precipitation.ipynb | lgpl-3.0 | # First you should import the third-party python modules
# The first line enables that figures are shown inline, directly in the notebook
%pylab inline
from matplotlib import pyplot as plt
# If you want to use your own local build of shyft, you can set the path or the environment PYTHONPATH
# import os, sys
# from os ... |
arcyfelix/Courses | 18-11-22-Deep-Learning-with-PyTorch/01-Introduction to neural networks/06-Gradient-Descent-Algorithm/GradientDescent.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
#Some helper functions for plotting and drawing lines
def plot_points(X, y):
admitted = X[np.argwhere(y==1)]
rejected = X[np.argwhere(y==0)]
plt.scatter([s[0][0] for s in rejected], [s[0][1] for s in rejected], s = 25, color = 'blue', ... |
maueroats/teaching | docs/machine-learning/isl-ch2/_index.files/lab-02-03.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import scipy
import scipy.stats
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.simplefilter('ignore',FutureWarning)
"""
Explanation: ISL Lab 2.3 Introduction to Statistical Computing with Python
End of explanation
"""
np.arange(6)
a = np.arange... |
Kaggle/learntools | notebooks/intro_to_programming/raw/tut1.ipynb | apache-2.0 | print("Hello, world!")
"""
Explanation: Welcome to the Intro to Programming course! This course is for you if you have never written a single line of code, and you are interested in learning data science and machine learning. (If you do have programming experience and are just new to the Python language, the Python ... |
chili-epfl/allograph | notebooks/Letter Difficulty - Dissimilarity Measure of Multivariate Time Series Evolution.ipynb | isc | # Load the database of letters and numbers
subject_folders_path = os.path.join(os.getcwd(), "DB_wacomPaper_v2")
subject_folders = os.listdir(subject_folders_path)
letters_db = dict()
trajectories = dict()
for subject in tqdm(subject_folders):
letters_db[subject] = dict()
trajectories[subject] = dict()
let... |
joelau/joelau.github.io | notes/index.ipynb | mit | !wget https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg_cnn_s.pkl
"""
Explanation: Introduction
This example demonstrates using a network pretrained on ImageNet for classification. The model used was converted from the VGG_CNN_S model (http://arxiv.org/abs/1405.3531) in Caffe's Model Zoo.
For details o... |
fionapigott/Data-Science-45min-Intros | sklearn-101/sklearn-101.ipynb | unlicense | import numpy as np
import random
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Intro to scikit-learn, machine learning in Python
Part of our team's ongoing Data Science Workshops
2014-04-04, Josh Montague (@jrmontag)
Overview
This is a simple introduction to the sklearn API, with two examples usi... |
d-k-b/udacity-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... |
keras-team/keras-io | examples/generative/ipynb/molecule_generation.ipynb | apache-2.0 | !pip -q install rdkit-pypi==2021.9.4
import ast
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import matplotlib.pyplot as plt
from rdkit import Chem, RDLogger
from rdkit.Chem import BondType
from rdkit.Chem.Draw import MolsToGridImage... |
akshaybabloo/Car-ND | Term_1/TensorFlow_3/TensorFlow_Lab/solutions.ipynb | mit | # Problem 1 - Implement Min-Max scaling for grayscale image data
def normalize_grayscale(image_data):
"""
Normalize the image data with Min-Max scaling to a range of [0.1, 0.9]
:param image_data: The image data to be normalized
:return: Normalized image data
"""
a = 0.1
b = 0.9
grayscale... |
sylke-gruhnwald/weiterbildung_python | 03 Homework.ipynb | mit | a = list(range(10))
a
"""
Explanation: Hausaufgaben Einstieg in Python - Lektion 2
1.Kreiere eine Liste aus Zahlen, die aus 10 Elementen besteht, und ordne sie der Variabel a zu.
End of explanation
"""
b = list(range(100))
b
"""
Explanation: 2.Mache dasselbe mit einer Liste aus 100 Elementen und ordne sie der Var... |
mdda/fossasia-2016_deep-learning | notebooks/1-MLP/1-MNIST-MLP_theano.ipynb | mit | import numpy as np
import theano
import theano.tensor as T
import lasagne
import matplotlib.pyplot as plt
%matplotlib inline
import gzip
import pickle
# Seed for reproducibility
np.random.seed(42)
"""
Explanation: Theano + Lasagne :: MNIST MLP
This is a quick illustration of a single-layer network training on the M... |
idc9/law-net | download_data.ipynb | mit | # modify these for your own computer
repo_directory = '/Users/iaincarmichael/Dropbox/Research/law/law-net/'
data_dir = '/Users/iaincarmichael/data/courtlistener/'
"""
Explanation: This notebook downloads and cleans the SCOTUS subnetwork data. It can be modified to create any jurisdiction subnetwork and also the feder... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Visualization/Seaborn/Categorical Plots.ipynb | mit | import seaborn as sns
%matplotlib inline
tips = sns.load_dataset('tips')
tips.head()
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Categorical Data Plots
Now let's discuss using seaborn to plot categorical data! There are a few main plot types for this:
factorplot... |
ES-DOC/esdoc-jupyterhub | notebooks/uhh/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'uhh', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: UHH
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
akhambhati/rs-NMF_CogControl | Analysis_Notebooks/e03-Subgraph_Cognitive_Control-Dynamics.ipynb | gpl-3.0 | try:
%load_ext autoreload
%autoreload 2
%reset
except:
print 'NOT IPYTHON'
from __future__ import division
import os
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import sys
import glob
import numpy as np
import pandas as pd
#import se... |
AssembleSoftware/IoTPy | examples/ExamplesOfIncrementalPCA.ipynb | bsd-3-clause | permutation = np.random.permutation(len(iris_target))
iris_data = np.take(iris_data, permutation, axis=0)
iris_target = np.take(iris_target, permutation)
# Function to plot data
def plot_data(colors, names, data, target):
plt.figure(figsize=(8, 8))
N = len(names)
for color, i, target_name in zip(colors, li... |
dream-olfaction/olfaction-prediction | opc_python/paper/fig4ab-Morgan.ipynb | mit | # Load the data
descriptors = loading.get_descriptors(format=True)
sets = ['training','leaderboard']#,'testset'])
all_CIDs = loading.get_CIDs(sets)
all_CID_dilutions = loading.get_CID_dilutions(sets)
#features_full = dream.get_molecular_data(['dragon','episuite','morgan','nspdk','gramian'],all_CIDs)
features_drag_morg ... |
Roc-J/Python_data_science | 001_dict_for_statistic_text.ipynb | apache-2.0 | # init a sentence including many words
sentence = "The ability to analyze data with Python is critical in data science Learn the basics and move on to create stunning visualizations"
# init a dict
word_dict = {}
# analysis the words of the sentence and statistic the number of every word
for word in sentence.split():
... |
yiiinghuang/dmc | notebooks/week-2/02 - Introduction to Python - Conditionals and Loops.ipynb | apache-2.0 | b = True
if b:
print 'b is True'
"""
Explanation: Now that we understand variables, we can start to develop more complex code structures which can build more interesting functionality into our scripts. Up to this point, our scripts have been pretty basic, and limited to only executing in a top-down order, with on... |
MATH497project/MATH497-DiabeticRetinopathy | ICD_code_exploration/ICD_codes_dictionary.ipynb | mit | #{k:{k1:[item for item in v1.Enc_Nbr]
# for k1,v1 in v.groupby('Diagnosis_Code_ID')}
# for k,v in df.groupby('Person_Nbr')}
"""
Explanation: Group data by person_Nbr then by icd code. Same code may appear in different encounter. Same code may also appear within one encounter, which is suggested to keep only one.
E... |
dtrimarco/blog | posts/product_data_071317.ipynb | mit | import pandas as pd
data = pd.read_csv('test_user_data.csv')
print(data.head(10))
"""
Explanation: Pandas for Product Analysis Part 1: Apply and Transform
Python's pandas package is one of the most powerful tools for data analysis in the Python ecosystem. Built on top of NumPy, it makes working with tabular data quit... |
Upward-Spiral-Science/grelliam | code/descriptive_and_exploratory_answers.ipynb | apache-2.0 | # Import packages
import igraph as ig
import numpy as np
import math
import os
from subprocess import Popen, PIPE
# Initializing dataset names
dnames = list(['../data/desikan/MRN114', '../data/desikan/KKI2009', '../data/desikan/SWU4'])
print "Datasets: " + ", ".join(dnames)
print "D = " + str(len(dnames))
# Getting g... |
gabrielrezzonico/dogsandcats | notebooks/02 - Simple CNN.ipynb | mit | %autosave 0
IMAGE_SIZE = (360,404) # The dimensions to which all images found will be resized.
BATCH_SIZE = 32
NUMBER_EPOCHS = 8
TENSORBOARD_DIRECTORY = "../logs/simple_model/tensorboard"
TRAIN_DIRECTORY = "../data/train/"
VALID_DIRECTORY = "../data/valid/"
TEST_DIRECTORY = "../data/test/"
NUMBER_TRAIN_SAMPLES = 175... |
brclark-usgs/flopy | examples/Notebooks/flopy3_external_file_handling.ipynb | bsd-3-clause | import os
import sys
import shutil
import numpy as np
import flopy
print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('flopy version: {}'.format(flopy.__version__))
# make a model
nlay,nrow,ncol = 10,20,5
model_ws = os.path.join("data","external_demo")
if os.path.exists(model_ws):
shutil... |
IACS-CS-207/cs207-F17 | lectures/L17/L17.ipynb | mit | import sqlite3
"""
Explanation: Lecture 17: Databases
Monday, November 6th 2017
Introduction
Why Learn Databases
You will see many databases in your career.
SQL (Structured Query Language) is still very popular and will remain so for a long time. Hence, you will need to code SQL.
SQL is the language used to qu... |
AllenDowney/ThinkBayes2 | soln/chap07.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename... |
FZJ-IEK3-VSA/tsam | examples/aggregation_segment_period_opti.ipynb | mit | %load_ext autoreload
%autoreload 2
import copy
import os
import pandas as pd
import matplotlib.pyplot as plt
import tsam.timeseriesaggregation as tsam
import tsam.hyperparametertuning as tune
import tqdm
%matplotlib inline
"""
Explanation: tsam - Optimal combination of segments and periods
Determine the optimal combin... |
GoogleCloudPlatform/training-data-analyst | quests/sparktobq/04_bigquery.ipynb | apache-2.0 | # Catch-up cell. Run if you did not do previous notebooks of this sequence
!wget http://kdd.ics.uci.edu/databases/kddcup99/kddcup.data_10_percent.gz
BUCKET='cloud-training-demos-ml' # CHANGE
!gsutil cp kdd* gs://$BUCKET/
"""
Explanation: Migrating from Spark to BigQuery via Dataproc -- Part 4
Part 1: The original Sp... |
g-weatherill/notebooks | gmpe-smtk/Residuals-Training.ipynb | agpl-3.0 | %matplotlib inline
import numpy as np
import cPickle
input_database = "data/demo_records/metadata.pkl"
db1 = cPickle.load(open(input_database, "r"))
print "Number of records: %g" % db1.number_records()
"""
Explanation: Comparing GMPEs with Observed Ground Motions
This tutorial illustrates how to use a database of st... |
josh-gree/maths-with-python | 08-statistics.ipynb | mit | !head southampton_precip.txt
"""
Explanation: There are many specialized packages for dealing with data analysis and statistical programming. One very important code that you will see in MATH1024, Introduction to Probability and Statistics, is R. A Python package for performing similar analysis of large data sets is p... |
AllenDowney/ThinkBayes2 | examples/world_cup_mcmc_soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import classes from thinkbayes2
from thinkbayes2 import Pmf, Cdf, Suite
import thinkbayes2
import thin... |
arthurtsang/deep-learning | first-neural-network/dlnd-your-first-neural-network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/object_detection.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
tleonhardt/CodingPlayground | dataquest/DataVisualiation/Customizing_Data_Visualizations.ipynb | mit | # Setup the environment by importing the libraries we need
import pandas as pd
import matplotlib.pyplot as plt
# And run the necessary Jupyter magic so plots are displayed inline
%matplotlib notebook
# Read the dataset into a DataFrame
recent_grads = pd.read_csv('../data/recent-grads.csv')
# Start exploring the begi... |
mbuchove/notebook-wurk-b | stats/HW_4_PS.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy import optimize, ndimage
from astropy.io import fits
#Import file and plot data
starfile = fits.open('hw3prob1-data.fits')
stardata = starfile[0].data
#plt.contourf(stardata)
#plt.colorbar()
#Gaussian fit from HW3
def gaussian_f(z,sig... |
badlands-model/BayesLands | Examples/etopo_fast/etopo.ipynb | gpl-3.0 | from pyBadlands.model import Model as badlandsModel
# Initialise model
model = badlandsModel()
# Define the XmL input file
model.load_xml('etopo.xml')
"""
Explanation: Real topography model
Using the bathymetric/topographic grid produced with ETOPO1 using badlands companion, we investigate the geomorphological evolut... |
kubeflow/pipelines | components/gcp/dataproc/submit_pyspark_job/sample.ipynb | apache-2.0 | %%capture --no-stderr
!pip3 install kfp --upgrade
"""
Explanation: Name
Data preparation using PySpark on Cloud Dataproc
Label
Cloud Dataproc, GCP, Cloud Storage,PySpark, Kubeflow, pipelines, components
Summary
A Kubeflow Pipeline component to prepare data by submitting a PySpark job to Cloud Dataproc.
Details
Intend... |
lindsayad/jupyter_notebooks | sage_scratch.ipynb | mit | bm2 = .00202183
height = 198.12
radius = var('radius')
solns = solve(bm2 == (pi/height)^2 + (2.405/radius)^2, radius, solution_dict=True)
[s[radius].n() for s in solns]
radius = solns[1][radius].n()
print(radius)
nu = 2.43654
sigma_f = 1.3769e-3
sigma_a = 2.21110e-3
diff = 5.31788e-1
bm2_calc = (nu * sigma_f - sigma... |
intellimath/pyaxon | examples/axon_readable_as_yaml.ipynb | mit | # print all urls
import yaml
import io
val = yaml.safe_load(io.open("example_config.yaml", "rt"))
print([entry["url"] for entry in val["handlers"]])
"""
Explanation: Isn't AXON as readable as YAML?
Let's consider example of YAML formatted configuration file:
``` yaml
application: myapp
version: alpha-001
runtime: pyth... |
smorton2/think-stats | code/chap05soln.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
import analytic
import thinkstats2
import thinkplot
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensou... |
andres-de-castro/scraping | pyTorontoPresentation.ipynb | mit | import pandas as pd
url = 'http://performance.morningstar.com/Performance/stock/split-history.action?&t=AAPL'
pd.read_html(url)[0]
"""
Explanation: Lessons Learned Scraping The Web
Hacking public, inflexbile APIs and discovering concurrency
Andres De Castro
https://github.com/andres-de-castro/scraping
Live presentat... |
KMFleischer/PyEarthScience | Visualization/PyNGL/PyEarthScience_filled_markers_instead_grid_cells_PyNGL.ipynb | mit | from __future__ import print_function
import numpy as np
import Ngl,Nio
"""
Explanation: DKRZ PyNGL example
- Filled circles instead of grid cells; the size depends on a quality value.
Description:
Draw two plots, first plot is a raster contour plot and the second shows
the data using filled circles which are sized by... |
Kaggle/learntools | notebooks/data_viz_to_coder/raw/tut5.ipynb | apache-2.0 | #$HIDE$
import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
print("Setup Complete")
"""
Explanation: In this tutorial you'll learn all about histograms and density plots.
Set up the notebook
As always, we begin by setting up the codi... |
trangel/Data-Science | tmp/Freedom exploration-v2.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib as plt
import seaborn as sns
filename='TABLE_III._Deaths_in_122_U.S._cities.csv'
df = pd.read_csv(filename)
df = df[:1000]
"""
Explanation: Freedom exploration
Data exploration
End of explanation
"""
df.describe()
"""
Explanation: <a id='... |
adrienlina/jupyter-silent-import | results_presentation.ipynb | mit | plot_approximation()
"""
Explanation: Approximation of Pi
Theory
We approximated the value of $\pi$ (the ratio of a circle's perimeter to its diameter) using the Monte Carlo Method.
For that, we sample uniformly the available points of the square $[-1, +1]^2$. We then compute the ratio of pionts that follow the implic... |
phoebe-project/phoebe2-docs | development/examples/contact_spots.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Contact Binary with Spots
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
logger = phoeb... |
samstav/scipy_2015_sklearn_tutorial | notebooks/03.6 Case Study - Titanic Survival.ipynb | cc0-1.0 | from sklearn.datasets import load_iris
iris = load_iris()
print(iris.data.shape)
"""
Explanation: Feature Extraction
Here we will talk about an important piece of machine learning: the extraction of
quantitative features from data. By the end of this section you will
Know how features are extracted from real-world d... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: MRI
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
gojomo/gensim | docs/notebooks/wikinews-bigram-en.ipynb | lgpl-2.1 | LANG="english"
%%bash
fdate=20170327
fname=enwikinews-$fdate-cirrussearch-content.json.gz
if [ ! -e $fname ]
then
wget "https://dumps.wikimedia.org/other/cirrussearch/$fdate/$fname"
fi
# iterator
import gzip
import json
FDATE = 20170327
FNAME = "enwikinews-%s-cirrussearch-content.json.gz" % FDATE
def iter_te... |
ES-DOC/esdoc-jupyterhub | notebooks/nims-kma/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', 'nims-kma', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NIMS-KMA
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emission... |
phoebe-project/phoebe2-docs | 2.0/tutorials/intens_weighting.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Intensity Weighting
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
... |
keras-team/keras-io | guides/ipynb/keras_tuner/getting_started.ipynb | apache-2.0 | !pip install keras-tuner -q
"""
Explanation: Getting started with KerasTuner
Authors: Luca Invernizzi, James Long, Francois Chollet, Tom O'Malley, Haifeng Jin<br>
Date created: 2019/05/31<br>
Last modified: 2021/10/27<br>
Description: The basics of using KerasTuner to tune model hyperparameters.
End of explanation
"""... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/time_series_prediction/labs/optional_2_feature_engineering.ipynb | apache-2.0 | PROJECT = 'your-gcp-project' # Replace with your project ID.
import pandas as pd
from google.cloud import bigquery
from IPython.core.magic import register_cell_magic
from IPython import get_ipython
bq = bigquery.Client(project = PROJECT)
# Allow you to easily have Python variables in SQL query.
@register_cell_magi... |
hover2pi/svo_filters | svo_demo.ipynb | mit | from svo_filters import svo
"""
Explanation: Introduction
The Spanish Virtual Observatory (SVO) Filter Profile Service is a great resource for homogenized photometric filter curves and metadata. With svo_filters, I tried to create a lightweight and flexible package to incorporate these filters into Python applications... |
mjbrodzik/ipython_notebooks | charis/Convert_evap_clim_by_basin.ipynb | apache-2.0 | import pandas as pd
import numpy as np
from charistools.hypsometry import Hypsometry
from charistools.modelEnv import ModelEnv
from charistools.readers import read_tile
dirname = '/Users/brodzik/projects/CHARIS/evaporation/merra'
%cd $dirname
%ls
filename = 'merra_evap_high_asia_calibration_basins_month_clim.txt'
dr... |
robertoalotufo/ia898 | 2S2018/Seminarios/B_Correlação_Cruzada_Scipy.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from scipy import signal
img = mpimg.imread('../figures/lena_greyscale.png')
arr = np.asarray(img)
template = np.copy(arr[240:290, 240:290])
#plt.figure(figsize=(15,10))
plt.subplot(1,2,1)
plt.title('Template - olhos de Lena')
plt.ims... |
arnicas/eyeo_nlp | python/.ipynb_checkpoints/TFIDF_Clustering-checkpoint.ipynb | cc0-1.0 | %matplotlib inline
# You can ignore the pink warning that appears
import itertools
import math
import nltk
import string
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
from scipy.spatial.distance import pdist, squareform
from scipy.cluster.hierarchy impor... |
irisliu0616/Short-text-Classification | Model/Yahoo/yahoo_SVM.ipynb | mit | from __future__ import print_function
import os
import time
import sys
#from tabulate import tabulate
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from collections import Counter, defaultdict
from sklearn import *
from sklearn.feature_extraction.text import CountVectorizer
... |
Diyago/Machine-Learning-scripts | DEEP LEARNING/NLP/text analyses/CookingLDA_PA.ipynb | apache-2.0 | import json
with open("recipes.json") as f:
recipes = json.load(f)
print recipes[0]
"""
Explanation: Programming Assignment
Готовим LDA по рецептам
Как вы уже знаете, в тематическом моделировании делается предположение о том, что для определения тематики порядок слов в документе не важен; об этом гласит гипотеза... |
Jonestj1/mbuild | docs/tutorials/tutorial_ethane.ipynb | mit | import mbuild as mb
class CH3(mb.Compound):
def __init__(self):
super(CH3, self).__init__()
mb.load('ch3.pdb', compound=self)
"""
Explanation: Ethane: Reading from files, Ports and coordinate transforms
In this example, we'll cover reading molecular components from files, introduce the concept of... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/14. Lists.ipynb | mit | a = [] # empty list
b = [True] # single item, a boolean
c = [1, 2, 3, 4] # list of 4 numbers
d = ["a", 2, "b", 4] # strings and numbers
e = [ [1,2], [2,3], [3,2]] # lists within lists
print(a,b,c,d,e, sep="\n")
# Also, if you want to create a list of size n wit... |
MaxPoint/spylon | examples/01_SpylonExample.ipynb | bsd-3-clause | import spylon
import spylon.spark as sp
c = sp.SparkConfiguration()
c._spark_home = "/path/to/spark-1.6.2-bin-hadoop2.6"
c.master = ["local[4]"]
(sc, sqlContext) = c.sql_context("MyApplicationName")
from spylon.spark.spark import SparkJVMHelpers
helpers = SparkJVMHelpers(sc)
"""
Explanation: Some boilerplate
Importi... |
tpin3694/tpin3694.github.io | machine-learning/hyperparameter_tuning_using_grid_search.ipynb | mit | # Load libraries
import numpy as np
from sklearn import linear_model, datasets
from sklearn.model_selection import GridSearchCV
"""
Explanation: Title: Hyperparameter Tuning Using Grid Search
Slug: hyperparameter_tuning_using_grid_search
Summary: How to conduct grid search for hyperparameter tuning in scikit-learn for... |
jmschrei/pomegranate | examples/bayesnet_asia.ipynb | mit | %pylab inline
from pomegranate import *
"""
Explanation: Asia Bayesian Network.
authors:<br>
Jacob Schreiber [<a href="mailto:jmschreiber91@gmail.com">jmschreiber91@gmail.com</a>]<br>
Nicholas Farn [<a href="mailto:nicholasfarn@gmail.com">nicholasfarn@gmail.com</a>]
This example shows how to create an Asia Bayesian Ne... |
hetaodie/hetaodie.github.io | assets/media/uda-ml/code/boston_housing/boston_housing.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
from sklearn.model_selection import ShuffleSplit
# Import supplementary visualizations code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Load the Boston housing dataset
data = pd.read_csv('hous... |
topcatse/maker-presentation | notebooks/Presentation.ipynb | apache-2.0 | from IPython.core.display import HTML
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/pOSqctHH9vY" frameborder="0" allowfullscreen></iframe>')
"""
Explanation: Programutveckling med Git
En introduktion
Most images in this presentation are from the Pro Git book. The entire Pro Git book, writte... |
jokedurnez/RequiredEffectSize | Figure1_Power/.ipynb_checkpoints/RequiredEffectSizeForSufficientPower-checkpoint.ipynb | mit | % matplotlib inline
from __future__ import division
import os
import nibabel as nib
import numpy as np
from neuropower import peakdistribution
import scipy.integrate as integrate
import pandas as pd
import matplotlib.pyplot as plt
import palettable.colorbrewer as cb
"""
Explanation: Figure: How large should effect siz... |
IoA-coding/codecorners | material/2017_11_07/Cython_CodeCorner.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
#helper function to generate points
def gen_points_sphere(n):
"""
generate random points on sphere
"""
#angles
costheta = 2*np.random.rand(n)-1
theta = np.arccos(costheta)
phi = 2*np.pi*np.random.rand(n)
#unit vectors... |
julienchastang/unidata-python-workshop | notebooks/Model_Output/Downloading model fields with NCSS.ipynb | mit | # Resolve the latest GFS dataset
import metpy
from siphon.catalog import TDSCatalog
# Set up access via NCSS
gfs_catalog = ('http://thredds.ucar.edu/thredds/catalog/grib/NCEP/GFS/'
'Global_0p5deg/catalog.xml?dataset=grib/NCEP/GFS/Global_0p5deg/Best')
cat = TDSCatalog(gfs_catalog)
ncss = cat.datasets[0].... |
tjwei/HackNTU_Data_2017 | Week11/DIY_AI/FeedForward-Backpropagation.ipynb | mit | # 參考範例, 各種函數、微分
%run -i solutions/ff_funcs.py
# 參考範例, 計算 loss
%run -i solutions/ff_compute_loss2.py
"""
Explanation: Chain Rule
考慮 $F = f(\mathbf{a},\mathbf{g}(\mathbf{b},\mathbf{h}(\mathbf{c}, \mathbf{i}))$
$\mathbf{a},\mathbf{b},\mathbf{c},$ 代表著權重 , $\mathbf{i}$ 是輸入
站在 \mathbf{g} 的角度,為了要更新權重,我們想算
$\frac{\partial ... |
ctools/ctools | doc/source/users/tutorials/cta/howto/howto_advanced_python_fitting.ipynb | gpl-3.0 | import gammalib
import ctools
import cscripts
"""
Explanation: How to do advanced model manipulation and fitting in Python?
In this tutorial you will learn to perform some more advanced model manipulation and fitting from Python. You can use these methods in an interactive Python session to explore your dataset and im... |
rubensfernando/mba-analytics-big-data | Python/2016-07-22/aula2-parte2-classes.ipynb | mit | class Pessoa(object):
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
joao = Pessoa()
joao = Pessoa('João', 20)
print(joao, '\n')
print(joao.nome)
print(joao.idade)
joao.nome = 'João Pedro'
print(joao.nome)
maria = Pessoa('Maria', 20)
print(maria)
print(maria.nome)
print(mar... |
scikit-optimize/scikit-optimize.github.io | dev/notebooks/auto_examples/plots/partial-dependence-plot-with-categorical.ipynb | bsd-3-clause | print(__doc__)
import sys
from skopt.plots import plot_objective
from skopt import forest_minimize
import numpy as np
np.random.seed(123)
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_breast_cancer
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import... |
ricklupton/sankeyview | docs/cookbook/forwards-backwards.ipynb | mit | import pandas as pd
from io import StringIO
flows = pd.read_csv(StringIO("""
source,target,type,value
a,b,main,2
a,c,main,1
c,d,main,3
b,c,back,2
"""))
flows
"""
Explanation: Forwards & backwards flows
This recipe demonstrates how forwards and backwards flows work.
For demonstration, the CSV data is written directly... |
kubeflow/kfp-tekton-backend | samples/core/ai_platform/ai_platform.ipynb | apache-2.0 | %%capture
# Install the SDK (Uncomment the code if the SDK is not installed before)
!python3 -m pip install 'kfp>=0.1.31' --quiet
!python3 -m pip install pandas --upgrade -q
# Restart the kernel for changes to take effect
import json
import kfp
import kfp.components as comp
import kfp.dsl as dsl
import pandas as p... |
rashikaranpuria/Machine-Learning-Specialization | Machine Learning Foundations: A Case Study Approach/Assignment_two/Analyzing product sentiment.ipynb | mit | import graphlab;
"""
Explanation: Predicting sentiment from product reviews
Fire up GraphLab Create
End of explanation
"""
products = graphlab.SFrame('amazon_baby.gl/')
"""
Explanation: Read some product review data
Loading reviews for a set of baby products.
End of explanation
"""
products.head()
"""
Explanati... |
carpentries-nl/numpy-lesson | 2016-04-SRON-NumPy.ipynb | cc0-1.0 | import numpy as np
a = np.arange(5)
a
a.size
a.shape
"""
Explanation: Introduction to NumPy
Topics:
First contact
Dimensions
Linear algebra
Data files
Instructional material, unless otherwise indicated, by Markus van Dijk (SURFsara). Made available under CC0 https://creativecommons.org/publicdomain/zero/1.0/
Firs... |
andygup/geodev-hackerlabs | develop/python_api/add layer to map.ipynb | apache-2.0 | from arcgis.gis import GIS
import getpass
password = getpass.getpass("Enter your ArcGIS Organizational Account Password: ")
gis = GIS("https://esrihax.maps.arcgis.com", "johnyHack", password)
print("Logged in successfully to {} as {}.".format(gis.properties.urlKey + '.' + gis.properties.customBaseUrl, \
... |
mne-tools/mne-tools.github.io | 0.23/_downloads/9e70404d3a55a6b6d1c1877784347c14/mixed_source_space_inverse.ipynb | bsd-3-clause | # Author: Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD (3-clause)
import os.path as op
import matplotlib.pyplot as plt
from nilearn import plotting
import mne
from mne.minimum_norm import make_inverse_operator, apply_inverse
# Set dir
data_path = mne.datasets.sample.data_path()
subject = 'sample'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.