repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sys-bio/tellurium
examples/notebooks/core/tellurium_examples.ipynb
apache-2.0
import warnings warnings.filterwarnings("ignore") import tellurium as te te.setDefaultPlottingEngine('matplotlib') %matplotlib inline # model Definition r = te.loada (''' #J1: S1 -> S2; Activator*kcat1*S1/(Km1+S1); J1: S1 -> S2; SE2*kcat1*S1/(Km1+S1); J2: S2 -> S1; Vm2*S2/(Km2+S2); ...
liyigerry/msm_test
examples/hmm-and-msm.ipynb
apache-2.0
from __future__ import print_function import os %matplotlib inline from matplotlib.pyplot import * from msmbuilder.featurizer import SuperposeFeaturizer from msmbuilder.example_datasets import AlanineDipeptide from msmbuilder.hmm import GaussianHMM from msmbuilder.cluster import KCenters from msmbuilder.msm import Mark...
csdms/bmi-live-2017
nb/visualize.ipynb
mit
%matplotlib auto import matplotlib.pyplot as plt from ipywidgets import interact from bmi_live.bmi_diffusion import BmiDiffusion """ Explanation: <img src="img/csdms_logo.jpg"> Visualization with ipywidgets Let's visualize the evolution of the 2D temperature field as heat diffuses across the plate. We can do this inte...
muatik/my-coding-challenges
python/challenge-reverse-words.ipynb
mit
def reverse_words(string): if not string: return string newString = [] for word in string.split(): newWord = [] for char in word: newWord.insert(0, char) newString.insert(0, "".join(newWord)) return " ".join(newString) """ Explanation: Constraints Can I assu...
geektoni/shogun
doc/ipython-notebooks/ica/ecg_sep.ipynb
bsd-3-clause
# change to the shogun-data directory import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') os.chdir(os.path.join(SHOGUN_DATA_DIR, 'ica')) import numpy as np # load data # Data originally from: # http://perso.telecom-paristech.fr/~cardoso/icacentral/base_single.html data = np.loadtxt('foetal_ecg.dat...
computational-class/cjc2016
code/08.01-statistics_thinking.ipynb
mit
from collections import Counter #from linear_algebra import sum_of_squares, dot import math import numpy as np import matplotlib.pyplot as plt """ Explanation: Introduction to Statistical Thinking <img align="left" style="padding-right:10px;" width ="200px" src="./img/stats/preface2.png"> Table of Contents Introduc...
zzsza/TIL
python/dask.ipynb
mit
import dask import pandas as pd df = pd.read_csv('./user_log_2018_01_01.csv') df import dask.dataframe as dd dask_df = dd.read_csv('./user_log_2018_01_01.csv') dask_df dir(dask_df) dask_df["0"] dask_df.index len(dask_df.index) dask_df.info """ Explanation: Dask Dask 공식 문서 numpy, pandas, sklearn이랑 통합 가능 Da...
Ivanhehe/Sharings
affectiveComputing/ComparisonAnalysis.ipynb
mit
# all the function we need to parse the data def extract_split_data(data): content = re.findall("\[(.*?)\]", data) timestamps = [] values = [] for c in content[0].split(","): c = (c.strip()[1:-1]) if len(c)>21: x, y = c.split("#") values.append(int(x)) ...
paulmorio/grusData
basics/NaiveBayes.ipynb
mit
from sklearn.datasets import make_blobs X, y = make_blobs(100, 2, centers=2, random_state=2, cluster_std=1.5) plt.scatter(X[:, 0], X[:, 1], c=y, s=50, cmap='RdBu'); """ Explanation: Gaussian Naive Bayes We are going to start off with the simplest Naive Bayes model, using Gaussian fits to generate likelihoods, but befo...
wllmtrng/wllmtrng.github.io-src
content/2017-10-22-supervised-learning-part-1.ipynb
gpl-3.0
import pandas as pd import matplotlib matplotlib.style.use('ggplot') %matplotlib inline training_data = { 'x': [0, 1, 2, 3], 'y': [4, 7, 7, 8] } train_df = pd.DataFrame.from_dict(training_data) train_df """ Explanation: Supervised Learning, Part 1: Regression What is Supervised Learning? Supervised learning...
desihub/desispec
doc/nb/Cosmics.ipynb
bsd-3-clause
from astropy.io import fits import numpy as np import matplotlib.pyplot as plt from skimage import measure from astropy.visualization import astropy_mpl_style plt.style.use(astropy_mpl_style) """ Explanation: Cosmic Ray Track Finder This is a primitive track finder in CCD images. It thresholds the image to find "blo...
Diyago/Machine-Learning-scripts
time series regression/DL aproach for timeseries/Air_Pressure 1D_Conv.ipynb
apache-2.0
from __future__ import print_function import os import sys import pandas as pd import numpy as np %matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import datetime #set current working directory os.chdir('D:/Practical Time Series') #Read the dataset into a pandas.DataFrame df = pd.read_csv...
sequana/resources
coverage/03-fungus/fungus.ipynb
bsd-3-clause
%pylab inline matplotlib.rcParams['figure.figsize'] = [10,7] """ Explanation: sequana_coverage test case example (fungus) This notebook creates the BED file S_pombe.filtered.bed provided in - https://github.com/sequana/resources/tree/master/coverage and - https://www.synapse.org/#!Synapse:syn10638358/wiki/465309 geno...
tensorflow/federated
docs/tutorials/private_heavy_hitters.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...
rileyrustad/pdxapartmentfinder
analysis/Third_Analysis.ipynb
mit
# start with imports import numpy as np import pandas as pd from pandas import DataFrame, Series import json import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: This is my third attempt at creating a model using sklearn alogithms In this iteration of analy...
sdpython/code_beatrix
_doc/notebooks/algorithmes/postier_chinois.ipynb
mit
import matplotlib.pyplot as plt plt.style.use('ggplot') %matplotlib inline from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: Postier chinois Postier chinois, chemin eulérien, deux noms pour le même problème, illustrés sur les rues de Seattle. End of explanation """ vertices = [(-122.3...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/copula.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy import stats sns.set_style("darkgrid") sns.mpl.rc("figure", figsize=(8, 8)) %%javascript IPython.OutputArea.prototype._should_scroll = function(lines) { return false; } """ Explanation: Copula - Multivariate joint distribution En...
deepmind/dm_control
dm_control/mujoco/tutorial.ipynb
apache-2.0
#@title Run to install MuJoCo and `dm_control` import distutils.util import subprocess if subprocess.run('nvidia-smi').returncode: raise RuntimeError( 'Cannot communicate with GPU. ' 'Make sure you are using a GPU Colab runtime. ' 'Go to the Runtime menu and select Choose runtime type.') print('Ins...
widdowquinn/Teaching-SfAM-ECS
workshop/03a-building.ipynb
mit
# The line below allows the notebooks to show graphics inline %pylab inline import io # This lets us handle streaming data import os # This lets us communicate with the operating system import pandas as pd # This lets us use dataframes import seab...
sthuggins/phys202-2015-work
assignments/assignment06/InteractEx05.ipynb
mit
from IPython.display import display, SVG import numpy as np %matplotlib inline from matplotlib import pyplot as plt from IPython.html.widgets import interact, interactive, fixed """ Explanation: Interact Exercise 5 Imports Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell. En...
jonathanmorgan/msu_phd_work
methods/precision_recall/prelim_month_human-confusion_matrix.ipynb
lgpl-3.0
# set the label we'll be looking at throughout current_label = "prelim_month_human" """ Explanation: prelim_month_human - confusion matrix old file name: 2017.10.21 - work log - prelim_month_human - confusion matrix Confusion matrix for data where coder 1 is ground truth, coder 2 is uncorrected human coding. <h1>Table...
sympy/scipy-2017-codegen-tutorial
notebooks/_37-chemical-kinetics-numba.ipynb
bsd-3-clause
import json import numpy as np import sympy as sym from scipy2017codegen.odesys import ODEsys from scipy2017codegen.chem import mk_rsys """ Explanation: NOTE This notebook doesn't work yet. I have previously written my own version of lambdify here. Don't know if that's the path to go, or wait for next release of numba...
dnc1994/MachineLearning-UW
ml-regression/polynomial-regression.ipynb
mit
import graphlab """ Explanation: Regression Week 3: Assessing Fit (polynomial regression) In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will: * Write a function to take a...
albahnsen/ML_RiskManagement
notebooks/05-data_preparation_evaluation.ipynb
mit
import pandas as pd import zipfile with zipfile.ZipFile('../datasets/titanic.csv.zip', 'r') as z: f = z.open('titanic.csv') titanic = pd.read_csv(f, sep=',', index_col=0) titanic.head() # check for missing values titanic.isnull().sum() """ Explanation: 05 - Data Preparation and Advanced Model Evaluation by Al...
vinitsamel/udacitydeeplearning
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...
ThyrixYang/LearningNotes
MOOC/stanford_cnn_cs231n/assignment2/Dropout.ipynb
gpl-3.0
# As usual, a bit of setup from __future__ import print_function import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solv...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/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', 'miroc', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: MIROC Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Transport, Emissions, Con...
nikbearbrown/Deep_Learning
NEU/Singh_Palod_DL/Generative Adversarial Networks/GANS Mode Collapse.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import os """ Explanation: Generative Adversarial Networks for Natural Language Processing End of explanation """ def xavier_init(n_inputs, n_ou...
deeplycloudy/MetPy
talks/2015 Unidata Users Workshop.ipynb
bsd-3-clause
# Level 3 example with multiple products import numpy as np import matplotlib.pyplot as plt from numpy import ma from metpy.cbook import get_test_data from metpy.io.nexrad import Level3File from metpy.plots import ctables # Helper code for making sense of these products. This is hidden from the slideshow # and eventu...
unpingco/Python-for-Probability-Statistics-and-Machine-Learning
chapters/statistics/notebooks/Convergence.ipynb
mit
from __future__ import division import numpy as np np.random.seed(123456) """ Explanation: Python for Probability, Statistics, and Machine Learning End of explanation """ from scipy import stats u=stats.uniform() xn = lambda i: u.rvs(i).max() xn(5) """ Explanation: The absence of the probability density for the raw...
prasants/pyds
07.Loop_it_up.ipynb
mit
collection = [1,2,3,4,5] len(collection) if len(collection) == 5: print("Woohoo!") collection[1] if collection[0] % 2 == 0: print("Divisible") else: print("Not Divisible") """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Control-Flow" data-toc-modified-id="Control-Flow-1"><spa...
msampathkumar/data_science_sessions
Session-2-Hands-Experience-for-ML/DataScience_Presentation2-LR2.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model %matplotlib inline """ Explanation: Linear Regression - Part 2 In this tutorial we shall see, where linear regression limitations. Imports End of explanation """ n_samples = 30 true_fun = lambda X: np.cos(1.5 * np.pi * X) X = np.so...
omoju/Fundamentals
Data/data_time_Series_1.ipynb
gpl-3.0
%pylab inline # Import libraries from __future__ import absolute_import, division, print_function # Ignore warnings import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd import math # Graphing Libraries import matplotlib.pyplot as pyplt from matplotlib.pylab import rcParams rcPar...
bspalding/research_public
presentations/How To - Estimate Pi.ipynb
apache-2.0
# Import libraries import math import numpy as np import matplotlib.pyplot as plt in_circle = 0 outside_circle = 0 n = 10 ** 4 # Draw many random points X = np.random.rand(n) Y = np.random.rand(n) for i in range(n): if X[i]**2 + Y[i]**2 > 1: outside_circle += 1 else: in_circle += 1 are...
empet/Plotly-plots
Moebius-Normals.ipynb
gpl-3.0
import numpy as np import plotly.graph_objects as go """ Explanation: Normals along the central circle of the Moebius strip The aim of this notebook is twofold: - first, to show how we can define a standard 3d arrow and place it at different positions in space; - second, to illustrate the non-orientability of this...
maojrs/riemann_book
Euler.ipynb
bsd-3-clause
%matplotlib inline %config InlineBackend.figure_format = 'svg' from exact_solvers import euler from exact_solvers import euler_demos from ipywidgets import widgets from ipywidgets import interact State = euler.Primitive_State gamma = 1.4 """ Explanation: The Euler equations of gas dynamics In this notebook, we discus...
tensorflow/docs-l10n
site/ko/tutorials/keras/text_classification.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...
ES-DOC/esdoc-jupyterhub
notebooks/snu/cmip6/models/sandbox-2/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'snu', 'sandbox-2', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: SNU Source ID: SANDBOX-2 Topic: Ocean Sub-Topics: Timestepping Framework, Advection, ...
tommyogden/maxwellbloch
docs/examples/mbs-two-sech-4pi.ipynb
mit
import numpy as np SECH_FWHM_CONV = 1./2.6339157938 t_width = 1.0*SECH_FWHM_CONV # [τ] print('t_width', t_width) mb_solve_json = """ { "atom": { "fields": [ { "coupled_levels": [[0, 1]], "rabi_freq_t_args": { "n_pi": 4.0, "centre": 0.0, "width": %f }, ...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/02_02/Begin/.ipynb_checkpoints/Selection-checkpoint.ipynb
bsd-3-clause
import pandas as pd import numpy as np sample_numpy_data = np.array(np.arange(24)).reshape((6,4)) dates_index = pd.date_range('20160101', periods=6) sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD')) sample_df """ Explanation: Differences between interactive and production work Note:...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner_fast_learner_3_actions-checkpoint.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
mjbommar/cscs-530-w2015
code/002-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() # Import widget methods from IPython.html.widgets import * """ Explanation: CSCS530 Winter 2015 Complex Systems 530 - Computer Modeling of Complex Systems (Winter 2015) Course...
eds-uga/csci1360e-su17
lectures/L13.ipynb
mit
import numpy as np np.random.seed(29384924) data = np.random.randint(10, size = 100) # 100 random numbers, from 0 to 9 print(data) """ Explanation: Lecture 13: Statistics CSCI 1360E: Foundations for Informatics and Analytics Overview and Objectives Continuing this week's departure from Python, today we'll jump into ...
trangel/Data-Science
reinforcement_learning/practice_vi.ipynb
gpl-3.0
# If you Colab, uncomment this please # !wget -q https://raw.githubusercontent.com/yandexdataschool/Practical_RL/master/week02_value_based/mdp.py transition_probs = { 's0': { 'a0': {'s0': 0.5, 's2': 0.5}, 'a1': {'s2': 1} }, 's1': { 'a0': {'s0': 0.7, 's1': 0.1, 's2': 0.2}, 'a...
balavenkatesan/yellowbrick
examples/ndanielsen/Yellowbrick in the Flower Garden.ipynb
apache-2.0
# read the iris data into a DataFrame import pandas as pd url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data' col_names = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species'] iris = pd.read_csv(url, header=None, names=col_names) iris.head() """ Explanation: Using Yello...
geilerloui/deep-learning
first-neural-network/Your_first_neural_network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
ES-DOC/esdoc-jupyterhub
notebooks/nerc/cmip6/models/hadgem3-gc31-hm/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nerc', 'hadgem3-gc31-hm', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: NERC Source ID: HADGEM3-GC31-HM Topic: Ocean Sub-Topics: Timestepping Framewor...
ES-DOC/esdoc-jupyterhub
notebooks/csiro-bom/cmip6/models/access-1-0/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csiro-bom', 'access-1-0', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CSIRO-BOM Source ID: ACCESS-1-0 Topic: Land Sub-Topics: Soil, Snow, Vegetation, ...
konstantinstadler/pymrio
doc/source/notebooks/buildflowmatrix.ipynb
gpl-3.0
import pymrio io = pymrio.load_test() """ Explanation: Analysing the source of stressors (flow matrix) To calculate the source (in terms of regions and sectors) of a certain stressor or impact driven by consumption, one needs to diagonalize this stressor/impact. This section shows how to do this based on the small te...
kit-cel/lecture-examples
mloc/ch1_Preliminaries/gradient_descent.ipynb
gpl-2.0
import importlib autograd_available = True # if automatic differentiation is available, use it try: import autograd except ImportError: autograd_available = False pass if autograd_available: import autograd.numpy as np from autograd import elementwise_grad as egrad else: import numpy as np ...
carlosmartinezvillar/4001finalproject
descriptive_statistics.ipynb
mit
import MySQLdb as mdb import sys import time import csv import numpy as np import pandas as pd %matplotlib inline con = mdb.connect('128.206.116.195', 'tg4_ro', '?3stEt7!3hUbRa-R', 'tw4_db') if not(con): con = mdb.connect('opendata.missouri.edu','datascience','datascience','datascience') if not(con): print('Co...
tamasjozsa/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...
AstroHackWeek/AstroHackWeek2017
day3/start_here-code_repos.ipynb
mit
! #complete ! #complete """ Explanation: Code Repositories Astro Hack Week 2017 The notebook contains problems oriented around building a basic Python code repository and making it public via Github. Of course there are other places to put code repositories, with complexity ranging from services comparable to github ...
paris-saclay-cds/python-workshop
Day_2_Software_engineering_best_practices/04_reusing_code_modules.ipynb
bsd-3-clause
%%file test.py message = "Hello how are you?" for word in message.split(): print(word) """ Explanation: Reusing code: modules and packages This notebook is largely based on material of the Python Scientific Lecture Notes (https://scipy-lectures.github.io/), adapted with some exercises. Introduction For now, we ...
ispmarin/text_norm
src/Search Engine.ipynb
mit
from retrieve.search import * """ Explanation: Search using Whoosh We will use Whoosh, a search engine with Python, to retrieve a few candidates. The search engine is already doing some parsing, but with a more complex problem we can use it for a few fields. End of explanation """ doc1 = { 'street': 'XV de novem...
molgor/spystats
notebooks/Sandboxes/TensorFlow/Getting Started with Tensor Flow.ipynb
bsd-2-clause
## importation import tensorflow as tf """ Explanation: Getting Started with Tensor Flow Here I´m taking the tutorials from: https://www.tensorflow.org/get_started/get_started End of explanation """ node1 = tf.constant(3.0, dtype=tf.float32) node2 = tf.constant(4.0) # also tf.float32 implicitly print(node1, node2) ...
bearing/dosenet-analysis
calibration/Thorium Otherdetector.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit csv = np.genfromtxt('Thorium_102566_2019-03-28_D3S.csv', delimiter= ",").T summed = np.sum(csv, axis=1) plt.plot(summed) plt.yscale('log') plt.show() """ Explanation: First I import the thorium data from det 2 End of explanation ""...
MarsUniversity/ece387
website/block_3_vision/lsn19/lsn19.ipynb
mit
%matplotlib inline from __future__ import print_function from __future__ import division import numpy as np from matplotlib import pyplot as plt import cv2 import time # make sure you have installed the library with: # pip install -U ar_markers from ar_markers import detect_markers """ Explanation: Augmented Real...
RogueAstro/RV_PS2017
notebooks/the_basics.ipynb
mit
from radial import body import astropy.units as u import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: The basics of radial velocities We can almost completely characterize the orbits of massive bodies around a star using a set of five orbital parameters for each body. Different param...
probml/pyprobml
notebooks/misc/dropout_MLP_torch.ipynb
mit
import numpy as np import matplotlib.pyplot as plt np.random.seed(seed=1) import math import torch from torch import nn from torch.nn import functional as F !mkdir figures # for saving plots !wget https://raw.githubusercontent.com/d2l-ai/d2l-en/master/d2l/torch.py -q -O d2l.py import d2l """ Explanation: <a href="...
kkkddder/dmc
notebooks/week-3/01-basic ann.ipynb
apache-2.0
%matplotlib inline import random import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set(style="ticks", color_codes=True) from sklearn.preprocessing import OneHotEncoder from sklearn.utils import shuffle """ Explanation: Lab 3 - Basic Artificial Neural Network In this lab we will build a very...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch2-Problem_2-03.ipynb
unlicense
%pylab notebook %precision 4 """ Explanation: Excercises Electric Machinery Fundamentals Chapter 2 Problem 2-3 End of explanation """ VS = 480.0 * exp(0j) # [Ohm] using polar syntax Zline = 3.0 + 4.0j # [Ohm] using cartesian syntax Zload = 30.0 + 40.0j # [Ohm] using cartesian syntax """ Explanation: Descriptio...
dh7/ML-Tutorial-Notebooks
tf-linear-regression.ipynb
bsd-2-clause
%matplotlib notebook import matplotlib import matplotlib.pyplot as plt ''' A linear regression learning algorithm example using TensorFlow library. Author: Aymeric Damien Project: https://github.com/aymericdamien/TensorFlow-Examples/ ''' import tensorflow as tf import numpy as np """ Explanation: Linear regression w...
jcharit1/Amazon-Fine-Foods-Reviews
code/model_building_part_3.ipynb
mit
import os import pandas as pd import numpy as np import scipy as sp import seaborn as sns import matplotlib.pyplot as plt import json from IPython.display import Image from IPython.core.display import HTML retval=os.chdir("..") clean_data=pd.read_pickle('./clean_data/clean_data.pkl') clean_data.head() kept_cols=['h...
ZhiangChen/deep_learning
Tutorials/Udacity/1_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.line...
Neuroglycerin/neukrill-net-work
notebooks/superclass_hierarchy/Using superclass predictions.ipynb
mit
with open("predictions.pkl", "rb") as f: predictions = pickle.load(f) """ Explanation: Model with col_norms set to a higher value and augmentations turned on. We saved its pickle with predictions across all superclass vectors. End of explanation """ superclasses = predictions[:,121:(121+38)] s = np.sum(superclas...
xiongzhenggang/xiongzhenggang.github.io
data-science/28-密度和轮廓图.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('seaborn-white') import numpy as np """ Explanation: 密度和轮廓图 有时,使用轮廓或颜色编码区域在二维中显示三维数据很有用。有三个Matplotlib函数可以帮助完成此任务:用于轮廓图的plt.contour,用于填充轮廓图的plt.contourf和用于显示图像的plt.imshow。本节介绍了使用它们的几个示例。我们将从设置笔记本开始,以绘制和导入将要使用的功能: End of explanation """ def f(x, y): ...
hktxt/MachineLearning
PyTorch Tutorials/detach.ipynb
gpl-3.0
# a is a tensor with require grad a = torch.tensor(2., requires_grad=True);a b = a.detach();b # with deatch() no grad. """ Explanation: deatch(): https://discuss.pytorch.org/t/clone-and-detach-in-v0-4-0/16861 tensor.detach() creates a tensor that shares storage with tensor that does not require grad. End of explana...
statsmodels/statsmodels.github.io
v0.12.1/examples/notebooks/generated/statespace_concentrated_scale.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data dta.index = pd.date_range(start='1959Q1', end='2009Q4', freq='Q') """ Explanation: State space models - concentrating the scale out of the likelihood function End of explanation """ class LocalLevel(sm...
JDTimlin/QSO_Clustering
highz_clustering/classification/.ipynb_checkpoints/SpIESHighzQuasarPhotoz2-checkpoint.ipynb
mit
## Read in the Training Data and Instantiating the Photo-z Algorithm %matplotlib inline from astropy.table import Table import numpy as np import matplotlib.pyplot as plt #data = Table.read('GTR-ADM-QSO-ir-testhighz_findbw_lup_2016_starclean.fits') #JT PATH ON TRITON to training set after classification #data = Table....
elektrobohemian/courses
.ipynb_checkpoints/InformationRetrieval-checkpoint.ipynb
mit
# This cell has to be run to prepare the Jupyter notebook # The %... is an Jupyter thing, and is not part of the Python language. # In this case we're just telling the plotting library to draw things on # the notebook, instead of on a separate window. %matplotlib inline # See all the "as ..." contructs? They're just a...
ProfessorKazarinoff/staticsite
content/code/error_bars/bar_chart_with_matplotlib.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np #if using a jupyter notebook %matplotlib inline """ Explanation: Building bar charts is a useful skill for engineers. Import matplotlib and numpy End of explanation """ # Enter in the raw data aluminum = np.array([6.4e-5 , 3.01e-5 , 2.36e-5, 3.0e-5, 7....
wtbarnes/aia_response
notebooks/response_function_tests.ipynb
mit
import os import sys import pickle import numpy as np import scipy import matplotlib.pyplot as plt import ChiantiPy.core as ch import sunpy.instr.aia as aia %matplotlib inline """ Explanation: AIA Response Function Tests End of explanation """ response = aia.Response(path_to_genx_dir='../ssw_aia_response_data/') ...
wcmckee/wcmckee.com
posts/niktrans.ipynb
mit
import os import json os.system('python3 nikoladu.py') os.chdir('/home/wcmckee/nik1/') os.system('nikola build') os.system('rsync -azP /home/wcmckee/nik1/* wcmckee@wcmckee.com:/home/wcmckee/github/wcmckee.com/output/minedujobs') opccschho = open('/home/wcmckee/ccschool/cctru.json', 'r') opcz = opccschho.read() rssc...
walchko/soccer2
docs/ipython/Gait_Code_Check.ipynb
mit
%matplotlib inline from __future__ import print_function from __future__ import division import matplotlib.pyplot as plt import numpy as np import sys sys.path.insert(0, '../..') from math import pi, sqrt from Quadruped import Quadruped from Gait import DiscreteRippleGait, ContinousRippleGait """ Explanation: Full Ga...
the-deep-learners/TensorFlow-LiveLessons
notebooks/point_by_point_intro_to_tensorflow.ipynb
mit
import numpy as np np.random.seed(42) import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import tensorflow as tf tf.set_random_seed(42) """ Explanation: Introduction to TensorFlow, fitting point by point In this notebook, we introduce TensorFlow by fitting a line of the form y=m*x+b point by point....
tiagoantao/bioinf-python
notebooks/01_NGS/Working_with_FASTQ.ipynb
apache-2.0
!rm -f SRR003265.filt.fastq.gz 2>/dev/null !wget -nd ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/NA18489/sequence_read/SRR003265.filt.fastq.gz """ Explanation: Getting the necessary data You just need to download this ~28 MB file only once End of explanation """ from collections import defaultdict import gz...
enakai00/jupyter_tfbook
Chapter03/MNIST single layer network.ipynb
gpl-3.0
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data np.random.seed(20160612) tf.set_random_seed(20160612) """ Explanation: [MSL-01] 必要なモジュールをインポートして、乱数のシードを設定します。 End of explanation """ mnist = input_data.read_data_sets("/tmp/data/", ...
chipfranzen/dillinger
demos/regression_demo.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from dillinger.gaussian_process import GaussianProcess from dillinger.kernel_functions import PeriodicKernel %matplotlib inline sns.set(font_scale=1.3, palette='deep', color_codes=True) np.random.seed(0) # setting up the objective function def o...
sot/aca_stats
fit_acq_prob_model-2018-04-poly-spline-tccd.ipynb
bsd-3-clause
from __future__ import division import numpy as np import matplotlib.pyplot as plt from astropy.table import Table from astropy.time import Time import tables from scipy import stats import tables3_api from scipy.interpolate import CubicSpline from Chandra.Time import DateTime %matplotlib inline """ Explanation: Fit...
ChadFulton/statsmodels
examples/notebooks/discrete_choice_overview.ipynb
bsd-3-clause
from __future__ import print_function import numpy as np import statsmodels.api as sm """ Explanation: Discrete Choice Models Overview End of explanation """ spector_data = sm.datasets.spector.load() spector_data.exog = sm.add_constant(spector_data.exog, prepend=False) """ Explanation: Data Load data from Spector a...
mromanello/SunoikisisDC_NER
participants_notebooks/Sunoikisis - Named Entity Extraction 1b_PG.ipynb
gpl-3.0
######## # NLTK # ######## import nltk from nltk.tag import StanfordNERTagger ######## # CLTK # ######## import cltk from cltk.tag.ner import tag_ner ############## # MyCapytain # ############## import MyCapytain from MyCapytain.resolvers.cts.api import HttpCTSResolver from MyCapytain.retrievers.cts5 import CTS from M...
ergosimulation/mpslib
scikit-mps/examples/ex_mpslib_entropy.ipynb
lgpl-3.0
import numpy as np import matplotlib.pyplot as plt import mpslib as mps """ Explanation: MPSlib: computation of entropy and self-information The self-information, and entropy (the average self-information), acan be commputed using MPSlib by setting do_entropy=1 This works for all algorithms excpet when using mps_gen...
cagaray/edubot
doc2vec/doc2vec.ipynb
apache-2.0
#We'll need an object with questions and label like SENT_#number_of_question. class LabeledLineSentence(object): def __init__(self, filename): self.filename = filename def __iter__(self): for uid, line in enumerate(open(utils.data_path + 'doc2vec/' + self.filename, 'r')): yield Label...
snucsne/CSNE-Course-Source-Code
CSNE2444-Intro-to-CS-I/jupyter-notebooks/ch07-iteration.ipynb
mit
a = 5 b = a # a and b are now equal a = 3 # a and b are no longer equal """ Explanation: Chapter 7: Iteration Contents - Multiple assignment - Updating variables - The while statement - Break statement - Exercises This notebook is based on "Think Python, 2Ed" by Allen B. Downey <br> https://greenteapress.com/w...
tclaudioe/Scientific-Computing
SC1v2/Bonus - 07-08 Weighted Least Squares.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import scipy.linalg as spla %matplotlib inline # https://scikit-learn.org/stable/modules/classes.html#module-sklearn.datasets from sklearn import datasets import ipywidgets as widgets from ipywidgets import interact, interact_manual import matplotlib as mpl mpl.rcParam...
drericstrong/Blog
20170702_ParsevalsTheoremInPython.ipynb
agpl-3.0
import numpy as np import pandas as pd from scipy.fftpack import fft import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') %matplotlib inline def calculate_fft(wf, T, N): # xf is the frequency ("x") axis of the half-width fft, # yf is the raw fft, yfs is the scaled fft, and yfsh is...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/sandbox-2/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-2', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: NCC Source ID: SANDBOX-2 Topic: Aerosol Sub-Topics: Transport, Emissions, Concent...
patrickmineault/xcorr-snippets
decision-making/Multi-armed bandit as a Markov decision process.ipynb
mit
import itertools import numpy as np from pprint import pprint def sorted_values(dict_): return [dict_[x] for x in sorted(dict_)] def solve_bmab_value_iteration(N_arms, M_trials, gamma=1, max_iter=10, conv_crit = .01): util = {} # Initialize every state to utility 0. ...
dm-wyncode/zipped-code
content/posts/python-mongodb/set_creation_speed_test.ipynb
mit
import logging import timeit """ Explanation: Introduction I obtained this Fort Lauderdale Police Department data from the City of Fort Lauderdale via the Fort Lauderdale Civic Hackathon. See my blog post about my participation in the hackathon. This is my first Pelican blog post using a Jupyter notebook made possible...
jupyter/docker-demo-images
notebooks/Welcome to Spark with Python.ipynb
bsd-3-clause
import pyspark from pyspark.mllib.regression import LabeledPoint from pyspark.mllib.classification import LogisticRegressionWithSGD from pyspark.mllib.tree import DecisionTree """ Explanation: Welcome to Apache Spark with Python Apache Spark is a fast and general-purpose cluster computing system. It provides high-l...
JAmarel/Phys202
Interact/InteractEx04.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 4 Imports End of explanation """ def random_line(m, b, sigma, size=10): """Create a line y = m*x + b + N(0,si...
ilanman/gdi
week2/02_Week2_I_functions_sol.ipynb
mit
def square(x): """Square of x.""" return x*x def cube(x): """Cube of x.""" return x*x*x def root(x): """Square root of x.""" return x**.5 # create a dictionary of functions funcs = { 'square': square, 'cube': cube, 'root': root, } x = 2 print square(x) print cube(x) print root(x...
relf/smt
tutorial/SMT_ExpandedLHS.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from smt.sampling_methods import LHS import matplotlib.patches as patches xlimits = np.array([[0.0, 4.0], [0.0, 3.0], [0.0, 3.0], [1.0, 5.0]]) sampling = LHS(xlimits=xlimits, criterion='ese', random_state=1) num = 10 x = sampling(num) ### For visualization only in...
mdda/fossasia-2016_deep-learning
notebooks/2-CNN/4-ImageNet/0-modelzoo-tf-keras.ipynb
mit
import keras #import tensorflow.contrib.keras as keras import numpy as np if False: import os, sys targz = "v0.5.tar.gz" url = "https://github.com/fchollet/deep-learning-models/archive/"+targz models_orig_dir = 'deep-learning-models-0.5' models_here_dir = 'keras_deep_learning_models' models_di...
sainathadapa/fastai-courses
deeplearning1/nbs-custom-mine/lesson5_01_wordvectors.ipynb
apache-2.0
def get_glove(name): with open(path+ 'glove.' + name + '.txt', 'r') as f: lines = [line.split() for line in f] words = [d[0] for d in lines] vecs = np.stack(np.array(d[1:], dtype=np.float32) for d in lines) wordidx = {o:i for i,o in enumerate(words)} save_array(res_path+name+'.dat', vecs) pickle...
bmbutle2/ethereum_blockchain
notebooks/modeling2.ipynb
gpl-3.0
train.columns """ Explanation: Drop some features that might cause data leakage that we don't have access to as inputs End of explanation """ train.drop(['type', 'mv', 'blockTime', 'difficulty', 'gasLimit_b', 'gasUsed_b', 'reward', ...
JavierVLAB/DataAnalysisScience
Titanic/Titanic_01.ipynb
gpl-3.0
#Libraries to import import numpy import pandas import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline sns.set_style("whitegrid") sns.set_context("notebook", font_scale=1.5) # Import dataset titanic_train = pandas.read_csv('train.csv') titanic_test = pandas.read_csv('test.csv') """ Explanation:...
PMEAL/OpenPNM
examples/tutorials/network/coupling_continuum_regions_with_pore_networks.ipynb
mit
import numpy as np import scipy as sp import openpnm as op %config InlineBackend.figure_formats = ['svg'] import openpnm.models.geometry as gm import openpnm.models.physics as pm import openpnm.models.misc as mm import matplotlib.pyplot as plt np.set_printoptions(precision=4) np.random.seed(10) ws = op.Workspace() ws.s...
mguerrap/tydal
Module3_TidalCurrents.ipynb
mit
from IPython.display import Image Image("Figures/EbbTideCurrent.jpg") """ Explanation: Module 3 Demo What is happening under the sea surface? Tidal Currents A current is generated by a difference in the sea surface elevation between different points in space, which makes water move back and forth as the surface tilt c...