repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sot/aca_stats
fit_acq_prob_model-2018-03-sota.ipynb
bsd-3-clause
from __future__ import division import numpy as np import matplotlib.pyplot as plt from astropy.table import Table from astropy.time import Time import tables from scipy import stats import tables3_api %matplotlib inline """ Explanation: Fit the flight acquisition probability model in 2018-03 Fit values here were co...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/cmip6/models/sandbox-3/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: NASA-GISS Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Transport, Emissi...
nicoa/showcase
pydatabln_2018_schedule2cal/pydatabln2018_filter_and_overview.ipynb
mit
import requests as rq import pandas as pd import matplotlib.pyplot as mpl import bs4 import os from tqdm import tqdm_notebook from datetime import time %matplotlib inline """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Query-Data" data-toc-modified-id="Query-Data-1"><span class="toc-item-...
kevinsung/OpenFermion
docs/fqe/guide/introduction.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...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_object_evoked.ipynb
bsd-3-clause
import os.path as op import mne """ Explanation: The :class:Evoked &lt;mne.Evoked&gt; data structure: evoked/averaged data End of explanation """ data_path = mne.datasets.sample.data_path() fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif') evokeds = mne.read_evokeds(fname, baseline=(None, 0), pro...
pwer21c/pwer21c.github.io
python/pythoncodes/20022021.ipynb
mit
i=1 while i<100: if i%7==0: print(i) i=i+1 """ Explanation: 1에서 100까지의 수중에서 7의 배수 multiples de 7, multiples of 7를 출력할때 입니다. End of explanation """ i=1 multiplesof7=[] while i<100: if i%7==0: multiplesof7.append(i) i=i+1 print(multiplesof7) """ Explanation: 그런데 7의 배수를 list 변...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-mh/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-mh', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-MH Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radi...
benvanwerkhoven/kernel_tuner
tutorial/diffusion_opencl.ipynb
apache-2.0
nx = 1024 ny = 1024 """ Explanation: Tutorial: From physics to tuned GPU kernels This tutorial is designed to show you the whole process starting from modeling a physical process to a Python implementation to creating optimized and auto-tuned GPU application using Kernel Tuner. In this tutorial, we will use diffusion ...
scotthuang1989/Python-3-Module-of-the-Week
concurrency/multiprocessing/Passing_Messages_to_Processes.ipynb
apache-2.0
import multiprocessing class MyFancyClass: def __init__(self, name): self.name = name def do_something(self): proc_name = multiprocessing.current_process().name print('Doing something fancy in {} for {}!'.format( proc_name, self.name)) def worker(q): obj = q.get() ...
kanhua/pypvcell
demos/metpv_data_reader_demo.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import os from pypvcell.solarcell import SQCell,MJCell,TransparentCell from pypvcell.illumination import Illumination from pypvcell.spectrum import Spectrum from pypvcell.metpv_reader import N...
gfeiden/MagneticUpperSco
notes/equipartition_B_strength.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import scipy.interpolate as scint """ Explanation: Equipartition Surface Magnetic Field Strengths Computing equipartition magnetic field strengths using PHOENIX stellar atmosphere models (Hauschildt et al. 1999). End of explanation """ iso_10 = np...
xaibeing/cn-deep-learning
tutorials/sentiment-rnn/Sentiment_RNN_Solution.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
RogueAstro/RV_PS2017
notebooks/HIP67620_example.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import matplotlib.pylab as pylab import astropy.units as u from radial import estimate, dataset %matplotlib inline """ Explanation: The orbital parameters of the binary solar twin HIP 67620 radial is a simple program designed to do a not very trivial task: simulate ra...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session13/Day0/TooBriefVisualization.ipynb
mit
from sklearn.datasets import load_linnerud linnerud = load_linnerud() chinups = linnerud.data[:,0] """ Explanation: Introduction to Visualization: Density Estimation and Data Exploration Version 0.2 There are many flavors of data analysis that fall under the "visualization" umbrella in astronomy. Today, by way of exa...
abeschneider/algorithm_notes
Heapsort.ipynb
mit
def build_heap(lst): # last non-leaf node nonleaf_nodes = len(lst)/2 # start at bottom work up for each node for i in range(nonleaf_nodes-1, -1, -1): percolate_down(lst, i, len(lst)) """ Explanation: Heap Sort Summary | Performance | Complexity | |--------------------...
timzhangau/ml_nano
student_intervention/student_intervention.ipynb
mit
# Import libraries import numpy as np import pandas as pd from time import time from sklearn.metrics import f1_score # Read student data student_data = pd.read_csv("student-data.csv") print "Student data read successfully!" """ Explanation: Machine Learning Engineer Nanodegree Supervised Learning Project: Building a ...
chetnapriyadarshini/deep-learning
reinforcement/Q-learning-cart.ipynb
mit
import gym import tensorflow as tf import numpy as np """ Explanation: Deep Q-learning In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called Cart-Pole. In this game, a freely swinging p...
eyadsibai/rep
howto/00-intro_ipython.ipynb
apache-2.0
%pylab inline from IPython.display import YouTubeVideo YouTubeVideo("qb7FT68tcA8", width=600, height=400, theme="light", color="blue") # You can ignore this, it's just for aesthetic purposes matplotlib.rcParams['figure.figsize'] = (8,5) rcParams['savefig.dpi'] = 100 """ Explanation: Intro into IPython notebooks End ...
wilkeraziz/notebooks
nlp2/fsa_permutations.ipynb
apache-2.0
import fst """ Explanation: Permutations End of explanation """ # Let's see the input as a simple linear chain FSA def make_input(srcstr, sigma = None): """ converts a nonempty string into a linear chain acceptor @param srcstr is a nonempty string @param sigma is the source vocabulary """ ass...
laa-1-yay/SDC1-DetectLaneLines
.ipynb_checkpoints/Laav_Lane_Lines_Detection-checkpoint.ipynb
gpl-3.0
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline """ Explanation: Self-Driving Car Engineer Nanodegree Project: Finding Lane Lines on the Road In this project, you will use the tools you learned about in the lesson to ide...
sorig/shogun
doc/ipython-notebooks/structure/FGM.ipynb
bsd-3-clause
%pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') import numpy as np import scipy.io dataset = scipy.io.loadmat(os.path.join(SHOGUN_DATA_DIR, 'ocr/ocr_taskar.mat')) # patterns for training p_tr = dataset['patterns_train'] # patterns for testing p_ts = dataset['pat...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/robust_models_0.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm """ Explanation: Robust Linear Models End of explanation """ data = sm.datasets.stackloss.load() data.exog = sm.add_constant(data.exog) """ Explanation: Estimation Load data: End of explanation """ huber_t = sm.RLM...
lyndond/Analyzing_Neural_Time_Series
chapter33.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy as sp from scipy.stats import norm from scipy.signal import convolve2d import skimage.measure """ Explanation: Chapter 33. Nonparametric permutation testing End of explanation """ x = np.arange(-5,5, .01) pdf = norm.pdf(x) data = np.random.randn(1000) ...
eds-uga/csci4360-fa17
workshops/w8/CSCI+6360-Data+Science-Workshops.ipynb
mit
# Autoendoer using H2o #CSCI6360 H2O WORKSHOP from IPython.display import Image,display from IPython.core.display import HTML import matplotlib.pyplot as plot from h2o.estimators.deeplearning import H2ODeepLearningEstimator from h2o.grid.grid_search import H2OGridSearch #sp...
masterfish2015/my_project
python/demo1/scipy-advanced-tutorial-master/Part2/Exercise 2.ipynb
mit
%%javascript delete requirejs.s.contexts._.defined.CustomViewModule; define('CustomViewModule', ['jquery', 'widgets/js/widget'], function($, widget) { var CustomView = widget.DOMWidgetView.extend({ }); return {CustomView: CustomView}; }); from IPython.html.widgets import DOMWidget from IPython.display imp...
daniel-koehn/Theory-of-seismic-waves-II
05_2D_acoustic_FD_modelling/lecture_notebooks/5_fdac2d_heterogeneous.ipynb
gpl-3.0
# Execute this cell to load the notebook's style sheet, then ignore it from IPython.core.display import HTML css_file = '../../style/custom.css' HTML(open(css_file, "r").read()) """ Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 by D. Koehn, heterogen...
BrainIntensive/OnlineBrainIntensive
resources/matplotlib/Examples/lineplots.ipynb
mit
%load_ext watermark %watermark -u -v -d -p matplotlib,numpy """ Explanation: Sebastian Raschka back to the matplotlib-gallery at https://github.com/rasbt/matplotlib-gallery Link the matplotlib gallery at https://github.com/rasbt/matplotlib-gallery End of explanation """ %matplotlib inline """ Explanation: <font si...
M-R-Houghton/euroscipy_2015
scikit_image/lectures/adv3_panorama-stitching.ipynb
mit
import numpy as np import matplotlib.pyplot as plt def compare(*images, **kwargs): """ Utility function to display images side by side. Parameters ---------- image0, image1, image2, ... : ndarrray Images to display. labels : list Labels for the different images. """ ...
jamesjia94/BIDMach
tutorials/BIDMat_intro.ipynb
bsd-3-clause
import BIDMat.{CMat,CSMat,DMat,Dict,IDict,FMat,GMat,GIMat,GSMat,GSDMat,HMat,IMat,Image,LMat,Mat,SMat,SBMat,SDMat} import BIDMat.MatFunctions._ import BIDMat.SciFunctions._ import BIDMat.Solvers._ import BIDMat.JPlotting._ Mat.checkMKL Mat.checkCUDA Mat.setInline if (Mat.hasCUDA > 0) GPUmem """ Explanation: Introducti...
quantopian/research_public
case_studies/traditional_value/traditional_value_notebook.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt from quantopian.pipeline import Pipeline from quantopian.pipeline.data.builtin import USEquityPricing from quantopian.research import run_pipeline from quantopian.pipeline.data import morningstar from quantopian.pipeline.factors import CustomFactor ...
tensorflow/workshops
extras/archive/01_linear_regression_low_level.ipynb
apache-2.0
# The next three imports help with compatability between # Python 2 and 3 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import pylab import tensorflow as tf # A special command for IPython Notebooks that # intructs Matplotlib...
tpin3694/tpin3694.github.io
blog/aisle_seat_probabilities.ipynb
mit
# Import required modules import pandas as pd import numpy as np # Set plots to display in the iPython notebook %matplotlib inline """ Explanation: Title: What Is The Probability An Economy Class Seat Is An Aisle Seat? Slug: aisle_seat_probabilities Summary: What Is The Probability An Economy Class Seat Is An Aisle S...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a/td2a_correction_session_5_donnees_non_structurees_et_programmation_fonctionnelle_corrige.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.i - Données non structurées, programmation fonctionnelle - correction Calculs de moyennes et autres statistiques sur une base twitter au format JSON avec de la programmation fonctionnelle (module cytoolz). End of explanation """ impo...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/srl_stl.ipynb
apache-2.0
!pip install hanlp -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/srl_mtl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Ope...
jart/tensorflow
tensorflow/contrib/eager/python/examples/generative_examples/text_generation.ipynb
apache-2.0
!pip install unidecode """ Explanation: Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"). Text Generation using a RNN <table class="tfo-notebook-buttons" align="left"><td> <a target="_blank" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/...
a301-teaching/a301_code
notebooks/layertops_demo_solution.ipynb
mit
import glob import h5py import numpy as np import glob from a301lib.cloudsat import get_geo from a301utils.a301_readfile import download from matplotlib import pyplot as plt lidar_name='2006303212128_02702_CS_2B-GEOPROF-LIDAR_GRANULE_P2_R04_E02.h5' download(lidar_name) """ Explanation: Reading the Lidar LayerTops var...
BadWizard/Inflation
Disaggregated-Data/weather-like-plot-HICP-by-country.ipynb
mit
df_infl_ctry['min'] = df_infl_ctry.apply(min,axis=1) df_infl_ctry['max'] = df_infl_ctry.apply(max,axis=1) df_infl_ctry['mean'] = df_infl_ctry.apply(np.mean,axis=1) df_infl_ctry['mode'] = df_infl_ctry.quantile(q=0.5, axis=1) df_infl_ctry['10th'] = df_infl_ctry.quantile(q=0.10, axis=1) df_infl_ctry['90th'] = df_infl_ctry...
ntftrader/ntfdl
examples/notebooks/Historical data.ipynb
mit
%matplotlib inline %pylab inline --no-import-all pylab.rcParams['figure.figsize'] = (18, 10) from ntfdl import Dl stl = Dl('STL', exchange='OSE', download=False) history = stl.get_history() history.tail() fig, ax = plt.subplots() ax.tick_params(labeltop=False, labelright=True) history.close.plot() plt.grid() # An...
bourneli/deep-learning-notes
DAT236x Deep Learning Explained/.ipynb_checkpoints/Lab6_TextClassification_with_LSTM-checkpoint.ipynb
mit
from __future__ import print_function # Use a function definition from future version (say 3.x from 2.7 interpreter) import requests import os def download(url, filename): """ utility function to download a file """ response = requests.get(url, stream=True) with open(filename, "wb") as handle: for ...
tommyogden/maxwellbloch
docs/examples/mbs-two-weak-square-decay.ipynb
mit
mb_solve_json = """ { "atom": { "decays": [ { "channels": [[0, 1]], "rate": 1.0 } ], "energies": [], "fields": [ { "coupled_levels": [[0, 1]], "detuning": 0.0, "rabi_freq": 1.0e-3, "rabi_freq_t_args": { "ampl": 1.0, ...
sthuggins/phys202-2015-work
assignments/assignment03/.ipynb_checkpoints/NumpyEx01-checkpoint.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 1 Imports End of explanation """ def checkerboard(size): """Return a 2d checkboard of 0.0 and 1.0 as a NumPy array""" ...
ingmarschuster/distributions
Transforms_demo.ipynb
lgpl-3.0
from __future__ import division, print_function, absolute_import import numpy as np import scipy as sp import scipy.stats as stats from numpy import exp, log, sqrt from scipy.misc import logsumexp import distributions as dist, distributions.transform as tr import matplotlib.pyplot as plt def apply_to_mg(func, *mg)...
dmitrip/PML
performance_tests/num_clumps.ipynb
apache-2.0
S = 10_000 # support set size p = np.ones(S)/S # distribution # iterate over S unknown, known S_known_list = [False,True] # make sample size list n_list n_min = np.sqrt(S) n_max = 100*S num_n_points = 21 n_list = np.logspace(np.log10(n_min), np.log10(n_max), num_n_points).astype(int) num_trials = 100 # number of tri...
MingChen0919/learning-apache-spark
notebooks/01-data-strcture/1.1-rdd.ipynb
mit
# from a list rdd = sc.parallelize([1,2,3]) rdd.collect() # from a tuple rdd = sc.parallelize(('cat', 'dog', 'fish')) rdd.collect() # from a list of tuple list_t = [('cat', 'dog', 'fish'), ('orange', 'apple')] rdd = sc.parallelize(list_t) rdd.collect() # from a set s = {'cat', 'dog', 'fish', 'cat', 'dog', 'dog'} rdd...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_eeg_erp.ipynb
bsd-3-clause
import mne from mne.datasets import sample """ Explanation: EEG processing and Event Related Potentials (ERPs) For a generic introduction to the computation of ERP and ERF see tut_epoching_and_averaging. Here we cover the specifics of EEG, namely: - setting the reference - using standard montages :func:`mne.channels.M...
aleereza/twitterbot
twitterbot.ipynb
apache-2.0
import tweepy import time import sys import pickle import datetime """ Explanation: Twitterbot Here I am going to create a Twitter Bot step by step. First I should create a Twitter application on https://dev.twitter.com/ Install tweepy: #pip install tweepy End of explanation """ path="./data/" filename="auth_data" f...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/machine_learning_in_the_enterprise/solutions/gapic-vizier-multi-objective-optimization.ipynb
apache-2.0
# Setup your dependencies 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 = ...
keras-team/keras-io
examples/vision/ipynb/convmixer.ipynb
apache-2.0
from tensorflow.keras import layers from tensorflow import keras import matplotlib.pyplot as plt import tensorflow_addons as tfa import tensorflow as tf import numpy as np """ Explanation: Image classification with ConvMixer Author: Sayak Paul<br> Date created: 2021/10/12<br> Last modified: 2021/10/12<br> Description...
slundberg/shap
notebooks/api_examples/plots/waterfall.ipynb
mit
import xgboost import shap # train XGBoost model X,y = shap.datasets.adult() model = xgboost.XGBClassifier().fit(X, y) # compute SHAP values explainer = shap.Explainer(model, X) shap_values = explainer(X) """ Explanation: waterfall plot This notebook is designed to demonstrate (and so document) how to use the shap.p...
gregmedlock/Medusa
docs/stats_compare.ipynb
mit
import medusa from medusa.test import create_test_ensemble ensemble = create_test_ensemble("Staphylococcus aureus") import pandas as pd biolog_base = pd.read_csv("../medusa/test/data/biolog_base_composition.csv", sep=",") biolog_base # convert the biolog base to a dictionary, which we can use to set ensemble.base_mo...
NREL/bifacial_radiance
docs/tutorials/18 - AgriPV - Coffee Plantation with Tree Modeling.ipynb
bsd-3-clause
import bifacial_radiance import os from pathlib import Path import numpy as np import pandas as pd testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_18') if not os.path.exists(testfolder): os.makedirs(testfolder) resultsfolder = os.path.join(testfolder, 'results') ""...
massimo-nocentini/on-python
UniFiCourseSpring2020/introduction.ipynb
mit
__AUTHORS__ = {'am': ("Andrea Marino", "andrea.marino@unifi.it",), 'mn': ("Massimo Nocentini", "massimo.nocentini@unifi.it", "https://github.com/massimo-nocentini/",)} __KEYWORDS__ = ['Python', 'Jupyter', 'notebooks', 'keynote',] """ ...
sangheestyle/ml2015project
howto/model02_linear_models.ipynb
mit
import gzip import cPickle as pickle with gzip.open("../data/train.pklz", "rb") as train_file: train_set = pickle.load(train_file) with gzip.open("../data/test.pklz", "rb") as test_file: test_set = pickle.load(test_file) with gzip.open("../data/questions.pklz", "rb") as questions_file: questions = pickle...
cliburn/sta-663-2017
notebook/11C_IPyParallel.ipynb
mit
import numpy as np """ Explanation: Using ipyparallel Parallel execution is tightly integrated with Jupyter in the ipyparallel package. Install with bash conda install ipyparallel ipcluster nbextension enable Official documentation End of explanation """ from ipyparallel import Client """ Explanation: Starting engi...
FlorentSilve/Udacity_ML_nanodegree
projects/customer_segments/customer_segments.ipynb
mit
# Import libraries necessary for this project import numpy as np import pandas as pd from IPython.display import display # Allows the use of display() for DataFrames # Import supplementary visualizations code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inline # Load the wholesale custo...
uber/pyro
tutorial/source/contrib_funsor_intro_i.ipynb
apache-2.0
from collections import OrderedDict import torch import funsor from pyro import set_rng_seed as pyro_set_rng_seed funsor.set_backend("torch") torch.set_default_dtype(torch.float32) pyro_set_rng_seed(101) """ Explanation: pyro.contrib.funsor, a new backend for Pyro - New primitives (Part 1) Introduction In this tutor...
ucsdlib/python-novice-inflammation
3-lists.ipynb
cc0-1.0
odds = [1,3,5,7] print('odds are:',odds) print('first and last:', odds[0], odds[-1]) for number in odds: print(number) """ Explanation: for loop is a way to do many operations list a way to store many values Unlike numpy, lits are built into the language so we don't need to load [] creates a list End of explan...
tpin3694/tpin3694.github.io
machine-learning/save_images.ipynb
mit
# Load library import cv2 import numpy as np from matplotlib import pyplot as plt """ Explanation: Title: Save Images Slug: save_images Summary: How to save images using OpenCV in Python. Date: 2017-09-11 12:00 Category: Machine Learning Tags: Preprocessing Images Authors: Chris Albon Preliminaries End of explana...
DS-100/sp17-materials
sp17/hw/hw1/hw1.ipynb
gpl-3.0
!pip install -U okpy """ Explanation: Homework 1: Setup and (Re-)Introduction to Python Course Policies Here are some important course policies. These are also located at http://www.ds100.org/sp17/. Tentative Grading There will be 7 challenging homework assignments. Homeworks must be completed individually and will mi...
halexan/cs231n
assignment1/features.ipynb
mit
import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' # for auto-reloading extenrnal modu...
iwansmith/FutureLHCb
notebooks/01_LoadingSmearingPlotting.ipynb
gpl-3.0
import sys sys.path.append('../../FourVector') sys.path.append('../project') from FourVector import FourVector from ThreeVector import ThreeVector from FutureColliderTools import SmearVertex, GetCorrectedMass, GetMissingMass2, GetQ2 from FutureColliderDataLoader import LoadData_KMuNu, LoadData_DsMuNu from FutureColl...
iiasa/xarray_tutorial
xarray-tutorial-egu2017.ipynb
bsd-3-clause
# standard imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import xarray as xr import warnings %matplotlib inline np.set_printoptions(precision=3, linewidth=80, edgeitems=1) # make numpy less verbose xr.set_options(display_width=70) warnings.simplefilter('ignore') # filter some warnin...
icrtiou/coursera-ML
ex3-neural network/2- one vs all logistic regression.ipynb
mit
# add intercept=1 for x0 X = np.insert(raw_X, 0, values=np.ones(raw_X.shape[0]), axis=1) X.shape # y have 10 categories here. 1..10, they represent digit 0 as category 10 because matlab index start at 1 # I'll ditit 0, index 0 again y_matrix = [] for k in range(1, 11): y_matrix.append((raw_y == k).astype(int)) #...
smharper/openmc
examples/jupyter/mgxs-part-iii.ipynb
mit
import math import pickle from IPython.display import Image import matplotlib.pyplot as plt import numpy as np import openmc import openmc.mgxs from openmc.openmoc_compatible import get_openmoc_geometry import openmoc import openmoc.process from openmoc.materialize import load_openmc_mgxs_lib %matplotlib inline """...
jonathf/chaospy
docs/user_guide/main_usage/pseudo_spectral_projection.ipynb
mit
import chaospy from problem_formulation import joint gauss_quads = [ chaospy.generate_quadrature(order, joint, rule="gaussian") for order in range(1, 8) ] sparse_quads = [ chaospy.generate_quadrature( order, joint, rule=["genz_keister_24", "clenshaw_curtis"], sparse=True) for order in range(1,...
nholtz/structural-analysis
matrix-methods/frame2d/30-test-Beaufait-9-4-1.ipynb
cc0-1.0
from Frame2D import Frame2D from Frame2D.Members import Member # because units are kips, inches Member.E = 30000. #ksi Member.G = 11500. from IPython import display display.Image('data/Beaufait-9-4-1.d/fig1.jpg') frame = Frame2D('Beaufait-9-4-1') # Example 9.4.1, p. 460 frame.input_all() rs = frame.solve() fra...
eecs445-f16/umich-eecs445-f16
handsOn_lecture00_python_tutorial/lecture00_python_tutorial_exercises_with_solutions.ipynb
mit
# 1. With Loops # OK, not very "Pythonic" def sum_of_multiples_with_loop(l, max_): total = 0 # [1, 1000) for i in range(1, max_): for j in l: if i % j == 0: total += i break return total # With Filter. # Better (At least more "Pythonic") def sum_of_m...
Epidemium/RAMP-1
epidemium_01_starting_kit.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns; sns.set() pd.set_option('display.max_columns', None) """ Explanation: Find this notebook in https://tinyurl.com/epidemium-ramp <div class="page-header"><h1 class="alert alert-info">Epidemium RAMP: Cancer...
zhouqifanbdh/liupengyuan.github.io
chapter2/homework/computer/3-29/201611680697-3.29作业.ipynb
mit
def factorial_sum(end): i = 0 factorial_n = 1 while i < end: i = i + 1 factorial_n = factorial_n *i return factorial_n m= int(input('请输入第1个整数,以回车结束。')) n= int(input('请输入第2个整数,以回车结束。')) k = int(input('请输入第3个整数,以回车结束。')) print('最终的和是:', factorial_sum(m) + factorial_sum(n) + factorial_s...
xpmanoj/content
HW0.ipynb
mit
x = [10, 20, 30, 40, 50] for item in x: print "Item is ", item """ Explanation: Homework 0 Due Tuesday, September 10 (but no submission is required) Welcome to CS109 / STAT121 / AC209 / E-109 (http://cs109.org/). In this class, we will be using a variety of tools that will require some initial configuration. To ...
Kaggle/learntools
notebooks/feature_engineering/raw/ex2.ipynb
apache-2.0
# Set up code checking # This can take a few seconds from learntools.core import binder binder.bind(globals()) from learntools.feature_engineering.ex2 import * """ Explanation: Introduction In this exercise you'll apply more advanced encodings to encode the categorical variables ito improve your classifier model. The ...
liganega/Gongsu-DataSci
previous/y2017/GongSu05_Flow_Control.ipynb
gpl-3.0
def sum_if_3(k, m): if (m % 3 == 0) or (str(m).endswith('3')): return k + m else: return k """ Explanation: 흐름 제어: 조건문과 반복문(루프) 활용 수정 사항 gcd 함수 위주로 반복문 작성 가능여부 확인 좀 더 실용적인 수학함수 활용 가능 요약 조건문 활용 if문: 불리언 값을 이용하여 조건을 제시하는 방법 반복문(루프) 활용 while 반복문(루프): 특정 조건이 만족되는 동안 동일한 과정을 반복하는 방법 for ...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2022.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A - Enoncé 3 novembre 2021 Correction de l'examen du 3 novembre 2021. End of explanation """ import time def mesure_temps_fonction(fct, N=100): begin = time.perf_counter() for i in range(N): fct() return (time.perf...
colour-science/colour-ipython
notebooks/colorimetry/luminance.ipynb
bsd-3-clause
import colour colour.utilities.filter_warnings(True, False) sorted(colour.LUMINANCE_METHODS.keys()) """ Explanation: !!! D . R . A . F . T !!! Luminance The Luminance $L_v$ is the quantity defined by the formula: <a name="back_reference_1"></a><a href="#reference_1">[1]</a> $$ \begin{equation} L_v=\cfrac{d\Phi_v}{dA...
BrownDwarf/ApJdataFrames
notebooks/Luhman2004c.ipynb
mit
import warnings warnings.filterwarnings("ignore") """ Explanation: ApJdataFrames 003: Luhman2004c Title: New Brown Dwarfs and an Updated Initial Mass Function in Taurus Authors: Luhman K.L. Data is from this paper: http://iopscience.iop.org/0004-637X/617/2/1216/ End of explanation """ import pandas as pd names = ["...
vipmunot/Data-Science-Course
Data Visualization/Lab 6/w06_Vipul_Munot.ipynb
mit
import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd sns.set_style('white') %matplotlib inline """ Explanation: W6 Lab Assignment Deep dive into Histogram and boxplot. End of explanation """ bins = [0, 1, 3, 5, 10, 24] data = {0.5: 4300, 2: 6900, 4: 4900, 7: 2000, 15: 2100}...
rpmunoz/topicos_ingenieria_1
clase_1/02 - Lectura de datos con Pandas.ipynb
gpl-3.0
import numpy as np from __future__ import print_function import pandas as pd pd.__version__ """ Explanation: Lectura y manipulación de datos con Pandas Autor: Roberto Muñoz <br /> E-mail: &#114;&#109;&#117;&#110;&#111;&#122;&#64;&#117;&#99;&#46;&#99;&#108; This notebook shows how to create Series and Dataframes wit...
quantopian/research_public
notebooks/data/quandl.fred_usdontd156n/notebook.ipynb
apache-2.0
# import the dataset from quantopian.interactive.data.quandl import fred_usdontd156n as libor # Since this data is public domain and provided by Quandl for free, there is no _free version of this # data set, as found in the premium sets. This import gets you the entirety of this data set. # import data operations from...
karst87/ml
dev/pyml/datacamp/intro-to-python-for-data-science/02_python-lists.ipynb
mit
fmz = [1.65, 1.45, 1.76] fmz fmz2 = [1, 3, 1.2, 'Hello'] fmz2 fmz3= [[23,12], [99, 1]] fmz3 """ Explanation: Python Lists https://campus.datacamp.com/courses/intro-to-python-for-data-science/chapter-2-python-lists?ex=1 Learn to store, access and manipulate data in lists: the first step towards efficiently wor...
bjshaw/phys202-project
galaxy_project/F) Plotting_function.ipynb
mit
def plotter(ic,sol,n=0): """Plots the positions of the stars and disrupting galaxy at each t in the time array Parameters -------------- ic : initial conditions sol : solution array n : integer Returns ------------- """ plt.figure(figsize=(10,10)) y = np.linspa...
synthicity/synthpop
demos/census_api.ipynb
bsd-3-clause
c = Census(os.environ["CENSUS"]) """ Explanation: The census api needs a key - you can register for can sign up http://api.census.gov/data/key_signup.html End of explanation """ income_columns = ['B19001_0%02dE'%i for i in range(1, 18)] vehicle_columns = ['B08201_0%02dE'%i for i in range(1, 7)] workers_columns = ['B...
IsaacLab/LaboratorioIntangible
T4/T4.5-Prisoner's-dilemma.ipynb
agpl-3.0
from pydilemma.game_play import * play_with('Nice', 'TitForTat') # These 2 guys get along very well... #play_with('Nice', 'Naive') # Naive tries to get advantage of what works... #play_with('Nice', 'NaiveProber') # And Naive Prober tries aggressively... #play_with('NaiveProber', 'Majority') # But the NaiveProber can'...
tcstewar/testing_notebooks
semd/sEMD.ipynb
gpl-2.0
# the facilitation spikes def stim_1_func(t): index = int(t/0.001) if index in [100, 1100, 2100]: return 1000 else: return 0 # the trigger spikes def stim_2_func(t): index = int(t/0.001) if index in [90, 1500, 2150]: return 1000 else: return 0 # the operatio...
GoogleCloudPlatform/asl-ml-immersion
notebooks/tfx_pipelines/guided_projects/guided_project_1.ipynb
apache-2.0
import os """ Explanation: Guided Project 1 Learning Objectives: Learn how to generate a standard TFX template pipeline using tfx template Learn how to modify and run a templated TFX pipeline Note: This guided project is adapted from Create a TFX pipeline using templates). End of explanation """ PATH = %env PATH ...
jmitz/daymetDataExtraction
daymetDataDownload.ipynb
unlicense
import urllib import os from datetime import date as dt """ Explanation: <h1>Daymet Data Download</h1> Daymet data can be extracted/downloaded in two ways. The nationwide or localized grid can be downloaded; alternately, the data for particular grid cells can be extracted through a web interface. <h2>Daymet Data Dow...
JakeColtman/BayesianSurvivalAnalysis
PyMC Done.ipynb
mit
running_id = 0 output = [[0]] with open("E:/output.txt") as file_open: for row in file_open.read().split("\n"): cols = row.split(",") if cols[0] == output[-1][0]: output[-1].append(cols[1]) output[-1].append(True) else: output.append(cols) output = out...
spulido99/Programacion
Camilo/Taller 2 - Archivos y Bases de Datos.ipynb
mit
import pandas as pd DF = pd.read_csv('../data/alternative.tsv', sep='\t') DF """ Explanation: Archivos y Bases de datos La idea de este taller es manipular archivos (leerlos, parsearlos y escribirlos) y hacer lo mismo con bases de datos estructuradas. Ejercicio 1 Baje el archivo de "All associations with added ontol...
zambzamb/zpic
python/O-X Waves.ipynb
agpl-3.0
import em1ds as zpic electrons = zpic.Species( "electrons", -1.0, ppc = 64, uth=[0.005,0.005,0.005]) sim = zpic.Simulation( nx = 1000, box = 100.0, dt = 0.05, species = electrons ) #Bz0 = 0.5 Bz0 = 1.0 #Bz0 = 4.0 sim.emf.set_ext_fld('uniform', B0= [0.0, 0.0, Bz0]) """ Explanation: Waves in magnetized Plasmas: O-wa...
regata/dbda2e_py
chapters/4.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') import numpy as np np.random.seed(47405) N = 500 # Specify the total number of flips, denoted N. p_heads = 0.5 # Specify underlying probability of heads. # Flip a coin N times and compute the running proportion of heads at each flip. # Genera...
HNoorazar/PyOpinionGame
Famous_Models.ipynb
gpl-3.0
import numpy as np import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt import matplotlib.animation as animation import matplotlib.image as mpimg from matplotlib import rcParams import seaborn as sb """ Explanation: Famous Opinion Dynamic Models End of explanation """ def converg...
DB2-Samples/db2jupyter
v1/Db2 11 Time and Date Functions.ipynb
apache-2.0
%run db2.ipynb """ Explanation: <a id="top"></a> Db2 11 Time and Date Functions There are plenty of new date and time functions found in Db2 11. These functions allow you to extract portions from a date and format the date in a variety of different ways. While Db2 already has a number of date and time functions, these...
IACS-CS-207/cs207-F17
lectures/L14/L14.ipynb
mit
class SentenceIterator: def __init__(self, words): self.words = words self.index = 0 def __next__(self): try: word = self.words[self.index] except IndexError: raise StopIteration() self.index += 1 return word def __iter_...
davidbrough1/pymks
notebooks/stats_checker_board.ipynb
mit
import pymks %matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt """ Explanation: Checkerboard Microstructure Introduction - What are 2-Point Spatial Correlations (also called 2-Point Statistics)? The purpose of this example is to introduce 2-point spatial correl...
neurodata/ndparse
examples/isbi2012_deploy.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import sys, os, copy, logging, socket, time import numpy as np import pylab as plt #from ndparse.algorithms import nddl as nddl #import ndparse as ndp sys.path.append('..'); import ndparse as ndp try: logger except: # do this precisely once logger = ...
McIntyre-Lab/ipython-demo
r_inside_ipython_pt1.ipynb
gpl-2.0
# Imports import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt %matplotlib inline # Load R magic %load_ext rmagic # Make data to plot in python x = np.random.uniform(0, 1000, size=1000) y = np.random.normal(1000, size=1000) # Plot using matplotlib plt.scatter(x=x, y=y, color='k')...
chbehrens/pr_bc_connectivity-1
RBC_subtypes.ipynb
gpl-3.0
import numpy as np from scipy.stats import itemfreq from scipy.io import loadmat from scipy.spatial import ConvexHull import pandas as pd import matplotlib import matplotlib.pyplot as plt import seaborn as sns from PIL import Image from PIL import ImageDraw from sklearn.mixture import GMM from shapely.geometry import P...
hschh86/usersong-extractor
documents/Investigationing.ipynb
mit
from __future__ import print_function, division import itertools import re # numpy imports import numpy as np import matplotlib.pyplot as plt %matplotlib inline def hexbyte(x): return "{:02X}".format(x) def binbyte(x): return "{:08b}".format(x) def tohex(by, sep=" "): return sep.join(hexbyte(x) for x in...
kubeflow/pipelines
components/gcp/bigquery/query/sample.ipynb
apache-2.0
%%capture --no-stderr !pip3 install kfp --upgrade """ Explanation: Name Gather training data by querying BigQuery Labels GCP, BigQuery, Kubeflow, Pipeline Summary A Kubeflow Pipeline component to submit a query to BigQuery and store the result in a Cloud Storage bucket. Details Intended use Use this Kubeflow compone...
sidazhang/udacity-dlnd
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...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/statespace_dfm_coincident.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt np.set_printoptions(precision=4, suppress=True, linewidth=120) from pandas_datareader.data import DataReader # Get the datasets from FRED start = '1979-01-01' end = '2014-12-01' indprod = DataReade...