repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
timothydmorton/isochrones
notebooks/batch-demo.ipynb
mit
import numpy as np from isochrones import get_ichrone bands = ['J', 'H', 'K', 'G', 'BP', 'RP'] mist = get_ichrone('mist', bands=bands) from itertools import product primary_masses = [0.8, 1.0] mass_ratios = [0.5, 0.9] feh_grid = [-0.25, 0.0] age = 9.7 distance = 500 AV = 0. m1, m2, feh, name = zip(*[(m, q*m, f, f'...
phoebe-project/phoebe2-docs
development/tutorials/distributions.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" import phoebe logger = phoebe.logger() b = phoebe.default_binary() b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,101)) """ Explanation: Distributions Distributions are mostly useful when using samplers (which we'll see in the next tutorial on solving the inverse problem)...
tensorflow/neural-structured-learning
g3doc/tutorials/adversarial_keras_cnn_mnist.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
mne-tools/mne-tools.github.io
0.24/_downloads/d12911920e4d160c9fd8c97cffdda6b7/time_frequency_erds.ipynb
bsd-3-clause
# Authors: Clemens Brunner <clemens.brunner@gmail.com> # Felix Klotzsche <klotzsche@cbs.mpg.de> # # License: BSD-3-Clause """ Explanation: Compute and visualize ERDS maps This example calculates and displays ERDS maps of event-related EEG data. ERDS (sometimes also written as ERD/ERS) is short for event-relat...
Kaggle/learntools
notebooks/deep_learning_intro/raw/tut5.ipynb
apache-2.0
#$HIDE_INPUT$ # Setup plotting import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') # Set Matplotlib defaults plt.rc('figure', autolayout=True) plt.rc('axes', labelweight='bold', labelsize='large', titleweight='bold', titlesize=18, titlepad=10) import pandas as pd red_wine = pd.read_csv('../inpu...
WenboTien/Crime_data_analysis
exploratory_data_analysis/.ipynb_checkpoints/UCIrvine_Crime_data_analysis-checkpoint.ipynb
mit
df = pd.read_csv('../datasets/UCIrvineCrimeData.csv'); df = df.replace('?',np.NAN) features = [x for x in df.columns if x not in ['state', 'community', 'communityname', 'county' , 'ViolentCrimesPerPop']] """ Explanation: Read the CSV We use pandas read_csv(path/to/csv) me...
nehal96/Deep-Learning-ND-Exercises
Transfer-Learning/Transfer_Learning.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
mne-tools/mne-tools.github.io
dev/_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...
AtmaMani/pyChakras
udemy_ml_bootcamp/Machine Learning Sections/Support-Vector-Machines/Support Vector Machines with Python.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Support Vector Machines with Python Welcome to the Support Vector Machines with Python Lecture Notebook! Rem...
MTG/sms-tools
notebooks/E10-1-Music-piece.ipynb
agpl-3.0
import sys, os sys.path.append('../software/models/') import utilFunctions as UF # read sounds chosen and perform the analysis ### your code here """ Explanation: Exercise 10-1: Music piece combining sound transformations The aim of this exercise is to extend what you did in Exercise 8 by having no limitations on ...
DSSatPitt/katz-python-workshop
intro-to-python/participant.ipynb
cc0-1.0
# open the source CSV file csv = open("cars.csv") # create a list with the column names. we assume the first row contiains them. # we strip the carriage return (if there is one) from the line, then split values on the commas. # Note: this uses a nifty python feature called 'list comprehension' to do it in one line col...
akutuzov/webvectors
preprocessing/rusvectores_tutorial.ipynb
gpl-3.0
import wget udpipe_url = 'https://rusvectores.org/static/models/udpipe_syntagrus.model' text_url = 'https://rusvectores.org/static/henry_sobolya.txt' modelfile = wget.download(udpipe_url) textfile = wget.download(text_url) """ Explanation: RusVectōrēs: семантические модели для русского языка Елизавета Кузьменко, Анд...
femtotrader/barchart-ondemand-client-python
notebooks/example.ipynb
bsd-3-clause
#barchart.API_KEY = 'YOURAPIKEY' """ Explanation: API key setup End of explanation """ import datetime import requests_cache session = requests_cache.CachedSession(cache_name='cache', backend='sqlite', expire_after=datetime.timedelta(days=1)) #session = None # pass a None session to avoid caching queries """ Ex...
aleph314/K2
Foundations/Python CS/Activity 08.ipynb
gpl-3.0
def function_plot(ω0=1, ω1=1): # Define x axis range x = np.linspace(-4*np.pi, 4*np.pi, 100) # Add labels to x and y axis plt.xlabel('$x$') plt.ylabel('$\exp(x/10) \cdot \sin(\omega_{1}x) \cdot \cos(\omega_{0}x)$') # Limit x axis between start and end point of the range plt.xlim(x[0], x[-1])...
sorig/shogun
doc/ipython-notebooks/neuralnets/neuralnets_digits.ipynb
bsd-3-clause
%pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from scipy.io import loadmat from shogun import features, MulticlassLabels, Math # load the dataset dataset = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat')) Xall = dataset['data'] # the usps dataset...
huajianmao/learning
coursera/deep-learning/4.convolutional-neural-networks/week2/.ipynb_checkpoints/pa.1.Keras - Tutorial - Happy House v1-checkpoint.ipynb
mit
import numpy as np from keras import layers from keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D from keras.layers import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D from keras.models import Model from keras.preprocessing import im...
chengjun/iching
iching_intro.ipynb
mit
from iching import iching iching.ichingDate(1985052620150704) """ Explanation: iching is a packge developed by Cheng-Jun Wang. It employs the method of Shicao prediction to reproce the prediction of I Ching--the Book of Exchanges. The I Ching ([î tɕíŋ]; Chinese: 易經; pinyin: Yìjīng), also known as the Classic of Cha...
opalytics/opalytics-ticdat
examples/expert_section/notebooks/pandas_and_ticdat.ipynb
bsd-2-clause
import ticdat.testing.testutils as tdu from ticdat import TicDatFactory tdf = TicDatFactory(**tdu.netflowSchema()) dat = tdf.copy_tic_dat(tdu.netflowData()) """ Explanation: pandas and ticdat pandas is arguably the most successful data library in history, not just for Python but across all languages. That said, in th...
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/statespace_chandrasekhar.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from pandas_datareader.data import DataReader """ Explanation: State space models - Chandrasekhar recursions End of explanation """ cpi_apparel = DataReader('CPIAPPNS', 'fred', start='1986') cpi_a...
zrhans/python
exemplos/manipulacao-estatistica-de-dados-meteorologicos.ipynb
gpl-2.0
import pandas as pd from pandas import DataFrame import datetime import pandas.io.data ## Vamos utilizar para acesso à API do Yahoo finance e importação de dados import matplotlib.pyplot as plt csna3 = pd.io.data.get_data_yahoo('CSNA3.SA', start = datetime.datetime(2000,10,1), ...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_decoding_csp_space.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Romain Trachel <romain.trachel@inria.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ ...
zhouqifanbdh/liupengyuan.github.io
chapter1/homework/localization/201621198175.ipynb
mit
def product_sum(end): i = 1 total_n = 1 while i < end: i += 1 total_n *= i return total_n m = int(input("请输入第1个整数,以回车结束:")) n = int(input("请输入第2个整数,以回车结束:")) k = int(input("请输入第3个整数,以回车结束:")) print("最终的和是:",product_sum(m)+product_sum(n)+product_sum(k)) """ Explanation: 练习 1:仿照求 ∑...
patrickmineault/xcorr-notebooks
notebooks/Multi-armed bandit as a Markov decision process.ipynb
mit
import itertools import numpy as np from pprint import pprint def sorted_values(dict_): return [dict_[x] for x in sorted(dict_)] def solve_bmab_value_iteration(N_arms, M_trials, gamma=1, max_iter=10, conv_crit = .01): util = {} # Initialize every state to utility 0. ...
enbanuel/phys202-2015-work
assignments/assignment04/MatplotlibEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 2 Imports End of explanation """ !head -n 30 open_exoplanet_catalogue.txt """ Explanation: Exoplanet properties Over the past few decades, astronomers have discovered thousands of extrasolar planets. The follo...
kubeflow/kfp-tekton-backend
samples/core/lightweight_component/lightweight_component.ipynb
apache-2.0
# Install the SDK #!pip3 install 'kfp>=0.1.31.2' --quiet import kfp import kfp.components as comp """ Explanation: Lightweight python components Lightweight python components do not require you to build a new container image for every code change. They're intended to use for fast iteration in notebook environment. Bu...
tensorflow/docs-l10n
site/en-snapshot/model_optimization/guide/quantization/training_comprehensive_guide.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...
luchorivera/Prueba
Kaggle_Panda_Curso.ipynb
mit
import pandas as pd """ Explanation: <a href="https://colab.research.google.com/github/luchorivera/Prueba/blob/master/Kaggle_Panda_Curso.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> https://www.kaggle.com/residentmario/creating-reading-and-writin...
vipmunot/Data-Science-Course
Data Visualization/Lab 8/w08_lab_Vipul_Munot.ipynb
mit
import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import numpy as np import scipy.stats as ss import warnings warnings.filterwarnings("ignore") sns.set_style('white') %matplotlib inline """ Explanation: W8 Lab Assignment End of explanation """ x = np.array([1, 1, 1,1, 10, 100, 1000]) y = np...
jamesmarva/maths-with-python
10-generators.ipynb
mit
def naivesum_list(N): """ Naively sum the first N integers """ A = 0 for i in list(range(N + 1)): A += i return A """ Explanation: Iterators and Generators In the section on loops we introduced the range function, and said that you should think about it as creating a list of numbers. In Python 2.X th...
ellisonbg/talk-2014
Jupyter and IPython.ipynb
mit
from IPython.display import display, Image, HTML from talktools import website, nbviewer """ Explanation: Projects Jupyter and IPython End of explanation """ import ipythonproject ipythonproject.core_devs() """ Explanation: Overview Jupyter and IPython are a pair of open source projects that together offer an open...
JAmarel/Phys202
Matplotlib/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.""" return (2/L)*np.sin(nx * np.pi * x/L)*np.sin(ny * np.pi * y/L) psi = well2d(np.linspac...
3DGenomes/tadbit
doc/notebooks/install.ipynb
gpl-3.0
%%bash wget -nv https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh """ Explanation: Installing TADbit on GNU/Linux TADbit requires python2 >= 2.6 or python3 >= 3.6 as well as several dependencies that are listed below. Dependencies Conda Conda (http://conda.pydata.org/docs/index.htm...
andher/labs
Modeling Oscellation.ipynb
gpl-3.0
%matplotlib inline """ Explanation: Esteban Martinez, Andres Heredia Introduction The purpose of this lab is to find out the effects of mass on the oscillation of a spring scale. We will put several weights on the scale and record the oscillation time five times, after which we will take the average. Procedure $$Osci...
UChicagoPhysics/SampleExercises
exercises/electricityAndMagnetism/Poynting Vector of Half-Wave Antenna.ipynb
gpl-2.0
import numpy as np import matplotlib.pylab as plt """ Explanation: Poynting Vector of Half-Wave Antenna PROGRAM: Poynting vector of half-wave antenna CREATED: 5/30/2018 Import packages. End of explanation """ #Define constants - permeability of free space, speed of light, current amplitude. u_0 = 1.26 * 10**(-6) c...
robertoalotufo/ia898
master/tutorial_ti_2.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import sys,os ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/') if ia898path not in sys.path: sys.path.append(ia898path) import ia898.src as ia """ Explanation: Table of Contents <p><div class="lev1 to...
huazhisong/race_code
kaggle_ws/titanic_ws/Titanic Data Science Solutions.ipynb
gpl-3.0
# data analysis and wrangling import pandas as pd import numpy as np import random as rnd # visualization import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline # machine learning from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC, LinearSVC from sklearn.ensemble import ...
rsignell-usgs/notebook
HOPS/hops_velocity3.ipynb
mit
from netCDF4 import Dataset #url = ('http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/' # 'nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_2015081612_01h.nc') url = ('/usgs/data2/rsignell/gdrive/' 'nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_20...
sauravrt/signal-processing
ipynb/BeamformingFFT.ipynb
gpl-2.0
from IPython.display import YouTubeVideo YouTubeVideo('DVi1TC24_BY') """ Explanation: Beamforming and FFT This notebook explains the relation between spatial beamforming and the time domain FFT operation and show how beamforming can be implemented using FFT. The content presented below is loosely based on a tutorial b...
maartenbreddels/vaex
examples/healpix_plotting.ipynb
mit
# Make sure you have healpy installed by running either command #!conda install -c conda-forge healpy #!pip install healpy import vaex as vx import healpy as hp %matplotlib inline tgas = vx.datasets.tgas.fetch() """ Explanation: Healpix plotting End of explanation """ level = 2 factor = 34359738368 * (4**(12-level...
MLWave/kepler-mapper
docs/notebooks/KeplerMapper-Newsgroup20-Pipeline.ipynb
mit
# from kmapper import jupyter import kmapper as km import numpy as np from sklearn.datasets import fetch_20newsgroups from sklearn.cluster import AgglomerativeClustering from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import TruncatedSVD from sklearn.manifold import Isomap from s...
martinjrobins/hobo
examples/interfaces/statsmodels-state-space.ipynb
bsd-3-clause
import pints import pints.toy as toy import pints.plot import numpy as np import matplotlib.pyplot as plt """ Explanation: Interface to statsmodels: state space time series models This notebook provides a short exposition of how it is possible to interface with the cornucopia of time series models provided by the stat...
ngcm/training-public
FEEG6016 Simulation and Modelling/01-Monte-Carlo-Lab-1.ipynb
mit
from IPython.core.display import HTML css_file = 'https://raw.githubusercontent.com/ngcm/training-public/master/ipython_notebook_styles/ngcmstyle.css' HTML(url=css_file) """ Explanation: Monte Carlo Methods: Lab 1 Take a look at Chapter 10 of Newman's Computational Physics with Python where much of this material is dr...
tpin3694/tpin3694.github.io
machine-learning/handling_missing_values_in_time_series.ipynb
mit
# Load libraries import pandas as pd import numpy as np """ Explanation: Title: Handling Missing Values In Time Series Slug: handling_missing_values_in_time_series Summary: How to handle the missing values in time series in pandas for machine learning in Python. Date: 2017-09-11 12:00 Category: Machine Learning Tag...
geektoni/shogun
doc/ipython-notebooks/distributions/KernelDensity.ipynb
bsd-3-clause
import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt %matplotlib inline import os import shogun as sg SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') # generates samples from the distribution def generate_samples(n_samples,mu1,sigma1,mu2,sigma2): samples1 = np.random.normal(...
amirziai/learning
deep-learning/fully-convolutional-networks.ipynb
mit
import numpy as np import tensorflow as tf import collections """ Explanation: Fully Convolutional Networks (FCN) Notes from Udacity's Self-Driving Car Nanodegree - Encoder extracts features that the decoder uses layer Pieces: - Pre-train encoder on VGG/ResNet - Do a 1x1 convolution - Tansposed convolutions to upsampl...
mwickert/SP-Comm-Tutorial-using-scikit-dsp-comm
tutorial_part1/IIR Filter Design and C Headers.ipynb
bsd-2-clause
fs = 48000 f_pass = 5000 f_stop = 8000 b_but,a_but,sos_but = iir_d.IIR_lpf(f_pass,f_stop,0.5,60,fs,'butter') b_cheb1,a_cheb1,sos_cheb1 = iir_d.IIR_lpf(f_pass,f_stop,0.5,60,fs,'cheby1') b_cheb2,a_cheb2,sos_cheb2 = iir_d.IIR_lpf(f_pass,f_stop,0.5,60,fs,'cheby2') b_elli,a_elli,sos_elli = iir_d.IIR_lpf(f_pass,f_stop,0.5,60...
nansencenter/nansat-lectures
notebooks/12 Nansat Use Case 03.ipynb
gpl-3.0
# download sample files !wget -P data -nc ftp://ftp.nersc.no/nansat/test_data/obpg_l2/A2015121113500.L2_LAC.NorthNorwegianSeas.hdf !wget -P data -nc ftp://ftp.nersc.no/nansat/test_data/obpg_l2/A2015122122000.L2_LAC.NorthNorwegianSeas.hdf import numpy as np import matplotlib.pyplot as plt from IPython.display import Im...
sebp/scikit-survival
doc/user_guide/boosting.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline from sklearn.model_selection import train_test_split from sksurv.datasets import load_breast_cancer from sksurv.ensemble import ComponentwiseGradientBoostingSurvivalAnalysis from sksurv.ensemble import GradientBoostingSurvivalAna...
phobson/statsmodels
examples/notebooks/regression_diagnostics.ipynb
bsd-3-clause
%matplotlib inline from __future__ import print_function from statsmodels.compat import lzip import statsmodels import numpy as np import pandas as pd import statsmodels.formula.api as smf import statsmodels.stats.api as sms import matplotlib.pyplot as plt # Load data url = 'http://vincentarelbundock.github.io/Rdatas...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_read_and_write_raw_data.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/MEG/sample/sample_audvis_raw.fif' raw = mne.io.read_raw_fif(fname) # Set up pick list: MEG + STI 014 - b...
VokhmintcevKirill/ti-nic_competition2
Titanic_3.0.ipynb
mit
train.info() test.info() """ Explanation: В ходе решения Titanic_2.0 мы получили baseline- 0.76077, проведем глубокое исследование данных и попытаемся улучшить эти значения Только 2 непрерывных признака, остальные дискретные. Возмодно можно будет понастраивать кодирование признаков End of explanation """ train.Surv...
dahlend/Physics77Fall17
Workshop 3 - Practice Makes Perfect.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np # Base Python range() doesn't allow decimal numbers # numpy improved and made thier own: t = np.arange(0.0, 1., 0.01) y = t**3. plt.plot(100 * t, y) plt.xlabel('Time (% of semester)') plt.ylabel('Enjoyment of Fridays') plt.title('Happiness over Time') plt.show() "...
rafburzy/Python_EE
RL_and_RLC_circuit/RLC_circuit_current_v2.ipynb
bsd-3-clause
#importing all required modules #important otherwise pop-up window may not work %matplotlib inline import numpy as np import scipy as sp from scipy.integrate import odeint, ode, romb, cumtrapz import matplotlib as mpl import matplotlib.pyplot as plt from math import * import seaborn from IPython.display import Image ...
eford/rebound
ipython_examples/FourierSpectrum.ipynb
gpl-3.0
import rebound import numpy as np sim = rebound.Simulation() sim.units = ('AU', 'yr', 'Msun') sim.add("Sun") sim.add("Jupiter") sim.add("Saturn") """ Explanation: Fourier analysis & resonances A great benefit of being able to call rebound from within python is the ability to directly apply sophisticated analysis tools...
vzg100/Post-Translational-Modification-Prediction
.ipynb_checkpoints/Phosphorylation Sequence Tests -isolation_forest -dbptm+ELM-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"] for i in par: try: print("y", i) y = Predictor() y.load_da...
mitdbg/modeldb
client/workflows/demos/census-end-to-end-s3-example.ipynb
mit
# restart your notebook if prompted on Colab try: import verta except ImportError: !pip install verta """ Explanation: Logistic Regression with Grid Search (scikit-learn) <a href="https://colab.research.google.com/github/VertaAI/modeldb/blob/master/client/workflows/demos/census-end-to-end-s3-example.ipynb" tar...
tuanavu/coursera-university-of-washington
machine_learning/3_classification/assigment/week2/module-3-linear-classifier-learning-assignment-blank.ipynb
mit
import graphlab """ Explanation: Implementing logistic regression from scratch The goal of this notebook is to implement your own logistic regression classifier. You will: Extract features from Amazon product reviews. Convert an SFrame into a NumPy array. Implement the link function for logistic regression. Write a f...
dwhswenson/contact_map
examples/custom_plotting.ipynb
lgpl-2.1
%matplotlib inline import matplotlib.pyplot as plt import mdtraj as md traj = md.load("5550217/kras.xtc", top="5550217/kras.pdb") from contact_map import ContactFrequency traj_contacts = ContactFrequency(traj) frame_contacts = ContactFrequency(traj[0]) diff = traj_contacts - frame_contacts """ Explanation: Customizin...
davek44/Basset
tutorials/prepare_compendium.ipynb
mit
!cd ../data; preprocess_features.py -y -m 200 -s 600 -o er -c genomes/human.hg19.genome sample_beds.txt """ Explanation: In this tutorial, we'll walk through downloading and preprocessing the compendium of ENCODE and Epigenomics Roadmap data. This part won't be very iPython tutorial-ly... First cd in the terminal over...
Small-Bodies-Node/pds4-python
notebooks/spectrum-example-hyakutake.ipynb
bsd-3-clause
from urllib.request import urlretrieve # to download the data from pds4_tools import pds4_read # to read and inspect the data and metadata import matplotlib.pyplot as plt # for plotting # for plotting in Jupyter notebooks %matplotlib notebook # Download data from PDS SBN label_fn, headers = urlretrieve('...
mathnathan/notebooks
dissertation/.ipynb_checkpoints/tests_for_colloquium-checkpoint.ipynb
mit
p = GMM([1.0], np.array([[0.5,0.05]])) num_samples = 1000 beg = 0.0 end = 1.0 t = np.linspace(beg,end,num_samples) num_neurons = len(p.pis) colors = [np.random.rand(num_neurons,) for i in range(num_neurons)] p_y = p(t) p_max = p_y.max() np.random.seed(110) num_neurons = 1 network = Net(1,1,num_neurons, bias=0.0006, ...
prk327/CoAca
6_Grouping_and_Summarising.ipynb
gpl-3.0
# Loading libraries and files import numpy as np import pandas as pd market_df = pd.read_csv("../global_sales_data/market_fact.csv") customer_df = pd.read_csv("../global_sales_data/cust_dimen.csv") product_df = pd.read_csv("../global_sales_data/prod_dimen.csv") shipping_df = pd.read_csv("../global_sales_data/shipping_...
tensorflow/docs-l10n
site/zh-cn/federated/tutorials/simulations.ipynb
apache-2.0
#@test {"skip": true} !pip install --quiet --upgrade tensorflow-federated-nightly !pip install --quiet --upgrade nest-asyncio import nest_asyncio nest_asyncio.apply() import collections import time import tensorflow as tf import tensorflow_federated as tff source, _ = tff.simulation.datasets.emnist.load_data() d...
DS-100/sp17-materials
sp17/disc/disc12/disc12.ipynb
gpl-3.0
import numpy as np import matplotlib %matplotlib inline import matplotlib.pyplot as plt import ds100 """ Explanation: K-means End of explanation """ np.random.seed(13337) c1 = np.random.randn(25, 2) c2 = np.array([2, 8]) + np.random.randn(25, 2) c3 = np.array([8, 4]) + np.random.randn(25, 2) x1 = np.vstack((c1, c2,...
Kaggle/learntools
notebooks/deep_learning/raw/ex4_transfer_learning.ipynb
apache-2.0
# Set up code checking from learntools.core import binder binder.bind(globals()) from learntools.deep_learning.exercise_4 import * print("Setup Complete") """ Explanation: Exercise Introduction The cameraman who shot our deep learning videos mentioned a problem that we can solve with deep learning. He offers a servi...
cxhernandez/msmbuilder
examples/advanced/hmm-and-msm.ipynb
lgpl-2.1
from __future__ import print_function import os %matplotlib inline from matplotlib.pyplot import * from msmbuilder.featurizer import SuperposeFeaturizer from msmbuilder.example_datasets import AlanineDipeptide from msmbuilder.hmm import GaussianHMM from msmbuilder.cluster import KCenters from msmbuilder.msm import Mark...
getsmarter/bda
module_2/M2_NB3_CollectYourOwnData.ipynb
mit
import pandas as pd import numpy as np import matplotlib import os import bandicoot as bc from IPython.display import IFrame %matplotlib inline matplotlib.rcParams['figure.figsize'] = (10, 8) """ Explanation: <div align="right">Python 3.6 Jupyter Notebook</div> Collect your own data Your completion of the notebook ex...
tien-le/kaggle-titanic
Applying Machine Learning Techniques-Regression.ipynb
gpl-3.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import random """ Explanation: Applying Machine Learning Techniques-Regression Homepage: https://github.com/tien-le/kaggle-titanic Updating later ... End of explanation """ #Training Corpus trn_corpus_aft...
vinhqdang/my_mooc
coursera/advanced_machine_learning_spec/4_nlp/natural-language-processing-master/week1/week1-MultilabelClassification.ipynb
mit
import sys sys.path.append("..") from download_utils import download_week1_resources download_week1_resources() """ Explanation: Predict tags on StackOverflow with linear models In this assignment you will learn how to predict tags for posts from StackOverflow. To solve this task you will use multilabel classificatio...
google/starthinker
colabs/trends_places_to_sheets_via_value.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: Trends Places To Sheets Via Values Move using hard coded WOEID values. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obt...
p-chambers/Python_OOP_Workshop
soln/02-Classes_pt2.ipynb
mit
from IPython.core.display import HTML def css_styling(): sheet = '../css/custom.css' styles = open(sheet, "r").read() return HTML(styles) css_styling() """ Explanation: Python OOP 2: Inheritance and Magic Methods The purpose of this exercise is to test your new found knowledge of inheritance using the cla...
as595/AllOfYourBases
Nuclear/PoissonMLRealData.ipynb
gpl-3.0
def gauss_fn(p0, x): amp,mu,sigma,gamma = p0 model = SkewedGaussianModel() #amp*=sigma*np.sqrt(2*np.pi) # set initial parameter values params = model.make_params(amplitude=amp, center=mu, sigma=sigma, gamma=gamma) ymod = model.eval(params=params,x=x) return ymod def lnlike(p...
gsorianob/fiuba-python
Clase 04 - Excepciones, funciones lambda, búsquedas y ordenamientos.ipynb
apache-2.0
lista_de_numeros = [1, 6, 3, 9, 5, 2] lista_ordenada = sorted(lista_de_numeros) print lista_ordenada """ Explanation: <!-- 27/10 Ordenamientos y búsquedas. Excepciones. Funciones anónimas.(Pablo o Andres) --> Ordenamiento de listas Las listas se pueden ordenar fácilmente usando la función sorted: End of explanation "...
DavidLeoni/relmath
bq-examples/Marks/Image.ipynb
apache-2.0
import ipywidgets as widgets import os image_path = os.path.abspath('../data_files/trees.jpg') with open(image_path, 'rb') as f: raw_image = f.read() ipyimage = widgets.Image(value=raw_image, format='jpg') ipyimage """ Explanation: The Image Mark Image is a Mark object, used to visualize images in standard forma...
doingmathwithpython/pycon-us-2016
notebooks/.ipynb_checkpoints/slides-checkpoint.ipynb
mit
As I will attempt to describe in the next slides, Python is an amazing way to lead to a more fun learning and teaching experience. It can be a basic calculator, a fancy calculator and Math, Science, Geography.. Tools that will help us in that quest are: """ Explanation: <center> Doing Math with Python </center> <c...
takashi-suehiro/rtmtools
rtc_handle_example/script/basic.ipynb
mit
#!/usr/bin/env python # -*- Python -*- import sys import time import subprocess """ Explanation: rtc_handle.py(basic) this ipnb shows a basic usage of rtc_handle.py precondition: rtcs(cin and cout) are prelaunched separetely you can monitor the behavior of the system with openrtp you can access and control rtcs of ...
akloster/table-cleaner
docs/source/Tutorial.ipynb
bsd-2-clause
import numpy as np import pandas as pd from IPython import display import table_cleaner as tc """ Explanation: Tutorial This tutorial will show you how to use the Table-Cleaner validation framework. First, let's import the necessary modules. My personal style is to abbreviate the scientific python libraries with two l...
retnuh/deep-learning
embeddings/Skip-Gram_word2vec.ipynb
mit
import time import numpy as np import tensorflow as tf import utils from collections import Counter import random """ Explanation: Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about...
jacquerie/senato.py
cirinna.ipynb
mit
import os import re from itertools import combinations import xml.etree.ElementTree as ET from matplotlib import pyplot as plt from scipy.cluster.hierarchy import dendrogram, linkage %matplotlib inline DATA_FOLDER = 'data/cirinna' NAMESPACE = {'an': 'http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD03'} ALPHANUM_...
crystalzhaizhai/cs207_yi_zhai
homeworks/HW6/HW6_finished.ipynb
mit
from enum import Enum class AccountType(Enum): SAVINGS = 1 CHECKING = 2 """ Explanation: Homework 6 Due: Tuesday, October 10 at 11:59 PM Problem 1: Bank Account Revisited We are going to rewrite the bank account closure problem we had a few assignments ago, only this time developing a formal class for a Bank ...
google/applied-machine-learning-intensive
content/04_classification/06_images_and_video/02-video_processing.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...
darshanbagul/ComputerVision
FourierTransforms/FourierTransforms.ipynb
gpl-3.0
%matplotlib inline import cv2 import numpy as np import matplotlib.pyplot as plt import cmath """ Explanation: Fourier Transform Problem 1. In this problem, given an image we perform the following tasks: 1. Compute its Fourier Transform 2. Try to reconstruct the image by applying Inverse Fourier Transform to the Four...
zzsza/Datascience_School
11. 기초 확률론4 - 상관 관계/02. 확률 밀도 함수의 독립.ipynb
mit
np.set_printoptions(precision=4) pmf1 = np.array([[0, 1, 2, 3, 2, 1], [0, 2, 4, 6, 4, 2], [0, 4, 8,12, 8, 4], [0, 2, 4, 6, 4, 2], [0, 1, 2, 3, 2, 1]]) pmf1 = pmf1/pmf1.sum() pmf1 sns.heatmap(pmf1) plt.xlabel("x") plt.ylabel("y") plt.title("Joint Proba...
alfkjartan/control-computarizado
polynomial-design/notebooks/Polynomial design exercise.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import control import sympy as sy """ Explanation: Effect of cancelling a process zero The following exercise is taken from Åström & Wittenmark (problem 5.3) Consider the system with pulse-transfer function $$ H(z) = \frac{z+0.7}{z^2 - 1.8z + 0.81}.$$ Use polynomial ...
steven-murray/halomod
devel/using_angular_corr.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy.integrate import simps from halomod.integrate_corr import AngularCF, angular_corr_gal, flat_z_dist, dxdz from hmf.cosmo import Cosmology from mpmath import gamma as Gamma """ Explanation: Using the Angular Correlation Function End of exp...
CRPropa/CRPropa3
doc/pages/example_notebooks/Diffusion/DiffusionValidationI.v4.ipynb
gpl-3.0
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy.stats import chisquare from scipy.integrate import quad from crpropa import * #figure settings A4heigth = 29.7/2.54 A4width = 21./2.54 """ Explanation: Diffusion Validation I This notebook simul...
7deeptide/Design-Optimization
Homeworks/ME596_Homework_4.ipynb
gpl-3.0
import numpy as np import matplotlib import matplotlib.pyplot as plt from __future__ import division %config InlineBackend.figure_formats=['svg'] %matplotlib inline plt.rc('pdf',fonttype=3) # for proper subsetting of fonts plt.rc('axes',linewidth=0.5) # thin axes; the default for lines is 1pt al = np.lins...
espressomd/espresso
doc/tutorials/lattice_boltzmann/lattice_boltzmann_poiseuille_flow.ipynb
gpl-3.0
import logging import sys %matplotlib inline import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) import numpy as np import tqdm import espressomd import espressomd.lb import espressomd.lbboundaries import espressomd.shapes logging.basicConfig(level=logging.INFO, stream=sys.stdout) espressomd.asse...
privong/pythonclub
sessions/07-pandas/01 - Pandas tutorial.ipynb
gpl-3.0
import numpy as np from __future__ import print_function import pandas as pd pd.__version__ """ Explanation: Reading and manipulating datasets with Pandas This notebook shows how to create Series and Dataframes with Pandas. Also, how to read CSV files and creaate pivot tables. The first part is based on the chapter...
pbutenee/ml-tutorial
release/1/anomaly_detection.ipynb
mit
import pickle with open('data/past_data.pickle', 'rb') as file: past = pickle.load(file, encoding='latin1') with open('data/all_data.pickle', 'rb') as file: all_data = pickle.load(file, encoding='latin1') print(f'Past data shape = {past.shape}') print(f'Full data shape = {all_data.shape}') """ Explanati...
sertansenturk/tomato
demos/joint_analysis_demo.ipynb
agpl-3.0
data_folder = os.path.join('..', 'sample-data') # score inputs symbtr_name = 'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede' txt_score_filename = os.path.join(data_folder, symbtr_name, symbtr_name + '.txt') mu2_score_filename = os.path.join(data_folder, symbtr_name, symbtr_name + '.mu2') # instantiate audio_mbid ...
jotterbach/SimpleNeuralNets
examples/Causal_vs_Noncausal_Learning.ipynb
apache-2.0
%load_ext autoreload import numpy as np from numpy.polynomial.polynomial import polyval import numpy.random as rd import matplotlib.pyplot as plt import seaborn as sns import sys %matplotlib inline sys.path.append('./NeuralNetworks') # Configuration for plots fig_size = (12,8) font_size = 14 """ Explanation: Causa...
biof-309-python/BIOF309-2016-Fall
Week_08/Week 08 - 02 - Dictionaries.ipynb
mit
dna = "ATCGATCGATCGTACGCTGA" a_count = dna.count("A") """ Explanation: Dictionaries, (Sets, Tuples) Source: This materials is adapted from Python for Biologists and Learn Python 3 in Y Minutes. You can read more about dictionaries and tuples in the Python for Everyone book. Storing paired data Suppose we want to count...
johnnyliu27/openmc
examples/jupyter/mg-mode-part-iii.ipynb
mit
import os import matplotlib.pyplot as plt import numpy as np import openmc %matplotlib inline """ Explanation: This Notebook illustrates the use of the the more advanced features of OpenMC's multi-group mode and the openmc.mgxs.Library class. During this process, this notebook will illustrate the following features...
vipmunot/Data-Science-Course
Data Visualization/Lab 3/lab03_Munot_Vipul.ipynb
mit
import pandas as pd import numpy as np import warnings warnings.filterwarnings('ignore') """ Explanation: W3 Lab Assignment Submit the .ipynb file to Canvas with file name w03_lab_lastname_firstname.ipynb. In this lab, we will introduce pandas, matplotlib, and seaborn and continue to use the imdb.csv file from the l...
rdempsey/python-for-sharing
pandas-for-noobs/Three Pandas Tips for Pandas Noobs.ipynb
mit
# Import the Python libraries we need import pandas as pd # Define a variable for the accidents data file f = './data/accidents1k.csv' # Use read_csv() to import the data accidents = pd.read_csv(f, sep=',', header=0, index_col=False, ...
TheMitchWorksPro/DataTech_Playground
PY_Basics/TMWP_DictionaryBasics.ipynb
mit
# Ex39 in Learn Python the Hard Way: # https://learnpythonthehardway.org/book/ex39.html # edited, expanded, and made PY3.x compliant by Mitch before inclusion in this notebook # create a mapping of state to abbreviation states = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/computer_vision_fun/labs/classifying_images_using_dropout_and_batchnorm_layer.ipynb
apache-2.0
import tensorflow as tf print(tf.version.VERSION) """ Explanation: Classifying Images using Dropout and Batchnorm Layer Introduction In this notebook, you learn how to build a neural network to classify the tf-flowers dataset using dropout and batchnorm layer. Learning objectives Define Helper Functions. Apply dropou...
dnxbjyj/python-basic
libs/ConfigParser/handout.ipynb
mit
import ConfigParser cf = ConfigParser.ConfigParser() cf.read('./sys.conf') """ Explanation: 用ConfigParser模块读写conf配置文件 ConfigParser是Python内置的一个读取配置文件的模块,用它来读取和修改配置文件非常方便,本文介绍一下它的基本用法。 数据准备 假设当前目录下有一个名为sys.conf的配置文件,其内容如下: ```bash [db] db_host=127.0.0.1 db_port=22 db_user=root db_pass=root123 [concurrent] thread = ...
rsignell-usgs/ipython-notebooks
files/ncSOS_and_OWSlib.ipynb
unlicense
%matplotlib inline from owslib.sos import SensorObservationService import pdb from owslib.etree import etree import pandas as pd import datetime as dt import numpy as np url = 'http://sdf.ndbc.noaa.gov/sos/server.php?request=GetCapabilities&service=SOS&version=1.0.0' ndbc = SensorObservationService(url) # usgs woods...