repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
mklokocka/seminator | notebooks/Complement.ipynb | gpl-3.0 | f = spot.formula('G(a | (b U (Gc | Gd)))')
aut = f.translate(); aut
neg1 = seminator(aut, complement="spot"); neg1
neg2 = seminator(aut, complement="pldi"); neg2
nf = spot.formula_Not(f)
assert neg1.equivalent_to(nf)
assert neg2.equivalent_to(nf)
"""
Explanation: The seminator() function can also perform complement... |
mortada/notebooks | blog/Fibonacci_numbers_in_python.ipynb | apache-2.0 | import math
from __future__ import print_function
def fib_recursive(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib_recursive(n-1) + fib_recursive(n-2)
print([fib_recursive(i) for i in range(20)])
"""
Explanation: Fibonacci numbers
The Fibonacci numbers are defined ... |
ITAM-DS/analisis-numerico-computo-cientifico | libro_optimizacion/temas/5.optimizacion_de_codigo/5.4/Computo_en_paralelo_usando_CPUS_en_SMC.ipynb | apache-2.0 | %%bash
lscpu
%%bash
sudo lshw -C memory
%%bash
uname -ar #r for kernel, a for all
"""
Explanation: (COMPPARALELOCPUSSMC)=
5.4 Cómputo en paralelo usando CPUs en un sistema de memoria compartida (SMC)
```{admonition} Notas para contenedor de docker:
Comando de docker para ejecución de la nota de forma local:
nota: ca... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_movement_compensation.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from os import path as op
import mne
from mne.preprocessing import maxwell_filter
print(__doc__)
data_path = op.join(mne.datasets.misc.data_path(verbose=True), 'movement')
pos = mne.chpi.read_head_pos(op.join(data_path, 'simulated_quats.p... |
juancarlosqr/datascience | python/udacity_intro_data_analysis/lesson_01/L1_Starter_Code.ipynb | mit | import unicodecsv
## Longer version of code (replaced with shorter, equivalent version below)
# enrollments = []
# f = open('enrollments.csv', 'rb')
# reader = unicodecsv.DictReader(f)
# for row in reader:
# enrollments.append(row)
# f.close()
with open('enrollments.csv', 'rb') as f:
reader = unicodecsv.Dict... |
pastas/pasta | examples/notebooks/01_basic_model.ipynb | mit | import matplotlib.pyplot as plt
import pandas as pd
import pastas as ps
ps.show_versions()
"""
Explanation: A Basic Model
In this example application it is shown how a simple time series model can be developed to simulate groundwater levels. The recharge (calculated as precipitation minus evaporation) is used as the... |
maxvogel/NetworKit-mirror2 | Doc/Notebooks/NetworKit_Tutorial_Part_2.ipynb | mit | from networkit import *
%matplotlib inline
cd ~/workspace/NetworKit
G = readGraph("input/PGPgiantcompo.graph", Format.METIS)
"""
Explanation: Tutorial "Algorithmic Methods for Network Analysis with NetworKit" (Part 2)
End of explanation
"""
# 2-2) and 2-3) Decide whether graph is Eulerian or not
"""
Explanatio... |
hunterherrin/phys202-2015-work | assignments/assignment03/NumpyEx03.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
from math import exp
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 3
Imports
End of explanation
"""
def brownian(maxt, n):
"""Return one realization of a Brownian (Wiener... |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/talks/StartupML/Jan-20-2017/SparkMLTensorflowAI-HybridCloud-ContinuousDeployment.ipynb | apache-2.0 | import numpy as np
import os
import tensorflow as tf
from tensorflow.contrib.session_bundle import exporter
import time
# make things wide
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
from IPython.display import clear_output, Image, display, HTML... |
kinshuk4/MoocX | misc/machinelearningbootcamp/day2/neural_nets.ipynb | mit | # Load the libraries
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
"""
Explanation: Neural Networks
The Perceptron
To get an intuitive idea about Neural Networks, let us code an elementary perceptron. In this example we will illustrate some of the concepts we have seen, build a small percep... |
Santana9937/Coursera_ML_Andrew_Ng | machine-learning-ex1/linear_regression.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Linear Regression
This is the first assignment from Andrew Ng's Machine Learning class. In this notebook we perform linear regression with one variable and with multiple variables.
Importing Libraries
End of explanation
"""
exerc... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/formulas.ipynb | bsd-3-clause | import numpy as np # noqa:F401 needed in namespace for patsy
import statsmodels.api as sm
"""
Explanation: Formulas: Fitting models using R-style formulas
Since version 0.5.0, statsmodels allows users to fit statistical models using R-style formulas. Internally, statsmodels uses the patsy package to convert formulas... |
rflamary/POT | docs/source/auto_examples/plot_optim_OTreg.ipynb | mit | import numpy as np
import matplotlib.pylab as pl
import ot
import ot.plot
"""
Explanation: Regularized OT with generic solver
Illustrates the use of the generic solver for regularized OT with
user-designed regularization term. It uses Conditional gradient as in [6] and
generalized Conditional Gradient as proposed in [... |
naliboff/dealii | contrib/python-bindings/notebooks/tutorial-1.ipynb | lgpl-2.1 | %matplotlib inline
import PyDealII.Debug as dealii
"""
Explanation: Tutorial-1
The first thing to do to use the python wrappers is to import the package. PyDealII is only a shell and importing it will only allow you to call
python
help(PyDealII)
PyDealII is composed of two libraries:
- PyDealII.Debug which uses th... |
claudiuskerth/PhDthesis | Data_analysis/SNP-indel-calling/dadi/04_1D_expGrowth_bottleneck.ipynb | mit | from ipyparallel import Client
cl = Client()
cl.ids
%%px --local
# run whole cell on all engines a well as in the local IPython session
import numpy # dadi calls numpy (not np)
import sys
sys.path.insert(0, '/home/claudius/Downloads/dadi')
import dadi
"""
Explanation: Table of Contents
<p><div class="lev1 toc-... |
hvillanua/deep-learning | autoencoder/Simple_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
"""
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to compres... |
tolga-b/debiaswe | tutorial_example1.ipynb | mit | # Setup:
# Clone the code repository from https://github.com/tolga-b/debiaswe.git
# mkdir debiaswe_tutorial
# cd debiaswe_tutorial
# git clone https://github.com/tolga-b/debiaswe.git
# To reduce the time of downloading data, we provide as subset of GoogleNews-vectors in the following location:
# https://drive.google.c... |
claudiuskerth/PhDthesis | Data_analysis/SNP-indel-calling/dadi/03_1D_bottlegrowth.ipynb | mit | from ipyparallel import Client
cl = Client()
cl.ids
# clear the namespace in engines
cl.clear()
%px %who
%%px --local
# run whole cell on all engines a well as in the local IPython session
import numpy as np
import sys
sys.path.insert(0, '/home/claudius/Downloads/dadi')
import dadi
%%px --local
# import 1D ... |
ceos-seo/data_cube_notebooks | notebooks/Data_Challenge/S2_ESA_Mosaic.ipynb | apache-2.0 | # Supress Warnings
import warnings
warnings.filterwarnings('ignore')
# Import common GIS tools
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import rioxarray as rio
import rasterio.features
# Import Planetary Computer tools
import stackstac
import pystac_client
import planetary_computer
impo... |
NumCosmo/NumCosmo | notebooks/tutorials/DistTutorial.ipynb | gpl-3.0 | try:
import gi
gi.require_version('NumCosmo', '1.0')
gi.require_version('NumCosmoMath', '1.0')
except:
pass
from gi.repository import GObject
from gi.repository import NumCosmo as Nc
from gi.repository import NumCosmoMath as Ncm
import sys
import math
import numpy as np
import matplotlib.pyplot as plt
%matplo... |
azubiolo/itstep | it_step/intro_ml/lab_5/model_selection_validation.ipynb | mit | %matplotlib inline
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
"""
Explanation: Introduction to Machine Learning with scikit-learn
Lab 5: Model evaluation and selection
In this lab, we will apply a few model evaluation metrics we've seen in the lecture.
End of explanation
"""
from... |
biothings/biothings_explorer | jupyter notebooks/TIDBIT 04 Finding Marketed Drugs that Might Treat an Unknown Syndrome by Perturbing the Disease Mechanism Pathway.ipynb | apache-2.0 | !pip install git+https://github.com/biothings/biothings_explorer#egg=biothings_explorer
"""
Explanation: Introduction
This notebook demonstrates how BioThings Explorer can be used to answer the following query:
"Finding Marketed Drugs that Might Treat an Unknown Sy... |
joshnsolomon/phys202-2015-work | assignments/assignment07/AlgorithmsEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Algorithms Exercise 2
Imports
End of explanation
"""
def find_peaks(a):
"""Find the indices of the local maxima in a sequence."""
leest = []
if a[0] > a[1]:
leest.append(0)
for x ... |
tralpha/Computer-Vision-Gatech | ps0_python/Lesson 2A-L3.ipynb | apache-2.0 | import cv2
import os
import matplotlib.pyplot as plt
from ps0 import *
import numpy as np
%matplotlib inline
driver_path = 'input/ps0-1-a-1.jpg'
driver = cv2.imread(driver_path)
show_img(driver)
driver_blur = cv2.GaussianBlur(driver, (7,7), 3, borderType=2)
show_img(driver_blur)
"""
Explanation: This Notebook Cove... |
dato-code/tutorials | dss-2016/churn_prediction/churn-tutorial-explore-explain.ipynb | apache-2.0 | import graphlab as gl
import datetime
gl.canvas.set_target('ipynb') # make sure plots appear inline
"""
Explanation: Exploring & Explaining churn prediction models
Churn prediction is the task of identifying users that are likely to stop using a service, product or website. In this tutorial, you will learn how to:
Exp... |
Olsthoorn/TransientGroundwaterFlow | Syllabus_in_notebooks/Sec7_convolution.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import exp1
from scipy.signal import lfilter
# aquifer data
S = 0.001 # [-]
kD = 600 # m2/d
r = 1000. # m
# time step length
dtau = 1
# length of time series taken as long as the length of the block response
tau = np.arange(1, 100, dtau)
# step ... |
arkottke/pysra | examples/example-03.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pysra
%matplotlib inline
# Increased figure sizes
plt.rcParams["figure.dpi"] = 120
"""
Explanation: Example 3: Wave propagation calculators
Use RVT input motion with:
1. Linear elastic
2. Equivalent linear (e.g., SHAKE)
3. Frequency-dependent equivalent line... |
miykael/nipype_tutorial | notebooks/wip_saving_workflows.ipynb | bsd-3-clause | from nipype.interfaces.fsl import BET, ImageMaths
from nipype import Workflow, Node, MapNode
from nipype.interfaces.utility import Function, IdentityInterface
bet = Node(BET(), name='bet')
bet.iterables = ('frac', [0.3, 0.4])
bet2 = MapNode(BET(), name='bet2', iterfield=['infile'])
bet2.iterables = ('frac', [0.4, 0.5... |
NumCosmo/NumCosmo | notebooks/DataNCount/run_ascaso_mc_binned.ipynb | gpl-3.0 | #CCL cosmology
cosmo_ccl = ccl.Cosmology(Omega_c = 0.30711 - 0.048254, Omega_b = 0.048254, h = 0.677, sigma8 = 0.8822714165197718, n_s=0.96, Omega_k = 0, transfer_function='eisenstein_hu')
#ccl_cosmo_set_high_prec (cosmo_ccl)
cosmo_numcosmo, dist, ps_lin, ps_nln, hmfunc = create_nc_obj (cosmo_ccl)
psf = hmfunc.peek_p... |
briennakh/BIOF509 | Wk02/Wk02-Development.ipynb | mit | import itertools
import math
import matplotlib.pyplot as plt
import numpy as np
import random
%matplotlib inline
print("Numpy:", np.__version__)
random.seed(0)
"""
Explanation: Week 2 - Development
Learning Objectives
List different optimization strategies
List the benefits of coding style guides
Prepare documenta... |
matthewgilbert/blotter | examples/intraday.ipynb | mit | %pylab inline
import sys
sys.path.append("..")
from blotter import blotter
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.options.display.max_rows = 10
blt = blotter.Blotter(prices="./prices", interest_rates="daily_interest_rates.csv", eod_time=None)
blt.connect_market_data()
blt.define_gene... |
maxvogel/NetworKit-mirror2 | Doc/Notebooks/Sparsification.ipynb | mit | G = readGraph("../../input/jazz.graph", Format.METIS)
G.indexEdges()
G.size()
"""
Explanation: All considered sparsification algorithm implementations rely on edge scores, so do not forget to call indexEdges() on the graph you want to work on.
End of explanation
"""
sparsificationAlgorithm = sparsification.LocalDegr... |
HAOzj/Classic-ML-Methods-Algo | ipynbs/appendix/deal_with_overfitting/dropout.ipynb | mit | keep_prob = 0.5
do_dropout = True
"""
Explanation: Dropout
Dropout是一种用于深度神经网络的方法,用于避免过拟合.
在训练时,每次迭代中每层以提前设定的概率,称为keep_prob,来随机选择保留的节点,其他的节点在该次前向传播被忽略(设为0),同时在后向传播中也忽略.如下图中打叉的节点就是某次迭代中忽略的节点.
作用,应用
Dropout主要有两个作用:
dropout在训练时每个迭代中相当于减小了网络规模,有正则化的作用.
dropout可以避免把过多的权重放在某个节点上,而是把权重分散给全部的节点.
在实践中,dropout在CV领域比较... |
ocean-color-ac-challenge/evaluate-pearson | evaluation-participant-f.ipynb | apache-2.0 | w_412 = 0.56
w_443 = 0.73
w_490 = 0.71
w_510 = 0.36
w_560 = 0.01
"""
Explanation: E-CEO Challenge #3 Evaluation
Weights
Define the weight of each wavelength
End of explanation
"""
run_id = '0000005-150701000025418-oozie-oozi-W'
run_meta = 'http://sb-10-16-10-55.dev.terradue.int:50075/streamFile/ciop/run/participant-... |
phoebe-project/phoebe2-docs | development/tutorials/compute_multiple.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Advanced: Running Multiple Compute Options Simulataneously
Now that we have datasets added to our Bundle, our next step is to run the forward model and compute a synthetic model for each of these datasets.
Setup
Let's first make sure we have the latest version of PH... |
kaushik94/tardis | docs/running/interaction/integrator.ipynb | bsd-3-clause | %pylab notebook
import tardis
from tardis.io.config_reader import Configuration
from tardis.simulation import Simulation
config_fname = tardis.__path__[0] + '/../../data/tardis_example/tardis_example_integral.yml'
"""
Explanation: API example for the formal integral
There are currently two ways to invoke the calculati... |
piskvorky/gensim | docs/src/auto_examples/tutorials/run_wmd.ipynb | lgpl-2.1 | # Image from https://vene.ro/images/wmd-obama.png
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread('wmd-obama.png')
imgplot = plt.imshow(img)
plt.axis('off')
plt.show()
"""
Explanation: Word Mover's Distance
Demonstrates using Gensim's implemenation of the WMD.
Word Mover's Distance ... |
charlesreid1/rejoyce | Fourier.ipynb | mit | %matplotlib inline
from __future__ import division
from numpy import *
from matplotlib.pyplot import *
import seaborn as sns
"""
Explanation: Fourier Transforms
This notebook works out some of the implementation details of Fourier transforms.
It shows an example turning a set of superimposed sine waves into a spectra... |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_label_from_stc.ipynb | bsd-3-clause | # Author: Luke Bloy <luke.bloy@gmail.com>
# Alex Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.minimum_norm import read_inverse_operator, apply_inverse
from mne.datasets import sample
print(__doc__)
data_pa... |
jaidevd/inmantec_fdp | notebooks/day2/04_time_series_in_pandas.py.ipynb | mit | """
----------------------------------------------------------------------
Filename : 04_time_series_in_pandas.py
Date : 12th Dec, 2013
Author : Jaidev Deshpande
Purpose : Introduction to time series analysis and plotting in Pandas
Libraries: Pandas, NumPy, Matplotlib
--------------------------------------------... |
tensorflow/docs-l10n | site/ja/hub/tutorials/bert_experts.ipynb | apache-2.0 | #@title Copyright 2020 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 ... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/Final Project (Minesweeper)/_02. Printing the Board(HW).ipynb | mit | def display_board(board):
for row in board:
print(row)
# Runing the tests...
test()
# Note if you recieve an error message saying test_board not found
# try hitting the run button on the test_board cell and try again.
"""
Explanation: Possible Solution
End of explanation
"""
def display_board(b... |
arsenovic/galgebra | examples/ipython/verify_doc_python.ipynb | bsd-3-clause | import sympy
from __future__ import absolute_import, division
from __future__ import print_function
from galgebra.printer import Format, xpdf
from galgebra.ga import Ga
Format()
g4d = Ga('a b c d')
(a, b, c, d) = g4d.mv()
g4d.g
a | (b * c)
a | (b ^ c)
a | (b ^ c ^ d)
(a | (b ^ c)) + (c | (a ^ b)) + (b | (c ^ a... |
dcavar/python-tutorial-for-ipython | notebooks/Flair Training Sequence Labeling Models.ipynb | apache-2.0 | from flair.data import Corpus
from flair.datasets import WNUT_17
from flair.embeddings import TokenEmbeddings, WordEmbeddings, StackedEmbeddings
from typing import List
"""
Explanation: Flair Training Sequence Labeling Models
(C) 2019-2020 by Damir Cavar
Version: 0.3, February 2020
Download: This and various other Jup... |
springcoil/PyDataLondonTutorial | notebooks/LogisticRegScikitlearn.ipynb | mit | import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn.cross_validation import train_test_split
%matplotlib inline
data = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data", header=None, names=['age', 'workclass', 'fnlwgt',
'education... |
benmiroglio/pymatch | Example.ipynb | mit | %load_ext autoreload
%autoreload 2
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
from pymatch.Matcher import Matcher
import pandas as pd
import numpy as np
"""
Explanation: Example
The following example demonstrates how to the use the pymatch package to match Lending Club Loan Data. Follow the ... |
Murali-group/PathLinker-Cytoscape | cytoscape-automation-example/lovastatin_analysis.ipynb | gpl-3.0 | # necessary libraries and dependencies
import sys
from py2cytoscape.data.cyrest_client import CyRestClient
from py2cytoscape.data.style import StyleUtil
import networkx as nx
import pandas as pd
import json
import requests
print("python version: " + sys.version)
# The py2cytoscape module doesn't have a version. I ins... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, ... |
Upward-Spiral-Science/uhhh | code/.ipynb_checkpoints/DavidWest - Analysis-checkpoint.ipynb | apache-2.0 | # Import necessary libraries
% matplotlib inline
from matplotlib import pyplot as plt
from sklearn.decomposition import PCA
from sklearn.decomposition import PCA
import numpy as np
import pandas as pd
import seaborn as sns
from pylab import *
import csv
from mpl_toolkits.mplot3d import Axes3D
# Read in the data
data ... |
mintcloud/deep-learning | autoencoder/Convolutional_Autoencoder.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
img = mnist.train.images[300]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
len(mnist.train.... |
massimo-nocentini/PhD | notebooks/fibonacci-numbers-unary-indexed-unfolding.ipynb | apache-2.0 | %run "../src/start_session.py"
%run "../src/recurrences.py"
%run "../src/sums.py"
from oeis import oeis_search, ListData
import knowledge
sys.setrecursionlimit(10000000)
"""
Explanation: <p>
<img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg"
alt="UniFI logo" style="float: left; wid... |
gvasold/gdp17 | texte/regex.ipynb | apache-2.0 | firstnames = ['Astrid', 'Ines', 'Christoph', 'Markus', 'Çınar', 'Đželila', 'Niklas', 'Anna', 'Stefanie', 'Raphael', 'Anna-Lena', 'Silvia', 'Julian', 'Simon', 'Katharina', 'Michael', 'Dominik', 'Maria', 'Kevin', 'Bianca', 'Thomas', 'Nora', 'Manuel', 'Selina', 'Gabriel', 'Daniel', 'Thomas', 'Nina', 'Michael', 'Fabio', 'T... |
JaviMerino/lisa | ipynb/tutorial/02_TestEnvUsage.ipynb | apache-2.0 | import logging
reload(logging)
logging.basicConfig(
format='%(asctime)-9s %(levelname)-8s: %(message)s',
datefmt='%I:%M:%S')
# Enable logging at INFO level
logging.getLogger().setLevel(logging.DEBUG)
# Execute this cell to enabled devlib debugging statements
logging.getLogger('ssh').setLevel(logging.DEBUG)
#... |
QuantEcon/phd_workshops | John/numba.ipynb | bsd-3-clause | import numpy as np
from numba import vectorize, jit, float64
from quantecon.util import tic, toc
import matplotlib.pyplot as plt
"""
Explanation: Vectorization and JIT compilation in Python
Examples for the QuantEcon 2017 PhD workshops
John Stachurski
End of explanation
"""
α = 4
"""
Explanation: Problem 1: A Time ... |
M0nica/python-foundations-hw | 07/billionaires.ipynb | mit | df['citizenship'].value_counts().head()
df.groupby('citizenship')['networthusbillion'].sum().sort_values(ascending=False)
us_pop = 318.9 #billion (2014)
us_bill = df[df['citizenship'] == 'United States']
print("There are", us_pop/len(us_bill), "billionaires per billion people in the United States.")
germ_pop = 0.0... |
nfaggian/notebooks | Introductions/.ipynb_checkpoints/Tutorial - 1.5 - Scikit-Learn-checkpoint.ipynb | apache-2.0 | from IPython.display import Image
Image("http://blog.kaggle.com/wp-content/uploads/2015/04/iris_petal_sepal.png")
import pandas as pd
import numpy as np
from sklearn.datasets import load_iris
iris = load_iris()
"""
Explanation: Scikit Learn
http://scikit-learn.org/
A mature library for machine learning, built using... |
Olsthoorn/TransientGroundwaterFlow | Syllabus_in_notebooks/Sec5_5_2_error_function.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erfc
"""
Explanation: Section 5.5.2 Error function
IHE, Delft, 2019-11-02
@T.N. Olsthoorn
Context
An 1D aquifer (cross section) has a limited width equal to $L$. The head at $x=0$ changes suddenly at $t=0$ by the value $a$, while the head at ... |
guruucsd/EigenfaceDemo | python/Backprop Exercise.ipynb | mit | xs=linspace(-3,3,100)
plt.plot(xs,tanh(xs)); plt.grid()
def funny_tanh(x):
return 1.7159 * tanh(x*2/3) + 0.001 * x
xs=linspace(-3,3,100)
plt.plot(xs,funny_tanh(xs)); plt.grid()
"""
Explanation: Backpropagation Exercise
Let's implement the backpropagation algorithm to train a simple neural network with a single h... |
rtidatascience/connected-nx-tutorial | notebooks/6. Community.ipynb | mit | %reload_ext watermark
%watermark -p networkx
import networkx as nx
from networkx.algorithms.community import k_clique_communities, girvan_newman
import matplotlib.pyplot as plt
%matplotlib inline
GA = nx.read_gexf('../data/ga_graph.gexf')
"""
Explanation: Community
"Where do I belong?"
Definition of Community and ... |
mne-tools/mne-tools.github.io | dev/_downloads/1a105d401683707ed0696f30397d6253/40_artifact_correction_ica.ipynb | bsd-3-clause | import os
import mne
from mne.preprocessing import (ICA, create_eog_epochs, create_ecg_epochs,
corrmap)
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_filt-0-... |
bcantarel/bcantarel.github.io | bicf_nanocourses/courses/ML_1/exercises/Keras_Tutorial.ipynb | gpl-3.0 | # Lets import the various libraries we need
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import RMSprop
from keras.utils.vis_utils import plot_model
import numpy as np
import matplo... |
NeuroStat/Python-scripts | plot_haxby_simple.ipynb | gpl-3.0 | from nilearn import datasets
# if you download these from python.
haxby_dataset = datasets.fetch_haxby()
# print basic information on the dataset
print('First subject anatomical nifti image (3D) is at: %s' %
haxby_dataset.anat[0])
print('First subject functional nifti images (4D) are at: %s' %
haxby_datase... |
FireCARES/data | sources/parcels/notebooks/structure-count-vs-population.ipynb | mit | q = """select fd.id, fd.name, fd.state,
COALESCE(fd.population, 0) as population,
sum(rm.structure_count) as structure_count,
fd.population / sum(rm.structure_count)::float as people_per_structure
from firestation_firedepartment fd
inner join firestation_firedepartmentriskmodels rm
on rm.department_... |
seg/2016-ml-contest | PA_Team/PA_Team_Submission_4.ipynb | apache-2.0 | import numpy as np
np.random.seed(1337)
import warnings
warnings.filterwarnings("ignore")
import time as tm
import pandas as pd
from keras.models import Sequential, Model
from keras.constraints import maxnorm
from keras.layers import Dense, Dropout, Activation
from keras.utils import np_utils
from sklearn.metrics ... |
AndreiBarsan/dm-notes | 03-classification-homework.ipynb | unlicense | import math
import numpy as np
import pandas as pd
import scipy
from scipy.linalg import norm
from sklearn.base import BaseEstimator, ClassifierMixin
%matplotlib inline
import matplotlib.pyplot as plt
# Ensure consistency across runs.
np.random.seed(1337)
Xtrain = np.genfromtxt('data/Xtrain.csv', delimiter=',')
Y... |
JackDi/phys202-2015-work | assignments/assignment07/AlgorithmsEx01.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
"""
Explanation: Algorithms Exercise 1
Imports
End of explanation
"""
wasteland = """
APRIL is the cruellest month, breeding
Lilacs out of the dead land, mixing
Memory and desire, stirring
Dull roots with spring rain.
"""
def tokenize(s, sto... |
metpy/MetPy | v0.8/_downloads/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from metpy.calc import get_wind_components
from metpy.cbook import get_test_data
from metpy.gridding.gridding_functions import interpolate, rem... |
google/meterstick | meterstick_demo.ipynb | apache-2.0 | !pip install meterstick
"""
Explanation: The Meterstick package provides a concise and flexible syntax to describe and execute
routine data analysis tasks. The easiest way to learn to use Meterstick is by example.
For External users
You can open this notebook in Google Colab.
Installation
You can install from pip for ... |
ozorich/phys202-2015-work | days/day11/Interpolation.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
"""
Explanation: Interpolation
Learning Objective: Learn to interpolate 1d and 2d datasets of structured and unstructured points using SciPy.
End of explanation
"""
x = np.linspace(0,4*np.pi,10)
x
"""
Explanation: Overview
W... |
jacobdein/alpine-soundscapes | utilities/Pull data from OpenStreetMap inset.ipynb | mit | bounding_box_file = ""
result_shapefile_filepath = ""
p1 = pyproj.Proj("+init=epsg:31254")
p2 = pyproj.Proj("+init=epsg:4326")
p3 = pyproj.Proj("+init=epsg:3857")
p4 = pyproj.Proj("+init=epsg:25832")
"""
Explanation: Pull political boundary data from OpenStreetMap as shapefile
This notebook pulls political boundary ... |
tensorflow/docs-l10n | site/en-snapshot/probability/examples/Probabilistic_PCA.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
vicente-gonzalez-ruiz/YAPT | 04-concurrency/mutial_exclusion.ipynb | cc0-1.0 | # Two threads that have a critical section executed in parallel without mutual exclusion.
# This code does not work!
import threading
import time
counter = 10
def task_1():
global counter
for i in range(10**6):
counter += 1
def task_2():
global counter
for i in range(10**6+1):
... |
rahlk/learnPy | .ipynb_checkpoints/Lecture4-checkpoint.ipynb | mit | def foo():
return 1
foo()
"""
Explanation: CSX91: Python Tutorial
1. Functions
Fucntions in Python are created using the keyword def
It can return values with return
Let's create a simple function:
End of explanation
"""
aString = 'Global var'
def foo():
a = 'Local var'
print locals()
foo()
print globa... |
megatharun/basic-python-for-researcher | Tutorial 5 - Functions and Modules.ipynb | artistic-2.0 | # Find the square root of integer in a list
from math import *
x1 = [23,12,45]
for m,k in enumerate(x1):
Ex1 = sqrt(k)
print Ex1
"""
Explanation: <span style="color: #B40486">BASIC PYTHON FOR RESEARCHERS</span>
by Megat Harun Al Rashid bin Megat Ahmad
last updated: April 14, 2016
<span style="color: #29088A... |
FinTechies/HedgingRL | notebooks/TD Learning Black Scholes.ipynb | mit | import td
import scipy as sp
α = 0.05
γ = 0.1
td_learning = td.TD(α, γ)
"""
Explanation: Q-learning
Initialize $V(s)$ arbitrarily
Repeat for each episode
Initialize s
Repeat (for each step of episode)
$\alpha \leftarrow$ action given by $\pi$ for $s$
Take action a, observe reward r, and next state s'
$V(s... |
infilect/ml-course1 | week1/CNN/notebook/basic_cnn.ipynb | mit | from IPython.display import Image, display
Image('images/02_network_flowchart.png')
"""
Explanation: TensorFlow Tutorial On Convolutional Neural Network
Introduction
The previous tutorial showed that a simple linear model had about 91% classification accuracy for recognizing hand-written digits in the MNIST data-set.... |
mne-tools/mne-tools.github.io | 0.21/_downloads/2b9ae87368ee06cd9589fd87e1be1d30/plot_time_frequency_mixed_norm_inverse.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
from mne.inverse_sparse import tf_mixed_n... |
christopherpryer/gameofthrones_analysis | analysis.ipynb | mit | import os
import pandas as pd
import numpy as np
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
from plotly.graph_objs import *
import matplotlib.pyplot as mplt
#go offline with plotly
init_notebook_mode(connected=True)
#set working directory
WRKSPC = 'C:\\Users\\Chris\\Analytics\\game... |
rfinn/LCS | notebooks/SFR-Stellarmass-Size.ipynb | gpl-3.0 | import numpy as np
from pylab import *
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Plots for SFR-Stellar Mass-Size Paper
This is an outline of the results that will go into the first paper. The first paper will focus on the $$SFR-M_{*}-Size$$ relation, where $$Size \equiv R_e... |
GoogleCloudPlatform/ai-platform-samples | notebooks/samples/aihub/knn_classification/knn_classification.ipynb | apache-2.0 | PROJECT_ID = "[your-project-id]" #@param {type:"string"}
! gcloud config set project $PROJECT_ID
"""
Explanation: By deploying or using this software you agree to comply with the AI Hub Terms of Service and the Google APIs Terms of Service. To the extent of a direct conflict of terms, the AI Hub Terms of Service will ... |
achave11/bioapi-examples | python_notebooks/1kg_allele_annotation_service.ipynb | apache-2.0 | import ga4gh_client.client as client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
"""
Explanation: GA4GH 1000 Genome Variant Service Example
This example illustrates how to access the different variant calls implemented within the variant service.
Initialize the client
In this step we create a client object whi... |
xianjunzhengbackup/code | python/Python Machine Learning Blueprint/pandas_plot_seaborn.ipynb | mit | print(r.headers)
print(r.text[:100])
with open('iris.data','w') as fp:
fp.write(r.text)
df=pd.read_csv('iris.data',names=['sepal length', 'sepal width', 'petal length', 'petal width', 'class'])
df.head()
df['sepal length'][:10]
"""
Explanation: r is response
End of explanation
"""
df.ix[:3,1]
df[(df['class'... |
ThyrixYang/LearningNotes | MOOC/stanford_cnn_cs231n/assignment2/.ipynb_checkpoints/TensorFlow-checkpoint.ipynb | gpl-3.0 | import tensorflow as tf
import numpy as np
import math
import timeit
import matplotlib.pyplot as plt
%matplotlib inline
from cs231n.data_utils import load_CIFAR10
def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=10000):
"""
Load the CIFAR-10 dataset from disk and perform preprocessing to... |
alfkjartan/control-computarizado | misc-notebooks/MR2007-final-exam-spring-2016.ipynb | mit | T = 120
Tr = 2.2*120
print [Tr/10, Tr/4]
h = 40.0
pc = -1.0/120
pd = np.exp(pc*h)
print pd
"""
Explanation: Problem 1
(a)
Choosing sampling time and calculating the discrete-time poles. The time constant of the first-order response is $T=120$s. Rise time is $T_r = 2.2T = 264$s. Rule-of-thumb is 4-10 sampling periods ... |
littlewine/USelections2016 | Sentiment analysis (prediction).ipynb | mit | from pymongo import MongoClient
client = MongoClient()
db = client.Twitter
#db = client.tweets_sample
from pprint import pprint
import pandas as pd
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt
import time
"""
Explanation: Fundamentals of Data Science - Week 2 and Week 3
<span style=... |
IS-ENES-Data/submission_forms | test/forms/test/test_ki_222.ipynb | apache-2.0 | # please edit the (red) information below: Name, email and project the data belongs to
from dkrz_forms import form_handler
my_project = "DKRZ_CDP"
my_first_name = "...." # example: sf.first_name = "Harold"
my_last_name = "...." # example: sf.last_name = "Mitty"
my_email = "...." # example: sf.email = "Mr.Mitt... |
josephcslater/array_to_latex | Examples.ipynb | mit | import pandas as pd
import numpy as np
import array_to_latex as a2l
%load_ext autoreload
%autoreload 2
"""
Explanation: Some brief examples on using array_to_latex to get nicely formatted latex versions of your arrays.
End of explanation
"""
A = np.array([[1.23456, 23.45678],[456.23+1j, 8.239521]])
a2l.to_ltx(A, frm... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/cmip6/models/sandbox-2/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-2', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-2
Topic: Landice
Sub-Topics: Glaciers, Ice.
Propertie... |
certik/chess | examples_manual/Convergence4.ipynb | mit | %pylab inline
! grep "multipv 1" log8c.txt | grep -v lowerbound | grep -v upperbound > log8c_g.txt
def parse_info(l):
D = {}
k = l.split()
i = 0
assert k[i] == "info"
i += 1
while i < len(k):
if k[i] == "depth":
D[k[i]] = int(k[i+1])
i += 2
elif k[i] ==... |
Kaggle/learntools | notebooks/game_ai/raw/ex3.ipynb | apache-2.0 | from learntools.core import binder
binder.bind(globals())
from learntools.game_ai.ex3 import *
"""
Explanation: Introduction
In the tutorial, you learned how to build a reasonably intelligent agent with the minimax algorithm. In this exercise, you will check your understanding and submit your own agent to the competi... |
NREL/bifacial_radiance | docs/tutorials/21 - Example Simulation - Modeling Module Performance, an End to End Simulation.ipynb | bsd-3-clause | import os
from pathlib import Path
testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_21')
if not os.path.exists(testfolder): os.mkdir(testfolder)
# Another option using relative address; for some operative systems you might need '/' instead of '\'
# testfolder = os.path.abspa... |
letsgoexploring/teaching | winter2017/econ129/python/Econ129_Class_13.ipynb | mit | # Import actual and trend production data
data = pd.read_csv('http://www.briancjenkins.com/teaching/winter2017/econ129/data/Econ129_Rbc_Data.csv',index_col=0)
print(data.head())
"""
Explanation: Class 13: Introduction to Business Cycle Modeling
Empirical evidence of TFP fluctuation
End of explanation
"""
# Create ne... |
gmonce/datascience | src/Intro_Matplotlib.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
"""
Explanation: Módulo 3: Visualización de datos: Matplotlib
En este notebook describiremos brevemente Matplotlib, la principal biblioteca para visualización de datos de Python, construida sobre NumPy, y que funciona sobre diferentes plataformas y formatos de salida. En esta i... |
LimeeZ/phys292-2015-work | assignments/assignment10/ODEsEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def lorentz_derivs(yvec, t, sigma, rho, beta):
"""Compute the the de... |
quantopian/research_public | drafts/Relative Value Factor Notebook.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from quantopian.pipeline.classifiers.morningstar import Sector
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.research import run_pipeline
from quantopian.pipeline.data import mo... |
bbfamily/abu | abupy_lecture/29-多因子策略并行执行配合.ipynb | gpl-3.0 | # 基础库导入
from __future__ import print_function
from __future__ import division
import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
import sys
# 使用insert 0即只使用github,避免交叉使用了pip安装的abupy,导致的... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-1/cmip6/models/sandbox-1/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-1', 'sandbox-1', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: TEST-INSTITUTE-1
Source ID: SANDBOX-1
Sub-Topics: Radiative Forcin... |
dschick/udkm1Dsimpy | docs/source/examples/heat.ipynb | gpl-3.0 | import udkm1Dsim as ud
u = ud.u # import the pint unit registry from udkm1Dsim
import scipy.constants as constants
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
u.setup_matplotlib() # use matplotlib with pint units
"""
Explanation: Heat
In this example the laser-excitation of a sample Structu... |
tensorflow/quantum | docs/tutorials/mnist.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... |
GoogleCloudPlatform/python-docs-samples | notebooks/tutorials/bigquery/BigQuery command-line tool.ipynb | apache-2.0 | !bq help
"""
Explanation: BigQuery command-line tool
The BigQuery command-line tool is installed as part of the Cloud SDK and can be used to interact with BigQuery. When you use CLI commands in a notebook, the command must be prepended with a !.
View available commands
To view the available commands for the BigQuery c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.