repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
datacommonsorg/api-python
notebooks/intro_data_science/Data_Commons_For_Data_Science_Tutorial.ipynb
apache-2.0
!pip install datacommons --upgrade --quiet !pip install datacommons_pandas --upgrade --quiet """ Explanation: <a href="https://colab.research.google.com/github/datacommonsorg/api-python/blob/master/notebooks/intro_data_science/Data_Commons_For_Data_Science_Tutorial.ipynb" target="_parent"><img src="https://colab.resea...
gonmolina/CCE_ProblemasResueltos
ProbsVVEE/Python Control Notebook/rlocus_test.ipynb
mit
sys1 = ctrl.tf([1, 1], [1, 10, 1]) print(sys1) r, k = ctrl.rlocus(sys1) plt.show() r, k = ctrl.rlocus(sys1, grid=True) """ Explanation: Simple example that is not OK End of explanation """ r, k = ctrl.rlocus(sys1, grid=True, ylim=[-10, 10]) """ Explanation: However, when I plot the grid the figure looks not so goo...
harmsm/pythonic-science
chapters/05_big-files/00_fastq-files.ipynb
unlicense
f = open("files/simple-file.txt") for l in f.readlines(): print(l,end="") f.close() """ Explanation: Reading high-throughput sequencing files @SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=60 GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACCAAGTTACCCTTAACAACTTAAGGG +SRR001666.1 071112_SLXA-EAS1_s_7:5:1:817:345 length=60 ...
slundberg/shap
notebooks/overviews/Explaining quantitative measures of fairness.ipynb
mit
# here we define a function that we can call to execute our simulation under # a variety of different alternative scenarios import scipy as sp import numpy as np import matplotlib.pyplot as pl import pandas as pd import shap %config InlineBackend.figure_format = 'retina' def run_credit_experiment(N, job_history_sex_imp...
mne-tools/mne-tools.github.io
0.23/_downloads/c69e0120935518121b8298ecac72eed8/35_dipole_orientations.ipynb
bsd-3-clause
import mne import numpy as np from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse data_path = sample.data_path() evokeds = mne.read_evokeds(data_path + '/MEG/sample/sample_audvis-ave.fif') left_auditory = evokeds[0].apply_baseline() fwd = mne.read_forward_solution( dat...
ocefpaf/intro_python_notebooks
08-dados_alunos.ipynb
mit
import pandas as pd df = pd.read_excel("./data/2005.02_onda.xlsx").head() df.head() """ Explanation: Dados de ondas do modelo Wavewatch III Dado mensal amostrado de 6 em 6 horas, as variáveis são tempo, direção de onda e altura significativa da onda. valores de máximo e mínimo da altura significativa média da altu...
phoebe-project/phoebe2-docs
2.3/tutorials/emcee_continue_from.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" import phoebe from phoebe import u # units import numpy as np logger = phoebe.logger('error') """ Explanation: Advanced: Continuing Emcee from a Previous Run IMPORTANT: this tutorial assumes basic knowledge (and uses a file resulting from) the emcee tutorial. NOTE: support for con...
cattoire/sparksamples
streaming-twitter/notebook/Twitter + Watson Tone Analyzer Part 2.ipynb
apache-2.0
# Import SQLContext and data types from pyspark.sql import SQLContext from pyspark.sql.types import * # sc is an existing SparkContext. sqlContext = SQLContext(sc) """ Explanation: Twitter + Watson Tone Analyzer Sample Notebook In this sample notebook, we show how to load and analyze data from the Twitter + Watson To...
alaindomissy/xarray_example
seasonal_averages.ipynb
mit
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import xarray from netCDF4 import num2date from netCDF4 import Dataset # !conda list print("numpy version :", np.__version__) print("pandas version :", pd.__version__) print("xray version :", xarray.__version__) """ Expl...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session04/Day1/StatisticsAperitif.ipynb
mit
y = np.array([203, 58, 210, 202, 198, 158, 165, 201, 157, 131, 166, 160, 186, 125, 218, 146]) x = np.array([495, 173, 479, 504, 510, 416, 393, 442, 317, 311, 400, 337, 423, 334, 533, 344]) """ Explanation: Introduction to Statistics: An Aperitif for DSFP Sess...
mathLab/RBniCS
tutorials/05_gaussian/tutorial_gaussian_eim.ipynb
lgpl-3.0
from dolfin import * from rbnics import * """ Explanation: TUTORIAL 05 - Empirical Interpolation Method for non-affine elliptic problems Keywords: empirical interpolation method 1. Introduction In this Tutorial, we consider steady heat conduction in a two-dimensional square domain $\Omega = (-1, 1)^2$. The boundary $\...
vtsuperdarn/davitpy
docs/notebook/radarStruct.ipynb
gpl-3.0
# Import radar module %pylab inline from davitpy.pydarn.radar import * """ Explanation: network(), radar() and site() objects This notebook introduces the high-level python interface with the radar.dat and hdw.dat content. For more in-depth access (i.e., your own hdw.dat), look at the radInfoIO module: radInfoIo? ...
chrisbarnettster/cfg-analysis-on-heroku-jupyter
notebooks/notebooks/download_cfg_for_galectin.ipynb
mit
# standard imports import urllib2 import os import json import StringIO import pickle # dataframe and numerical import pandas as pd import numpy as np # plotting import matplotlib.pyplot as plt %matplotlib inline #scipy from scipy import stats from scipy.special import erf from scipy import sqrt from IPython.disp...
bioinformatica-corso/lezioni
laboratorio/lezione6-7-15-21ott21/esercizio3-soluzione.ipynb
cc0-1.0
def format_fasta(header, sequence): return header + '\n' + '\n'.join(re.findall('\w{,80}', sequence)) """ Explanation: Esercizio 3 EMBL (http://www.ebi.ac.uk/cgi-bin/sva/sva.pl/) è una banca di sequenze nucleotidiche sviluppata da EMBL-EBI (European Bioinformatics Institute, European Molecular Biology Laboratory),...
bretthandrews/marvin
docs/sphinx/jupyter/whats_new_v21.ipynb
bsd-3-clause
import matplotlib %matplotlib inline # only necessary if you have a local DB from marvin import config config.forceDbOff() """ Explanation: What's New in Marvin 2.1 Marvin is Python 3.5+ compliant! End of explanation """ from marvin.tools.cube import Cube cube = Cube(plateifu='7957-12702') print(cube) list(cube.ns...
antoniomezzacapo/qiskit-tutorial
community/aqua/general/eoh.ipynb
apache-2.0
import numpy as np from qiskit_aqua.operator import Operator num_qubits = 2 temp = np.random.random((2 ** num_qubits, 2 ** num_qubits)) qubitOp = Operator(matrix=temp + temp.T) temp = np.random.random((2 ** num_qubits, 2 ** num_qubits)) evoOp = Operator(matrix=temp + temp.T) """ Explanation: The EOH (Evolution of Ham...
d-k-b/udacity-deep-learning
embeddings/Skip-Gram_word2vec.ipynb
mit
import time import numpy as np import tensorflow as tf import utils """ 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 embedding words for use in natural language p...
mit-crpg/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: Multigroup (Delayed) Cross Section Generation Part II: Advanced Features This IPython Notebook illustrates the use of the openmc.mgxs.Library class. The Library class is designed to aut...
mndrake/PythonEuler
euler_051_060.ipynb
mit
from euler import Seq, timer, primes, is_prime def p051(): def groups(n): return ([[int(str(n).replace(x,y)) for y in '0123456789'] >> Seq.toSet >> Seq.filter(is_prime) >> Seq.toList for x in '0123456789'] >> Seq.filte...
WNoxchi/Kaukasos
FAI_old/lesson2/L2HW1_LM.ipynb
mit
# Import relevant libraries from keras.models import Sequential from keras.layers import Dense from keras.optimizers import SGD, RMSprop from keras.preprocessing import image import numpy as np import os # Data functions ~ mostly from utils.py or vgg16.py def get_batches(dirname, gen=image.ImageDataGenerator(), shuffl...
cathywu/flow
tutorials/tutorialxx_template.ipynb
mit
a = 1 b = 2 def add(a, b): return a + b """ Explanation: Tutorial XX: Template This tutorial walks you through the process of FILL IN. The reason behind when and why this is important should be briefly described in the remainder of this paragraph. If possible, this should be further elucidated by a complementary ...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/cmip6/models/sandbox-2/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-2', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-2 Topic: Ocnbgchem Sub-Topics: Tracers. P...
lukas/scikit-class
examples/notebooks/Lesson-0-Getting-Started.ipynb
gpl-2.0
import numpy as np from sklearn.linear_model import LinearRegression from sklearn import datasets import matplotlib.pyplot as plt # matplotlib is a graphing library %matplotlib inline # Load the boston housing price dataset # Dataset of house prices by area boston_houses = datasets.load_boston() # load the average...
gVallverdu/cookbook
colorscale.ipynb
gpl-2.0
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from IPython.display import HTML # intégration notebook %matplotlib inline """ Explanation: Color palette with python Germain Salvato Vallverdu germain.vallverdu@univ-pau.fr This notebook aims to present several ways to manage color palette wi...
aimacode/aima-python
search.ipynb
mit
from search import * from notebook import psource, heatmap, gaussian_kernel, show_map, final_path_colors, display_visual, plot_NQueens # Needed to hide warnings in the matplotlib sections import warnings warnings.filterwarnings("ignore") """ Explanation: Solving problems by Searching This notebook serves as supportin...
iurilarosa/thesis
codici/Archiviati/Plots/plot funzioni.ipynb
gpl-3.0
G = 6.67408*1e-11 c = 299792458 r = 2.4377e+20 I = 1e38 epsilon = 1e-4 nu0 = 1 nudot = -5e-10 cost = 16*math.pi**2*G/(c**4*r)*I*epsilon print(cost) nmesi = 9 tobs = nmesi*30*24*60*60 print(tobs) tempi = numpy.linspace(0,10,100000) leggeOraria = nu0+nudot*tempi ampiezza = cost*numpy.power(leggeOraria,2) onda = ampiez...
gfeiden/Notebook
Projects/mlt_calib/alpha_distributions.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Handling Posterior Distributions of $\alpha_{\rm MLT}$ End of explanation """ means = np.genfromtxt('data/run08_mean_props.txt') medians = np.genfromtxt('data/run08_median_props.txt') modes = np.genfromtxt('data/run08_mle_props.tx...
pauliacomi/pyGAPS
docs/examples/import.ipynb
mit
from pathlib import Path import pygaps.parsing as pgp json_path = Path.cwd() / 'data' """ Explanation: Reading isotherms The first thing to do is to read previously created isotherms. Example data can be found in the data directory, saved in the pyGAPS JSON format, which we will now open. First, we'll do the necessar...
chemiskyy/simmit
Examples/Continuum_Mechanics/constitutive_props.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from simmit import smartplus as sim import os """ Explanation: constitutive : The Constitutive Library End of explanation """ E = 70000.0 nu = 0.3 L = sim.L_iso(E,nu,"Enu") print np.array_str(L, precision=4, suppress_small=True) d = sim.check_sy...
Epidemium/RAMP-1
_.ipynb_checkpoints/epidemium_01_starting_kit-checkpoint.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...
foreignOwl/data-analysis-notebooks
unemploymentHigherEducation.ipynb
mit
# this line is required to see visualizations inline for Jupyter notebook %matplotlib inline # importing modules that we need for analysis import matplotlib.pyplot as plt import pandas as pd import numpy as np import re all_ages = pd.read_csv("all-ages.csv") grad_students = pd.read_csv("grad-students.csv") majors = p...
giacomov/3ML
docs/examples/Time-energy-fit.ipynb
bsd-3-clause
from threeML import * import matplotlib.pyplot as plt from jupyterthemes import jtplot %matplotlib inline jtplot.style(context="talk", fscale=1, ticks=True, grid=False) plt.style.use("mike") """ Explanation: Time-energy fit 3ML allows the possibility to model a time-varying source by explicitly fitting the time-d...
vravishankar/Jupyter-Books
Python+Operators.ipynb
mit
2 + 3 """ Explanation: Python Operators Operators are special symbols in python that carry out arthimetic and logical operations. Example End of explanation """ x = 15 y = 6 # Addition Operator print('x + y = ', x + y) # Subtraction Operator print('x - y = ', x - y) # Multiplication Operator print('x * y = ', x *...
tensorflow/docs
site/en/guide/intro_to_modules.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...
gwu-libraries/notebooks
20180320-twitter-commandline/Twitter command-line.ipynb
mit
!wc -l *.jsonl """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#Command-line-tools-for-wrangling-Twitter-data" data-toc-modified-id="Command-line-tools-for-wrangling-Twitter-data-1"><span class="toc-item-num">1&n...
boya-zhou/kaggle_bimbo_reformat
notebooks/1_predata.ipynb
mit
agencia_for_cliente_producto = train_dataset[['Cliente_ID','Producto_ID' ,'Agencia_ID']].groupby(['Cliente_ID', 'Producto_ID']).agg(lambda x:x.value_counts().index[0]).reset_index() canal_for_cliente_pr...
sympy/scipy-2017-codegen-tutorial
notebooks/_38-chemical-kinetics-symengine.ipynb
bsd-3-clause
import json import numpy as np from scipy2017codegen.odesys import ODEsys from scipy2017codegen.chem import mk_rsys """ Explanation: NOTE This notebook will make more sense (provide speed-up) once the LLVM backend is exposed in the python wrappers for SymEngine. I need to get back working on that here. In this noteboo...
esa-as/2016-ml-contest
CannedGeo_/Facies_classification-BPage_CannedGeo_F1_56-VALIDATED.ipynb
apache-2.0
import sklearn print(sklearn.__version__) """ Explanation: Facies classification using Machine Learning <hr /> Contest entry by Bryan Page This version has been validated by Matt <hr /> Based on the original notebook by Brendon Hall, Enthought <hr /> Matt's current sklearn version End of explanation """ %matplot...
kkkddder/dmc
notebooks/week-2/01 - Introduction to Python - Variables.ipynb
apache-2.0
print "Hello World" """ Explanation: Introduction to Python The main technology we will use in this class is Python. Python is a very modern, general-purpose and high-level object-oriented programming language. It has become extremely popular in recent years due to its relatively simple syntax extensibility through ...
claesenm/semisup-metrics
performance-curves-python3.ipynb
bsd-2-clause
import random import operator as op import optunity.metrics import semisup_metrics as ss import numpy as np from matplotlib import pyplot as plt import pickle import csv import util %matplotlib inline """ Explanation: Performance curves In this notebook we will show how to compute performance curves (ROC and PR curves...
facaiy/book_notes
deep_learning/Introduction/note.ipynb
cc0-1.0
show_image('fig1_5.png', figsize=[12, 10]) show_image('fig1_4.png', figsize=[10, 8]) """ Explanation: Chapter 1 Introduction End of explanation """ show_image('fig1_11.png', figsize=[10, 8]) """ Explanation: History: distributed representation back-propagation long short-term memory (LSTM) network: used for many ...
USCDataScience/parser-indexer-py
notebooks/minerals-ner/MineralNER.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline from snorkel import SnorkelSession import os import numpy as np import re import codecs os.environ['SNORKELDB'] = 'sqlite:///snorkel-mte.db' # Open Session session = SnorkelSession() # Read input base_dir = '/Users/thammegr/work/mte/data/newcorpus/MTE-corpus-ope...
MarkPinches/Metrum-Institute
MI250 Lecture 4 - Simple Hierarchical mixed effect max model.ipynb
gpl-3.0
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline from pymc3 import Model, Normal, Lognormal, Uniform, trace_to_dataframe, df_summary """ Explanation: This model buils a simple Hierarchial mixed effect model to look at dose response from 5 clinical trials...
lrayle/rental-listings-census
src/rental_listings_modeling.ipynb
bsd-3-clause
# TODO: add putty connection too. #read SSH connection parameters with open('ssh_settings.json') as settings_file: settings = json.load(settings_file) hostname = settings['hostname'] username = settings['username'] password = settings['password'] local_key_dir = settings['local_key_dir'] census_dir = 'synth...
krischer/pyadjoint
doc/example_dataset.ipynb
bsd-3-clause
import obspy import numpy as np event_longitude = 126.42 event_latitude = 1.97 event_depth_in_km = 37.3 station_longitude = -123.24 station_latitude = 43.12 max_period = 100.0 min_period = 20.0 cmt_time = obspy.UTCDateTime(2014, 11, 15, 2, 31, 50.26) # Desired properties after the data processing. sampling_rate = ...
GuidoBR/python-for-finance
Exploring the Bitcoin Cryptocurrency Market/notebook.ipynb
mit
# Importing pandas import pandas as pd # Importing matplotlib and setting aesthetics for plotting later. import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'svg' plt.style.use('fivethirtyeight') # Reading datasets/coinmarketcap_06122017.csv into pandas dec6 = pd.read_csv("datase...
fdcl-gwu/MAE3134_examples
sinusoidal_response.ipynb
gpl-3.0
%matplotlib inline import numpy as np from scipy import signal import matplotlib.pylab as plt from ipywidgets import interact import ipywidgets as widgets np.set_printoptions(2) # plt.rc('text', usetex=True) # plt.rc('font', family='serif') def A(w, wn, zeta): A = 1 / np.sqrt((1 - (w/wn)**2)**2 + (2*zeta*w/wn)**...
ES-DOC/esdoc-jupyterhub
notebooks/dwd/cmip6/models/mpi-esm-1-2-hr/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'dwd', 'mpi-esm-1-2-hr', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: DWD Source ID: MPI-ESM-1-2-HR Topic: Ocean Sub-Topics: Timestepping Framework, A...
cathalmccabe/PYNQ
boards/Pynq-Z2/logictools/notebooks/boolean_generator.ipynb
bsd-3-clause
from pynq.overlays.logictools import LogicToolsOverlay logictools_olay = LogicToolsOverlay('logictools.bit') """ Explanation: Boolean Generator This notebook will show how to use the boolean generator to generate a boolean combinational function. The function that is implemented is a 2-input XOR. Step 1: Download the...
jaimefrio/pydatabcn2017
taking_numpy_in_stride/Taking NumPy In Stride.ipynb
unlicense
a = np.arange(3) type(a) """ Explanation: Array views and slicing A NumPy array is an object of numpy.ndarray type: End of explanation """ a = np.arange(3) a.base is None b = a b.base is None a[:].base is None a[:].base is a """ Explanation: All ndarrays have a .base attribute. If this attribute is not None, then...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a_algo/td1a_sobel_correction.ipynb
mit
from pyquickhelper.loghelper import noLOG from pyensae.datasource import download_data f = download_data("python.png", url="http://imgs.xkcd.com/comics/") from IPython.display import Image Image("python.png") """ Explanation: 1A.algo - filtre de Sobel - correction Correction. Exercice 1 : application d'un filtre End o...
ual/hedonic-models
statistical-modeling.ipynb
bsd-3-clause
# Startup steps import pandas as pd, numpy as np, statsmodels.api as sm import matplotlib.pyplot as plt, matplotlib.cm as cm, matplotlib.font_manager as fm import matplotlib.mlab as mlab import time, requests from scipy.stats import pearsonr, ttest_rel import seaborn as sns sns.set() %matplotlib inline """ Explanation...
SciTools/courses
course_content/extra_courses/numpy_intro.ipynb
gpl-3.0
# NumPy is generally imported as 'np'. import numpy as np print(np) print(np.__version__) """ Explanation: A Workshop Introduction to NumPy The Python language is an excellent tool for general-purpose programming, with a highly readable syntax, rich and powerful data types (strings, lists, sets, dictionaries, arbitrar...
amcdawes/QMlabs
Lab 3 - Operators - Solutions (old).ipynb
mit
import matplotlib.pyplot as plt from numpy import sqrt,cos,sin,pi,arange from qutip import * H = Qobj([[1],[0]]) V = Qobj([[0],[1]]) P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]]) M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]]) R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]]) L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]]) """ Explanation: Lab 3: Operators...
PySCeS/PyscesToolbox
documentation/notebooks/basic_usage.ipynb
bsd-3-clause
# PySCeS model instantiation using the `example_model.py` file # with name `mod` mod = pysces.model('example_model') mod.SetQuiet() # Parameter scan setup and execution # Here we are changing the value of `Vf2` over logarithmic # scale from `log10(1)` (or 0) to log10(100) (or 2) for a # 100 points. mod.scan_in = 'Vf2...
zzsza/Datascience_School
03. 파이썬 프로그래밍/08. Python의 날짜 및 시간 관련 패키지 소개.ipynb
mit
import datetime """ Explanation: Python의 날짜 및 시간 관련 패키지 소개 날짜/시간 관련 패키지 datetime https://docs.python.org/2/library/datetime.html time https://docs.python.org/2/library/time.html pytz http://pythonhosted.org/pytz/ dateutil http://dateutil.readthedocs.org/en/latest/index.html datetime 패키지 서브 패키지 d...
conversationai/conversationai-crowdsource
constructiveness_toxicity_crowdsource/jupyter-notebooks/sanity_tests/sanity_test_crowd_annotations.ipynb
apache-2.0
df['constructive_nominal'] = df['constructive'].apply(nominalize_constructiveness) cdict = df['constructive_nominal'].value_counts().to_dict() # Plot constructiveness distribution in the data # The slices will be ordered and plotted counter-clockwise. labels = 'Constructive', 'Non constructive', 'Not sure' items =[cd...
WNoxchi/Kaukasos
FAI_old/lesson4_codealong.ipynb
mit
import theano import sys, os sys.path.insert(1, os.path.join('utils')) %matplotlib inline import utils; reload(utils) from utils import * from __future__ import print_function, division path = "data/ml-latest-small/" model_path = path + 'models/' if not os.path.exists(model_path): os.mkdir(model_path) batch_size = 6...
SIMEXP/Projects
NSC2006/labo8_filtrage/labo 8 Introduction au filtrage.ipynb
mit
%matplotlib inline from pymatbridge import Octave octave = Octave() octave.start() %load_ext pymatbridge """ Explanation: Laboratoire d'introduction au filtrage Cours NSC-2006, année 2015 Méthodes quantitatives en neurosciences Pierre Bellec, Yassine Ben Haj Ali Objectifs: Ce laboratoire a pour but de vous initier ...
desihub/desisim
doc/nb/simulating-desi-spectra.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt from astropy.io import fits from astropy.table import Table import desispec.io import desisim.io from desisim.obs import new_exposure from desisim.scripts import quickgen from desispec.scripts import group_spectra %pylab inline """ Explanation: Simulating...
omoju/Fundamentals
CS/Part_1_Complexity_RunTimeAnalysis.ipynb
gpl-3.0
%pylab inline # Import libraries from __future__ import absolute_import, division, print_function import math from time import time import matplotlib.pyplot as pyplt """ Explanation: Runtime Analysis using Finding the nth Fibonacci numbers as a computational object to think with End of explanation """ from IPython...
opencobra/cobrapy
documentation_builder/simulating.ipynb
gpl-2.0
from cobra.io import load_model model = load_model("textbook") """ Explanation: Simulating with FBA Simulations using flux balance analysis can be solved using Model.optimize(). This will maximize or minimize (maximizing is the default) flux through the objective reactions. End of explanation """ solution = model.op...
joewie/PySyft
notebooks/Syft - Testing - Benchmark Tests.ipynb
apache-2.0
from syft.test.benchmark import Benchmark Benchmark(str) """ Explanation: Testing: Benchmark Tests One goal of the OpenMined project is to efficiently train Deep Learning models in a homomorphically encrypted state. Therefore it is very important to benchmark new and existing features in order to achieve better and f...
jdstokes/nsc211
notebooks/2.0-jds-tf_udacity_notMNIST.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import os import sys import tarfile from IPython.display import display, Image from scipy import ndimage from sklearn.lin...
mlamoureux/PIMS_YRC
2D_Widgets.ipynb
mit
from ipywidgets import interact """ Explanation: Widgets, for interactive plotting in 2D Widgets are a quick way to get interactivity in your Jupyter displays. Jupyter has its own version of widgets, based on Python widgets. We use the interact command to access them. End of explanation """ def f(x): return x ...
scholer/cy-rest-python
advanced/path2models.ipynb
mit
import libsbml import pandas as pd import re """ Explanation: Mapping Path2Models whole genome metabolism model to KEGG pathway Software Requirements pandas python-libsbml End of explanation """ !curl -o BMID000000140222.xml http://www.ebi.ac.uk/biomodels-main/download?mid=BMID000000140222 """ Explanation: Retriev...
qinwf-nuan/keras-js
notebooks/layers/wrappers/Bidirectional.ipynb
mit
data_in_shape = (3, 6) layer_0 = Input(shape=data_in_shape) layer_1 = Bidirectional(SimpleRNN(4, activation='tanh', return_sequences=False), merge_mode='sum')(layer_0) model = Model(inputs=layer_0, outputs=layer_1) # set weights to random (use seed for reproducibility) weights = [] for i, w in enumerate(model.get_wei...
landlab/landlab
notebooks/tutorials/landscape_evolution/hylands/HyLandsTutorial.ipynb
mit
## Import Numpy and Matplotlib packages import numpy as np import copy import matplotlib as mpl import matplotlib.pyplot as plt # For plotting results; optional ## Import Landlab components # Flow routing and depression handling from landlab.components import PriorityFloodFlowRouter # SPACE model from landlab.compon...
mayank-johri/LearnSeleniumUsingPython
Section 3 - Machine Learning/ThirdParty-scikit-learn-videos-master/03_getting_started_with_iris.ipynb
gpl-3.0
from IPython.display import IFrame IFrame('http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', width=300, height=200) """ Explanation: Getting started in scikit-learn with the famous iris dataset From the video series: Introduction to machine learning with scikit-learn Agenda What is the famous ...
wuafeing/Python3-Tutorial
02 strings and text/02.14 combine and concatenate strings.ipynb
gpl-3.0
parts = ["Is", "Chicago", "Not", "Chicago?"] " ".join(parts) ",".join(parts) "".join(parts) """ Explanation: Previous 2.14 合并拼接字符串 问题 你想将几个小的字符串合并为一个大的字符串 解决方案 如果你想要合并的字符串是在一个序列或者 iterable 中,那么最快的方式就是使用 join() 方法。比如: End of explanation """ a = "Is Chicago" b = "Not Chicago?" a + " " + b """ Explanation: 初看起来,这种语法...
mabevillar/rmtk
rmtk/vulnerability/derivation_fragility/hybrid_methods/N2/N2.ipynb
agpl-3.0
import N2Method from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: N2 - Eurocode 8, CEN (2005) This simplified nonlinear procedure for the estimation of the seismic response of structures uses capacity curves and inelastic spectra. This method has been developed to be used in combination ...
google/intelligent_annotation_dialogs
exp1_IAD_RL.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np from __future__ import division from __future__ import print_function import math import gym from gym import spaces import pandas as pd import tensorflow as tf from IPython import display import time from third_party import np_box_ops import annotator, detector, di...
GoogleCloudPlatform/asl-ml-immersion
notebooks/supplemental/solutions/deepconv_gan.ipynb
apache-2.0
try: %tensorflow_version 2.x except Exception: pass import tensorflow as tf tf.__version__ # To generate GIFs !python3 -m pip install -q imageio import glob import os import time import imageio import matplotlib.pyplot as plt import numpy as np import PIL from IPython import display from tensorflow.keras i...
tensorflow/docs
site/en/guide/migrate/logging_stop_hook.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...
willettk/insight
interviews/intuit/risk.ipynb
apache-2.0
%matplotlib inline from matplotlib import pyplot as plt from sqlalchemy import create_engine from sqlalchemy_utils import database_exists, create_database import psycopg2 import pandas as pd # Requires v 0.18.0 import numpy as np import seaborn as sns sns.set_style("whitegrid") dbname = 'risk' username = 'willettk' ...
LorenzoBi/courses
TSAADS/tutorial 2/.ipynb_checkpoints/TSA2_LORENZO_BIASI__JULIUS_VERNIE-checkpoint.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy.io as sio from sklearn import datasets, linear_model %matplotlib inline def set_data(p, x): temp = x.flatten() n = len(temp[p:]) x_T = temp[p:].reshape((n, 1)) X_p = np.ones((n, p + 1)) for i in range(1, p + 1): X_p[:, i] = tem...
Neuroglycerin/neukrill-net-work
notebooks/Saturation epoch model result.ipynb
mit
import pylearn2.utils import pylearn2.config import theano import neukrill_net.dense_dataset import neukrill_net.utils import numpy as np %matplotlib inline import matplotlib.pyplot as plt #import holoviews as hl #%load_ext holoviews.ipython import sklearn.metrics cd .. """ Explanation: Compare the current best model...
OpenAstronomy/workshop_sunpy_astropy
03-python2-defense-instructors.ipynb
mit
# Usual import first from __future__ import print_function, division numbers = [1.5, 2.3, 0.7, -0.001, 4.4] total = 0.0 for n in numbers: assert n > 0.0, 'Data should only contain positive values' total += n print('total is:', total) """ Explanation: Introduction to Python 2 Defensive Programming <section cla...
grigorisg9gr/menpo-notebooks
menpowidgets/Custom Widgets/Options Widgets.ipynb
bsd-3-clause
from menpowidgets.options import (AnimationOptionsWidget, ChannelOptionsWidget, PatchOptionsWidget, LandmarkOptionsWidget, RendererOptionsWidget, PlotOptionsWidget, LinearModelParametersWidget, TextPrintWidget, FeatureOptionsWidget, ...
materialsvirtuallab/megnet
notebooks/transfer_learning.ipynb
bsd-3-clause
model_form = MEGNetModel.from_file('../mvl_models/mp-2018.6.1/formation_energy.hdf5') """ Explanation: Load formation energy model End of explanation """ embedding_layer = [i for i in model_form.layers if i.name.startswith('embedding')][0] embedding = embedding_layer.get_weights()[0] print('Embedding matrix dimensio...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/03_tensorflow/labs/e_ai_platform.ipynb
apache-2.0
import os PROJECT = 'cloud-training-demos' # REPLACE WITH YOUR PROJECT ID BUCKET = 'cloud-training-demos-ml' # REPLACE WITH YOUR BUCKET NAME REGION = 'us-central1' # REPLACE WITH YOUR BUCKET REGION e.g. us-central1 # for bash os.environ['PROJECT'] = PROJECT os.environ['BUCKET'] = BUCKET os.environ['REGION'] = REGION o...
AllenDowney/DataExploration
effect_size.ipynb
mit
from __future__ import print_function, division import numpy import scipy.stats import matplotlib.pyplot as pyplot from IPython.html.widgets import interact, fixed from IPython.html import widgets # seed the random number generator so we all get the same results numpy.random.seed(17) # some nice colors from http:/...
mdpiper/topoflow-notebooks
Meteorology-Qn_LW.ipynb
mit
%matplotlib inline import numpy as np """ Explanation: Net longwave radiative flux in the Meteorology component Goal: In this example, check whether the Meteorology component produces output for land_surface_net-longwave-radiation__energy_flux (Qn_LW internally) when the model state is updated, given scalar inputs for...
LucaCanali/Miscellaneous
Oracle_Jupyter/Oracle_IPython_cx_Oracle_pandas.ipynb
apache-2.0
# connect to Oracle using cx_Oracle # !pip install cx_Oracle if needed import cx_Oracle db_user = 'scott' db_connect_string = 'localhost:1521/XEPDB1' db_pass = 'tiger' # db_connect_string = 'dbserver:1521/orcl.mydomain.com' # import getpass # db_pass = getpass.getpass() ora_conn = cx_Oracle.connect(user=db_user, pa...
zzsza/Datascience_School
03. 파이썬 프로그래밍/04. Numpy 시작하기.ipynb
mit
import numpy as np a = np.array([0, 1, 2, 3]) a """ Explanation: NumPy NumPy란 수치해석용 Python 라이브러리 C로 구현 (파이썬용 C라이브러리) BLAS/LAPACK 기반 빠른 수치 계산을 위한 Structured Array 제공 Home http://www.numpy.org/ Documentation http://docs.scipy.org/doc/ Tutorial http://www.scipy-lectures.org/intro/numpy/index.html https://docs.scipy.org/...
aaschroeder/Titanic_example
Final_setup_SVM.ipynb
gpl-3.0
import numpy as np import pandas as pd titanic=pd.read_csv('./titanic_clean_data.csv') cols_to_norm=['Age','Fare'] col_norms=['Age_z','Fare_z'] titanic[col_norms]=titanic[cols_to_norm].apply(lambda x: (x-x.mean())/x.std()) #titanic['cabin_clean']=(pd.notnull(titanic.Cabin)) from sklearn.cross_validation import tra...
Mashimo/datascience
03-NLP/POS.ipynb
apache-2.0
# load in the training corpus with open("../datasets/WSJ_02-21.pos", 'r') as f: training_corpus = f.readlines() # list print("A few items of the training corpus list: ") print(training_corpus[0:5]) len(training_corpus) """ Explanation: Parts-of-Speech Tagging (POS) Part-of-speech refers to the category of words...
plipp/informatica-pfr-2017
nbs/4/2-1-Classification-Decision-Tree-w-Label-Encoding-Exercise.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Predicting Earnings from Census Data with Decision Tree taken from The Analytics Edge The Task The United States government periodically collects demographic information by conducting a census. In this problem, we are going to use census information about an indi...
davek44/Basset
tutorials/test.ipynb
mit
model_file = '../data/models/pretrained_model.th' seqs_file = '../data/encode_roadmap.h5' """ Explanation: Once you've trained a model, you might like to get more information about how it performs on the various targets you asked it to predict. To run this tutorial, you'll need to either download the pre-trained model...
tensorflow/docs-l10n
site/zh-cn/tutorials/images/cnn.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...
beyondvalence/biof509_wtl
Wk12-ml-workflow/Wk12-machine-learning-workflow.ipynb
mit
import matplotlib.pyplot as plt import numpy as np import pandas as pd %matplotlib inline """ Explanation: Week 12 - The Machine Learning Workflow End of explanation """ # http://scikit-learn.org/stable/auto_examples/plot_digits_pipe.html#example-plot-digits-pipe-py import numpy as np import matplotlib.pyplot as p...
kgullikson88/keras_notebooks
notebooks/Reuters_MLP.ipynb
mit
# Imports from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets import reuters from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.utils import np_utils from keras.preprocessing.text import Tokenizer """ ...
Gezort/YSDA_deeplearning17
Seminar3/outdated/Seminar 3.ipynb
mit
%matplotlib inline from time import time import numpy as np import matplotlib.pyplot as plt from matplotlib.offsetbox import AnnotationBbox, OffsetImage """ Explanation: Seminar 3 (Data embedding) The goal of this seminar is to play around with diffrent techniques for data visualization. We are going work on the well-...
tensorflow/docs-l10n
site/en-snapshot/io/tutorials/kafka.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...
skalkur/Transfer_learning_Startup.ML
Transfer-learning.ipynb
mit
from tensorflow.python.platform import gfile import tensorflow as tf import numpy as np model='../inception/classify_image_graph_def.pb' def create_graph(): ''' Function to extract GraphDef of Inception model. Returns: Extracted GraphDef ''' with tf.Session() as sess: with gf...
hmelberg/motionChart
notebooks/motion chart notebook.ipynb
gpl-2.0
from motionchart.motionchart import MotionChart, MotionChartDemo import webbrowser import pandas as pd import pyperclip """ Explanation: Motion Charts in Python with Pandas Hans Olav Melberg (hans.melberg@gmail.com), 17. October, 2015 Import modules End of explanation """ fruitdf = pd.DataFrame([ ['Apples', '...
pybel/pybel-notebooks
summary/Graph Summary.ipynb
apache-2.0
import logging import os import sys import time from collections import Counter, defaultdict from operator import itemgetter import matplotlib.pyplot as plt import networkx as nx import seaborn as sns import pybel import pybel_tools as pbt from pybel.constants import * from pybel_tools.visualization import to_jupyter...
karlstroetmann/Algorithms
Python/Chapter-05/Insertion-Sort.ipynb
gpl-2.0
def sort(L): if L == []: return [] x, *R = L return insert(x, sort(R)) """ Explanation: Insertion Sort The function sort is specified via two equations: $\mathtt{sort}([]) = []$ $\mathtt{sort}\bigl([x] + R\bigr) = \mathtt{insert}\bigl(x, \mathtt{sort}(R)\bigr)$ This is most easily implemen...
refgenomics/onecodex
notebook_examples/notebooks_demo.ipynb
mit
from onecodex import Api ocx = Api() project = ocx.Projects.get("d53ad03b010542e3") # get DIABIMMUNE project by ID samples = ocx.Samples.where(project=project.id, public=True, limit=50) samples.metadata[[ "gender", "host_age", "geo_loc_name", "totalige", "eggs", "vegetables", "milk", ...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session04/Day2/GPTutorial1.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.spatial.distance import cdist from numpy.random import multivariate_normal from numpy.linalg import inv from numpy.linalg import slogdet from scipy.optimize import fmin """ Explanation: Gaussian Process regresstion tutorial 1: Introductio...