repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
agile-geoscience/striplog
docs/tutorial/03_Display_objects.ipynb
apache-2.0
from striplog import Decor """ Explanation: Display objects A striplog depends on a hierarchy of objects. This notebook shows the objects related to display: Decor: One element from a legend — describes how to display a Rock. Legend: A set of Decors — describes how to display a set of Rocks or a Striplog. <hr /> De...
Hexiang-Hu/mmds
week6/Quiz-Week6.ipynb
mit
import numpy as np p1 = (5, 4) p2 = (8, 3) p3 = (7, 2) p4 = (3, 3) def calc_wb(p1, p2): dx = ( p1[0] - p2[0] ) dy = ( p1[1] - p2[1] ) return ( ( float(dy) *2 / float(dy - dx), float(-dx)*2 / float(dy - dx) ),\ (dx*p2[1] - dy * p2[0])*2 / float(dy - dx) + 1) # b = dx*y1 - dy*x1 def cal_margin(...
gwulfs/research_public
lectures/long_short_equity/Long-Short Equity Strategies.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt # We'll generate a random factor current_factor_values = np.random.normal(0, 1, 10000) equity_names = ['Equity ' + str(x) for x in range(10000)] # Put it into a dataframe factor_data = pd.Series(current_factor_values, index = equity_names) factor_d...
kit-cel/wt
nt1/vorlesung/7_entzerrung/isi.ipynb
gpl-2.0
# importing import numpy as np from scipy import stats import matplotlib.pyplot as plt import matplotlib # showing figures inline %matplotlib inline # plotting options font = {'size' : 22} plt.rc('font', **font) plt.rc('text', usetex=matplotlib.checkdep_usetex(True)) matplotlib.rc('figure', figsize=(18, 6) ) ""...
zhaojijet/UdacityDeepLearningProject
language-translation/dlnd_language_translation.ipynb
apache-2.0
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
linan7788626/tutmom
mystic.ipynb
bsd-3-clause
%matplotlib inline """ Explanation: Optimiztion with mystic End of explanation """ """ Example: - Minimize Rosenbrock's Function with Nelder-Mead. - Plot of parameter convergence to function minimum. Demonstrates: - standard models - minimal solver interface - parameter trajectories using retall...
Danghor/Formal-Languages
Ply/Conflicts.ipynb
gpl-2.0
import ply.lex as lex tokens = [ 'NUMBER' ] def t_NUMBER(t): r'0|[1-9][0-9]*' t.value = float(t.value) return t literals = ['+', '-', '*', '/', '(', ')'] t_ignore = ' \t' def t_newline(t): r'\n+' t.lexer.lineno += t.value.count('\n') def t_error(t): print(f"Illegal character '{t.value[0]}...
deepakgupta1313/models
slim/slim_walkthough.ipynb
apache-2.0
import matplotlib %matplotlib inline import matplotlib.pyplot as plt import math import numpy as np import tensorflow as tf import time from datasets import dataset_utils # Main slim library slim = tf.contrib.slim """ Explanation: TF-Slim Walkthrough This notebook will walk you through the basics of using TF-Slim to...
zlxs23/Python-Cookbook
data_structure_and_algorithm_py2_1.ipynb
apache-2.0
p = (1,2,3) x,y,z = p x y z da = [1,2,'a',p] a,b,c,_ = da a b c _ """ Explanation: 1.1 解压序列赋值给多个变量 任何的序列(或者是可迭代对象)可以通过一个简单的赋值语句解压并赋值给多个变量,唯一的前提就是变量的数量必须跟序列元素的数量是一样的 End of explanation """ s = 'acfun' a,b,c,d,e = s a e """ Explanation: 这里本身我要输出(1,2,3 )但是在ipython中'_'自动识别成最新的(上一个值) 类似于matlab 中的ans 当然在pyth...
arcyfelix/Courses
17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/05-Pandas-with-Time-Series/02 - Time Shifting.ipynb
apache-2.0
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline df = pd.read_csv('time_data/walmart_stock.csv', index_col = 'Date') df.index = pd.to_datetime(df.index) df.head() df.tail() """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> <cen...
thombashi/sqlitebiter
test/data/pytablewriter_examples.ipynb
mit
writer = pytablewriter.LatexMatrixWriter() writer.table_name = "B" writer.value_matrix = [ ["a_{11}", "a_{12}", "\\ldots", "a_{1n}"], ["a_{21}", "a_{22}", "\\ldots", "a_{2n}"], [r"\vdots", "\\vdots", "\\ddots", "\\vdots"], ["a_{n1}", "a_{n2}", "\\ldots", "a_{nn}"], ] writer.write_table() """ Explanatio...
samuxiii/notebooks
simpsons/Simpsons_SPP_Approach-PyTorch.ipynb
apache-2.0
!pip install -q kaggle !mkdir -p ~/.kaggle !echo '{"username":"XXXX","key":"XXXX"}' > ~/.kaggle/kaggle.json !kaggle datasets download -d alexattia/the-simpsons-characters-dataset !unzip -qo the-simpsons-characters-dataset.zip -d the-simpsons-characters-dataset !unzip -qo ./the-simpsons-characters-dataset/simpsons_data...
phoebe-project/phoebe2-docs
2.3/tutorials/limb_darkening.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: Limb Darkening 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 logger = phoebe.logger() b = phoebe.default_binary() ...
regisDe/compagnons
Calcul symbolique.ipynb
gpl-2.0
%matplotlib inline """ Explanation: Calcul symbolique en Python End of explanation """ from sympy import * """ Explanation: Introduction Ce notebook est la traduction française du cours sur SymPy disponible entre autre sur Wakari avec quelques modifications et compléments notamment pour la résolution d'équations di...
whitead/numerical_stats
unit_10/hw_2017/problem_set_2.ipynb
gpl-3.0
import scipy.stats as ss import numpy as np Z = (1070 - 1064) / 7 p = 1 - (ss.norm.cdf(Z - ss.norm.cdf(-Z))) print(p) """ Explanation: General Instructions For full credit, you must have the following items for each problem: [1 point] Describe what and why the method you're using is applicable. For example, 'I cho...
comp-journalism/Baseline_Problem_for_Algorithm_Audits
BASELINE/Google_Images_Baseline.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.style.use('ggplot') plt.rcParams['figure.figsize'] = (15, 3) plt.rcParams['font.family'] = 'sans-serif' pd.set_option('display.width', 5000) pd.set_option('display.max_columns', 60) """ Explanation: Google Image Search Ba...
alexiusacademia/Masteral-Theory-of-Plates-and-Shells
Assignments/01 - 08-27-2016/Assignment 01 - Plates and Shells.ipynb
gpl-3.0
import sympy as sp from sympy import init_printing init_printing(use_unicode=True) # Declare the symbols EPx, EPy, EPz = sp.symbols("\u03B5x \u03B5y \u03B5z") Qx, Qy, Qz = sp.symbols("\u03C3x \u03C3z \u03C3z") E, v = sp.symbols("E \u03C5") """ Explanation: <div style="font-size:24px;background-color:blue;color:#fff;...
solowPy/solowPy
examples/4 Solving the model.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import sympy as sym import solowpy """ Explanation: <div align='center' ><img src='https://raw.githubusercontent.com/davidrpugh/numerical-methods/master/images/sgpe-logo.jpg' width="1200" height="100"></div> <div align='right'>...
rongchuhe2/workshop_data_analysis_python
example_loan_prediction.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("data/loan_prediction_train.csv") df.head() """ Explanation: Problem Statement About Company Company deals in all home loans. They have presence across all urban, semi urban and rural areas. Customer first appl...
henriquefacioli/mc855-proj2
Projeto.ipynb
gpl-3.0
# Import findspark import findspark # Initialize and provide path findspark.init("/home/henrique/Downloads/spark") # Or use this alternative #findspark.init() # Import SparkSession from pyspark.sql import SparkSession # Build the SparkSession spark = SparkSession.builder \ .master("local") \ .appName...
olgabot/cshl-singlecell-2017
notebooks/2.1_explore_clustering.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy import stats # use seaborn plotting defaults import seaborn as sns; sns.set() """ Explanation: <small><i>The K-means section of this notebook was put together by Jake Vanderplas. Source and license info is on GitHub.</i></small> Clusteri...
mne-tools/mne-tools.github.io
stable/_downloads/91078106f2c04f1e09c01a2fa07e9d27/10_raw_overview.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt import mne """ Explanation: The Raw data structure: continuous data This tutorial covers the basics of working with raw EEG/MEG data in Python. It introduces the :class:~mne.io.Raw data structure in detail, including how to load, query, subselect, export, an...
tleonhardt/LearningCython
Learning_Cython_video/Chapter06/opoverload/opoverload.ipynb
mit
%load_ext cython """ Explanation: Operator Overloading Playground! End of explanation """ %%cython from libc.math cimport sqrt cdef class Unsure: cdef double value cdef double error def __init__(self, double value, double error=0): self.value = value self.error = error def _...
metpy/MetPy
v0.6/_downloads/upperair_soundings.ipynb
bsd-3-clause
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import numpy as np import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import Hodograph, SkewT from metpy.units import units """ Explanation: Upper Air Sounding Tutorial Upper...
FRBs/FRB
docs/nb/Halo_Scattering.ipynb
bsd-3-clause
# imports import numpy as np from importlib import reload from astropy import units from astropy import constants from frb import turb_scattering as frb_scatt """ Explanation: Halo Scattering v1 -- Mainly in the context of the FRB 181112 paper End of explanation """ reload(frb_scatt) z_FRB = 0.4755 z_halo = 0.367 ...
y2ee201/Deep-Learning-Nanodegree
my-experiments/.ipynb_checkpoints/Linear Regression-checkpoint.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd """ Explanation: Linear regression using Batch Gradient Descent Building linear regression from ground up End of explanation """ class linear_regression(): def __init__(self): self.weights = None self.learning_rate = N...
boffi/boffi.github.io
dati_2017/wt05/MassMatrix.ipynb
mit
m, L, x1, x2 = symbols('m L x_1 x_2') """ Explanation: Mass Matrix <img src="figures/trab01_conv.svg" alt="Dynamic System" style="width:95%;"/> The 2 DOF dynamical system in figure is composed of two massless rigid bodies and a massive one. Compute the mass matrix of the system with reference to the degrees of freedom...
slock83/FaceDetect
.ipynb_checkpoints/NN Playground-VariX-checkpoint.ipynb
bsd-3-clause
import numpy as np from cStringIO import StringIO import matplotlib.pyplot as plt import caffe from IPython.display import clear_output, Image, display import cv2 import PIL.Image import os os.chdir("start_deep/") """ Explanation: Neural network "playground" imports End of explanation """ caffe.set_mode_cpu() """ ...
hpanderson/dexpy-pymntos
dexpy-demo.ipynb
apache-2.0
dot = Digraph(comment='Design of Experiments') dot.body.extend(['rankdir=LR', 'size="10,10"']) dot.node_attr.update(shape='rectangle', style='filled', fontsize='20', fontname="helvetica") dot.node('X', 'Controllable Factors', color='mediumseagreen', width='3') dot.node('Z', 'Noise Factors', color='indianred2', width='...
reynoldsk/pySCA
SCA_betalactamase.ipynb
bsd-3-clause
%matplotlib inline from __future__ import division import os import time import matplotlib.pyplot as plt import numpy as np import copy import scipy.cluster.hierarchy as sch from scipy.stats import scoreatpercentile import scaTools as sca import colorsys import mpld3 import cPickle as pickle from optparse import Opti...
trangel/Data-Science
deep_learning_ai/Neural+machine+translation+with+attention+-+v4.ipynb
gpl-3.0
from keras.layers import Bidirectional, Concatenate, Permute, Dot, Input, LSTM, Multiply from keras.layers import RepeatVector, Dense, Activation, Lambda from keras.optimizers import Adam from keras.utils import to_categorical from keras.models import load_model, Model import keras.backend as K import numpy as np from...
INM-6/Python-Module-of-the-Week
session20_NEST/jupyter_notebooks/2_brunel_network.ipynb
mit
# populate namespace with pylab functions and stuff %pylab inline # import NEST & NEST rasterplot import nest import nest.raster_plot """ Explanation: PyNEST - Brunel Network Modeling networks of spiking neurons using NEST Python Module of the Week, 03.05.2019 Alexander van Meegen <img src="img/erdos-renyi-ei.png" alt...
jeffzhengye/pylearn
tensorflow_learning/tf2/notebooks/.ipynb_checkpoints/training_keras_models_on_cloud-checkpoint.ipynb
unlicense
!pip install -q tensorflow_cloud import tensorflow as tf import tensorflow_cloud as tfc from tensorflow import keras from tensorflow.keras import layers """ Explanation: Training Keras models with TensorFlow Cloud Author: Jonah Kohn<br> Date created: 2020/08/11<br> Last modified: 2020/08/11<br> Description: In-depth...
alexbarcelo/pythoncoursetgk
notebook/25-primercaspractic_solved.ipynb
mit
prices = {'apple': 0.40, 'banana': 0.50, 'entrada_promocional': 10, 'entrada_simple': 17} """ Explanation: Python Course - Primer cas pràctic <img src="http://www.telecogresca.com/logo_mail.png"></img> Exercici fortament sintètic (En part de https://wiki.python.org/moin/SimplePrograms, en part collita pròpia) Consider...
tensorflow/workshops
tfx_labs/Lab_1_Pipeline_in_Colab.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...
goujou/LAPM
notebooks/Intro to LAPM.ipynb
mit
from sympy import * from LAPM import * from LAPM.linear_autonomous_pool_model import LinearAutonomousPoolModel """ Explanation: Introduction to LAPM LAPM is a python package for the analysis of linear autonomous pool (compartmental) models. It can be used to obtain a large set of different system-level diagnostics of ...
mbeyeler/opencv-machine-learning
notebooks/05.03-Using-Decision-Trees-for-Regression.ipynb
mit
import numpy as np rng = np.random.RandomState(42) """ Explanation: <!--BOOK_INFORMATION--> <a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 100px; background: white; padding: 1px; border: 1p...
piscataway/datascience
lab/01 Introduction-to-Python.ipynb
mit
# COMMENTS begin with a pound sign (#) and extend to the end of the line. # Comments are ignored by the computer. They are used to explain what the code is supposed to do. # It is best practice to use LOTS of comments. # That way, when you look back at your code, you can more quickly understand what you meant to do. ...
dsiufl/2015-Fall-Hadoop
instructor-notes/1-hadoop-streaming-py-wordcount.ipynb
mit
hadoop_root = '/home/ubuntu/shortcourse/hadoop-2.7.1/' hadoop_start_hdfs_cmd = hadoop_root + 'sbin/start-dfs.sh' hadoop_stop_hdfs_cmd = hadoop_root + 'sbin/stop-dfs.sh' # start the hadoop distributed file system ! {hadoop_start_hdfs_cmd} # show the jave jvm process summary # You should see NamenNode, SecondaryNameNod...
Jeff-Meadows/box-python-sdk-examples
Box Python SDK.ipynb
apache-2.0
# Import two classes from the boxsdk module - Client and OAuth2 from boxsdk import Client, OAuth2 # Define client ID, client secret, and developer token. CLIENT_ID = None CLIENT_SECRET = None ACCESS_TOKEN = None # Read app info from text file with open('app.cfg', 'r') as app_cfg: CLIENT_ID = app_cfg.readline() ...
petrs/ECTester
util/plot_gen.ipynb
mit
%matplotlib notebook import numpy as np from scipy.stats import describe from scipy.stats import norm as norm_dist from scipy.stats.mstats import mquantiles from math import log, sqrt import matplotlib.pyplot as plt from matplotlib import ticker, colors, gridspec from copy import deepcopy from utils import plot_hist, m...
AllenDowney/ModSim
soln/chap05.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
govinda-kamath/clustering_on_transcript_compatibility_counts
Timing_pipeline/Timing_Analysis.ipynb
mit
# Some modules used in this notebook import numpy as np import os import re import colorsys import matplotlib.pyplot as plt """ Explanation: Runtime comparison of alignment/quantification methods This notebook reviews how we ran other tools and obtained Figure 3 in our paper. Before clustering cells, we need to obtai...
google/applied-machine-learning-intensive
content/03_regression/02_regression_in_sklearn/colab.ipynb
apache-2.0
# 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 the L...
wubin7019088/lightfm
examples/movielens/example.ipynb
apache-2.0
import data """ Explanation: Getting the data The first step is to get the movielens data. Let's import the utility functions from data.py: End of explanation """ import inspect print(inspect.getsource(data._build_interaction_matrix)) """ Explanation: The following functions get the dataset, and save it to a local...
tjctw/PythonNote
6.041/A Trivial A Day - Bayes's rule - 1 -zh-TW.ipynb
cc0-1.0
pa = 0.001 pbga = 0.95 pac = 1-pa pbgac = 0.05 print "Total probability of P(B) is " + \ str(0.001*0.95 + 0.05* 0.999) """ Explanation: 前言 大學時候一直沒辦法學好這個被教授屢屢稱為trivial的科目。 這個系列文章我們將以淺入淺出的原則幫作者複習一些機率的概念。 題1 我是不是該去看醫生 這個是個簡單的機率問題。假定有個醫學界阿宅檢定號稱通過考試的阿宅有95%的機率是個阿宅,而當前人口有99.9%是正常人。 請問 1.)隨便抓一個人去檢驗而出現陽性反應的機率有多少? $${ P...
DJCordhose/speed-limit-signs
notebooks/retrain-cnn-step-2-2-using-bottleneck-features.ipynb
apache-2.0
import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline import matplotlib.pylab as plt import numpy as np from distutils.version import StrictVersion import sklearn print(sklearn.__version__) assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1') import tensorflow as tf t...
phoebe-project/phoebe2-docs
2.3/tutorials/fti.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: Finite Time of Integration (fti) 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 n...
GoogleCloudPlatform/mlops-on-gcp
examples/tfdv-structured-data/tfdv-covertype.ipynb
apache-2.0
import os import tempfile import tensorflow as tf import tensorflow_data_validation as tfdv import time from apache_beam.options.pipeline_options import PipelineOptions, GoogleCloudOptions, StandardOptions, SetupOptions, DebugOptions, WorkerOptions from google.protobuf import text_format from tensorflow_metadata.proto...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/05_artandscience/d_customestimator_linear.ipynb
apache-2.0
import math import shutil import numpy as np import pandas as pd import tensorflow as tf tf.logging.set_verbosity(tf.logging.INFO) pd.options.display.max_rows = 10 pd.options.display.float_format = '{:.1f}'.format """ Explanation: Custom Estimator Learning Objectives: * Use a custom estimator of the Estimator class...
google/empirical_calibration
notebooks/survey_calibration_simulated.ipynb
apache-2.0
#@title Copyright 2019 The Empirical Calibration Authors. # 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 l...
metpy/MetPy
v0.10/_downloads/3aec65fc693ccd0216a40e663bc10ddb/Hodograph_Inset.ipynb
bsd-3-clause
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import numpy as np import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import add_metpy_logo, Hodograph, SkewT from metpy.units import units """ Explanation: Hodograph Inset ...
darkomen/TFG
modelado/temperatura/.ipynb_checkpoints/modelado-checkpoint.ipynb
cc0-1.0
#Importamos las librerías utilizadas import numpy as np import pandas as pd import seaborn as sns #Mostramos las versiones usadas de cada librerías print ("Numpy v{}".format(np.__version__)) print ("Pandas v{}".format(pd.__version__)) print ("Seaborn v{}".format(sns.__version__)) #Mostramos todos los gráficos en el n...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/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', 'ec-earth-consortium', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: SANDBOX-3 Topic: Aerosol Sub-Topic...
sameersingh/ml-discussions
week1/loading_data_and_plotting.ipynb
apache-2.0
from __future__ import division """ Explanation: As a rule, I always import division from future when using python 2.*. By doing so, any floating number division will work correctly without the use of '.' or numpy (e.g. 3/2 will prduce 1.5 instead of 1) End of explanation """ import numpy as np # setting a random s...
antoniomezzacapo/qiskit-tutorial
qiskit/aqua/chemistry/advanced_howto.ipynb
apache-2.0
# import common packages import numpy as np from collections import OrderedDict # lib from Qiskit Aqua Chemistry from qiskit_aqua_chemistry import FermionicOperator # lib from Qiskit Aqua from qiskit_aqua import Operator from qiskit_aqua import (get_algorithm_instance, get_optimizer_instance, ...
AllenDowney/ThinkBayes2
soln/chap18.ipynb
mit
# If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install empiricaldist # Get utils.py from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename...
cliburn/sta-663-2017
notebook/11B_Threads_Processses_Concurrency.ipynb
mit
%load_ext cython from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor import multiprocessing as mp from multiprocessing import Pool, Value, Array import os import time import numpy as np from numba import njit """ Explanation: Multi-Core Parallelism End of explanation """ def mc_pi(n): s = 0 ...
mne-tools/mne-tools.github.io
0.23/_downloads/7ba58cd4e9bc2622d60527d21fc13577/decoding_spatio_temporal_source.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Jean-Remi King <jeanremi.king@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline impo...
LFPy/LFPy
examples/LFPy-example-02.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import LFPy """ Explanation: Example 2: Extracellular response of synaptic input This is an example of LFPy running in a Jupyter notebook. To run through this example code and produce output, press &lt;shift-Enter&gt; in each c...
mne-tools/mne-tools.github.io
dev/_downloads/91078106f2c04f1e09c01a2fa07e9d27/10_raw_overview.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt import mne """ Explanation: The Raw data structure: continuous data This tutorial covers the basics of working with raw EEG/MEG data in Python. It introduces the :class:~mne.io.Raw data structure in detail, including how to load, query, subselect, export, an...
Unidata/unidata-python-workshop
notebooks/NumPy/NumPy Broadcasting and Vectorization.ipynb
mit
import numpy as np a = np.array([10, 20, 30, 40]) a + 5 """ Explanation: <a name="top"></a> <div style="width:1000 px"> <div style="float:right; width:98 px; height:98px;"> <img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_static/unidata_150x150.png" alt="Unidata Logo" style="height: 98px...
XPRIZE/GLEXP-Team-SlideSpeech
FitNeuralNets/testFitNeuralNet.ipynb
apache-2.0
dirName = "../lettersketch/assets/train_images/UpperCase/StraightLines/" fileNames = [] fileLetters = [] for fileName in os.listdir(dirName): if fileName.endswith(".png") and (not "__" in fileName): fileNames.append(dirName+fileName) letter = fileName.split("_")[1] fileLetters.append(letter) ...
ecabreragranado/OpticaFisicaII
Trabajo Anillos de Newton/Anillos_de_Newton_Ejercicio.ipynb
gpl-3.0
# MODIFICAR EL NOMBRE DEL FICHERO IMAGEN. LUEGO EJECUTAR ######################################################## nombre_fichero_imagen="nombre.jpg" # Incluir el nombre completo con extensión del fichero imagen dentro de las comillas # DESDE AQUÍ NO TOCAR ############################################...
csdms/coupling
docs/demos/hydrotrend.ipynb
mit
import matplotlib.pyplot as plt import numpy as np """ Explanation: HydroTrend Link to this notebook: https://github.com/csdms/pymt/blob/master/docs/demos/hydrotrend.ipynb Package installation command: $ conda install notebook pymt_hydrotrend Command to download a local copy: $ curl -O https://raw.githubusercontent....
CCI-Tools/ect-core
notebooks/cate-uc09.ipynb
mit
from cate.core.ds import DATA_STORE_REGISTRY import cate.ops as ops from cate.util import ConsoleMonitor monitor = ConsoleMonitor() data_store = DATA_STORE_REGISTRY.get_data_store('esa_cci_odp') local_store = DATA_STORE_REGISTRY.get_data_store('local') oz_remote_sources = data_store.query('esacci.OZONE.mon.L3.NP.mul...
wd15/chimad-phase-field
hackathons/hackathon1/problems.ipynb
mit
from IPython.display import SVG SVG(filename='../images/block1.svg') """ Explanation: Table of Contents Challenge Problems 1. Spinodal Decomposition - Cahn-Hilliard 1.1 Parameter Values 1.2 Initial Conditions 1.3 Domains 1.a Square Periodic 1.b No Flux 1.c T-Shape No Flux 1.d Sphere 1.4 Tasks 2. Ostwald Ripening ...
kabrapratik28/Stanford_courses
cs231n/assignment1/knn.ipynb
apache-2.0
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcParams['figure.figsize'] = (10....
basp/notes
linear_algebra_lectures.ipynb
mit
f1 = lambda x: 2*x f2 = lambda x: (1/2*x) + 1 + (1/2) x = np.linspace(0, 3, 100) plt.plot(x, f1(x), label=r'$y = 2x$') plt.plot(x, f2(x), label=r'$y = \frac{1}{2}x + 1\frac{1}{2}$') plt.legend(loc=4) """ Explanation: linear algebra Most of these notes correspond to the video lectures by Professor Gilbert Strang of MIT...
claudiuskerth/PhDthesis
Data_analysis/SNP-indel-calling/dadi/01_dadi_1D_exp_growth.ipynb
mit
from ipyparallel import Client cl = Client() cl.ids cl[:].targets %%px --noblock # run a whole cell in non-blocking mode, by default on all engines # note: the magic has to be at the top of the cell import time time.sleep(1) time.time() %pxresult # get the result from the AsyncResult object %%px --local # run ...
WoodResourcesGroup/RoundwoodHarvestGHG
.ipynb_checkpoints/wood_fates-checkpoint.ipynb
mit
HWu = pd.read_sql('''SELECT * FROM so4 WHERE harvestslash = "X" AND processingresidues = "X" AND "post-usewoodproduct" = "X" AND stumps is null''', sqdb['cx'],index_col = 'index') HWo = pd.read_sql('...
dsacademybr/PythonFundamentos
Cap02/Notebooks/DSA-Python-Cap02-03-Strings.ipynb
gpl-3.0
# Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) """ Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 2</font> Download: http://github.com/dsacademybr End of explanation """ # Uma ú...
openfisca/openfisca-france-indirect-taxation
openfisca_france_indirect_taxation/examples/notebooks/compare_final.ipynb
agpl-3.0
# Import de modules généraux from __future__ import division import pkg_resources import os import pandas as pd from pandas import concat import seaborn # modules spécifiques from openfisca_france_indirect_taxation.examples.utils_example import graph_builder_line # from ipp_macro_series_parser.agregats_transports.tr...
danresende/deep-learning
intro-to-tensorflow/intro_to_tensorflow.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile print('All m...
marcinofulus/PR2014
MPI/PR_cython_numpy_fortran_diff2d.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np %load_ext Cython %%cython cimport cython cimport numpy as np @cython.wraparound(False) @cython.boundscheck(False) def cython_diff2d(np.ndarray[double, ndim=2] u,np.ndarray[double, ndim=2] v, double dx2, double dy2, double c): cdef unsigned int...
cshankm/rebound
ipython_examples/Churyumov-Gerasimenko.ipynb
gpl-3.0
import rebound sim = rebound.Simulation() sim.add("Sun") sim.add("Jupiter") sim.add("Saturn") """ Explanation: 67P/Churyumov–Gerasimenko This tutorial teaches you how to use the IAS15 integator (Rein and Spiegel, 2015) to simulate the orbit of 67P/Churyumov–Gerasimenko. We will download the data from NASA Horizons and...
mwickert/scikit-dsp-comm
docs/source/nb_examples/Multirate_Processing.ipynb
bsd-2-clause
Image('300ppi/Interpolator_Top_Level@300ppi.png',width='60%') Image('300ppi/Decimator_Top_Level@300ppi.png',width='60%') """ Explanation: Multirate Signal Processing Using multirate_helper In this section the classes multirate_FIR and multirate_IIR, found in the module sk_dsp_comm.multirate_helper, are discussed with...
lknelson/text-analysis-2017
03-Pandas_and_DTM/01-DTM_DistinctiveWords_ExerciseSolutions.ipynb
bsd-3-clause
#First recreate our data import pandas from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer #create a dataframe called "df" df = pandas.read_csv("../Data/BDHSI2016_music_reviews.csv", sep = '\t', encoding = 'utf-8') #counte vectorizer countvec = Coun...
massimo-nocentini/on-python
fdg/intro.ipynb
mit
from operator import attrgetter from sympy import * init_printing() """ Explanation: <p> <img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg" alt="UniFI logo" style="float: left; width: 20%; height: 20%;"> <div align="right"> Massimo Nocentini<br> <small> <br>May 2018: intro </small> <...
dwhswenson/openpathsampling
examples/toy_model_mstis/toy_mstis_A1_split.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import openpathsampling as paths import numpy as np """ Explanation: Splitting a simulation Included in this notebook: Split a full simulation file into trajectories and the rest End of explanation """ %%time storage = paths.AnalysisStorage("mstis.nc") st_split = ...
TakayukiSakai/tensorflow
tensorflow/examples/udacity/2_fullyconnected.ipynb
apache-2.0
# 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 numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range """ Explanation: Deep Learning Assignment 2 Previously in 1_n...
hannorein/rebound
ipython_examples/User_Defined_Collision_Resolve.ipynb
gpl-3.0
import rebound import numpy as np import matplotlib.pyplot as plt def setupSimulation(): ''' Setup the 3-Body scenario''' sim = rebound.Simulation() sim.integrator = "ias15" # IAS15 is the default integrator, so we don't need this line sim.add(m=1.) sim.add(m=1e-3, a=1., r=np.sqrt(1e-3/3.)) # we no...
AllenDowney/ProbablyOverthinkingIt
ess3.ipynb
mit
from __future__ import print_function, division import string import random import numpy as np import pandas as pd import statsmodels.formula.api as smf import thinkstats2 import thinkplot import matplotlib.pyplot as plt import ess %matplotlib inline """ Explanation: Internet use and religion in Europe, part thre...
kit-cel/wt
mloc/ch4_Autoencoders/Autoencoder_AWGN_variableBatchSize.ipynb
gpl-2.0
import torch import torch.nn as nn import torch.optim as optim import numpy as np import matplotlib import matplotlib.pyplot as plt from ipywidgets import interactive import ipywidgets as widgets device = 'cuda' if torch.cuda.is_available() else 'cpu' print("We are using the following device for learning:",device) ""...
fluxcapacitor/source.ml
jupyterhub.ml/notebooks/train_deploy/zz_under_construction/tensorflow/optimize/05_Train_Model_Distributed.ipynb
apache-2.0
import tensorflow as tf cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]}) """ Explanation: Train Model on Distributed Cluster IMPORTANT: You Must STOP All Kernels and Terminal Session The GPU is wedged at this point. We need to set it free!! Define ClusterSpec End of explanation """ ...
ewulczyn/talk_page_abuse
src/modeling/Clean Annotations Exploration.ipynb
apache-2.0
df['is_harassment_or_attack'].value_counts(dropna=False) def attack_and_not_attack(s): return 'not_attack' in s and s!= 'not_attack' df[df['is_harassment_or_attack'].apply(attack_and_not_attack)]['_worker_id'].value_counts().head() """ Explanation: Explore ambivalent is_harassment_or_attack labels It is incorrec...
scidash/sciunit
docs/chapter2.ipynb
mit
!pip install -q sciunit import sciunit """ Explanation: <a href="https://colab.research.google.com/github/scidash/sciunit/blob/master/docs/chapter2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Chapter 2. Writing a model and test in SciUnit from ...
amanikamail/flexx
examples/notebooks/flexx_tutorial_react.ipynb
bsd-2-clause
from flexx import react """ Explanation: Tutorial for flexx.react - reactive programming Also see http://flexx.readthedocs.org/en/latest/react/ Where classic event-driven programming is about reacting to things that happen, RP is about staying up to date with changing signals. Signals are objects that have a value whi...
mbeyeler/opencv-machine-learning
notebooks/02.04-Visualizing-Data-from-an-External-Dataset.ipynb
mit
import numpy as np from sklearn import datasets import matplotlib.pyplot as plt % matplotlib inline """ Explanation: <!--BOOK_INFORMATION--> <a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 1...
jasonjgy2000/Cuny
Data 608/Homework 4/Homeword 4 Notebook.ipynb
gpl-3.0
data.dtypes """ Explanation: Data Cleansing End of explanation """ data['Date'] = pd.to_datetime(data["Date"]) data['Site'] = data['Site'].astype('category') data['EnteroCount'] = data['EnteroCount'].str.replace(r'\<|>', '').astype('int64') # remove Na data = data.dropna() data[3230:3234] data.dtypes """ Explanat...
jljones/portfolio
ds/Webscraping_Craigslist_multi.ipynb
apache-2.0
%pylab inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import requests from bs4 import BeautifulSoup as bs4 """ Explanation: Webscraping Craigslist for Housing Listings in the East Bay Jennifer Jones End of explanation """ # Get the data using the requests module npgs = np.arange(0,10,...
egodat/chaos_game_fractal
fractal_from_random.ipynb
mit
import pickle,glob import numpy as np import matplotlib.pyplot as plt import pandas as pd %pylab inline """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Generating-Fractal-From-Random-Points---The-Chaos-Game" data-toc-modified-id="Generating-Fractal-From-Random-Points---The-Chaos-Game-1"><sp...
CalPolyPat/phys202-2015-work
assignments/assignment09/IntegrationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy import integrate """ Explanation: Integration Exercise 1 Imports End of explanation """ def trapz(f, a, b, N): """Integrate the function f(x) over the range [a,b] with N points.""" h = (b-a)/N I = 0 for i in range(N): ...
jeffzhengye/pylearn
jpx-tokyo-simple-lstm-network-scuec.ipynb
unlicense
# check gpu env with torch import torch print(torch.__version__) # 查看torch当前版本号 print(torch.version.cuda) # 编译当前版本的torch使用的cuda版本号 print("is_cuda_available:", torch.cuda.is_available()) # 查看当前cuda是否可用于当前版本的Torch,如果输出 print('gpu count:', torch.cuda.device_count()) # 查看指定GPU的容量、名称 device = "cuda:0" print(f"{devic...
ccasotto/rmtk
rmtk/vulnerability/derivation_fragility/NLTHA_on_SDOF/2MSA_on_SDOF.ipynb
agpl-3.0
from rmtk.vulnerability.common import utils import double_MSA_on_SDOF import numpy from rmtk.vulnerability.derivation_fragility.NLTHA_on_SDOF.read_pinching_parameters import read_parameters import MSA_utils %matplotlib inline """ Explanation: Double Multiple Stripe Analysis (2MSA) for Single Degree of Freedom (SDOF) O...
GoogleCloudPlatform/training-data-analyst
courses/fast-and-lean-data-science/colab_intro.ipynb
apache-2.0
import math import tensorflow as tf from matplotlib import pyplot as plt print("Tensorflow version " + tf.__version__) a=1 b=2 a+b """ Explanation: <img alt="Colaboratory logo" height="45px" src="https://colab.research.google.com/img/colab_favicon.ico" align="left" hspace="10px" vspace="0px"> <h1>Welcome to Colabora...
DJCordhose/ai
notebooks/workshops/tss/cnn-imagenet-retrain.ipynb
mit
import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline import matplotlib.pylab as plt import numpy as np from distutils.version import StrictVersion import sklearn print(sklearn.__version__) assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1') import tensorflow as tf t...
shunliz/test
python/Pandas.ipynb
apache-2.0
s = pd.Series([3, -5, 7, 4], index=['a', 'b', 'c', 'd']) data = {'Country': ['Belgium', 'India', 'Brazil'], 'Capital': ['Brussels', 'New Delhi', 'Brasília'], 'Population': [11190846, 1303171035, 207847528]} df = pd.DataFrame(data, columns=['Country', 'Capital', 'Population']) #Pivvot, data = {'Date': ['2016-03-01', '...
CUBoulder-ASTR2600/lectures
lecture_15_ndarraysII.ipynb
isc
%matplotlib inline import numpy as np import matplotlib.pyplot as pl """ Explanation: Some comments from homework 4 Don't do lines too long, it's considered bad style as horizontal scrolling is awkward. Most projects demand lines < 80 or, more rarely, < 100 chars. This also helps the case when you want to compare tw...
ngcm/training-public
FEEG6016 Simulation and Modelling/03-Molecular-Dynamics-Lab-1.ipynb
mit
from IPython.core.display import HTML css_file = 'https://raw.githubusercontent.com/ngcm/training-public/master/ipython_notebook_styles/ngcmstyle.css' HTML(url=css_file) """ Explanation: Molecular Dynamics: Lab 1 In part based on Fortran code from Furio Ercolessi. End of explanation """ %matplotlib inline import num...