repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Olsthoorn/TransientGroundwaterFlow | readthedocs/Course2016_jupyter/docs/source/DelayedYield.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import numpy as np
from scipy.special import expi, k0, k1 # exp. integral and two bessel functions
from wells import Wh # Hantush well function defined in module wells
def W(u): return -expi(-u) # Theis well function
Se = 1e-3
Sy = 1e-1
u = np.logspace(-5., 2., 81)
ue = u
uy = ue * Sy... |
h-mayorquin/time_series_basic | presentations/2015-10-27(Visualization of pre-generated images).ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.image as mpimg
# Widgets library
from ipywidgets import interact
%matplotlib inline
# We need to load all the files here
# Load the file
folder = '../results/'
name = 'parameter_swep_SLM-0.00-0.00-10.00.png'
file_name = fol... |
tpin3694/tpin3694.github.io | python/hard_wrapping_text.ipynb | mit | import textwrap
"""
Explanation: Title: Hard Wrapping Text
Slug: hard_wrapping_text
Summary: Hard Wrapping Text Using Python.
Date: 2017-02-02 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
Preliminaries
End of explanation
"""
# Create some text
excerpt = 'Then there was the bad weather. It would come in... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-mmh/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-mmh', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-MMH
Topic: Ocean
Sub-Topics: Timestepping Framework, Adv... |
isamu-isozaki/Machine-Learning | Machine learning Nanodegree/creating_customer_segments/customer_segments.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
import renders as rs
from IPython.display import display # Allows the use of display() for DataFrames
# Show matplotlib plots inline (nicely formatted in the notebook)
%matplotlib inline
# Load the wholesale customers dataset
try:
... |
sympy/scipy-2017-codegen-tutorial | notebooks/32-chemical-kinetics-symbolic-construction.ipynb | bsd-3-clause | reactions = [
# (coeff, r_stoich, net_stoich)
('k1', {'A': 1}, {'B': 1, 'A': -1}),
('k2', {'B': 1, 'C': 1}, {'A': 1, 'B': -1}),
('k3', {'B': 2}, {'B': -1, 'C': 1})
]
names = 'A B C'.split()
"""
Explanation: Symbolic representation of chemical kinetics
As we saw in the previous notebook, the rate of che... |
shreyas111/Multimedia_CS523_Project1 | Style_Transfer_Saving_Mixed_Image_Every_10_Iterations.ipynb | mit | from IPython.display import Image, display
Image('images/15_style_transfer_flowchart.png')
"""
Explanation: Style Transfer
Our Changes:
We are just saving the mixed image every 10 iterations.
End of explanation
"""
%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import P... |
georgetown-analytics/nba-tracking | Visual_Game/.ipynb_checkpoints/Game_iPython-checkpoint.ipynb | mit | #imports we will be needing
import os
import csv
import pandas as pd
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import random
import seaborn as sns
#for visuals
sns.set_color_codes()
sns.set_style("white")
#Setting default directory
os.chdir('C:\\Users\\Josh\\Documents... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/tensorflow/d_traineval.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.6
import tensorflow as tf
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: <h1> 2d. Distributed training and monitoring </h1>
In this notebook, we refactor to call train_and_evaluate instead of hand-coding ... |
PyLCARS/PythonUberHDL | PYNQLearn/FabricOnly/.ipynb_checkpoints/myHDL_PYNQZ12_FabricOnly-checkpoint.ipynb | bsd-3-clause | from myhdl import *
from myhdlpeek import Peeker
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from sympy import *
init_printing()
import random
#https://github.com/jrjohansson/version_information
%load_ext version_information
%version_information myhdl, myhdlpeek, numpy, ... |
GoogleCloudPlatform/cloud-sql-python-connector | samples/notebooks/sqlserver_python_connector.ipynb | apache-2.0 | from google.colab import auth
auth.authenticate_user()
"""
Explanation: Connect to Cloud SQL using the Cloud SQL Python Connector
This notebook will be demonstrating how to connect and query data from a Cloud SQL database in an easy and efficient way all from within a jupyter style notebook! Let's have some fun!
📒 ... |
Flaviolib/dx | 13_dx_quite_complex_portfolios.ipynb | agpl-3.0 | from dx import *
import time
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
%matplotlib inline
np.random.seed(10000)
"""
Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4">
Quite Complex Portfolios
This part illustrates that you can m... |
tpin3694/tpin3694.github.io | machine-learning/identifying_best_value_of_k.ipynb | mit | # Load libraries
from sklearn.neighbors import KNeighborsClassifier
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.model_selection import GridSearchCV
"""
Explanation: Title: Identifying Best Value Of k
Slug: identifying_be... |
afedynitch/MCEq | examples/Zenith_distribution_IceCube.ipynb | bsd-3-clause | #basic imports and jupyter setup
import matplotlib.pyplot as plt
import numpy as np
#import solver related modules
from MCEq.core import MCEqRun
#import primary model choices
import crflux.models as pm
"""
Explanation: Zenith dependence of neutrino fluxes
This notebook demonstrates how to compute the zenith distribut... |
phasedchirp/Assorted-Data-Analysis | exercises/SlideRule-DS-Intensive/UD120/FeatureSelection.ipynb | gpl-2.0 | import pickle
import numpy
from sklearn import cross_validation
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.tree import DecisionTreeClassifier
numpy.random.seed(42)
words_file = "../text_learning/your_word_data.pkl"
authors_file = "../text_learning/your_email_authors.pkl"
word_data = pickle... |
mne-tools/mne-tools.github.io | 0.23/_downloads/9f8cb3957705df93f5da4fe6dc1bc69b/fnirs_artifact_removal.ipynb | bsd-3-clause | # Authors: Robert Luke <mail@robertluke.net>
#
# License: BSD (3-clause)
import os
import mne
from mne.preprocessing.nirs import (optical_density,
temporal_derivative_distribution_repair)
"""
Explanation: Visualise NIRS artifact correction methods
Here we artificially introduce se... |
Neuroglycerin/neukrill-net-work | notebooks/model_modifications/Tuning Learning Rate.ipynb | mit | import pylearn2.utils
import pylearn2.config
import theano
import neukrill_net.dense_dataset
import neukrill_net.utils
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import holoviews as hl
%load_ext holoviews.ipython
import sklearn.metrics
cd ..
settings = neukrill_net.utils.Settings("settings.... |
mitdbg/modeldb | demos/webinar-2020-5-6/01-ad_hoc/01-train/NLP training.ipynb | mit | !python -m spacy download en_core_web_sm
"""
Explanation: NLP training example
In this example, we'll train an NLP model for sentiment analysis of tweets using spaCy.
First we download spaCy language libraries.
End of explanation
"""
from __future__ import unicode_literals, print_function
import boto3
import json
i... |
kwinkunks/axb | NumPy_wavelets_with_noise.ipynb | apache-2.0 | import sys
sys.version
import numpy as np
np.__version__
import sklearn
sklearn.__version__
"""
Explanation: Linear inverse solutions in NumPy
An exploration of linear seismic inversion — considering the particular problem of getting reflectivity from a seismic trace, given the wavelet.
We'll be working on a model, ... |
mgalardini/2017_python_course | notebooks/5-Scripting.ipynb | gpl-2.0 | def parse_args(cmd_line):
Args = collections.namedtuple('Args',
['n', 'in_file'])
n_trigger = False
# default value for "n"
n = 1
for arg in cmd_line:
if n_trigger:
n = int(arg)
n_trigger = False
continue
if arg ==... |
amandersillinois/landlab | notebooks/tutorials/fields/working_with_fields.ipynb | mit | import numpy as np
from landlab import RasterModelGrid, FieldError
from landlab.components import LinearDiffuser
mg = RasterModelGrid((3, 4))
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a>
Understanding and working with Landlab data fields
<hr>
<small>... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/09_sequence_keras/word2vec.ipynb | apache-2.0 | # change these to try this notebook out
BUCKET = 'alexhanna-dev-ml'
PROJECT = 'alexhanna-dev'
REGION = 'us-central1'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
"""
Explanation: <h1> Creating a custom Word2Vec embedding on your data </h1>
This notebook illust... |
GoogleCloudPlatform/mlops-on-gcp | on_demand/tfx-caip/lab-02-tfx-pipeline/labs/lab-02.ipynb | apache-2.0 | import yaml
# Set `PATH` to include the directory containing TFX CLI and skaffold.
PATH=%env PATH
%env PATH=/home/jupyter/.local/bin:{PATH}
"""
Explanation: Continuous training with TFX and Google Cloud AI Platform
Learning Objectives
Use the TFX CLI to build a TFX pipeline.
Deploy a new TFX pipeline version with tu... |
facaiy/book_notes | deep_learning/Deep_Feedforward_Networks/note.ipynb | cc0-1.0 | show_image("fig6_2.png", figsize=(5, 8))
"""
Explanation: Chapter 6 Deep Feedforward Networks
feedforward: no feedback connections.
input layer -> hidden layers -> output layer
\begin{align}
y &= f(x; \theta) \approx f^*(x) \
&= W^T \phi(x) + b
\end{align}
how to choose the mapping $\phi$?
use a very generi... |
ivukotic/ML_platform_tests | tutorial/GAN handwriting/dcgan.ipynb | gpl-3.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... |
machinelearningnanodegree/stanford-cs231 | solutions/vijendra/assignment3/ImageGeneration.ipynb | mit | # As usual, a bit of setup
import time, os, json
import numpy as np
from scipy.misc import imread, imresize
import matplotlib.pyplot as plt
from cs231n.classifiers.pretrained_cnn import PretrainedCNN
from cs231n.data_utils import load_tiny_imagenet
from cs231n.image_utils import blur_image, deprocess_image, preproces... |
awjuliani/DeepRL-Agents | Contextual-Policy.ipynb | mit | import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
"""
Explanation: Simple Reinforcement Learning in Tensorflow Part 1.5:
The Contextual Bandits
This tutorial contains a simple example of how to build a policy-gradient based agent that can solve the contextual bandit problem. For more in... |
tensorflow/fairness-indicators | g3doc/tutorials/Fairness_Indicators_TFCO_CelebA_Case_Study.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... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/08_image/flowers_fromscratch.ipynb | apache-2.0 | import os
PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID
BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
MODEL_TYPE = "cnn"
# do not change these
os.environ["PROJECT"] = PROJECT
os.environ["BUCKET"] = BUCKET
o... |
leosartaj/scipy-2016-tutorial | tutorial_exercises/01-Symbols-Derivatives-Functions.ipynb | bsd-3-clause | from sympy import *
init_printing() # Set up fancy printing
import math
math.sqrt(2)
sqrt(2) # This `sqrt` comes from SymPy
cos(0)
"""
Explanation: Introduction
In this section we learn to do the following:
Import SymPy and set up pretty printing
Use mathematical operations like sqrt and sin
Make SymPy Symbols
T... |
NYUDataBootcamp/Projects | UG_S17/Chen-Zheng-SkyscraperIndex&Recession.ipynb | mit | %matplotlib inline
import pandas as pd # data package
import matplotlib.pyplot as plt # graphics module
import datetime as dt # date and time module
import numpy as np # foundation for Pandas
import xlwt # ... |
ethen8181/machine-learning | ga/ga.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', 'notebook_format'))
from formats import load_style
load_style(plot_style = False)
os.chdir(path)
import numpy as np
import pandas as pd
import matplotlib... |
RTHMaK/RPGOne | scipy-2017-sklearn-master/notebooks/05 Supervised Learning - Classification.ipynb | apache-2.0 | from sklearn.datasets import make_blobs
X, y = make_blobs(centers=2, random_state=0)
print('X ~ n_samples x n_features:', X.shape)
print('y ~ n_samples:', y.shape)
print('\nFirst 5 samples:\n', X[:5, :])
print('\nFirst 5 labels:', y[:5])
"""
Explanation: SciPy 2016 Scikit-learn Tutorial
Supervised Learning Part 1 -... |
karlstroetmann/Artificial-Intelligence | Python/7 Neural Networks/Autograd-Intro.ipynb | gpl-2.0 | import autograd
import autograd.numpy as np
"""
Explanation: Automatic Differentiation with autograd
Technically, autograd is layer that wraps and extends numpy. Hence it is most often imported as follows:
End of explanation
"""
def S(x):
return 1.0 / (1.0 + np.exp(-x))
def Q(x):
return np.multiply(x, x)
... |
zahup/COLOP | COLOP in SCI mode.ipynb | gpl-2.0 | import sys
import numpy as np
from scipy.stats import linregress
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: COLOP in Colour Inversion Mode
IPython notebook to calculate operator for colour inversion using seismic amplitude spectrum and well AI spectrum exported from OpendTect.
First sample of ... |
google/trax | trax/examples/trax_data_Explained.ipynb | apache-2.0 | #@title
# Copyright 2020 Google LLC.
# 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... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/labs/distributed_training.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
"""
Explanation: Distributed Training with GPUs on Cloud AI Platform
Learning Objectives:
1. Setting up the environment
1. Create a model to train locally
1. Train on multiple GPUs/CPUs with MultiWorkerMirrored Strategy
In this notebook, we will ... |
wdbm/Psychedelic_Machine_Learning_in_the_Cenozoic_Era | Keras_convolutional_MNIST_2.ipynb | gpl-3.0 | from psychedelic.jupyter_implicit import *
environment_printout(preferred_device='GeForce')
from vis.visualization import visualize_activation
from vis.visualization import visualize_saliency
from vis.utils import utils
%matplotlib inline
plt.rcParams["figure.figsize"] = [17, 10]
# input dimensions
img_x = 28
i... |
AssembleSoftware/IoTPy | examples/Introduction.ipynb | bsd-3-clause | from IoTPy.agent_types.simple import f_item
def f(item, M, multiples_stream, non_multiples_stream):
if item%M:
multiples_stream.append(item)
else:
non_multiples_stream.append(item)
"""
Explanation: f_item(func, in_stream, keyword_arguments)
func: function
function that is called when a new ele... |
amitkaps/hackermath | Module_1a_linear_algebra_inverse.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (10, 6)
x = np.arange(-10, 10, 1)
y1 = (15 - x)/3
y2 = (2 - 2*x)/-1
plt.plot(x, y1)
plt.text(x[-1], y1[-1], 'row1')
plt.plot(x, y2)
plt.text(x[-1], y2[-1], 'row2')
plt.axhline(0,... |
pdamodaran/yellowbrick | examples/rebeccabilbro/testing.ipynb | apache-2.0 | from sklearn.datasets.base import Bunch
## The path to the test data sets
FIXTURES = os.path.join(os.getcwd(), "data")
## Dataset loading mechanisms
datasets = {
"reviews": os.path.join(FIXTURES, "reviews")
}
def load_data(name, download=True):
"""
Loads and wrangles the passed in text corpus by name... |
aleph314/K2 | Data Mining/Anomaly Detection/anomaly_detection_problems.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Anomaly Detection Problems
Multivariate Approach
This data contains two metrics for a particular server. Anomalous behavior can be an indication of various types of problems. The goal is to create a system that c... |
howthebodyworks/mlmistrels | intro_to_tensorflow.ipynb | gpl-3.0 | import numpy as np
import warnings
from scipy.optimize import minimize
from scipy.integrate import quad
from scipy.interpolate import interp1d
from scipy import stats
from importlib import reload
from src import sim_cts, sim_discrete
from scipy.stats import poisson, geom
import tensorflow as tf
## web graphics
%matplo... |
ga7g08/ga7g08.github.io | _notebooks/09-02-2017-The-Gelman-Rubin-Statistic-and-emcee.ipynb | mit | # Model parameters
A = 2.3
f = 1
X0 = 2.5
# Noise parameter
sigma = 0.6
N = 500
t = np.sort(np.random.uniform(0, 10, N))
X = X0 + A * np.sin(2 * np.pi * f * t) + np.random.normal(0, sigma, N)
plt.plot(t, X, "o")
plt.xlabel("$t$")
plt.ylabel(r"$X_{\mathrm{obs}}$")
plt.show()
"""
Explanation: The Gelman-Rubin statist... |
AjinkyaBhave/CarND_P1_FindLanes | .ipynb_checkpoints/P1-checkpoint.ipynb | agpl-3.0 | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import os
import math
from scipy import misc
%matplotlib inline
# Import everything needed to edit/save/watch video clips
from moviepy.editor import VideoFileClip
from IPython.display import H... |
tpin3694/tpin3694.github.io | machine-learning/sharpen_images.ipynb | mit | # Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Title: Sharpen Images
Slug: sharpen_images
Summary: How to sharpen images using OpenCV in Python.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Images
Authors: Chris Albon
Preliminaries
End of ... |
saashimi/code_guild | interactive-coding-challenges/recursion_dynamic/hanoi/hanoi_challenge.ipynb | mit | %run ../../stacks_queues/stack/stack.py
%load ../../stacks_queues/stack/stack.py
def hanoi(num_disks, src, dest, buff):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Implement the T... |
phungkh/phys202-2015-work | assignments/assignment07/AlgorithmsEx01.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
matplotlib?
"""
Explanation: Algorithms Exercise 1
Imports
End of explanation
"""
def no_punctuation(x):
if x=="'" or x=='`'or x=='~'or x=='!'or x=='@'or x=='#'or x=='$'or x=='%'or x=='^'or x=='&'or x=='*'or x=='('or x==')'or x=='_'or x=... |
greenelab/GCB535 | 31_Prelab_ML-IV/Prelab_ML4.ipynb | bsd-3-clause | # numpy provides python tools to easily load comma separated files.
import numpy as np
# use numpy to load disease #1 data
d1 = np.loadtxt(open("../31_Data_ML-IV/D1.csv", "rb"), delimiter=",")
# features are all rows for columns before 200
# The canonical way to name this is that X is our matrix of
# examples by feat... |
ES-DOC/esdoc-jupyterhub | notebooks/dwd/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: DWD
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
dfm/george | docs/_static/notebooks/new-kernel.ipynb | mit | import george
george.__version__
"""
Explanation: Implementing new kernels
This notebook was made with the following version of george:
End of explanation
"""
import numpy as np
from george import kernels
kernel = 5 * kernels.MyLocalGaussianKernel(x0=0.0, log_w=np.log(0.2))
kernel += 5 * kernels.Matern32Kernel(100.... |
pyemma/deeplearning | assignment3/ImageGradients.ipynb | gpl-3.0 | # As usual, a bit of setup
import time, os, json
import numpy as np
import skimage.io
import matplotlib.pyplot as plt
from cs231n.classifiers.pretrained_cnn import PretrainedCNN
from cs231n.data_utils import load_tiny_imagenet
from cs231n.image_utils import blur_image, deprocess_image
%matplotlib inline
plt.rcParams... |
IBMDecisionOptimization/docplex-examples | examples/mp/jupyter/efficient.ipynb | apache-2.0 | import time
import math
class ContextTimer(object):
def __init__(self, msg):
self.msg = msg
self.start = 0
def __enter__(self):
self.start = time.time()
print('--> begin {0}'.format(self.msg))
return self # return value is value of with ()
def __ex... |
cesarcontre/Simulacion2017 | Modulo2/.ipynb_checkpoints/Clase10_IntroMontecarlo-checkpoint.ipynb | mit | import random
def random_walk(n):
# Devuelve posición después de n pasos
x = 0
for i in range(n):
paso = random.choice([-1, 1])
x += paso
return x
def random_walk1(n):
# Devuelve secuencia de posiciones
x = 0
xx = [x]
for i in range(n):
paso = random.choice([-1,... |
ltiao/project-euler | problem-48-self-powers.ipynb | unlicense | from six.moves import map, range, reduce
sum(map(lambda k: k**k, range(1, 1000+1))) % 10**10
"""
Explanation: The series, $1^1 + 2^2 + 3^3 + ... + 10^{10} = 10405071317$.
Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + ... + 1000^{1000}$.
Version 1: The obvious way
End of explanation
"""
def prod_mod(num... |
ellisonbg/talk-2015 | 01-Index.ipynb | mit | %load_ext load_style
%load_style images-pad.css
from IPython.display import Image
Image("images/calpoly_logo.png", width=400)
"""
Explanation: Project Jupyter for Data Science
Brian E. Granger(@ellisonbg)
Associate Professor
Physics+Data Science
Cal Poly, San Luis Obispo
End of explanation
"""
Image("images/jupyter... |
ES-DOC/esdoc-jupyterhub | notebooks/messy-consortium/cmip6/models/sandbox-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'messy-consortium', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: MESSY-CONSORTIUM
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topic... |
PBrockmann/ipython_ferretmagic | notebooks/ferretmagic_05_Linemagic.ipynb | mit | %load_ext ferretmagic
"""
Explanation: <hr>
Patrick BROCKMANN - LSCE (Climate and Environment Sciences Laboratory)<br>
<img align="left" width="40%" src="http://www.lsce.ipsl.fr/Css/img/banniere_LSCE_75.png" ><br><br>
<hr>
Updated: 2019/11/13
Load the ferret extension
End of explanation
"""
for i in [100,500,1000]:... |
madHatter106/DataScienceCorner | posts/speeding-up-numpy-array-comparison.ipynb | mit | import sys
import numpy as np
import time
print(f"Python: {sys.version.rsplit('|')[0]}")
print(f"Numpy: {np.__version__}")
"""
Explanation: This short post details an easy way to speed up array comparison. My problem was that I had to compare two 3D arrays, A and B, These arrays are different only in their first dimen... |
wcmckee/wcmckee.com | posts/getsdrawn.ipynb | mit | import os
import requests
from bs4 import BeautifulSoup
import re
import json
import time
import praw
import dominate
from dominate.tags import *
from time import gmtime, strftime
#import nose
#import unittest
import numpy as np
import pandas as pd
from pandas import *
from PIL import Image
from pprint import pprint
... |
tensorflow/docs-l10n | site/ja/lattice/tutorials/aggregate_function_models.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... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Sparse_Tensors.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... |
ethen8181/machine-learning | networkx/networkx.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', 'notebook_format'))
from formats import load_style
load_style(plot_style = False)
os.chdir(path)
# 1. magic for inline plot
# 2. magic to print version
... |
CSB-book/CSB | regex/solutions/BeeChecklist_solution.ipynb | gpl-3.0 | import csv
import re
"""
Explanation: Solution of 5.9.1, Bee Checklist
First of all, we import the two modules we'll need to read the csv file, and to use regular expressions:
End of explanation
"""
with open('../data/bee_list.txt') as f:
csvr = csv.DictReader(f, delimiter = '\t')
species = []
authors = ... |
keras-team/keras-io | examples/vision/ipynb/shiftvit.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_addons as tfa
# Setting seed for reproducibiltiy
SEED = 42
keras.utils.set_random_seed(SEED)
"""
Explanation: A Vision Transformer without Attention
Author: A... |
mne-tools/mne-tools.github.io | 0.24/_downloads/70e603ce6ceb1fd2cb094ccee99a1920/resolution_metrics_eegmeg.ipynb | bsd-3-clause | # Author: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.minimum_norm.resolution_matrix import make_inverse_resolution_matrix
from mne.minimum_norm.spatial_resolution import resolution_metrics
print(__doc__)
data_path = sample.data_path()
subject... |
maxhutch/thesis-notebooks | Stokes.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize'] = (10.0, 16.0)
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from scipy import fftpack
from numpy import fft
import json
from functools import partial
class Foo: pass
from chest import Chest
from slict import CachedSlict
... |
aleph314/K2 | Foundations/Python CS/Activity 10.ipynb | gpl-3.0 | def min_max(x):
"Return min and max of a list iterating over all elements"
# Initialize min and max to the first element
x_min, x_max = x[0], x[0]
# For each element update min or max if it is less or greater than the current min or max
for el in x:
if el < x_min:
x_min = el... |
OmegaHorizonResearch/subject-scholar | subject_scholar.ipynb | gpl-3.0 | import nltk
from nltk import corpus
# nltk.download()
# print(dir(corpus))
# corp = corpus.gutenberg
files = corpus.gutenberg.fileids()
print(files)
# NOTE: This is only needed to open NLTK's downloads manager!
# nltk.download()
# Get our source corpora from gutenberg in nltk.
emma_sents = corpus.gutenberg.sents('a... |
m2dsupsdlclass/lectures-labs | labs/10_unsupervised_generative_models/Deep_Convolutional_GAN.ipynb | mit | WORK_ON_COLAB = True
if WORK_ON_COLAB:
try:
# %tensorflow_version only exists in Colab.
%tensorflow_version 2.x
except Exception:
pass
import tensorflow as tf
tf.__version__
"""
Explanation: DCGAN: Deep Convolutional GAN
In this lab you are going to code a Deep Convolutional GAN (DCGAN), aka ... |
rvuduc/cse6040-ipynbs | 09--sqlite3.ipynb | bsd-3-clause | import sqlite3 as db
# Connect to a database (or create one if it doesn't exist)
conn = db.connect ('example.db')
"""
Explanation: CSE 6040, Fall 2015 [09]: Relational Databases via SQL
Today's lab is a crash-course in relational databases, as well as SQL (Structured Query Language), which is the most popular languag... |
tensorflow/docs-l10n | site/en-snapshot/tfx/tutorials/tfx/penguin_simple.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... |
csdms/coupling | docs/demos/subside.ipynb | mit | from __future__ import print_function
%matplotlib inline
import matplotlib.pyplot as plt
"""
Explanation: <img src="images/csdms_logo.jpg">
Flexural Subsidence
Link to this notebook: https://github.com/csdms/pymt/blob/master/docs/demos/subside.ipynb
Install command: $ conda install notebook pymt_sedflux
This examp... |
GSimas/EEL7045 | Aula 9.1 - Capacitores.ipynb | mit | print("Exemplo 6.1")
C = 3*(10**(-12))
V = 20
q = C*V
print("Carga armazenada:",q,"C")
w = q**2/(2*C)
print("Energia armazenada:",w,"J")
"""
Explanation: Jupyter Notebook desenvolvido por Gustavo S.S.
"Na ciência, o crédito vai para o homem que convence o mundo,
não para o que primeiro teve a ideia" - Francis Dar... |
jdsanch1/SimRC | 02. Parte 2/13. Clase 13/13Class NB.ipynb | mit | #importar los paquetes que se van a usar
import pandas as pd
import pandas_datareader.data as web
import numpy as np
from sklearn.neighbors import KernelDensity
import datetime
from datetime import datetime, timedelta
import scipy.stats as stats
import scipy as sp
import scipy.optimize as optimize
import scipy.cluster.... |
LucaCanali/Miscellaneous | Oracle_Jupyter/Oracle_Jupyter_oracledb_pandas.ipynb | apache-2.0 | # connect to Oracle using oracledb
# !pip install oracledb
import oracledb
db_user = 'scott'
db_connect_string = 'localhost:1521/XEPDB1'
db_pass = 'tiger'
# To avoid storig connection passwords use getpas or db_config
# db_connect_string = 'dbserver:1521/orcl.mydomain.com'
# import getpass
# db_pass = getpass.getpas... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/matching_engine/matching_engine_for_indexing.ipynb | apache-2.0 | PROJECT_ID = "<your_project_id>" # @param {type:"string"}
NETWORK_NAME = "ucaip-haystack-vpc-network" # @param {type:"string"}
PEERING_RANGE_NAME = "ucaip-haystack-range"
# Create a VPC network
! gcloud compute networks create {NETWORK_NAME} --bgp-routing-mode=regional --subnet-mode=auto --project={PROJECT_ID}
# Ad... |
zhuwei05/ml-basic | my_first_jupyter_notebook.ipynb | mit | import logging
logging.basicConfig()
from sklearn.datasets import fetch_20newsgroups
categories = ['alt.atheism', 'soc.religion.christian','comp.graphics', 'sci.med']
twenty_train = fetch_20newsgroups(subset='train', categories=categories, shuffle=True, random_state=42)
"""
Explanation: 安装 jupyter
安装
pip install ju... |
ProfessorKazarinoff/staticsite | content/code/bokeh/mohrs_circle_with_bokeh.ipynb | gpl-3.0 | >>> import bokeh
>>> bokeh.__version__
"""
Explanation: Bokeh is a plotting library for Python like Matplotlib and Alatir (https://altair-viz.github.io/). While Matplotlib is widely used and great for making static 2D and 3D plots, building interactive web graphics is not its strong suite. Bokeh on the other hand is a... |
willettk/chile2015-gender | analysis.ipynb | mit | %pylab inline
'''
Note: this notebook requires the following, fairly standard Python packages:
numpy
scipy
matplotlib
pandas
And one not-as-common package (also available through PyPI):
sexmachine
'''
from __future__ import division
from matplotlib import pyplot as plt
import numpy as np
im... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_decoding_csp_eeg.ipynb | bsd-3-clause | # Authors: Martin Billinger <martin.billinger@tugraz.at>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne import Epochs, pick_types, find_events
from mne.channels import read_layout
from mne.io import concatenate_raws, read_raw_edf
from mne.datasets import eegbci
from mne.decodi... |
NlGG/MachineLearning | SA_and_PSO.ipynb | mit | %matplotlib inline
import numpy as np
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
"""
Explanation: 必要なモジュールをインポートする。
End of explanation
"""
def rosenbrock(x):
z = 0
for i in range(1, len(x)):
z += 100*pow(x[0] - x[i], 2) + pow(1 - x[i], 2)
return z
fig =... |
quantopian/research_public | notebooks/data/zacks.earnings_surprises/notebook.ipynb | apache-2.0 | # import the dataset
from quantopian.interactive.data.zacks import earnings_surprises as dataset
# or if you want to import the paid dataset, use:
# from quantopian.interactive.data.zacks import earnings_surprises_free
# import data operations
from odo import odo
# import other libraries we will use
import pandas as ... |
bmeaut/python_nlp_2017_fall | course_material/02_Types_Operators_Strings/02_Types_Operators_Strings_lecture.ipynb | mit | i = 2
type(i), id(i)
i = "foo"
type(i), id(i)
"""
Explanation: Introduction to Python and Natural Language Technologies
Type system and built-in types
Lecture 02
13 September 2017
PEP8, the Python style guide
widely accepted style guide for Python
PEP8 by Guido himself, 2001
Specifies:
indentation
line length
modu... |
diego0020/va_course_2015 | AstroML/notebooks/10_exercise01.ipynb | mit | %pylab inline
import numpy as np
import pylab as pl
np.random.seed(0)
X = np.vstack([np.random.normal(0, 1, size=(100, 2)),
np.random.normal(3, 1, size=(100, 2))])
y = np.zeros(200)
y[100:] = 1
pl.scatter(X[:, 0], X[:, 1], c=y, linewidth=0)
"""
Explanation: Exercise 1: Star/Quasar Classification with ... |
loisaidasam/gensim | docs/notebooks/doc2vec-lee.ipynb | lgpl-2.1 | import gensim
import os
import collections
import smart_open
import random
"""
Explanation: Doc2Vec Tutorial on the Lee Dataset
End of explanation
"""
# Set file names for train and test data
test_data_dir = '{}'.format(os.sep).join([gensim.__path__[0], 'test', 'test_data'])
lee_train_file = test_data_dir + os.sep +... |
tpin3694/tpin3694.github.io | python/store_api_credentials_for_open_source_projects.ipynb | mit | import json
"""
Explanation: Title: Store API Credentials For Open Source Projects
Slug: store_api_credentials_for_open_source_projects
Summary: Store API Credentials For Open Source Projects
Date: 2016-11-01 12:00
Category: Python
Tags: Basic
Authors: Chris Albon
One issue which repeated comes up is how to manag... |
gsi-upm/senpy | docs/Evaluation.ipynb | apache-2.0 | import requests
from IPython.display import Code
endpoint = 'http://senpy.gsi.upm.es/api'
res = requests.get(f'{endpoint}/evaluate',
params={"algo": "sentiment-vader",
"dataset": "vader,sts",
'outformat': 'json-ld'
})
Co... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/tsa_arma_1.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from statsmodels.graphics.tsaplots import plot_predict
from statsmodels.tsa.arima_process import arma_generate_sample
from statsmodels.tsa.arima.model import ARIMA
np.random.seed(12345)
"""
Explanation: Autoregressive Moving Average (ARMA): Artificial data
E... |
gammapy/PyGamma15 | tutorials/gamera/gappa-tutorial.ipynb | bsd-3-clause | %matplotlib inline
import gappa as gp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
"""
Explanation: gappa tutorial
In this tutorial you will learn step-by-step to use gappa in order to
* calculate an SED from a particle distribution
* perform a particle evolution in the pr... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-hh/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-hh', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-HH
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, ... |
locuslab/qpth | example-sudoku.ipynb | apache-2.0 | import os
import sys
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Function, Variable
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from qpth.qp import QPFunction
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.style.use('bmh')
%matplotlib ... |
bcantarel/bcantarel.github.io | bicf_nanocourses/courses/python_1/lectures/introduction_to_pandas_and_dataframes_key.ipynb | gpl-3.0 | # Import Pandas and Numpy
import pandas as pd
import numpy as np
"""
Explanation: Intoduction to Pandas and Dataframes
<hr>
Venkat Malladi (Computational Biologist BICF)
Agenda
<hr>
Introduction to Pandas
DataSeries
Exercise 1
Exercise 2
Dataframe
Exercise 3
Exercise 4
Exercise 5
Import and Store Data
Summar... |
gfrubi/FM2 | Notebooks/Ejemplos-Transformada-Fourier.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interact
plt.style.use('classic')
"""
Explanation: Ejemplos de transformadas de Fourier:
En el presente notebook se han definido y graficado diversas funciones y sus correspondientes transformadas de Fourier.
End of explanati... |
hglanz/phys202-2015-work | assignments/assignment07/AlgorithmsEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Algorithms Exercise 2
Imports
End of explanation
"""
def find_peaks(a):
"""Find the indices of the local maxima in a sequence."""
# local maxima defined as being greater than the one adjacent cel... |
lukauskas/means | tutorial/4. Input & Output.ipynb | mit | import means
import means.examples
"""
Explanation: Input & Output
MEANS package provides a set of routines for serialisation (saving) and deserialisation (loading) of the MEANS-specific objects into human-readable YAML format.
These routines all reside inside means.io package, which is imported by default from the pa... |
a-slide/JupyterGenoViewer | README.ipynb | gpl-3.0 | #### REMOVE in README.md ####
import JGV as package
from IPython.core.display import display, Markdown
if "__install_requires__" in package.__dict__:
display(Markdown("## Python packages dependencies:\n"))
for dep in package.__install_requires__:
display(Markdown("* {}\n".format(dep)))
#################... |
tensorflow/agents | docs/tutorials/3_policies_tutorial.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... |
tensorflow/tfx | docs/tutorials/tfx/gcp/vertex_pipelines_simple.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... |
seniosh/StatisticalMethods | lessons/3.PDFCharacterization.ipynb | gpl-2.0 | import numpy as np
from straightline_utils import *
%matplotlib inline
from matplotlib import rcParams
rcParams['savefig.dpi'] = 100
(x,y,sigmay) = get_data_no_outliers()
plot_yerr(x, y, sigmay)
"""
Explanation: PHYS366: Statistical Methods in Astrophysics
Lesson 3: Inference in Practice: PDF Characterization
Goals fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.