repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sz2472/foundations-homework
homework_2/Homework_2_Shengying_Zhao.ipynb
mit
import pg8000 conn = pg8000.connect(database="homework2") """ Explanation: Homework 2: Working with SQL (Data and Databases 2016) This homework assignment takes the form of an IPython Notebook. There are a number of exercises below, with notebook cells that need to be completed in order to meet particular criteria. Yo...
CopernicusMarineInsitu/INSTACTraining
PythonNotebooks/PlatformPlots/Read_CORA_dataset.ipynb
mit
datafile = ( '~/CMEMS_INSTAC/INSITU_GLO_TS_OA_REP_OBSERVATIONS_013_002_b/' 'CORIOLIS-GLOBAL-CORA04.1-OBS_FULL_TIME_SERIE/data/2013/OA_CORA4.1_20131215_dat_PSAL.nc' ) """ Explanation: Salinity from CORA dataset The data can be obtained from Coriolis FTP at ftp://ftp1.ifremer.fr/Core/INSITU_GLO_TS_REP_OBSERVATIO...
eaton-lab/eaton-lab.github.io
slides/fundamentals2019/session-3-tree-think/notebooks/nb-3.3-assignment.ipynb
mit
import toytree """ Explanation: Notebook 3.3: Newick Assignment Complete the notebook then download as an HTML file (toolbar -> File -> Download as) and submit your assignment by emailing to Natalie (natalie.niepoth@columbia.edu). End of explanation """ newick = "((a,b),(c, d));" tre = toytree.tree(newick) ...
guyk1971/deep-learning
tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
chuckberry1974/DataScience
Iris data set (full walk thru).ipynb
mit
from sklearn.linear_model import LogisticRegression # instantiate the model logreg = LogisticRegression() #fit the model logreg.fit(x,y) # predict the response value logreg.predict(x) y_pred = logreg.predict(x) len(y_pred) """ Explanation: Logistic Regression End of explanation """ from sklearn import metrics p...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/06_structured/labs/1_explore.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # change these to try this notebook out BUCKET = 'cloud-training-demos-ml' # CHANGE this to a globally unique value. Your project name is a good option to try. PROJECT = 'cloud-training-demos' # CHANGE this to your project name REGION = 'us-centr...
quantopian/research_public
notebooks/lectures/Universe_Selection/notebook.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt from quantopian.pipeline.classifiers.fundamentals import Sector from quantopian.pipeline import Pipeline from quantopian.pipeline.data.builtin import USEquityPricing from quantopian.research import run_pipeline from quantopian.pipeline.data import...
mjuric/LSSTC-DSFP-Sessions
Session4/Day1/LSSTC-DSFP4-Juric-FrequentistAndBayes-03-Credibility.ipynb
mit
import numpy as np N = 5 Nsamp = 10 ** 6 sigma_x = 2 np.random.seed(0) x = np.random.normal(0, sigma_x, size=(Nsamp, N)) mu_samp = x.mean(1) sig_samp = sigma_x * N ** -0.5 print("{0:.3f} should equal {1:.3f}".format(np.std(mu_samp), sig_samp)) """ Explanation: Frequentism and Bayesianism III: Confidence, Credibilit...
desihub/desisim
doc/nb/bgs-redshift-efficiency.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt from astropy.table import Table from astropy.io import fits import seaborn as sns import multiprocessing nproc = multiprocessing.cpu_count() // 2 from desispec.io.util import write_bintable from desiutil.log import get_logger log = get_logger() %matplotli...
ituethoslab/navcom-2017
exercises/Week 3-What are Digital Methods/Exercises week 3.ipynb
gpl-3.0
import pandas as pd %matplotlib inline """ Explanation: Exercises week 3: What are Digital Methods? 1. Install Tableau Desktop <img src="https://cdns.tblsft.com/sites/default/files/pages/answerdeeperquestions.png" style="width: 50%; float: right;"></img> Students are given a license for this software. 2. Open the DAMD...
davofis/computational_seismology
lambs_problem/lambs_problem_solution.ipynb
gpl-3.0
# Import all necessary libraries, this is a configuration step for the exercise. # Please run it before the simulation code! import numpy as np import matplotlib.pyplot as plt import os from ricker import ricker # Show the plots in the Notebook. plt.switch_backend("nbagg") # Compile the source code (needs gfortran!) ...
rongchuhe2/workshop_data_analysis_python
Introduction_to_Python.ipynb
mit
4 2 + 2 50 - 5*6 (50-5)*6 8/5 8//5 # Floor division discards the fractional part 8%5 # The % operator return the remainder of the division """ Explanation: Using Python as a Calculator Let's try some simple python commands Numbers The interpreter acts as a simple calculator: you can type an expression at it an...
GoogleCloudPlatform/mlops-on-gcp
immersion/supplemental/solutions/text2hub.ipynb
apache-2.0
import os import tensorflow as tf import tensorflow_hub as hub """ Explanation: Custom TF-Hub Word Embedding with text2hub Learning Objectives: 1. Learn how to deploy AI Hub Kubeflow pipeline 1. Learn how to configure the run parameters for text2hub 1. Learn how to inspect text2hub generated artifacts and word ...
giacomov/3ML
examples/obsolete/gbm_lle_catalog_demo.ipynb
bsd-3-clause
%matplotlib inline %matplotlib notebook from astropy.time import Time from threeML import * get_available_plugins() """ Explanation: GBM, LAT LLE and Swift Catalogs Using 3ML's catalog and data downloading tools, it is easy to build an analysis for either a single or multiple GRBs from start to finish. Here, we de...
sylvchev/coursMLpython
3b-RegressionLineaire-Salaires.ipynb
unlicense
% matplotlib inline from numpy import zeros, zeros_like, ones, vstack, mod, loadtxt import matplotlib.pyplot as plt from numpy.linalg import pinv """ Explanation: Regression linéaire avec les moindres carrés End of explanation """ def h(theta, x): y_estimated = 0. for theta_i, x_i in zip(theta, x): y...
keras-team/keras-io
examples/keras_recipes/ipynb/sample_size_estimate.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import keras import tensorflow_datasets as tfds from tensorflow.keras import layers # Define seed and fixed variables seed = 42 tf.random.set_seed(seed) np.random.seed(seed) AUTO = tf.data.AUTOTUNE """ Explanation: Estimating r...
Hvass-Labs/TensorFlow-Tutorials
04_Save_Restore.ipynb
mit
from IPython.display import Image Image('images/02_network_flowchart.png') """ Explanation: TensorFlow Tutorial #04 Save & Restore by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube WARNING! This tutorial does not work with TensorFlow v. 1.9 due to the PrettyTensor builder API apparently no longer being update...
iannesbitt/ml_bootcamp
Python-Crash-Course/Python Crash Course Exercises .ipynb
mit
7**4 """ Explanation: Python Crash Course Exercises This is an optional exercise to test your understanding of Python Basics. If you find this extremely challenging, then you probably are not ready for the rest of this course yet and don't have enough programming experience to continue. I would suggest you take anothe...
minyoungg/selfconsistency
demo.ipynb
apache-2.0
# Arg: quality and num_per_dim -> tradeoffs between quality and time spent running # quality affects dense=False, and num_per_dim affects dense=True ckpt_path = './ckpt/exif_final/exif_final.ckpt' exif_demo = demo.Demo(ckpt_path=ckpt_path, use_gpu=0, quality=3.0, num_per_dim=30) """ Explanation: Initialize Demo Solve...
ernestyalumni/MLgrabbag
theano_RNN_LSTM.ipynb
mit
%matplotlib inline from collections import namedtuple import matplotlib.pyplot as plt import sklearn from sklearn import datasets import pandas as pd import theano from theano import function, config, sandbox, shared import theano.tensor as T import numpy as np import scipy import time print( theano.config.devic...
tensorflow/text
docs/tutorials/bert_orbit.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...
seniosh/StatisticalMethods
notes/InferenceSandbox.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt import scipy.stats %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 5.0) # the model parameters a = np.pi b = 1.6818 # my arbitrary constants mu_x = np.exp(1.0) # see definitions above tau_x = 1.0 s = 1.0 N = 50 # number of data points # get some x's and y...
bjshaw/phys202-2015-work
assignments/assignment04/MatplotlibEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 1 Imports End of explanation """ import os assert os.path.isfile('yearssn.dat') """ Explanation: Line plot of sunspot data Download the .txt data for the "Yearly mean total sunspot number [1700 - now]" from th...
tensorflow/docs-l10n
site/ko/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...
edwardd1/phys202-2015-work
assignments/assignment06/ProjectEuler17.ipynb
mit
#First I define a dictionary of all the necessary words to make numbers numbers = {1:'one', 2:'two', 3:'three', 4:'four', 5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine', 10:'ten', 11:'eleven', 12:'twelve', 13:'thirteen', 14:'fourteen', 15:'fifteen', 16:'sixteen', 17:'seventeen', 18:'eighteen', ...
ajhenrikson/phys202-2015-work
assignments/assignment12/FittingModelsEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 2 Imports End of explanation """ def modl(t,A,o,l,d): return A*np.exp(-1*t)*np.cos(o*t)+d thetabest,thetacov=opt.curve_fit(modl,tdata,ydata,np.array((6,1,1,0)),dy,absolute_...
Benedicto/ML-Learning
Linear_Regression_2_multiple_regression_assignment_1.ipynb
gpl-3.0
import graphlab """ Explanation: Regression Week 2: Multiple Regression (Interpretation) The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions. In this notebook you will use data on house sales in King County to predict prices using multiple regressi...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_parcellation.ipynb
bsd-3-clause
# Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from surfer import Brain import mne subjects_dir = mne.datasets.sample.data_path() + '/subjects' mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir, verbose=True) labels = mne.read_label...
opengeostat/pygslib
pygslib/Ipython_templates/.ipynb_checkpoints/backtr_raw-checkpoint.ipynb
mit
#general imports import matplotlib.pyplot as plt import pygslib from matplotlib.patches import Ellipse import numpy as np import pandas as pd #make the plots inline %matplotlib inline """ Explanation: Testing the back normalscore transformation End of explanation """ #get the data in gslib format into a pa...
mne-tools/mne-tools.github.io
0.23/_downloads/8fc13fc21872d78f6b3678c81e192a76/decoding_xdawn_eeg.ipynb
bsd-3-clause
# Authors: Alexandre Barachant <alexandre.barachant@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import StratifiedKFold from sklearn.pipeline import make_pipeline from sklearn.linear_model import LogisticRegression from sklearn.metrics import c...
lithiumdenis/MLSchool
1. Визуализация.ipynb
mit
#Выберем для наглядности часть таблицы, где только атакующие и защитники attDef = df[ ['attacker_king', 'defender_king'] ] #Отсортируем сначала по attacker_king, внутри attacker_king - по defender_king attDef = attDef.sort_values(by=['attacker_king', 'defender_king'], ascending=[False, False]); attDef.attacker_king.v...
mbakker7/ttim
notebooks/well_near_river_or_wall.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from ttim import * """ Explanation: Comparison of HeadLineSinkString and LeakyLineDoubletString vs. image well End of explanation """ ml1 = ModelMaq(kaq=10, z=[20, 0], Saq=[0.1], phreatictop=True, tmin=0.001, tmax=100) w1 = Well(ml1, 0, 0, rw=0.3,...
ES-DOC/esdoc-jupyterhub
notebooks/cas/cmip6/models/sandbox-2/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cas', 'sandbox-2', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: CAS Source ID: SANDBOX-2 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbulen...
theJollySin/python_for_scientists
classes/12_matplotlib/2_points_and_errorbars.ipynb
gpl-3.0
import numpy from matplotlib import pyplot %matplotlib inline ### generate some random data xdata = numpy.arange(15) ydata = numpy.random.randn(15) + xdata ### initialize the "figure" and "axes" objects fig, ax = pyplot.subplots() points_plot = ax.plot(xdata, ydata, marker='o') """ Explanation: Scatter Plots Perh...
JJINDAHOUSE/deep-learning
dcgan-svhn/DCGAN.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
alvaroing12/CADL
session-3/lecture-3.ipynb
apache-2.0
# imports %matplotlib inline # %pylab osx import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx # Some additional libraries which we'll use just # to produce some visualizations of our training from libs.utils import montage from libs i...
sassoftware/sas-viya-machine-learning
Python-integration/Viya 2020 Example.ipynb
apache-2.0
# Packages for Python Basics import sys import numpy as np import pandas as pd # Packages for Building Model Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import OneHotEncoder from sklearn.pipeline import Pipeline from sklearn.compose import ColumnTransformer import xgboost as xgb # Pac...
wanderer2/pymc3
docs/source/notebooks/lasso_block_update.ipynb
apache-2.0
%pylab inline from matplotlib.pylab import * from pymc3 import * import numpy as np d = np.random.normal(size=(3, 30)) d1 = d[0] + 4 d2 = d[1] + 4 yd = .2*d1 +.3*d2 + d[2] """ Explanation: Sometimes, it is very useful to update a set of parameters together. For example, variables that are highly correlated are ofte...
ondrejiayc/StatisticalMethods
examples/Cepheids/FirstLook.ipynb
gpl-2.0
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (15.0, 8.0) """ Explanation: A First Look at the Periods and Luminosities of Cepheid Stars Cepheids are stars whose brightness oscillates with a stable period that appears to ...
ShiroJean/Breast-cancer-risk-prediction
.ipynb_checkpoints/SVM Classification-checkpoint.ipynb
mit
#load libraries import pandas as pd import numpy as np #Supervised learning from sklearn.model_selection import train_test_split from sklearn.svm import SVC #Load data set from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() cancer =pd.DataFrame(cancer.data) cancer.head() #Split data set ...
matthewfeickert/fellowship-project
Notebooks/HistFactory_Examples/One-Bin.ipynb
mit
import ROOT ROOT.RooMsgService.instance().setGlobalKillBelow(5) %jsroot on import sys import os # Don't require pip install to test out sys.path.append(os.getcwd() + '/../../src') from dfgmark import histfactorybench as hfbench #import rootpy #from rootpy.stats.histfactory import utils as hfutils """ Explanation: Ex...
studentofdata/qcew
vmfiles/IPNB/Examples/b Graphics/20 mpld3.ipynb
bsd-3-clause
# first the imports: the matplotlib usuals, plus mpld3 import numpy as np import matplotlib.pyplot as plt import mpld3 plt.style.use('bmh') """ Explanation: mpld3 mpld3 is a Python package that adds interactivity to Matplotlib graphics, for enhanced visualization in browsers. It does so by producing [D3.js]( out of t...
eshlykov/mipt-day-after-day
labs/term-4/lab-1-4.ipynb
unlicense
import numpy as np import scipy as ps import pandas as pd import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Работа 1.4. Исследование вынужденной прецессии гироскопа Цель работы: исследовать вынужденную прецессию уравновешенного симметричного гироскопа; установить зависимость угловой скорости вынужден...
ajgeers/frw
frw.ipynb
bsd-2-clause
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from ipywidgets import interact, IntSlider, FloatSlider %matplotlib inline """ Explanation: Flow rate waveform transformation Arjan Geers An artery's flow rate waveform (FRW) can be characterized in many ways. Three common descriptors ar...
statsmaths/stat665
lectures/lec16/.ipynb_checkpoints/notebook16-checkpoint.ipynb
gpl-2.0
%pylab inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from keras.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import SGD, RMSprop from keras.utils import np_utils from keras.regularizers import l...
NeuroDataDesign/pan-synapse
pipeline_1/background/Cluster_Components_Class_Algorithms.md.ipynb
apache-2.0
%matplotlib inline import matplotlib.pyplot as plt import sys sys.path.insert(0,'../code/functions/') import tiffIO as tIO import connectLib as cLib import plosLib as pLib import time import scipy.ndimage as ndimage import numpy as np """ Explanation: Algorithm Description The Cluster Components class takes in a binar...
ricklupton/beamfe
theory/FE element matrices.ipynb
mit
xi, l, rho = symbols('xi, l, rho') # Shape functions S = Matrix(np.zeros((4, 12))) x2 = (1 - xi) S[0, 0 ] = x2 # extension S[0, 6 ] = xi S[1, 1 ] = x2**2 * (3 - 2*x2) # y-deflection S[1, 7 ] = xi**2 * (3 - 2*xi) S[1, 5 ] = -x2**2 * (x2 - 1) * l S[1, 11] = xi**2 * (xi - 1) * l S[2, 2 ] ...
OSGeoLabBp/tutorials
english/python/pylint.ipynb
cc0-1.0
!python -m pip install pylint -q """ Explanation: <a href="https://colab.research.google.com/github/OSGeoLabBp/tutorials/blob/master/english/python/pylint.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Pylint A tool to check your Python code. Pylin...
unnikrishnankgs/va
venv/lib/python3.5/site-packages/matplotlib/backends/web_backend/nbagg_uat.ipynb
bsd-2-clause
import matplotlib reload(matplotlib) matplotlib.use('nbagg') import matplotlib.backends.backend_nbagg reload(matplotlib.backends.backend_nbagg) """ Explanation: UAT for NbAgg backend. The first line simply reloads matplotlib, uses the nbagg backend and then reloads the backend, just to ensure we have the latest modi...
qutip/qutip-notebooks
examples/landau-zener-stuckelberg.ipynb
lgpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from qutip import * from qutip.ui.progressbar import TextProgressBar as ProgressBar """ Explanation: QuTiP example: Landau-Zener-Stuckelberg inteferometry J.R. Johansson and P.D. Nation For more information about QuTiP see http://qutip.org End of...
rashikaranpuria/Machine-Learning-Specialization
Regression/Assignment_two/week-2-multiple-regression-assignment-1-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 2: Multiple Regression (Interpretation) The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions. In this notebook you will use data on house sales in King County to predict prices using multiple regressi...
ernestyalumni/CompPhys
crack/BigO.ipynb
apache-2.0
def sumOfN(n): theSum = 0 for i in range(1,n+1): theSum = theSum + i return theSum print(sumOfN(10)) def foo(tom): fred = 0 for bill in range(1,tom+1): barney = bill fred = fred + barney return fred print(foo(10)) import time def sumOfN2(n): s...
atulsingh0/MachineLearning
python_DC/ST_Python_01b.ipynb
gpl-3.0
# import import pandas as pd import numpy as np import seaborn as sns from sklearn.datasets import load_iris import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Statistical Thinking in Python (Part 1) Thinking probabilistically End of explanation """ np.random.seed(42) random_numbers = np.empty(1000...
microsoft/dowhy
docs/source/example_notebooks/dowhy_example_effect_of_memberrewards_program.ipynb
mit
# Creating some simulated data for our example import pandas as pd import numpy as np num_users = 10000 num_months = 12 signup_months = np.random.choice(np.arange(1, num_months), num_users) * np.random.randint(0,2, size=num_users) # signup_months == 0 means customer did not sign up df = pd.DataFrame({ 'user_id': n...
astroumd/GradMap
notebooks/Lectures2021/Lecture3/Preview_from2020Lecture3_Instructor.ipynb
gpl-3.0
import numpy as np """ Explanation: Review from the previous lecture In yesterday's Lecture 2, you learned how to use the numpy module, how to make your own functions, and how to import and export data. Below is a quick review before we move on to Lecture 3. Remember, to use the numpy module, first it must be imported...
paultheastronomer/OAD-Data-Science-Toolkit
Teaching Materials/Machine Learning/Supervised Learning/Courses/Astrophysical Machine Learning/Part 1/Exercise 1.ipynb
gpl-3.0
import numpy as np # Define your function def softmax(x): # This is where you write your code! vector = "This is only psudo code.\nYou will have to write this function yourself!" return vector # Replace this with the new array # Test it out on an array test=[1,3,2] print(softmax(test)) # The result should...
melissawm/oceanobiopython
Notebooks/Aula_2.ipynb
gpl-3.0
minhalista = "Como fazer uma list comprehension".split() """ Explanation: List Comprehensions End of explanation """ minhalista """ Explanation: Observe que na linha acima aplicamos o método split diretamente a uma string, sem precisarmos nomear uma variável com o conteúdo da string! End of explanation """ minhal...
trolldbois/python-haystack-reverse
docs/Haystack_reverse_CLI.ipynb
gpl-3.0
!haystack-reverse --help """ Explanation: Usage reference guide for haystack-reverse this is an example of every haystack-reverse commands. The zeus.vmem.856.dump is there https://dl.dropboxusercontent.com/u/10222931/HAYSTACK/zeus.vmem.856.dump.tgz It was extracted from pid 856 from the zeus.img image from http://malw...
mjbommar/cscs-530-w2016
notebooks/basic-space/003-basic_network.ipynb
bsd-2-clause
%matplotlib inline # Imports import networkx as nx import numpy import matplotlib.pyplot as plt import pandas import seaborn; seaborn.set() seaborn.set_style("darkgrid") # Import widget methods from IPython.html.widgets import * """ Explanation: CSCS530 Winter 2016 Complex Systems 530 - Computer Modeling of Complex...
tensorflow/docs-l10n
site/ko/model_optimization/guide/clustering/clustering_comprehensive_guide.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
isendel/machine-learning
ml-regression/week3-4/week-4-ridge-regression-assignment-1-blank.ipynb
apache-2.0
import graphlab import numpy as np """ Explanation: Regression Week 4: Ridge Regression (interpretation) In this notebook, we will run ridge regression multiple times with different L2 penalties to see which one produces the best fit. We will revisit the example of polynomial regression as a means to see the effect of...
PMEAL/OpenPNM
examples/tutorials/geometry/stick_and_ball.ipynb
mit
import openpnm as op %config InlineBackend.figure_formats = ['svg'] import matplotlib.pyplot as plt pn = op.network.Cubic(shape=[20, 20, 20], spacing=100) """ Explanation: The Stick and Ball Geometry The SpheresAndCylinders class contains an assortment of pore-scale models that generate geometrical information assumi...
bgruening/EDeN
examples/Sequence_example.ipynb
gpl-3.0
%matplotlib inline """ Explanation: Example Consider sequences that are increasingly different. EDeN allows to turn them into vectors, whose similarity is decreasing. End of explanation """ import random def make_data(size): text = ''.join([str(unichr(97+i)) for i in range(26)]) seqs = [] def swap_two_...
mne-tools/mne-tools.github.io
0.21/_downloads/ee17e3e8df43ce4f0119faeeeccc374f/plot_sensors_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Stefan Appelhoff <stefan.appelhoff@mailbox.org> # Richard Höchenberger <richard.hoechenberger@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.time_frequenc...
hetland/python4geosciences
materials/ST_singular_value_decomposition.ipynb
mit
# The tranformation matrix M = np.array([[ 0.50, 0.75], [-0.25, 1.50]]) # Generate some random points scattered around the origin N = 10 x = np.random.randn(2, N) # Transform the points into the new coordinate system x_trans = np.dot(M, x) fig, axs = plt.subplots(2, 3, sharex=True, sharey=True, squeez...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex09-Read SST and visualize in different projections.ipynb
mit
%matplotlib inline import numpy as np from netCDF4 import Dataset # http://unidata.github.io/netcdf4-python/ import matplotlib.pyplot as plt # to generate plots from mpl_toolkits.basemap import Basemap # plot on map projections from matplotlib.pylab import rcParams rcParams['figure.figsize'] = 15, 6 ""...
DavidPowell/openmodes-examples
Using and creating geometric shapes.ipynb
gpl-3.0
import openmodes import os import os.path as osp os.listdir(openmodes.geometry_dir) """ Explanation: Working with the included and custom geometries For convenience, a number of common meta-atom geometries are included with OpenModes. The code below shows a list of those which are currently available End of explanati...
thehackerwithin/berkeley
code_examples/keras_introduction/Multi_layer_keras.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers import Dense, Activation from keras.optimizers import SGD %matplotlib inline """ Explanation: Building and training a mutli-layer network with Keras End of explanation """ # Load data df = pd....
qqwjq/lightFM
examples/movielens/learning_schedules.ipynb
apache-2.0
import numpy as np import data %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt from lightfm import LightFM train, test = data.get_movielens_data() train.data = np.ones_like(train.data) test.data = np.ones_like(test.data) from sklearn.metrics import roc_auc_score def preci...
dhuppenkothen/BayesPSD
docs/Demo.ipynb
bsd-2-clause
%matplotlib inline import matplotlib.pyplot as plt ## this is just to make plots prettier ## comment out if you don't have seaborn import seaborn as sns sns.set() ######################################## import numpy as np """ Explanation: How To Search for QPOs with BayesPSD This notebook is a demonstration for h...
nvenayak/impact
docs/source/create_new_feature.ipynb
gpl-3.0
from impact.core.features import BaseAnalyteFeature, BaseAnalyteFeatureFactory """ Explanation: Creating a feature Features are derived from multiple analytes within a single trial. For example, product yield is a function of the substrate consumed, and product produced. Features are registered to the SingleTrial clas...
Dharamsitejas/E4571-Personalisation-Theory-Project
Part2/analysis/tree_based_ann.ipynb
mit
data = pd.read_csv('../created_datasets/Combine.csv') rows = data.user_id.unique() cols = data['isbn'].unique() print("Sparsity :", 100 - (data.shape[0]/(len(cols)*len(rows)) * 100)) idict = dict(zip(cols, range(len(cols)))) udict = dict(zip(rows, range(len(rows)))) data.user_id = [ udict[i] for i in data.user...
tknapen/FIRDeconvolution
test/pupil_preprocess_python.ipynb
mit
from __future__ import division import numpy as np import scipy as sp import matplotlib import matplotlib.pyplot as pl %matplotlib inline import seaborn as sn sn.set(style="ticks") # extra dependencies of this notebook, for data loading and fitting of kernels import pandas as pd from lmfit import minimize, Paramet...
ES-DOC/esdoc-jupyterhub
notebooks/pcmdi/cmip6/models/sandbox-1/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-1', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: PCMDI Source ID: SANDBOX-1 Sub-Topics: Radiative Forcings. Properties: 85 (4...
mne-tools/mne-tools.github.io
0.19/_downloads/ef89d1f7daeb4e357098461753c3af0f/plot_source_alignment.ipynb
bsd-3-clause
import os.path as op import numpy as np import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() subjects_dir = op.join(data_path, 'subjects') raw_fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_raw.fif') trans_fname = op.join(data_path, 'MEG', 'sample', ...
Luindil/Glassure
glassure/notebooks/Effect on extrapolation and optimization.ipynb
mit
%matplotlib inline import os import sys import matplotlib.pyplot as plt sys.path.insert(1, os.path.join(os.getcwd(), '../../')) from glassure.core.calc import calculate_fr, calculate_sq, optimize_sq, calculate_gr from glassure.core.utility import extrapolate_to_zero_poly, convert_density_to_atoms_per_cubic_angstrom fr...
mne-tools/mne-tools.github.io
dev/_downloads/a9e07affc8c71aa96bb4ffe855ff552c/morph_surface_stc.ipynb
bsd-3-clause
# Author: Tommy Clausner <tommy.clausner@gmail.com> # # License: BSD-3-Clause import os import os.path as op import mne from mne.datasets import sample print(__doc__) """ Explanation: Morph surface source estimate This example demonstrates how to morph an individual subject's :class:mne.SourceEstimate to a common r...
hootnot/oanda-api-v20
jupyter/historical.ipynb
mit
import json import oandapyV20 import oandapyV20.endpoints.instruments as instruments from exampleauth import exampleauth accountID, access_token = exampleauth.exampleAuth() client = oandapyV20.API(access_token=access_token) instrument = "EUR_USD" params = { "from": "2017-01-01T00:00:00Z", "granularity": "H1",...
phoebe-project/phoebe2-docs
2.3/tutorials/t0s.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: Various t0s Setup Let's first make sure we have the latest version of PHOEBE 2.3 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 as np import mat...
halfak/are-the-bots-really-fighting
analysis/main/5-3-reverts-per-page.ipynb
mit
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import glob import datetime import pickle %matplotlib inline start = datetime.datetime.now() """ Explanation: Section 5.3: Reverts per page (setup and exploratory) This is a data analysis script used to produce findings in th...
wikistat/Intro-Python
Cal4-PythonProg.ipynb
mit
for i in range(5): print (i) """ Explanation: <center> <a href="http://www.insa-toulouse.fr/" ><img src="http://www.math.univ-toulouse.fr/~besse/Wikistat/Images/logo-insa.jpg" style="float:left; max-width: 120px; display: inline" alt="INSA"/></a> <a href="http://wikistat.fr/" ><img src="http://www.math.univ-toulo...
ameliecordier/iutdoua-info_algo2015
2015-09-14 - TD2 - Variables et conditions.ipynb
cc0-1.0
age = 33 """ Explanation: Le concept de variable Une variable est une "boîte" dans laquelle il est possible de stocker une valeur (et de la changer au fil du temps). Les variables peuvent être de plusieurs types, mais c'est une autre histoire, que l'on verra plus tard. On peut faire plusieurs opérations sur les vari...
probml/pyprobml
notebooks/book2/18/bnn_mnist_sgld.ipynb
mit
%%capture !pip install -qq git+https://github.com/jamesvuc/jax-bayes !pip install -qq SGMCMCJax !pip install -qq distrax import jax.numpy as jnp from jax.experimental import optimizers import jax try: import jax_bayes except ModuleNotFoundError: %pip install -qq jax_bayes import jax_bayes try: impor...
BrainIntensive/OnlineBrainIntensive
resources/nipype/nipype_tutorial/notebooks/basic_mapnodes.ipynb
mit
from nipype import Function def square_func(x): return x ** 2 square = Function(["x"], ["f_x"], square_func) """ Explanation: <img src="../static/images/mapnode.png" width="300"> MapNode If you want to iterate over a list of inputs, but need to feed all iterated outputs afterwards as one input (an array) to the n...
datactive/bigbang
examples/attendance/IETF Attendance.ipynb
mit
from ietfdata.datatracker import * from ietfdata.datatracker_ext import * import pandas as pd import matplotlib.pyplot as plt import dataclasses datatracker = DataTracker() meetings = datatracker.meetings(meeting_type = datatracker.meeting_type(MeetingTypeURI('/api/v1/name/meetingtypename/ietf/'))) full_ietf_meet...
kirichoi/tellurium
examples/notebooks/models/yeast_glycolysis.ipynb
apache-2.0
%matplotlib inline from __future__ import print_function import tellurium as te # load the model r = te.loadSBMLModel('yeast_glycolysis.xml') # promote all the local parameters to global parameters sbml_str = r.getSBML() sbmlp_str = r.getParamPromotedSBML(sbml_str) r = te.loads(sbmlp_str) print(r.getGlobalParameterId...
karlstroetmann/Algorithms
Python/Chapter-05/Three-Way-Merge-Sort-Array.ipynb
gpl-2.0
def sort(L): A = L[:] mergeSort(L, 0, len(L), A) """ Explanation: 3-Way Merge Sort: An Array-Based Implementation The function $\texttt{sort}(L)$ sorts the list $L$ in place using merge sort. It takes advantage of the fact that, in Python, lists are stored internally as arrays. The function sort is a wrapper f...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_visualize_epochs.ipynb
bsd-3-clause
import os.path as op import mne data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample') raw = mne.io.read_raw_fif( op.join(data_path, 'sample_audvis_raw.fif'), preload=True) raw.load_data().filter(None, 9, fir_design='firwin') raw.set_eeg_reference('average', projection=True) # set EEG average refe...
quantopian/research_public
notebooks/lectures/VaR_and_CVaR/notebook.ipynb
apache-2.0
import numpy as np import pandas as pd from scipy.stats import norm import time import matplotlib.pyplot as plt """ Explanation: Portfolio Value at Risk and Conditional Value at Risk By Jonathan Larkin and Delaney Granizo-Mackenzie. Part of the Quantopian Lecture Series: www.quantopian.com/lectures github.com/quant...
Xilinx/BNN-PYNQ
notebooks/LFC-BNN_Chars_Webcam.ipynb
bsd-3-clause
import bnn """ Explanation: BNN on Pynq This notebook covers how to use Binary Neural Networks on Pynq. It shows an example of handwritten character recognition using a binarized neural network composed of 4 fully connected layers with 1024 neurons each, trained on the NIST database of handwritten characters. In ord...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_05/Begin/Panels.ipynb
bsd-3-clause
import pandas as pd import numpy as np import datetime from pandas_datareader import data, wb pd.set_eng_float_format(accuracy=2, use_eng_prefix=True) my_first_panel = pd.Panel(np.random.randn(2, 5, 4), items=['Item01', 'Item02'], major_axis=pd.date_range('9/6/2016...
hvillanua/deep-learning
image-classification/dlnd_image_classification.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' class DLProgress(tqdm): last_block = 0 def hoo...
JJINDAHOUSE/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
bloomberg/bqplot
examples/Interactions/Selectors.ipynb
apache-2.0
import pandas as pd import numpy as np symbol = "Security 1" symbol2 = "Security 2" price_data = pd.DataFrame( np.cumsum(np.random.randn(150, 2).dot([[0.5, 0.4], [0.4, 1.0]]), axis=0) + 100, columns=[symbol, symbol2], index=pd.date_range(start="01-01-2007", periods=150), ) dates_actual = price_data.index...
tiagoantao/biopython-notebook
notebooks/16 - Supervised learning methods.ipynb
mit
from Bio import LogisticRegression xs = [[-53, -200.78], [117, -267.14], [57, -163.47], [16, -190.30], [11, -220.94], [85, -193.94], [16, -182.71], [15, -180.41], [-26, -181.73], [58, -259.87], [126, -414.53], [191, -249.57], [113, -265.28], [145, -312.99], [154, -213.83], [147, -380.85],[93, -291.13]...
whitead/numerical_stats
unit_3/lectures/lecture_2.ipynb
gpl-3.0
from IPython.display import Math from math import frexp, pi import math #Convert a float into its mantissa and exponent and print as LaTeX def fprint(x): m,e = frexp(x) return Math('{:4} \\times 2^{{{:}}}'.format(m, int(e))) #Convert a mantissa from decimal to binary and print as LaTeX def ffrac_ltx(x, te...
metpy/MetPy
dev/_downloads/7fd39302ff9f3fa4a7870d3c31b04722/cross_section.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import numpy as np import xarray as xr import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.interpolate import cross_section """ Explanation: Cross Section Analysis The MetPy function metpy.interpolat...
manipopopo/tensorflow
tensorflow/contrib/eager/python/examples/notebooks/eager_basics.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...
daniel-acuna/python_data_science_intro
notebooks/lab-random_forest_for_predicting_credit_score.ipynb
mit
import pandas as pd import numpy as np X = np.array([ [0, 0], [0, 1], [1, 0], [1, 1]]) y = np.array([0, 1, 1, 0]) pd.DataFrame(np.hstack((X, y.reshape(-1, 1))), columns=['x1', 'x2', 'y']) %matplotlib inline import matplotlib.pyplot as plt plt.scatter(X[y==0, 0], X[y==0, 1], c='red')...
dlegor/Tutorial-Pandas-Python
Code/Capitulo_2-Exploración.ipynb
cc0-1.0
#Se prepara el entorno de trabajo %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd #matplotlib.style.use('ggplot') se puede correr este código para usar gráficos del tipo de ggplot2 en R plt.rcParams['figure.figsize']=(20,7) # -*- coding:...