repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
phoebe-project/phoebe2-docs
development/examples/sun.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: Sun (single rotating star) 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 import numpy a...
tensorflow/model-remediation
docs/min_diff/guide/integrating_min_diff_without_min_diff_model.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
dev/_downloads/141ddce18e923e8220337b357ba3dc45/ssd_spatial_filters.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # Victoria Peterson <victoriapeterson09@gmail.com> # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne import Epochs from mne.datasets.fieldtrip_cmc import data_path from mne.decoding import SSD """ Explanation: Compute Spectro-Spa...
tensorflow/ranking
docs/tutorials/quickstart.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...
landlab/landlab
notebooks/tutorials/flow_direction_and_accumulation/the_FlowAccumulator.ipynb
mit
%matplotlib inline # import plotting tools from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import matplotlib as mpl # import numpy import numpy as np # import necessary landlab components from landlab im...
quanhua92/learning-notes
libs/scipy/scipy-lectures/13_Math_Optimization.ipynb
apache-2.0
from scipy import optimize import numpy as np def f(x): return -np.exp(-(x - 0.7) ** 2) optimize.minimize_scalar(f) """ Explanation: Chapter 13: Mathematical optimization: finding minima of functions 13.1 Knowing your problem Dimensionality of the problem: The scale of an optimization problem is pretty much set ...
mroberge/hydrofunctions
docs/notebooks/USGS_Statistics_Service.ipynb
mit
import hydrofunctions as hf print(hf.__version__) """ Explanation: Requesting Statistics from the USGS Statistics Service The USGS calculates various types of statistics for its data and provides these values through a web service. You can access this service through the stats function. Learn more about the USGS Stati...
osamoylenko/YSDA_deeplearning17
Seminar1/Classwork_ru.ipynb
mit
!wget https://github.com/goto-ru/Unsupervised_ML/raw/20779daf2aebca80bfe38401bc87cf41fc7b493d/03_zebrafish/zebrafish.npy -O zebrafish.npy #alternative link: https://www.dropbox.com/s/hhep0wj4c11qibu/zebrafish.npy?dl=1 """ Explanation: Чем думает рыба? End of explanation """ import numpy as np data = np.load("zebrafi...
ejolly/pymer4
docs/auto_examples/example_03_posthoc.ipynb
mit
# import basic libraries and sample data import os import pandas as pd from pymer4.utils import get_resource_path from pymer4.models import Lmer # IV3 is a categorical predictors with 3 levels in the sample data df = pd.read_csv(os.path.join(get_resource_path(), "sample_data.csv")) # # We're going to fit a multi-leve...
ShubhamDebnath/Coursera-Machine-Learning
Course 4/Convolution model Application v1.ipynb
mit
import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage import tensorflow as tf from tensorflow.python.framework import ops from cnn_utils import * %matplotlib inline np.random.seed(1) """ Explanation: Convolutional Neural Networks: Appli...
cathalmccabe/PYNQ
boards/Pynq-Z1/base/notebooks/microblaze/microblaze_python_libraries.ipynb
bsd-3-clause
from pynq.overlays.base import BaseOverlay from pynq.lib import MicroblazeLibrary base = BaseOverlay('base.bit') lib = MicroblazeLibrary(base.PMODA, ['i2c', 'pmod_grove']) """ Explanation: Microblaze Python Libraries In addition to using the pynqmb libraries from C it is also possible to create Python wrappers for th...
jinntrance/MOOC
coursera/ml-classification/assignments/module-6-decision-tree-practical-assignment-blank.ipynb
cc0-1.0
import graphlab """ Explanation: Decision Trees in Practice In this assignment we will explore various techniques for preventing overfitting in decision trees. We will extend the implementation of the binary decision trees that we implemented in the previous assignment. You will have to use your solutions from this pr...
ajgpitch/qutip-notebooks
examples/control-pulseoptim-symplectic.ipynb
lgpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import datetime from qutip import Qobj, identity, sigmax, sigmay, sigmaz, tensor from qutip.qip import hadamard_transform import qutip.logging_utils as logging logger = logging.get_logger() #Set this to None or logging.WARN for 'quiet' execution log...
sgratzl/ipython-tutorial-VA2015
03_Plotting_solution.ipynb
cc0-1.0
#disable some annoying warning import warnings warnings.filterwarnings('ignore', category=FutureWarning) #plots the figures in place instead of a new window %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np #use a standard dataset of heterogenous data ca...
maartenbreddels/vaex
docs/source/tutorial_ml.ipynb
mit
import vaex vaex.multithreading.thread_count_default = 8 import vaex.ml import numpy as np import pylab as plt """ Explanation: Machine Learning with vaex.ml If you want to try out this notebook with a live Python kernel, use mybinder: <a class="reference external image-reference" href="https://mybinder.org/v2/gh/vae...
jmhsi/justin_tinker
data_science/lendingclub_bak/csv_dl_preparation/clean_pmt_history_2.ipynb
apache-2.0
import dir_constants as dc from tqdm import tqdm_notebook def find_dupe_dates(group): return pd.to_datetime(group[group.duplicated('date')]['date'].values) def merge_dupe_dates(group): df_chunks = [] dupe_dates = find_dupe_dates(group) df_chunks.append(group[~group['date'].isin(dupe_dates)]) ...
metpy/MetPy
v1.0/_downloads/8c91fa5ab51e12860cfa1e679eaa746d/xarray_tutorial.ipynb
bsd-3-clause
import numpy as np import xarray as xr # Any import of metpy will activate the accessors import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.units import units """ Explanation: xarray with MetPy Tutorial xarray &lt;http://xarray.pydata.org/&gt;_ is a powerful Python package that provides N-di...
ykLIU1982/dental
dental_plan_comp.ipynb
mit
def nonPremCost(maxY, unitCostPrev, rPrev, prevDeduct, costBase, rBase, baseDeduct): paidPrev = 0 paidBase = 0 # first, calculate the preventive services, suppose that 2 units per year totalCostPrev = unitCostPrev * 2 coveredPrev = min(maxY, max(0, totalCostPrev - prevDeduct) * rPrev) #prin...
kaleoyster/nbi-data-science
Deterioration Curves/(West) Deterioration+Curves+and+Classification+of+Bridges+in+the+West+United+States.ipynb
gpl-2.0
import pymongo from pymongo import MongoClient import time import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import csv """ Explanation: Libraries and Packages End of explanation """ Client = MongoClient("mongodb://bridges:readonly@nbi-mongo.admin/bridge") db = Client.bridg...
christinawlindberg/LtaP
LtaP.ipynb
mit
!pip install nxpd %matplotlib inline import matplotlib.pyplot as plt import networkx as nx import pandas as pd import numpy as np from operator import truediv from collections import Counter import itertools import random import collaboratr #from nxpd import draw #import nxpd #reload(collaboratr) """ Explanation...
statsmodels/statsmodels
examples/notebooks/wls.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm from scipy import stats from statsmodels.iolib.table import SimpleTable, default_txt_fmt np.random.seed(1024) """ Explanation: Weighted Least Squares End of explanation """ nsample = 50 x = np.linspace(0, 20, nsample...
lknelson/DH-Institute-2017
03-Operationalizing/Operationalizing.ipynb
bsd-2-clause
# Let's assign a string to a new variable # Using the triple quotation mark, we can simply paste a passage in between # and Python will treat it as a continuous string first_sonnet = """From fairest creatures we desire increase, That thereby beauty's rose might never die, But as the riper should by time decease, His t...
ledeprogram/algorithms
class7/homework/radhikapc_Homework7.ipynb
gpl-3.0
from sklearn import datasets import pandas as pd %matplotlib inline from sklearn import datasets from pandas.tools.plotting import scatter_matrix import matplotlib.pyplot as plt from sklearn import tree iris = datasets.load_iris() iris iris.keys() iris['target'] iris['target_names'] iris['data'] iris['feature_n...
astarostin/MachineLearningSpecializationCoursera
course6/week6/SentimentAnalysisContest.ipynb
apache-2.0
import scrapy # to run: # scrapy crawl reviews -o reviews.json class ReviewsSpider(scrapy.Spider): name = "reviews" start_urls = ['https://market.yandex.ru/catalog/54726/list?how=opinions&deliveryincluded=0&onstock=1'] def __init__(self): self.count = 0 self.LIMIT = 5 def parse(s...
tensorflow/docs-l10n
site/ja/guide/mixed_precision.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...
johnnyliu27/openmc
examples/jupyter/mdgxs-part-ii.ipynb
mit
%matplotlib inline import math import matplotlib.pyplot as plt import numpy as np import openmc import openmc.mgxs """ Explanation: This IPython Notebook illustrates the use of the openmc.mgxs.Library class. The Library class is designed to automate the calculation of multi-group cross sections for use cases with on...
stargaser/advancedviz2016
Linking_and_brushing.ipynb
mit
import bokeh import numpy as np from astropy.table import Table sdss = Table.read('data/sdss_galaxies_qsos_50k.fits') sdss from bokeh.models import ColumnDataSource from bokeh.plotting import figure, gridplot, output_notebook, output_file, show umg = sdss['u'] - sdss['g'] gmr = sdss['g'] - sdss['r'] rmi = sdss['...
lo-co/atm-py
examples/SMPS Algorithm Test.ipynb
mit
# Instantiate a DMA object based on the NOAA wide DMA dimensions noaa = dma.NoaaWide() # We also need a gas object that will represent the carrier gas of interest: air air = atm.Air() # Set the conditions to something representative of the conditions in the Boulder DMA air.t = 23 air.p = 820 d = noaa.v2d(50, air, 5,...
ohgodscience/Python
mousetrackerdata/post2.ipynb
gpl-2.0
import pandas as pd import re data = pd.read_csv("mousetrackercorrected.csv") data.columns.values data.iloc[0:4, 0:19] """ Explanation: Overview I'm going to be looking at some pilot data that some colleagues and I collected using Jon Freeman's Mousetracker (http://www.mousetracker.org/). As the name suggests, mouse...
ewulczyn/talk_page_abuse
src/data_generation/crowdflower_analysis/src/Crowdflower Analysis (Experiment v. 2).ipynb
apache-2.0
%matplotlib inline from __future__ import division import pandas as pd import numpy as np import matplotlib.pyplot as plt pd.set_option('display.max_colwidth', 1000) # Download data from google drive (Respect Eng / Wiki Collab): wikipdia data/v2_annotated dat = pd.read_csv('../data/exp2_annotated_1k_no_admin_blocked_...
mne-tools/mne-tools.github.io
0.23/_downloads/299b3deaa8eb66e88d34f06090d06628/evoked_ers_source_power.ipynb
bsd-3-clause
# Authors: Luke Bloy <luke.bloy@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import mne from mne.cov import compute_covariance from mne.datasets import somato from mne.time_frequency import csd_morlet from mne.beamformer import (make_di...
quoniammm/mine-tensorflow-examples
fastAI/deeplearning1/nbs/lesson4.ipynb
mit
ratings = pd.read_csv(path+'ratings.csv') ratings.head() len(ratings) """ Explanation: Set up data We're working with the movielens data, which contains one rating per row, like this: End of explanation """ movie_names = pd.read_csv(path+'movies.csv').set_index('movieId')['title'].to_dict() users = ratings.userId....
nadvamir/deep-learning
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
google/earthengine-api
python/examples/ipynb/Earth_Engine_REST_API_compute_image.ipynb
apache-2.0
# INSERT YOUR PROJECT HERE PROJECT = 'your-project' !gcloud auth login --project {PROJECT} """ Explanation: <table class="ee-notebook-buttons" align="left"><td> <a target="_blank" href="http://colab.research.google.com/github/google/earthengine-api/blob/master/python/examples/ipynb/Earth_Engine_REST_API_compute_imag...
zhuanxuhit/deep-learning
batch-norm/my_Batch_Normalization_Lesson.ipynb
mit
# Import necessary packages import tensorflow as tf import tqdm import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Import MNIST data so we have something for our experiments from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) "...
wso2/product-apim
modules/recommendation-engine/repository/resources/Word2vec_Model/Build_Word2vec_model.ipynb
apache-2.0
model = gensim.models.Word2Vec (dataset, size=300, window=10, min_count=5, workers=10) model.train(dataset,total_examples=len(dataset),epochs=15) """ Explanation: The 'Dataset.txt' file consists of API descriptions of over 15,000 APIs. Using the 'Dataset_PW.txt' file, a dataset which consists of sentences, is created....
simonsfoundation/CaImAn
demos/notebooks/demo_VST.ipynb
gpl-2.0
get_ipython().magic('load_ext autoreload') get_ipython().magic('autoreload 2') import logging import matplotlib.pyplot as plt import numpy as np import os import timeit logging.basicConfig(format= "%(relativeCreated)12d [%(filename)s:%(funcName)20s():%(lineno)s] [%(process)d] %(message)s", ...
kevntao/ThinkStats2
code/chap03ex.ipynb
gpl-3.0
kids = resp['numkdhh'] kids """ Explanation: Make a PMF of <tt>numkdhh</tt>, the number of children under 18 in the respondent's household. End of explanation """ pmf = thinkstats2.Pmf(kids) thinkplot.Pmf(pmf, label='PMF') thinkplot.Show(xlabel='# of Children', ylabel='PMF') """ Explanation: Display the PMF. End of...
ultiyuan/test0
lessons/VortexPanelMethod.ipynb
gpl-2.0
import numpy # velocity component functions def get_u( x, y, S, gamma ): return gamma/(2*numpy.pi)*(numpy.arctan((x-S)/y)-numpy.arctan((x+S)/y)) def get_v( x, y, S, gamma ): return gamma/(4*numpy.pi)*(numpy.log(((x+S)**2+y**2)/((x-S)**2+y**2))) # vortex panel class class Panel: # save the inputs and ...
nehal96/Deep-Learning-ND-Exercises
Sentiment Analysis/Sentiment Analysis with Andrew Trask/4-reducing-noise.ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
armgilles/presentation
EPSI/I5/Projet Big Data/Cours 2 Big Data.ipynb
mit
# Importer les lib python import pandas as pd """ Explanation: On va débuter step by step Inscription et récupération des données : Aller sur le site Kaggle et inscrivez-vous Ensuite aller sur le contest du Titanic Télécharger les données train.csv et test.csv dans l'onglet data Mettez ces données dans un répertoire ...
HsKA-ThermalFluiddynamics/NSS-1
PythonTutorial.ipynb
mit
from __future__ import print_function """ Explanation: Python Tutorial End of explanation """ # Output "Hello World!" print("Hello, World!") print("Hello World!", 10.0) """ Explanation: Hello World! End of explanation """ # define a variable s = "Hello World!" x = 10.0 i = 42 # define 2 variables at once a,b = 1...
aboSamoor/compsocial
Word_Tracker/3rd_Yr_Paper/Grants.ipynb
gpl-3.0
NIH_df = GetNIH() NSF_df = GetNSF() NIH_df.head() NSF_df.head() !mkdir data/processed """ Explanation: Merge CSV files Each cvs file represent a specific word results obtained from the NSF and NIH websites. End of explanation """ NSF_df.to_csv("data/Grants/processed/nsf_combined.csv", encoding='utf-8') NIH_df.to_...
SubhankarGhosh/NetworkX
3. Hubs and Paths (Instructor).ipynb
mit
# Load the sociopatterns network data. G = cf.load_sociopatterns_network() """ Explanation: Load Data We will load the sociopatterns network data for this notebook. From the Konect website: This network describes the face-to-face behavior of people during the exhibition INFECTIOUS: STAY AWAY in 2009 at the Science G...
ldiary/marigoso
notebooks/handling_select2_controls_in_selenium_webdriver.ipynb
mit
import os from marigoso import Test request = { 'firefox': { 'capabilities': { 'marionette': False, }, } } """ Explanation: Handling Select2 Controls in Selenium WebDriver Select2 is a jQuery based replacement for select boxes. This article will demonstrate how Selenium webdriver ca...
tyamamot/h29iro
codes/1_Try_Notebook.ipynb
mit
print ("Hello" + ", World") print(10 + 4) """ Explanation: 第1回 Jupyter notebookに慣れる 参考文献: IPython データサイエンスクックブック,オライリー社 1. IPythonとJupyterとは IPython IPythonはPythonを対話的に動作させるためのプラットフォームです.たとえばある文を入力した直後に結果を確認するといったように,インタラクティブに結果を確認しながらプログラミングしていくことができます. Jupyter notebookとは IPythonをWebベースで実行するためのプラットフォームです.ソースコードを書くだ...
topgate/training-gcp
CPB102/tensorflow/tfclassic.ipynb
apache-2.0
import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data print(tf.__version__) """ Explanation: TensorFlow Low-Level API 高レベル API を使わない、いわゆる生の TensorFlow でコードを書いてみましょう。 End of explanation """ mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) """ Explanation...
kingb12/languagemodelRNN
report_notebooks/encdec_noing_250_512_040dr.ipynb
mit
report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/reports/encdec_noing_250_512_040dr_2.json' log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/logs/encdec_noing_250_512_040dr_2.json' import json import matplotlib.pyplot as plt with open(report_file) as f: report = json.loads(f.read()) with open(log_fi...
quantumlib/ReCirq
docs/benchmarks/rabi_oscillations.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 unde...
tOverney/ADA-Project
preprocessing/process_path.ipynb
apache-2.0
columns = [ 'agency_id', 'service_date_id', 'service_date_date', 'route_id', 'route_short_name', 'route_long_name', 'trip_id', 'trip_headsign', 'trip_short_name', 'stop_time_id', 'stop_time_arrival_time', 'stop_time_departure_time', 'stop_time_stop_sequence', 'stop_id', 'stop_stop_id', 'stop_n...
rjenc29/numerical
notebooks/principal_component_analysis.ipynb
mit
from sklearn.datasets import load_iris import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from pprint import pprint import matplotlib.pyplot as plt import matplotlib %matplotlib inline import ipywidgets as widgets from scipy.optimize import fmin...
tanghaibao/goatools
notebooks/report_depth_level.ipynb
bsd-2-clause
# Get http://geneontology.org/ontology/go-basic.obo from goatools.base import download_go_basic_obo obo_fname = download_go_basic_obo() """ Explanation: Report counts of GO terms at various levels and depths Reports the number of GO terms at each level and depth. Level refers to the length of the shortest path fro...
highb/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/text_classification/solutions/text_classification.ipynb
apache-2.0
# Import necessary libraries import matplotlib.pyplot as plt import os import re import shutil import string import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import losses # Print the TensorFlow version print(tf.__version__) """ Explanation: Basic Text Classification Overview This n...
nathanshammah/pim
doc/notebooks/piqs_superradiance.ipynb
mit
import matplotlib as mpl from matplotlib import cm import matplotlib.pyplot as plt from qutip import * from piqs import * #TLS parameters N = 6 ntls = N nds = num_dicke_states(ntls) [jx, jy, jz, jp, jm] = jspin(N) w0 = 1 gE = 0.1 gD = 0.01 h = w0 * jz #photonic parameters nphot = 20 wc = 1 kappa = 1 ratio_g = 2 g = r...
thehackerwithin/berkeley
code_examples/python_mayavi/mayavi_intermediate.ipynb
bsd-3-clause
# setup parameters for Lorenz equations sigma=10 beta=8/3. rho=28 def lorenz(x, t, ): dx = np.zeros(3) dx[0] = -sigma*x[0] + sigma*x[1] dx[1] = rho*x[0] - x[1] - x[0]*x[2] dx[2] = -beta*x[2] + x[0]*x[1] return dx # solve for a specific particle # initial condition y0 = np.ones(3) + .01 # time ste...
minxuancao/shogun
doc/ipython-notebooks/multiclass/KNN.ipynb
gpl-3.0
import numpy as np import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from scipy.io import loadmat, savemat from numpy import random from os import path mat = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat')) Xall = mat['data'] Yall = np.array(mat['label'].squeeze(), dtype=n...
tensorflow/docs-l10n
site/ja/tutorials/load_data/text.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.19/_downloads/f01121873dbae065a1740e6c0c20d1d5/plot_eeg_no_mri.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Joan Massich <mailsik@gmail.com> # # License: BSD Style. import os.path as op import mne from mne.datasets import eegbci from mne.datasets import fetch_fsaverage # Download fsaverage files fs_dir = fetch_fsaverage(verbose=True) subjects_dir = op....
fionapigott/Data-Science-45min-Intros
matplotlib-201/matplotlib-201.ipynb
unlicense
import matplotlib.pyplot as plt %matplotlib inline plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show() """ Explanation: Understanding just enough of matplotlib... (or, Why a State Machine within a State Machine is a Shitty Idea) <br> So, you want to plot something in Python. Perhaps you've typed python import...
debsankha/network_course_python
exercises/01-exercise-python.ipynb
gpl-2.0
numbers = [[1,2,3],[4,5,6],[7,8,9]] words = ['if','i','could','just','go','outside','and','have','an','ice','cream'] """ Explanation: 1. Party game: squeezed One guessing game, called “squeezed”, is very common in parties. It consists of a player, the chooser, who writes down a number between 00–99. The other players ...
fsilva/deputado-histogramado
notebooks/Deputado-Histogramado-2.ipynb
gpl-3.0
%matplotlib inline import pylab import matplotlib import pandas import numpy dateparse = lambda x: pandas.datetime.strptime(x, '%Y-%m-%d') sessoes = pandas.read_csv('sessoes_democratica_org.csv',index_col=0,parse_dates=['data'], date_parser=dateparse) """ Explanation: Deputado Histogramado expressao.xyz/deputado/ Co...
bpgc-cte/python2017
Week 5/Lecture_11_Decorators_Multiple_Inheritance.ipynb
mit
def func2(func1): return func1 + 1 def func3(func2, arg):# Here func2 is being passed as a parameter. return func2(arg) print(func2(2)) print(func3(func2, 3)) def user_defined_decorator(function1): def wrapper(): print("This statement is being printed before the passed function is called.") ...
dsacademybr/PythonFundamentos
Cap02/Notebooks/DSA-Python-Cap02-02-Variaveis.ipynb
gpl-3.0
# Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) """ Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 2</font> Download: http://github.com/dsacademybr End of explanation """ # Atrib...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-1/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', 'test-institute-1', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: TEST-INSTITUTE-1 Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Tra...
4DGenome/Chromosomal-Conformation-Course
Notebooks/00-Hi-C_quality_check.ipynb
gpl-3.0
for renz in ['HindIII', 'MboI']: print renz ! head -n 4 /media/storage/FASTQs/K562_"$renz"_1.fastq print '' """ Explanation: FASTQ format The file is organized in 4 lines per read: 1 - The header of the DNA sequence with the read id (the read length is optional) 2 - The DNA sequence 3 - The header of th...
hashiprobr/redes-sociais
encontro02/2-largura.ipynb
gpl-3.0
import sys sys.path.append('..') import socnet as sn """ Explanation: Encontro 02, Parte 2: Revisão de Busca em Largura Este guia foi escrito para ajudar você a atingir os seguintes objetivos: implementar o algoritmo de busca em largura; usar funcionalidades avançadas da biblioteca da disciplina. Primeiramente, vam...
agile-geoscience/notebooks
Jerk_jounce_etc.ipynb
apache-2.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set() """ Explanation: Jerk, jounce, etc. This notebook accompanies a blog post on Agile. First, the usual preliminaries... End of explanation """ data = np.loadtxt('data/tesla_speed.csv', delimiter=',') """ Explanation...
tpin3694/tpin3694.github.io
python/create_a_new_file_and_the_write_to_it.ipynb
mit
# Create a file if it doesn't already exist with open('file.txt', 'xt') as f: # Write to the file f.write('This file now exsits!') # Close the connection to the file f.close() """ Explanation: Title: Create A New File Then Write To It Slug: create_a_new_file_and_the_write_to_it Summary: Create A New Fi...
tensorflow/docs-l10n
site/ja/xla/tutorials/compile.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...
GoogleCloudPlatform/training-data-analyst
blogs/pandas_to_beam/pandas_to_beam.ipynb
apache-2.0
%pip install --quiet apache-beam[gcp]==2.26.0 import apache_beam as beam import pandas as pd print(beam.__version__) """ Explanation: Pandas API in Apache Beam Apache Beam 2.26 onwards supports the Pandas API. This makes it very convenient to write complex pipelines, and execute them at scale, or in a streaming manne...
dwillis/agate
example.py.ipynb
mit
import agate table = agate.Table.from_csv('examples/realdata/ks_1033_data.csv') print(table) """ Explanation: Using agate in a Jupyter notebook First we import agate. Then we create an agate Table by loading data from a CSV file. End of explanation """ kansas_city = table.where(lambda r: r['county'] in ('JACKSON',...
rtidatascience/connected-nx-tutorial
notebooks/2. Creating Graphs.ipynb
mit
import csv import networkx as nx import pandas as pd import matplotlib.pyplot as plt %matplotlib inline # Create empty graph G = nx.Graph() # Add nodes G.add_node(1) G.add_nodes_from([2, 3]) G.add_node(4) G.nodes() """ Explanation: Creating Graphs in NetworkX Creating a graph object Adding nodes and edges Add...
andre-martins/AD3
examples/python/parse_example.ipynb
lgpl-3.0
rng = np.random.RandomState(0) sentence = ["*", "the", "quick", "fox", "jumps", "."] # possible edge from every node to every other node OR the root link_ix = [] link_var = [] fg = ad3.PFactorGraph() for mod in range(1, len(sentence)): for head in range(len(sentence)): if mod == head: continu...
kit-cel/wt
mloc/ch7_Evolutionary_Algorithms/Differential_Evolution.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt """ Explanation: Optimization of Non-Differentiable Functions Using Differential Evolution This code is provided as supplementary material of the lecture Machine Learning and Optimization in Communications (MLOC).<br> This code illustrates: * Use of differential evolu...
crystalzhaizhai/cs207_yi_zhai
lectures/L9/L9.ipynb
mit
from IPython.display import HTML """ Explanation: Lecture 9 Object Oriented Programming Monday, October 2nd 2017 End of explanation """ def Complex(a, b): # constructor return (a,b) def real(c): # method return c[0] def imag(c): return c[1] def str_complex(c): return "{0}+{1}i".format(c[0], c[1]) ...
rohinkumar/galsurveystudy
old/Parallel Computing with Python public.ipynb
mit
%pylab inline """ Explanation: Parallel Computing with Python Rodrigo Nemmen, IAG USP This IPython notebook illustrates a few simple ways of doing parallel computing. Practical examples included: Parallel function mapping to a list of arguments (multiprocessing module) Parallel execution of array function (scatter/ga...
Kaggle/learntools
notebooks/geospatial/raw/ex1.ipynb
apache-2.0
import geopandas as gpd from learntools.core import binder binder.bind(globals()) from learntools.geospatial.ex1 import * """ Explanation: Introduction Kiva.org is an online crowdfunding platform extending financial services to poor people around the world. Kiva lenders have provided over $1 billion dollars in loans ...
ethen8181/machine-learning
trees/lightgbm.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', 'notebook_format')) from formats import load_style load_style(css_style='custom2.css', plot_style=False) os.chdir(path) # 1. magic for inline plot # 2. ...
DylanGification/PhleepGG
data/MultipleLinearRegression.ipynb
mit
import pandas as pd import numpy as np import statsmodels.api as sm data = pd.read_json("Overwatch090317.json") rank=[x for x in data['rank']] level=[x for x in data['level']] wins=[x for x in data.get('comp', {})] # winsdata=[x for x in wins.index[x]] # wins=[x for x in data['comp'] if x <1E100] a=wins[0] b=a.get...
rebeccabilbro/machine-learning
notebook/Wheat Classification.ipynb
mit
%matplotlib inline import os import json import time import pickle import requests import numpy as np import pandas as pd import matplotlib.pyplot as plt URL = "https://archive.ics.uci.edu/ml/machine-learning-databases/00236/seeds_dataset.txt" def fetch_data(fname='seeds_dataset.txt'): """ Helper method to...
SJSlavin/phys202-2015-work
assignments/assignment07/AlgorithmsEx01.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np """ Explanation: Algorithms Exercise 1 Imports End of explanation """ file = open("mobydick_chapter1.txt") mobydick = file.read() mobydick = mobydick.splitlines() mobydick = " ".join(mobydick) punctuation = ["-", ",", "."] mobydick = list(...
julienchastang/unidata-python-workshop
notebooks/Surface_Data/Surface Data with Siphon and MetPy.ipynb
mit
from siphon.catalog import TDSCatalog # copied from the browser url box metar_cat_url = ('http://thredds.ucar.edu/thredds/catalog/' 'irma/metar/catalog.xml?dataset=irma/metar/Metar_Station_Data_-_Irma_fc.cdmr') # Parse the xml catalog = TDSCatalog(metar_cat_url) # what datasets are here? print(list(...
jrieke/mhbf
4/4.ipynb
mit
from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Solution from Johannes Rieke and Alex Moore¶ End of explanation """ from scipy.integrate import odeint def step(x): return int(x >= 0) x = np.linspace(-10, 10, 1000) plt.plot(x...
bsipocz/AstroHackWeek2015
inference/straightline.ipynb
gpl-2.0
%load_ext autoreload %autoreload 2 from __future__ import print_function import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (8.0, 8.0) plt.rcParams['savefig.dpi'] = 100 from straightline_utils import * """ Explanation: Fitting a Straight Line Phil Marshall, Danie...
flaxandteal/python-course-lecturer-notebooks
Python Course - 002a - And so we begin.ipynb
mit
import datetime print(datetime.date.today()) """ Explanation: ... and so we begin Critical information First steps Order of the day Learn to use Jupyter / iPython Notebook Get familiar with basic Python Start with Spyder, a traditional editor Fundamental Python-in-Science skills What is Jupyter (previously i...
trudake/Notebooks
PixieApp+for+Outlier+Detection.ipynb
mit
!pip install --user --upgrade pixiedust !pip install --user --upgrade scikit-learn import pixiedust import numpy as np import matplotlib.pyplot as plt import sklearn.ensemble import pandas as pd from sklearn import svm from pyspark.mllib.stat import Statistics from pyspark.mllib.clustering import * import pyspark.sql....
zomansud/coursera
ml-classification/week-3/module-5-decision-tree-assignment-2-blank.ipynb
mit
import graphlab """ Explanation: Implementing binary decision trees The goal of this notebook is to implement your own binary decision tree classifier. You will: Use SFrames to do some feature engineering. Transform categorical variables into binary variables. Write a function to compute the number of misclassified e...
JackDi/phys202-2015-work
assignments/assignment11/OptimizationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Optimization Exercise 1 Imports End of explanation """ # YOUR CODE HERE def hat(x,a,b): v=-1*a*x**2+b*x**4 return v assert hat(0.0, 1.0, 1.0)==0.0 assert hat(0.0, 1.0, 1.0)==0.0 assert hat(1.0...
sraejones/phys202-2015-work
assignments/midterm/AlgorithmsEx03.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact """ Explanation: Algorithms Exercise 3 Imports End of explanation """ def char_probs(s): """Find the probabilities of the unique characters in the string s. Parameters ---------- ...
eaton-lab/toytree
docs/10-treestyles.ipynb
bsd-3-clause
import toytree # generate a random tree tree = toytree.rtree.unittree(ntips=10, seed=123) """ Explanation: Using built-in Tree Styles The built-in treestyle or ts drawing options in toytree provide a base layer for styling drawings that can make it easier to achieve a desired style using fewer options. Additional sty...
jeicher/cobrapy
documentation_builder/io.ipynb
lgpl-2.1
import cobra.test import os from os.path import join data_dir = cobra.test.data_directory print("mini test files: ") print(", ".join(i for i in os.listdir(data_dir) if i.startswith("mini"))) textbook_model = cobra.test.create_test_model("textbook") ecoli_model = cobra.test.create_test_model("ecoli"...
robblack007/clase-dinamica-robot
Practicas/practica1/inicio.ipynb
mit
2 + 3 2*3 2**3 sin(pi) """ Explanation: Práctica 1 - Introducción a Jupyter lab y libreria robots Introducción a Jupyter y el lenguaje de programación Python Expresiones aritmeticas y algebraicas Empezaremos esta práctica con algo de conocimientos previos de programación. Se que muchos de ustedes no han tenido la o...
cfjhallgren/shogun
doc/ipython-notebooks/structure/FGM.ipynb
gpl-3.0
%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...
GeosoftInc/gxpy
examples/jupyter_notebooks/Tutorials/Geosoft Databases.ipynb
bsd-2-clause
from IPython.display import Image import numpy as np import geosoft.gxapi as gxapi import geosoft.gxpy.gx as gx import geosoft.gxpy.gdb as gxdb import geosoft.gxpy.utility as gxu gxc = gx.GXpy() url = 'https://github.com/GeosoftInc/gxpy/raw/9.3.1/examples/data/' gxu.url_retrieve(url + 'mag_data.csv') """ Explanation:...
arnoldlu/lisa
ipynb/tutorial/04_ExecutorUsage.ipynb
apache-2.0
import logging from conf import LisaLogging LisaLogging.setup() # Execute this cell to enabled executor debugging statements logging.getLogger('Executor').setLevel(logging.DEBUG) """ Explanation: Tutorial Goal This tutorial aims to show how to configure and run a predefined set of synthetic workload using the executo...
mgorenstein/multiplot
tutorial.ipynb
mit
import pandas as pd import numpy as np import scipy.signal as signal from multiplot import PandasPlot, NumpyPlot %matplotlib inline """ Explanation: multiplot tutorial Although the forthcoming inline plots are static, running this code in a Python shell will produce interactive matplotlib windows. End of explanation "...
CompPhysics/MachineLearning
doc/src/NeuralNet/notes/.ipynb_checkpoints/mlp-checkpoint.ipynb
cc0-1.0
# import necessary packages import numpy as np import matplotlib.pyplot as plt from sklearn import datasets #ensure the same random numbers appear every time np.random.seed(0) # display images in notebook %matplotlib inline plt.rcParams['figure.figsize'] = (10,10) # download MNIST dataset digits = datasets.load_di...
melissawm/oceanobiopython
exemplos/exemplo_5/CTD_Data.ipynb
gpl-3.0
import pandas as pd """ Explanation: Exemplo: manipulação de NaNs e limpeza de dados Neste exemplo, usaremos um arquivo com muitos dados ausentes (representados por NaNs) para explorar o conceito de filtros. Além disso, vamos fazer um gráfico simples para representar os dados. Para isso, vamos usar duas bibliotecas im...
BinRoot/TensorFlow-Book
ch02_basics/Concept08_TensorBoard.ipynb
mit
import tensorflow as tf import numpy as np raw_data = np.random.normal(10, 1, 100) """ Explanation: Ch 02: Concept 08 Using TensorBoard TensorBoard is a great way to visualize what's happening behind the code. In this example, we'll loop through some numbers to improve our guess of the average value. Then we can vis...