repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
maojrs/riemann_book | Kitchen_sink_problem.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
from scipy.optimize import fsolve
from scipy import integrate
import matplotlib.pyplot as plt
from clawpack import pyclaw
from clawpack import riemann
from clawpack.visclaw.ianimate import ianimate
import matplotlib
plt.style.use('seaborn-talk')
from IPython.display import HTML
""... |
mikarubi/notebooks | worker/notebooks/neurofinder/tutorials/custom-example-thunder.ipynb | mit | %matplotlib inline
from thunder import Colorize
image = Colorize.image
tile = Colorize.tile
"""
Explanation: Writing an algorithm (using Spark/Thunder)
In this notebook, we show how to write an algorithm and put it in a function that can be submitted to the NeuroFinder challenge. In these examples, the algorithms will... |
the-deep-learners/nyc-ds-academy | notebooks/deep_net_in_tensorflow.ipynb | mit | import numpy as np
np.random.seed(42)
import tensorflow as tf
tf.set_random_seed(42)
"""
Explanation: Deep Neural Network in TensorFlow
In this notebook, we convert our intermediate-depth MNIST-classifying neural network from Keras to TensorFlow (compare them side by side) following Aymeric Damien's Multi-Layer Percep... |
kescobo/gender-comp-bio | notebooks/gender_detection.ipynb | gpl-3.0 | import os
os.chdir("../data/pubdata")
names = []
with open("comp.csv") as infile:
for line in infile:
names.append(line.split(",")[5])
"""
Explanation: 2. Gender Detection
Figuring out genders from names
We're going to use 3 different methods, all of which use a similar philosophy. Essentially, each of th... |
phasedchirp/Assorted-Data-Analysis | exercises/SlideRule-DS-Intensive/Inferential Statistics/sliderule_dsi_inferential_statistics_exercise_2.ipynb | gpl-2.0 | %matplotlib inline
from __future__ import division
import matplotlib
matplotlib.rcParams['figure.figsize'] = (15.0,5.0)
import pandas as pd
import numpy as np
from scipy import stats
data = pd.io.stata.read_stata('data/us_job_market_discrimination.dta')
print "Total count: ",len(data)
print "race == 'b': ",len(data[da... |
mjasher/gac | original_libraries/flopy-master/examples/Notebooks/flopy3_Zaidel_example.ipynb | gpl-2.0 | %matplotlib inline
import sys
import os
import platform
import numpy as np
import matplotlib.pyplot as plt
import flopy
import flopy.utils as fputl
#Set name of MODFLOW exe
# assumes executable is in users path statement
exe_name = 'mfusg'
if platform.system() == 'Windows':
exe_name = 'mfusg.exe'
mfexe = exe_nam... |
mp4096/controlboros | examples/simple_control_loop.ipynb | bsd-3-clause | from controlboros import StateSpaceBuilder
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
"""
Explanation: Simulating a simple control loop
Mikhail Pak, 2017
End of explanation
"""
t_begin, t_end = 0.0, 10.0
dt = 0.1
"""... |
kingb12/languagemodelRNN | model_comparisons/noingX_compared.ipynb | mit | report_files = ["/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing6_200_512_04drb/encdec_noing6_200_512_04drb.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_200_512_04drb/encdec_noing10_200_512_04drb.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experi... |
mne-tools/mne-tools.github.io | stable/_downloads/9e70404d3a55a6b6d1c1877784347c14/mixed_source_space_inverse.ipynb | bsd-3-clause | # Author: Annalisa Pascarella <a.pascarella@iac.cnr.it>
#
# License: BSD-3-Clause
import os.path as op
import matplotlib.pyplot as plt
from nilearn import plotting
import mne
from mne.minimum_norm import make_inverse_operator, apply_inverse
# Set dir
data_path = mne.datasets.sample.data_path()
subject = 'sample'
da... |
wasit7/cs439_python | week03/Class.ipynb | bsd-3-clause | class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world'
dir(m)
m.__doc__
m=MyClass()
m.i
m.f()
"""
Explanation: References
https://docs.python.org/2/tutorial/classes.html
Simple Python Class Components
End of explanation
"""
class AnotherClass:
def __init... |
tensorflow/docs-l10n | site/ja/neural_structured_learning/tutorials/adversarial_keras_cnn_mnist.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 u... |
junpenglao/Bayesian-Cognitive-Modeling-in-Pymc3 | CaseStudies/TheBARTModelofRiskTaking.ipynb | gpl-3.0 | p = .15 # (Belief of) bursting probability
ntrials = 90 # Number of trials for the BART
Data = pd.read_csv('data/GeorgeSober.txt', sep='\t')
# Data.head()
cash = np.asarray(Data['cash']!=0, dtype=int)
npumps = np.asarray(Data['pumps'], dtype=int)
options = cash + npumps
d = np.full([ntrials,30], np.nan)
k = np.fu... |
LxMLS/lxmls-toolkit | labs/notebooks/basic_tutorials/python_basics.ipynb | mit | print('Hello World!')
"""
Explanation: Installation
Make sure to have all the required software installed after proceeding.
For installation help, please consult the school guide.
Python Basics
End of explanation
"""
print(3 + 5)
print(3 - 5)
print(3 * 5)
print(3 ** 5)
# Observation: this code gives different resu... |
vbarua/PythonWorkshop | Code/Introduction To Python/2 - Tuples and Lists.ipynb | mit | ('x', 'y', 'z')
"""
Explanation: Tuples and Lists
Tuples
A Python Tuple is an immutable
sequence of fixed sized. They are created using round brackets () with commas to separate the elements.
End of explanation
"""
(1, 'b', 2.5)
"""
Explanation: The elements of a tuple need not have the same type.
End of explanati... |
JanetMatsen/Machine_Learning_CSE_546 | HW2/notebooks/Q-1-2_Neural_Nets_with_a_random_first_layer.ipynb | mit | import numpy as np
import matplotlib as mpl
%matplotlib inline
import time
import pandas as pd
import seaborn as sns
from mnist import MNIST # public package for making arrays out of MINST data.
import sys
sys.path.append('../code/')
from ridge_regression import RidgeMulti
from hyperparameter_explorer import Hyper... |
khrapovs/metrix | notebooks/basic_data_io_analysis.ipynb | mit | import re
import requests
import zipfile
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
import seaborn as sns
import statsmodels.formula.api as sm
sns.set_context('talk')
pd.set_option('float_format', '{:6.2f}'.format)
%matplotlib inline
"""
Explanation: Basic data IO and analysis
First, we ne... |
jmcs/ecological | tutorial.ipynb | mit | import os
os.environ["INTEGER_LIST"] = "[1, 2, 3, 4, 5]"
os.environ["DICTIONARY"] = "{'key': 'value'}"
os.environ["INTEGER"] = "42"
os.environ["BOOLEAN"] = "False"
os.environ["OVERRIDE_DEFAULT"] = "This is NOT the default value"
"""
Explanation: Ecological Tutorial
Getting Started
Before we start to set some environme... |
damienstanton/nanodegree | p1_lessons/5 - Hough Transform.ipynb | mit | import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
# convert to grayscale and smooth with a Gaussian
img = mpimg.imread('testimg.jpg')
gray_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
kernel_size = 5
blurred = cv2.GaussianBlur(gray_img, (kernel_size, kernel_size), 0)
# edge... |
ocefpaf/intro_python_notebooks | 02-NumPy.ipynb | mit | a = [0.1, 0.25, 0.03]
b = [400, 5000, 6e4]
c = a + b
c
[e1+e2 for e1, e2 in zip(a, b)]
import math
math.tanh(c)
[math.tanh(e) for e in c]
"""
Explanation: Aula 02 - NumPy
Objetivos
Apresentar o objeto array de N-dimensões
Guia de funções sofisticadas (broadcasting)
Tour nos sub-módulos para: Álgebra Linear, trans... |
KUrushi/knocks | 02/chapter2.ipynb | mit | hightemp = "".join(map(str, [i.replace('\t', ' ') for i in open('hightemp.txt', 'r')]))
print(hightemp)
"""
Explanation: 11. タブをスペースに置換
タブ1文字につきスペース1文字に置換せよ.確認にはsedコマンド,trコマンド,もしくはexpandコマンドを用いよ.
End of explanation
"""
col1 = open('col1.txt', 'w')
col2 = open('col2.txt', 'w')
hightemp = [i.replace('\t', ' ').split(... |
smorton2/think-stats | code/chap02ex.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/MIT
End of explanation
"""
t = [1,... |
flohorovicic/pynoddy | docs/notebooks/9-Topology.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
# Basic settings
import sys, os
import subprocess
# Now import pynoddy
import pynoddy
%matplotlib inline
# determine path of repository to set paths corretly below
repo_path = os.path.realpath('../..')
"""
Explanation: ... |
BillyLjm/CS100.1x.__CS190.1x | lab4_machine_learning_student.ipynb | mit | import sys
import os
from test_helper import Test
baseDir = os.path.join('data')
inputPath = os.path.join('cs100', 'lab4', 'small')
ratingsFilename = os.path.join(baseDir, inputPath, 'ratings.dat.gz')
moviesFilename = os.path.join(baseDir, inputPath, 'movies.dat')
"""
Explanation: version 1.0.1
+
Introduction to M... |
AustT1996/language-recognition-with-neural-nets | Language Recognition Neural Net- Training and Testing.ipynb | mit | # imports
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import string
import math
import tabulate
import os
"""
Explanation: Summary
Use Tensorboard to build and train a neural net for recognizing
Conclusion
The Neural net has mediocre overall performance, likely because I didn't spend th... |
probml/pyprobml | notebooks/book1/22/matrix_factorization_recommender_surprise_lib.ipynb | mit | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
"""
Explanation: <a href="https://colab.research.google.com/github/Nirzu97/pyprobml/blob/matrix-factorization/notebooks/matrix_factorization_recommender_surprise_lib.ipynb" target="_parent"><img src="https://colab.research.google.com/asse... |
jpilgram/phys202-2015-work | assignments/assignment09/IntegrationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import integrate
"""
Explanation: Integration Exercise 2
Imports
End of explanation
"""
#I worked with James Amarel on this assignement
def integrand(x, a):
return 1.0/(x**2 + a**2)
def integral_approx(a):
... |
agile-geoscience/notebooks | The_frequency_of_a_Ricker.ipynb | apache-2.0 | T, dt, f = 0.256, 0.001, 25
import bruges
w, t = bruges.filters.ricker(T, dt, f, return_t=True)
import scipy.signal
f_W, W = scipy.signal.welch(w, fs=1/dt, nperseg=256)
fig, axs = plt.subplots(figsize=(15,5), ncols=2)
axs[0].plot(t, w)
axs[0].set_xlabel("Time [s]")
axs[1].plot(f_W[:25], W[:25], c="C1")
axs[1].set_xl... |
Pybonacci/notebooks | Machine Learning/Regresión lineal.ipynb | bsd-2-clause | from sklearn import datasets
boston = datasets.load_boston()
"""
Explanation: Los modelos lineales son fundamentales tanto en estadística como en el aprendizaje automático, pues muchos métodos se apoyan en la combinación lineal de variables que describen los datos. Lo más sencillo será ajustar una línea recta con Line... |
Fetisoff/Portfolio | 0. Python (Basic) Explore U.S. Births/Basics.ipynb | apache-2.0 | f = open('US_births_1994-2003_CDC_NCHS.csv', 'r')
data = f.read()
data
data_spl = data.split("\n")
data_spl
data_spl[0:10]
"""
Explanation: Explore U.S. Births
In this project, I am working with the dataset, compiled by FiveThirtyEight [https://raw.githubusercontent.com/fivethirtyeight/data/master/births/US_births... |
facemelters/data-science | Atlas/Draft Final Project.ipynb | gpl-2.0 | df = pd.read_csv('atlas-taggings.csv')
df[2:5]
"""
Explanation: First we import the table of tag-article mappings from our SQL database
(but read in as a .csv).
End of explanation
"""
articles = df[df.tagged_type == 'Article']
"""
Explanation: We only care about the content type "Article"
End of explanation
"""
... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/train_models_with_tensorFlow_decision_forests.ipynb | apache-2.0 | # Install the specified package
!pip install tensorflow_decision_forests
"""
Explanation: Building, Training and Evaluating Models with TensorFlow Decision Forests
Overview
In this lab, you use TensorFlow Decision Forests (TF-DF) library for the training, evaluation, interpretation and inference of Decision Forest mod... |
fdcl-gwu/MAE3134_examples | numerical_integration.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def input(t):
f = np.cos(t)
return f
def msd(state, t, m, c, k):
x, xd = state
pos_dot = xd
vel_dot = 1/m*(input(t) - c*xd - k*x)
state_dot = [pos_dot, vel_dot]
return state_dot
num_st... |
infilect/ml-course1 | keras-notebooks/Transfer-Learning/5.3 Transfer Learning & Fine-Tuning.ipynb | mit | import numpy as np
import datetime
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras import backe... |
bsafdi/NPTFit | examples/Example2_Creating_Masks.ipynb | mit | # Import relevant modules
%matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import healpy as hp
from NPTFit import create_mask as cm # Module for creating masks
"""
Explanation: Example 2: Creating Masks
In this example we show how to create masks using create_mask.py.
Often it is convenient ... |
amueller/nyu_ml_lectures | Linear models.ipynb | bsd-2-clause | from sklearn.datasets import make_regression
from sklearn.cross_validation import train_test_split
X, y, true_coefficient = make_regression(n_samples=80, n_features=30, n_informative=10, noise=100, coef=True, random_state=5)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=5)
print(X_train.shape)... |
whitead/numerical_stats | unit_8/hw_2019/homework_8_key.ipynb | gpl-3.0 | import scipy.stats as ss
data_21 = [65.58, -28.15, 21.17, -0.57, 6.04, -10.21, 36.46, 10.67, 77.98, 15.97]
se = np.std(data_21, ddof=1) / np.sqrt(len(data_21))
T = ss.t.ppf(0.9, df=len(data_21) - 1)
print(np.mean(data_21), T * se)
"""
Explanation: Homework 8 Key
CHE 116: Numerical Methods and Statistics
2/21/2019
1. ... |
SylvainCorlay/bqplot | examples/Marks/Object Model/Market Map.ipynb | apache-2.0 | data = pd.read_csv('../../data_files/country_codes.csv', index_col=[0])
country_codes = data.index.values
country_names = data['Name']
"""
Explanation: Get Data
End of explanation
"""
market_map = MarketMap(names=country_codes,
# basic data which needs to set for each map
... |
joshnsolomon/phys202-2015-work | assignments/assignment04/TheoryAndPracticeEx01.ipynb | mit | from IPython.display import Image
"""
Explanation: Theory and Practice of Visualization Exercise 1
Imports
End of explanation
"""
# Add your filename and uncomment the following line:
Image(filename='graph1.png')
"""
Explanation: Graphical excellence and integrity
Find a data-focused visualization on one of the fol... |
jtwalsh0/methods | Statistics.ipynb | mit | %%latex
\begin{align*}
f_X(X=x) &= cx^2, 0 \leq x \leq 2 \\
1 &= c\int_0^2 x^2 dx \\
&= c[\frac{1}{3}x^3 + d]_0^2 \\
&= c[\frac{8}{3} + d - d] \\
&= c[\frac{8}{3}] \\
f_X(X=x) &= \frac{3}{8}x^2, 0 \leq x \leq 2
\end{align*}
u = np.random.uniform(size=100000)
x = 2 * u**.3333
df = pd.DataFrame... |
ComputoCienciasUniandes/MetodosComputacionalesLaboratorio | 2016-1/w04/sistemas_lineales.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Sistemas de ecuaciones lineales
En este notebook vamos a ver conceptos básicos para resolver sistemas de ecuaciones lineales.
La estructura de esta presentación está basada en http://nbviewer.ipython.org/github/mbakker7/exploratory_... |
gdementen/larray | doc/source/tutorial/tutorial_IO.ipynb | gpl-3.0 | # first of all, import the LArray library
from larray import *
"""
Explanation: Load And Dump Arrays
The LArray library provides methods and functions to load and dump Array, Session, Axis Group objects to several formats such as Excel, CSV and HDF5. The HDF5 file format is designed to store and organize large amounts... |
NlGG/Home | seminar/Chap05.ipynb | mit | #Simulate interest rate oath by the Vasicek model
def vasicek(r0, K, theta, sigma, T=1., N=10, seed=777):
np.random.seed(seed)
dt = T/float(N)
rates = [r0]
for i in range(N):
dr = K*(theta-rates[-1]*dt) + sigma*np.random.normal()
rates.append(rates[-1] + dr)
return range(N+... |
gardenermike/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... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/classify_text_with_bert.ipynb | apache-2.0 | # A dependency of the preprocessing for BERT inputs
!pip install -q --user tensorflow-text
"""
Explanation: Classify text with BERT
Learning Objectives
Learn how to load a pre-trained BERT model from TensorFlow Hub
Learn how to build your own model by combining with a classifier
Learn how to train a your BERT model b... |
kazzz24/deep-learning | autoencoder/Simple_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
"""
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to compres... |
JaviMerino/lisa | ipynb/wlgen/rtapp_examples.ipynb | apache-2.0 | # Let's use the local host as a target
te = TestEnv(
target_conf={
"platform": 'host',
"username": 'put_here_your_username'
})
"""
Explanation: Test environment setup
End of explanation
"""
# Create a new RTApp workload generator
rtapp = RTA(
target=te.target, # Target execution on t... |
openhep/ackp16 | H750.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import math
from sympy import *
from scipy.optimize import root, brentq
from sympy.abc import tau, sigma, x, D, T, Q, Y, N
T3, sigmaprime = symbols('T3, sigmaprime')
# local packages
from plothelp import label_line... |
zrhans/python | exemplos/googlecode-day-python/google-python-class-day2-p1.ipynb | gpl-2.0 | # Importando o modulo de expressoes regulares
import re
"""
Sintax: match = re.serach(pat, text)
"""
match = re.search('iig','camado piiig')
# O metodo group do objeto retorna o que match encontrou
match.group()
"""
Explanation: Google Python Class Day 2 Part 1
Fonte: Youtube
Nick Parlante - Google engEDU
Topico:
... |
google-coral/tutorials | retrain_efficientdet_model_maker_tf2.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... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/projects/04-language-translation/notebooks/dlnd_language_translation_v2.ipynb | mit | """
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... |
AllenDowney/ProbablyOverthinkingIt | dice_prob.ipynb | mit | from __future__ import print_function, division
from numpy.random import choice
from collections import Counter
from collections import defaultdict
"""
Explanation: Solution to a problem posted at
https://www.reddit.com/r/statistics/comments/4csjee/finding_pab_given_two_sets_of_data/
Copyright 2016 Allen Downey
MIT L... |
calroc/joypy | docs/Quadratic.ipynb | gpl-3.0 | from notebook_preamble import J, V, define
"""
Explanation: Quadratic formula
End of explanation
"""
define('quadratic == over [[[neg] dupdip sqr 4] dipd * * - sqrt [+] [-] cleave] dip 2 * [truediv] cons app2 roll< pop')
J('3 1 1 quadratic')
"""
Explanation: Cf. jp-quadratic.html
-b +/- sqrt(b^2 - 4 * a ... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Sparse_Tensors-Solutions.ipynb | cc0-1.0 | from __future__ import print_function
import tensorflow as tf
import numpy as np
from datetime import date
date.today()
author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises"
tf.__version__
np.__version__
sess = tf.InteractiveSession()
"""
Explanation: Sparse Tensors
End of explanation
"""
x = tf... |
tcstewar/testing_notebooks | sgbc/Simple LSTM example.ipynb | gpl-2.0 | t = np.arange(50)*0.05
input_data = np.sign(np.array([np.sin(2*np.pi*t),np.sin(2*np.pi*t)]).T).astype(float)
input_data += np.random.normal(size=input_data.shape)*0.1
output_data = (np.sign(np.sin(2*np.pi*t*2+np.pi)).astype(float)+1)/2
print('Input Data', input_data)
print('Output Data', output_data)
"""
Explanation:... |
xtr33me/deep-learning | intro-to-rnns/Anna_KaRNNa.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
bashtage/statsmodels | examples/notebooks/gee_score_test_simulation.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
from scipy.stats.distributions import norm, poisson
import statsmodels.api as sm
import matplotlib.pyplot as plt
"""
Explanation: GEE score tests
This notebook uses simulation to demonstrate robust GEE score tests. These tests can be used in a GEE analysis to compare nested hypo... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/ml_ops/stage6/get_started_with_tf_serving.ipynb | apache-2.0 | import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
USER_FLAG = ... |
Xilinx/meta-petalinux | recipes-multimedia/gstreamer/gstreamer-vcu-notebooks/vcu-demo-camera-encode-file.ipynb | mit | from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_04/Final/Universal.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(10, 4), columns=['A', 'B', 'C', 'D'])
df2 = pd.DataFrame(np.random.randn(7, 3), columns=['A', 'B', 'C'])
sum_df = df + df2
sum_df
"""
Explanation: NumPy Universal Functions
If the data within a DataFrame are numeric, NumPy's universal functions ... |
ClickSecurity/data_hacking | mdl_exploration/MDL_Data_Exploration.ipynb | mit | # This exercise is mostly for us to understand what kind of data we have and then
# run some simple stats on the fields/values in the data. Pandas will be great for that
import pandas as pd
pd.__version__
# Set default figure sizes
pylab.rcParams['figure.figsize'] = (14.0, 5.0)
# This data url can be a web location h... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topic... |
freininghaus/adventofcode | 2016/day11-python.ipynb | mit | with open("input/day11.txt", "r") as f:
inputLines = tuple(line.strip() for line in f)
import itertools
import re
"""
Explanation: Day 11: Radioisotope Thermoelectric Generators
End of explanation
"""
floors = {
"first" : 1,
"second" : 2,
"third" : 3,
"fourth" : 4,
}
"""
Explanation: Function... |
tensorflow/docs | site/en/guide/migrate/validate_correctness.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... |
mne-tools/mne-tools.github.io | 0.23/_downloads/72bb0e260a352fd7c21fee1dd2f83d79/decoding_spoc_CMC.ipynb | bsd-3-clause | # Author: Alexandre Barachant <alexandre.barachant@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import Epochs
from mne.decoding import SPoC
from mne.datasets.fieldtrip_cmc import data_path
from sklearn.pipeline import ma... |
oroszl/szamprob | notebooks/Package04/plotly.ipynb | gpl-3.0 | from plotly import *
from plotly.offline import *
init_notebook_mode()
"""
Explanation: ☠ Ábrakészítés a plotly modul segítségével
Az ábrakészítéshez természetesen az eddig használt matplotlib modul mellett számos másik függvénycsomag is létezik. A lent röviden bemutatott plotly modul előnye, hogy az alapbeállításokat... |
damontallen/IPython-quick-ref-sheets | SVG_Table_Builder.ipynb | mit | cd Git_quickref_project/
"""
Explanation: Using Custom Magic and SVG Table Builder Classes to turn %quickref Magic into a SVG Table.
This notebook uses the SVG table classes here to build SGV tables of the %quickref text. The github project containing the external files used is here.
End of explanation
"""
from IPy... |
camm0991/ThesisProject | Scripts/02 Signal filtering/Signal filtering from csv file.ipynb | mit | from scipy.signal import butter
from scipy.signal import lfilter
from sklearn.preprocessing import StandardScaler
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""
Explanation: Signal filtering
End of explanation
"""
def butter_bandpass(lowcut, highcut, fs, order=4):
nyq =... |
MATH497project/MATH497-DiabeticRetinopathy | person_profile_exploration/person_profile.ipynb | mit | temp=list(data['family_hist_list'][data['family_hist_list'].Relation.notnull()].Relation.drop_duplicates())
len(temp)
data['encounters'].head()
"""
Explanation: There are 443 different relationships
End of explanation
"""
# Create Date variable
from datetime import datetime
data['family_hist_list']['Date'] = [datet... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_lcmv_beamformer.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import numpy as np
import mne
from mne.datasets import sample
from mne.beamformer import lcmv
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_a... |
rexthompson/data-512-a1 | hcds-a1-data-curation.ipynb | mit | import json
import matplotlib.pyplot as plt
import os
import pandas as pd
import requests
%matplotlib inline
"""
Explanation: English Wikipedia page views, 2008 - 2017
Here I retrieve, aggregate and visualize the number of monthly visitors to English Wikipedia from January 2008 through September 2017. I group the dat... |
computationforpolicy/lecture-examples | Solutions 4.ipynb | gpl-3.0 | base_url = "https://en.wikipedia.org"
index_ref = "/wiki/List_of_accidents_and_incidents_involving_commercial_aircraft"
index_html = urlopen(base_url + index_ref)
index = BeautifulSoup(index_html, "lxml")
"""
Explanation: Question a: Setting up the dataframe
End of explanation
"""
result = index.find_all('li')
"""
... |
Jackporter415/phys202-2015-work | assignments/assignment12/FittingModelsEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize as opt
"""
Explanation: Fitting Models Exercise 1
Imports
End of explanation
"""
a_true = 0.5
b_true = 2.0
c_true = -4.0
dy = 2.0
x = np.linspace(-5,5,30)
"""
Explanation: Fitting a quadratic curve
For this problem we are go... |
saashimi/CPO-datascience | Normalized Dataset - Testing parameters.ipynb | mit | #Import required packages
import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt
def format_date(df_date):
"""
Splits Meeting Times and Dates into datetime objects where applicable using regex.
"""
df_date['Days'] = df_date['Meeting_Times'].str.extract('([^\s]+)', expand... |
enchantner/python-zero | lesson_5/Slides.ipynb | mit | a = 1
b = 3
a + b
a.__add__(b)
type(a)
isinstance(a, int)
class Animal(object):
mammal = True # class variable
def __init__(self, name, voice, color="black"):
self.name = name
self.__voice = voice # "приватный" или "защищенный" атрибут
self._color = color # "типа приватны... |
zpace/zaphod | zaphod/zaphod_example.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from astropy.io import fits
from astropy import units as u
"""
Explanation: Let's make fake galaxies!
(Zach Pace, UWisc; last substantial update 2 Sept 2016)
Let's say you want to test your spectral fitting model... First, generate a CSP spectrum w... |
rbiswas4/ObsCond | examples/Demo_SkyBrightness.ipynb | gpl-3.0 | fig, ax = plt.subplots()
ax.plot(hwbpDict['g'].wavelen, hwbpDict['g'].sb, 'k')
ax.plot(hwbpDict['g'].wavelen, TotbpDict['g'].sb, 'r')
pointings = pd.read_csv(os.path.join(obscond.example_data_dir, 'example_pointings.csv'), index_col='obsHistID')
skycalc = obscond.SkyCalculations(photparams="LSST", hwBandpassDict=hwbp... |
phani-vadrevu/phani-vadrevu.github.io | markdown_generator/publications.ipynb | mit | !cat publications.tsv
"""
Explanation: Publications markdown generator for academicpages
Takes a TSV of publications with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in publications.py. Run either from the m... |
obust/Pandas-Tutorial | Pandas I - Series and DataFrames.ipynb | mit | import pandas as pd
import numpy as np
pd.set_option('max_columns', 50)
"""
Explanation: Pandas I - Series and DataFrame
Pandas introduces two new data structures to Python, both of which are built on top of NumPy (this means it's fast) :
- Series : one-dimensional object akin to an observation/row in a dataset
- Data... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Analysis/Pandas/DataFrames.ipynb | mit | import pandas as pd
import numpy as np
from numpy.random import randn
np.random.seed(101)
df = pd.DataFrame(randn(5,4),index='A B C D E'.split(),columns='W X Y Z'.split())
df
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
DataFrames
DataFrames are the workhorse of... |
SlipknotTN/udacity-deeplearning-nanodegree | seq2seq/sequence_to_sequence_implementation.ipynb | mit | import helper
source_path = 'data/letters_source.txt'
target_path = 'data/letters_target.txt'
source_sentences = helper.load_data(source_path)
target_sentences = helper.load_data(target_path)
"""
Explanation: Character Sequence to Sequence
In this notebook, we'll build a model that takes in a sequence of letters, an... |
xdnian/pyml | code/ch10/ch10.ipynb | mit | %load_ext watermark
%watermark -a '' -u -d -v -p numpy,pandas,matplotlib,sklearn,seaborn
"""
Explanation: Copyright (c) 2015, 2016 Sebastian Raschka
<br>
Li-Yi Wei
https://github.com/1iyiwei/pyml
MIT License
Python Machine Learning - Code Examples
Chapter 10 - Predicting Continuous Target Variables with Regression Ana... |
ShinjiKatoA16/UCSY-sw-eng | Python-5 Class and object.ipynb | mit | # empty class for data container
class Test_case():
pass
def distance(tc):
'''
tc: test_case instance
return distance from (0,0) to (tc.x, tc,y)
'''
return (tc.x**2 + tc.y**2) ** (0.5)
tc1 = Test_case() # create new instance
tc1.x = 100
tc1.y = 200
tc2 = Test_case()
tc2.x = 10
tc2.y... |
landlab/landlab | notebooks/tutorials/data_record/DataRecord_tutorial.ipynb | mit | import numpy as np
import xarray as xr
from landlab import RasterModelGrid
from landlab.data_record import DataRecord
from landlab import imshow_grid
import matplotlib.pyplot as plt
from matplotlib.pyplot import plot, subplot, xlabel, ylabel, title, legend, figure
%matplotlib inline
"""
Explanation: <a href="http://... |
GoogleCloudPlatform/ml-design-patterns | 06_reproducibility/storm_reports/similar_reports.ipynb | apache-2.0 | %pip install -q google-cloud-bigquery-storage pyarrow==0.16 tfx
## CHANGE AS NEEDED
BEAM_RUNNER = 'DirectRunner' # or DataflowRunner
PROJECT='ai-analytics-solutions'
BUCKET='ai-analytics-solutions-kfpdemo'
REGION='us-west1'
"""
Explanation: Find similar storm reports
This notebook shows a TFX pipeline that does a se... |
bhargavvader/gensim | docs/notebooks/word2vec.ipynb | lgpl-2.1 | # import modules & set up logging
import gensim, logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
sentences = [['first', 'sentence'], ['second', 'sentence']]
# train word2vec on the two sentences
model = gensim.models.Word2Vec(sentences, min_count=1)
"""
Explanation:... |
Jim00000/Numerical-Analysis | Projects/project_pi_calculation_monte_carlo.ipynb | unlicense | # Import modules
import time
import math
import numpy as np
import scipy
import matplotlib.pyplot as plt
"""
Explanation: ★ Monte Carlo Simulation To Calculate PI ★
End of explanation
"""
def linear_congruential_generator(x, a, b, m):
x = (a * x + b) % m
u = x / m
return u, x, a, b, m
def stdrand(x):
... |
chrisfilo/fmri-analysis-vm | analysis/MVPA/RSA.ipynb | mit | import numpy
import nibabel
import os
from haxby_data import HaxbyData
from nilearn.input_data import NiftiMasker
%matplotlib inline
import matplotlib.pyplot as plt
import sklearn.manifold
import scipy.cluster.hierarchy
datadir='/Users/poldrack/data_unsynced/haxby/subj1'
print 'Using data from',datadir
haxbydata=Hax... |
chrisfilo/fmri-analysis-vm | analysis/connectivity/ConnectivitySimulations.ipynb | mit | import os,sys
import numpy
%matplotlib inline
import matplotlib.pyplot as plt
sys.path.insert(0,'../utils')
from mkdesign import create_design_singlecondition
from nipy.modalities.fmri.hemodynamic_models import spm_hrf,compute_regressor
from make_data import make_continuous_data
data=make_continuous_data(N=200)
prin... |
sdss/marvin | docs/sphinx/jupyter/my-first-query.ipynb | bsd-3-clause | # Python 2/3 compatibility
from __future__ import print_function, division, absolute_import
from marvin import config
config.setRelease('MPL-4')
from marvin.tools.query import Query
"""
Explanation: My First Query
One of the most powerful features of Marvin 2.0 is ability to query the newly created DRP and DAP datab... |
mne-tools/mne-tools.github.io | 0.19/_downloads/2784a8d5822ed9797c0330f973573c10/plot_stats_cluster_erp.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import ttest_ind
import mne
from mne.channels import find_ch_connectivity, make_1020_channel_selections
from mne.stats import spatio_temporal_cluster_test
np.random.seed(0)
# Load the data
path = mne.datasets.kiloword.data_path() + '/kword_metadata-... |
macks22/gensim | docs/notebooks/lda_training_tips.ipynb | lgpl-2.1 | # Read data.
import os
# Folder containing all NIPS papers.
data_dir = 'nipstxt/'
# Folders containin individual NIPS papers.
yrs = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
dirs = ['nips' + yr for yr in yrs]
# Read all texts into a list.
docs = []
for yr_dir in dirs:
files ... |
sangheestyle/ml2015project | howto/read_data.ipynb | mit | import csv
import yaml
reader = csv.reader(open("../data/questions.csv"))
"""
Explanation: Here, I will show you how to read questions.csv file. Let's do it.
Read csv formatted file without header
First above all, you need to import csv and yaml then read the csv formatted file.
End of explanation
"""
question_1 = ... |
KitwareMedical/ITKTubeTK | examples/TubeNumPyArrayAndPropertyHistograms.ipynb | apache-2.0 | import os
import sys
from _tubetk_numpy import tubes_from_file
tubes = tubes_from_file("data/Normal071-VascularNetwork.tre")
"""
Explanation: This notebook illustrates the TubeTK tube NumPy array data structure and how to create histograms of the properties of a VesselTube.
First, import the function for reading a t... |
NuGrid/NuPyCEE | regression_tests/temp/SYGMA_DTD.ipynb | bsd-3-clause | %pylab nbagg
import sygma as s
reload(s)
s.__file__
from scipy.integrate import quad
from scipy.interpolate import UnivariateSpline
import numpy as np
"""
Explanation: Input parameter for the DTDs.
Check different input for the SNIa DTD.
$\odot$ Power law & Maoz
$\odot$ Gaussian
$\odot$ Exponential
End of explanation
... |
poppy-project/community-notebooks | tutorials-education/poppy-humanoid_poppy-torso__vrep_installation et prise en main/poppy simulé/Ergo_simulation prise en main.ipynb | lgpl-3.0 | from poppy_ergo_jr import PoppyErgoJr
creature = PoppyErgoJr(simulator='vrep')
"""
Explanation: <img src="png/poppy.png" HEIGHT=200 WIDTH=200 ALIGN=right>
<img src="png/inria.jpg" HEIGHT=150 WIDTH=325 ALIGN=left >
Premiers pas avec une créature
8 choses à savoir sur Ergo_Jr
Ouvrir l'interface
Instancier Ergo_Jr (déma... |
ShubhamDebnath/Coursera-Machine-Learning | Course 4/Face Recognition for the Happy House v3.ipynb | mit | from keras.models import Sequential
from keras.layers import Conv2D, ZeroPadding2D, Activation, Input, concatenate
from keras.models import Model
from keras.layers.normalization import BatchNormalization
from keras.layers.pooling import MaxPooling2D, AveragePooling2D
from keras.layers.merge import Concatenate
from kera... |
zhouqifanbdh/liupengyuan.github.io | chapter2/homework/localization/4-5/201611680085(2017.4.11).ipynb | mit | m=int(input('请输入数字下界,按回车键结束'))
k=int(input('请输入数字上界,按回车键结束'))
n=int(input('请输入数字个数'))
i=0
import random
while i<n:
number=random.randint(m,k)
i+=1
print(number)
total=number+number+number
print((total/n)**(1/2))
"""
Explanation: 练习 1:写函数,求n个随机整数均值的平方根,整数范围在m与k之间(n,m,k由用户输入)。
End of explanation
"""
m=int(... |
pylablanche/MillionSong | Exploration_of_data_in_MillionMusicSubset.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import sqlite3
import h5py as h5
%matplotlib inline
plt.rcParams['figure.figsize'] = (8,6)
sns.set_palette('Dark2')
sns.set_style('whitegrid')
path_to_data = '../MillionSongSubset/'
"""
Explanation: Required imports
End of e... |
danresende/deep-learning | sentiment_network/.ipynb_checkpoints/Sentiment Classification - Project 3 Solution-checkpoint.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
nvoron23/word2vec | examples/word2vec.ipynb | apache-2.0 | import word2vec
"""
Explanation: word2vec
This notebook is equivalent to demo-word.sh, demo-analogy.sh, demo-phrases.sh and demo-classes.sh from Google.
Training
Download some data, for example: http://mattmahoney.net/dc/text8.zip
End of explanation
"""
word2vec.word2phrase('/Users/drodriguez/Downloads/text8', '/Use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.