repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
widdowquinn/Teaching-SfAM-ECS | workshop/02b-blast.ipynb | mit | # Import Python libraries
%matplotlib inline
import os # This lets us interact with the operating system
from Bio import SeqIO # This lets us handle reading/writing sequence data
from Bio.Blast import NCBIWWW # This lets us run remote BLAST searches
"""
Explanation: <img src="images/JH... |
cmawer/pycon-2017-eda-tutorial | notebooks/1-RedCard-EDA/1-Redcard-Dataset.ipynb | mit | !conda install -c conda-forge pandas-profiling -y
!pip install missingno
%matplotlib inline
%config InlineBackend.figure_format='retina'
from __future__ import absolute_import, division, print_function
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib.pyplot import GridSpec
import seabor... |
PMEAL/OpenPNM | examples/simulations/percolation/relative_diffusivity.ipynb | mit | import numpy as np
import openpnm as op
%config InlineBackend.figure_formats = ['svg']
import matplotlib.pyplot as plt
%matplotlib inline
ws = op.Workspace()
np.random.seed(10)
ws.settings["loglevel"] = 40
np.set_printoptions(precision=5)
"""
Explanation: Relative Diffusivity
Generating the Network, adding Geometry an... |
FZJ-IEK3-VSA/tsam | examples/aggregation_segment_period_building_timeseries.ipynb | mit | %load_ext autoreload
%autoreload 2
import copy
import os
import pandas as pd
import matplotlib.pyplot as plt
import tsam.timeseriesaggregation as tsam
import tsam.hyperparametertuning as tune
import tqdm
%matplotlib inline
"""
Explanation: tsam - Optimal combination of segments and periods for building supply systems
... |
UWashington-Astro300/Astro300-W17 | 03_Python_Introduction.ipynb | mit | print("Hello World!")
# lines that begin with a # are treated as comment lines and not executed
# print("This line is not printed")
print("This line is printed")
"""
Explanation: IPython notebooks are a browser-based python environment that integrates:
Text
Executable python code
Plots and images
Rendered mathemat... |
jrg365/gpytorch | examples/00_Basic_Usage/Saving_and_Loading_Models.ipynb | mit | import math
import torch
import gpytorch
from matplotlib import pyplot as plt
"""
Explanation: Saving and Loading Models
In this bite-sized notebook, we'll go over how to save and load models. In general, the process is the same as for any PyTorch module.
End of explanation
"""
train_x = torch.linspace(0, 1, 100)
tr... |
supergis/git_notebook | pyadvanced/game_theory_py.ipynb | gpl-3.0 | from __future__ import division, print_function
import numpy as np
from quantecon.game_theory import NormalFormGame, Player
"""
Explanation: Tools for Game Theory
Daisuke Oyama
Faculty of Economics, University of Tokyo
This notebook demonstrates the functionalities of the game_theory module.
End of explanation
"""
... |
ToqueWillot/M2DAC | FDMS/TME4/TME4_FiltrageCollaboratif.ipynb | gpl-2.0 | def loadMovieLens(path='./data/movielens'):
#Get movie titles
movies={}
for line in open(path+'/u.item'):
id,title=line.split('|')[0:2]
movies[id]=title
# Load data
prefs={}
for line in open(path+'/u.data'):
(user,movieid,rating,ts)=line.split('\t')
prefs.setdefa... |
ymero/pyDataScienceToolkits_Base | NumPy/.ipynb_checkpoints/(6)linear_algebra-checkpoint.ipynb | mit | import numpy as np
"""
Explanation: 内容索引
矩阵 --- mat函数
线性代数 ---
numpy.linalg中的逆矩阵函数inv函数、行列式det函数、求解线性方程组的solve函数、内积dot函数、特征分解eigvals函数、eig函数、奇异值分解svd函数、广义逆矩阵的pinv函数
End of explanation
"""
A = np.mat('1 2 3; 4 5 6; 7 8 9')
print "Creation from string:\n", A
# 转置
print "Transpose A :\n", A.T
# 逆矩阵
print "Inverse A... |
opesci/devito | examples/seismic/tutorials/08_snapshotting.ipynb | mit | #NBVAL_IGNORE_OUTPUT
%reset -f
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Snapshotting with Devito using the ConditionalDimension
This notebook intends to introduce new Devito users (especially with a C or FORTRAN background) to the best practice on saving snapshots to disk... |
anhaidgroup/py_stringsimjoin | notebooks/Joining two tables using TF-IDF measure.ipynb | bsd-3-clause | # Import libraries
import py_stringsimjoin as ssj
import py_stringmatching as sm
import pandas as pd
import os
import sys
print('python version: ' + sys.version)
print('py_stringsimjoin version: ' + ssj.__version__)
print('py_stringmatching version: ' + sm.__version__)
print('pandas version: ' + pd.__version__)
"""
E... |
jfosorio/plldesigner | notebooks/Linearity.ipynb | mit | # Compatibility with python 3.0
from __future__ import division
# Array Computation and basic functions
import numpy as np
from numpy import (ones, log10, sin, pi, tan, sqrt)
# Plotting
import matplotlib.pyplot as plt
import matplotlib
## plotting settings
%matplotlib inline
matplotlib.rcParams['font.size'] = 12
mat... |
eduardojvieira/Curso-Python-MEC-UCV | 2-Numpy.ipynb | mit | import numpy as np
"""
Explanation: <table width="100%" border="0">
<tr>
<td><img src="./images/ing.png" alt="" align="left" /></td>
<td><img src="./images/ucv.png" alt="" align="center" height="100" width="100" /></td>
<td><img src="./images/mec.png" alt="" align="right"/></td>
</tr>
</table>
<br>
<h1 ... |
oemof/examples | oemof_examples/oemof.solph/v0.2.x/jupyter_tutorials/2_Processing_results_and_plotting.ipynb | gpl-3.0 | energysystem = solph.EnergySystem()
energysystem.restore(dpath=None, filename=None)
"""
Explanation: Restore the whole energysystem with results
End of explanation
"""
string_results = outputlib.views.convert_keys_to_strings(energysystem.results['main'])
print(string_results.keys())
"""
Explanation: Convert keys to... |
cbpygit/pypmj | examples/Getting started - for the impatient.ipynb | gpl-3.0 | import sys
sys.path.append('..')
import os
import numpy as np
"""
Explanation: Imports and configuration
Note: It is assumed that impatient people do not have a configuration file yet. You can learn on configuration files in the Setting up a configuration file notebook.
Since the parent directory, which contains the ... |
tianchuanting/Udacity | P3/P3.ipynb | mit | %matplotlib inline
import os, subprocess, mplleaflet, re, json
import xml.etree.ElementTree as ET
import pandas as pd
import geopandas as gpd
import seaborn as sns
from pymongo import MongoClient
from pprint import pprint
from collections import defaultdict
from shapely.geometry import shape
"""
Explanation: P3 - Wra... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
benvandyke/us-traffic-fatalities | Traffic-Fatalities-Analysis.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import StringIO
import zipfile
import urllib
from __future__ import division, print_function
matplotlib.style.use('fivethirtyeight')
%matplotlib inline
# Download and extract the 2015 FARS file
output = StringIO.StringIO()
output... |
metpy/MetPy | v0.12/_downloads/f1c8c5b9729cd7164037ec8618030966/upperair_declarative.ipynb | bsd-3-clause | from datetime import datetime
import pandas as pd
from metpy.cbook import get_test_data
import metpy.plots as mpplots
from metpy.units import units
"""
Explanation: Upper Air Analysis using Declarative Syntax
The MetPy declarative syntax allows for a simplified interface to creating common
meteorological analyses in... |
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies | ex13-Apply Hovmoller Diagram-The seasonal migration of rainfall in Africa.ipynb | mit | % matplotlib inline
import datetime as dt
import numpy as np
from netCDF4 import Dataset # http://unidata.github.io/netcdf4-python/
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.dates import MonthLocator, WeekdayLocator, DateFormatter
import matplotlib.ticker as ticker
"""
Explan... |
axbaretto/beam | examples/notebooks/tour-of-beam/windowing.ipynb | apache-2.0 | # Install apache-beam with pip.
!pip install --quiet apache-beam
"""
Explanation: Windowing -- Tour of Beam
Sometimes, we want to aggregate data, like GroupByKey or Combine, only at certain intervals, like hourly or daily, instead of processing the entire PCollection of data only once.
We might want to emit a moving a... |
kylepolich/dataskeptic | shownotes/acf-correlograms.ipynb | cc0-1.0 | %matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from datetime import datetime
import trulia.stats
import geocoder
import json
from datetime import timedelta
from collections import defaultdict
import time
import requests
from statsmodels.graphics import... |
p0licat/university | Competitions/qiskit-qchack/qiskit.ipynb | mit | from qiskit import QuantumCircuit
circ = QuantumCircuit(4, 4)
circ.ry(0, 0)
circ.rz(0, 0)
circ.ry(0, 1)
circ.rz(0, 1)
circ.ry(0, 2)
circ.rz(0, 2)
circ.ry(0, 3)
circ.rz(0, 3)
circ.cx(0, 1)
circ.cx(1, 2)
circ.cx(2, 3)
circ.ry(0, 0)
circ.rz(0, 0)
circ.ry(0, 1)
circ.rz(0, 1)
circ.ry(0, 2)
circ.rz(0, 2)
circ.ry(0, 3)
circ... |
gschivley/ERCOT_power | Midterm Report/Midway report.ipynb | mit | from IPython.display import SVG
SVG('https://www.dropbox.com/s/k8ac0la03hkjo5f/ERCOT%20power%20plants%202007.svg?raw=1')
"""
Explanation: Predicting Marginal Generating Units in ERCOT
Project Goals and Model Choices
The goal of this project is to build a model that can predict the type of fossil marginal generating un... |
bbfamily/abu | abupy_lecture/6-回测结果的度量(ABU量化使用文档).ipynb | gpl-3.0 | # 基础库导入
from __future__ import print_function
from __future__ import division
import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
import sys
# 使用insert 0即只使用github,避免交叉使用了pip安装的abupy,导致的... |
mkhuthir/learnPython | jupyter/Basics/keyboard-shortcuts.ipynb | mit | # mode practice
"""
Explanation: Keyboard shortcuts
In this notebook, you'll get some practice using keyboard shortcuts. These are key to becoming proficient at using notebooks and will greatly increase your work speed.
First up, switching between edit mode and command mode. Edit mode allows you to type into cells whi... |
QuantScientist/Deep-Learning-Boot-Camp | day03/1.3 Introduction - Keras.ipynb | mit | from kaggle_data import load_data, preprocess_data, preprocess_labels
X_train, labels = load_data('data/kaggle_ottogroup/train.csv', train=True)
X_train, scaler = preprocess_data(X_train)
Y_train, encoder = preprocess_labels(labels)
X_test, ids = load_data('data/kaggle_ottogroup/test.csv', train=False)
X_test, _ = p... |
ghvn7777/ghvn7777.github.io | content/fluent_python/10_list_modify_hash_slice.ipynb | apache-2.0 | from array import array
import reprlib
import math
class Vector:
typecode = 'd'
def __init__(self, components):
self._components = array(self.typecode, components) # 把 Vector 分量保存到一个数组中('d' 表示 double)
def __iter__(self):
return iter(self._components)
def __repr__(self):
... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties: 6... |
csc-training/python-introduction | notebooks/examples/7 - NumPy.ipynb | mit | import numpy as np
"""
Explanation: NumPy
NumPy is the fundamental package for scientific computing with Python. The main additions to the standard Python are
New datatype, NumPy array
static, multidimensional
Fast processing of arrays
Tools for linear algebra, random numbers, ...
Numpy array
The NumPy array is stat... |
justanr/notebooks | top-ten-experiment/analyzing_top_ten_lists.ipynb | mit | # set up all the data for the rest of the notebook
import json
from collections import Counter
from itertools import chain
from IPython.display import HTML
def vote_table(votes):
"""Render a crappy HTML table for easy display. I'd use Pandas, but that seems like
complete overkill for this simple task.
"""
... |
ES-DOC/esdoc-jupyterhub | notebooks/dwd/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: DWD
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
zedyang/vn.datayes | Tutorial_demo.ipynb | mit | # init.py
from base import *
if __name__ == '__main__':
ds = DataGenerator()
ds.download()
"""
Explanation: vn.past.demo - Welcome!
1. Preface
past 是一个从属于vn.trader的市场历史数据解决方案模块。主要功能为:
从datayes(通联数据)等web数据源高效地爬取、更新历史数据。
基于MongoDB的数据库管理、快速查询,各种输出格式的转换。
基于Matplotlib快速绘制K线图等可视化对象。
主要依赖:pymongo,pandas,request... |
mirjalil/DataScience | bigdata-platforms/pyspark-mllib-package.ipynb | gpl-2.0 | from pyspark import SparkContext
sc = SparkContext('local','example')
from pyspark.mllib.linalg import Vectors
x = Vectors.dense([1,2,3,4])
x[0]
x = [Vectors.dense([1,2,3,4,5]), Vectors.dense([6,7,8,9,10])]
xrdd = sc.parallelize(x, 2)
xrdd.glom().collect()
"""
Explanation: Machine Learning in Spark
Data Types
M... |
TiKeil/Master-thesis-LOD | notebooks/Figure_7.5_newShapes.ipynb | apache-2.0 | import os
import sys
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
from visualize import drawCoefficient, AllshapesSixdrawCoefficient
import buildcoef2d
bg = 0.05 #background
val = 1 #values
NWorldFine = np.array([11, 11])
"""
Explanation: New shapes function for constructi... |
heberqc/generador-grafos | proc-sol.ipynb | gpl-3.0 | %matplotlib inline
import FuncionesGrafos as fg
import numpy as np
from matplotlib import pyplot as plt
from scipy import stats
import pandas as pd
"""
Explanation: Análisis de muestra de grafo extraído de facebook
Secuencia de grados
Importar los paquetes
End of explanation
"""
Sg = fg.extrae_secuencia_grados(
... |
wgong/open_source_learning | learn_stem/python/dive-into-python-xml.ipynb | apache-2.0 | #import lxml.etree as etree
try:
from lxml import etree as etree
except ImportError:
import xml.etree.ElementTree as etree
tree = etree.parse('feed.xml')
root = tree.getroot()
root
"""
Explanation: Source : Dive Into Python - Chapter 12 XML by Mark Pilgrim
XML overview
XML is a generalized way of describing ... |
alandschaft/DataScienceMeetup | TextVectorization.ipynb | mit | # Import python libs
import sqlite3 as sqlite # work with sqlite databases
import os # used to set working directory
import pandas as pd # process data with pandas dataframe
import numpy as np
# Setup pandas display options
pd.options.display.max_colwidth = 500
# Constants
s... |
ilanman/gdi | week4/04_Week4_I_strings.ipynb | mit | import numpy as np
A = np.arange(25).reshape(5,5)
B = np.arange(25).reshape(5,5)
A
print np.diag(np.dot(A, B))
B.T
A * B.T
print np.sum(A * B.T, axis=1) # what does this do?
"""
Explanation: Week 3 Review
basic numpy manipulation
Write two ways to get the diagonal elements of a dot product of two matrices, A and... |
psiq/gdsfactory | notebooks/04__routing_single_optical_port.ipynb | mit | import pp
c = pp.Component()
mmi1 = c << pp.c.mmi1x2()
mmi2 = c << pp.c.mmi1x2()
mmi2.move((100, 50))
pp.qp(c)
"""
Explanation: Routing
Routing allows you to define routes between component ports
End of explanation
"""
from pp.routing.connect import connect_strip, connect_strip_way_points
connect_strip?
c = pp.Co... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session03/Day2/Databases.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.spatial import Delaunay
# from matplotlib.collections import LineCollection
import os
import copy
%matplotlib inline
"""
Explanation: Data Management Part 1
For April 25, 2017
Yusra AlSayyad (Princeton University)
This excerise demonst... |
HemantTiwariGitHub/AndroidNDSunshineProgress | HandCodedNN.ipynb | apache-2.0 | import numpy as np
import pickle
import gzip
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import h5py
import sklearn
import sklearn.datasets
import scipy
from PIL import Image
from scipy import ndimage
%matplotlib inline
"""
Explanation: <a href="https://cola... |
ioos/notebooks_demos | notebooks/2016-12-22-boston_light_swim.ipynb | mit | import warnings
# Suppresing warnings for a "pretty output."
warnings.simplefilter("ignore")
"""
Explanation: The Boston Light Swim temperature analysis with Python
In the past we demonstrated how to perform a CSW catalog search with OWSLib,
and how to obtain near real-time data with pyoos.
In this notebook we will u... |
ctralie/TUMTopoTimeSeries2016 | Wasserstein And Bottleneck.ipynb | apache-2.0 | #Do all of the imports and setup inline plotting
import time
import numpy as np
from scipy import sparse
from ripser import ripser
import cechmate as cm
from persim import plot_diagrams
from persim import wasserstein, wasserstein_matching
from persim import bottleneck, bottleneck_matching
%matplotlib notebook
import m... |
akloster/amplicon_classification | notebooks/amplicon_datasets.ipynb | isc | %load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn
import porekit
import re
import pysam
import random
import feather
import h5py
%matplotlib inline
training_data = feather.read_dataframe("amplicon_training_metadata.feather")
test_data = feather.re... |
JasonWayne/course-notes | ml-zb/lec01.ipynb | mit | %pylab inline
import numpy as np
import math
x = np.linspace(0.01, 3, 300)
y = [math.log(_) for _ in x]
plt.plot(x, y, 'r-', linewidth=3, label='log curve')
a = [x[20], x[175]]
b = [y[20], y[175]]
plt.plot(a, b, 'b-', linewidth=2)
plt.plot(a, b, 'b*', markersize=15, alpha=0.75)
plt.legend(loc='upper left')
plt.grid(Tru... |
jart/tensorflow | tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb | apache-2.0 | # Install TensorFlow; note that Colab notebooks run remotely, on virtual
# instances provided by Google.
!pip install -U -q tf-nightly
import os
import time
import tensorflow as tf
from tensorflow.contrib import autograph
import matplotlib.pyplot as plt
import numpy as np
import six
from google.colab import widgets... |
dawenl/cofactor | src/WMF_ML20M.ipynb | apache-2.0 | import itertools
import os
import sys
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy as np
import pandas as pd
from scipy import sparse
import content_wmf
import batched_inv_joblib
import rec_eval
"""
Explanation: Fit WMF (weighted matrix factorization) to the binarized ML20M
End of explanation
"""
DATA_DIR... |
cranium/deep-learning | 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'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
ulfaslak/bandicoot | immutable/demo/demo.ipynb | mit | %pylab inline
import seaborn as sns
"""
Explanation: Bandicoot
bandicoot is an open-source python toolbox to analyze mobile phone metadata.
For more information, see: http://bandicoot.mit.edu/
<hr>
End of explanation
"""
!head -n 5 data/ego.csv
!head -n 5 data/antennas.csv
"""
Explanation: Input files
<img src="mi... |
jeicher/cobrapy | documentation_builder/loopless.ipynb | lgpl-2.1 | %matplotlib inline
import plot_helper
import cobra.test
from cobra import Reaction, Metabolite, Model
from cobra.flux_analysis.loopless import construct_loopless_model
from cobra.flux_analysis import optimize_minimal_flux
from cobra.solvers import get_solver_name
"""
Explanation: Loopless FBA
The goal of this procedu... |
weleen/mxnet | example/notebooks/tutorials/aws_spot_price_predict_lstm.ipynb | apache-2.0 | import dateutil.parser
import pandas
import numpy as np
import matplotlib.pyplot as plt
import mpld3
%matplotlib inline
mpld3.enable_notebook()
from IPython.display import display, HTML
# Data format: Time, Instance type, OS, Availability Zone, Current Bid Price
# 2017-05-08 20:14:04+00:00,p2.xlarge,Linux/UNIX,us-we... |
albahnsen/ML_SecurityInformatics | notebooks/07-feature_selection.ipynb | mit | import pandas as pd
import numpy as np
import zipfile
with zipfile.ZipFile('../datasets/titanic.csv.zip', 'r') as z:
f = z.open('titanic.csv')
titanic = pd.read_csv(f, sep=',', index_col=0)
titanic.head()
titanic.Age.fillna(titanic.Age.median(), inplace=True)
titanic.loc[titanic.Embarked.isnull(), 'Embarked'] ... |
sherpa/sherpa | notebooks/ExamplePlots.ipynb | gpl-3.0 | import numpy as np
%matplotlib inline
from sherpa import data
from sherpa.astro import data as astrodata
from sherpa import plot
from sherpa.astro import plot as astroplot
"""
Explanation: A sample of plots
The idea of this notebook is to show off a number of plot types, and act as a simple check of the plotting ou... |
YuriyGuts/kaggle-quora-question-pairs | notebooks/feature-magic-cooccurrence-matrix.ipynb | mit | from pygoose import *
import os
import sys
from scipy.sparse import csr_matrix, dok_matrix
from sklearn.decomposition import TruncatedSVD
from sklearn.metrics.pairwise import cosine_distances, euclidean_distances, manhattan_distances
"""
Explanation: Feature: Distances Between Co-Occurrence Matrix Rows
This is a "m... |
mari-linhares/tensorflow-workshop | workshops/cdnextcon_2017/Walk-Through.ipynb | apache-2.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
# tensorflow
import tensorflow as tf
print('Expected TensorFlow version is v1.3.0 or higher')
print('Your TensorFlow version:', tf.__version__)
# data manipulation
import numpy as np
import... |
NEONScience/NEON-Data-Skills | tutorials/Python/Lidar/intro-lidar/merge_lidar_geotiff_files_py/merge_lidar_geotiff_files_py.ipynb | agpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import os, glob
from osgeo import gdal
"""
Explanation: syncID: 52f863b138b14d79a97e91422fc17b4f
title: "Merging GeoTIFF Files to Create a Mosaic"
description: "Learn to merge multiple GeoTIFF files to great a larger area of interest."
dateCreated: 2018-07-05
author... |
prody/ProDy-website | _static/ipynb/prody_basic.ipynb | mit | print('hello world!')
"""
Explanation: <img src="https://www.python.org/static/opengraph-icon-200x200.png" align="left" width="70" height="70"> <h1>Python Basics</h1>
Python is an interpreted language originally designed for general-purpose programming, but it also became a full-fledged tool for scentific computing th... |
WillenZh/deep-learning-project | face-generation/dlnd_face_generation.ipynb | mit | data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input'
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', data_dir)
"""
Explanation: 人脸生成(Face Generation)
在该项目中,你将使用生成式对抗网络(Generative Adversa... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/sandbox-3/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'sandbox-3', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: INM
Source ID: SANDBOX-3
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection, ... |
splicemachine/splice-community-sample-code | twimlcon-workshop-materials/2 - Feature Discovery.ipynb | apache-2.0 | #Begin spark session
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
#Create pysplice context. Allows you to create a Spark dataframe using our Native Spark DataSource
from splicemachine.spark import PySpliceContext
splice = PySpliceContext(spark)
#Iniatialize our Feature Store API
f... |
mne-tools/mne-tools.github.io | 0.22/_downloads/ba93e79a900327aac9ad4c8f17e818c8/plot_brainstorm_phantom_elekta.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import find_events, fit_dipole
from mne.datasets.brainstorm import bst_phantom_elekta
from mne.io import read_raw_fif
print(__doc__)
"""
Explanatio... |
as595/AllOfYourBases | TIARA/Tutorial/KeplerLightCurve.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: KeplerLightCurve.ipynb
‹ KeplerLightCurve.ipynb › Copyright (C) ‹ 2017 › ‹ Anna Scaife - anna.scaife@manchester.ac.uk ›
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Founda... |
aamirg/athena-hacks-honeywell | data_formatting.ipynb | apache-2.0 | from os import listdir
from os.path import isfile, join
"""
Explanation: The data used in this demo is available at https://archive.ics.uci.edu/ml/datasets/Gas+Sensor+Array+Drift+Dataset
Citation :Alexander Vergara and Shankar Vembu and Tuba Ayhan and Margaret A. Ryan and Margie L. Homer and Ramón Huerta, Chemical ga... |
robblack007/clase-dinamica-robot | Practicas/practica4/numerico.ipynb | mit | def f(t, x):
# Se importan funciones matematicas necesarias
from numpy import cos
# Se desenvuelven las variables que componen al estado
q1, q̇1 = x
# Se definen constantes del sistema
g = 9.81
m1, J1 = 0.3, 0.0005
l1 = 0.4
τ1 = 0
# Se calculan las variables a devolver por el sis... |
WoodResourcesGroup/RoundwoodHarvestGHG | wood_fates.ipynb | mit | HWu = pd.read_sql('''SELECT *
FROM so4
WHERE harvestslash = "X"
AND processingresidues = "X"
AND "post-usewoodproduct" = "X"
AND stumps is null''', sqdb['cx'],index_col = 'index')
HWo = pd.read_sql('... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/Python Debugger (pdb)-checkpoint.ipynb | apache-2.0 | x = [1,3,4]
y = 2
z = 3
result = y + z
print result
result2 = y+x
print result2
"""
Explanation: Python Debugger
You've probably used a variety of print statements to try to find errors in your code. A better way of doing this is by using Python's built-in debugger module (pdb). The pdb module implements an interacti... |
brian-rose/env-415-site | assignments/Assignment04.ipynb | mit | # The usual import statements to get us started
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import climlab
"""
Explanation: ENV / ATM 415: Climate Laboratory, Spring 2016
Assignment 4
Out: Tuesday March 8, 2016
Due: Thursday March 24, 2016 at 10:15 am.
Your assignment
Answer all questions be... |
zzsza/Datascience_School | 08. 미적분과 최적화/01. SymPy를 사용한 함수 미분.ipynb | mit | def f(x):
return 2*x
x = 10
y = f(x)
print(x, y)
"""
Explanation: SymPy를 사용한 함수 미분
데이터 분석에서 미분의 필요성
그다지 관련이 없어 보이지만 사실 데이터 분석에도 미분(differentiation)이 필요하다. 데이터 분석의 목표 중 하나는 확률 모형의 모수(parameter)나 상태 변수(state)를 추정(estimation)하는 작업이다. 이러한 작업은 근본적으로 함수의 최소점 혹은 최대점을 찾는 최적화(optimization) 작업이며 미분 혹은 편미분을 사용한 도함수를 필요로 한다... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_topo_compare_conditions.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.viz import plot_evoked_topo
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
"""
... |
zhuanxuhit/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
paris-saclay-cds/python-workshop | Day_1_Scientific_Python/__solved__04-scipy_statsmodels_introduction.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: <img width=700px; src="../img/logoUPSayPlusCDS_990.png">
<p style="margin-top: 3em; margin-bottom: 2em;"><b><big><big><big><big>Introduction to Scipy and Statsmodels libraries</big></big></big></big></b></p>
End of explanation
"""
... |
sourabhrohilla/ds-masterclass-hands-on | session-2/python/Named_Entity_Recommender.ipynb | mit | PATH_NEWS_ARTICLES="/home/phoenix/Documents/HandsOn/Final/news_articles.csv"
ARTICLES_READ=[4,5,7,8]
NUM_RECOMMENDED_ARTICLES=5
ALPHA = 0.5
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import re
from nltk.stem.... |
google/starthinker | colabs/bigquery_function.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: BigQuery Function
Add a custom function or table to a dataset.
License
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 co... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/quantile_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
data = sm.datasets.engel.load_pandas().data
data.head()
"""
Explanation: Quantile regression
This example page shows how to use statsmodels' QuantReg class to r... |
nouiz/summerschool2015 | convnets/lenet.ipynb | bsd-3-clause | import numpy
import theano
import theano.tensor as T
from logistic_sgd import LogisticRegression
from mlp import HiddenLayer
"""
Explanation: This notebook demonstrates the LeNet model.
First we load some dependencies for our code.
End of explanation
"""
from theano.tensor.signal import downsample
from theano.tens... |
cgrudz/cgrudz.github.io | teaching/stat_775_2021_fall/activities/activity-2021-09-20.ipynb | mit | # This code has an intentional error. You can type it directly or
# use it for reference to understand the error message below.
def favorite_ice_cream():
ice_creams = [
'chocolate',
'vanilla',
'strawberry'
]
print(ice_creams[3])
favorite_ice_cream()
"""
Explanation: Introduction to... |
nkarast/notebooks | sympy1.ipynb | mit | from sympy import *
import math
3 + math.sqrt(3)
expr = 3 * sqrt(3)
expr
init_printing(use_latex='mathjax')
expr
expr = sqrt(8)
expr
"""
Explanation: Tutorial Brief
Disclaimer: Notebook taken from https://www.youtube.com/channel/UC98x5I1LVPhtnUHDyujq7zg
SymPy is symbolic mathematics library written completely in ... |
bcorlett/Notebooks_Modelling | Corlett_Assign5.ipynb | mit | #Import toolboxes
from scipy import sparse #Allows me to create sparse matrices (i.e. not store all of the zeros in the 'A' matrix)
from scipy.sparse import linalg as linal
from numpy import * #To make matrices and do matrix manipulation
import matplotlib.pyplot as plt
import matplotlib.cm as cm #Load colormaps
plt.st... |
google/profit-bidder | solution_test/profit_bidder_quickstart.ipynb | apache-2.0 | # Copyright 2022 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, so... |
scruwys/and-the-award-goes-to | notebooks/analysis.ipynb | mit | import re
import numpy as np
import pandas as pd
import scipy.stats as stats
pd.set_option('display.float_format', lambda x: '%.3f' % x)
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sb
sb.set(color_codes=True)
sb.set_palette("muted")
np.random.seed(sum(map(ord, "reg... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/mri-esm2-0/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'mri-esm2-0', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: MRI
Source ID: MRI-ESM2-0
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties:... |
liganega/Gongsu-DataSci | previous/y2017/GongSu04_Python_DataTypes_Part_2.ipynb | gpl-3.0 | import urllib.request
page = urllib.request.urlopen("http://beans-r-us.appspot.com/prices.html")
text = page.read().decode("utf8")
"""
Explanation: 파이썬 기본 자료형 2부
수정 사항
문자열 메소드 사용 예제: 보다 실용적인 예제였으면 함.
요약
문자열 자료형 다루기
문자열 메소드 활용
응용: 웹 상에 있는 데이터를 가져와서 정보 활용하기
준비 사항
문자열의 정의화 기초적인 활용법에 대한 자세한 설명은
여기를
참조한다.
최... |
gfeiden/Notebook | Daily/20150724_Kepler_452.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: On Kepler 452
Kepler 452 is a solar-like star in the Kepler field that was recently announced to possess a planet with an orbit of 385 Earth days. Based on a stellar evolution model analysis of the host star, the planet is found to ... |
flavioamieiro/AlertaDengue | notebooks/rasterio-fiona.ipynb | gpl-3.0 | from glob import glob
from math import floor, log10, ceil
from matplotlib import pyplot as plt
from pprint import pprint
from rasterio.features import rasterize
from rasterio.transform import from_origin, IDENTITY
import fiona
import geopandas as gpd
import gdal
import geopy.distance
import numpy as np
import rasterio... |
dlab-berkeley/python-taq | merge_py/clean_dsenames.ipynb | bsd-2-clause | import pandas as pd
import numpy as np
dsenames = pd.read_csv('../crsp/dsenames.csv')
"""
Explanation: In this file, we prepare the first of a few CRSP files we will be using in the TAQ/CRSP merge. The main goals are to: 1) select the subset of securities in the original dsenames.csv file that we want to examine; 2) ... |
SATHVIKRAJU/Inferential_Statistics | Human_Temp.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
df = pd.read_csv('data/human_body_temperature.csv')
df.head()
"""
Explanation: What is the True Normal Human Body Temperature?
Background
The mean normal body temperature was held to be 37$^{\circ}$C or 98.6$^{\circ}$F for m... |
rabernat/xgcm | doc/grid_metrics.ipynb | mit | import xarray as xr
import numpy as np
from xgcm import Grid
import matplotlib.pyplot as plt
%matplotlib inline
# hack to make file name work with nbsphinx and binder
import os
fname = '../datasets/mitgcm_example_dataset_v2.nc'
if not os.path.exists(fname):
fname = '../' + fname
ds = xr.open_dataset(fname)
ds... |
mikelseverson/Udacity-Deep_Learning-Nanodegree | reinforcement/Q-learning-cart.ipynb | mit | import gym
import tensorflow as tf
import numpy as np
"""
Explanation: Deep Q-learning
In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called Cart-Pole. In this game, a freely swinging p... |
dsacademybr/PythonFundamentos | Cap04/Notebooks/DSA-Python-Cap04-Exercicios-Solucao.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 4</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Exerc... |
Ccaccia73/semimonocoque | 05_CorrectiveSolutions-6nodes-2loops.ipynb | mit | from pint import UnitRegistry
import sympy
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import sys
%matplotlib inline
from IPython.display import display
"""
Explanation: Semi-Monocoque Theory: corrective solutions
End of explanation
"""
from Section import Section
"""
Explanation: Impor... |
cydcowley/Imperial-Visualizations | visuals_maths/2D_Transformations/notebook/2D_transformations.ipynb | mit | # Import libraries/packages to be used (HIT SHIFT + ENTER TO RUN CELL)
import numpy as np
import math as ma
import plotly.figure_factory as ff
from plotly.offline import download_plotlyjs,init_notebook_mode,plot,iplot
import plotly.graph_objs as go
init_notebook_mode(connected=True)
"""
Explanation: <img src="imperia... |
aleph314/K2 | Regression/intro_regression.ipynb | gpl-3.0 | e = np.random.randn(50)
w = 3
x = np.random.rand(50)*np.random.randint(0,10,50)
y = w*x + 2*e
x
x[41], y[41]
sns.regplot(x, y, ci=False)
plt.plot((x[25], x[25]), (13, y[25]-0.3), 'r:');
plt.plot((x[41], x[41]), (y[41]+0.3, 14.5), 'r:');
import pandas as pd
from pandas import DataFrame as DF, Series
import numpy as... |
EvanBianco/Practical_Programming_for_Geoscientists | Ex__Volumetrics.ipynb | apache-2.0 | thick = 80 # metres
area = 20000 * 30000 # metres
grv = thick * area
grv
from IPython import display
display.Image("http://subsurfwiki.org/images/6/66/Geometric_correction_factor.png", width=600)
height = 100
ratio = thick / height
top = 'slab'
if top == 'round':
g = -0.6 * ratio + 1
elif top == 'f... |
intel-analytics/analytics-zoo | apps/automl/nyc_taxi_dataset.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
"""
Explanation: Automated ML for time series predicion
We used one of the dataset in Numenta Anomaly Benchmark (NAB) for demo, i.e. NYC taxi passengers dataset, which contains 10320 records, each indicating the total number of taxi passengers in NYC at a corresonponding time spot.
E... |
tensorflow/docs-l10n | site/ja/xla/tutorials/autoclustering_xla.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... |
boffi/boffi.github.io | dati_2015/ha03/05_Rigid_System.ipynb | mit | from fractions import Fraction as frac
def d(v): return v
def delta(v): return v
def dot(v): return v
def ddot(v): return v
"""
Explanation: Rigid System
Our problem is described by the following figure:
<img src="trabacolo.svg" style="width:100%">
Solution
To solve this problem we we'll use fractions and dumm... |
GoogleCloudPlatform/ai-notebooks-extended | dataproc-hub-example/build/infrastructure-builder/mig/files/gcs_working_folder/examples/Environment Checks/02 - google-cloud-bigquery.ipynb | apache-2.0 | # Performs a query
QUERY = (
'SELECT * from `bigquery-public-data.usa_names.usa_1910_2013` '
'WHERE state = "CA" '
'LIMIT 5')
# API request
query_job = client.query(QUERY)
# Waits for query to finish
rows = query_job.result()
for row in rows:
print(row)
df = query_job.to_dataframe()
df
"""
Explana... |
PHBS-2017-ASP-Classroom/SABRmodel_Base | Demo_GHQ.ipynb | mit | import numpy as np
import numpy.polynomial as nppoly
import scipy
import scipy.stats as ss
import matplotlib.pyplot as plt
const = 1/np.sqrt(2.0*np.pi)
z, w = nppoly.hermite_e.hermegauss(deg=20)
w = w*const
print(z)
print(w)
pdf = ss.norm.pdf(z)
plt.plot(z, np.log(w))
plt.plot(z, np.log(pdf))
plt.grid()
plt.show()
... |
quantopian/research_public | notebooks/data/quandl.cboe_vvix/notebook.ipynb | apache-2.0 | # For use in Quantopian Research, exploring interactively
from quantopian.interactive.data.quandl import cboe_vvix as dataset
# import data operations
from odo import odo
# import other libraries we will use
import pandas as pd
# Let's use blaze to understand the data a bit using Blaze dshape()
dataset.dshape
# And ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.