repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
weikang9009/pysal | notebooks/explore/pointpats/centrography.ipynb | bsd-3-clause | import numpy as np
from pysal.explore.pointpats import PointPattern
%matplotlib inline
import matplotlib.pyplot as plt
points = [[66.22, 32.54], [22.52, 22.39], [31.01, 81.21],
[9.47, 31.02], [30.78, 60.10], [75.21, 58.93],
[79.26, 7.68], [8.23, 39.93], [98.73, 77.17],
[89.78, 42.53], [... |
mediagit2016/workcamp-maschinelles-lernen-grundlagen | 20-02-20-ml-workcamp/aufgaben/matplotlib-werkzeugkiste-20.ipynb | gpl-3.0 | from __future__ import division, print_function, unicode_literals
"""
Explanation: Werkzeugkiste - matplotlib
Dieses Notizbuch zeigt, wie Sie mit der matplotlib-Bibliothek schöne Grafiken zeichnen.
Zeichnen Sie Ihr erstes Diagramm
Stellen wir zunächst sicher, dass dieses Notebook sowohl in Python 2 als auch in Python ... |
keras-team/keras-io | examples/vision/ipynb/siamese_contrastive.ipynb | apache-2.0 | import random
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import matplotlib.pyplot as plt
"""
Explanation: Image similarity estimation using a Siamese Network with a contrastive loss
Author: Mehdi<br>
Date created: 2021/05/06<br>
Last modified: 2021/05/06... |
hongguangguo/shogun | doc/ipython-notebooks/gaussian_process/gaussian_processes.ipynb | gpl-3.0 | %matplotlib inline
# import all shogun classes
from modshogun import *
import random
import numpy as np
import matplotlib.pyplot as plt
from math import exp
"""
Explanation: Gaussian Processes in Shogun
By Heiko Strathmann - <a href="mailto:heiko.strathmann@gmail.com">heiko.strathmann@gmail.com</a> - <a href="https://... |
silburt/rebound2 | ipython_examples/AdvWHFast.ipynb | gpl-3.0 | import rebound
import numpy as np
def test_case():
sim = rebound.Simulation()
sim.integrator = 'whfast'
sim.add(m=1.) # add the Sun
sim.add(m=3.e-6, a=1.) # add Earth
sim.move_to_com()
sim.dt = 0.2
return sim
"""
Explanation: Advanced settings for WHFast: Extra speed, accuracy, and additio... |
tpin3694/tpin3694.github.io | python/pandas_rename_column_headers.ipynb | mit | # Import required modules
import pandas as pd
"""
Explanation: Title: Rename Column Headers In Pandas
Slug: pandas_rename_column_headers
Summary: Rename Column Headers In Pandas
Date: 2016-06-17 12:00
Category: Python
Tags: Data Wrangling
Authors: Chris Albon
Originally from rgalbo on StackOverflow.
Preliminaries
E... |
setiQuest/ML4SETI | tutorials/Step_5c_Convert_TS_to_unit8Dataset_DSX.ipynb | apache-2.0 | import requests
import json
#!pip install ibmseti
import ibmseti
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow as tf
import os
"""
Explanation: <a href="https://www.cognitiveclass.ai"><img src = "https://cognitiveclass.ai/wp-content/themes/bdu3.0/static/images/cc-logo.png" ali... |
Olsthoorn/TransientGroundwaterFlow | Syllabus_in_notebooks/Sec5_3_2_Sine_temp_wave_penetration.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Section 5.3.2. Temperature penetration
IHE, Delft, , 2019-12-30
@T.N. olsthoorn
This case relates to the exercises of section 5.3.3. of the syllabus
The conduction of head into the ground obeys the same governing partial differential equation as does ... |
csadorf/signac | doc/signac_203_Database_Integration.ipynb | bsd-3-clause | import signac
#
# --- PLEASE UNCOMMENT ONE OF THE FOLLOWING TWO CONFIGURATIONS ---
#
# --- 1) USING A LOCAL MONGODB INSTANCE ---
#from pymongo import MongoClient
#client = MongoClient()
#db = client.testing
# --- 2) USING A SIGNAC DATABASE CONFIGURATION ---
db = signac.get_database('testing')
index = db.signac_tuto... |
obscode/bootcamp | MoreNotebooks/AstropySmorgasbord.ipynb | mit | from astropy.table import QTable
import astropy.units as u
import numpy as np
"""
Explanation: Astropy Smorgasbord
Astropy is a the python package designed to contain the basic utilities needed for astronomy. It has been many years in the making and replicated some of the functionaily of other astronomy packages from... |
uqyge/combustionML | FPV_ANN/notebooks/fgm_nn_inhouse.ipynb | mit | !pip install gdown
!mkdir ./data
import gdown
def data_import():
ids = {
"tables_of_fgm.h5":"1omAitbGljJeoZPMJ9odkrF27zaoQm61X"
}
url = 'https://drive.google.com/uc?id='
for title, g_id in ids.items():
try:
output_file = open("/content/data/" + title, 'wb')
gdown.download(url + g_id, o... |
mathinmse/mathinmse.github.io | Lecture-11-Scalars-Vectors.ipynb | mit | %matplotlib notebook
import sympy as sp
from sympy.plotting import plot3d
import numpy as np
import matplotlib.pyplot as plt
x, y = sp.symbols('x y')
"""
Explanation: Lecture 11: Scalar and Vector Fields, Accumulation
Background
Engineers and scientists are typically interested in how certain quantities vary within ... |
opengeostat/pygslib | pygslib/Ipython_templates/bigaus_raw.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
import pandas as pd
#make the plots inline
%matplotlib inline
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file('../data/cluster.dat')
# This is a 2D file, in this GS... |
DamienIrving/ocean-analysis | development/dask.ipynb | mit | #from dask.distributed import Client, progress, LocalCluster
#client = LocalCluster()
#client
from dask.distributed import Client
client = Client()
client
import dask
import dask.multiprocessing
dask.set_options(get=dask.multiprocessing.get)
import dask
import dask.threaded
dask.set_options(get=dask.threaded.get)
... |
debsankha/network_course_python | talks/02-pythonbasics-libraries.ipynb | gpl-2.0 | %matplotlib inline
%config InlineBackend.figure_format = 'png'
matplotlib.rcParams['figure.figsize'] = (4,4)
matplotlib.rcParams['xtick.labelsize'] = 35
matplotlib.rcParams['ytick.labelsize'] = 35
matplotlib.rcParams['font.size'] = 35
matplotlib.rcParams['axes.labelsize'] = 50
matplotlib.rcParams['axes.facecolor'] = 'w... |
keras-team/keras-io | examples/vision/ipynb/barlow_twins.ipynb | apache-2.0 | !pip install tensorflow-addons
import os
# slightly faster improvements, on the first epoch 30 second decrease and a 1-2 second
# decrease in epoch time. Overall saves approx. 5 min of training time
# Allocates two threads for a gpu private which allows more operations to be
# done faster
os.environ["TF_GPU_THREAD_M... |
tsarouch/python_minutes | feature_selection/regression_feature_selection.ipynb | gpl-2.0 | # necessary imports
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
%load_ext autoreload
%autoreload 2
import sys
sys.path.append("../lib_plot")
import scatter_boxplot as sbp
%matplotlib inline
import seaborn as sns
from scipy.stats.stats import pearsonr
from scipy import stats
# — the data... |
DS-100/sp17-materials | sp17/disc/disc10/disc10.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
%matplotlib inline
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 12, 10
"""
Explanation: The Bias-Variance Trade-Off
End of explanation
"""
np.random.seed(100)
x = np.array([i*np.pi/180 for i in range(0,360,18)]... |
Yen-HuaChen/STA663-Final-Project | final.ipynb | mit | import numpy as np
from scipy.special import gammaln
import random
from collections import Counter
import string
import graphviz
import pygraphviz
import pydot
"""
Explanation: Hierarchical Topic Models and the Nested Chinese Restaurant Process
Tun-Chieh Hsu, Xialingzi Jin, Yen-Hua Chen
I. Background
Recently, complex... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/10_recommend/hybrid_recommendations/hybrid_recommendations.ipynb | apache-2.0 | !pip3 install tensorflow_hub
%%bash
pip install --upgrade tensorflow
"""
Explanation: Neural network hybrid recommendation system on Google Analytics data model and training
This notebook demonstrates how to implement a hybrid recommendation system using a neural network to combine content-based and collaborative fil... |
besser82/shogun | doc/ipython-notebooks/converter/Tapkee.ipynb | bsd-3-clause | import numpy
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
def generate_data(curve_type, num_points=1000):
if curve_type=='swissroll':
tt = numpy.array((3*numpy.pi/2)*(1+2*numpy.random.rand(num_points)))
height = numpy.array((numpy.random.rand(num_points)-0.5))
X = numpy.array([tt*nump... |
tensorflow/tpu | tools/colab/fashion_mnist.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
yvan/titanicdeath | nbs/blog_writeup.ipynb | mit | #let us load the logistic regression model used
import pandas as pd
data_df = pd.read_csv('../titanicdeath/static/train.csv')
"""
Explanation: <a href="http://titanicdeath.com">titanicdeath.com</a>
This is the writeup for <a href="http://titanicdeath.com">titanicdeath.com</a>. Besides having a truly fantastic name, th... |
Wei1234c/Elastic_Network_of_Things_with_MQTT_and_MicroPython | notebooks/demo/Neural Network demo.ipynb | gpl-3.0 | import os
import sys
import time
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, '..\\codes', 'client')))
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, '..\\codes', 'node')))
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, '..\\codes', 'shared')))
sys.path.append(os.path.abspa... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-3/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-3', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-3
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
ricklupton/sankeyview | docs/cookbook/imports-exports.ipynb | mit | import pandas as pd
from io import StringIO
flows = pd.read_csv(StringIO("""
source,target,type,value
a,b,main,3
b,c,main,4
imports,b,import/export,2
b,exports,import/export,1
"""))
flows
"""
Explanation: Imports & exports
This recipe demonstrates how to show import and export flows to/from a simple process chain.
F... |
ericlejan/CahierISNEtICN | Geolocalisation.ipynb | gpl-3.0 | import geopy
from geopy.geocoders import Nominatim
geocoder = Nominatim()
adresse = "22 rue Saint Lo, Rouen, France"
location = geocoder.geocode(adresse, True, 30)
print("longitude = ",location.longitude,"latitude = ",location.latitude)
"""
Explanation: La géolocalisation avec le module geopy
Ce module permet de récup... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_compute_mne_inverse_epochs_in_label.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import apply_inverse_epochs, read_inverse_operator
from mne.minimum_norm import apply_inverse
print(__... |
mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.01 - Functional Programming/02_04_Comprehensions.ipynb | gpl-3.0 | # Original
doubled_numbers = []
for n in range(1,12,2):
doubled_numbers.append(n*2)
print(doubled_numbers)
#list compreshensions
doubled_numbers = [n * 2 for n in range(1,12,2)] # 1 ,3, 5, 7, 9, 11
print(doubled_numbers)
"""
Explanation: Comprehensions
Using comprehensions is often a way both to make code more c... |
Michaelt293/ANZSMS-Programming-workshop | Python_tutorial.ipynb | cc0-1.0 | print("Hello, world!")
"""
Explanation: ANZSMS 2015 Python Programming Workshop
Print Function
The print function prints output to the command-line interface (terminal in OS X/Linux, powershell in Windows). In the following example, we print the text string "Hello, world!"
End of explanation
"""
Ag = 107
Au = 197
... |
google/eng-edu | ml/cc/exercises/representation_with_a_feature_cross.ipynb | apache-2.0 | %tensorflow_version 2.x
"""
Explanation: Representation with a Feature Cross
In this exercise, you'll experiment with different ways to represent features.
Learning Objectives:
After doing this Colab, you'll know how to:
Use tf.feature_column methods to represent features in different ways.
Represent features as bins... |
kcyu1993/ML_course_kyu | projects/project1/scripts/project1.ipynb | mit | from proj1_helpers import *
DATA_TRAIN_PATH = '' # TODO: download train data and supply path here
y, tX, ids = load_csv_data(DATA_TRAIN_PATH)
"""
Explanation: Load the training data into feature matrix, class labels, and event ids:
End of explanation
"""
DATA_TEST_PATH = '' # TODO: download train data and supply pa... |
gth158a/NLP_event_classification | notebooks/DSCI 6003-6004 - Introduction.ipynb | mit | def search_titles(df, expression):
categories = df[df['category'].str.contains(expression, regex=True) == True]['category']
idxs = df[df['category'].str.contains(expression, regex=True) == True].index
print(categories)
return idxs
def update_category(df, indices, category_title):
for i in indices:
... |
jpzhangvincent/InstacartKaggleCompetition | notebooks/05 - JP - FeatureEngineering.ipynb | mit | orders_prior_info = orders_df[orders_df.eval_set == "prior"]
orders_prior_info.shape
prior_uid_pid_df = pd.merge(orders_df[['user_id', 'order_id']], op_prior_df, how = "inner", on = "order_id")
prior_uid_pid_df.shape
"""
Explanation: Extract features based on the "prior" set
End of explanation
"""
num_orders_per_... |
mne-tools/mne-tools.github.io | 0.21/_downloads/5f84ce88b4773e5ca1f9b3502aef334a/plot_eeg_erp.ipynb | bsd-3-clause | import mne
from mne.datasets import sample
from mne.channels import combine_channels
"""
Explanation: EEG processing and Event Related Potentials (ERPs)
:depth: 1
End of explanation
"""
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
event_fname = data_path + '/ME... |
jovanbrakus/data-analysis-tools | week-3-assignment.ipynb | gpl-3.0 | %matplotlib inline
import pandas
import numpy
import seaborn
import scipy
import matplotlib.pyplot as plt
data = pandas.read_csv('gapminder.csv', low_memory=False)
data['oilperperson'] = pandas.to_numeric(data['oilperperson'], errors='coerce')
data['incomeperperson'] = pandas.to_numeric(data['incomeperperson'], erro... |
GoogleCloudDataproc/spark-bigquery-connector | examples/notebooks/Top words in Shakespeare by work.ipynb | apache-2.0 | from pyspark.sql import SparkSession
spark = SparkSession.builder \
.appName('Top Shakepeare words')\
.config('spark.jars', 'gs://spark-lib/bigquery/spark-bigquery-latest.jar') \
.getOrCreate()
"""
Explanation: Using the Spark BigQuery connector in Jupyter
Use a Python kernel (not PySpark) to allow configuring t... |
sspickle/sci-comp-notebooks | P10-CoupledMasses.ipynb | mit | USE_VISUAL=False
#
# Either use this cell, in which case you will be using VPython
# Note: VPython only works if you have it installed on your local
# computer. Also, stopping a VPython simulation appears to restart the kernel. Save first!
#
import numpy as np
if USE_VISUAL:
import vpython as vp
#
# Or use... |
lifeinoppo/littlefishlet-scode | RES/REF/python_sourcecode/ipython-master/examples/IPython Kernel/Cell Magics.ipynb | gpl-2.0 | %lsmagic
"""
Explanation: Cell Magics in IPython
IPython has a system of commands we call 'magics' that provide a mini command language that is orthogonal to the syntax of Python and is extensible by the user with new commands. Magics are meant to be typed interactively, so they use command-line conventions, such as ... |
metpy/MetPy | dev/_downloads/0eff36d3fdf633f2a71ae3e92fdeb5b8/Simple_Sounding.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, SkewT
from metpy.units import units
# Change default to be better for skew-T
plt.rcParams['figure.figsize'] = (9, 9)
# Upper air data can be... |
luofan18/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... |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_info.ipynb | bsd-3-clause | import mne
import os.path as op
"""
Explanation: The :class:Info <mne.Info> data structure
The :class:Info <mne.Info> data object is typically created
when data is imported into MNE-Python and contains details such as:
date, subject information, and other recording details
the sampling rate
information ab... |
zhangyue1208/nd_dl_project1 | Your_first_neural_network.ipynb | apache-2.0 | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
mangecoeur/pineapple | data/examples/python2.7/Welcome.ipynb | gpl-3.0 | 2 ** 64
"""
Explanation: Welcome
Welcome to Pineapple, the next generation scientific notebook.
This example is for Python 2.7
Run Python code
End of explanation
"""
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10)
plt.plot(x, np.sin(x));
"""
Explanation: You can make plo... |
rainyear/pytips | Tips/2016-03-09-List-Comprehension.ipynb | mit | evens = [x for x in range(10) if x % 2 == 0]
print(evens)
"""
Explanation: 0x03 - Python 列表推导
0x02 中提到的 map/filter 方法可以通过简化的语法快速构建我们需要的列表(或其它可迭代对象),与它们功能相似的,Python 还提供列表推导(List Comprehension)的语法。最初学 Python 的时候,我只是把这种语法当做一种语法糖,可以用来快速构建特定的列表,后来学习 Haskell 的时候才知道这种形式叫做 List Comprehension(中文我好像没有找到固定的翻译,有翻译成列表速构、列表解析之类的,但意... |
claudiuskerth/PhDthesis | Data_analysis/SNP-indel-calling/ANGSD/BOOTSTRAP_CONTIGS/minInd9_overlapping/SFS/check_effect_of_Ludovics_correction.ipynb | mit | % ll original/ERY/
import sys
sys.path.insert(0, "/home/claudius/Downloads/dadi/")
import dadi
fs_ery = dadi.Spectrum.from_file("original/ERY/ERY.unfolded.sfs.dadi")
fs_ery = fs_ery.fold()
# make the extrapolating version of the standard neutral model function
func_ex = dadi.Numerics.make_extrap_log_func(dadi.Demo... |
saga-survey/erik | ipython_notebooks/saga_artpop.ipynb | gpl-2.0 | stellar_mass_sgr = 2.1e7 * u.Msun #McConnachie et al. 2012
Rh_sgr = 630*u.pc # extrapolatiopn from the stellar mass following Fig 7 of Tollerud et al 2010
feh_sgr = -1
distance = 30*u.Mpc
# the mag below which to treat as "integrated light" - lowers computational time
mag_limit = 6 + Distance(distance).distmod.value... |
liuhanfei0615/liupengyuan.github.io | chapter2/homework/computer/4-5/201411680496_task5.ipynb | mit | import random,math
def Square():
m=int(input('plz input the min '))
k=int(input('plz input the max '))
n=int(input('plz input n : '))
i=0
total=0
while i<n:
i+=1
temp=random.randint(m,k)
total+=temp
print (math.sqrt(total/n))
Square()
"""
Explanation: 练习 1:写函数,求... |
he7d3r/revscoring | ipython/feature_engineering.ipynb | mit | from revscoring.extractors import api
import mwapi
extractor = api.Extractor(mwapi.Session("https://en.wikipedia.org",
user_agent="Revscoring feature demo ahalfaker@wikimedia.org"))
"""
Explanation: Feature engineering
This notebook will teach you how to extract feature values ... |
tetsuyasu/jupyter_tfbook | Chapter03/MNIST single layer network.ipynb | apache-2.0 | %matplotlib inline
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
np.random.seed(20160612)
tf.set_random_seed(20160612)
"""
Explanation: [MSL-01] 必要なモジュールをインポートして、乱数のシードを設定します。
End of explanation
"""
mnist = input_data.read_data_... |
Python4AstronomersAndParticlePhysicists/PythonWorkshop-ICE | notebooks/12_01_Databases.ipynb | mit | %load -r 1-16 solutions/12_01_Databases.py
"""
Explanation: Index
Modeling
E-R Diagrams
Relational model
SQL
SELECT
JOIN
Exercises
Using SQLAlchemy
Why do we normalize?
SQL security issues
1) Modeling
When the amount or the complexity of the data we work with overwhelms us, we look for tools able to help us. Databa... |
dssg/education-highschool-public | experiments/Example.ipynb | mit | import pandas as pd
# Import experimental configuration.
import config
# Import pipeline modules, and database utilities.
from hspipeline.pipeline import *
from hspipeline.utils.database import connect as db_connect
BASE_PATH = os.path.dirname(os.path.abspath('__file__'))
input_dir = os.path.join(BASE_PATH, 'input')... |
tianchuanting/Udacity | P1/P1.ipynb | mit | import pandas as pd
df = pd.read_csv("./stroopdata.csv")
df.describe()
"""
Explanation: 1. What is our independent variable? What is our dependent variable?
Independent Varible: whether congruent or incongruent were presented in the test
Dependent Variable: time to complete the test
<hr />
2. What is an appropriate ... |
turbomanage/training-data-analyst | blogs/goes16/maria/hurricanes2017.ipynb | apache-2.0 | %bash
apt-get update
apt-get -y install python-mpltoolkits.basemap
from mpl_toolkits.basemap import Basemap
import google.datalab.bigquery as bq
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
query="""
#standardSQL
SELECT
name,
latitude,
longitude,
iso_time,
usa_sshs
FROM
`bigqu... |
GoogleCloudPlatform/practical-ml-vision-book | 05_create_dataset/05_split_tfrecord.ipynb | apache-2.0 | import pandas as pd
df = pd.read_csv('gs://practical-ml-vision-book/flowers_5_jpeg/flower_photos/all_data.csv', names=['image','label'])
df.head()
import numpy as np
np.random.seed(10)
rnd = np.random.rand(len(df))
train = df[ rnd < 0.8 ]
valid = df[ (rnd >= 0.8) & (rnd < 0.9) ]
test = df[ rnd >= 0.9 ]
print(len(df)... |
AllenDowney/ModSim | python/soln/chap25.ipynb | gpl-2.0 | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
mne-tools/mne-tools.github.io | 0.23/_downloads/3d564af6b3f1e758cf01cd38abefd45f/50_epochs_to_data_frame.ipynb | bsd-3-clause | import os
import seaborn as sns
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_filt-0-40_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
"""
Explanation... |
GlooperLabs/GraphTime | examples/GFGL Example.ipynb | bsd-3-clause | y = np.load('../data/y.npy')
sigma = np.load('../data/sigma.npy')
sigma_inv = np.load('../data/sigma_inv.npy')
T = 90 # Steps
K = 2 # Changepoints
P = 10 # Variables
M = 5 # Active Edges
eps = 0.000001 # Edge threshold epsilon
"""
Explanation: Parameters and Example Data
End of explanation
"""
edges = get_edges(sigm... |
brandoncgay/deep-learning | autoencoder/Simple_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)
"""
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to compres... |
sunil07t/e-mission-server | Timeseries_Sample.ipynb | bsd-3-clause | import emission.core.get_database as edb
import pandas as pd
all_users = pd.DataFrame(list(edb.get_uuid_db().find({}, {"user_email":1, "uuid": 1, "_id": 0})))
all_users
from uuid import UUID
test_user_id = all_users.iloc[1].uuid # replace with UUID from above
"""
Explanation: In order to run this notebook with the c... |
Chipe1/aima-python | probability4e.ipynb | mit | from collections import defaultdict, Counter
import itertools
import math
import random
class BayesNet(object):
"Bayesian network: a graph of variables connected by parent links."
def __init__(self):
self.variables = [] # List of variables, in parent-first topological sort order
self.loo... |
SATHVIKRAJU/European_Language_Classification | Language_European_Small-final.ipynb | mit | import codecs
import glob as g
import pandas as pd
import os
pd_dict={}
#os.path.basename(path)
#path="C:/Users/Sathvik/Desktop/DS/NLP_TEXT/"
get_dir1=g.glob('C:/Users/Sathvik/Desktop/DS/NLP_TEXT_SMALL/*')
a=len(get_dir1)
for k in range(0,a):
with codecs.open(get_dir1[k],encoding="utf-8") as f:
pd_dict[... |
biogeochemistry/PorousMediaLab | examples/Column - Freeze-Thaw.ipynb | mit | import sys
sys.path.append('../')
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
from porousmedialab.column import Column
"""
Explanation: Import libraries:
End of explanation
"""
t = 27 / 365
dx = 0.2
L = 40
phi = 0.8
dt = 1e-4
ftc = Column(L, dx, t, dt)
"""
Explanation: Setting up the pro... |
fevangelista/pyWicked | examples/forte/spinorbital-CCSDT.ipynb | mit | import wicked as w
import psi4
import forte
import forte.utils
from forte import forte_options
import numpy as np
import time
w.reset_space()
w.add_space("o", "fermion", "occupied", ["i", "j", "k", "l", "m", "n"])
w.add_space("v", "fermion", "unoccupied", ["a", "b", "c", "d", "e", "f"])
Top = w.op("T", ["v+ o", "v+ ... |
jomavera/Work | Sentiment Analysis.ipynb | mit | import numpy as np
import itertools
import math
import pandas as pd
import csv
import time
from sklearn.cross_validation import train_test_split, KFold
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.model_selection import learning_curve
from... |
aerospace-notebook/aerospace-notebook | Segway-control.ipynb | bsd-3-clause | import sympy #symbolic algebra library
import sympy.physics.mechanics as mech
import control #control analysis library
sympy.init_printing(use_latex='mathjax')
from IPython.display import display
%matplotlib inline
%load_ext autoreload
%autoreload 2
import px4_logutil
import pylab as pl
"""
Explanation: Segway Dynamic... |
rjmanriquew/Diplomado-2017 | TallerRJMW.ipynb | mit | import pandas as pd
pd.read_excel('Precio_Bolsa_Nacional_($kwh)_1995.xlsx')
x=[]
for n in range(1995,2018):
if n<2000:
skip=3
else:
skip=2
nombrearchivo='Precio_Bolsa_Nacional_($kwh)_' + str(n)
if n>=2016:
nombrearchivo += '.xls'
else:
nombrearchivo += '... |
tensorflow/docs-l10n | site/zh-cn/tutorials/estimator/keras_model_to_estimator.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... |
yw-fang/readingnotes | linux-mac-win/2018-linuxnote.ipynb | apache-2.0 | ## 2. All about ssh problems
"""
Explanation: Notes on linux in the year of 2018
Author: Yue-Wen FANG
Contact: fyuewen@gmail.com
Revision history: created in 11th, January, at Kyoto
1. About texlive in linux
After installing texlive into your linux system, you may still have problem when compling tex files (... |
erikdrysdale/erikdrysdale.github.io | _rmd/extra_unequalvar/unequalvar.ipynb | mit | # Import modules needed to reproduce results
import os
import plotnine
from plotnine import *
import pandas as pd
from scipy import stats
import numpy as np
from statsmodels.stats.proportion import proportion_confint as prop_CI
def tdist_2dist(mu1, mu2, se1, se2, n1, n2, var_eq=False):
var1, var2 = se1**2, se2**2
... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/matplotlib/matplotlib-applied.ipynb | mit | %matplotlib inline
import pandas as pd
import numpy as np
import pylab as plt
import seaborn
# Set the global default size of matplotlib figures
plt.rc('figure', figsize=(10, 5))
# Set seaborn aesthetic parameters to defaults
seaborn.set()
df_train = pd.read_csv('../data/titanic/train.csv')
def clean_data(df):
... |
jeffzhengye/pylearn | tensorflow_learning/tf2/notebooks/.ipynb_checkpoints/tf_keras_介绍_研究人员版-checkpoint.ipynb | unlicense | import tensorflow as tf
from tensorflow import keras
"""
Explanation: Introduction to Keras for Researchers
Author: fchollet<br>
Date created: 2020/04/01<br>
Last modified: 2020/10/02<br>
Description: Everything you need to know to use Keras & TensorFlow for deep learning research.
Setup
End of explanation
"""
x = t... |
dotsdl/msmbuilder | examples/hmm-and-msm.ipynb | lgpl-2.1 | from __future__ import print_function
import os
%matplotlib inline
from matplotlib.pyplot import *
from msmbuilder.featurizer import SuperposeFeaturizer
from msmbuilder.example_datasets import AlanineDipeptide
from msmbuilder.hmm import GaussianFusionHMM
from msmbuilder.cluster import KCenters
from msmbuilder.msm impor... |
e-sr/SDWirkungNi | DSP/darstellungMicSignale.ipynb | cc0-1.0 | %reset -f
%matplotlib notebook
%load_ext autoreload
%autoreload 1
%aimport functions
%qtconsole
import numpy as np
import acoustics
from functions import *
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
mpl.rcParams['lines.linewidth']=0.5
"""
Explanation: Darstellung Mikrophonsignale, u... |
shankari/e-mission-server | Timeseries_Sample.ipynb | bsd-3-clause | import emission.core.get_database as edb
import pandas as pd
all_users = pd.DataFrame(list(edb.get_uuid_db().find({}, {"user_email":1, "uuid": 1, "_id": 0})))
all_users
from uuid import UUID
test_user_id = all_users.iloc[1].uuid # replace with UUID from above
"""
Explanation: In order to run this notebook with the c... |
7deeptide/Design-Optimization | Homeworks/ME596_Midterm.ipynb | gpl-3.0 | #First put problem in standard form and construct cannonical matrix
# ^^ program will NOT do this.
#Note: this is coded in Python3 *not* MATLAB
#initial feasible solution is given by initial tableu construction
from __future__ import division
def printTableu(tableu):
print('--------------------------------... |
SurAnand/KK_to_ABS_15apr15 | KK_to_ABS_15apr15.ipynb | gpl-2.0 | ls -l *.R
"""
Explanation: KK's Rscript to Pyscript
Somayaji made a script in R which I am dying to reproduce in python using pandas and other great frameworks. His source file is:
End of explanation
"""
from pandas import DataFrame, read_csv
import matplotlib.pyplot as plt
import pandas as pd
import sys
%matplotlib... |
jsvine/pdfplumber | examples/notebooks/san-jose-pd-firearm-report.ipynb | mit | import pdfplumber
import re
print(pdfplumber.__version__)
"""
Explanation: Parsing San Jose PD's firearm search reports
This example uses pdfplumber's visual debugging and text-extraction features to parse a fixed-width table embedded in a PDF. Thanks to Ron Campbell for the sample PDF.
End of explanation
"""
pdf = ... |
dchandan/rebound | ipython_examples/EscapingParticles.ipynb | gpl-3.0 | import rebound
import numpy as np
def setupSimulation():
sim = rebound.Simulation()
sim.integrator = "ias15" # IAS15 is the default integrator, so we don't need this line
sim.add(m=1., id=0)
sim.add(m=1e-3,x=1.,vx=2., id=1)
sim.add(m=1e-3,a=1.25,M=np.pi/2, id=2)
sim.move_to_com()
return sim
... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/markov_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# NBER recessions
from pandas_datareader.data import DataReader
from datetime import datetime
usrec = DataReader(
"USREC", "fred", start=datetime(1947, 1, 1), end=datetime(2013, 4, 1)
)
"""
Exp... |
openai/openai-python | examples/embeddings/Semantic_text_search_using_embeddings.ipynb | mit | import pandas as pd
import numpy as np
df = pd.read_csv('output/embedded_1k_reviews.csv')
df['babbage_search'] = df.babbage_search.apply(eval).apply(np.array)
"""
Explanation: Semantic text search using embeddings
We can search through all our reviews semantically in a very efficient manner and at very low cost, by ... |
gutouyu/cs231n | cs231n/assignment/assignment1/features.ipynb | mit | import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloading extenrnal modu... |
boffi/boffi.github.io | dati_2017/02/response_by_fft.ipynb | mit | %pylab inline
%config InlineBackend.figure_format = 'svg'
import json
s = json.load( open("mplrc.json") )
matplotlib.rcParams.update(s)
matplotlib.rcParams['figure.figsize'] = 9,4
black="#404060" # plots containing "real black" elements look artificial
"""
Explanation: Configure the plotting machinery
End of explanati... |
quantopian/research_public | notebooks/lectures/Statistical_Moments/questions/notebook.ipynb | apache-2.0 | # Useful Libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats as stats
from statsmodels.stats.stattools import jarque_bera
"""
Explanation: Exercises: Statistical Moments and Normality Testing
Lecture Link :
https://www.quantopian.com/lectures/statistical-moments
IMPORTAN... |
barjacks/foundations-homework | 05/Spotify_Homework_5_Skinner_Graded.ipynb | mit | import requests
"""
Explanation: Graded = 8/8
End of explanation
"""
response = requests.get('https://api.spotify.com/v1/search?query=Lil&type=artist&limit=50&market=US')
Lil_data = response.json()
Lil_data.keys()
Lil_data['artists'].keys()
"""
Explanation: These are the search queries for the Spotify Web API
End... |
AllenDowney/ThinkBayes2 | examples/height_soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
import numpy as np
import pandas as pd
from thinkbayes2 import Pmf, Cdf, Suite, Joint
import thinkplot
... |
mne-tools/mne-tools.github.io | 0.14/_downloads/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
intereference and compensa... |
canclini/bikesharing | worldfeed.ipynb | mit | from __future__ import print_function
import socket
import json
import sys
import threading
import time
from satori.rtm.client import make_client, SubscriptionMode
from kafka import KafkaProducer
def satori2kafka(channel,endpoint, appkey, topic, delay=1):
# Kafka
producer = KafkaProducer(bootstrap_servers=['lo... |
radhikapc/foundation-homework | homework10/Homework10-Radhika-Reddit.ipynb | mit | import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response = requests.get("https://www.reddit.com/", headers=headers)
doc = BeautifulSoup(response.text, 'html.parser')
import... |
silburt/rebound2 | ipython_examples/PoincareMap.ipynb | gpl-3.0 | import rebound
import numpy as np
"""
Explanation: Poincare Map
This example shows how to calculate a simple Poincare Map with REBOUND. A Poincare Map (or sometimes calles Poincare Section) can be helpful to understand dynamical systems.
End of explanation
"""
sim = rebound.Simulation()
sim.add(m=1.)
sim.add(m=1e-3,... |
facebook/prophet | notebooks/saturating_forecasts.ipynb | mit | %%R
df <- read.csv('../examples/example_wp_log_R.csv')
df = pd.read_csv('../examples/example_wp_log_R.csv')
"""
Explanation: Forecasting Growth
By default, Prophet uses a linear model for its forecast. When forecasting growth, there is usually some maximum achievable point: total market size, total population size, e... |
Kulbear/deep-learning-nano-foundation | DLND-image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
class DLProgress(tqdm):
last_block = 0
def hoo... |
sourabhrohilla/ds-masterclass-hands-on | session-2/python/Topic_Model_Recommender.ipynb | mit | PATH_ARTICLE_TOPIC_DISTRIBUTION = "/home/phoenix/Documents/HandsOn/Final/python/Topic Model/model/Article_Topic_Distribution.csv"
PATH_NEWS_ARTICLES = "/home/phoenix/Documents/HandsOn/Final/news_articles.csv"
NO_OF_TOPICS=150
ARTICLES_READ=[7,6,76,61,761]
NUM_RECOMMENDED_ARTICLES=5
import pandas as pd
import numpy as ... |
GoogleCloudPlatform/healthcare | datathon/anzics18/tutorial.ipynb | apache-2.0 | # Import libraries
import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path
import tensorflow as tf
# Below imports are used to print out pretty pandas dataframes
from IPython.display import display, HTML
# Imports for accessi... |
tensorflow/graphics | tensorflow_graphics/projects/radiance_fields/TFG_tiny_nerf.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... |
alfkjartan/control-computarizado | sampling-and-aliasing/notebooks/Fourier-transform.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
w1 = 1 # rad/s
M = 100 # Number of periods
ws = 40*w1 # Sampling frequency at 40 times the frequency of the sinusoid
wN = ws/2.0 # The Nyquist frequency
h = 2*np.pi/ws
N = M*40
t = np.arange(N)*h
y = np.sin(w1*t)
Y = np.fft.fft(y)*h # Computes the... |
regardscitoyens/Collaborateurs-Parlement | exploitations/turnover.ipynb | agpl-3.0 | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import ttest_ind, linregress
# Fichier généré quotidiennement par NosDéputés.fr depuis le site de l'AN
csv = pd.read_csv("../data/turnover.csv", encoding='utf-8')
csv["groupes_majoritaires"] = (csv["groupe_sigle"] == "LREM") | (cs... |
JavascriptMick/deeplearning | seq2seq/sequence_to_sequence_implementation.ipynb | mit | import numpy as np
import time
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 ta... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/recommendation_systems/solutions/als_bqml_hybrid.ipynb | apache-2.0 | import os
PROJECT = "your-project-id-here" # REPLACE WITH YOUR PROJECT ID
# Do not change these
os.environ["PROJECT"] = PROJECT
%%bigquery --project $PROJECT
SELECT
processed_input,
feature,
TO_JSON_STRING(factor_weights),
intercept
FROM ML.WEIGHTS(MODEL movielens.recommender_16)
WHERE
(processed... |
khrapovs/metrix | notebooks/mle_probit.ipynb | mit | import numpy as np
import matplotlib.pylab as plt
import seaborn as sns
np.set_printoptions(precision=4, suppress=True)
sns.set_context('notebook')
%matplotlib inline
"""
Explanation: Probit
$$Y_{i}^{*}=X_{i}\theta+e_{i}$$
$$Y_{i}=\begin{cases}
1, & Y_{i}^{}>0,\
0, & Y_{i}^{}\leq0.
\end{cases}$$
End of explanation
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.