repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
dereneaton/ipyrad | testdocs/analysis/cookbook-baba-ipcoal.ipynb | gpl-3.0 | # conda install ipyrad -c conda-forge -c bioconda
# conda install ipcoal -c conda-forge
import ipyrad.analysis as ipa
import ipcoal
import toytree
import toyplot
print(ipa.__version__)
print(ipcoal.__version__)
print(toyplot.__version__)
print(toytree.__version__)
"""
Explanation: <span style="color:gray">ipyrad-ana... |
root-mirror/training | SummerStudentCourse/2019/Exercises/ROOTBooks/FittingExample_Solution.ipynb | gpl-2.0 | import ROOT
"""
Explanation: Fitting Example
End of explanation
"""
%%cpp -d
//Define functions for fitting
// Quadratic background function
double background(double *x, double *par) {
return par[0] + par[1]*x[0] + par[2]*x[0]*x[0];
}
// Lorenzian Peak function
double lorentzianPeak(double *x, double *par) {
r... |
ClaudiaEsp/inet | Analysis/Bidirectional connections as a function of distance.ipynb | gpl-2.0 | %pylab inline
import warnings
from inet import DataLoader, __version__
from inet.utils import II_slice
print('Inet version {}'.format(__version__))
"""
Explanation: <H1>Bidirectional connections as a function of the distance </H1>
<P>
We will analyze the probability of finding bidirectionally connected inhibitory syn... |
mit-eicu/eicu-code | notebooks/admissiondx.ipynb | mit | # Import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import psycopg2
import getpass
import pdvega
# for configuring connection
from configobj import ConfigObj
import os
%matplotlib inline
# Create a database connection using settings from config file
config='../db/config.ini'
#... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/sandbox-1/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'sandbox-1', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-1
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
gully/adrasteia | notebooks/adrasteia_05-05_DR2_rotation_period_comparison_K2.ipynb | mit | # %load /Users/obsidian/Desktop/defaults.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
df_single = pd.read_csv('../data/analysis/k2_gaia_rotmod_single.csv')
df_single.shape
df_single.head()
"""
Explanation: Gaia DR2 variab... |
mne-tools/mne-tools.github.io | 0.24/_downloads/bdc8ac519d8f54d70a73a5e0de598566/50_background_freesurfer_mne.ipynb | bsd-3-clause | import os
import numpy as np
import nibabel
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
import mne
from mne.transforms import apply_trans
from mne.io.constants import FIFF
"""
Explanation: How MNE uses FreeSurfer's outputs
This tutorial explains how MRI coordinate frames are handled... |
cloudant-labs/spark-cloudant | tutorials/wowPython.ipynb | apache-2.0 | !pip install --user --upgrade --no-deps pixiedust
"""
Explanation: 0. Preparation and setup
One Python library that makes GraphX support available to our Jupyter notebooks is not yet bound to the runtime by default.
To get it added to the Spark context you have to use the !pip magic cell command install first to bind... |
seblabbe/MATH2010-Logiciels-mathematiques | NotesDeCours/05-resolution-equation.ipynb | gpl-3.0 | from __future__ import division, print_function # Python 3
from sympy import init_printing
init_printing(use_latex='mathjax',use_unicode=False) # Affichage des résultats
"""
Explanation: $$
\def\CC{\bf C}
\def\QQ{\bf Q}
\def\RR{\bf R}
\def\ZZ{\bf Z}
\def\NN{\bf N}
$$
Résolution d'équations
End of explanation
"""
... |
leoferres/prograUDD | certamenes/Certamen2_A_TI2_2017_1.ipynb | mit | ##escriba la función aqui##
fechaValida('02/06/2017')
"""
Explanation: Certamen 2A, TI 2, 2017-1
Leo Ferres & Rodrigo Trigo
UDD
Pregunta 1
Cree la función fechaValida(fecha) que devuelva True si el argumento es una fecha real, o False si no. Ejemplo, "32 de enero" no es válida (no considere bisiestos). La fecha se da... |
GoogleCloudPlatform/mlops-on-gcp | immersion/kubeflow_pipelines/walkthrough/solutions/lab-01.ipynb | apache-2.0 | import json
import os
import numpy as np
import pandas as pd
import pickle
import uuid
import time
import tempfile
from googleapiclient import discovery
from googleapiclient import errors
from google.cloud import bigquery
from jinja2 import Template
from kfp.components import func_to_container_op
from typing import N... |
boffi/boffi.github.io | dati_2015/01/DynamicTesting.ipynb | mit | from scipy import matrix, sqrt, pi, cos, sin, set_printoptions
p0 = 2224.0 # converted from kN to Newton
rho1 = 183E-6 ; rho2 = 368E-6 # converted from μm to m
w1 = 16.0 ; w2 = 25.0
th1 = 15.0 ; th2 = 55.0
d2r = pi/180.
cos1 = cos(d2r*th1) ; cos2 = cos(d2r*th2)
sin1 = sin(d2r*th1) ; sin2 = sin(d2r*th2)
# the unknowns... |
jimaples/jimaples.github.io | files/Process.ipynb | mit | import sympy
print(sympy.__doc__)
help(sympy)
"""
Explanation: Mathematical Modeling in SymPy
Presented by Jacob Maples (GS Comm)
<br>
Navigate the reveal.js slideshow with the arrow keys.
Go right to advance the slide, go down for details
<br>
WARNING: This presentation contains Python!
Contents:
SymPy Introductio... |
sborgeson/prop39schools | notebooks/VISDOM/CSV Data to MySQL for use in VISDOM.ipynb | mit | csv_dir = "PGE_csv"
"""
Explanation: CSV Data to MySQL for use in VISDOM
This notebook can be used to construct an 'account' table and a 'meter_data' table in mysql, based on the csv files with data extracted from the prop39schools xml files, and an 'intervention' table based on the PEPS_Data.xlsx file available on th... |
csferrie/openreviews | arxiv.1703.10743/arxiv.1703.10743.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from data_utils import load_data_lstm, load_data_ss
from keras.models import Sequential
from keras.metrics import mean_squared_error
from keras.layers import Dense, Dropout, Flatten
from keras.layers.recurrent import GRU
from keras.layers.conv... |
kecnry/autofig | docs/tutorials/size_modes.ipynb | gpl-3.0 | import autofig
import numpy as np
import matplotlib.pyplot as plt
#autofig.inline()
x = np.linspace(0,0.1,11)
y = np.full_like(x, 0)
"""
Explanation: Autofig Size Modes
End of explanation
"""
style = {'marker': 'o', 'linestyle': 'none', 'xpad': 0}
"""
Explanation: s as float vs array
End of explanation
"""
auto... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/tsa_filters.ipynb | bsd-3-clause | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
dta = sm.datasets.macrodata.load_pandas().data
index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3'))
print(index)
dta.index = index
del dta['year']
del dta['quarter']
print(sm.datasets.macrodata.N... |
astroumd/GradMap | notebooks/Lectures2019/Lecture1/GradMap_L1_Instructor.ipynb | gpl-3.0 | ## You can use Python as a calculator:
5*7 #This is a comment and does not affect your code.
#You can have as many as you want.
#Comments help explain your code to others and yourself
#No worries.
5+7
5-7
5/7
"""
Explanation: Introduction to "Doing Science" in Python for REAL Beginners
Python is one of many lang... |
bearing/dosenet-analysis | correlations_with_binning.ipynb | mit | %matplotlib inline
import numpy as np # math
import pandas as pd # manipulating data
import matplotlib.pyplot as plt # graphing
import os # useful for handling filenames etc.
from scipy.stats import pearsonr # calculates the Pearson correlation coef... |
ajdawson/python_for_climate_scientists | course_content/solutions/old_exercises/iris_exercise_6.ipynb | gpl-3.0 | qplt.contour(cube[:, 0])
plt.show()
"""
Explanation: Exercise 6: Use the a1b sample data ('A1B_north_america.nc'), with appropriate slicing, to produce the following:
1. a contour plot of longitude vs time
End of explanation
"""
import cartopy.crs as ccrs
ax = plt.axes(projection=ccrs.LambertConformal())
ax.coastlin... |
tensorflow/docs-l10n | site/ja/tutorials/keras/save_and_load.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... |
israelzuniga/spark_streaming_class | spark_streaming_class/TwitterTrends_Socket/Twitter_Trends_Ejercicio.ipynb | mit | from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import SQLContext
from pyspark.sql.functions import desc
from collections import namedtuple
# Namedtuple: https://pymotw.com/2/collections/namedtuple.html, http://stackoverflow.com/questions/2970608/what-are-named-tuples-i... |
GoogleCloudPlatform/tf-estimator-tutorials | 00_Miscellaneous/tf_train_eval_export/Tutorial - TensorFlow from Estimators to Keras.ipynb | apache-2.0 | import math
import os
import pandas as pd
import numpy as np
from datetime import datetime
import tensorflow as tf
from tensorflow import data
print("TensorFlow : {}".format(tf.__version__))
SEED = 19831060
"""
Explanation: TensorFlow: From Estimators to Keras
Building a custom TensorFlow estimator (as a reference... |
robertoalotufo/ia898 | src/rectangle.ipynb | mit | import numpy as np
def rectangle(s, r, c):
rows, cols = s[0], s[1]
rrows, rcols = r[0], r[1]
rr0, cc0 = c[0], c[1]
rr, cc = np.meshgrid(np.arange(rows), np.arange(cols), indexing='ij')
min_row, max_row = rr0-rrows//2, rr0+rrows//2
min_col, max_col = cc0-rcols//2, cc0+rcols//2
g1 = ... |
fsix/mnist | notebooks/Perturbing.ipynb | apache-2.0 | plt.imshow(X_train[0].reshape(28,28)) # This is what the image looks like
examples = [54229,17473, 6642, 29232, 38150, 2186, 58443, 15689, 14413, 14662]
from mpl_toolkits.axes_grid1 import AxesGrid
def draw_examples_with_perturbation(examples, f):
"""Draw examples with provided perturbation f
:param exa... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session02/Day1/Unsupervised machine learning.ipynb | mit | import numpy as np
import matplot.pyplot as plt
%matplotlib inline
"""
Explanation: Unsupervised machine learning problems
By Matthew J. Graham (California Institute of Technology)
Acknowledgements to A. A. Miller and G. Cabrera.
(c) 2017, California Institute of Technology
<b><i>Version 0.1</i></b>
Given a data set o... |
google-research/text-to-text-transfer-transformer | notebooks/t5-trivia.ipynb | apache-2.0 | # Copyright 2019 The T5 Authors. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
darkomen/TFG | ipython_notebooks/06_regulador_experto/ensayo5.ipynb | cc0-1.0 | #Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
#Abrimos el fichero csv con los datos... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 3 Unsupervised learning/Lectures notebooks/4 BigARTM library/BigARTM.ipynb | mit | from matplotlib import pyplot as plt
%matplotlib inline
import artm
"""
Explanation: Пример использования библиотеки BigARTM для тематического моделирования
Для Bigartm v0.8.0
Редактировал Максим Чурилин
Импортируем BigARTM:
End of explanation
"""
batch_vectorizer = artm.BatchVectorizer(data_path="school.txt", data... |
summanlp/gensim | docs/notebooks/annoytutorial.ipynb | lgpl-2.1 | # pip install watermark
%reload_ext watermark
%watermark -v -m -p gensim,numpy,scipy,psutil,matplotlib
"""
Explanation: Similarity Queries using Annoy Tutorial
This tutorial is about using the (Annoy Approximate Nearest Neighbors Oh Yeah) library for similarity queries with a Word2Vec model built with gensim.
Why use ... |
SheffieldML/notebook | compbio/transcriptionFactorActivities.ipynb | bsd-3-clause | import numpy as np
import scipy as sp
import pylab as pb
import GPy
import scipy.io
import matplotlib.pyplot as plt
from IPython.display import display
%matplotlib inline
"""
Explanation: Inferring Transcription Factor Activities by Combining Binding Information with Gene Expression Profiles
A Model and Analysis in Pr... |
frazer-lab/cardips-ipsc-eqtl | notebooks/Input Data.ipynb | mit | import glob
import os
import subprocess
import cdpybio as cpb
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import ciepy
import cardipspy as cpy
%matplotlib inline
outdir = os.path.join(ciepy.root, 'output',
'input_data')
cpy.makedir(outdir)
priv... |
nicolasfauchereau/metocean | notebooks/spharm.ipynb | unlicense | from windspharm.standard import VectorWind
from windspharm.tools import prep_data, recover_data, order_latdim
"""
Explanation: Streamfunction and velocity potential from zonal and meridional wind component
windspharm is a Python library developed by
Andrew Dawson which provides an pythonic interface to the pyspharm m... |
xpmanoj/content | HW3_solutions.ipynb | mit | %matplotlib inline
import json
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 30)
# set some nicer defaults for matplotlib
from matplotlib import rcParams
#these colors come from colorbrewer2.org. Each ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/launching_into_ml/solutions/automl_text_classification.ipynb | apache-2.0 | # Setup your dependencies
import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
# Google Cloud Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = ... |
AssembleSoftware/IoTPy | examples/ExamplesOfCombiningAndMergingStreams.ipynb | bsd-3-clause | import sys
sys.path.append("../")
from IoTPy.core.stream import Stream, run
from IoTPy.agent_types.op import map_element
from IoTPy.helper_functions.recent_values import recent_values
"""
Explanation: Combining and Merging Streams
End of explanation
"""
w = Stream('w')
x = Stream('x')
y = Stream('y')
z = (x+y)*w
# ... |
ppham27/MLaPP-solutions | chap12/11.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(2016)
N = 1000
Z = stats.norm.rvs(loc=0, scale=1, size=2*N)
Z = Z.reshape((-1,2))
W = np.array([[1,0],[1,0.001],[0,10]])
X = np.dot(Z, W.T)
X[:10,:]
"""
Explanation: Probabilistic Principal Component Analysi... |
OSGeoLabBp/tutorials | hungarian/ransac/ransac_vonal.ipynb | cc0-1.0 | # Python packages used
import numpy as np # for array operations
from matplotlib import pyplot as plt # for graphic output
from math import sqrt
# parameters
tolerance = 2.5 # max distance from the plane to accept point
rep = 1000 # number of repetition
"""
Explanation... |
honjy/foundations-homework | 06/darksky-foundations-homework.ipynb | mit | import requests
response = requests.get('https://api.forecast.io/forecast/2720ff846cb70aeec085c402d31c3ea2/40.7128,-74.0059')
data = response.json()
type(data)
data.keys()
#Check the timezone
print(data['timezone'])
#Yay!
#I chose New York so I'll know when to bring my umbrella to class
"""
Explanation: 1) Make a r... |
dm-wyncode/zipped-code | content/posts/coding/binary_search_functional_style.ipynb | mit | ( # colors for logging display
BLUE,
GREEN,
YELLOW,
RED,
) = (
'blue',
'green',
'yellow',
'red',
)
# demonstration of reduce
# Thinking I could use with binary search
from functools import reduce
reduce(lambda x, y: (x, y), range(1, 10), 0)
reduce(lambda x, y: (x, y), reversed(range(1... |
elliottd/satyrid | alpha_visualization.ipynb | bsd-3-clause | import theano
from theano import tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import numpy
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import skimage
import skimage.transform
import skimage.io
from PIL import Image
import capgen
import generate_c... |
CUBoulder-ASTR2600/lectures | lecture_20_classes2.ipynb | isc | import numpy as np
"""
Explanation: Classes & Object Oriented Programming
Object-oriented programming or programming using classes is an abstraction that tries to apply the same abstraction rules used for categorizing nature to programming techniques.
This has the advantage that the process for creating a computer pro... |
uber/pyro | tutorial/source/vae.ipynb | apache-2.0 | import os
import numpy as np
import torch
from pyro.contrib.examples.util import MNIST
import torch.nn as nn
import torchvision.transforms as transforms
import pyro
import pyro.distributions as dist
import pyro.contrib.examples.util # patches torchvision
from pyro.infer import SVI, Trace_ELBO
from pyro.optim import ... |
pligor/predicting-future-product-prices | 04_time_series_prediction/38_price_hist_train_valid_test_data_gen_clustered.ipynb | agpl-3.0 | input_len = 60
target_len = 30
with_EOS = False
kmeans_group = 10
#reading from
data_path = '../../../../Dropbox/data'
mobattrs_ph_path = data_path + '/mobattrs_price_history'
mobattrs_ph_norm_path = mobattrs_ph_path + '/mobattrs_ph_norm.npy'
sku_ids_groups_path = data_path + '/sku_ids_groups'
npz_sku_ids_group_kmeans... |
subutai/htmresearch | projects/sdr_paper/sdr_math_neuron_paper.ipynb | agpl-3.0 | oxp = Symbol("Omega_x'")
b = Symbol("b")
n = Symbol("n")
theta = Symbol("theta")
s = Symbol("s")
a = Symbol("a")
subsampledOmega = (binomial(s, b) * binomial(n - s, a - b)) / binomial(n, a)
subsampledFpF = Sum(subsampledOmega, (b, theta, s))
subsampledOmegaSlow = (binomial(s, b) * binomial(n - s, a - b))
subsampledFp... |
mwcraig/schrod-binder | index.ipynb | bsd-3-clause | from __future__ import division, print_function
import numpy as np
from ipywidgets import interact
import matplotlib.pyplot as plt
%matplotlib nbagg
"""
Explanation: Double clik to put your name(s) here
Instructions
Run the code in each cell by holding down the shift key and pushing Return (Enter)
DOWNLOAD A COPY ... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/variance_components.ipynb | bsd-3-clause | import numpy as np
import statsmodels.api as sm
from statsmodels.regression.mixed_linear_model import VCSpec
import pandas as pd
"""
Explanation: Variance Component Analysis
This notebook illustrates variance components analysis for two-level
nested and crossed designs.
End of explanation
"""
np.random.seed(3123)
"... |
tpin3694/tpin3694.github.io | machine-learning/parse_html.ipynb | mit | # Load library
from bs4 import BeautifulSoup
"""
Explanation: Title: Parse HTML
Slug: parse_html
Summary: How to parse HTML for machine learning in Python.
Date: 2016-09-07 12:00
Category: Machine Learning
Tags: Preprocessing Text
Authors: Chris Albon
Preliminaries
End of explanation
"""
# Create some HTML code
htm... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/regression_diagnostics.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lzip
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 = 'https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Guerry.csv'
dat... |
QuantCrimAtLeeds/PredictCode | examples/Retrospective hotspotting.ipynb | artistic-2.0 | tau = 2.5
x = np.linspace(-3, 3, 100)
y = (1 - (abs(x) / tau) ** 2) ** 2
y = y * (abs(x) < tau)
_ = plt.plot(x,y)
"""
Explanation: Sources
Bowers, Johnson, Pease, "Prospective hot-spotting: The future of crime mapping?", Brit. J. Criminol. (2004) 44 641--658. doi:10.1093/bjc/azh036
Bailey, Gatrell, "Interactive s... |
tjwei/HackNTU_Data_2017 | Week02/05-Decision Trees.ipynb | mit | from PIL import Image
import numpy as np
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
from sklearn import datasets, tree
matplotlib.style.use('bmh')
matplotlib.rcParams['figure.figsize']=(10,7)
"""
Explanation: Decision Trees
End of explanation
"""
# windows only hack for graphviz path
impo... |
tensorflow/docs-l10n | site/en-snapshot/datasets/determinism.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... |
KECB/learn | Learn Jupyter.ipynb | mit | !ls
# %load cookie.py
"""This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from thinkbayes import Pmf
pmf = Pmf()
pmf.Set('Bowl 1', 0.5)
pmf.Set('Bowl 2', 0.5)
pmf.Mult(... |
hparik11/Deep-Learning-Nanodegree-Foundation-Repository | sentiment-rnn/Sentiment_RNN_Solution.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
conversationai/conversationai-crowdsource | constructiveness_toxicity_crowdsource/jupyter-notebooks/annotation_aggregation/combine_annotated_batches.ipynb | apache-2.0 | dfs = []
for batch in batches:
filename = aggregated_data_path + 'batch' + str(batch) + '_constructiveness_and_toxicity_combined.csv'
dfs.append(pd.read_csv(filename))
combined_annotations_df = pd.concat(dfs)
# Sort the merged dataframe on constructiveness and toxicity
combined_annotations_df.shape
# Relevan... |
andre-martini/advanced-comp-2017 | 04-model-performance/exercise.ipynb | gpl-3.0 | %config InlineBackend.figure_format='retina'
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (8, 8)
plt.rcParams["font.size"] = 14
from sklearn.utils import check_random_state
"""
Explanation: Exercise 4
Work on this before the next lecture on 1 May. We will talk... |
google/prog-edu-assistant | exercises/oop-en-master.ipynb | apache-2.0 | # MASTER ONLY
from prog_edu_assistant_tools.magics import report, autotest
%load_ext prog_edu_assistant_tools.magics
"""
Explanation: Object-Oriented Programming
Learning outcomes:
Understand the concept of "encapsulation" and "abstraction"
Understand why we use classes in object-oriented programming
Understand the P... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-cm2-sr5/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-sr5', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-CM2-SR5
Topic: Ocean
Sub-Topics: Timestepping Framework, Adv... |
scikit-optimize/scikit-optimize.github.io | 0.8/notebooks/auto_examples/bayesian-optimization.ipynb | bsd-3-clause | print(__doc__)
import numpy as np
np.random.seed(237)
import matplotlib.pyplot as plt
from skopt.plots import plot_gaussian_process
"""
Explanation: Bayesian optimization with skopt
Gilles Louppe, Manoj Kumar July 2016.
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
Problem statement
We are interested... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/quasibinomial.ipynb | bsd-3-clause | import statsmodels.api as sm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO
"""
Explanation: Quasi-binomial regression
This notebook demonstrates using custom variance functions and non-binary data
with the quasi-binomial GLM family to perform a regression analysis using... |
MachineLearningStudyGroup/Smart_Review_Summarization | ipynbs/Dynamic_Aspect_Extraction_Part_B.ipynb | mit | import json
import nltk
import string
from srs.utilities import Product, AspectPattern
"""
Explanation: Dynamic Aspect Extraction for camera Reviews Part B
Han, Kehang (hkh12@mit.edu)
As a follow-up demonstration, this ipynb is focused on extracting aspects from datasets called AmazonReviews, which has much more revi... |
SJSlavin/phys202-2015-work | assignments/assignment04/MatplotlibExercises.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Visualization 1: Matplotlib Basics Exercises
End of explanation
"""
plt.scatter(np.random.randn(100), np.random.randn(100), marker="x", color="m", linestyle="-", alpha=0.6)
plt.xlabel("x label")
plt.ylabel("y label")
"""
Explanat... |
KEHANG/AutoFragmentModeling | ipython/1. frag_mech_generation/generate_fragment_mechanism_2mobenzene.ipynb | mit | import os
from tqdm import tqdm
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
from rmgpy.kinetics import KineticsData
from rmgpy.rmg.model import getFamilyLibraryObject
from rmgpy.data.kinetics.family import TemplateReaction
from rmgpy.data.kinetics.depository import DepositoryReaction
from rmgpy.d... |
nicolas998/wmf | Examples/Ejemplo_Hidrologia_Maximos.ipynb | gpl-3.0 | %matplotlib inline
from wmf import wmf
import numpy as np
import pylab as pl
import datetime as dt
import os
import pandas as pd
import pickle
import plot_y_tablas as pyt
from scipy import stats as stat
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('d... |
Vvkmnn/books | AutomateTheBoringStuffWithPython/lesson37.ipynb | gpl-3.0 | def simpleAdd():
print('Enter the first nuber to add:')
first = input()
print('Enter the second number to add:')
second = input()
print('Enter the third number to add:')
third = input()
print('The sum is ' + first + second + third +'.')
simpleAdd()
"""
Explanation: Lesson 37:
Using the Deb... |
paolorivas/homeworkfoundations | 06/Homework_06_Paolo_Rivas_Legua.ipynb | mit | import requests
response = requests.get("https://api.forecast.io/forecast/5afc9217d7eea82824254c951b1b57f4/-12.0561,-77.0268")
weather_Lima = response.json()
weather_Lima.keys()
"""
Explanation: You'll be using the Dark Sky Forecast API from Forecast.io, available at https://developer.forecast.io. It's a pretty simp... |
BorisPolonsky/LearningTensorFlow | CNN101/CNN101_Test.ipynb | mit | import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
"""
Explanation: Implement CNN network with TensorFlow
Brief
Load a CNN implemented in TensorFlow trained before and test it's performance on MNIST dataset.
Notice
Saving checkpoints of this model demands sufficient disk memory.
Import necess... |
hagne/atm-py | examples/aerosols_pysics_hygroscopicity.ipynb | mit | fname = '../atmPy/unit_testing/test_data/sgptdmahygC1.b1.20120601.004227.cdf'
out = arm.read_netCDF(fname, data_quality= 'patchy', leave_cdf_open= False)
"""
Explanation: HygroscopicGrowthFactorDistributions
We need to generate a data set that can be used to initiate a HygroscopicGrowthFactorDistributions instance. Hi... |
LxMLS/lxmls-toolkit | labs/notebooks/non_linear_classifiers/exercise_3.ipynb | mit | %load_ext autoreload
%autoreload 2
import lxmls.readers.sentiment_reader as srs
from lxmls.deep_learning.utils import AmazonData
corpus = srs.SentimentCorpus("books")
data = AmazonData(corpus=corpus)
"""
Explanation: Amazon Sentiment Data
End of explanation
"""
from lxmls.deep_learning.utils import Model, glorot_we... |
pysal/pysal | notebooks/model/spint/ODW_example.ipynb | bsd-3-clause | origins = ps.weights.lat2W(4,4)
dests = ps.weights.lat2W(4,4)
origins.n
dests.n
ODw = ODW(origins, dests)
print ODw.n, 16*16
ODw.full()[0].shape
"""
Explanation: With an equal number of origins and destinations (n=16)
End of explanation
"""
origins = ps.weights.lat2W(3,3)
dests = ps.weights.lat2W(5,5)
origins... |
atremblay/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... |
aguinane/energyusage | notebooks/EnergyUsage.ipynb | agpl-3.0 | # Will allow us to embed images in the notebook
%matplotlib inline
"""
Explanation: Set Up
End of explanation
"""
# Import NEM12 data
from nemreader import output_as_data_frames
file_path = '../examples/example.csv'
dfs = output_as_data_frames(file_path)
nmi, df = dfs[0] # Get data for first NMI in file
nmi = '*Reda... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/sandbox-2/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-2', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Tim... |
philippgrafendorfe/stackedautoencoders | .ipynb_checkpoints/MNIST_Autoencoder-checkpoint.ipynb | mit | from keras.layers import Input, Dense, Dropout
from keras.models import Model
from keras.datasets import mnist
from keras.models import Sequential, load_model
from keras.optimizers import RMSprop
from keras.callbacks import TensorBoard
from __future__ import print_function
from keras.utils import plot_model
from IPytho... |
zomansud/coursera | ml-clustering-and-retrieval/week-6/6_hierarchical_clustering_blank.ipynb | mit | import graphlab
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
import time
from scipy.sparse import csr_matrix
from sklearn.cluster import KMeans
from sklearn.metrics import pairwise_distances
%matplotlib inline
'''Check GraphLab Create version'''
from distutils.version import StrictVersion
as... |
sdonapar/data_analysis_python | numpy_overview.ipynb | mit | # import NumPy library
# This library is bundled along with anaconda distribution
# np alias is the standard convention
import numpy as np
"""
Explanation: NumPy
Why NumPy ?
NumPy is an acronym for "Numeric Python" or "Numerical Python"
NumPy is the fundamental package for scientific computing with Python. It contain... |
tpin3694/tpin3694.github.io | machine-learning/imputing_missing_class_labels_using_k-nearest_neighbors.ipynb | mit | # Load libraries
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
"""
Explanation: Title: Imputing Missing Class Labels Using k-Nearest Neighbors
Slug: imputing_missing_class_labels_using_k-nearest_neighbors
Summary: How to impute missing class labels using k-nearest neighbors for machine learning... |
AllenDowney/ThinkStats2 | homeworks/homework03.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='white')
from utils import decorate
from thinkstats2 import Pmf, Cdf
import thinkstats2
import thinkplot
"""
Explanation: Homework 3
Visualizing relationships between variables
Allen Downey... |
cfcdavidchan/Deep-Learning-Foundation-Nanodegree | first-neural-network/Your_first_neural_network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
laco/presentations | 20210325-Ubitalk-Python/Modern Python Programming.ipynb | mit | from datetime import datetime
def welcome_time():
now = datetime.now()
if now.hour > 6 and now.hour < 12:
return "Morning"
elif now.hour >=12 and now.hour < 18:
return "Afternoon"
elif now.hour >= 18 and now.hour < 24:
return "Evening"
else:
raise NotImplemented("You... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/matplotlib/04.08-Multiple-Subplots.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn-white')
import numpy as np
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; the... |
nadvamir/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... |
KronosKoderS/Linear-Systems-Theory | 01a - Example of Phase-Plane Analysis.ipynb | mit | f_1 = x_2
f_2 = -3 * x_1 - x_1 ** 2 - x_2
"""
Explanation: Introduction
Consider the following 2nd order system (Mass-Damper-Spring):
$\ddot{x} + \dot{x} = 3x + x^2 = 0 \Longleftrightarrow \ddot{x} + c \dot{x} + f(x) = 0$
$c$ is the dampening force and $f(x)$ is the non-linear spring.
The system can be placed into t... |
jhconning/FarmSizePower | examples/mir_economy.ipynb | gpl-3.0 | %reload_ext watermark
%watermark -u -n -t
"""
Explanation: Modeling the Russian Mir
Land and labor allocations on a commune:a general equilibrium framework
Jonathan Conning (Hunter College and The Graduate Center, CUNY) and Aleksandr Michuda (University of California, Davis)
End of explanation
"""
import sys
sys.pa... |
desihub/desisim | doc/nb/sne-failure.ipynb | bsd-3-clause | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from desisim.templates import BGS
mpl.rc('font', size=14)
"""
Explanation: Make Template + Supernova
Test insertion of SNe in desisim.templates.GALAXY.
For now it will fail because metadata needed by the GALAXY is missing.
End of explanation... |
tensorflow/tpu | tools/colab/autoencoder_embeddings.ipynb | apache-2.0 | # Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
EmuKit/emukit | notebooks/Emukit-tutorial-bayesian-optimization-external-objective-evaluation.ipynb | apache-2.0 | ### General imports
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
%pylab inline
### --- Figure config
colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS)
LEGEND_SIZE = 15
TITLE_SIZE = 25
AXIS_SIZE = 15
"""
Explanation: External objective function ... |
tritemio/multispot_paper | out_notebooks/usALEX-5samples-PR-raw-out-DexDem-22d.ipynb | mit | ph_sel_name = "DexDem"
data_id = "22d"
# ph_sel_name = "all-ph"
# data_id = "7d"
"""
Explanation: Executed: Mon Mar 27 11:35:20 2017
Duration: 10 seconds.
usALEX-5samples - Template
This notebook is executed through 8-spots paper analysis.
For a direct execution, uncomment the cell below.
End of explanation
"""
f... |
PhilipReschke/TensorFlow-Code-Examples | Multilayer Perceptron Example.ipynb | gpl-3.0 | import tensorflow as tf
"""
Explanation: TensorFlow - Multilayer Perceptron Example
About this notebook
Author: Philip Reschke (http://www.philipreschke.com)
Project: https://github.com/PhilipReschke/TensorFlow-Code-Examples
I will build a MLP network using two hidden layers to which I apply the ReLu activation functi... |
martinjrobins/hobo | examples/stats/custom-prior.ipynb | bsd-3-clause | import pints
import pints.toy
import pints.plot
import numpy as np
import matplotlib.pyplot as plt
# Load a forward model
model = pints.toy.LogisticModel()
# Create some toy data
real_parameters = np.array([1, 500])
times = np.linspace(0, 1000, 1000)
org_values = model.simulate(real_parameters, times)
# Add noise
no... |
materialsproject/MPSentries | workflows/mp_production.ipynb | mit | user_remarks = [
"new ICSD batch", "Pauling file", "Heusler ABC2 phases",
"proton conducting materials for fuel cells", "solid solution metal", "solid solution oxide", "intermetallic",
"CNGMD Nitrides", "MAGICS calculation of band structures of 2D TMDC stacked heterostructures"
]
"""
Explanation: general: ... |
hanezu/cs231n-assignment | assignment3/ImageGradients.ipynb | mit | # As usual, a bit of setup
import time, os, json
import numpy as np
import skimage.io
import matplotlib.pyplot as plt
from cs231n.classifiers.pretrained_cnn import PretrainedCNN
from cs231n.data_utils import load_tiny_imagenet
from cs231n.image_utils import blur_image, deprocess_image
%matplotlib inline
plt.rcParams... |
arcyfelix/Courses | 17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/06-Data-Sources/01 - Pandas-Datareader.ipynb | apache-2.0 | import pandas_datareader.data as web
import datetime
start = datetime.datetime(2015, 1, 1)
end = datetime.datetime(2017, 1, 1)
facebook = web.DataReader("FB", 'google', start, end)
facebook.head()
"""
Explanation: Pandas Datareader
NOTE: Not every geographical location works well with pandas datareader, your fir... |
planetlabs/notebooks | jupyter-notebooks/in-class-exercises/convert-radiance-to-reflectance/convert-radiance-to-reflectance.ipynb | apache-2.0 | # To use Planet's CLI from this Notebook, begin your line as follows:
!planet data
# < add your own code here >
"""
Explanation: Converting PlanetScope Imagery from Radiance to Reflectance
How to use this exercise
Adjacent to this notebook, you'll find a notebook titled convert-radiance-to-reflectance-key.ipynb: that... |
PMEAL/OpenPNM-Examples | PaperRecreations/Wu2010_part_c.ipynb | mit | import openpnm as op
import matplotlib.pyplot as plt
import scipy as sp
import numpy as np
import openpnm.models.geometry as gm
import openpnm.topotools as tt
%matplotlib inline
"""
Explanation: Example: Regenerating Data from
R. Wu et al. / Elec Acta 54 25 (2010) 7394–7403
Import the modules
End of explanation
"""
... |
alexweav/Learny-McLearnface | Example2.ipynb | mit | import numpy as np
import LearnyMcLearnface as lml
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Example 2 - MNIST with a Shallow Feedforward Network
We will use a shallow feedforward neural network to learn the famous MNIST dataset.
First, as usual, we import Numpy to hold the data, and we impor... |
masve/saav-deliveries | project/Weather Data-Copy1.ipynb | mit | import pandas as pd
import numpy as np
import datetime
from datetime import date
from dateutil.rrule import rrule, DAILY
from __future__ import division
import geoplotlib as glp
from geoplotlib.utils import BoundingBox, DataAccessObject
pd.set_option('display.max_columns', None)
%matplotlib inline
"""
Explanation: ... |
jswoboda/SimISR | ExampleNotebooks/Pulsatingaurora.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import scipy as sp
import seaborn as sns
#SimISR packages
from SimISR import Path
from SimISR.utilFunctions import readconfigfile,makeconfigfile
from SimISR.runsim import main as runsim
from SimISR.IonoContainer import IonoContainer,MakeTestIonoclass
from SimISR.analy... |
JAmarel/Phys202 | Matplotlib/Matplotlib.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Visualization with Matplotlib
Learning Objectives: Learn how to make basic plots using Matplotlib's pylab API and how to use the Matplotlib documentation.
This notebook focuses only on the Matplotlib API, rather that the broader que... |
bdetweiler/isqa-8080-homework | Homework2/ISQA 8080 Homework 2 - MongoDB.ipynb | bsd-2-clause | import pymongo
from pymongo import MongoClient
import datetime
import re
from pymongo import InsertOne, DeleteOne, ReplaceOne
import datetime
client = MongoClient()
client = MongoClient('mongodb://localhost:27017/')
db = client.homework2
users = db.users
movies = db.movies
"""
Explanation: ISQA 8080 Homework 2.2
Bri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.