repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Rotvig/cs231n | Project/DCGAN.ipynb | mit | #Import the libraries we will need.
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
import matplotlib.pyplot as plt
import tensorflow.contrib.slim as slim
import os
import scipy.misc
import scipy
"""
Explanation: Deep Convolutional Generative Adversarial Network (D... |
mrustl/flopy | examples/Notebooks/flopy3_mnw2package_example.ipynb | bsd-3-clause | import sys
import os
import numpy as np
try:
import pandas as pd
except:
pass
import flopy
"""
Explanation: MNW2 package example
End of explanation
"""
m = flopy.modflow.Modflow('mnw2example', model_ws='temp')
dis = flopy.modflow.ModflowDis(nrow=5, ncol=5, nlay=3, nper=3, top=10, botm=0, model=m)
"""
Explan... |
jottenlips/aima-python | search.ipynb | mit | from search import *
"""
Explanation: Solving problems by Searching
This notebook serves as supporting material for topics covered in Chapter 3 - Solving Problems by Searching and Chapter 4 - Beyond Classical Search from the book Artificial Intelligence: A Modern Approach. This notebook uses implementations from searc... |
phoebe-project/phoebe2-docs | development/tutorials/21_22_ld_coeffs_source.ipynb | gpl-3.0 | import phoebe
b = phoebe.default_binary()
b.add_dataset('lc', dataset='lc01')
print(b.filter(qualifier='ld*', dataset='lc01'))
"""
Explanation: 2.1 - 2.2 Migration: ld_coeffs_source
PHOEBE 2.2 introduces the capability to interpolate limb-darkening coefficients for a given ld_func (i.e. linear, quadratic, etc). In or... |
machow/siuba | examples/architecture/003-fast-mutate.ipynb | mit | %%capture
import pandas as pd
pd.set_option("display.max_rows", 5)
from siuba import _
from siuba.data import mtcars
g_cyl = mtcars.groupby("cyl")
## Both snippets below raise an error.... :/
g_cyl.mpg + g_cyl.mpg
g_cyl.add(g_cyl.mpg)
"""
Explanation: Pandas fast mutate architecture
(Published 27 Oct 2019)
Problem... |
boffi/boffi.github.io | dati_2020/01/Resonance.ipynb | mit | def x_normalized(t, z):
wn = w = 2*pi
wd = wn*sqrt(1-z*z)
# Clough Penzien p. 43
A = z/sqrt(1-z*z)
return (-cos(wd*t)-A*sin(wd*t))*exp(-z*wn*t) + cos(w*t)
"""
Explanation: Resonant excitation
We want to study the behaviour of an undercritically damped SDOF system when it is
subjected to a harmonic... |
google/eng-edu | ml/cc/prework/fr/hello_world.ipynb | apache-2.0 | # 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 the L... |
metpy/MetPy | v0.11/_downloads/e1a6a28aa03f7e0f88631b525fc7c40d/Hodograph_Inset.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, Hodograph, SkewT
from metpy.units import units
"""
Explanation: Hodograph Inset
Layout a Skew-T plo... |
cosmolejo/Fisica-Experimental-3 | Calculo_Error/Poisson/.ipynb_checkpoints/Poisson-checkpoint.ipynb | gpl-3.0 | dado = np.array([5, 3, 3, 2, 5, 1, 2, 3, 6, 2, 1, 3, 6, 6, 2, 2, 5, 6, 4, 2, 1, 3, 4, 2, 2, 5, 3, 3,
2, 2, 2, 1, 6, 2, 2, 6, 1, 3, 3, 3, 4, 4, 6, 6, 1, 2, 2, 6, 1, 4, 2, 5, 3, 6, 6, 3,
5, 2, 2, 4, 2, 2, 4, 4, 3, 3, 1, 2, 6, 1, 3, 3, 5, 4, 6, 6, 4, 2, 5, 6, 1, 4, 5, 4, 3, 5,
... |
postBG/DL_project | intro-to-rnns/Anna_KaRNNa_Exercises.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is bas... |
tensorflow/lucid | notebooks/differentiable-parameterizations/appendix/colab_gl.ipynb | apache-2.0 | # 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 the L... |
GoogleCloudPlatform/gcp-getting-started-lab-jp | data_analytics/sample.ipynb | apache-2.0 | %%bigquery
SELECT
COUNT(DISTINCT station_id) as cnt
FROM
`bigquery-public-data.new_york.citibike_stations`
"""
Explanation: 「%%bigquery」に続いてSQLを記述するとBigQueryにクエリを投げることができます
例えば、WebUIから実行した「重複なしでバイクステーションの数をカウントする」クエリは以下のように実行します
End of explanation
"""
%%bigquery
SELECT
COUNT(station_id) as cnt
FROM
`bigquery... |
AllenDowney/ThinkBayes2 | examples/regress_soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
import numpy as np
# import classes from thinkbayes2
from thinkbayes2 import Pmf, Cdf, Suite, Joint
imp... |
lowcloudnine/singularity-spark | ipython_notebooks/schiefjm/Elasticsearch/elasticsearch -- curl examples.ipynb | apache-2.0 | %%bash
curl -XGET "http://search-01.ec2.internal:9200/"
"""
Explanation: Using cURL with Elasticsearch
The introductory documents and tutorials all use cURL (here after referred to by its command line name curl) to interact with Elasticsearch and demonstrate what is possible and what is returned. Below is a short col... |
chrismcginlay/crazy-koala | jupyter/06_conditional_loops.ipynb | gpl-3.0 | word = input("What is the magic word? ")
while word!="abracadabra":
word = input("Wrong. Try again. What is the magic word? ")
print("Correct")
"""
Explanation: 6 Conditional Loops
Loops
Loops are a big deal in computing and robotics! Think about the kinds of tasks that computers and robots often get used for:
- j... |
phoebe-project/phoebe2-docs | 2.3/tutorials/constraints_hierarchies.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Advanced: Constraints and Changing Hierarchies
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # ... |
jmunar/pymc3-kalman | notebooks/01_RandomWalkPlusObservationNoise.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
%matplotlib inline
# True values
T = 500 # Time steps
sigma2_eps0 = 3 # Variance of the observation noise
sigma2_eta0 = 10 # Variance in the update of the mean
#... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160518수_5일차_미적분Calculus과 최적화Optimization/6.NumPy 패키지의 난수 관련 명령어.ipynb | mit | np.random.seed(0)
"""
Explanation: NumPy 패키지의 난수 관련 명령어
numpy.random 서브패키지
numpy.random 서브패키지는 NumPy 의 랜덤 넘버 생성 관련 함수를 모아 놓은 것으로 다음과 같은 함수를 제공한다.
seed: pseudo random 상태 설정
shuffle: 조합(combination)
choice: 순열(permutation)
random_integers: uniform integer
rand: uniform
randn: Gaussina normal
컴퓨터에서 생성한 난수는 랜덤처럼 보이지만 정해... |
kaivalyar/Sensei | TensorFlowIntro/IntroToTensorFlow.ipynb | mit | import tensorflow as tf
3 # a rank 0 tensor; this is a scalar with shape []
[1. ,2., 3.] # a rank 1 tensor; this is a vector with shape [3]
[[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3]
[[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 tensor with shape [2, 1, 3]
"""
Explanation: Introduction t... |
ageron/tensorflow-safari-course | 03_basics_collections_ex3.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
tf.__version__
"""
Explanation: Try not to peek at the solutions when you go through the exercises. ;-)
First let's make sure this notebook works well in both Python 2 and Python 3:
End of explanation
"""
>>> ... |
SIMEXP/Projects | metaad/network_level_meta_DMN.ipynb | mit | #seed_data = pd.read_csv('20160128_AD_Decrease_Meta_Christian.csv')
template_036= nib.load('/home/cdansereau/data/template_cambridge_basc_multiscale_nii_sym/template_cambridge_basc_multiscale_sym_scale036.nii.gz')
template_020= nib.load('/home/cdansereau/data/template_cambridge_basc_multiscale_nii_sym/template_cambrid... |
m2dsupsdlclass/lectures-labs | labs/06_deep_nlp/Character_Level_Language_Model_rendered.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Character-level Language Modeling with LSTMs
This notebook is adapted from Keras' lstm_text_generation.py.
Steps:
Download a small text corpus and preprocess it.
Extract a character vocabulary and use it to vectorize the text.
Trai... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/word2vec.ipynb | apache-2.0 | # Use the chown command to change the ownership of repository to user.
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install -q tqdm
# You can use any Python source file as a module by executing an import statement in some other Python source file.
# The import statement combines two operati... |
tgrammat/ML-Data_Challenges | Dato-tutorials/anomaly-detection/Anomaly Detection - Demo 2 [Moving Z-Score and Bayesian Changepoint Models].ipynb | apache-2.0 | import graphlab as gl
import matplotlib.pyplot as plt
fred_dcoilbrenteu = gl.SFrame.read_csv('./FRED-DCOILBRENTEU.csv')
fred_dcoilbrenteu
"""
Explanation: Anomaly Detection: Moving Z-Score and Bayesian Changepoints Model
Introductory Remarks
Anomalies are data points that are different from other observations in som... |
fastai/fastai | nbs/20b_tutorial.distributed.ipynb | apache-2.0 | #|all_multicuda
"""
Explanation: Tutorial - Distributed training in a notebook!
Using Accelerate to launch a training script from your notebook
End of explanation
"""
#hide
from fastai.vision.all import *
from fastai.distributed import *
from fastai.vision.models.xresnet import *
from accelerate import notebook_la... |
Olsthoorn/TransientGroundwaterFlow | Syllabus_in_notebooks/Sec6_5_Dalem-pumptest-Hantush.ipynb | gpl-3.0 | from scipy.special import exp1
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Secton 6.5.
The Dalem pumping test (semi-confined, Hantush type)
IHE, Transient groundwater
Olsthoorn, 2019-01-03
The most famous book on pumping test analyses is due to Krusemand and De Ridder (1970, 1994). Their book ... |
Soil-Carbon-Coalition/atlasdata | Mapping federal crop insurance in the U.S..ipynb | mit | #some usual imports, including some options for displaying large currency amounts with commas and only 2 decimals
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
pd.set_option('display.float_format', '{:,}'.format)
pd.set_option('display.precision',2)
"""
Explanation: Mapping ... |
BrownDwarf/ApJdataFrames | notebooks/Luhman2012.ipynb | mit | import warnings
warnings.filterwarnings("ignore")
from astropy.io import ascii
import pandas as pd
"""
Explanation: ApJdataFrames 008: Luhman2012
Title: THE DISK POPULATION OF THE UPPER SCORPIUS ASSOCIATION
Authors: K. L. Luhman and E. E. Mamajek
Data is from this paper:
http://iopscience.iop.org/0004-637X/758/1/3... |
ctzhu/Python_Data_Wrangling | Challenge01_key.ipynb | cc0-1.0 | df_temp = pd.read_csv('Temp_116760.csv', skiprows=1, index_col=0)
df_temp.tail()
df_prcp = pd.read_csv('Prcp_116760.csv', index_col=0)
df_prcp.index = pd.to_datetime(df_prcp.index)
df_prcp.head()
# and I want the index to be of date-time, rather than just strings
df_prcp.index.dtype
"""
Explanation: Data Wrangling... |
bgruening/EDeN | examples/ExampleModel.ipynb | gpl-3.0 | #code for making artificial dataset
import random
def swap_two_characters(seq):
'''define a function that swaps two characters at random positions in a string '''
line = list(seq)
id_i = random.randint(0,len(line)-1)
id_j = random.randint(0,len(line)-1)
line[id_i], line[id_j] = line[id_j], line[id_... |
smharper/openmc | examples/jupyter/mg-mode-part-iii.ipynb | mit | import os
import matplotlib.pyplot as plt
import numpy as np
import openmc
%matplotlib inline
"""
Explanation: This Notebook illustrates the use of the the more advanced features of OpenMC's multi-group mode and the openmc.mgxs.Library class. During this process, this notebook will illustrate the following features:... |
anhaidgroup/py_entitymatching | notebooks/guides/step_wise_em_guides/.ipynb_checkpoints/Selecting the Best Learning Matcher-checkpoint.ipynb | bsd-3-clause | # Import py_entitymatching package
import py_entitymatching as em
import os
import pandas as pd
# Set the seed value
seed = 0
!ls $datasets_dir
# Get the datasets directory
datasets_dir = em.get_install_path() + os.sep + 'datasets'
path_A = datasets_dir + os.sep + 'dblp_demo.csv'
path_B = datasets_dir + os.sep + '... |
barjacks/foundations-homework | 07/.ipynb_checkpoints/07_Introduction_to_Pandas-checkpoint.ipynb | mit | # import pandas, but call it pd. Why? Because that's What People Do.
import pandas as pd
"""
Explanation: An Introduction to pandas
Pandas! They are adorable animals. You might think they are the worst animal ever but that is not true. You might sometimes think pandas is the worst library every, and that is only kind... |
ocelot-collab/ocelot | demos/ipython_tutorials/4_wake.ipynb | gpl-3.0 | # the output of plotting commands is displayed inline within frontends,
# directly below the code cell that produced it
%matplotlib inline
# this python library provides generic shallow (copy) and deep copy (deepcopy) operations
from copy import deepcopy
import time
# import from Ocelot main modules and functions
f... |
ContinuumIO/nbpresent | notebooks/Importing revealjs themes.ipynb | bsd-3-clause | from os.path import join, basename, splitext, abspath
from glob import glob
import re
from pprint import pprint
from collections import defaultdict
from copy import deepcopy
import json
from uuid import uuid4
import colour
import jinja2
import yaml
from IPython.display import Javascript, display, Markdown
"""
Expl... |
opalytics/opalytics-ticdat | examples/expert_section/ml_soda_promotion/soda_promotion.ipynb | bsd-2-clause | import pandas
df_hist = pandas.read_excel("soda_sales_historical_data.xlsx")
df_hist[:5]
df_hist.shape
"""
Explanation: Combining Machine Learning and Optimization
With Gurobi and sklearn
Machine Learning topics
Touching the elephant here, but ~~not there~~
Supervised Learning
* Algorithm selection and hyper-parame... |
egrinstein/egrinstein.github.io | _posts/.ipynb_checkpoints/matplotlib-checkpoint.ipynb | mit | import matplotlib.pyplot as plt
%matplotlib inline
X = [0,1,2,3,4]
Fx = [x**2 for x in X]
fig = plt.plot(X,Fx)
plt.show(fig)
"""
Explanation: Matplotlib -- A Mostly Formal Introduction
Matplotlib is Python's most used library for scientific visualization. However, there are many ways to use it, and its syntax can... |
tclaudioe/Scientific-Computing | SC1v2/04b_BONUS_conjugate_gradient_method.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import solve_triangular
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
# pip install memory_profiler
%load_ext memory_profiler
np.random.seed(0)
from ipywidgets import interact, IntSlider
import matplotlib as mpl
mpl.rcParams['font.size'] ... |
marko911/deep-learning | tv-script-generation/dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
jhillairet/scikit-rf | doc/source/examples/metrology/Multiline TRL.ipynb | bsd-3-clause | %matplotlib inline
import skrf
from skrf.media import CPW, Coaxial
import numpy as np
import matplotlib.pyplot as plt
skrf.stylely()
"""
Explanation: Multiline TRL
Multiline TRL is a two-port VNA calibration utilizing at least two transmission lines with different physical lengths and at least one reflective standard ... |
LimeeZ/phys292-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.... |
rvperry/phys202-2015-work | assignments/assignment10/ODEsEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def solve_euler(derivs, y0, x):
"""Solve a 1d ... |
phungkh/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):
return (-a*x**2 + b*x**4)
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)==-9.0
"""... |
SunPower/PVMismatch | pvmismatch/contrib/xlsio/example_workflow/example_workflow.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from pvmismatch.pvmismatch_lib import (pvcell, pvconstants, pvmodule,
pvstring, pvsystem)
from pvmismatch.contrib import xlsio
"""
Explanation: Experimenting with shadow patterns and cell temperatures on... |
google-research/google-research | group_agnostic_fairness/data_utils/CreateUCISyntheticDataset.ipynb | apache-2.0 | from __future__ import division
import pandas as pd
import numpy as np
import json
import collections
import os
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_context('paper',font_scale=1.5)
dataset_base_dir = './group_agnostic_fairness/data/uci_adult/'
def sample_data(data_df, num=None, restrictions=N... |
balarsen/pymc_learning | DirichletProcess/Sunspot_example.ipynb | bsd-3-clause | # pymc3.distributions.DensityDist?
import matplotlib.pyplot as plt
import matplotlib as mpl
from pymc3 import Model, Normal, Slice
from pymc3 import sample
from pymc3 import traceplot
from pymc3.distributions import Interpolated
from theano import as_op
import theano.tensor as tt
import numpy as np
from scipy import ... |
lmcinnes/hdbscan | notebooks/Performance data generation .ipynb | bsd-3-clause | import sklearn.datasets
import numpy as np
import pandas as pd
import subprocess
import time
"""
Explanation: Performance timings data generation
We need to generate data comparing performance of the reference implementation of HDBSCAN and various historical versions of the hdbscan library. We need to do this varying ... |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_tf_dics.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.event import make_fixed_length_events
from mne.datasets import sample
from mne.time_frequency import csd_epochs
from mne.beamformer import tf_dics
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = sample.da... |
phockett/ePSproc | notebooks/LF_AF_verification_tests_060720_tidy.ipynb | gpl-3.0 | # Imports
import numpy as np
import pandas as pd
import xarray as xr
# Special functions
# from scipy.special import sph_harm
import spherical_functions as sf
import quaternion
# Performance & benchmarking libraries
# from joblib import Memory
# import xyzpy as xyz
import numba as nb
# Timings with ttictoc or time
#... |
rbiswas4/simlib | example/ExploringOpSimOutputs.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Required packages sqlachemy, pandas (both are part of anaconda distribution, or can be installed with a python installer)
# One step requires the LSST stack, can be skipped for a particular OPSIM database in question
import opsimsummary as oss
im... |
tensorflow/workshops | extras/tfhub-text/movie-classification.ipynb | apache-2.0 | import os
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
import json
import pickle
import urllib
from sklearn.preprocessing import MultiLabelBinarizer
print(tf.__version__)
"""
Explanation: Building a text classification model with TF Hub
In this notebook, we'll walk you ... |
axbaretto/beam | examples/notebooks/documentation/transforms/python/element-wise/flatmap-py.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License")
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you u... |
maartenbreddels/vaex | docs/source/example_ml_titanic.ipynb | mit | import vaex
import vaex.ml
import numpy as np
import pylab as plt
"""
Explanation: <style>
pre {
white-space: pre-wrap !important;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}
.table-striped > tbody > tr:nth-of-type(even) {
background-color: white;
}
.table-striped td, .table... |
kubeflow/kfp-tekton-backend | samples/contrib/arena-samples/standalonejob/standalone_pipeline.ipynb | apache-2.0 | ! arena data list
"""
Explanation: Arena Kubeflow Pipeline Notebook demo
Prepare data volume
You should prepare data volume user-susan by following docs.
And run arena data list to check if it's created.
End of explanation
"""
KFP_SERVICE="ml-pipeline.kubeflow.svc.cluster.local:8888"
KFP_PACKAGE = 'http://kubeflow.... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_object_epochs.ipynb | bsd-3-clause | import mne
import os.path as op
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: The :class:Epochs <mne.Epochs> data structure: epoched data
:class:Epochs <mne.Epochs> objects are a way of representing continuous
data as a collection of time-locked trials, stored in an array of shap... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-cm2-vhr4/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-vhr4', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-CM2-VHR4
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation... |
BinRoot/TensorFlow-Book | ch12_rank/Concept01_ranknet.ipynb | mit | import tensorflow as tf
import numpy as np
import random
%matplotlib inline
import matplotlib.pyplot as plt
"""
Explanation: Ch 12: Concept 01
Ranking by neural network
Import the relevant libraries
End of explanation
"""
n_features = 2
def get_data():
data_a = np.random.rand(10, n_features) + 1
data_b = n... |
rishuatgithub/MLPy | torch/PYTORCH_NOTEBOOKS/00-Crash-Course-Topics/00-Crash-Course-NumPy/01-NumPy-Indexing-and-Selection.ipynb | apache-2.0 | import numpy as np
#Creating sample array
arr = np.arange(0,11)
#Show
arr
"""
Explanation: <a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>
<center><em>Copyright Pierian Data</em></center>
<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandat... |
bryantbiggs/luther-02 | Total_Analysis1_57%.ipynb | mit | import pandas as pd
import numpy as np
import string
from collections import defaultdict
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
"""
Explanation: Dates:
Older moves might not be torrented
Month: Blockbusters are released in May and December, No good movies re... |
henchc/Rediscovering-Text-as-Data | 10-Metadata/02-HTRC-Classification-Example.ipynb | mit | poetry_output = !htid2rsync --f data/poetry.txt | rsync -azv --files-from=- data.sharc.hathitrust.org::features/ data/poetry/
scifi_output = !htid2rsync --f data/scifi.txt | rsync -azv --files-from=- data.sharc.hathitrust.org::features/ data/scifi/
outputs = list([poetry_output, scifi_output])
subjects = ['poetry', 's... |
ewulczyn/talk_page_abuse | src/modeling/Clean Annotations.ipynb | apache-2.0 | """
# v4_annotated
user_blocked = [
'annotated_onion_layer_5_rows_0_to_5000_raters_20',
'annotated_onion_layer_5_rows_0_to_10000',
'annotated_onion_layer_5_rows_0_to_10000_raters_3',
'annotated_onion_layer_5_rows_10000_to_50526_... |
YuriyGuts/kaggle-quora-question-pairs | notebooks/feature-jaccard-ngrams.ipynb | mit | from pygoose import *
"""
Explanation: Feature: Character N-Gram Jaccard Index
Calculate Jaccard similarities between sets of character $n$-grams for different values of $n$.
Imports
This utility package imports numpy, pandas, matplotlib and a helper kg module into the root namespace.
End of explanation
"""
project ... |
elmaso/tno-ai | aind2-cnn/cifar10-classification/cifar10_cnn.ipynb | gpl-3.0 | import keras
from keras.datasets import cifar10
# load the pre-shuffled train and test data
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
"""
Explanation: Artificial Intelligence Nanodegree
Convolutional Neural Networks
In this notebook, we train a CNN to classify images from the CIFAR-10 database.
1. L... |
apryor6/apryor6.github.io | visualizations/seaborn/notebooks/countplot.ipynb | mit | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.rcParams['figure.figsize'] = (20.0, 10.0)
plt.rcParams['font.family'] = "serif"
df = pd.read_csv('../../../datasets/movie_metadata.csv')
df.head()
"""
Explanation: seaborn.countplot
Bar graphs are useful for displaying ... |
PDBeurope/PDBe_Programming | search_interface/notebooks/search_introduction.ipynb | apache-2.0 | PDBE_SOLR_URL = "http://www.ebi.ac.uk/pdbe/search/pdb"
# or https://www.ebi.ac.uk/pdbe/search/pdb/select?rows=0&q=status:REL&wt=json
from mysolr import Solr
solr = Solr(PDBE_SOLR_URL, version=4)
response = solr.search(q='status:REL', rows=0)
documents = response.documents
print("Number of results:",... |
azhurb/deep-learning | intro-to-tensorflow/intro_to_tensorflow.ipynb | mit | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
frictionlessdata/datapackage-pipelines | TUTORIAL.ipynb | mit | %%sh
python3 -m pip install -qU datapackage-pipelines[seedup]
"""
Explanation: Datapackage Pipelines Tutorial
This tutorial is built as a Jupyter notebook which allows you to run and modify the code inline and can be used as a starting point for new Datapackage Pipelines projects.
Installation
Follow the DataFlows Tut... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb | apache-2.0 | # Use the chown command to change the ownership of the repository.
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.3.0 || pip install tensorflow==2.3.0
"""
Explanation: Introducing the Keras Functional API on Ve... |
smorton2/think-stats | code/chap05exmine.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
import analytic
import thinkstats2
import thinkplot
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensou... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/art_and_science_of_ml/solutions/export_data_from_bq_to_gcs.ipynb | apache-2.0 | # Run the chown command to change the ownership of the repository
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Install the Google Cloud BigQuery library
%pip install google-cloud-bigquery==1.25.0
"""
Explanation: Exporting data from BigQuery to Google Cloud Storage
In this notebook, we export ... |
massimo-nocentini/simulation-methods | notes/set-based-type-system/set-based-type-system.ipynb | mit | from itertools import repeat
from sympy import *
#from type_system import *
%run ../../src/commons.py
%run ./type-system.py
"""
Explanation: <p>
<img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg"
alt="UniFI logo" style="float: left; width: 20%; height: 20%;">
<div align="right">
Ma... |
Hamstard/RVMs | Tutorial.ipynb | mit | %matplotlib inline
from linear_model import RelevanceVectorMachine, distribution_wrapper, GaussianFeatures, \
FourierFeatures, repeated_regression, plot_summary
from sklearn import preprocessing
import numpy as np
from scipy import stats
import matplotlib#
import matplotlib.pylab as plt
matplotlib.rc('text', usete... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a_eco2/td2a_Seance_7_Analyse_de_textes_correction.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: TD7 - Analyse de texte - correction
Analyse de texte, TF-IDF, LDA, moteur de recherche, expressions régulières (correction).
End of explanation
"""
from pyensae.datasource import download_data
download_data("df_pocket.zip")
"""
Explana... |
CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter4_TheGreatestTheoremNeverTold/Ch4_LawOfLargeNumbers_PyMC2.ipynb | mit | %matplotlib inline
import numpy as np
from IPython.core.pylabtools import figsize
import matplotlib.pyplot as plt
figsize(12.5, 5)
import pymc as pm
sample_size = 100000
expected_value = lambda_ = 4.5
poi = pm.rpoisson
N_samples = range(1, sample_size, 100)
for k in range(3):
samples = poi(lambda_, size=sample_... |
zingale/pyreaclib | library-examples.ipynb | bsd-3-clause | import pynucastro as pyna
library_file = '20180319default2'
mylibrary = pyna.rates.Library(library_file)
"""
Explanation: Selecting Rates from a Library
The Library class in pynucastro provides a high level interface for reading files containing one or more Reaclib rates and then filtering these rates based on user-s... |
miguelfrde/stanford-cs231n | assignment3/NetworkVisualization-PyTorch.ipynb | mit | import torch
from torch.autograd import Variable
import torchvision
import torchvision.transforms as T
import random
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
import matplotlib.pyplot as plt
from cs231n.image_utils import SQUEEZENET_MEAN, SQUEEZENET_STD
from PIL import Image
%matplotlib i... |
kirichoi/tellurium | examples/notebooks/core/tellurium_utility.ipynb | apache-2.0 | %matplotlib inline
from __future__ import print_function
import tellurium as te
# to get the tellurium version use
print('te.__version__')
print(te.__version__)
# or
print('te.getTelluriumVersion()')
print(te.getTelluriumVersion())
# to print the full version info use
print('-' * 80)
te.printVersionInfo()
print('-' *... |
mne-tools/mne-tools.github.io | 0.18/_downloads/2187adaa95700a6de5f9ba2004254a87/plot_sensor_noise_level.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import mne
data_path = mne.datasets.sample.data_path()
raw_erm = mne.io.read_raw_fif(op.join(data_path, 'MEG', 'sample',
'ernoise_raw.fif'), preload=True)
"""
Explanation: Show nois... |
StefanoAllesina/ISC | python/solutions/Lahti2014_solution.ipynb | gpl-2.0 | import csv
"""
Explanation: Solution of Lahti et al. 2014
Write a function that takes as input a dictionary of constraints and returns a dictionary tabulating the BMI group for all the records matching the constraints. For example, calling:
get_BMI_count({'Age': '28', 'Sex': 'female'})
should return:
{'NA': 3, 'lean'... |
qingshuimonk/STA663 | docs/vae-Bohao.ipynb | mit | import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(0)
tf.set_random_seed(0)
# Load MNIST data in a format suited for tensorflow.
# The script input_data is available under this URL:
# https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/e... |
harishkrao/Machine-Learning | Titanic - Machine Learning from Disaster - Understanding the data.ipynb | mit | sns.barplot(x='Pclass',y='Survived',data=train, hue='Sex')
"""
Explanation: The plot shows that the number of female survivors were significantly more than the male survivors. There were more survivors overall in first class than in any other class.
There were also less survivors overall in third class than in any oth... |
mne-tools/mne-tools.github.io | dev/_downloads/58e35821e0f211b843d5ead3e33d8849/20_sensors_time_frequency.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
# Richard Höchenberger <richard.hoechenberger@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequency... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Machine Learning Sections/K-Nearest-Neighbors/K Nearest Neighbors with Python.ipynb | mit | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
K Nearest Neighbors with Python
You've been given a classified data set from a company! They've hidden the f... |
TakayukiSakai/tensorflow | tensorflow/examples/udacity/1_notmnist.ipynb | apache-2.0 | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
RainFool/Udacity_Anwser_RainFool | Project0/titanic_survival_exploration.ipynb | mit | # 检查你的Python版本
from sys import version_info
if version_info.major != 2 and version_info.minor != 7:
raise Exception('请使用Python 2.7来完成此项目')
import numpy as np
import pandas as pd
# 数据可视化代码
from titanic_visualizations import survival_stats
from IPython.display import display
%matplotlib inline
# 加载数据集
in_file = 't... |
DhashS/Olin-Complexity-Final-Project | reports/01_exact_algorithms.ipynb | gpl-3.0 | # %load -s brute_force algs.py
def brute_force(p, perf=False):
import itertools as it
#Generate all possible tours (complete graph)
tours = list(it.permutations(p.nodes())) #O(V!)
costs = []
if not perf:
cost_data = pd.DataFrame(columns=["$N$", "cost"])
#Evaluate all tours
... |
radhikapc/foundation-homework | homework_sql/Homework_6-Radhika.ipynb | mit | import requests
data = requests.get('http://localhost:5000/lakes').json()
print(len(data), "lakes")
for item in data[:10]:
print(item['name'], "- elevation:", item['elevation'], "m / area:", item['area'], "km^2 / type:", item['type'])
"""
Explanation: Homework 6: Web Applications
For this homework, you're going to... |
turbomanage/training-data-analyst | quests/endtoendml/labs/5_train_keras.ipynb | apache-2.0 | # change these to try this notebook out
BUCKET = 'cloud-training-demos-ml'
PROJECT = 'cloud-training-demos'
REGION = 'us-central1'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
os.environ['TFVERSION'] = '2.0' # not used in this notebook
%%bash
gcloud config set... |
g-weatherill/notebooks | hmtk/Geology.ipynb | agpl-3.0 | #Import tools
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from hmtk.plotting.faults.geology_mfd_plot import plot_recurrence_models
from openquake.hazardlib.scalerel.wc1994 import WC1994 # In all the following examples the Wells & Coppersmith (1994) Scaling Relation is Used
"""
Explanation: H... |
saashimi/CPO-datascience | Normalized Dataset.ipynb | mit | #Import required packages
import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt
def format_date(df_date):
"""
Splits Meeting Times and Dates into datetime objects where applicable using regex.
"""
df_date['Days'] = df_date['Meeting_Times'].str.extract('([^\s]+)', expand... |
ssunkara1/bqplot | examples/Marks/Pyplot/GridHeatMap.ipynb | apache-2.0 | np.random.seed(0)
data = np.random.randn(10, 10)
"""
Explanation: Get Data
End of explanation
"""
fig = plt.figure(padding_y=0.0)
grid_map = plt.gridheatmap(data)
fig
"""
Explanation: Basic Heat map
End of explanation
"""
axes_options = {'column': {'visible': False}, 'row': {'visible': False}, 'color': {'visible'... |
shngli/Data-Mining-Python | Mining massive datasets/Data stream mining.ipynb | gpl-3.0 | import numpy as np
A = np.array([#A B C D E F G H
[0,0,1,0,0,1,0,0],
[0,0,0,0,1,0,0,1],
[1,0,0,1,0,1,0,0],
[0,0,1,0,1,0,1,0],
[0,1,0,1,0,0,0,1],
[1,0,1,0,0,0,1,0],
[0,0,0,1,0,1,0,1],
[0,1,0,0,1,0,1,0]])
print A
D ... |
mne-tools/mne-tools.github.io | 0.20/_downloads/7b1b17f7cd0e886e3d0da4385e8a1630/plot_psf_ctf_vertices.ipynb | bsd-3-clause | # Authors: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
from mne.minimum_norm import (make_inverse_resolution_matrix, get_cross_talk,
get_point_spread)
print(__do... |
Chipe1/aima-python | notebooks/chapter24/Image Edge Detection.ipynb | mit | import os, sys
sys.path = [os.path.abspath("../../")] + sys.path
from perception4e import *
from notebook4e import *
"""
Explanation: Edge Detection
Edge detection is one of the earliest and popular image processing tasks. Edges are straight lines or curves in the image plane across which there is a “significant” chang... |
jepegit/cellpy | dev_utils/batch_notebooks/creating_journals_by_different_methods.ipynb | mit | %load_ext autoreload
%autoreload 2
import os
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cellpy
from cellpy import prms
from cellpy import prmreader
from cellpy.utils import batch
import holoviews as hv
%matplotlib inline
hv.extension("bokeh")
name = "firs... |
karlnapf/shogun | doc/ipython-notebooks/pca/pca_notebook.ipynb | bsd-3-clause | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
# import all shogun classes
from shogun import *
import shogun as sg
"""
Explanation: Principal Component Analysis in Shogun
By Abhijeet Kislay (GitHub ID: <a href='https://github.com/kislayabhi'>kislayabhi</a>)
Th... |
daniel-acuna/python_data_science_intro | notebooks/lab-sentiment_analysis.ipynb | mit | import findspark
findspark.init()
import pyspark
import numpy as np
conf = pyspark.SparkConf().\
setAppName('sentiment-analysis').\
setMaster('local[*]')
from pyspark.sql import SQLContext, HiveContext
sc = pyspark.SparkContext(conf=conf)
sqlContext = HiveContext(sc)
# dataframe functions
from pyspark.sql ... |
kdmurray91/kwip-experiments | writeups/coalescent/50reps_2016-05-18/50reps.ipynb | mit | expts = list(map(lambda fp: path.basename(fp.rstrip('/')), glob('data/*/')))
print("Number of replicate experiments:", len(expts))
def process_expt(expt):
expt_results = []
def extract_info(filename):
return re.search(r'kwip/(\d\.?\d*)x-(0\.\d+)-(wip|ip).dist', filename).groups()
# dict o... |
ueapy/enveast_python_course_materials | Day_3/22-Final-Project.ipynb | mit | # import pandas as pd
# df = pd.read_csv('../data/earthquakes_2015_2016_gt45.csv', parse_dates = ['time',], index_col='time')
# df.head()
"""
Explanation: Final Micro Project
The time has come to apply what you have learned throughout the course by doing a micro project.
You have two options now.
Choose from our li... |
pyReef-model/wavesed | wavesed2.ipynb | gpl-3.0 | file1='../data/gbr_south.csv'
file2='../data/topoGBR1000.csv'
# Bathymetric filename
bfile = file1
# Resolution factor
rfac = 4
"""
Explanation: Definition of model variables
Model domain / grid parameters
End of explanation
"""
# Wave heights (m)
H0 = [2,3,2]
# Define wave source direction at boundary
# (angle ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.