repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/structured/solutions/3a_bqml_baseline_babyweight.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
%%bash
pip freeze | grep google-cloud-bigquery==1.6.1 || \
pip install google-cloud-bigquery==1.6.1
"""
Explanation: LAB 3a: BigQuery ML Model Baseline.
Learning Objectives
Create baseline model with BQML
Evaluate baseline model
Calculate RMSE of ba... |
Yatekii/glal3 | versuch3/W8.ipynb | gpl-3.0 | # Preparations
import math
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
import seaborn as sns
from IPython.display import Latex
import warnings
from PrettyTable import PrettyTable
from functools ... |
esa-as/2016-ml-contest | MSS_Xmas_Trees/ml_seg_sub5_STU2.ipynb | apache-2.0 | from numpy.fft import rfft
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
import pandas as pd
import timeit
from sqlalchemy.sql import text
from sklearn import tree
#from sklearn.model_selection import LeavePGroupsOut
from sklearn import metrics
from sklearn.tree ... |
junhwanjang/DataSchool | Lecture/11. 추정 및 검정/3) SciPy를 사용한 기초적인 검정.ipynb | mit | N = 10
theta_0 = 0.5
np.random.seed(0)
x = sp.stats.bernoulli(theta_0).rvs(N)
n = np.count_nonzero(x)
n
sp.stats.binom_test(n, N)
"""
Explanation: SciPy를 사용한 기초적인 검정
SciPy 파이썬 패키지는 다음과 같은 다양한 검정 명령을 제공한다.
이항 검정 (Binomial test)
카이 제곱 검정 (Chi-square test)
단일 표본 z-검정 (One-sample z-test)
단일 표본 t-검정 (One-sample t-test)
독... |
ethen8181/machine-learning | python/python3_cookbook/2_strings_and_text.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', '..', 'notebook_format'))
from formats import load_style
load_style(plot_style=False)
os.chdir(path)
# magic to print version
%load_ext watermark
%water... |
dlsun/symbulate | docs/process.ipynb | mit | from symbulate import *
%matplotlib inline
"""
Explanation: Symbulate Documentation
Random Processes
<a id='contents'></a>
RandomProcess and TimeIndex
Defining a RandomProcess explicitly as a function of time
Process values at particular time points
Mean function
Defining a RandomProcess incrementally
< Conditioning... |
xR86/ml-stuff | kaggle/zmisc/dataquest-us-births-1994-2003/Basics.ipynb | mit | from pathlib import Path
my_file = Path('US_births_1994-2003_CDC_NCHS.csv')
if my_file.is_file():
print('File exists.')
data = open('US_births_1994-2003_CDC_NCHS.csv', 'r').read()
data_lst = data.split('\n')
else:
print("File doesn't exist, will be downloaded.")
import urllib.request
url = 'htt... |
mne-tools/mne-tools.github.io | 0.22/_downloads/162648d33d7b9ea4f5ce1e8bb494a02d/plot_mne_inverse_label_connectivity.ipynb | bsd-3-clause | # Authors: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Nicolas P. Rougier (graph code borrowed from his matplotlib gallery)
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
f... |
enbanuel/phys202-2015-work | assignments/assignment06/DisplayEx01.ipynb | mit | # YOUR CODE HERE
from IPython.display import display, Image
assert True # leave this to grade the import statements
"""
Explanation: Display Exercise 1
Imports
Put any needed imports needed to display rich output the following cell:
End of explanation
"""
# YOUR CODE HERE
Image(url='http://www.redorbit.com/media/up... |
Ttl/scikit-rf | doc/source/examples/networksets/Sorting Network Sets.ipynb | bsd-3-clause | from time import sleep
import skrf as rf
%matplotlib inline
from pylab import *
rf.stylely()
!rm -rf tmp
!mkdir tmp
wg = rf.wr10 # just a dummy media object to generate data
wg.frequency.npoints = 101
for k in range(10):
# timestamp generated with `rf.now_string()`
ntwk = wg.random(name=rf.now_string()+... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/building_production_ml_systems/solutions/4a_streaming_data_training.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import datetime
import os
import shutil
import pandas as pd
import tensorflow as tf
from matplotlib import pyplot as plt
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, DenseFeat... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/sandbox-3/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: SANDBOX-3
Topic: Seaice
Sub-Topics: ... |
mzszym/oedes | examples/egdm/image-force-prb79.ipynb | agpl-3.0 | %matplotlib inline
import matplotlib.pylab as plt
import io
import numpy as np
from oedes import *
init_notebook()
"""
Explanation: Devices with Gaussian Disorder: contact barrier and image-force barrier lowering
This example reproduces steady-state drift-diffusion simulations of unipolar organic diodes from the ref... |
icarrera/kaggle-titanic | Problem-Set-Statistics-1.ipynb | mit | import pandas
import numpy
MY_TITANIC_TRAIN = 'train_titanic.csv'
MY_TITANIC_TEST = 'test_titanic.csv'
titanic_dataframe = pandas.read_csv(MY_TITANIC_TRAIN, header=0)
print('length: {0}'.format(len(titanic_dataframe)))
titanic_dataframe.head(5)
"""
Explanation: KNN
Describe the data.
How big?
End of explanation
"""
... |
eford/rebound | ipython_examples/RemovingParticlesFromSimulation.ipynb | gpl-3.0 | import rebound
import numpy as np
sim = rebound.Simulation()
sim.add(m=1.)
sim.particles[0].hash = sim.generate_unique_hash()
for i in range(1,10):
sim.add(a=i)
sim.particles[i].hash = sim.generate_unique_hash()
sim.move_to_com()
print("Particle hashes:{0}".format([sim.particles[i].hash for i in range(sim.N)]... |
GlobalFishingWatch/vessel-maps | utilities/earth-engine-tests/Earth Engine and TensorFlow.ipynb | apache-2.0 | import ee
from IPython import display
import math
from matplotlib import pyplot
import numpy
from osgeo import gdal
import tempfile
import tensorflow as tf
import urllib
import zipfile
"""
Explanation: Introduction to Earth Engine and TensorFlow in Cloud Datalab
This notebook walks you through a simple example of usin... |
gschivley/Index-variability | Notebooks/archive/Download & clean all 923 data.ipynb | bsd-3-clause | %matplotlib inline
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import os
import glob
import numpy as np
import requests
from bs4 import BeautifulSoup
from urllib import urlretrieve
import zipfile
import fnmatch
url = 'https://www.eia.gov/electricity/data/eia923'
r = requests.get(url)
soup... |
olgaliak/cntk-cyclegan | simpleGan/CNTK_103A_MNIST_DataLoader.ipynb | mit | # Import the relevant modules to be used later
from __future__ import print_function
import gzip
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import os
import shutil
import struct
import sys
try:
from urllib.request import urlretrieve
except ImportError:
from urllib im... |
bretthandrews/marvin | docs/sphinx/jupyter/dap_maps.ipynb | bsd-3-clause | # import the maps
from marvin.tools.maps import Maps
# Load a MPL-5 map
mapfile = '/Users/Brian/Work/Manga/analysis/v2_0_1/2.0.2/SPX-GAU-MILESHC/8485/1901/manga-8485-1901-MAPS-SPX-GAU-MILESHC.fits.gz'
# Let's get a default map of
maps = Maps(filename=mapfile)
print(maps)
"""
Explanation: Marvin Maps
Marvin Maps is h... |
tomkimpson/MachLearnPy | SciLearn/.ipynb_checkpoints/1.Machine_Learning_101-checkpoint.ipynb | mit | from sklearn.datasets import load_iris
iris = load_iris()
n_samples, n_features = iris.data.shape
"""
Explanation: Machine Learning 101: General Concepts
ML involves building programs with tunable parameters that are adjusted automatically so as to improve their behaviour by adapting to previously seen data.
The ML a... |
mrustl/flopy | examples/Notebooks/flopy3_Zaidel_example.ipynb | bsd-3-clause | %matplotlib inline
import sys
import os
import platform
import numpy as np
import matplotlib.pyplot as plt
import flopy
import flopy.utils as fputl
#Set name of MODFLOW exe
# assumes executable is in users path statement
exe_name = 'mfusg'
if platform.system() == 'Windows':
exe_name = 'mfusg.exe'
mfexe = exe_nam... |
tensorflow/docs-l10n | site/ko/addons/tutorials/optimizers_lazyadam.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0
# 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 the License is d... |
lijingpeng/kaggle | competitions/Titanic/titanic.ipynb | mit | # -*- coding: UTF-8 -*-
%matplotlib inline
import pandas as pd
import string
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
def substrings_in_string(big_string, substrings):
for substring in substrings:
... |
SheffieldML/notebook | GPy/multiple outputs.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import GPy
import pods
from IPython.display import display
"""
Explanation: Multiple Outputs Gaussian Processes
Gaussian Process Summer School, Melbourne, Australia
25th-27th February 2015
Neil D. Lawrence
In this lab we are going to build on yester... |
keras-team/keras-io | examples/keras_recipes/ipynb/subclassing_conv_layers.ipynb | apache-2.0 | import tensorflow.keras as keras
print(keras.__version__)
"""
Explanation: Customizing the convolution operation of a Conv2D layer
Author: lukewood<br>
Date created: 11/03/2021<br>
Last modified: 11/03/2021<br>
Description: This example shows how to implement custom convolution layers using the Conv.convolution_op() ... |
c-north/hdbscan | notebooks/How HDBSCAN Works.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn.datasets as data
%matplotlib inline
sns.set_context('poster')
sns.set_style('white')
sns.set_color_codes()
plot_kwds = {'alpha' : 0.5, 's' : 80, 'linewidths':0}
"""
Explanation: How HDBSCAN Works
HDBSCAN is a clustering algorithm d... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/image_models/solutions/2_mnist_models.ipynb | apache-2.0 | import os
from datetime import datetime
REGION = "us-central1"
PROJECT = !(gcloud config get-value core/project)
PROJECT = PROJECT[0]
BUCKET = PROJECT
MODEL_TYPE = "cnn" # "linear", "dnn", "dnn_dropout", or "cnn"
# Do not change these
os.environ["PROJECT"] = PROJECT
os.environ["BUCKET"] = BUCKET
os.environ["REGION"]... |
alasdairtran/mclearn | projects/alasdair/notebooks/getting_started.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm impor... |
Upward-Spiral-Science/spect-team | Code/Assignment-4/Inferential_Depressed.ipynb | apache-2.0 | from scipy.stats import pearsonr
from scipy.stats import chisquare
from scipy.stats import ks_2samp
from scipy.stats import anderson_ksamp
pearsonr_test = lambda x: pearsonr(x[0], x[1])[1]
chi_test = lambda x: chisquare(x[0], x[1])[1]
ks_test = lambda x: ks_2samp(x[0], x[1])[1]
anderson_ksamp_test = lambda x: anderson... |
epequeno/coursera | crypto-014/PA1.ipynb | unlicense | m1 = "Hello World".encode('hex')
key = "supersecret".encode('hex')
print 'm1: {}\nkey: {}'.format(m1, key)
print len(m1), len(key)
"""
Explanation: Programming Assignment 1
https://class.coursera.org/crypto-014/quiz/attempt?quiz_id=18
My attempt at solving this problem is not yielding the results I expect. I suspect t... |
GAMPTeam/vampyre | demos/mlp/mlp_mnist_inpaint.ipynb | mit | # Add the vampyre path to the system path
import os
import sys
vp_path = os.path.abspath('../../')
if not vp_path in sys.path:
sys.path.append(vp_path)
import vampyre as vp
# Load the other packages
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Multi-Laye... |
ComputationalModeling/spring-2017-danielak | past-semesters/fall_2016/day-by-day/day03-order-of-magnitude-estimation/Day_3_Pre_Class_Notebook.ipynb | agpl-3.0 | # Imports the functionality that we need to display YouTube videos in a Jupyter Notebook.
# You need to run this cell before you run ANY of the YouTube videos.
from IPython.display import YouTubeVideo
# Display a specific YouTube video, with a given width and height.
# WE STRONGLY RECOMMEND that you can watch t... |
Ganeshgajakosh/ml_lab_ecsc_306 | lab1_assign_2(1).ipynb | apache-2.0 | import tensorflow as tf
with tf.name_scope("var"):
with tf.name_scope("mean_x"):
a=tf.constant([5.0,7.0,20.2,17.32],shape=[1,4],name='a')
b=tf.constant([7.0,9.0,19.0,18.0],shape=[1,4],name='b')
x=tf.reduce_mean(a)
sess=tf.Session()
print("mean",sess.run(x))
#mean x
#mean of y
wi... |
ajhenrikson/phys202-2015-work | assignments/assignment11/OptimizationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize as opt
"""
Explanation: Optimization Exercise 1
Imports
End of explanation
"""
def hat(x,a,b):
V=-a*x**2+b*x**4
return V
assert hat(0.0, 1.0, 1.0)==0.0
assert hat(0.0, 1.0, 1.0)==0.0
assert hat(1.0, 10.0, 1.0)==-... |
ehongdata/Network-Analysis-Made-Simple | 2. Network(X) Basics (Instructor).ipynb | mit | G = nx.read_gpickle('Synthetic Social Network.pkl') #If you are Python 2.7, read in Synthetic Social Network 27.pkl
nx.draw(G)
"""
Explanation: Nodes and Edges: How do we represent relationships between individuals using NetworkX?
As mentioned earlier, networks, also known as graphs, are comprised of individual entiti... |
paulovn/ml-vm-notebook | vmfiles/IPNB/Examples/b Graphics/11 Sankey diagrams.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.sankey import Sankey
"""
Explanation: Demonstrate the Sankey class by producing three basic diagrams
Code taken from the Sankey API at Matplotlib doc
End of explanation
"""
Sankey(flows=[0.25, 0.15, 0.60, -0.20, -0.15, -0.05, -0.5... |
okkhoy/pyDataAnalysis | ml-foundation/regression/Predicting house prices.ipynb | mit | import graphlab
"""
Explanation: Fire up graphlab create
End of explanation
"""
sales = graphlab.SFrame('home_data.gl/')
sales
"""
Explanation: Load some house sales data
Dataset is from house sales in King County, the region where the city of Seattle, WA is located.
End of explanation
"""
graphlab.canvas.set_ta... |
CAChemE/stochastic-optimization | PSO/2D/2D-Python-PSO-algorithm-viz.ipynb | bsd-3-clause | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from plotPSO import plotPSO_2D
import optitestfuns
# import scipy as sp
# import time
%matplotlib inline
plt.style.use('bmh')
"""
Explanation: Particle Swarm Optimization Algorithm (explained with Python!)... |
gregcaporaso/short-read-tax-assignment | ipynb/cross-validated/taxonomy-assignment.ipynb | bsd-3-clause | from os import system
from os.path import join, expandvars
from joblib import Parallel, delayed
from glob import glob
from tax_credit.framework_functions import (recall_novel_taxa_dirs,
parameter_sweep,
move_results_to_repository)
... |
lisitsyn/shogun | doc/ipython-notebooks/regression/Regression.ipynb | bsd-3-clause | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from cycler import cycler
# import all shogun classes
from shogun import *
import shogun as sg
slope = 3
X_train = rand(30)*10
y_train = slope*(X_train)+random.randn(30)*2+2
y_true = slope*(X_train)+2
X_test = conc... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/statespace_cycles.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
endog = DataReader('UNRATE', 'fred', start='1954-01-01')
endog.index.freq = endog.index.inferred_freq
"""
Explanation: Trends and cycles in unemployment... |
Olsthoorn/IHE-python-course-2017 | exercises/Mar21/sorting.ipynb | gpl-2.0 | import numpy as np
from numpy import random
from pprint import pprint
"""
Explanation: <figure>
<IMG SRC="../../logo/logo.png" WIDTH=250 ALIGN="right">
</figure>
IHE Python course, 2017
Sorting
T.N.Olsthoorn, Feb2017
Sorting (and) filtering are important operations when working with data and databases. This tutoria... |
lahoffm/aclu-bail-reform | src/visualization/Fulton County Data Viz.ipynb | mit | %matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
time_columns = ['inmate_dob',
'booking_timestamp',
'release_timestamp',
'court_date']
index_col = 'inmate_id'
scrape1 = pd.read_csv("fulton_2017-11-26_09-15-47.csv",
pars... |
blua/deep-learning | seq2seq/sequence_to_sequence_implementation.ipynb | mit | 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 takes in a sequence of letters, an... |
xpmanoj/content | HW4.ipynb | mit | %matplotlib inline
from collections import defaultdict
import json
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import rcParams
import matplotlib.cm as cm
import matplotlib as mpl
#colorbrewer2 Dark2 qualitative color table
dark2_colors = [(0.1058823529411... |
openfisca/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/notebooks/regressivite_tva.ipynb | agpl-3.0 | from __future__ import division
import pandas
import seaborn
"""
Explanation: Dans ce script on calcul la contribution des ménages à la TVA, par décile de revenu. On compare également l'importance de différents taux de TVA dans la consommation des ménages selon le décile de revenu.
Import de modules généraux
End of ... |
jhillairet/scikit-rf | doc/source/examples/networktheory/Transmission Lines and SWR.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import skrf as rf
rf.stylely()
"""
Explanation: How does the SWR vary along a line?
Let's assume a 10 MHz source powering an antenna (of load $Z_L$) through a transmission line of length $L$. Depending on the location of the SWR-meter, what does o... |
ihmeuw/dismod_mr | examples/predictive_covariates_for_time_trends.ipynb | agpl-3.0 | import numpy as np, matplotlib.pyplot as plt, pymc as mc, pandas as pd, dismod_mr
np.random.seed(123456)
# range of time for simulation
years = np.arange(1990,2011)
# covariates that completely explain variation of prevalence over time
x_1 = mc.rnormal((years-2000) / 10., .2**-2)
x_2 = mc.rnormal(0.*years, .2**-2)
... |
UltronAI/Deep-Learning | CS231n/reference/CS231n-master/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.... |
csaladenes/csaladenes.github.io | present/bi2/2020/ubb/az_en_jupyter2_mappam/sklearn_tutorial/03.1-Classification-SVMs.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
plt.style.use('seaborn')
"""
Explanation: <small><i>This notebook was put together by Jake Vanderplas. Source and license info is on GitHub.</i></small>
Supervised Learning In-Depth: Support Vector Machines
Previously we int... |
tensorflow/text | docs/guide/subwords_tokenizer.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/sandbox-3/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'sandbox-3', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MRI
Source ID: SANDBOX-3
Sub-Topics: Radiative Forcings.
Properties: 85 (42 re... |
jdhp-docs/python-notebooks | opendata_liste_postes_mcf_2018.ipynb | mit | import pandas as pd
df = pd.read_html('opendata_liste_postes_mcf_2018.html', header=0, encoding="utf-8")[0]
df
df.columns
df[df.Section == 27].groupby('Date clôture cand').count()
"""
Explanation: Liste des postes MCF 2018 (mars 2018)
Liste des postes MCF (section 27) https://www.galaxie.enseignementsup-recherche.g... |
ChrisAndre/expsin | old_python/Proof of Concept.ipynb | mit | # boilerplate
%matplotlib inline
from pylab import rcParams
rcParams['figure.figsize'] = 18, 8
from ExpoSinLambert import ExpoSinLambert
from PyKEP import MU_SUN, DAY2SEC, AU
from PyKEP.core import epoch
from PyKEP.planet import jpl_lp
import math
from Vector import *
import matplotlib.pyplot as plt
"""
Explanation: L... |
UWSEDS/LectureNotes | week_1/procedural_python/data_basics.ipynb | bsd-2-clause | # Let's do something with strings
a_string = "Happy birthday"
type(a_string)
a_string.count("p")
a = 3
# We can't count strings in an integer
a.count("p")
x = True
type(x)
x = a > 4
x
x = "3"
x + 2
"""
Explanation: Data Basics
Overview
Data basics
Theory of types
Basic types
Composite types: Tuples, lists and... |
tensorflow/docs-l10n | site/ko/guide/autodiff.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... |
hktxt/MachineLearning | ML/Distances and Angles between Images.ipynb | gpl-3.0 | # PACKAGE: DO NOT EDIT
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
%%javascript
// Some javascript to provide better layout for plots we have later.
IPython.OutputArea.prototype._should_scroll = function(lines)... |
pyreaclib/pyreaclib | examples/hot-CNO-breakout-example.ipynb | bsd-3-clause | import pynucastro as pyrl
"""
Explanation: hot-CNO and breakout
End of explanation
"""
files = ["c12-pg-n13-ls09",
"c13-pg-n14-nacr",
"n13--c13-wc12",
"n13-pg-o14-lg06",
"n14-pg-o15-im05",
"n15-pa-c12-nacr",
"o14--n14-wc12",
"o15--n15-wc12",
"o... |
perwin/s4g_barfractions | s4gbars_simulated-surveys.ipynb | bsd-3-clause | import plotutils as pu
import datautils as du
import s4gutils
# paths for locating data, saving plots, etc.
dataDir = "./data/"
simDir = dataDir
fbarLitDir = dataDir + "f_bar_trends-from-literature/"
# change the following if you want to save the figures somewhere convenient
baseDir = "/Users/erwin/Documents/Working/... |
hvillanua/deep-learning | tensorboard/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... |
GoogleCloudPlatform/training-data-analyst | courses/ai-for-finance/practice/intro_tf_data_keras_sequential.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.1 || pip install tensorflow==2.1
from __future__ import absolute_import, division, print_function, unicode_literals
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
fr... |
CopernicusMarineInsitu/INSTACTraining | PythonNotebooks/indexFileNavigation/index_file_navigation_platformCategory.ipynb | mit | user = '' #type CMEMS user name within colons
password = '' #type CMEMS password within colons
product_name = 'INSITU_BAL_NRT_OBSERVATIONS_013_032' #type aimed CMEMS in situ product
distribution_unit = 'cmems.smhi.se' #type aimed hosting institution
index_file = 'index_history.txt' #type aimed index file name
#remem... |
tensorflow/docs-l10n | site/ja/guide/random_numbers.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... |
a301-teaching/a301_code | notebooks/rad_calc.ipynb | mit | Image('figures/wallace4_33.png',width=500)
"""
Explanation: Weighting functions in the $CO_2$ 15 $\mu m$ absorption band
Below is a plot of radiance (or intensity) (left axis) and brightness temperature (right axis) vs. wavenumber near the main $CO_2$ absorption band. Wavenumber is defined as $1/\lambda$; the center ... |
mne-tools/mne-tools.github.io | dev/_downloads/4d3b714a9291625bb4b01d7f9c7c3a16/compute_source_psd_epochs.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, compute_source_psd_epochs
print(__doc__)
data_path = sample.data_path()
meg_path = data_path / 'MEG' / 'sampl... |
Arahabica/NNTrain | train/neural/ActivationFunctions.ipynb | mit | x = np.arange(-5.0, 5.0, 0.1)
y = np.array(x > 0, dtype=np.int)
plt.plot(x, y)
plt.show()
"""
Explanation: 活性化関数
ステップ関数
$y=\begin{cases}1 & ( x \gt 0 ) \-1 & ( x \leqq 0 )\end{cases}$
End of explanation
"""
x = np.arange(-5.0, 5.0, 0.1)
y = 1 / (1 + np.exp(-x))
plt.plot(x, y)
plt.show()
"""
Explanation: シグモイド関数
$y ... |
echopen/PRJ-medtec_sigproc | SigProc_101/SigProc-101-pimped.ipynb | mit | from __future__ import print_function
import numpy as np
from PIL import Image # for bmp import
from glob import glob
from scipy.misc import imresize
import matplotlib.pyplot as plt
import math
import time
%matplotlib inline
def showImage(imageToPlot):
plt.figure(figsize=(2, 4))
plt.gray()
plt.imshow(imag... |
CfA-Library/Training | 2016/2016-12-07-jupyter/intro.ipynb | mit | print 'hello world!'
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,10,1000)
y = np.sin(x)
"""
Explanation: A demo of some very basic features of Jupyter notebooks.
Author: Lehman Garrison (lgarrison@cfa.harvard.edu)
Made for the CfA Jupyter Workshop at Wolbach Library, 12/7/... |
mclaughlin6464/pearce | notebooks/Load Jeremey LSD Box.ipynb | mit | from pearce.mocks import cat_dict
import numpy as np
from os import path
from astropy.io import fits
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
a = 0.645161
z = 1.0/a - 1.0
"""
Explanation: I've implemented the integral of wt in pe... |
texib/deeplearning_homework | tensor-flow-exercises/3_regularization.ipynb | mit | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
import cPickle as pickle
import numpy as np
import tensorflow as tf
"""
Explanation: Deep Learning with TensorFlow
Credits: Forked from TensorFlow by Google
Setup
Refer to the setup instructions.
Exercise 3
Pre... |
keras-team/keras-io | examples/nlp/ipynb/text_extraction_with_bert.ipynb | apache-2.0 | import os
import re
import json
import string
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tokenizers import BertWordPieceTokenizer
from transformers import BertTokenizer, TFBertModel, BertConfig
max_len = 384
configuration = BertConfig() # default p... |
awagner-mainz/notebooks | gallery/textreuse_mainz_2020/textreuse.ipynb | mit | import os
in_dir = "./data/constitutions/"
# we create a dictionary with our constitutions:
sources = {}
for file in sorted(os.listdir(in_dir)):
key = os.path.basename(file).split(os.extsep)[0]
with open(in_dir + '/' + file, encoding="utf-8") as f:
sources[key] = f.read()
# and a list of available c... |
vravishankar/Jupyter-Books | Utility Packages.ipynb | mit | import timeit
"""
Explanation: Timing it
Sometimes you may need to measure the performance of the code or at least want to know which piece of the code is slowing down. Python has a built-in timing module to do this.
End of explanation
"""
# Using For Loop
timeit.timeit('"-".join(str(n) for n in range(100))', number... |
sdpython/ensae_teaching_cs | _doc/notebooks/exams/interro_rapide_20_minutes_2014_10.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.e - Correction de l'interrogation écrite du 10 octobre 2014
dictionnaire et coût algorithmique
End of explanation
"""
def pas_de_voyelle(mot):
s = ""
for c in mot :
if c not in "aeiouy" :
s += c
retur... |
PyLadiesCZ/pyladies.cz | original/v1/s006-lists/feedback-ostrava/Feedback k domácím projektům.ipynb | mit | [x for x in range(10)]
[x**2 for x in range(10)]
[x**2 for x in range(10) if x % 2 == 0]
[(x, x**2) for x in range(10)]
[[y for y in range(3)] for x in range(10)]
"""
Explanation: List comprehensions
Jedná se o zápis s Pythonu s jehož pomocí se dají jednoduše vytvářet seznamy.
End of explanation
"""
def vytvor_t... |
springcoil/Probabilistic_Programming_and_Rugby | Bayesian_Rugby.ipynb | mit | import os
import math
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pymc # I know folks are switching to "as pm" but I'm just not there yet
%matplotlib inline
import seaborn as sns
from IPython.core.pylabtools import figsize
import seaborn as sns
figsize(12, 12)
"""
Expl... |
probml/pyprobml | notebooks/book2/17/gp_deep_kernel_learning.ipynb | mit | %%capture
import os
try:
from tinygp import kernels, transforms, GaussianProcess
except ModuleNotFoundError:
%pip install -qq tinygp
from tinygp import kernels, transforms, GaussianProcess
try:
import flax.linen as nn
except ModuleNotFoundError:
%pip install -qq flax
import flax.linen as nn
fr... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session07/Day2/Clustering-Astronomical-Sources-AnswerKey.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
from time import time
from matplotlib.pyplot import imshow
from matplotlib.image import imread
from sklearn.cluster import KMeans
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from sklearn import metrics
from sk... |
daniestevez/jupyter_notebooks | dslwp/DSLWP-B Doppler analysis.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: DSLWP-B Doppler analysis
In this notebook we perform and analyse orbit determination of DSLWP-B using S-band Doppler measurments by Scott Tilley VE7TIL and GMAT.
End of explanation
"""
GMAT_PATH = '/home/daniel/GMAT/R2018a/'
import numpy as np
import matplotlib.pyplot as plt
imp... |
tensorflow/docs-l10n | site/ja/guide/checkpoint.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, En... |
zzsza/Datascience_School | 06. 기초 선형대수/06. 연립방정식과 역행렬.ipynb | mit | A = np.array([[1, 3, -2], [3, 5, 6], [2, 4, 3]])
A
b = np.array([[5], [7], [8]])
b
Ainv = np.linalg.inv(A)
Ainv
x = np.dot(Ainv, b) # 단순 곱하기를 하면 안되욧-! 3 x 3으로 나옴
x
np.dot(A, x) - b # 정답이 맞나 검증. 여기서 수치적 에러로 0이 나오지 않은 것임
x, resid, rank, s = np.linalg.lstsq(A, b) # 리스트 스쿠케어(최소자승)
x
"""
Explanation: 연립방정식과 역행렬
다음과 ... |
ppham27/MLaPP-solutions | chap08/2.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import preprocessing
from classifiers import read_spam_data, transform_log, transform_binary
train_data, test_data = read_spam_data()
# transform the data
ytrain = train_data['spam'].as_matrix()
ytest = test_data['... |
estnltk/episode-miner | docs/EventTagger.ipynb | gpl-2.0 | from pandas import DataFrame, read_csv
from estnltk import Text
from estnltk.taggers import EventTagger
"""
Explanation: EventTagger
A class that finds a list of events from Text object based on user-provided vocabulary. The events are tagged by several metrics (start, end, wstart_raw, wend_raw, cstart, wstart, bstart... |
mne-tools/mne-tools.github.io | 0.18/_downloads/db1991d3949b36cc336dce254c001fb0/plot_visualize_evoked.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
# sphinx_gallery_thumbnail_number = 9
"""
Explanation: Visualize Evoked data
In this tutorial we focus on the plotting functions of :class:mne.Evoked.
End of explanation
"""
data_path = mne.datasets.sample.data_path()
fname = op.joi... |
YihaoLu/statsmodels | examples/notebooks/statespace_dfm_coincident.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
np.set_printoptions(precision=4, suppress=True, linewidth=120)
from pandas.io.data import DataReader
# Get the datasets from FRED
start = '1979-01-01'
end = '2014-12-01'
indprod = DataReader('IPMAN... |
a-slide/pycoQC | docs/Fast5_to_seq_summary/API_usage.ipynb | gpl-3.0 | # Run cell with Ctrl + Enter
# Import main pycoQC module
from pycoQC.Fast5_to_seq_summary import Fast5_to_seq_summary
# Import helper functions from pycoQC
from pycoQC.common import jhelp, head
"""
Explanation: Fast5_to_seq_summary API Usage
Running Jupyter notebook
If you want to run pycoQC interactively in Jupyter... |
sarathid/Learning | Deep_learning_ND/language-translation/dlnd_language_translation.ipynb | gpl-3.0 | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_stats_cluster_spatio_temporal.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import mne
from mne import (io, spatial_tris_connectivity, compute... |
ffyu/Build-Model-from-Scratch | 3_Neural_Network.ipynb | mit | import numpy as np
import scipy
class ThreeLayerNeuralNetwork():
def __init__(self, layer1_size, layer2_size, layer3_size, lamda):
self.layer1_size = layer1_size
self.layer2_size = layer2_size
self.layer3_size = layer3_size
self.lamda = lamda
self._mu = None
self._... |
tensorflow/docs | site/en/r1/tutorials/representation/unicode.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... |
mdeff/ntds_2016 | toolkit/01_demo_acquisition_exploration.ipynb | mit | # While packages are usually imported at the top, they can
# be imported wherever you prefer, in whatever scope.
import numpy as np
# Show matplotlib graphs inside the notebook.
%matplotlib inline
import sys
print('Python {}.{}'.format(sys.version_info.major, sys.version_info.minor))
"""
Explanation: A Python Tour o... |
google/compass | packages/propensity/07.batch_scoring.ipynb | apache-2.0 | # Uncomment to install required python modules
# !sh ../utils/setup.sh
# Add custom utils module to Python environment
import os
import sys
sys.path.append(os.path.abspath(os.pardir))
from gps_building_blocks.ml.data_prep.ml_windowing_pipeline import ml_windowing_pipeline
from gps_building_blocks.cloud.utils import b... |
bbfamily/abu | abupy_lecture/9-港股市场的回测(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,导致的版... |
vidartf/hyperspy | hyperspy/tests/drawing/test_plot_image.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import hyperspy.api as hs
import matplotlib.pyplot as plt
"""
Explanation: Testing (and demonstrating) plot_images()
End of explanation
"""
import scipy.ndimage
image = hs.signals.Signal2D(np.random.random((2, 3, 512, 512)))
for i in range(2):
for j in range(3):
imag... |
BojanPLOJ/Bipropagation | Bipropagation_fashionMNIST.ipynb | gpl-3.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
roatienza/Deep-Learning-Experiments | versions/2022/tools/python/pytorch_demo.ipynb | mit | import torch
import torchvision
import torchvision.transforms as transforms
import timm
from einops import rearrange
from PIL import Image
"""
Explanation: Using a Pre-trained PyTorch Model for Inference
In this demo, we will use a pre-trained model to perform inference on a single image.
There are 3 components to ... |
davidzchen/tensorflow | tensorflow/lite/g3doc/performance/post_training_integer_quant_16x8.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... |
jrieke/machine-intelligence-2 | sheet04/4.ipynb | mit | from __future__ import division, print_function
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Machine Intelligence II (week 4) - Team MensaNord
Nikolai Zaki
Alexander Moore
Johannes Rieke
Georg Hoelger
Oliver Atanaszov
End of explanation
"""
std = 0.1
mea... |
besser82/shogun | doc/ipython-notebooks/multiclass/Tree/TreeEnsemble.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../../data')
from shogun import CSVFile,features,MulticlassLabels
def load_file(feat_file,label_file):
feats=features(CSVFile(feat_file))
labels=MulticlassLabels(CSVFile(label_file))
return (feats, labels)
trainfeat_file=os.path.join(SHOGUN_DAT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.