repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
drvinceknight/cfm | assets/assessment/2020-2021/ind/solution.ipynb | mit | import random
def sample_experiment():
### BEGIN SOLUTION
"""
Returns true if a random number is less than 0
"""
return random.random() < 0
number_of_experiments = 1000
sum(
sample_experiment() for repetition in range(number_of_experiments)
) / number_of_experiments
### END SOLUTION
"""
Expl... |
phoebe-project/phoebe2-docs | 2.0/tutorials/ltte.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Rømer and Light Travel Time Effects (ltte)
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""... |
encima/Comp_Thinking_In_Python | Session_4/4_Lists and Loops.ipynb | mit | movie_list = ['The Godfather', 'Jaws', 'Troy', 'Midnight Special', 'Casper']
"""
Explanation: Lists and Loops
Dr. Chris Gwilliams
gwilliamsc@cardiff.ac.uk
Overview So Far
Introduction to Python
Types
Variables
Functions (built in and your own)
Methods
Scope
Imports
This Session
Lists
indexing
negative indexing
Oper... |
tanghaibao/goatools | notebooks/annotation_coverage.ipynb | bsd-2-clause | # wget ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz
from goatools.base import download_ncbi_associations
gene2go = download_ncbi_associations()
"""
Explanation: Calculating Annotation Coverage
This section shows how to calculate annotation coverage as described here:
Annotation coverage of Gene Ontology (GO) te... |
liviu-/notebooks | notebooks/predicting_marks_by_facebook_likes.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 12, 10
plt.rcParams.update({'font.size': 15})
data = pd.read_csv('../data/train.csv')
data.describe()
"""
Explanation: Predicting Average Marks Based on Facebook Likes
Introduction
It is commo... |
RTHMaK/RPGOne | scipy-2017-sklearn-master/notebooks/16 Performance metrics and Model Evaluation.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=2)
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.svm import LinearSVC
digits = load_digits()
X, y = digits.data, digits.target
X_train, X_test, y_train, y_te... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_decoding_unsupervised_spatial_filter.ipynb | bsd-3-clause | # Authors: Jean-Remi King <jeanremi.king@gmail.com>
# Asish Panda <asishrocks95@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.decoding import UnsupervisedSpatialFilter
from sklearn.decomposition import PCA, FastI... |
retnuh/deep-learning | dcgan-svhn/DCGAN.ipynb | mit | %matplotlib inline
import pickle as pkl
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import tensorflow as tf
!mkdir data
"""
Explanation: Deep Convolutional GANs
In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De... |
kpolimis/SOC590-Python-tutorial | notebooks/nfl_passing.ipynb | mit | import os
import urllib
import webbrowser
import pandas as pd
from bs4 import BeautifulSoup
url = 'http://www.pro-football-reference.com/years/2015/passing.htm'
webbrowser.open_new_tab(url)
# The url we will be scraping
url_2015 = "http://www.pro-football-reference.com/years/2015/passing.htm"
# get the html
html = u... |
rebeccabilbro/tiamat | MongoDBTutorial.ipynb | mit | import json
import pymongo
from pprint import pprint
"""
Explanation: Introduction to MongoDB with PyMongo and NOAA Data
This notebook provides a basic walkthrough of how to use MongoDB and is based on a tutorial originally by Alberto Negron.
What is MongoDB?
MongoDB is a cross-platform document-oriented NoSQL databas... |
ihmeuw/dismod_mr | examples/checking_convergence.ipynb | agpl-3.0 | import numpy as np, pandas as pd, dismod_mr, pymc as pm, matplotlib.pyplot as plt, seaborn as sns
%matplotlib inline
# set a random seed to ensure reproducible simulation results
np.random.seed(123456)
# simulate data
n = 20
data = dict(age=np.random.randint(0, 10, size=n)*10,
year=np.random.randint(1990... |
chrismcginlay/crazy-koala | jupyter/07_fixed_loops.ipynb | gpl-3.0 | for star in range(5):
print("*")
"""
Explanation: 7. Fixed Loops
In the previous lesson we studied conditional loops. Now it is time to see fixed loops.
What's the difference?
With a fixed loop, you know how many times you are going to repeat the loop in advance. This is not the case with conditional loops as you ... |
ajdawson/python_for_climate_scientists | course_content/notebooks/numpy_intro.ipynb | gpl-3.0 | import numpy as np
"""
Explanation: An introduction to NumPy
NumPy provides an efficient representation of multidimensional datasets like vectors and matricies, and tools for linear algebra and general matrix manipulations - essential building blocks of virtually all technical computing
Typically NumPy is imported as ... |
mohanprasath/Course-Work | numpy/numpy_exercises_from_kyubyong/Mathematical_functions_solutions.ipynb | gpl-3.0 | import numpy as np
np.__version__
__author__ = "kyubyong. kbpark.linguist@gmail.com. https://github.com/kyubyong"
"""
Explanation: Mathematical functions
End of explanation
"""
x = np.array([0., 1., 30, 90])
print "sine:", np.sin(x)
print "cosine:", np.cos(x)
print "tangent:", np.tan(x)
"""
Explanation: Trigonom... |
ES-DOC/esdoc-jupyterhub | notebooks/nasa-giss/cmip6/models/sandbox-1/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-1', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: NASA-GISS
Source ID: SANDBOX-1
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, En... |
NYUDataBootcamp/Projects | MBA_S16/Reddick-Pulito-3GuysNamedChris.ipynb | mit | #This guided coding excercise requires associated .csv files: CE1.csv, CH1.csv, CP1.csv, Arnold1.csv, Bruce1.csv, and Tom1.csv
#make sure you have these supplemental materials ready to go in your active directory before proceeding
#Let's start coding! We first need to make sure our preliminary packages are in order. W... |
Griesbacher/ContentAnalytics | data_analysis_results/data_analysis.ipynb | gpl-3.0 | from tweet import Tweet
import numpy as np
from csv_handling import load_tweet_csv
import matplotlib.pyplot as plt
"""
Explanation: Betrachtung und Analyse der Lerndaten
Es werden zunächst die Daten Betrachtet, um Besonderheiten zu finden, und sich mit den Daten vertraut zu machen.
End of explanation
"""
tweets = lo... |
paoloRais/lightfm | examples/quickstart/quickstart.ipynb | apache-2.0 | import numpy as np
from lightfm.datasets import fetch_movielens
data = fetch_movielens(min_rating=5.0)
"""
Explanation: Quickstart
In this example, we'll build an implicit feedback recommender using the Movielens 100k dataset (http://grouplens.org/datasets/movielens/100k/).
The code behind this example is available ... |
kit-cel/wt | wt/vorlesung/ch1_3/birthday.ipynb | gpl-2.0 | # importing
import numpy as np
import time
import matplotlib.pyplot as plt
import matplotlib
# showing figures inline
%matplotlib inline
# plotting options
font = {'size' : 20}
plt.rc('font', **font)
plt.rc('text', usetex=0)
matplotlib.rc('figure', figsize=(18, 6) )
start = time.time()
"""
Explanation: Conten... |
ledeprogram/algorithms | class4/homework/Emelike_Mercy_4_1.ipynb | gpl-3.0 | conn = pg8000.connect(user = 'dot_student', database='training', port=5432, host='training.c1erymiua9dx.us-east-1.rds.amazonaws.com', password='qgis')
conn.rollback()
cursor = conn.cursor()
cursor.execute("SELECT column_name FROM information_schema.columns WHERE table_name='dot_311'")
# run the commented out code to... |
obulpathi/datascience | scikit/Chapter 1/Clustering.ipynb | apache-2.0 | from sklearn.datasets import make_blobs
X, y = make_blobs(random_state=42)
X.shape
plt.scatter(X[:, 0], X[:, 1])
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3)
kmeans.fit(X)
cluster_labels = kmeans.predict(X)
cluster_labels
plt.scatter(X[:, 0], X[:, 1], c=cluster_labels)
y
from sklearn.metrics... |
feststelltaste/software-analytics | notebooks/Generating Synthetic Data based on a Git Log.ipynb | gpl-3.0 | from lib.ozapfdis import git_tc
log = git_tc.log_numstat("C:/dev/repos/buschmais-spring-petclinic")
log.head()
log = log[log.file.str.contains(".java")]
log.loc[log.file.str.contains("/jdbc/"), 'type'] = "jdbc"
log.loc[log.file.str.contains("/jpa/"), 'type'] = "jpa"
log.loc[log.type.isna(), 'type'] = "other"
log.head... |
JanetMatsen/bacteriopop | depreciated/develop_simplify_phylogeny.ipynb | apache-2.0 | # df[['col1', 'col2', 'col3', 'col4']].groupby(['col1', 'col2']).agg(['mean', 'count'])
taxa_per_sample = loaded_data.groupby(['week', 'oxygen', 'replicate'])['abundance'].agg('count')
taxa_per_sample.head(20)
"""
Explanation: How many taxa are in each groupby?
End of explanation
"""
abs(-0.01)
sample_abundance_su... |
nvenayak/impact | docs/source/features_0.ipynb | gpl-3.0 | import impact as impt
import cobra
import cobra.test
import cobra.io
import numpy as np
# import matplotlib.pyplot as plt
% matplotlib inline
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
from plotly.graph_objs import Bar, Layout, Figure, Scatter
init_notebook_mode()
# We include this... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/machine_learning_in_the_enterprise/solutions/overfit_and_underfit.ipynb | apache-2.0 | !pip install tensorflow==2.7.0
"""
Explanation: Introduction to Overfit and Underfit
Learning objectives
Use the Higgs Dataset.
Demonstrate overfitting.
Strategies to prevent overfitting.
Introduction
In this notebook, we'll explore several common regularization techniques, and use them to improve on a classificatio... |
ljchang/psyc63 | Notebooks/3_Introduction_to_Regression.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.formula.api as smf
import statsmodels.stats.api as stats
"""
Explanation: Linear Regression Analysis
Written by Jin Cheong & Luke Chang
In this lab we are going to learn how to do ... |
matthewljones/computingincontext | .ipynb_checkpoints/CiC_lecture_04_text_mining_topics_trends-checkpoint.ipynb | gpl-2.0 | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import textmining_blackboxes as tm
"""
Explanation: Computing In Context
Social Sciences Track
Lecture 4--topics, trends, and dimensional scaling
Matthew L. Jones
like, with code and stuff
End of explanation
"""
#see if package imported correct... |
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies | ex06-Process uWind (Zonal Mean and Interpolation).ipynb | mit | % matplotlib inline
from pylab import *
import numpy as np
from scipy.interpolate import interp2d
from netCDF4 import Dataset as netcdf # netcdf4-python module
import matplotlib.pyplot as plt
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 12, 6
"""
Explanation: Process U-Wind: Zonal Mean and Int... |
rvuduc/cse6040-ipynbs | 24--online-linreg.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: CSE 6040, Fall 2015 [24]: "Online" regression
This notebook continues the linear regression problem from last time, but asks about a method that can estimate the regression coefficients when you only get to see samples "one-at-a-tim... |
tensorflow/docs-l10n | site/zh-cn/r1/tutorials/keras/basic_classification.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... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/histograms.ipynb.ipynb | mit | import plotly
plotly.__version__
"""
Explanation: New to Plotly?
Plotly's Python library is free and open source! Get started by downloading the client and reading the primer.
<br>You can set up Plotly to work in online or offline mode, or in jupyter notebooks.
<br>We also have a quick-reference cheatsheet (new!) to h... |
neurodata/ndmg | tutorials/Tractography_Directional_Field_QA_Tutorial.ipynb | apache-2.0 | #general imports
import os
import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
#dipy imports
from dipy.reconst.shm import CsaOdfModel
from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel, recursive_response
from dipy.data import get_sphere
from dipy.directio... |
mikekestemont/lot2016 | Chapter 2 - Collections.ipynb | mit | sentence = "Python's name is derived from the television series Monty Python's Flying Circus."
"""
Explanation: Chapter 2: Collections
-- A Python Course for the Humanities by Folgert Karsdorp and Maarten van Gompel, with modifications by Mike Kestemont and Lars Wieneke
Lists
Consider the sentence below:
End of expla... |
olgabot/cshl-singlecell-2017 | notebooks/in_progress/02_tissue_subpopulations/00_read_macosko2015_data.ipynb | mit | (n_transcripts_per_gene > 1e3).sum()
n_transcripts_per_gene[n_transcripts_per_gene > 1e4]
"""
Explanation: Subset the genes based on their total number of transcripts
End of explanation
"""
median_transcripts_per_gene = table1_t.median()
median_transcripts_per_gene.head()
sns.distplot(median_transcripts_per_gene)
... |
econ-ark/HARK | examples/Journeys/AzureMachineLearning.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import numpy as np
# Initial imports and notebook setup, click arrow to show
from HARK.ConsumptionSaving.ConsIndShockModelFast import IndShockConsumerTypeFast
from HARK.utilities import plot_funcs_der, plot_funcs
mystr = lambda number: "{:.4f}".format(number)
"""
Explanation: Azure Ma... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/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', 'miroc', 'sandbox-3', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-3
Sub-Topics: Radiative Forcings.
Properties: 85 (4... |
hoerldavid/nis-automation | create_overview_calibration.ipynb | mit | import os
import logging
import json
from nis_util import do_large_image_scan, set_optical_configuration, get_position
logging.basicConfig(format='%(asctime)s - %(levelname)s in %(funcName)s: %(message)s', level=logging.DEBUG)
logger = logging.getLogger(__name__)
"""
Explanation: Pixel -> Stage calibration for overv... |
Danghor/Formal-Languages | ANTLR4-Python/Earley-Parser/Earley-Parser.ipynb | gpl-2.0 | !cat simple.g
"""
Explanation: Implementing an Earley Parser
A Grammar for Grammars
Earley's algorithm has two inputs:
- a grammar $G$ and
- a string $s$.
It then checks whether the string $s$ can be parsed with the given grammar.
In order to input the grammar in a natural way, we first have to develop a parser for gr... |
hich28/mytesttxx | tests/python/decompose.ipynb | gpl-3.0 | aut = spot.translate('(Ga -> Gb) W c')
aut
"""
Explanation: This notebook demonstrates how to use the decompose_strength() function to split an automaton in up to three automata capturing different behaviors. This is based on the paper Strength-based decomposition of the property Büchi automaton for faster model che... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/26_sirajs_text_summarisation/notebooks/01-How_to_make_a_text_summarizer/predict.ipynb | mit | import os
os.environ['THEANO_FLAGS'] = 'device=cpu,floatX=float32'
import keras
keras.__version__
"""
Explanation: if your GPU is busy you can use CPU for predictions
End of explanation
"""
FN0 = 'vocabulary-embedding'
"""
Explanation: Generate headlines using the "simple" model from http://arxiv.org/pdf/1512.0171... |
zhoupc/CNMF_E | python_wrapper/analyze_cnmfe_matlab.ipynb | gpl-3.0 | import sys
import os
from matplotlib import pyplot as plt
import scipy.sparse as sparse
import scipy.io as sio
import numpy as np
import python_utils as utils
%matplotlib inline
"""
Explanation: Python analysis of output from MATLAB CNMF-E implementation
Analyze tif stacks using batch_cnmf.py and then open the resu... |
KennyCandy/HAR | LSTM.ipynb | mit | # All Includes
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf # Version r0.10
from sklearn import metrics
import os
# Useful Constants
# Those are separate normalised input features for the neural network
INPUT_SIGNAL_TYPES = [
"body_acc_x_",
"body_acc_y_",
... |
fionapigott/Data-Science-45min-Intros | long-tail-distributions-002/power-laws.ipynb | unlicense | # Plotting library
import matplotlib.pyplot as plt
%matplotlib inline
# mathematics
from math import exp, pi, sqrt, log
from numpy import linspace, hstack, round, random, arange, mean, logspace, argmax, array
from collections import Counter
from random import sample, choice
from random import uniform
#from functools i... |
GoogleCloudPlatform/bigquery-notebooks | notebooks/official/template_notebooks/bigquery_basics.ipynb | apache-2.0 | import pandas
from google.cloud import bigquery
"""
Explanation: BigQuery basics
BigQuery is a petabyte-scale analytics data warehouse that you can use to run SQL queries over vast amounts of data in near realtime. This page shows you how to get started with the Google BigQuery API using the Python client library.
Imp... |
gyulat/odometry-EKF | Kalman1.ipynb | apache-2.0 | def h(x,rs,rw):
## mérési egyenlet függvénye
## x = állapot vektor (p,pdot,pdotdot)
## rs = szenzor tengelytől mért távolsága
## rw = kerék sugara
g = 9.81
h1 = -g*np.sin(x[0]/rw) + x[2]*np.cos(x[0]/rw) - x[2]*rs/rw
h2 = -g*np.cos(x[0]/rw) - x[2]*np.sin(x[0]/rw) - (x[1])**2*rs/(rw**2)
r... |
jbarnoud/PBxplore | doc/source/notebooks/Assignement.ipynb | mit | from __future__ import print_function, division
from pprint import pprint
import os
import pbxplore as pbx
"""
Explanation: PB assignation
We hereby demonstrate how to use the API to assign PB sequences.
End of explanation
"""
pdb_path = os.path.join(pbx.DEMO_DATA_PATH, '1BTA.pdb')
structure_reader = pbx.chains_fro... |
dtamayo/rebound | ipython_examples/AdvWHFast.ipynb | gpl-3.0 | import rebound
import numpy as np
def test_case():
sim = rebound.Simulation()
sim.integrator = 'whfast'
sim.add(m=1.) # add the Sun
sim.add(m=3.e-6,e=0.99, a=1.) # add Earth
sim.move_to_com()
sim.dt = 0.2
return sim
"""
Explanation: Advanced settings for WHFast: Extra speed, accuracy, and ... |
TobiasLe/python-MD | .ipynb_checkpoints/Python_Basics-checkpoint.ipynb | gpl-3.0 | 1 + 1
"""
Explanation: What python is
Python is an easy to learn, yet powerful programming language. In general, programming languages can be divided into low-level and high-level languages.
In a low-level language you have to tell the computer very detailed and specific what to do. These very specific commands can be... |
c22n/ion-channel-ABC | docs/examples/human-atrial/nygren_ito_original.ipynb | gpl-3.0 | import os, tempfile
import logging
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from ionchannelABC import theoretical_population_size
from ionchannelABC import IonChannelDistance, EfficientMultivariateNormalTransition, IonChannelAcceptor
from ionchannelABC.experimen... |
phoebe-project/phoebe2-docs | 2.2/tutorials/LP.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: 'lp' (Line Profile) Datasets and Options
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
... |
PythonBootCampIAG-USP/NASA_PBC2015 | Day_00/03_Functions/Functions.ipynb | mit | 1+2
print 1+2
"""
Explanation: Fun with Functions!
Reference:
Code academy's Functions unit
Our objective is to learn how to write and use functions.
Functions allow us to abstract a task, write code to perform it, and then use it in various situations.
Example:
A calculator takes two numbers and an operator as input... |
cranmer/look-elsewhere-2d | two-experiment-lee.ipynb | mit | %pylab inline --no-import-all
#plt.rc('text', usetex=True)
plt.rcParams['figure.figsize'] = (6.0, 6.0)
#plt.rcParams['savefig.dpi'] = 60
import george
from george.kernels import ExpSquaredKernel
from scipy.stats import chi2, norm
length_scale_of_correaltion=1.
ratio_of_length_scales=4.
kernel1 = ExpSquaredKernel(leng... |
josef-pkt/statsmodels | examples/notebooks/regression_diagnostics.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function
from statsmodels.compat import lzip
import statsmodels
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
import matplotlib.pyplot as plt
# Load data
url = 'http://vincentarelbundock.github.io/Rdatas... |
shankari/folium | examples/Plugins.ipynb | mit | from folium import plugins
m = folium.Map([45, 3], zoom_start=4)
plugins.ScrollZoomToggler().add_to(m)
m.save(os.path.join('results', 'Plugins_0.html'))
m
"""
Explanation: Examples of plugins usage in folium
In this notebook we show a few illustrations of folium's plugin extensions.
This is a development notebook... |
jsharpna/DavisSML | lectures/lecture12/iris_tensorflow.ipynb | mit | # This was modified from Tensorflow tutorial: https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough
# All appropriate copywrites are retained, use of this material is guided by fair use for teaching
# Some modifications made for course STA 208 by James Sharpnack jsharpna@gmail.com
#@title Lice... |
vakilp/darvasBox | analysis/notebooks/darvasBoxExperiments.ipynb | gpl-2.0 | goog?
goog.T
goog.High
goog
goog.columns
goog.plot.im_self
plt.plot(goog.index,goog['High']);
%matplotlib qt
plt.plot(goog.index,goog['High']);
plt.plot(goog.index,goog['Low']);
%matplotlib inline
plt.plot(goog.index,goog['High'],goog.index,goog['Low'])
plt.grid()
goog.High[0]
a=[];
for i in range(1,len(goo... |
sainathadapa/fastai-courses | deeplearning1/nbs-custom-mine/lesson2_05_practice.ipynb | apache-2.0 | x = random((30, 2))
y = np.dot(x, [2., 3.]) + 1
"""
Explanation: Linear models in Keras
End of explanation
"""
keras_lm_model = keras.models.Sequential([
keras.layers.Dense(1, input_shape = (2,))
])
"""
Explanation: https://keras.io/getting-started/sequential-model-guide/
- The sequential model is a linear stac... |
phoebe-project/phoebe2-docs | development/tutorials/constraints_custom.ipynb | gpl-3.0 | import phoebe
from phoebe import u
b = phoebe.default_binary()
"""
Explanation: Advanced: Custom Constraints
Built-in Constraints are convenient as they automatically determine the correct expression and include support for multiple parameterizations via b.flip_constraint. However, for cases where a built-in constra... |
mne-tools/mne-tools.github.io | dev/_downloads/7a4ee69e8136370345a316ee3b2e2187/publication_figure.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Daniel McCloy <dan.mccloy@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD-3-Clause
"""
Explanation: Make figures more publication ready
In this example, we show several use cases to take MNE plots and
customize them for ... |
armgilles/presentation | meetup_kaggle/Best_practices.ipynb | mit | import pandas as pd
import numpy as np
import seaborn as sns
#sns.set_style('whitegrid')
import matplotlib.pyplot as plt
%matplotlib inline
import warnings
warnings.simplefilter('ignore', DeprecationWarning)
"""
Explanation: Inspiré par l'exellent livre de Sebastian Raschka (@rasbt) : Python Machine learning et Noteb... |
rodabt/pyrecharts | .ipynb_checkpoints/pycharts-checkpoint.ipynb | mit | data = dict(
labels=['Bananas','Apples','Oranges','Watermelons','Grapes','Kiwis'],
values=[4000,8000,3000,1600,1000,2500]
)
out = StdCharts.HBar(data)
HTML(out)
"""
Explanation: Horizontal Bar Charts
Best suited for categories comparison
Example 1: default options, "as is"
End of explanation
"""
StdCharts.... |
microsoft/dowhy | docs/source/example_notebooks/tutorial-causalinference-machinelearning-using-dowhy-econml.ipynb | mit | # Required libraries
import dowhy
from dowhy import CausalModel
import dowhy.datasets
# Avoiding unnecessary log messges and warnings
import logging
logging.getLogger("dowhy").setLevel(logging.WARNING)
import warnings
from sklearn.exceptions import DataConversionWarning
warnings.filterwarnings(action='ignore', categor... |
christoffkok/auxi.0 | src/examples/tools/chemistry/stoichiometry.ipynb | lgpl-3.0 | from auxi.tools.chemistry import stoichiometry
molarmass_FeO = stoichiometry.molar_mass("FeO")
molarmass_CO2 = stoichiometry.molar_mass("CO2")
molarmass_FeCr2O4 = stoichiometry.molar_mass("FeCr2O4")
"""
Explanation: Stoichiometry Calculations
Calculating Molar Mass
Determining the molar mass of a substance is done co... |
yedivanseven/LPDE | SmootherTest_2.ipynb | gpl-3.0 | damping = 0.5
ds = np.zeros_like(s)
ds[0] = s[0]
for t in range(1, len(s)):
ds[t] = damping * s[t] + (1 - damping) * ds[t-1]
smooth_ds, = ax.plot(ds)
damping = 0.2
ds = dds = np.zeros_like(s)
ds[0] = dds[0] = s[0]
for t in range(1, len(s)):
ds[t] = damping * s[t] + (1 - damping) * ds[t-1]
dds[t] = dam... |
julienchastang/unidata-python-workshop | notebooks/Jupyter_Notebooks/Plotting and Interactivity.ipynb | mit | # Import matplotlib as use the inline magic so plots show up in the notebook
import matplotlib.pyplot as plt
%matplotlib inline
# Make some "data"
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; heig... |
samirma/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
domluna/deep-rl-gym-tutorials | Image Processing - Atari Environment.ipynb | mit | # reshape is needed so we can use plt.imshow
rgb_to_gray = tf.reshape(tf.image.rgb_to_grayscale(ob), [ob.shape[0], ob.shape[1]])
gray_ob = rgb_to_gray.eval()
gray_ob.shape, gray_ob.dtype
plt.gray()
plt.imshow(gray_ob)
"""
Explanation: Converting to Grayscale
End of explanation
"""
# let's get the current ratio
fro... |
henchc/Rediscovering-Text-as-Data | 11-Word-Embeddings/01-Word-Embeddings.ipynb | mit | metadata_tb = Table.read_table('../09-Topic-Modeling/data/txtlab_Novel150_English.csv')
fiction_path = '../09-Topic-Modeling/data/txtlab_Novel150_English/'
novel_list = []
# Iterate through filenames in metadata table
for filename in metadata_tb['filename']:
# Read in novel text as single string, make lower... |
miykael/nipype_tutorial | notebooks/introduction_python.ipynb | bsd-3-clause | import math
"""
Explanation: <center><img src="../static/images/python.png" width=500></center>
Python
This section is meant as a general introduction to Python and is by far not complete. It is based amongst others on the IPython notebooks from J. R. Johansson, on http://www.stavros.io/tutorials/python/ and on http:/... |
simonward86/MySJcLqwwx | ML_test.ipynb | apache-2.0 | %pylab inline
pylab.rcParams['figure.figsize'] = (10, 6)
from datetime import datetime
import Methods as models
import Predictors as predictors
import stock_tools as st
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib import gridspec
from IPython.display import Image, display
"""... |
BeatHubmann/17F-U-DLND | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import helper
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present... |
GoogleCloudPlatform/mlops-with-vertex-ai | 03-training-formalization.ipynb | apache-2.0 | import os
import json
import numpy as np
import tfx
import tensorflow as tf
import tensorflow_transform as tft
import tensorflow_data_validation as tfdv
import tensorflow_model_analysis as tfma
from tensorflow_transform.tf_metadata import schema_utils
import logging
from src.common import features
from src.model_train... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_03/Begin/.ipynb_checkpoints/Indexing-checkpoint.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
produce_dict = {'veggies': ['potatoes', 'onions', 'peppers', 'carrots'],'fruits': ['apples', 'bananas', 'pineapple', 'berries']}
produce_df = pd.DataFrame(produce_dict)
produce_df
"""
Explanation: Indexing and Selection
| Operation | Syntax | Result ... |
sgkang/DamGeophysics | notebook/Kalman Filters_LIM-Waterlevel.ipynb | mit | %pylab inline
# Import a Kalman filter and other useful libraries
from pykalman import KalmanFilter
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import poly1d
"""
Explanation: Kalman Filters
By Evgenia "Jenny" Nitishinskaya, Dr. Aidan O'Mahony, and Delaney Granizo-Mackenzie. Algori... |
topgate/training-gcp | CPB102/tensorflow/tfsaver.ipynb | apache-2.0 | import os
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
print(tf.__version__)
"""
Explanation: Lab: tf.train.Saver
End of explanation
"""
CHECKPOINT_DIR = "saver_sample"
if not os.path.isdir("saver_sample"):
os.mkdir("saver_sample")
"""
Explanation: まずは ... |
StingraySoftware/notebooks | Simulator/Concepts/Simulate Event Lists With Inverse CDF.ipynb | mit | from astropy.modeling import models
pds_model = \
models.PowerLaw1D(x_0=1, alpha=1, amplitude=1)
nyq = 100.
freq = np.linspace(0, nyq, 1000)[1:]
pds_shape = pds_model(freq)
mean = 10
rms = 0.3
dt = 0.5 / nyq
flux = timmerkoenig(pds_shape, mean, rms)
times = dt * np.arange(flux.size)
plt.plot(times, flux)
"""... |
gorayni/UB | GettingStartedCNN/CaffeOnDockerStable.ipynb | apache-2.0 | import caffe
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
import matplotlib as mpl
import numpy as np
import os
import struct
%matplotlib inline
"""
Explanation: Getting started with Caffe on Docker environment
21 Octuber 2015
Alejandro Cartas
1. Introduction
What is a Deep Learning programmi... |
amitdo/clstm | misc/lstm-delay.ipynb | apache-2.0 | net = clstm.make_net_init("lstm1","ninput=1:nhidden=4:noutput=2")
print net
net.setLearningRate(1e-4,0.9)
print clstm.network_info_as_string(net)
"""
Explanation: Network creation and initialization is very similar to C++:
networks are created using the make_net(name) factory function
the net.set(key,value) method i... |
satishgoda/learning | python/jupyter/tutorial/ipywidgets_interact.ipynb | mit | from __future__ import print_function
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
def f(x):
return x
interact(f, x=10);
interact(f, x=True);
interact(f, x='Hi there!');
@interact(x=True, y=1.0)
def g(x, y):
return (x, y)
def h(p, q):
return (p, q)
interact(h, p=5,... |
pikinder/nn-patterns | examples/step_by_step_imagenet.ipynb | mit | %matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
import nn_patterns
import nn_patterns.utils.fileio
import nn_patterns.utils.tests.networks.imagenet
import lasagne
import theano
import imp
eutils = imp.load_source("utils", "./utils.py")
"""
Explanation: PatternNet and... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topic... |
jdstemmler/tutorials | python_tutorials/pandas_intro/4_working_with_data.ipynb | mit | def cdf_to_dataframe(netcdf_file, exclude_qc=True):
"""Takes in a netCDF object and returns a pandas DataFrame object
"""
# import packages
from netCDF4 import Dataset
import pandas as pd
import datetime
with Dataset(netcdf_file, 'r') as D:
# create an empty dictio... |
poppy-project/community-notebooks | tutorials-education/poppy_ergo_jr__decouverte_du_robot/TP2_mouvement_et_cartes_cor_prof.ipynb | lgpl-3.0 | pos = [-20, -20, 40, -30, 40, 20]
i = 0
for m in poppy.motors:
m.compliant = False
m.goto_position(pos[i], 0.5, wait = True)
i = i + 1
# importation des outils nécessaires
import cv2
%matplotlib inline
import matplotlib.pyplot as plt
from hampy import detect_markers
# affichage de l'image capturée
img =... |
edublancas/slides | supervised-learning.ipynb | mit | # configuramos matplotlib para incluir las gráficas en jupyter e importamos pandas
%matplotlib inline
import pandas as pd
# cargamos los datos en un data frame de pandas
url = 'http://mlr.cs.umass.edu/ml/machine-learning-databases/iris/iris.data'
names = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', '... |
arturops/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
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... |
mrcslws/nupic.research | projects/archive/dynamic_sparse/notebooks/ExperimentAnalysis-GSCSparser-SearchPerc.ipynb | agpl-3.0 | %load_ext autoreload
%autoreload 2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tabulate
import pprint
import click
import numpy as np
import pandas as pd
from ray.tune.commands import *
from nupic.research.frameworks.dynamic... |
Chipe1/aima-python | notebooks/chapter21/Passive Reinforcement Learning.ipynb | mit | import os, sys
sys.path = [os.path.abspath("../../")] + sys.path
from rl4e import *
"""
Explanation: Introduction to Reinforcement Learning
This Jupyter notebook and the others in the same folder act as supporting materials for Chapter 21 Reinforcement Learning of the book Artificial Intelligence: A Modern Approach. T... |
anhaidgroup/py_entitymatching | notebooks/guides/step_wise_em_guides/Generating Features Manually.ipynb | bsd-3-clause | # Import py_entitymatching package
import py_entitymatching as em
import os
import pandas as pd
"""
Explanation: Introduction
This IPython notebook illustrates how to generate features for blocking/matching manually.
First, we need to import py_entitymatching package and other libraries as follows:
End of explanation
... |
tensorflow/docs-l10n | site/ko/addons/tutorials/image_ops.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... |
chicagopython/CodingWorkshops | problems/data_science/chipmunks/data_science_project_night_4_18_19.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
# Read in the data
"""
Explanation: Oh, no! We've had a data crash.
As ChiPy leadership was preparing for PyCon at the end of this month, they found that the dataset on our infamous ChiPy chipmunks has disa... |
amueller/advanced_training | 05.1 Trees and Forests.ipynb | bsd-2-clause | %matplotlib notebook
from preamble import *
"""
Explanation: Trees and Forests
End of explanation
"""
from plots import plot_tree_interactive
plot_tree_interactive()
"""
Explanation: Decision Tree Classification
End of explanation
"""
from plots import plot_forest_interactive
plot_forest_interactive()
from sklea... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/.ipynb_checkpoints/ipython_notebook_tutorial-checkpoint.ipynb | bsd-3-clause | # Hit shift + enter or use the run button to run this cell and see the results
print 'hello world'
# The last line of every code cell will be displayed by default,
# even if you don't print it. Run this cell to see how this works.
2 + 2 # The result of this line will not be displayed
3 + 3 # The result of this line... |
miykael/nipype_tutorial | notebooks/basic_import_workflows.ipynb | bsd-3-clause | from niflow.nipype1.workflows.fmri.fsl.preprocess import create_susan_smooth
smoothwf = create_susan_smooth()
"""
Explanation: Reusable workflows
Nipype doesn't just allow you to create your own workflows. It also already comes with predefined workflows, developed by the community, for the community. For a full list o... |
albahnsen/PracticalMachineLearningClass | notebooks/04-logistic_regression.ipynb | mit | # glass identification dataset
import pandas as pd
import numpy as np
url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/glass/glass.data'
col_names = ['id','ri','na','mg','al','si','k','ca','ba','fe','glass_type']
glass = pd.read_csv(url, names=col_names, index_col='id')
glass.sort_values('al', inplace=Tr... |
sdss/marvin | docs/sphinx/tutorials/notebooks/marvin_queries.ipynb | bsd-3-clause | # we should be using DR15 MaNGA data
from marvin import config
config.release
# import the Query tool
from marvin.tools.query import Query
"""
Explanation: Marvin Queries
This tutorial goes through a few basics of how to perform queries on the MaNGA dataset using the Marvin Query tool. Please see the Marvin Query pag... |
keras-team/keras-io | examples/vision/ipynb/eanet.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_addons as tfa
import matplotlib.pyplot as plt
"""
Explanation: Image classification with EANet (External Attention Transformer)
Author: ZhiYong Chang<br>
Date created: 2021/10/19<br>
Last modi... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/contrasts.ipynb | bsd-3-clause | import numpy as np
import statsmodels.api as sm
"""
Explanation: Contrasts Overview
End of explanation
"""
import pandas as pd
url = 'https://stats.idre.ucla.edu/stat/data/hsb2.csv'
hsb2 = pd.read_table(url, delimiter=",")
hsb2.head(10)
"""
Explanation: This document is based heavily on this excellent resource fro... |
infilect/ml-course1 | week2/vgg_transfer_imagenet_to_flower/transfer_learning_python.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... |
real-numbers/pythonLessons | 02 Introduction to Strings.ipynb | mit | message = "Meet me tonight."
print(message)
"""
Explanation: Lesson 2 - Introduction to Strings
In Python, there are many ways to represent text with strings, in order to handle things like apostrophes, quotation marks, and multiple lines.
You can assign a string value to a variable using double quotes. Execute the ... |
mattmcd/PyBayes | scripts/GPSS_Lab1_gp.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
import GPy
"""
Explanation: Lab session 1: Gaussian Process models with GPy
Gaussian Process Summer School, 14th Semptember 2015
written by Nicolas Durrande, Neil Lawrence and James Hensman
The aim of this lab session is to illustrate the conce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.