repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
google/spectral-density | tf2/Lanczos_example.ipynb | apache-2.0 | import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
from matplotlib import pyplot as plt
import seaborn as sns
tf.enable_v2_behavior()
import lanczos_algorithm
num_samples = 50
num_features = 16
X = tf.random.normal([num_samples, num_features])
y = tf.random.normal([num_samples])
"""
Explanation: Ap... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160516월_3일차_기초 선형 대수 1 - 행렬의 정의와 연산 Basic Linear Algebra(NumPy)/3.NumPy 연산.ipynb | mit | x = np.arange(1, 101)
x
y = np.arange(101, 201)
y
%%time
z = np.zeros_like(x)
for i, (xi, yi) in enumerate(zip(x, y)):
z[i] = xi + yi
z
z
"""
Explanation: NumPy 연산
벡터화 연산
NumPy는 코드를 간단하게 만들고 계산 속도를 빠르게 하기 위한 벡터화 연산(vectorized operation)을 지원한다. 벡터화 연산이란 반복문(loop)을 사용하지 않고 선형 대수의 벡터 혹은 행렬 연산과 유사한 코드를 사용하는 것을 말한다... |
NAU-CFL/Python_Learning_Source | 04_Control_Structures_Lecture.ipynb | mit | num = 10 # Assignment Operator
num == 12 # Comparison operator
"""
Explanation: Control Structures
A control statement is a statement that determines the control flow of a set of instructions.
Sequence control is an implicit form of control in which instructions are executed in the order that they are written.
Selecti... |
ocelot-collab/ocelot | demos/ipython_tutorials/5_CSR.ipynb | gpl-3.0 | # the output of plotting commands is displayed inline within frontends,
# directly below the code cell that produced it
from time import time
# this python library provides generic shallow (copy) and deep copy (deepcopy) operations
from copy import deepcopy
# import from Ocelot main modules and functions
from ocel... |
datapolitan/lede_algorithms | class6_1/cluster_crime.ipynb | gpl-2.0 | data = list(csv.DictReader(open('data/columbia_crime.csv', 'r').readlines()))
# This part just splits out the latitude and longitude coordinate fields for each incident, which we need for mapping.
coords = [(float(d['lat']), float(d['lng'])) for d in data if len(d['lat']) > 0]
print coords[:10]
# And this creates a m... |
bhermanmit/openmc | docs/source/examples/mgxs-part-iii.ipynb | mit | import math
import pickle
from IPython.display import Image
import matplotlib.pyplot as plt
import numpy as np
import openmc
import openmc.mgxs
from openmc.openmoc_compatible import get_openmoc_geometry
import openmoc
import openmoc.process
from openmoc.materialize import load_openmc_mgxs_lib
%matplotlib inline
"""... |
GoogleCloudPlatform/training-data-analyst | CPB100/lab4c/mlapis.ipynb | apache-2.0 | # Use the chown command to change the ownership of repository to user
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
APIKEY="CHANGE-THIS-KEY" # Replace with your API key
"""
Explanation: <h1> Using Machine Learning APIs </h1>
First, visit <a href="http://console.cloud.google.com/apis">API consol... |
Smith42/neuralnet-mcg | CNNs/MCG-ProcessData-3D.ipynb | gpl-3.0 | k = 1 # How many folds in the k-fold x-validation
## I used this to save the array in a smaller file so it doesn't eat all my ram
# df60 = pd.read_pickle("./inData/6060DF_MFMts.pkl")
# coilData = df60["MFMts"].as_matrix()
# ziData = np.zeros([400,2000,19,17])
#
# for i in np.arange(400):
# for j in np.arange(2000):... |
mathnathan/notebooks | Linear vs Nonlinear Least Squares.ipynb | mit | #%matplotlib inline
import matplotlib.pyplot as plt
plt.scatter((1,2,2.5), (2,1,2)); plt.xlim((0,3)); plt.ylim((0,3));
"""
Explanation: Linear Least Squares
This is the most common form of linear regression. Let's look at a concrete example...
Let us assume we would like to fit a line to the following three points
$${... |
miti0/mosquito | notebooks/simple_reg_15_feat_sample.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
%matplotlib inline
df = pd.read_csv('simple_reg_15_feat_sample.csv')
df = df.drop(df.columns[[0]], axis=1)
df = df.reset_index(drop=True)
print('data-shape:', df.shape)
df.head()
"""
Explanation: Simple case for regression prediction currency data blueprint
Author: miti0
Da... |
atcemgil/notes | swe582-regression.ipynb | mit | import scipy.linalg as la
LL = np.zeros(N)
for rr in range(N):
ss = s*np.ones(N)
ss[rr] = q
D_r = np.diag(1/ss)
V_r = np.dot(np.sqrt(D_r), W)
b = y/np.sqrt(ss)
a_r,re,ra, cond = la.lstsq(V_r, b)
e = (y-np.dot(W, a_r))/np.sqrt(ss)
LL[rr] = -0.5*np.dot(e.T, e)
print(LL[rr])
#plt.pl... |
kimmintae/MNIST | MNIST Competition/mnist_competition.ipynb | mit | mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# test data
test_images = mnist.test.images.reshape(10000, 28, 28, 1)
test_labels = mnist.test.labels[:]
"""
Explanation: Load MNIST Data
End of explanation
"""
augmentation_size = 110000
images = np.concatenate((mnist.train.images.reshape(55000, 28, 28,... |
jmschrei/pomegranate | examples/bayesnet_huge_monty_hall.ipynb | mit | import math
from pomegranate import *
"""
Explanation: Huge Monty Hall Bayesian Network
authors:<br>
Jacob Schreiber [<a href="mailto:jmschreiber91@gmail.com">jmschreiber91@gmail.com</a>]<br>
Nicholas Farn [<a href="mailto:nicholasfarn@gmail.com">nicholasfarn@gmail.com</a>]
Lets expand the Bayesian network for the mon... |
napsternxg/DataMiningPython | Check installs.ipynb | gpl-3.0 | plt.plot(x,y, marker="o", color="r", label="demo")
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.title("Demo plot")
plt.legend()
"""
Explanation: Matplotlib checks
More details at: http://matplotlib.org/users/pyplot_tutorial.html
End of explanation
"""
df = pd.DataFrame()
df["X"] = x
df["Y"] = y
df["G"] = np.random.... |
pastas/pasta | examples/notebooks/14_timestep_analysis.ipynb | mit | import pandas as pd
import pastas as ps
import matplotlib.pyplot as plt
ps.set_log_level("ERROR")
ps.show_versions(numba=True, lmfit=True)
"""
Explanation: Reducing Autocorrelation
R.A. Collenteur, University of Graz
In this notebook we look at two strategies that may help to reduce the autocorrelation in the noise, ... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.0 || pip install tensorflow==2.0
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
print(tf.__version__)
"""
Explanation: Getting started with TensorFlow
Learning Objectives
1. Practice defining an... |
quoniammm/mine-tensorflow-examples | assignment/cs231n_assignment/assignment2/FullyConnectedNets.ipynb | mit | # As usual, a bit of setup
from __future__ import print_function
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solv... |
TiKeil/Master-thesis-LOD | notebooks/Figure_7.2_Perturbations.ipynb | apache-2.0 | import os
import sys
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
from visualize import drawCoefficient, ExtradrawCoefficient
import buildcoef2d
bg = 0.05 #background
val = 1 #values
NWorldFine = np.array([42, 42])
CoefClass = buildcoef2d.Coefficient2d(NWorldFine,
... |
WillenZh/deep-learning-project | tutorials/autoencoder/Convolutional_Autoencoder.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)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
sz2472/foundations-homework | 07 - Introduction to Pandas (complete).ipynb | mit | # import pandas, but call it pd. Why? Because that's What People Do.
import pandas as pd
"""
Explanation: An Introduction to pandas
Pandas! They are adorable animals. You might think they are the worst animal ever but that is not true. You might sometimes think pandas is the worst library every, and that is only kind ... |
leliel12/scikit-otree | tutorial.ipynb | mit | import skotree
skotree.VERSION
"""
Explanation: Scikit-oTree Tutorial
Welcome to the Scikit-oTree tutorial. This package aims to integrate
any experiment developed on-top of oTree, with the
Python Scientific-Stack; alowing
the scientists to access a big collection of tools for analyse the
experimental data.
End of ex... |
mne-tools/mne-tools.github.io | 0.17/_downloads/62cc7f00e993cd712f75bc4ad788e028/plot_artifacts_correction_maxwell_filtering.ipynb | bsd-3-clause | import mne
from mne.preprocessing import maxwell_filter
data_path = mne.datasets.sample.data_path()
"""
Explanation: Artifact correction with Maxwell filter
This tutorial shows how to clean MEG data with Maxwell filtering.
Maxwell filtering in MNE can be used to suppress sources of external
interference and compensat... |
MingChen0919/learning-apache-spark | notebooks/02-data-manipulation/2.7.2-dot-column-expression.ipynb | mit | mtcars = spark.read.csv('../../../data/mtcars.csv', inferSchema=True, header=True)
mtcars = mtcars.withColumnRenamed('_c0', 'model')
mtcars.show(5)
"""
Explanation: Example data
End of explanation
"""
mpg_col_exp = mtcars.mpg
mpg_col_exp
mtcars.select(mpg_col_exp).show(5)
"""
Explanation: Dot (.) column expression... |
mdeff/ntds_2016 | algorithms/08_sol_graph_inpainting.ipynb | mit | import numpy as np
import scipy.io
import matplotlib.pyplot as plt
%matplotlib inline
import os.path
X = scipy.io.mmread(os.path.join('datasets', 'graph_inpainting', 'embedding.mtx'))
W = scipy.io.mmread(os.path.join('datasets', 'graph_inpainting', 'graph.mtx'))
N = W.shape[0]
print('N = |V| = {}, k|V| < |E| = {}'.fo... |
Kaggle/learntools | notebooks/computer_vision/raw/tut6.ipynb | apache-2.0 | #$HIDE_INPUT$
# Imports
import os, warnings
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing import image_dataset_from_directory
# Reproducability
def set_seed(seed=31415):
np.random.seed(seed)
tf.random.set_seed(see... |
allanko/media-word-contagion | mediacloud-sandbox.ipynb | mit | # this api call takes a minute or two, but you should only need to do this once.
network = mc.topicMediaMap(topic_id)
with open('network.gexf', 'wb') as f:
f.write(network)
# if you've already generated network.gexf, run this cell to import it
with open('network.gexf', 'r') as f:
network = f.read()
"""
Exp... |
solvebio/solvebio-python | examples/global_beacon_indexing.ipynb | mit | # Importing SolveBio library
from solvebio import login
from solvebio import Object
# Logging to SolveBio
login()
"""
Explanation: Global Beacon
Global Beacon lets anyone in your organization find datasets based on the entities it contains (i.e. variants, genets, targets).
Note: Only datasets that contain entities c... |
noppanit/machine-learning | parking-signs-nyc/Parking Signs.ipynb | mit | row = 'NO PARKING (SANITATION BROOM SYMBOL) 7AM-7:30AM EXCEPT SUNDAY'
assert from_time(row) == '07:00AM'
assert to_time(row) == '07:30AM'
special_case1 = 'NO PARKING (SANITATION BROOM SYMBOL) 11:30AM TO 1PM THURS'
assert from_time(special_case1) == '11:30AM'
assert to_time(special_case1) == '01:00PM'
special_case2 = ... |
GoogleCloudPlatform/analytics-componentized-patterns | retail/recommendation-system/bqml-scann/05_deploy_lookup_and_scann_caip.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
"""
Explanation: Part 5: Deploy the solution to AI Platform Prediction
This notebook is the fifth of five notebooks that guide you through running the Real-time Item-to-item Recommendation with BigQuery ML Matrix Factorization and ScaNN solution.
Use this notebook to complete... |
tensorflow/docs-l10n | site/ja/probability/examples/Learnable_Distributions_Zoo.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... |
ShyamSS-95/Bolt | example_problems/nonrelativistic_boltzmann/quick_start/tutorial.ipynb | gpl-3.0 | # Importing problem specific modules:
import boundary_conditions
import domain
import params
import initialize
!cat boundary_conditions.py
"""
Explanation: Introduction To Bolt
Hello! This is an intro to $\texttt{Bolt}$ to help you understand the structure of the framework. This way you'll hit the hit the ground runn... |
mne-tools/mne-tools.github.io | 0.17/_downloads/4457f1e38b5fa0853b9fa024b11fe018/plot_artifacts_detection.ipynb | bsd-3-clause | import numpy as np
import mne
from mne.datasets import sample
from mne.preprocessing import create_ecg_epochs, create_eog_epochs
# getting some data ready
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True)
"""
Explanation: In... |
Caranarq/01_Dmine | Datasets/CNGMD/2015.ipynb | gpl-3.0 | descripciones = {
'P0306' : 'Programas de modernización catastral',
'P0307' : 'Disposiciones normativas sustantivas en materia de desarrollo urbano u ordenamiento territorial',
'P1001' : 'Promedio diario de RSU recolectados',
'P1003' : 'Número de municipios con disponibilidad de servicios relacionados con los RSU',
'P1... |
afedynitch/MCEq | examples/Compare_primary_fluxes.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
#import solver related modules
from MCEq.core import MCEqRun
import mceq_config as config
#import primary model choices
import crflux.models as pm
"""
Explanation: Dependence on primary cosmic ray flux
End of explanation
"""
mceq_run = MCEqRun(
#provide the string ... |
ds-hwang/deeplearning_udacity | udacity_notebook/1_notmnist.ipynb | mit | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
me-surrey/dl-gym | .ipynb_checkpoints/10_introduction_to_artificial_neural_networks-checkpoint.ipynb | apache-2.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
# to make this notebook's output stable across runs
def reset_graph(seed=42):
tf.reset_default_graph()
tf.set_random_seed(seed)
np.random.seed(seed)
# To... |
ellisztamas/faps | docs/tutorials/.ipynb_checkpoints/03_paternity_arrays-checkpoint.ipynb | mit | import faps as fp
import numpy as np
print("Created using FAPS version {}.".format(fp.__version__))
"""
Explanation: Paternity arrays
Tom Ellis, March 2017, updated June 2020
End of explanation
"""
np.random.seed(27) # this ensures you get exactly the same answers as I do.
allele_freqs = np.random.uniform(0.3,0.5, 5... |
Unidata/unidata-python-workshop | notebooks/Skew_T/SkewT_and_Hodograph.ipynb | mit | # Create a datetime for our request - notice the times are from laregest (year) to smallest (hour)
from datetime import datetime
request_time = datetime(1999, 5, 3, 12)
# Store the station name in a variable for flexibility and clarity
station = 'OUN'
# Import the Wyoming simple web service and request the data
# Don... |
tensorflow/docs-l10n | site/ja/tutorials/text/text_classification_rnn.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
csdms/coupling | docs/demos/cem.ipynb | mit | %matplotlib inline
"""
Explanation: <img src="../_static/pymt-logo-header-text.png">
Coastline Evolution Model
Link to this notebook: https://github.com/csdms/pymt/blob/master/docs/demos/cem.ipynb
Install command: $ conda install notebook pymt_cem
Download local copy of notebook:
$ curl -O https://raw.githubusercont... |
mathinmse/mathinmse.github.io | Lecture-14-Ordinary-Differential-Equations.ipynb | mit | %matplotlib notebook
import sympy as sp
# can also run quietly using:
#sp.init_session(quiet=True)
# set up some common symbols and report back to the user.
sp.init_session()
"""
Explanation: Lecture 14: Solutions to Ordinary Differential Equations and Viscoelasticity
Background
What are differential equations? ... |
facaiy/book_notes | Mining_of_Massive_Datasets/Advertising_on_the_Web/note.ipynb | cc0-1.0 | # exerices for section 8.1
"""
Explanation: 8 Advertising on the Web
"adwords" model, search
"collaborative filtering", suggestion
8.1 Issues in On-Line Advertising
8.1.1 Advertising Opportunities
Auto trading sites allow advertisters to post their ads directly on the website.
Display ads are placed o... |
moble/MatchedFiltering | GW150914/HybridizeNR.ipynb | mit | 16.4 / ((36.+29.) * m_sun)
"""
Explanation: We need about 16.4 seconds of data, after we scale the system to (36+29=) $65\, M_{\odot}$. In terms of $M$ as we know it, that's about...
End of explanation
"""
metadata = read_metadata_into_object(data_dir + '/metadata.txt')
m1 = metadata.relaxed_mass1
m2 = metadata.re... |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_parcellation.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from surfer import Brain
import mne
subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
verbose=True)
labels = mne.read_label... |
danecollins/pyawr | awr_nb/basic_awrde_connection.ipynb | mit | # import com library
import win32com.client
"""
Explanation: Working with AWR Design Environment
This notebook shows how to connect to AWRDE and retrieve data from a simulation.
Setup
To communicate with COM enabled Windows applications we must import the com interface library using the raw win32com connection.
End of... |
xianjunzhengbackup/code | IoT/Basic_dweet_cloud.ipynb | mit | payload={'Temperature':'28.1'}
req=requests.get('https://dweet.io/dweet/for/JunTest1?',params=payload)
print(req.content)
"""
Explanation: dweet.io is a simple cloud which could accept data via requests.
End of explanation
"""
import dweepy
data={'Temperature':'29.1'}
dweepy.dweet_for('JunTest1', data)
"""
Expl... |
DJCordhose/ai | notebooks/tf2/fashion-mnist-resnet.ipynb | mit | !pip install -q tf-nightly-gpu-2.0-preview
import tensorflow as tf
print(tf.__version__)
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()
x_train.shape
import numpy as np
# add empty color dimension
x_train = np.expand_dims(x_train, -1)
x_test = np.expand_dims(x_test, -1)
x_train... |
google/compass | packages/propensity/09.audience_upload.ipynb | apache-2.0 | # Add custom utils module to Python environment
import os
import sys
sys.path.append(os.path.abspath(os.pardir))
from IPython import display
from utils import helpers
"""
Explanation: 9. Audience Upload to GMP
GMP and Google Ads Connector is used to upload audience data to GMP (e.g. Google Analytics, Campaign Manage... |
nsrchemie/code_guild | wk1/notebooks/wk1.4.ipynb | mit | # How to make a set
a = {1, 2, 3}
type(a)
# Getting a set from a list
b = set([1, 2, 3])
a == b
# How to make a frozen set
a = frozenset({1, 2, 3})
# Getting a set from a list
b = frozenset([1, 2, 3])
# Getting a set from a string
set("obtuse")
# Getting a set from a dictionary
c = set({'a':1, 'b':2})
type(c... |
Bismarrck/deep-learning | sentiment-rnn/Sentiment_RNN.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
Raag079/self-driving-car | Term01-Computer-Vision-and-Deep-Learning/Labs/03-CarND-LeNet-Lab/.ipynb_checkpoints/LeNet-Lab-Solution-checkpoint.ipynb | mit | from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", reshape=False)
X_train, y_train = mnist.train.images, mnist.train.labels
X_validation, y_validation = mnist.validation.images, mnist.validation.labels
X_test, y_test = mnist.test.images, mn... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/LSTM_IMDB_Sentiment_Example.ipynb | apache-2.0 | # keras.datasets.imdb is broken in TensorFlow 1.13 and 1.14 due to numpy 1.16.3
!pip install numpy==1.16.2
# All the imports!
import tensorflow as tf
import numpy as np
from tensorflow.keras.preprocessing import sequence
from numpy import array
# Supress deprecation warnings
import logging
logging.getLogger('tensorf... |
yy/dviz-course | m10-logscale/m10-lab.ipynb | mit | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
import scipy.stats as ss
import vega_datasets
"""
Explanation: Module 10: Logscale
End of explanation
"""
x = np.array([1, 1, 1, 1, 10, 100, 1000])
y = np.array([1000, 100, 10, 1, 1, 1, 1 ])
ratio = x/y
print(rati... |
peterwittek/qml-rg | Archiv_Session_Spring_2017/Exercises/11_Markov_random_field.ipynb | gpl-3.0 | from skimage import io
from skimage.transform import resize
from functools import reduce # To do multiple-argument multiplications
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
"""
Explanation: QML - RG Homework 11: Markov Random Fields
Alejandro Pozas-Kerstjens
End of explanation... |
nwjs/chromium.src | third_party/tensorflow-text/src/docs/tutorials/text_classification_rnn.ipynb | bsd-3-clause | #@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... |
SeismicPi/SeismicPi | Lessons/Lesson 2/Lesson 2.ipynb | mit | one_to_ten = [1,2,3,4,5,6,7,8,9,10]
print one_to_ten
"""
Explanation: Lesson 2
Analog to Digital
This lesson will cover how to convert analog values to digital values, how to log data and view the data over a time period.
If you remember from the last lesson, a lot of sensors are analog, meaning they can output values... |
bgroveben/python3_machine_learning_projects | learn_kaggle/machine_learning/data_leakage.ipynb | mit | import pandas as pd
data = pd.read_csv('input/credit_card_data.csv', true_values=['yes'], false_values=['no'])
data.head()
data.shape
"""
Explanation: Data Leakage
What is it?
Data leakage is one of the most important issues for a data scientist to understand.
If you don't know how to prevent it, leakage will come u... |
trangel/Data-Science | reinforcement_learning/experience_replay.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import clear_output
import pandas as pd
#XVFB will be launched if you run on a server
import os
if type(os.environ.get("DISPLAY")) is not str or len(os.environ.get("DISPLAY")) == 0:
!bash ..... |
shngli/Data-Mining-Python | Mining massive datasets/algorithms.ipynb | gpl-3.0 | from math import e
"""
Explanation: Generalized BALANCE algorithm
End of explanation
"""
psi = lambda x, f: x * (1 - e ** (-f))
xs = [1, 2, 3]
fs = [0.9, 0.5, 0.6]
print "If a query arrives that is bidded on by A and B"
for i in [0, 1]:
print psi(xs[i], fs[i])
print "If a query arrives that is bidded on by A ... |
mne-tools/mne-tools.github.io | dev/_downloads/9552276573be20bde95d1b4bc52b4768/20_event_arrays.ipynb | bsd-3-clause | import os
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
raw.crop(tmax=60).load_data()... |
jserenson/Python_Bootcamp | Statements Assessment Test.ipynb | gpl-3.0 | st = 'Print only the words that start with s in this sentence'
#Code here
st = 'Print only the words that start with s in this sentence'
for word in st.split():
if word[0] == 's':
print(word )
"""
Explanation: Statements Assessment Test
Lets test your knowledge!
Use for, split(), and if to create a State... |
tpin3694/tpin3694.github.io | machine-learning/calibrate_predicted_probabilities_in_svc.ipynb | mit | # Load libraries
from sklearn.svm import SVC
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
import numpy as np
"""
Explanation: Title: Calibrate Predicted Probabilities In SVC
Slug: calibrate_predicted_probabilities_in_svc
Summary: How to calibrate predicted probabilities in support v... |
fierval/retina | Notebooks/Unused/CicrularCrop.ipynb | mit | import os
import skimage
from skimage import io, util
from skimage.draw import circle
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import math
"""
Explanation: Experiments with Crop Improvements
This notebook experiments advances in image cropping. This performs the following steps
determine ... |
tensorflow/docs-l10n | site/ko/tutorials/images/transfer_learning.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... |
schoolie/bokeh | examples/howto/charts/bar.ipynb | bsd-3-clause | df['neg_mpg'] = 0 - df['mpg']
"""
Explanation: Calculate some negative values to show handling of them
End of explanation
"""
defaults.width = 550
defaults.height = 400
"""
Explanation: Override some default values to avoid requiring input on each chart
End of explanation
"""
bar_plot = Bar(df, label='cyl', title... |
tkphd/pycalphad | examples/BinaryExamples.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from pycalphad import Database, binplot
import pycalphad.variables as v
# Load database and choose the phases that will be considered
db_alzn = Database('alzn_mey.tdb')
my_phases_alzn = ['LIQUID', 'FCC_A1', 'HCP_A3']
# Create a matplotlib Figure object and get the ac... |
tensorflow/text | docs/tutorials/nmt_with_attention.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... |
rhancockn/MRS | ipynb/003-aligning-with-anatomy.ipynb | mit | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
import os.path as op
import nibabel as nib
import MRS.data as mrd
import IPython.html.widgets as wdg
import IPython.display as display
mrs_nifti = nib.load(op.join(mrd.data_folder, '12_1_PROBE_MEGA_L_Occ.nii.gz'))
t1_nifti = nib.... |
SeismicPi/SeismicPi | Lessons/Lesson 3/Lesson 3.ipynb | mit | def double(x):
return(2*x);
"""
Explanation: Lesson 3
This lesson will review linear equations, briefly discuss kinematics and see how we can write functions in python to reuse code.
Linear Equations
Recall the definition of a line is $y(x) = mx + c$. Where $m$ is the slope of the line and $c$ is the y-intercept. ... |
tensorflow/docs-l10n | site/zh-cn/neural_structured_learning/tutorials/graph_keras_lstm_imdb.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... |
setiQuest/ML4SETI | tutorials/General_move_data_to_from_Nimbix_Cloud.ipynb | apache-2.0 | #!pip install --user pysftp
#restart your kernel
import pysftp
"""
Explanation: How to move data to/from your Nimbix Cloud machine.
This tutorial shows you how to use the pysftp client to move data to/from your Nimbix cloud machine.
This will be especially useful for moving data between your IBM Apache Spark servic... |
EnSpec/SpecDAL | specdal/examples/process_collection.ipynb | mit | import os
datadir = "/home/young/data/specdal/aidan_data2/ASD/"
c = Collection(name='myFirst')
for f in sorted(os.listdir(datadir))[1:11]:
spectrum = Spectrum(filepath=os.path.join(datadir, f))
c.append(spectrum)
"""
Explanation: Processing a Collection of spectra
SpecDAL provides Collection class for processi... |
sisnkemp/deep-learning | embeddings/Skip-Gram_word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
gabrielcs/nyc-subway-canvass | stations-location-cleaning.ipynb | mit | import pandas as pd
stations = pd.read_csv('data/DOITT_SUBWAY_STATION_01_13SEPT2010.csv')
stations.head(4)
"""
Explanation: MTA Subway Stations dataset cleaning
In this notebook we will clean the Subway Stations dataset made available by MTA.
Let's start by opening and examining it.
End of explanation
"""
import co... |
pdonorio/nbpydata-n-slides | slides/myslides.ipynb | mit | a = "Hello"
b = "World"
print a,b + "!"
"""
Explanation: Hello world
(press space)
This is how you do slides with ipython notebooks!
Formatting is simple, with markdown
...your python love will help you...
End of explanation
"""
# Please consider also that you can re-use
# variables defined in older slides ;)
print... |
jonathf/chaospy | docs/user_guide/main_usage/point_collocation.ipynb | mit | from pseudo_spectral_projection import gauss_quads
gauss_nodes = [nodes for nodes, _ in gauss_quads]
"""
Explanation: Point collocation
Point collection method is a broad term, as it covers multiple variation, but
in a nutshell all consist of the following steps:
Generate samples $Q_1=(\alpha_1, \beta_1), \dots, Q_N... |
gboeing/urban-data-science | modules/13-unsupervised-learning/lecture.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.cluster import hierarchy
from scipy.spatial.distance import pdist
from sklearn.cluster import DBSCAN, KMeans
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis... |
zingale/hydro_examples | compressible/euler-generaleos.ipynb | bsd-3-clause | from sympy import init_session
init_session()
from sympy.abc import rho, tau, alpha
rho, tau, c, h, p = symbols("rho tau c h p", real=True, positive=True)
re = symbols(r"(\rho{}e)", real=True, positive=True)
ge = symbols(r"\gamma_e", real=True, positive=True)
alpha, u = symbols("alpha u", real=True)
"""
Explanation: ... |
epifanio/CesiumWidget | Examples/CesiumWidget Example KML.ipynb | apache-2.0 | from CesiumWidget import CesiumWidget
from IPython import display
import numpy as np
"""
Explanation: Cesium Widget Example KML
If the installation of Cesiumjs is ok, it should be reachable here:
http://localhost:8888/nbextensions/CesiumWidget/cesium/index.html
End of explanation
"""
cesium = CesiumWidget()
"""
Exp... |
google/picatrix | notebooks/adding_magic.ipynb | apache-2.0 | #@title Only execute if you are connecting to a hosted kernel
!pip install picatrix
from picatrix.lib import framework
from picatrix.lib import utils
# This should not be included in the magic definition file, only used
# in this notebook since we are comparing all magic registration.
from picatrix import notebook_in... |
feststelltaste/software-analytics | prototypes/_archive/Production Coverage Demo Notebook PowerPoint.ipynb | gpl-3.0 | import pandas as pd
coverage = pd.read_csv("../input/spring-petclinic/jacoco.csv")
coverage = coverage[['PACKAGE', 'CLASS', 'LINE_COVERED' ,'LINE_MISSED']]
coverage['LINES'] = coverage.LINE_COVERED + coverage.LINE_MISSED
coverage.head(1)
"""
Explanation: Context
John Doe remarked in #AP1432 that there may be too much ... |
weichetaru/weichetaru.github.com | notebook/machine-learning/deep_learning-logistic-regression-gradient-decent.ipynb | mit | import numpy as np # Matrix and vector computation package
np.seterr(all='ignore') # ignore numpy warning like multiplication of inf
import matplotlib.pyplot as plt # Plotting library
from matplotlib.colors import colorConverter, ListedColormap # some plotting functions
from matplotlib import cm # Colormaps
# Allow ma... |
gpagliuca/pyfas | docs/notebooks/Tab_files.ipynb | gpl-3.0 | tab_path = '../../pyfas/test/test_files/'
fname = '3P_single-fluid_key.tab'
tab = fa.Tab(tab_path+fname)
"""
Explanation: Tab files
A tab file contains thermodynamic properties pre-calculated by a thermodynamic simulator like PVTsim. It is good practice to analyze these text files before using them. Unfortunately ther... |
hchauvet/beampy | doc-src/auto_tutorials/positioning_system.ipynb | gpl-3.0 | from beampy import *
from beampy.utils import bounding_box, draw_axes
doc = document(quiet=True)
with slide():
draw_axes(show_ticks=True)
t1 = text('This is the default theme behaviour')
t2 = text('x are centered and y equally spaced')
for t in [t1, t2]:
t.add_border()
display_matplotlib(gcs... |
winpython/winpython_afterdoc | docs/installing_R.ipynb | mit | import os
import sys
import io
# downloading R may takes a few minutes (80Mo)
try:
import urllib.request as urllib2 # Python 3
except:
import urllib2 # Python 2
# specify R binary and (md5, sha1) hash
# R-3.6.1:
r_url = "https://cran.r-project.org/bin/windows/base/old/3.6.1/R-3.6.1-win.exe"
hashes=("f6ca2ec... |
ajhenrikson/phys202-2015-work | assignments/assignment06/ProjectEuler17.ipynb | mit | def number_to_words(n):#pair programed with noah miller on this problem
"""Given a number n between 1-1000 inclusive return a list of words for the number."""
s=[]
o={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine'}
t={0:'ten',1:'eleven',2:'twelve',3:'thirteen',4:'fourte... |
mne-tools/mne-tools.github.io | 0.17/_downloads/01fb0f5b44af7b68840573c40d1eec05/plot_read_and_write_raw_data.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@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_raw.fif'
raw = mne.io.read_raw_fif(fname)
# Set up pick list: MEG + STI 014 - b... |
ricklupton/sankeyview | docs/tutorials/system-boundary.ipynb | mit | import pandas as pd
flows = pd.read_csv('simple_fruit_sales.csv')
from floweaver import *
# Set the default size to fit the documentation better.
size = dict(width=570, height=300)
# Same partitions as the Quickstart tutorial
farms_with_other = Partition.Simple('process', [
'farm1',
'farm2',
'farm3',
... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/td1a_correction_session7_edition.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
def dist_hamming(m1,m2):
d = 0
for a,b in zip(m1,m2):
if a != b :
d += 1
return d
dist_hamming("close", "cloue")
"""
Explanation: 1A.algo - La distance d'édition (correction)
Correction.
End of explanation
"""
def dist... |
cniedotus/Python_scrape | Python3_tutorial.ipynb | mit | width = 20
height = 5*9
width * height
"""
Explanation: <center> Python and MySQL tutorial </center>
<center> Author: Cheng Nie </center>
<center> Check chengnie.com for the most recent version </center>
<center> Current Version: Feb 18, 2016</center>
Python Setup
Since most students in this class use Windows 7, I wil... |
mne-tools/mne-tools.github.io | 0.17/_downloads/9794ea6d3b7fc21947e9529fb55249c9/plot_read_proj.ipynb | bsd-3-clause | # Author: Joan Massich <mailsik@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import read_proj
from mne.io import read_raw_fif
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
fname = data_path + '/MEG... |
tdeoskar/NLP1-2017 | lab1/lab1.ipynb | gpl-3.0 | ## YOUR CODE HERE ##
"""
Explanation: Lab 1: Text Corpora and Language Modelling
This lab is meant to help you get familiar with some language data, and use this data to estimate N-gram language models
First you will use the Penn Treebank, which is a collection of newspaper articles from the newspaper
The Wall Street... |
mespe/SolRad | collection/compare_cimis_cfsr/compare_before_after_clouds.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... |
hanhanwu/Hanhan_Data_Science_Practice | sequencial_analysis/try_poem_generator.ipynb | mit | import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import LSTM
from keras.layers import RNN
from keras.utils import np_utils
sample_poem = open('sample_sonnets.txt').read().lower()
sample_poem[77:99]
"""
Explanat... |
dhercher/state-farm | exploratory-analysis/dylan-explore-data.ipynb | mit | # Sample Data Raw
sample_df = pd.read_csv('../raw_data/sample_submission.csv')
print len(sample_df)
sample_df.head(1)
col_map = {
'c0' : 'safe driving',
'c1' : 'texting - right',
'c2' : 'talking on the phone - right',
'c3': 'texting - left',
'c4': 'talking on the phone - left',
'c5': 'operating... |
Cristianobam/UFABC | Unidade6-Atividades.ipynb | mit | import numpy as np
from math import pi
import matplotlib.pyplot as plot
%matplotlib notebook
x = np.arange(-5, 5.001, 0.0001)
y = (x**4)-(16*(x**2)) + 16
plot.plot(x,y,'c')
plot.grid(True)
"""
Explanation: Questão 1: Faça um gráfico da função $f(x) = x^4-16x^2+16$ para x de -5 a 5.
Coloque a grade.
Olhando para o ... |
muxiaobai/CourseExercises | python/kaggle/data-visual/plot&seaborn.ipynb | gpl-2.0 | sns.countplot(reviews['points'])
#reviews['points'].value_counts().sort_index().plot.bar()
plt.show()
sns.kdeplot(reviews.query('price < 200').price)
#reviews[reviews['price'] < 200]['price'].value_counts().sort_index().plot.line()
plt.show()
# 出现锯齿状
reviews[reviews['price'] < 200]['price'].value_counts().sort_index(... |
andymccurdy/redis-py | docs/examples/set_and_get_examples.ipynb | mit | import redis
r = redis.Redis(decode_responses=True)
r.ping()
"""
Explanation: Basic set and get operations
Start off by connecting to the redis server
To understand what decode_responses=True does, refer back to this document
End of explanation
"""
r.set("full_name", "john doe")
r.exists("full_name")
r.get("full... |
jamesfolberth/jupyterhub_AWS_deployment | notebooks/20Q/setup_sportsDataset.ipynb | bsd-3-clause | import csv
sports = [] # This is a python "list" data structure (it is "mutable")
# The file has a list of sports, one per line.
# There are spaces in some names, but no commas or weird punctuation
with open('data/SportsDataset_ListOfSports.csv','r') as csvfile:
myreader = csv.reader(csvfile)
for index, row in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.