repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
xboard/xboard.github.io
ipynb/IDH-Education.ipynb
mpl-2.0
%matplotlib inline import pandas as pd import requests as req import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_ind, ttest_rel from scipy.stats import gaussian_kde from statsmodels.formula.api import ols, mixedlm, gee from statsmodels.stats.outliers_influence import ...
ctools/ctools
doc/source/users/tutorials/cta/howto/howto_likelihood_profiles.ipynb
gpl-3.0
# Load the modules import gammalib import ctools import cscripts # Define the ctools install directory import os ct_dir = os.environ['CTOOLS'] os.environ['CALDB'] = ct_dir + '/share/caldb/' # Configure some preliminary variables inmodel = ct_dir + '/share/models/crab.xml' caldb = 'prod2' irf = 'North_5h' emin ...
jacksongomesbr/academia-md
probabilidade/probabilidade.ipynb
cc0-1.0
from fractions import Fraction def P(evento, espaco): "A probabilidade de um evento, dado o espaco amostral" return Fraction(len(evento & espaco), len(espaco)) """ Explanation: Probabilidade Definições iniciais Experimento: uma ocorrência com um resultado incerto. Também pode ser chamado "processo". Exemplo:...
QuantScientist/Deep-Learning-Boot-Camp
day03/2.2.3 CNN HandsON - CIFAR10.ipynb
mit
from keras.models import Sequential from keras.layers.core import Dense, Dropout, Flatten, Activation from keras.layers.convolutional import Convolution2D, MaxPooling2D from keras.optimizers import Adadelta input_shape = (3, 32, 32) nb_classes = 10 ## [conv@32x3x3+relu]x2 --> MaxPool@2x2 --> DropOut@0.25 --> ## [conv...
martinjrobins/hobo
examples/optimisation/spotting-unidentifiable-parameters.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import pints import pints.plot class BadLogisticModel(pints.ForwardModel): """ Logistic model of population growth with unidentifiable parameters. """ def __init__(self): super(BadLogisticModel, self).__init__() # Initial pop...
tylere/docker-tmpnb-ee
notebooks/1 - IPython Notebook Examples/IPython Project Examples/Interactive Widgets/Export As (nbconvert).ipynb
apache-2.0
notebook_name = widgets.Text() """ Explanation: This notebook shows a really roundabout way to get the name of the notebook file using widgets. The true purpose of this demo is to demonstrate how Javascript and Python widget models are related by id. Create a text Widget without displaying it. The widget will be use...
ianctse/pvlib-python
docs/tutorials/pvsystem.ipynb
bsd-3-clause
# built-in python modules import os import inspect import datetime # scientific python add-ons import numpy as np import pandas as pd # plotting stuff # first line makes the plots appear in the notebook %matplotlib inline import matplotlib.pyplot as plt # seaborn makes your plots look better try: import seaborn ...
dpshelio/2015-EuroScipy-pandas-tutorial
02 - Data structures.ipynb
bsd-2-clause
s = pd.Series([0.1, 0.2, 0.3, 0.4]) s """ Explanation: Data structures Pandas does this through two fundamental object types, both built upon NumPy arrays: the Series object, and the DataFrame object. Series A Series is a basic holder for one-dimensional labeled data. It can be created much as a NumPy array is created...
junhwanjang/DataSchool
Lecture/07. 미적분과 최적화/1) SymPy를 사용한 함수 미분.ipynb
mit
def f(x): return 2*x x = 10 y = f(x) print(x, y) """ Explanation: SymPy를 사용한 함수 미분 데이터 분석에서 미분의 필요성 그다지 관련이 없어 보이지만 사실 데이터 분석에도 미분(differentiation)이 필요하다. 데이터 분석의 목표 중 하나는 확률 모형의 모수(parameter)나 상태 변수(state)를 추정(estimation)하는 작업이다. 이러한 작업은 근본적으로 함수의 최소점 혹은 최대점을 찾는 최적화(optimization) 작업이며 미분 혹은 편미분을 사용한 도함수를 필요로 한다...
HrantDavtyan/Data_Scraping
Week 3/HW3_solutions.ipynb
apache-2.0
import pandas as pd urls = ["http://rate.am/am/armenian-dram-exchange-rates/banks/non-cash/2017/06/01/20-15", "http://rate.am/am/armenian-dram-exchange-rates/banks/non-cash/2017/06/02/20-15", "http://rate.am/am/armenian-dram-exchange-rates/banks/non-cash/2017/06/03/20-15", "http://rate.am/am/arm...
proinsias/gilbert-shannon-reeds
Gilbert-Shannon-Reeds.ipynb
mit
def get_random_number_for_right_deck(n: int, seed: int=None, ) -> int: """ Return the number of cards to split into the right sub-deck. :param n: one above the highest number that could be returned by this function. :param seed: optional seed for the random number generator to enable ...
mne-tools/mne-tools.github.io
0.22/_downloads/8f7e6dfc30a66795f2d4e4ae5ca6d23e/plot_40_artifact_correction_ica.ipynb
bsd-3-clause
import os import mne from mne.preprocessing import (ICA, create_eog_epochs, create_ecg_epochs, corrmap) sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif...
facemelters/data-science
Atlas/Erik vs the rest of our content.ipynb
gpl-2.0
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline df_all = pd.read_csv('All content.csv') df_erik = pd.read_csv('Erik content.csv') """ Explanation: TL;DR: Erik's articles perform poorly when compared to the rest of our articles published in the same time period. While he i...
enbanuel/phys202-2015-work
assignments/assignment03/NumpyEx01.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va """ Explanation: Numpy Exercise 1 Imports End of explanation """ def checkerboard(size): #I couldn't figure this out on my own. My partner helped me during pa...
mne-tools/mne-tools.github.io
0.23/_downloads/31239620dd9631320a99b07ac4a81074/interpolate_bad_channels.ipynb
bsd-3-clause
# Authors: Denis A. Engemann <denis.engemann@gmail.com> # Mainak Jas <mainak.jas@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/MEG/sample/sample_audvis-ave.fif' evoked = mne.read_evokeds(fnam...
phoebe-project/phoebe2-docs
2.1/tutorials/reflection_heating.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Reflection and Heating For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering. Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you...
lcharleux/numerical_analysis
doc/Interpolation/1D_interpolation.ipynb
gpl-2.0
# Setup %matplotlib inline import numpy as np import matplotlib.pyplot as plt import matplotlib params = {'font.size' : 14, 'figure.figsize':(15.0, 8.0), 'lines.linewidth': 2., 'lines.markersize': 15,} matplotlib.rcParams.update(params) """ Explanation: 1D interpolation Scope Finite...
fgnt/nara_wpe
examples/NTT_wrapper_offline.ipynb
mit
def aquire_audio_data(): D, T = 4, 10000 y = np.random.normal(size=(D, T)) return y y = aquire_audio_data() start = time.perf_counter() x = wpe(y) end = time.perf_counter() print(f"Time: {end-start}") """ Explanation: Minimal example with random data End of explanation """ channels = 8 sampling_rate =...
mayankjohri/LetsExplorePython
Section 1 - Core Python/Chapter 09 - Classes & OOPS/02_03_Multiple_Inheritance.ipynb
gpl-3.0
class Base1: pass class Base2: pass class MultiDerived(Base1, Base2): pass """ Explanation: Multiple Inheritance In multiple inheritance, a class can be derived from more than one base classes. The syntax for multiple inheritance is similar to single inheritance except we list all the base classes in se...
SystemsBiologyUniandes/Cytometry
HOW TO USE THE LIBRARY.ipynb
mit
import cytometry_lib as cy """ Explanation: Within the library the required packages for the code to run correctly are imported. If there's an import error check the following things: Check pandas is isntalled. Check fcs parser is installed. Check OS is installed. Once you've checked this run this code in 4 simple s...
mne-tools/mne-tools.github.io
0.19/_downloads/03db2d983950efa77a26beb0ac22b422/plot_20_rejecting_bad_data.ipynb
bsd-3-clause
import os import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False) events_file = os.path.join(sample_data...
ajgpitch/qutip-notebooks
examples/measures-trajectories-cats-kerr.ipynb
lgpl-3.0
import matplotlib.pyplot as plt import numpy as np from qutip import * from IPython.display import display, Math, Latex """ Explanation: Cat vs coherent states in a Kerr resonator, and the role of measurement $\newcommand{\ket}[1]{| #1 \rangle}$ $\newcommand{\bra}[1]{\langle #1 |}$ $\newcommand{\braket}[1]{\langle #1 ...
openfisca/combine-calculators
scripts/legislation_refactoring.ipynb
gpl-3.0
from utils import show_histogram, percent_diff, scatter_plot, multi_scatter from econometrics import gini, draw_ginis import matplotlib.pyplot as plt # import bqplot.pyplot as plt import pandas as pd import numpy as np import random import qgrid import copy from reformators import Excalibur qgrid.nbinstall(overwrit...
thomasantony/CarND-Projects
Exercises/Term1/transfer-learning-lab/Transfer_Learning_Lab.ipynb
mit
from keras.layers import Dense, Flatten, Input, Dropout from keras.models import Sequential import pickle def load_bottleneck_data(network, dataset): """ Arguments: network - String, one of 'resnet', 'vgg', 'inception' dataset - String, one of 'cifar10', 'traffic' """ train_file = '{}_{...
asazo/ANN
tarea1/tarea1.ipynb
mit
# Importar Librerías import numpy as np import matplotlib.pyplot as plt from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import SGD # Guardar semilla para numeros aleatorios seed = 21 np.random.seed(seed) def generate_data(n): # Lista para gua...
JAmarel/Phys202
Numpy/NumpyEx03.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va """ Explanation: Numpy Exercise 3 Imports End of explanation """ def brownian(maxt, n): """Return one realization of a Brownian (Wiener) process with n steps...
darcamo/pyphysim
ipython_notebooks/Partially Connected.ipynb
gpl-2.0
%matplotlib inline from ipywidgets.widgets import Image from IPython.display import display, display_svg, display_png # xxxxxxxxxx Add the parent folder to the python path. xxxxxxxxxxxxxxxxxxxx import sys parent_dir = "../" sys.path.append(parent_dir) # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-hh/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-HH Topic: Aerosol Sub-Topics: Transport, Emissions, Conce...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/dev/n03_feature_extraction.ipynb
mit
def generate_train_intervals(data_df, train_time, base_time, step, days_ahead, today): pass """ Explanation: The first objective of this notebook is to implement the next function (to extract sample intervals from the total period). End of explanation """ # I will try to keep the convention to name with the "day...
wbbeyourself/cn-deep-learning
tutorials/intro-to-tflearn/TFLearn_Sentiment_Analysis_Solution.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w...
ueapy/ueapy.github.io
content/notebooks/2017-06-02-matplotlib-contourf-subplots.ipynb
mit
import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Today we are going to learn some tricks about plotting two dimensional data with matplotlib contourf function. End of explanation """ # Array 1 delta1 = 0.025 x1 = np.arange(-3.0, 3.0, delta1) y1 = n...
ebachelet/pyLIMA
examples/pyLIMA_example_3.ipynb
gpl-3.0
## First import the required libraries %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import os, sys from pyLIMA import microlsimulator """ Explanation: Welcome to pyLIMA tutorial! Let's simulate, and fit back :), some events. Do not forget, if not made already. To obtain working link to the...
qinwf-nuan/keras-js
notebooks/layers/normalization/BatchNormalization.ipynb
mit
data_in_shape = (4, 3) norm = BatchNormalization(epsilon=1e-05, axis=-1, center=True, scale=True) layer_0 = Input(shape=data_in_shape) layer_1 = norm(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_weights()): ...
deme-rs/notebooks
BMI-vs-Distance.ipynb
mit
import numpy import pandas as pd import matplotlib.pyplot as plt %matplotlib inline pd.set_option('display.mpl_style', 'default') plt.rcParams['figure.figsize'] = (15, 5) plt.rcParams['font.family'] = 'sans-serif' import re """ Explanation: The Relationship between Athlete Shape and Running Distance I'm naively assum...
danijel3/ASRDemos
notebooks/TIMITDataPrep.ipynb
apache-2.0
import sys sys.path.append('../python') from timit import * """ Explanation: Preparing the TIMIT database If you are lucky enough to own the TIMIT database, or are willing to buy it from here, you can use this simple script to prepare the HDF5 files, similarly to how it was done with the Voxforge dataset. For a deta...
GoogleCloudPlatform/training-data-analyst
blogs/sme_academy/tfx/02_transform.ipynb
apache-2.0
import apache_beam as beam import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_transform as tft print('TF version: {}'.format(tf.__version__)) print('TFT version: {}'.format(tft.__version__)) print('TFDV version: {}'.format(tfdv.__version__)) print('Apache Beam version: {}'.format(beam....
ucbrise/clipper
examples/image_query/keras_on_docker_example.ipynb
apache-2.0
from keras.applications.resnet50 import ResNet50 # https://keras.io/applications/#classify-imagenet-classes-with-resnet50 model = ResNet50(weights='imagenet') """ Explanation: Prerequisites pip install clipper_admin==0.4.1 \ keras==2.2.4 \ tensorflow==1.13.1 \ numpy==1.16.4 \ ...
info-370/classification
knn/INFO370-KNN_Exercise_Solutions.ipynb
mit
from sklearn.datasets import load_boston from sklearn.cross_validation import train_test_split from sklearn.preprocessing import scale from sklearn.neighbors import KNeighborsRegressor from sklearn.metrics import mean_squared_error from sklearn.cross_validation import KFold import matplotlib.pyplot as plt import numpy ...
tensorflow/docs-l10n
site/en-snapshot/addons/tutorials/layers_normalizations.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...
marcus-nystrom/python_course
Week6_lecture.ipynb
gpl-3.0
# Create a string my_str = 'This is my string' # Split it... my_str_split = my_str.split() print(my_str_split) # ... and restore (join) it again my_str_joined = ' '.join(my_str_split) # ' ' means join with space print(my_str_joined) # Find first occurence of word containing 'str' print(my_str.find('str')) # Replac...
masterfish2015/my_project
python/demo1/scipy-advanced-tutorial-master/Part2/Widget Events.ipynb
mit
from __future__ import print_function """ Explanation: Index - Back - Next Widget Events Special events End of explanation """ from IPython.html import widgets print(widgets.Button.on_click.__doc__) """ Explanation: The Button is not used to represent a data type. Instead the button widget is used to handle mouse ...
srcole/qwm
misc/COGS108/clustering.ipynb
mit
%config InlineBackend.figure_format = 'retina' %matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: NOTES * jupyter nbconvert --to slides clustering.ipynb End of explanation """ np.random.seed(0) x1 = np.random.randn(30) y1 = 4*x1 + 10 + np.random.randn(len(x1)) x2 = x1*10 y2 = (x...
idc9/law-net
vertex_metrics_experiment/procedural_v_substantive_federal.ipynb
mit
%time d_pagerank = G.pagerank() %time u_pagerank = G.as_undirected().pagerank() %time d_betweenness = G.betweenness(directed=True) # %time u_betweenness = G.as_undirected().betweenness(directed=False) #COMPUTING D BETWEEN right now started at 6:35 pm %time d_closeness = G.closeness(mode="IN", normalized=True) %t...
Chipe1/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...
maurodoglio/taar
analysis/TAARExperimentV2Analysis.ipynb
mpl-2.0
import pyspark.sql.functions as F from pyspark.sql import Row import pyspark.sql.types as T import pandas as pd import re import matplotlib.pyplot as plt import seaborn as sns import datetime as dt from collections import Counter from IPython.display import Markdown, display from moztelemetry import Dataset from pyspar...
JAmarel/Phys202
Algorithms/AlgorithmsEx01.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np """ Explanation: Algorithms Exercise 1 Imports End of explanation """ def tokenize(s, stop_words=None, punctuation='`~!@#$%^&*()_-+={[}]|\:;"<,>.?/}\t'): """Split a string into a list of words, removing punctuation and stop words.""" ...
deepmind/educational
colabs/introductory/protein_folding.ipynb
apache-2.0
#@title Look how complex this structure is! from IPython.display import YouTubeVideo YouTubeVideo('GM9buhWJjlA', width=600, height=400) """ Explanation: <p><small><small>Copyright 2020 DeepMind Technologies Limited.</p> <p><small><small> Licensed under the Apache License, Version 2.0 (the "License"); you may not use t...
NelisW/ComputationalRadiometry
06-Diverse-pyradi-utilities.ipynb
mpl-2.0
from IPython.display import display from IPython.display import Image from IPython.display import HTML %matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: 6 Diverse pyradi utilities This notebook forms part of a series on computational optical radiometry. The notebooks can be down...
karolaya/PDI
PS-05/problem_set_5.ipynb
mit
'''This is a definition script, so we do not have to rewrite code''' import numpy as np import os import cv2 import matplotlib.pyplot as mplt import random import json # set matplotlib to print inline (Jupyter) %matplotlib inline # path prefix pth = '../data/' # files to be used as samples # list *files* holds the...
gtesei/python-for-finance-notes
2__Optimizing_Portfolios.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.optimize as spo def parab(X): ## X = 2 is the min Y = (X - 2)**2 + 1.5 return Y initial_guess = 3 opt_methods_no_Jacobian = ['Nelder-Mead','Powell','CG','BFGS','L-BFGS-B','TNC','COBYLA','SLSQP'] mins = [spo.minimize(pa...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_ecog.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Chris Holdgraf <choldgraf@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from mayavi import mlab import mne from mne.viz import plot_trans, snapshot_brain_montage print(__doc__) """ Ex...
archman/phantasy
docs/source/src/notebooks/phantasy_cavity.ipynb
bsd-3-clause
import os import phantasy import scan import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Cavity Tuning Import modules/packages End of explanation """ machine = "FRIB_FLAME" mp = phantasy.MachinePortal(machine=machine, segment='LINAC') """ Explanation: Model Machine End of explanation """ all_cavi...
py-chemist/Deep_Learning_with_Keras
classification.ipynb
gpl-3.0
from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasClassifier from sklearn.model_selection import StratifiedKFold, cross_val_score from sklearn.preprocessing import StandardScaler import numpy as np import pandas as pd import time # 1. Number of times pregna...
xqding/StatisticsExamples
Nested_Sampling/Nested_Sampling.ipynb
gpl-3.0
%matplotlib inline import numpy as np import math import matplotlib.pyplot as plt """ Explanation: Nested Sampling Nested sampling is used for calculating the normalization constant in Bayesian inference. The normalization constant is also called evidence. 1. Analytical Results of A Simple Gaussian Problem Considering...
rahulremanan/python_tutorial
Beginners/notebook/Pickle_tutorial.ipynb
mit
import gc import pickle import psutil import numpy as np import pandas as pd """ Explanation: Using Pickle to manage memory in Python Author: Dr. Rahul Remanan, CEO, Moad Computer Run this notebook in Google Colab Import dependencies End of explanation """ def memory_utilization(): print('Current memory utili...
magwenelab/mini-term-2016
ode-modeling2.ipynb
cc0-1.0
# import statements to make numeric and plotting functions available %matplotlib inline from numpy import * from matplotlib.pyplot import * ## We'll specify the behavior of X as a series of pulse of different length ## so we'll define a function to generate pulses def pulse(ontime, offtime, ntimes, onval=1): if ...
GoogleCloudPlatform/mlops-on-gcp
immersion/guided_projects/guided_project_1.ipynb
apache-2.0
import os """ Explanation: Guided Project 1 Learning Objectives: Learn how to generate a standard TFX template pipeline using tfx template Learn how to modify and run a templated TFX pipeline Note: This guided project is adapted from Create a TFX pipeline using templates). End of explanation """ PATH=%env PATH %e...
adrn/tutorials
notebooks/gaia-galactic-orbits/gaia-galactic-orbits.ipynb
cc0-1.0
# astropy imports import astropy.coordinates as coord from astropy.table import QTable import astropy.units as u from astroquery.gaia import Gaia # Third-party imports import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np %matplotlib inline # gala imports import gala.coordinates as gc import gal...
josephcslater/mousai
docs/tutorial/demos/Duffing_state_space.ipynb
bsd-3-clause
%matplotlib inline %load_ext autoreload %autoreload 2 import scipy as sp import numpy as np import matplotlib.pyplot as plt import mousai as ms from scipy import pi, sin # Test that all is working. # f_tol adjusts accuracy. This is smaller than reasonable, but illustrative of usage. t, x, e, amps, phases = ms.hb_tim...
juanshishido/visualization-with-python
visualization-with-python_answers.ipynb
bsd-2-clause
import math import random import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt """ Explanation: Theory of Data Visualization Visualization is meant to convey information. The power of a graph is its ability to enable one to take in the quantitative information, organize it,...
QuantEcon/QuantEcon.notebooks
markov_chain_ex01_py.ipynb
bsd-3-clause
%matplotlib inline from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt from quantecon.markov import MarkovChain """ Explanation: Finite Markov Chains: Examples Daisuke Oyama Faculty of Economics, University of Tokyo This notebook demonstrates how to analyze finite-state ...
jegibbs/phys202-2015-work
assignments/assignment10/ODEsEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy.integrate import odeint from IPython.html.widgets import interact, fixed """ Explanation: Ordinary Differential Equations Exercise 1 Imports End of explanation """ def lorentz_derivs(yvec, t, sigma, rho, beta): x = yvec[0] y = y...
trangel/Data-Science
deep_learning_ai/Convolution+model+-+Step+by+Step+-+v2.ipynb
gpl-3.0
import numpy as np import h5py import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' %load_ext autoreload %autoreload 2 np.random.seed(1) """ Explanation: Convolut...
cvxgrp/cvxpylayers
examples/tf/ReLU Layers.ipynb
apache-2.0
from cvxpylayers.tensorflow import CvxpyLayer import cvxpy as cp import tensorflow as tf from tensorflow.keras import layers tf.keras.backend.set_floatx('float64') class ReluLayer(layers.Layer): def __init__(self, input_dim, output_dim): super(ReluLayer, self).__init__() self.W = tf.Variable(1e-3 ...
khalido/algorithims
monty_hall.ipynb
gpl-3.0
import random import numpy as np # for plots, cause visuals %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns """ Explanation: The famous Monty Hall brain teaser: Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You...
Seeliglab/2017---Deep-learning-yeast-UTRs
Jupyter_notebooks/Notebook_3_CNN_Predictions_of_Native_UTR_HIS3_data.ipynb
mit
plt.rcParams["patch.force_edgecolor"] = True sns.set_style('whitegrid', {'axes.grid': True, 'grid.linestyle': u'--', 'axes.edgecolor': '0.1', 'axes.labelcolor': '0', 'axes.labelsize': 15, 'axes.titlesize': 15, 'legen...
plipp/informatica-pfr-2017
nbs/4/2-2-OPTIONAL-Classification-Random-Forests-w-One-Hot-Encoding-Exercise.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Predicting Earnings from Census Data with Random Forests 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 ind...
Z0m6ie/Zombie_Code
Data_Science_Course/Michigan Data Analysis Course/1 Applied Plotting, Charting & Data Representation/Week 2/Week2.ipynb
mit
%matplotlib notebook import matplotlib as mpl mpl.get_backend() import matplotlib.pyplot as plt plt.plot? # because the default is the line style '-', # nothing will be shown if we only pass in one point (3,2) plt.plot(3, 2) # we can pass in '.' to plt.plot to indicate that we want # the point (3,2) to be indicate...
opesci/notebooks
AcousticFWI/Acoustic-wave-equation.ipynb
bsd-3-clause
p=Function('p') m,s,h = symbols('m s h') m=M(x,y,z) q=Q(x,y,t) d=D(x,y,t) e=E(x,y) """ Explanation: PDE The acoustic wave equation for the square slowness m and a source q is given in 3D by : \begin{cases} &m \frac{d^2 u(x,t)}{dt^2} - \nabla^2 u(x,t) =q \ &u(.,0) = 0 \ &\frac{d u(x,t)}{dt}|_{t=0} = 0 \end{cases}...
Mashimo/datascience
00-tidyData/CleanDataHAR.ipynb
apache-2.0
import pandas as pd """ Explanation: Read and clean data using Python and Pandas End of explanation """ cat UCI\ HAR\ Dataset/activity_labels.txt act = pd.read_table('UCI HAR Dataset/activity_labels.txt', header=None, sep=' ', names=('ID','Activity')) act type(act) act.columns """ Explanation: Read the files an...
tensorflow/docs-l10n
site/ja/probability/examples/Eight_Schools.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # 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, sof...
jfrygeo/Read-Headers-CSV-python
View-Headers-Pandas.ipynb
apache-2.0
import pandas as pd print (pd.__version__) response = input("Please Enter Location of Input CSV (""Example: C:\Test\TestCSV.csv)"": ") """ Explanation: View-Headers-And-Edit-CSV If a file is too large to be opened by Excel or Notepad, this script will read the csv file and allow a user to output a clean csv End of ex...
kellerberrin/OSM-QSAR
Notebooks/EC50_Results/EC50 Prelim Results.ipynb
mit
from IPython.display import display import pandas as pd print("EC50_1000 Results") ec50_1000_results = pd.read_csv("./EC50_1000_results.csv") display(ec50_1000_results) print("EC50_500 Results") ec50_500_results = pd.read_csv("./EC50_500_results.csv") display(ec50_500_results) print("EC50_200 Results") ec50_200_results...
dlab-berkeley/geocoding-workshop
intro-geocoding.ipynb
mit
import json import requests import pandas as pd from pprint import pprint """ Explanation: Introductory Geocoding and Mapping Juan Shishido School of Information GSR, D-Lab Imports End of explanation """ def single_address(address, api='dstk'): ''' Individual address lookup with either DSTK or Photon ...
renekm/CD-atualizado-
MiniProjeto2/Mini-Projeto-2.ipynb
gpl-3.0
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np import os from scipy import stats lambp=10 dist= stats.poisson(lambp) x= stats.poisson.rvs(mu=lambp, loc=0, size=1000000) media= np.mean(x) var= np.var(x) media2=[] for i in range (0,10001): valores = np.random.choice(x,2) ...
evanmiltenburg/python-for-text-analysis
Chapters-colab/Chapter_01_Getting_Started_with_Variables_and_Values.ipynb
apache-2.0
%%capture !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip !unzip Data.zip -d ../ !unzip images.zip -d ./ !unzip Ext...
ChadFulton/statsmodels
examples/notebooks/mixed_lm_example.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf %load_ext rpy2.ipython %R library(lme4) """ Explanation: Linear Mixed Effects Models End of explanation """ data = sm.datasets.get_rdataset('dietox', 'geepack').data md = smf.mixedlm("Weight ~ Time", data, gro...
sangheestyle/ml2015project
howto/model09_refactoring_more_for _feat_avg_pos.ipynb
mit
import gzip import pickle from os import path from collections import defaultdict from numpy import sign """ Load buzz data as a dictionary. You can give parameter for data so that you will get what you need only. """ def load_buzz(root='../data', data=['train', 'test', 'questions'], format='pklz'): buzz_data = {...
nick-youngblut/SIPSim
ipynb/theory/.ipynb_checkpoints/qPCR_error_propagation-checkpoint.ipynb
mit
%load_ext rpy2.ipython %%R library(ggplot2) library(dplyr) library(tidyr) def neg_binom_err(m, r, negs=False): """Adding negative binomial distribuiton error, where variance scales more with the mean than a poisson distribution if (r < inf). Parameters ---------- m : float Mean value ...
tensorflow/docs-l10n
site/ko/tutorials/keras/overfit_and_underfit.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/05_artandscience/labs/a_handtuning.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst """ Explanation: Hand tuning hyperparameters Learning Objectives: * Use the LinearRegressor class in TensorFlow to predict median housing price, at the granularity of city blocks, based on one input feature * Evaluate the accuracy of a model's pred...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/03_tensorflow/d_traineval.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.5 from google.cloud import bigquery import tensorflow as tf import numpy as np import shutil print(tf.__version__) """ Explanation: <h1> 2d. Distributed training ...
CartoDB/cartoframes
docs/examples/data_observatory/do_geography_notebook_template.ipynb
bsd-3-clause
!pip install -U cartoframes # Note: a kernel restart is required after installing the library import cartoframes cartoframes.__version__ """ Explanation: CARTO Data Observatory This is a basic template notebook to start exploring your new Geography from CARTO's Data Observatory via the Python library CARTOframes. Y...
coolharsh55/advent-of-code
2016/python3/Day09.ipynb
mit
with open('../inputs/day09.txt', 'r') as f: data = ''.join([''.join(line.split()) for line in f.readlines()]) # TEST DATA # data = ''.join([ # 'ADVENT', # 'A(1x5)BC', # '(3x3)XYZ', # 'A(2x2)BCD(2x2)EFG', # '(6x1)(1x3)A', # 'X(8x2)(3x3)ABCY' # ]) """ Expla...
ES-DOC/esdoc-jupyterhub
notebooks/cccma/cmip6/models/sandbox-2/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-2', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: CCCMA Source ID: SANDBOX-2 Topic: Landice Sub-Topics: Glaciers, Ice. Propertie...
akshayrangasai/akshayrangasai.github.io
Blog Post Content/Airport Waiting Time.ipynb
mit
%matplotlib inline #Imports for solution import numpy as np import scipy.stats as sp from matplotlib.pyplot import * #Setting Distribution variables ##All rates are in per Minute. """ Explanation: Airport Wait Time Simulation End of explanation """ #Everything will me modeled as a Poisson Process SIM_TIME = 180 Q...
mediagit2016/workcamp-maschinelles-lernen-grundlagen
20-02-20-ml-workcamp/aufgaben/arbeiten-mit-listen.ipynb
gpl-3.0
#Haben Sie schon gemerkt dass # einen Kommentar einletet #Für diese einfache Berechnungen muss keine Bibliothek zugeladen werden x = [4,2,6,3] #Erzeugt eine Liste mit Integer Werten x1 = [4,2,6,3] #Erzeugt eine Liste mit den gleichen Werten x2 = [1.0,2.0,3.0,4.0] #Erzeugt eine Liste mit float Werten y = list() # Erzeu...
google/compass
packages/propensity/02.ml_data_preparation.ipynb
apache-2.0
# Uncomment to install required python modules # !sh ../utils/setup.sh # Add custom utils module to Python environment import os import sys sys.path.append(os.path.abspath(os.pardir)) import inspect import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from gps_building_blocks.cloud.ut...
Hash--/documents
notebooks/TP Master Fusion/IC-Hands-on_solutions.ipynb
mit
a = 140e-3 /2 # inner conductor radius b = 230e-3 /2 # inner conductor radius def coax_electric_field(rho, V, a, b): """ Returns the electric field in a coaxial line. """ return 1/rho*V/log(b/a) rho = linspace(a, b, 101) V = 1 # V plot(rho/a, coax_electric_field(rho, V, a, b)/V) xlabel('rho/a') ylabel...
Xyllan/boun_cmpe548_project
Paper_Implementation.ipynb
apache-2.0
import numpy as np m = 6040 # users n = 3952 # movies Rnan = np.full((m, n), np.nan) # Ratings matrix with nans instead of 0s """ Explanation: 1. Introduction We will reimplement the methodology of the paper in Python. 2. Preliminary Concepts Initially, we will recreate the basic variables defined in the paper. To ma...
kit-cel/wt
wt/vorlesung/ch7_9/queue.ipynb
gpl-2.0
# importing import numpy as np import matplotlib.pyplot as plt import matplotlib # showing figures inline %matplotlib inline # plotting options font = {'size' : 20} plt.rc('font', **font) plt.rc('text', usetex=True) matplotlib.rc('figure', figsize=(18, 6) ) """ Explanation: Content and Objective Using Poisson ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/end-to-end-structured/solutions/5b_deploy_keras_ai_platform_babyweight_vertex.ipynb
apache-2.0
import os from google.cloud import aiplatform from google.protobuf import json_format from google.protobuf.struct_pb2 import Value """ Explanation: LAB 5b: Deploy and predict with Keras model on Vertex AI Learning Objectives Setup up the environment Deploy trained Keras model to an endpoint for online prediction on...
tpin3694/tpin3694.github.io
python/matplotlib_grouped_bar_plot.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np """ Explanation: Title: Group Bar Plot In MatPlotLib Slug: matplotlib_grouped_bar_plot Summary: Group Bar Plot In MatPlotLib Date: 2016-05-01 12:00 Category: Python Tags: Data Visualization Authors: Chris Albon Based on: Sebast...
stlk/socialist
jupyter/photo_recomendation.ipynb
mit
from IPython.display import display, HTML for item in media: display(HTML(('<img src="%s"/>' % item.get_standard_resolution_url()))) from functools import reduce from collections import Counter def retreive_tags(result, tags): result += list(map(lambda tag: tag.name, tags)) return result tags_...
Cyb3rWard0g/ThreatHunter-Playbook
docs/notebooks/windows/09_collection/WIN-200609225055.ipynb
gpl-3.0
from openhunt.mordorutils import * spark = get_spark() """ Explanation: Access to Microphone Device Metadata | | | |:------------------|:---| | collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] | | creation date | 2020/06/09 | | modification date | 2020/09/20 | | playbook related | [] | Hy...
davidbrough1/pymks
notebooks/localization_cahn_hilliard_Legendre_2D.ipynb
mit
import pymks %matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt """ Explanation: Cahn-Hilliard with Primtive and Legendre Bases This example uses a Cahn-Hilliard model to compare two different bases representations to discretize the microstructure. One basis rep...
nick-youngblut/SIPSim
ipynb/bac_genome/n1147/atomIncorp_taxaIncorp_MW-HR-SIP_postSparsity.ipynb
mit
import os import glob import itertools import nestly %load_ext rpy2.ipython %load_ext pushnote %%R library(ggplot2) library(dplyr) library(tidyr) library(gridExtra) """ Explanation: Goal Follow-up to: atomIncorp_taxaIncorp Determining the effect of 'heavy' BD window (number of windows & window sizes) on HR-SIP accu...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_forward.ipynb
bsd-3-clause
import mne from mne.datasets import sample data_path = sample.data_path() # the raw file containing the channel location + types raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif' # The paths to Freesurfer reconstructions subjects_dir = data_path + '/subjects' subject = 'sample' """ Explanation: Head model a...
dnc1994/MachineLearning-UW
ml-foundations/backup/wiki-retrieval/Document retrieval.ipynb
mit
import graphlab """ Explanation: Document retrieval from wikipedia data Fire up GraphLab Create End of explanation """ people = graphlab.SFrame('people_wiki.gl/') """ Explanation: Load some text data - from wikipedia, pages on people End of explanation """ people.head() len(people) """ Explanation: Data contain...
cdiener/micom
docs/source/community.ipynb
apache-2.0
from micom.data import test_taxonomy taxonomy = test_taxonomy() taxonomy """ Explanation: Building communities micom will construct communities from a specification via a Pandas DataFrame. Here, the DataFrame needs at least two columns: "id" and "file" which specify the ID of the organism/tissue and a file containing...