repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
privong/pythonclub | sessions/parallel/PP_Astrpo_example.ipynb | gpl-3.0 | # Astro-example
####################
#Cosmic cleanning of an image of 12 detectors
#Uses L.A. Cosmic from P. van Dokkum
#Requires python version of la_cosmic
#http://www.astro.yale.edu/dokkum/lacosmic/
#it also uses Parallel python PP
##################
#
# La_cosmic must be in the same directory
#
#
import sys, os... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/ec-earth3-cc/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3-cc', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: EC-EARTH3-CC
Topic: Atmosch... |
tritemio/multispot_paper | realtime kinetics/Convert us-ALEX SM files to Photon-HDF5.ipynb | mit | filename = '0023uLRpitc_NTP_20dT_0.5GndCl.sm'
"""
Explanation: Convert µs-ALEX SM files to Photon-HDF5
<p class="lead">This <a href="https://jupyter.org/">Jupyter notebook</a>
will guide you through the conversion of a µs-ALEX data file from <b>SM</b> (WeissLab)
to <a href="http://photon-hdf5.org">Photon-HDF5</a> form... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/recursive_ls.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
from pandas_datareader.data import DataReader
np.set_printoptions(suppress=True)
"""
Explanation: Recursive least squares
Recursive least squares is an expanding window version of ordinary least squa... |
tensorflow/model-optimization | tensorflow_model_optimization/g3doc/guide/pruning/pruning_with_keras.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... |
rule-lab/ligfit | notebook/Derivation of Binding Equation.ipynb | gpl-3.0 | #Kd-prime and Kd-doubleprime as expressions of Kd and alpha (cooperativity)
#as well as their concentration ratios
kd, alpha, p, l, pl, plp = symbols('K_{D} alpha [P] [L] [PL] [PLP]')
kd_p = Eq(kd / 2, p * l / pl)
kd_p
kd_pp = Eq(2 * kd / alpha, p * pl / plp)
kd_pp
"""
Explanation: The Binding Model
The binding mod... |
Photon-HDF5/photon_hdf5_reading_examples | python/Reading µs-ALEX data from Photon-HDF5.ipynb | mit | from __future__ import division, print_function # only needed on py2
%matplotlib inline
import numpy as np
import tables
import matplotlib.pyplot as plt
"""
Explanation: Reading µs-ALEX data from Photon-HDF5
In this notebook we show how to read a µs-ALEX smFRET measurement stored in *
Photon-HDF5 format
using python... |
ES-DOC/esdoc-jupyterhub | notebooks/snu/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', 'snu', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: SNU
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/2_dataset_api.ipynb | apache-2.0 | # The json module is mainly used to convert the python dictionary above into a JSON string that can be written into a file
import json
# The math module in python provides some mathematical functions
import math
# The OS module in python provides functions for interacting with the operating system
import os
# The pprin... |
WNoxchi/Kaukasos | quantum/pyquil-notes_intro-quantum-computing.ipynb | mit | %matplotlib inline
%reload_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
# http://pyquil.readthedocs.io/en/latest/intro.html
outcome_0 = np.array([1.0, 0.0]) # orthonorm basis vecs
outcome_1 = np.array([0.0, 1.0])
a = 0.75
b = 0.25
# vec(v) = a*vec(0) + b*vec(1)
prob_bit = a*outcome_... |
AllenDowney/ThinkBayes2 | soln/chap10.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename... |
hamnonlineng/hamnonlineng | examples/Example_5th_order_Hamiltonian.ipynb | bsd-3-clause | import hamnonlineng as hnle
"""
Explanation: Find frequencies that make only $(\hat{a}^2\hat{b}^2+\hat{a}\hat{b}\hat{d}^2+\hat{d}^4)\hat{c}^\dagger +h.c.$ resonant in the 5th order expansion of $\sin(\hat{a}+\hat{b}+\hat{c}+\hat{d}+h.c.)$
Import the "Hamiltonian-through-Nonlinearities Engineering" module (it can be in... |
ethen8181/machine-learning | model_selection/collinearity.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()
os.chdir(path)
# 1. magic for inline plot
# 2. magic to print version
# 3. magic so that ... |
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies | ex07-Interpolate 2D field on regular and irregular grids.ipynb | mit | % matplotlib inline
import numpy as np
from scipy.interpolate import interp2d, griddata
import matplotlib.pyplot as plt
import numpy.ma as ma
from numpy.random import uniform, seed
from netCDF4 import Dataset as netcdf # netcdf4-python module
"""
Explanation: Interpolate 2D field on regular and irregular grids
From ... |
SheffieldML/notebook | compbio/factorAnalysis.ipynb | bsd-3-clause | import numpy as np
import GPy
%matplotlib inline
#%config InlineBackend.figure_format = 'svg'
from pylab import *
np.random.seed(113321)
# Prepare the data
N,D,Q = 500, 100, 3
pi = 0.2
# sample from 3 random sine waves
X = np.sin(2*np.pi*(np.random.rand(Q)[None,:]+.5)*(np.linspace(0.,3.,N)[:,None]-np.random.rand(Q)[No... |
csiu/datasci | text/2015-07-23_nltk-and-POS.ipynb | mit | import pandas as pd
import nltk
from nltk.corpus import stopwords
from nltk.stem import SnowballStemmer
from collections import Counter
"""
Explanation: Purpose: To experiment with Python's Natural Language Toolkit.
NLTK is a leading platform for building Python programs to work with human language data
End of explan... |
rawrgulmuffins/presentation_notes | pycon2016/tutorials/computation_statistics/sampling.ipynb | mit | %matplotlib inline
from __future__ import print_function, division
import numpy
import scipy.stats
import matplotlib.pyplot as pyplot
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.random.seed(18)
# some nicer... |
lia-statsletters/notebooks | people/populations.ipynb | gpl-3.0 | F=graphviz.Graph()#(engine='neato')
F.graph_attr['rankdir'] = 'LR'
F.edge('A_1','B_1')
F.edge('A_1','B_2')
F.edge('A_2','B_1')
F.edge('A_3','B_1')
F.edge('A_4','B_2')
F.edge('A_5','B_2')
F.edge('A_5','B_3')
F
"""
Explanation: Studying relations between clusters of people and clusters of stuff they purchase
The old say... |
xianjunzhengbackup/code | http/Basic Python Request lib.ipynb | mit | url='http://httpbin.org'
req=requests.get(url+'/basic-auth/user/passwd',auth=('user','passwd'))
print(req.text)
print(req.url)
print(req.status_code)
import json
payload={'some':'data'}
headers={'Content-Type':'application/json','Authorization':'some token'}
req=requests.post(url+'/post',data=json.dumps(payload),... |
mcflugen/bmi-tutorial | notebooks/cem_example.ipynb | mit | %matplotlib inline
"""
Explanation: <img src="images/csdms_logo.jpg">
Using a BMI: Coastline Evolution Model
This example explores how to use a BMI implementation using the CEM model as an example.
Links
CEM source code: Look at the files that have deltas in their name.
CEM description on CSDMS: Detailed information ... |
captain-proton/aise | documentation/source/nia/jupyter_nb/exercise_5.ipynb | gpl-3.0 | def djb2(value, M=np.power(2, 32)):
x_i = 5381
for i in range(len(value)):
char = value[i]
x_i = ((33 * x_i) + ord(char)) % M
return x_i
print('djb2 of "Hallo Welt": %d' % djb2('Hallo Welt'))
"""
Explanation: Übung 5
5.1 Hashfunktionen und DHT
5.1.1 Hashfunktion djb2
Es soll die Hashfunkti... |
leriomaggio/python-in-a-notebook | 10 External files.ipynb | mit | file_loc = 'data/elderlyHeightWeight.csv'
f_hand = open(file_loc, 'r')
print(f_hand)
"""
Explanation: Text Files
Data is often stored in formats that are not easy to read unless you have some specialised software. Excel spreadsheets are one example; how do you read an Excel spreadsheet if you don't have Excel? This re... |
mne-tools/mne-tools.github.io | 0.19/_downloads/ae8fb158e1a8fbcc6dff5d3e55a698dc/plot_30_filtering_resampling.ipynb | bsd-3-clause | import numpy as np
import mne
from mne.datasets import sample
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
proj_fname = data_path + '/MEG/sample/sample_audvis_eog_proj.fif'
tmin, tmax = 0, 20 # use the first 20s of data
# Setup for reading the raw data (save memory by c... |
julienchastang/unidata-python-workshop | notebooks/XArray/XArray Introduction.ipynb | mit | # Convention for import to get shortened namespace
import numpy as np
import xarray as xr
# Create some sample "temperature" data
data = 283 + 5 * np.random.randn(5, 3, 4)
data
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; height:98px;">
<img src="https://raw.githubusercontent.co... |
wheeler-microfluidics/teensy-minimal-rpc | teensy_minimal_rpc/notebooks/dma-examples/Example - Periodic multi-channel ADC multiple samples using DMA.ipynb | gpl-3.0 | import pandas as pd
def get_pdb_divide_params(frequency, F_BUS=int(48e6)):
mult_factor = np.array([1, 10, 20, 40])
prescaler = np.arange(8)
clock_divide = (pd.DataFrame([[i, m, p, m * (1 << p)]
for i, m in enumerate(mult_factor)
for p in... |
fja05680/pinkfish | examples/240.double-7s-portfolio/strategy.ipynb | mit | import datetime
import matplotlib.pyplot as plt
import pandas as pd
import pinkfish as pf
import strategy
# Format price data.
pd.options.display.float_format = '{:0.2f}'.format
%matplotlib inline
# Set size of inline plots
'''note: rcParams can't be in same cell as import matplotlib
or %matplotlib inline
... |
eblur/clarsach | notebooks/TestChandraHETG.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
try:
import seaborn as sns
except ImportError:
print("No seaborn installed. Oh well.")
import numpy as np
import pandas as pd
import astropy.io.fits as fits
import sherpa.astro.ui as ui
import astropy.modeling.models as models
from astropy.modeling.fittin... |
explosion/thinc | examples/00_intro_to_thinc.ipynb | mit | !pip install "thinc>=8.0.0" "ml_datasets>=0.2.0" "tqdm>=4.41"
"""
Explanation: Intro to Thinc for beginners: defining a simple model and config & wrapping PyTorch, TensorFlow and MXNet
This example shows how to get started with Thinc, using the "hello world" of neural network models: recognizing handwritten digits fro... |
ckemere/CloudShuffles | score_bayes_parallel-dask-joblib.ipynb | gpl-3.0 | import numpy as np
import os
import pandas as pd
import warnings
import nelpy as nel
warnings.filterwarnings("ignore")
"""
Explanation: Score multi-session events using the replay score from Davidson et al.
End of explanation
"""
import gcsfs
import pandas as pd
fs = gcsfs.GCSFileSystem(project='polar-program-784... |
nick-youngblut/SIPSim | ipynb/.ipynb_checkpoints/standard_vs_our_conditions-checkpoint.ipynb | mit | import numpy as np
%load_ext rpy2.ipython
%%R
library(ggplot2)
library(dplyr)
"""
Explanation: Description
Determining how differences in our isopycnic cfg conditions vary in meaningful ways from those of Clay et al., 2003. Eur Biophys J
Needed to determine whether the Clay et al., 2003 function describing diffusio... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/ec-earth3/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: EC-EARTH3
Topic: Seaice
Sub-Topics: ... |
rflamary/POT | notebooks/plot_stochastic.ipynb | mit | # Author: Kilian Fatras <kilian.fatras@gmail.com>
#
# License: MIT License
import matplotlib.pylab as pl
import numpy as np
import ot
import ot.plot
"""
Explanation: Stochastic examples
This example is designed to show how to use the stochatic optimization
algorithms for descrete and semicontinous measures from the P... |
ARM-software/lisa | ipynb/deprecated/examples/wlgen/rtapp_example.ipynb | apache-2.0 | import logging
from conf import LisaLogging
LisaLogging.setup()
# Generate plots inline
%pylab inline
import json
import os
# Support to initialise and configure your test environment
import devlib
from env import TestEnv
# Support to configure and run RTApp based workloads
from wlgen import RTA, Periodic, Ramp, St... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch3-Animation_ThreePhaseCurrents.ipynb | unlicense | %pylab notebook
"""
Explanation: Electric Machinery Fundamentals 5th edition
Chapter 3
Animation: Three-phase currents
(based on Example 3-1)
Calculate the combined currents of a three-phase stator (adapted for 50Hz).
Import the PyLab namespace (provides set of useful commands and constants like $\pi$):
End of explana... |
BinRoot/TensorFlow-Book | ch09_cnn/Concept01_cifar.ipynb | mit | import pickle
def unpickle(file):
fo = open(file, 'rb')
dict = pickle.load(fo, encoding='latin1')
fo.close()
return dict
"""
Explanation: Ch 09: Concept 01
Using the CIFAR-10 dataset
Download the CIFAR-10 dataset for Python here https://www.cs.toronto.edu/~kriz/cifar.html.
The documentation comes with... |
mwalli/spark-cloudant | tutorials/InterConnect2017_Python_RESULT.ipynb | apache-2.0 | properties = {
'twitter': {
'restAPI': 'https://xxx:xxx@cdeservice.mybluemix.net/api/v1/messages/search',
'username': 'xxx',
'password': 'xxx'
},
'cloudant': {
'account':'https://xxx:xxx@xxx.cloudant.com',
... |
rvuduc/cse6040-ipynbs | 28--kmeans-part2.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
"""
Explanation: CSE 6040, Fall 2015 [28]: K-means Clustering, Part 2
Last time, we implemented the basic version of K-means. In this lecture we will explore some advanced techniques
to improve the performa... |
mbeyeler/opencv-machine-learning | notebooks/08.03-Classifying-Handwritten-Digits-Using-k-Means.ipynb | mit | from sklearn.datasets import load_digits
digits = load_digits()
digits.data.shape
"""
Explanation: <!--BOOK_INFORMATION-->
<a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 100px; background: ... |
feststelltaste/software-analytics | demos/20190311_SoftwareArchitectureSummit_Muenchen/Wertloser Code.ipynb | gpl-3.0 | import pandas as pd
coverage = pd.read_csv("../dataset/jacoco_demo.csv")
coverage.head()
"""
Explanation: Wertlose Codeteile
im Projekt "Spring PetClinic"
Teil 1: Nutzungsstatistiken
Nutzungsdaten vom Produktivbetrieb
End of explanation
"""
coverage['lines'] = coverage.LINE_MISSED + coverage.LINE_COVERED
coverage['c... |
antoniomezzacapo/qiskit-tutorial | community/aqua/artificial_intelligence/qsvm_kernel_directly.ipynb | apache-2.0 | from datasets import *
from qiskit_aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name
from qiskit_aqua.input import get_input_instance
from qiskit_aqua import run_algorithm, get_feature_map_instance, get_algorithm_instance, get_multiclass_extension_instance
"""
Explanation: Quantum SVM (quantu... |
hethapu/big-data-python-class | Lectures/Lecture4-Matplotlib/Data_Visualization.ipynb | mit | from IPython.display import Image
from IPython.core.display import HTML
Image(url= "https://upload.wikimedia.org/wikipedia/commons/b/ba/Data_visualization_process_v1.png"
,height=400, width=550)
"""
Explanation: Data Visualization
Adapted from from <underline> 3. Plotting and Visualization.ipynb </underline> f... |
neuro-data-science/neuro_data_science | python/basics/simple_stats_and_uncertainty.ipynb | gpl-3.0 | # The data
# N = 25
N = 75
mu1 = 7
mu2 = 10
sd = 5
# Generate random data
data1 = sd * np.random.randn(N) + mu1
data2 = sd * np.random.randn(N) + mu2
"""
Explanation: Simple statistics and quantifying uncertainty
In any data analysis, it's important to visualize distributions and quantify statistics about those distr... |
py-bootcamp/python-for-beginners | notebooks/part_3.ipynb | cc0-1.0 | my_name = "Christian"
# 9 letters
len(my_name)
my_list = [1,2,3,4,5]
# elements inside a list
len(my_list)
# elements inside a dictionary
my_dict = {"first": "1", "second": "2"}
len(my_dict)
"""
Explanation: Built-in functions
What are the built-in functions?
The Python interpreter has a number of functions and ... |
ueapy/enveast_python_course_materials | Day_3/solutions/19-Cartopy-Intro-Solution.ipynb | mit | import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Brief look at Cartopy
Cartopy is a Python package that provides easy creation of maps with matplotlib.
Cartopy vs Basemap
Cartopy is better integrated with matplotlib and in a more active development state
Proper handling of datelines in cartopy - on... |
enbanuel/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
def random_line(m, b, sigma, size=10):
"""Create a line y = m*x + b + N(0,si... |
CamDavidsonPilon/lifelines | examples/Piecewise Exponential Models and Creating Custom Models.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from lifelines.datasets import load_waltons
waltons = load_waltons()
T, E = waltons['T'], waltons['E']
from lifelines import ExponentialFitter
fig, ax = plt.subplots(nrows=1,... |
KIPAC/StatisticalMethods | tutorials/ogle_lightcurve.ipynb | gpl-2.0 | exec(open('tbc.py').read()) # define TBC and TBC_above
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Tutorial: Lightcurve Data
In the next couple of notebooks, we'll be looking at data from the Optical Gravitational Lensing Experiment (... |
encima/Comp_Thinking_In_Python | Session_1/1_Introduction.ipynb | mit | "Hello, People"
"""
Explanation: Computational Thinking
Dr. Christopher Gwilliams
gwilliamsc@cardiff.ac.uk
Computational Thinking?
Computational Thinking is the thought processes involved in formulating problems and their solutions so that the solutions are represented in a form that can be effectively carried out by ... |
JohnCrickett/PythonExamples | Functional Programming in Python.ipynb | mit | sequence = [1, 2, 3, 4, 5]
def square(x):
return x**2
result = list(map(square, sequence))
print(result)
"""
Explanation: Functional Programming in Python
Interest in Functional Programming is currently growing as more developers become aware of the benefits it offers, particularly with respect to concurrency... |
EnergyID/opengrid | scripts/Demo_Houseprint.ipynb | gpl-2.0 | import os, inspect, sys
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = 16,8
from opengrid.library.houseprint import houseprint
"""
Explanation: General Imports
!! IMPORTANT !!
Make sure the path to the opengrid folder is added to your PYTHONPATH
End of explana... |
sot/aimpoint_mon | testing/offsets_vs_ofls/large_offset_check.ipynb | bsd-2-clause | arlac_text = """obsid targ_ra targ_dec y_det_offset z_det_offset q1 q2 q3 q4
----- -------------- ------------ ------------ ------------ ------------ ---------- ----------- ----------
17351 332.170000 45.742306 0.000000 0.000000 -0.87203164 0.078... |
graphistry/pygraphistry | demos/demos_databases_apis/databricks_pyspark/graphistry-notebook-dashboard.ipynb | bsd-3-clause | # Uncomment and run first time
! pip install graphistry
#! pip install git+https://github.com/graphistry/pygraphistry.git@dev/databricks
# Can sometimes help:
#dbutils.library.restartPython()
#Optional: Uncomment - We find this speeds up calls 10%+ on some datasets
#spark.conf.set("spark.sql.execution.arrow.enabl... |
GoogleCloudPlatform/tf-estimator-tutorials | 00_Miscellaneous/tfx/tfx-pipelines/02-census-tfx-pipeline.ipynb | apache-2.0 | import os
ROOT_DIR = '..'
DATA_DIR = ROOT_DIR + '/data'
TRAIN_DATA_DIR = DATA_DIR + '/train'
RAW_SCHEMA_DIR = ROOT_DIR + '/raw_schema'
OUTPUT_DIR = ROOT_DIR + '/workspace'
SRC_DIR = ROOT_DIR + '/src'
"""
Explanation: ML with TensorFlow Extended (TFX) Pipelines
Extracting the new training data from the source using E... |
quantumlib/Cirq | docs/qcvv/isolated_xeb.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... |
ankurankan/pgmpy | examples/Structure Learning with TAN.ipynb | mit | import networkx as nx
import matplotlib.pyplot as plt
from pgmpy.models import BayesianNetwork
# class variable is A and feature variables are B, C, D, E and R
model = BayesianNetwork([("A", "R"), ("A", "B"), ("A", "C"), ("A", "D"), ("A", "E")])
nx.draw_circular(
model, with_labels=True, arrowsize=30, node_size=80... |
pysg/pyther | Modelo de impregnacion/modelo2/Activité 10_Viernes_Revisión3.ipynb | mit | import numpy as np
from scipy import integrate
from matplotlib.pylab import *
"""
Explanation: Evaluation des modèles pour l'extraction supercritique
L'extraction supercritique est de plus en plus utilisée afin de retirer des matières organiques de différents liquides ou matrices solides. Cela est dû au fait que les f... |
andmax/gpufilter | python/alg5cpe.ipynb | mit | import math
import cmath
import numpy as np
from scipy import ndimage, linalg
from skimage.color import rgb2gray
from skimage.measure import structural_similarity as ssim
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
%matplotlib inline
plt.gray() # to plot gray images using gray scale
... |
tensorflow/docs-l10n | site/en-snapshot/tfx/tutorials/tfx/gcp/vertex_pipelines_bq.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... |
garth-wells/notebooks-3D7 | 02-ShapeFunctions.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Use seaborn to style the plots and use accessible colors
import seaborn as sns
sns.set()
sns.set_palette("colorblind")
"""
Explanation: Shape functions (basis functions)
This notebook explores the computation of finite element shape functions. We... |
jpilgram/phys202-2015-work | assignments/assignment08/InterpolationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.interpolate import interp1d
"""
Explanation: Interpolation Exercise 1
End of explanation
"""
# YOUR CODE HERE
#raise NotImplementedError()
with np.load('trajectory.npz') as data:
t = data['t']
x = data['x'... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/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', 'csir-csiro', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport... |
chbrandt/pynotes | cs82_tiles_stats/CS82 tiles - limiting magnitude - prototype.ipynb | gpl-2.0 | tilename = 'S82m0m_y.V2.7A.swarp.cut.deV.fit'
import astropy
import pandas
import bokeh
import numpy
from bokeh.io import output_notebook
output_notebook()
%matplotlib inline
import seaborn
seaborn.set()
from matplotlib import pyplot as plt
"""
Explanation: CS82 tiles statistics
Here we analyse some photometric mea... |
ronnydw/data-science-projects | sp500-stock-analysis/Stock Analysis - return-risk performance vs S&P500 index.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
import datetime as dt
from math import sqrt
"""
Explanation: Stock Analysis: return-risk performance vs S&P500 index
Find stocks that outperform the SP500 index, year after yea... |
garygr2002/data-512-a2 | hcds-a2-bias.ipynb | mit | """
This code file creates homework assignment #2
Gary Gregg
DATA 512A
University of Washington
Autumn 2017
"""
import numpy as np
import csv
import matplotlib.pyplot as plt
plt.rcdefaults()
import os.path
import requests
"""
Explanation: Declare all required import packages.
End of explanation
"""
# Country Map
... |
galtay/tensorflow_examples | 00_tensorboard.ipynb | gpl-3.0 | logdir='/tmp/tensorflow/00_tensorboard/logs_01_scalars'
if os.path.exists(logdir):
os.system('rm -rf {}'.format(logdir))
with tf.Graph().as_default() as graph:
a = tf.constant(1, name='a')
b = tf.constant(2, name='b')
c = tf.add(a, b, name='c')
d = tf.multiply(a, c, name='d')
with tf.Session(graph... |
WomensCodingCircle/CodingCirclePython | Lesson06_Files/Files.ipynb | mit | # Run these to get some of the files we will be using today.
# These are the salaries of public workers in California from the website transparentcalifornia
# The last line is downloading a short story for the project
import urllib.request, urllib.parse, urllib.error
urllib.request.urlretrieve("http://transparentcali... |
ptoman/sailon | 201611_Regression_BikeShare.ipynb | mit | import pandas as pd
data = pd.read_csv("day.csv")
print data.columns # these are the columns available
print data[0:5] # these are the first 5 rows
"""
Explanation: Regression in Python:
Supporting the environment by modeling bike share needs
We're going to work with bike share data. This is an environmentally frien... |
xMyrst/BigData | python/ejercicios/ucm_diccionarios_02_ej.ipynb | gpl-3.0 | d1 = { }
d2 = {'Hola': ['Hi','Hello'], 'Adios': ['Bye'] }
# Sol:
d2['Hola']
"""
Explanation: Ejercicios 3
1 Ejercicio
Escribe una expresión Python para recuperar el valor del elemento con clave 'Hola' del un diccionario d.
* Comprueba que si d es {} la ejecución produce un error.
* ¿ Y si d es {'Hola': ['Hi','Hell... |
fullmetalfelix/ML-CSC-tutorial | KRR - TotalEnergy.ipynb | gpl-3.0 | # INITIAL DEFINITIONS
from pyKRR import KRRsolver # import our KRR solver object
import numpy, random
import numpy, math, random
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.sparse import load_npz
"""
Explanation: Total Energy Prediction - Kernel Ridge Regression
Introduction
In ... |
graphistry/pygraphistry | demos/demos_databases_apis/gpu_rapids/part_i_cpu_pandas.ipynb | bsd-3-clause | #!pip install graphistry -q
import pandas as pd
import graphistry
graphistry.__version__
# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com')
# For more options, see https://github.com/graphistry/pygraphistry#confi... |
kkhenriquez/python-for-data-science | Week-5-Visualization/05a_Matplotlib_Notebook.ipynb | mit | import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
data = pd.read_csv('./world-development-indicators/Indicators.csv')
data.shape
"""
Explanation: <br><p style="font-family: Arial; font-size:3.75em;color:purple; font-style:bold">
Matplotlib: Exploring <br> <br> <br>Data Visualization... |
ireapps/cfj-2017 | completed/06. pandas? pandas! (Part 2).ipynb | mit | import pandas as pd
"""
Explanation: More fun with pandas
Let's use pandas to dive into some more complicated data.
The data
We're going to be working with FDA import refusal data from 2014 to September 2017. From the source:
The Food, Drug, and Cosmetic Act (the Act) authorizes FDA to detain a regulated product that... |
metpy/MetPy | v1.1/_downloads/3f80eaf969d597174a3c39544b2f3037/Mesonet_Stationplot.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, StationPlot
from metpy.units import units
"""
Explanation: Mesonet Station Plot
Make a surface sta... |
vpoggi/catalogue_toolkit | notebooks/Catalogue Querying Example.ipynb | agpl-3.0 | %matplotlib inline
import os, sys
sys.path.append('/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages')
import numpy as np
import matplotlib.pyplot as plt
from eqcat.parsers.isf_catalogue_reader import ISFReader
import eqcat.catalogue_query_tools as cqt
"""
Explanation: Catalogue Query Tools... |
darkomen/TFG | medidas/12082015/Análisis de datos Ensayo 1.ipynb | cc0-1.0 | #Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
#Abrimos el fichero csv con los datos... |
nehal96/Deep-Learning-ND-Exercises | Sentiment Analysis/Sentiment Analysis with TFLearn/sentiment-analysis-tflearn.ipynb | mit | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
"""
Explanation: Sentiment analysis with TFLearn
In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w... |
cgpotts/cs224u | rel_ext_02_experiments.ipynb | apache-2.0 | __author__ = "Bill MacCartney and Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2022"
"""
Explanation: Relation extraction using distant supervision: experiments
End of explanation
"""
from collections import Counter
import os
import rel_ext
import utils
# Set all the random seeds for reproducibility. ... |
marc-moreaux/Deep-Learning-classes | notebooks/Intro to deep neural networks.ipynb | mit | import keras
from keras import models
from keras import layers
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# Reshape Xs and Ys
y_train = keras.utils.to_categorical(y_train)
y_test = keras.utils.to_categorical(y_test)
x_train = x_train.reshape(-1, 28 * 28)
x_test = x_test.... |
datascience-practice/data-quest | python_introduction/intermediate/.ipynb_checkpoints/Modules-checkpoint.ipynb | mit | import math
"""
Explanation: 3: The math module
Instructions
Use the sqrt() function within the math module to assign the square root of 16.0 to a.
Use the ceil() function within the math module to assign the ceiling of 111.3 to b.
Use the floor() function within the math module to assign the floor of 89.9 to c.
End o... |
OpenAstronomy/workshop_sunpy_astropy | 07-Tables/reading_tables.ipynb | mit | from astropy.io import ascii
# Read a sample file: sources.dat
"""
Explanation: Reading data into Astropy Tables
Objectives
Read ASCII files with a defined format
Learn basic operations with astropy.tables
Ingest header information
VOTables
Reading data
Our first task with python was to read a csv file using np.lo... |
minireference/noBSLAnotebooks | chapter02_exercises.ipynb | mit | # setup SymPy
from sympy import *
x, y, z, t = symbols('x y z t')
init_printing()
"""
Explanation: 2/ Exercise solutions
End of explanation
"""
# define the matrices A and B, and the vecs v and w
A = Matrix([[1,3],
[4,5]])
B = Matrix([[-1,0],
[ 3,3]])
v = Matrix([[1,2]]).T # the .T makes ... |
metpy/MetPy | dev/_downloads/f8c7f51c50c58b17901913e49a5b977e/Inverse_Distance_Verification.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import cKDTree
from metpy.interpolate.geometry import dist_2
from metpy.interpolate.points import barnes_point, cressman_point
from metpy.interpolate.tools import average_spacing, calc_kappa
def draw_circle(ax, x, y, r, m, label):
th = np.lins... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-mmh/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-mmh', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-MMH
Sub-Topics: Radiative Forcings.
Properties: 8... |
calee0219/Course | DM/DataMining/hw0.ipynb | mit | #!/usr/bin/env python3
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.preprocessing import Imputer
from sklearn.metrics import pairwise
from pyproj import Geod
df = pd.read_csv('201707-citibike-tripdata.csv')
"""
Explanation: 2017 NCTU Data Mining HW0
0416037 李家安
Info
Group 3
... |
infilect/ml-course1 | week3/rnn-lstm/notebooks/Sentiment_RNN_Solution.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... |
probml/pyprobml | deprecated/simulated_annealing_2d_demo.ipynb | mit | import numpy as np
import matplotlib
matplotlib.use("nbagg")
import matplotlib.pyplot as plt
from IPython import display
from mpl_toolkits.mplot3d import Axes3D
!mkdir figures
!mkdir scripts
%cd /content/scripts
!wget -q https://raw.githubusercontent.com/probml/pyprobml/master/scripts/pyprobml_utils.py
import pypr... |
KDD-OpenSource/geox-young-academy | day-3/solutions/DA_exercises_IraBen.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import scipy.io as sio
import math
n=100 # number of iterations
#initial
B=0.15 # Model Noise
R=0.02 # Observation Noise
A = 0.5 # Model Matrix
# creation of numpy arrays for variables
z= np.zeros(n)
m= np.zeros(n)
y= np.zeros(n)
C... |
YorkUIRLab/eosdb | word-movers-distance-in-python.ipynb | lgpl-3.0 | import os
import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.cross_validation import train_test_split
if not os.path.exists("data/embed.dat"):
print("Caching word embeddings in memmapped format...")
from gensim.models.wor... |
IBMDecisionOptimization/docplex-examples | examples/mp/jupyter/nurses_pandas-multi_objective.ipynb | apache-2.0 | import pip
REQUIRED_MINIMUM_PANDAS_VERSION = '0.17.1'
try:
import pandas as pd
assert pd.__version__ >= REQUIRED_MINIMUM_PANDAS_VERSION
except:
raise Exception("Version %s or above of Pandas is required to run this notebook" % REQUIRED_MINIMUM_PANDAS_VERSION)
"""
Explanation: The Nurse Assignment Problem
T... |
NervanaSystems/coach | tutorials/5. Goal-Based Data Collection.ipynb | apache-2.0 | from rl_coach.agents.td3_exp_agent import TD3GoalBasedAgentParameters
from rl_coach.architectures.embedder_parameters import InputEmbedderParameters
from rl_coach.architectures.layers import Dense, Conv2d, BatchnormActivationDropout, Flatten
from rl_coach.base_parameters import EmbedderScheme
from rl_coach.core_types i... |
oroszl/szamprob | notebooks/Package07/mintapelda07.ipynb | gpl-3.0 | %pylab inline
from scipy.optimize import curve_fit # Az illesztéshez használt függvény
from numpy.fft import * # Fourier-analízishez használt rutinok
"""
Explanation: Adatok elemzése
Az alábbi példasorban két, gyakran előforduló adatelemzési problémát fogunk megvizsgálni. Az első a függvényillesztés, a má... |
zhuanxuhit/deep-learning | transfer-learning/Transfer_Learning_Solution.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... |
theislab/scanpy_usage | 170430_krumsiek11/krumsiek11.ipynb | bsd-3-clause | import numpy as np
import scanpy.api as sc
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
sc.settings.set_figure_params(dpi=80) # low dpi (dots per inch) yields small inline figures
sc.logging.print_versions()
"""
Explanation: First compiled on: December 3, 2016.
Simulating mye... |
evanmiltenburg/python-for-text-analysis | Chapters-colab/Chapter_05_Core_concepts_of_containers.ipynb | apache-2.0 | %%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d ./
!unzip Ext... |
Savvysherpa/provenance | docs/source/hashing-and-mutation.ipynb | mit | a = [1, 2, 3]
nested_references = [a, a]
nested_values = [[1, 2, 3], [1, 2, 3]]
"""
Explanation: Hashing and mutation
At the core of provenance is the ability to hash arbritary python data structures. Artifact ids are hashes of a function's metadata and the arguments for a given invocaiton. The value_id of an Artifac... |
CRPropa/CRPropa3 | doc/pages/example_notebooks/extragalactic_fields/MHD_models.v4.ipynb | gpl-3.0 | from crpropa import *
## settings for MHD model (must be set according to model)
filename_bfield = "clues_primordial.dat" ## filename of the magnetic field
gridOrigin = Vector3d(0,0,0) ## origin of the 3D data, preferably at boxOrigin
gridSize = 1024 ## size of uniform grid in data... |
anhaidgroup/py_stringsimjoin | notebooks/jaccard_books.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__)
"""
Ex... |
MartyWeissman/Python-for-number-theory | P3wNT Notebook 5.ipynb | gpl-3.0 | 23 % 5 # What is the remainder after dividing 23 by 5? What is the natural representative of 23 modulo 5?
"""
Explanation: Part 5: Modular arithmetic and primality testing with Python 3.x
Python, like most programming languages, comes with a "mod operation" % to compute remainders. This makes basic modular arithme... |
stereoboy/Study | Issues/algorithms/Linked Lists.ipynb | mit | class Node():
def __init__(self, value, Next=None):
self.value = value
self.next = Next
def __str__(self):
if self.next == None:
return str(self.value)
return str(self.value) + '-' + self.next.__str__()
def getSize(node):
count = 0
while node != None:
... |
davesque/cs231n | assignment1/knn.ipynb | mit | # Run some setup code for this notebook.
import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.