repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Cyb3rWard0g/ThreatHunter-Playbook | docs/notebooks/windows/07_discovery/WIN-190826010110.ipynb | gpl-3.0 | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Remote Service Control Manager Handle
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/08/26 |
| modification date | 2020/09/20 |
| playbook related ... |
david4096/bioapi-examples | python_notebooks/1kg.ipynb | apache-2.0 | from ga4gh.client import client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
"""
Explanation: GA4GH 1000 Genomes Examples
Variant data from the Thousand Genomes project is being served by the GA4GH reference server. In this example we show how to use the GA4GH client to access the data.
Initialize the client
I... |
atlury/deep-opencl | DL0110EN/6.1.1What is Convolution.ipynb | lgpl-3.0 | import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage, misc
"""
Explanation: <div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="http://cocl.us/pytorch_link_top"><img src = "http://cocl.us/Pytorch_top" width = 950, align = "center"></... |
lknelson/DH-Institute-2017 | 05-Dictionary-Method/Dictionary Method.ipynb | bsd-2-clause | #import the necessary packages
import pandas
import nltk
from nltk import word_tokenize
import string
#read the Music Reviews corpus into a Pandas dataframe
df = pandas.read_csv("BDHSI2016_music_reviews.csv", sep = '\t')
#view the dataframe
df
"""
Explanation: Dictionary Method
For the final two days we'll move to m... |
quantumlib/Cirq | docs/tutorials/google/spin_echoes.ipynb | apache-2.0 | try:
import cirq
except ImportError:
print("installing cirq...")
!pip install --quiet cirq --pre
print("installed cirq.")
import matplotlib.pyplot as plt
import numpy as np
import cirq
import cirq_google as cg
import os
# The Google Cloud Project id to use.
project_id = '' #@param {type:"string"}
pr... |
mne-tools/mne-tools.github.io | 0.19/_downloads/0e581c82105908041041c03567ff0208/plot_visualize_epochs.ipynb | bsd-3-clause | import os.path as op
import mne
data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample')
raw = mne.io.read_raw_fif(
op.join(data_path, 'sample_audvis_filt-0-40_raw.fif'), preload=True)
event_id = {'auditory/left': 1, 'auditory/right': 2, 'visual/left': 3,
'visual/right': 4, 'smiley': 5, '... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/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', 'thu', 'sandbox-1', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-1
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
WNoxchi/Kaukasos | FAI02_old/Lesson8/DCGAN.ipynb | mit | %matplotlib inline
import importlib
import utils2; importlib.reload(utils2)
from utils2 import *
from tqdm import tqdm
"""
Explanation: Generative Adversarial Networks in Keras
End of explanation
"""
from keras.datasets import mnist
(X_train, y_train), (X_test, y_test) = mnist.load_data()
X_train.shape
n = len(X_t... |
bwalrond/explore-notebooks | jupyter_notebooks/CS190-1x Module 4- Feature Hashing Lab.ipynb | mit | labVersion = 'cs190.1x-lab4-1.0.4'
print labVersion
"""
Explanation: <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="licens... |
flowersteam/explauto | notebook/learning_with_sensorimotor_context.ipynb | gpl-3.0 | from __future__ import print_function
from explauto.environment.simple_arm import SimpleArmEnvironment
from explauto.environment import environments
env_cls = SimpleArmEnvironment
env_conf = environments['simple_arm'][1]['low_dimensional']
"""
Explanation: Learning a sensorimotor model with a sensorimotor context
In ... |
WillenZh/deep-learning-project | 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... |
jmunar/pymc3-kalman | notebooks/HowTo_ProfilingTheanoScan.ipynb | apache-2.0 | import numpy as np
import theano
import theano.tensor as tt
import kalman
"""
Explanation: Let's admit it, bayesian modeling on time series is slow. In pymc3, it typically implies using theano scan operation. Here, we will show how to profile one step of the kalman filter, as well as the scan operat... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_automl_tabular_binary_classification_online_export_cloud.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: AutoML training tabular binary classification model for export to cloud
<table alig... |
teuben/astr288p | notebooks/n6503-orbits.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import math
"""
Explanation: Gas Streaming in Disks: circular orbit approach
The gas streaming around a young star, or in a galactic disk is dominated by gravity. So we can simply compute the orbits of a point mass around a star, or in the more com... |
jtwhite79/pyemu | examples/modflow_to_pest_like_a_boss.ipynb | bsd-3-clause | %matplotlib inline
import os
import shutil
import platform
import numpy as np
import pandas as pd
from matplotlib.patches import Rectangle as rect
import matplotlib.pyplot as plt
import warnings
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib as mpl
newparams = {'legend.fontsize':10, 'axes.lab... |
AEW2015/PYNQ_PR_Overlay | Pynq-Z1/notebooks/Video_PR/Mirror_Filter.ipynb | bsd-3-clause | from pynq.drivers.video import HDMI
from pynq import Bitstream_Part
from pynq.board import Register
from pynq import Overlay
Overlay("demo.bit").download()
"""
Explanation: Don't forget to delete the hdmi_out and hdmi_in when finished
Mirror Filter Example
In this notebook, we will demonstrate how to use the mirror f... |
fmaschler/networkit | Doc/uploads/docs/GephiStreaming_UserGuide.ipynb | mit | G = generators.ErdosRenyiGenerator(300, 0.2).generate()
G.addEdge(0, 1) #We want to make sure this specific edge exists, for usage in an example later.
"""
Explanation: Introduction
NetworKit provides an easy interface to Gephi that uses the Gephi graph streaming plugin. To be able to use it, install the Graph Streami... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-hh/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-HH
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection... |
Linlinzhao/linlinzhao.github.io | _drafts/Pytorch_basic_operations.ipynb | mit | import torch
x = torch.rand(4, 3) #randomly generated tensors
print x
x.t_() #transpose of x, note that x has been changed!
print x
print x.t()
print x #the x is still the previous modified, which is not mutated by x.t()
z = torch.Tensor(3, 4)
z.copy_(x) #copy x to z
print x
print z
print z.add_(x)
print x
print z ... |
Danghor/Formal-Languages | ANTLR4-Python/SLR-Parser-Generator/Shift-Reduce-Parser-AST.ipynb | gpl-2.0 | cat Examples/sum-for.sl
"""
Explanation: <b>Exercise</b>: Extending a Shift-Reduce Parser
In this exercise your task is to extend the shift-reduce parser
that has been discussed in the lecture so that it returns an abstract syntax tree. You should test it with the program sum-for.sl that is given the directory Exampl... |
liganega/Gongsu-DataSci | ref_materials/excs/Lab-03.ipynb | gpl-3.0 | import math # math 모듈을 임포트해야 pi 값을 사용할 수 있다.
def degree(x):
return (x *360.0) / (2 * math.pi)
degree(math.pi)
"""
Explanation: Training
training3.py 파일에 아래에 예제들에서 설명되는 함수들을 정의하라.
예제 1
인자로 x 라디안(호도, radian)을 입력받아 각도(degree)로 계산하여 되돌려주는 함수 degree(x)를 정의하라.
`degree(x) = (x * 360) / (2 * pi)`
여기서 pi는 원주율을 나타내며, 라디... |
TiKeil/Master-thesis-LOD | notebooks/TEST_VCLOD_Coefficient_2.ipynb | apache-2.0 | import os
import sys
import numpy as np
import scipy.sparse as sparse
import random
import csv
%matplotlib notebook
import matplotlib.pyplot as plt
from visualize import drawCoefficient
from data import *
from gridlod import interp, coef, util, fem, world, linalg, femsolver
import pg_rand, femsolverCoarse, buildcoef... |
joelgrus/codefellows-data-science-week | ipynb/pandas.ipynb | unlicense | from pandas import DataFrame, Series
import pandas as pd
import numpy as np
"""
Explanation: More often when working with data you'll use the pandas library. The fundamental constructs in pandas are the DataFrame and Series
End of explanation
"""
series = Series({'a' : 1, 'c' : 3, 'e' : 7, 'b' : 4})
series
"""
Exp... |
cxxgtxy/tensorflow | tensorflow/compiler/xla/g3doc/tutorials/jit_compile.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... |
sthuggins/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
"""Return phi(x, t) for a soliton wave with co... |
ecervera/UJI_AMR | solutions/Square.ipynb | mit | import packages.initialization
import pioneer3dx as p3dx
p3dx.init()
"""
Explanation: <img align="right" src="../img/square_240.png" />
Exercise: Square Test.
You are going to make a program for describing a square trajectory with the robot.
Instead of starting to code from scratch, you are going to reuse the code tha... |
DTOcean/dtocean-core | notebooks/DTOcean Electrical Sub-Systems Example.ipynb | gpl-3.0 | %matplotlib inline
from IPython.display import display, HTML
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (14.0, 8.0)
import numpy as np
from dtocean_core import start_logging
from dtocean_core.core import Core
from dtocean_core.menu import ModuleMenu, ProjectMenu
from dtocean_core.pipeline impo... |
zzsza/TIL | python/or-tools(solver)-tutorial.ipynb | mit | from ortools.linear_solver import pywraplp
"""
Explanation: OR Tools
설치
pip3 install ortools
문서
예제 코드 Github
사용 방법
변수 생성
제약조건 정의
목적 함수 정의
Solver 실행
<변제목솔>
흠 자꾸 죽음...
Solver에서 변수 2번째 할당할 때 죽네
OR Tools Solver 자체는 어렵지 않은 느낌, 수식을 코드화할 수 있느냐가 관건일 듯
Scipy의 Optimization도 있음
End of explanation
"""
solver = pywraplp... |
gmarceaucaron/ecole-apprentissage-profond | notebooks/theano_basics/intro_theano.ipynb | bsd-3-clause | import os
#os.environ['THEANO_FLAGS'] = 'floatX=float64,device=cpu,mode=FAST_RUN'
os.environ['THEANO_FLAGS'] = 'floatX=float32, device=cuda, mode=FAST_RUN'
import numpy as np
import theano
import theano.tensor as T
"""
Explanation: Introduction to Theano
To execute a cell: Ctrl-Enter.
The code was executed with the d... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/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', 'cas', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: CAS
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties: 6... |
MaximMalakhov/coursera | Learning on marked data/Week 4/grad_boosting.ipynb | mit | from sklearn import cross_validation, datasets, metrics, tree, ensemble, learning_curve
import numpy as np
import pandas as pd
%pylab inline
boston = datasets.load_boston()
X_train = boston.data[:379]
X_test = boston.data[379:]
y_train = boston.target[:379]
y_test = boston.target[379:]
"""
Explanation: Градиентный... |
mne-tools/mne-tools.github.io | 0.22/_downloads/f01121873dbae065a1740e6c0c20d1d5/plot_eeg_no_mri.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD Style.
import os.path as op
import mne
from mne.datasets import eegbci
from mne.datasets import fetch_fsaverage
# Download fsaverage files
fs_dir = fetch_fsaverage(verbose=True)
subjects_dir = op.... |
arturops/deep-learning | intro-to-rnns/Anna_KaRNNa_Exercises.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is bas... |
ondrejiayc/StatisticalMethods | examples/XrayImage/FirstLook.ipynb | gpl-2.0 | from __future__ import print_function
import astropy.io.fits as pyfits
import numpy as np
import os
import urllib
import astropy.visualization as viz
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 10.0)
"""
Explanation: A First Look at an X-ray Image Dataset
Images are data.... |
cuttlefishh/emp | code/06-beta-diversity/filter_biom_bdiv.ipynb | bsd-3-clause | # a trick to make it transparent if executed on a barnacle node or on my machine with barnacles file system mounted to /media/barnacle
import socket
ROOT = "/media/barnacle/" if socket.gethostname() == 't440s' else "/"
%matplotlib inline
# make all necessary imports
import pandas as pd
import sys
import os
import bio... |
chengsoonong/didbits | Fairness/error-fairness.ipynb | apache-2.0 | import pandas as pd
import numpy as np
from itertools import product
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection, Line3DCollection
import matplotlib.pyplot as plt
%matplotlib notebook
# Illustrating the use of itertools product
for ix,value in enumerate(product(ran... |
paulbrodersen/netgraph | docs/source/sphinx_gallery_output/plot_10_community_layout.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import networkx as nx
from netgraph import Graph
# create a modular graph
partition_sizes = [10, 20, 30, 40]
g = nx.random_partition_graph(partition_sizes, 0.5, 0.1)
# create a dictionary that maps nodes to the community they belong to
node_to_community = dict()
node = 0
for community... |
geoscixyz/computation | notebooks/fundamentals/pixels_and_neighbors/divergence.ipynb | mit | import numpy as np
from SimPEG import Mesh
import matplotlib.pyplot as plt
%matplotlib inline
plt.set_cmap(plt.get_cmap('viridis')) # use a nice colormap!
# define a 1D mesh
mesh1D = Mesh.TensorMesh([5]) # with 5 cells
fig, ax = plt.subplots(1,1, figsize=(12,2))
ax.plot(mesh1D.gridN, np.zeros(mesh1D.nN),'-k',marker=... |
pligor/predicting-future-product-prices | 04_time_series_prediction/27_price_history_mobattrs_date_generation.ipynb | agpl-3.0 | num_units = 400 #state size
input_len = 60
target_len = 30
batch_size = 50
with_EOS = False
total_train_size = 57994
"""
Explanation: Step 0 - hyperparams
vocab_size is all the potential words you could have (classification for translation case)
and max sequence length are the SAME thing
decoder RNN hidden units ar... |
wy1iu/sphereface | tools/caffe-sphereface/examples/net_surgery.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Make sure that caffe is on the python path:
caffe_root = '../' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
# configure plotting
plt.rcParams['figure.figsize'] = (10, 1... |
cdawei/digbeta | dchen/music/pldataset_split.ipynb | gpl-3.0 | %matplotlib inline
%load_ext autoreload
%autoreload 2
import os, sys
import gzip
import pickle as pkl
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import precision_recall_fscore_support, roc_auc_score, average_precision_score
from scipy.optimize impor... |
abevieiramota/data-science-cookbook | 2016/naive-bayes/NaiveBayes.ipynb | mit | from collections import defaultdict
from functools import reduce
import math
class NaiveBayes:
def __init__(self):
self.freqFeature = defaultdict(int)
self.freqLabel = defaultdict(int)
# condFreqFeature[label][feature]
self.condFreqFeature = defaultdict(lambda: defaultdict(int))
... |
WendyMawanli/liupengyuan.github.io | chapter2/homework/localization/3-29/201611680122.ipynb | mit | def compute_product(end):
i = 0
product_n = 1
while i < end:
i = i + 1
product_n = product_n * i
return product_n
m = int(input('请输入第一个整数,以回车结束:'))
n = int(input('请输入第二个整数,以回车结束:'))
k = int(input('请输入第三个整数,以回车结束:'))
print('最终的和是:',compute_product(m) + compute_product(n) +... |
adrn/thejoker | docs/examples/4-Continue-sampling-mcmc.ipynb | mit | import astropy.coordinates as coord
import astropy.table as at
from astropy.time import Time
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
import corner
import pymc3 as pm
import pymc3_ext as pmx
import exoplanet as xo
import arviz as az
import thejoker as tj
# set up... |
mmadsen/experiment-seriation-classification | analysis/sc-4-5/sc-4-5-classification.ipynb | apache-2.0 | import numpy as np
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import cPickle as pickle
from copy import deepcopy
from sklearn.utils import shuffle
import sklearn_mmadsen.graphs as skmg
%matplotlib inline
plt.style.use("fivethirtyeight")
sns.set()
all_graphs = pickl... |
tensorflow/docs-l10n | site/ko/tutorials/quickstart/beginner.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... |
ChadFulton/statsmodels | examples/notebooks/tsa_arma_0.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function
import numpy as np
from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.graphics.api import qqplot
"""
Explanation: Autoregressive Moving Average (ARMA): Sunspots data
End of explanation
"""... |
QijunNiu/Notes | Python/Scope.ipynb | bsd-3-clause | x = 15
def func():
print(x)
func()
"""
Explanation: 作用域
作用域规定了一个变量能在什么地方使用。
python的作用域规则也很简单,可以理解为多个盒子,这些盒子是一层一层套在一起的,里面的盒子可以看到外面的盒子里的东西,而外面的盒子看不到里面盒子里的东西。这些盒子在python 中用词法来规定的。程序员自己的代码一般会在三个盒子中,自己创建出来的盒子只有以下两种:
函数盒子
类盒子
这些盒子都是装在一个文件中的,出了这些盒子,再定义变量,都是放在一个全局的盒子中,一般称作全局作用域:
3. 全局盒子
程序是在python解释器中运行的,解释器会有一些内建的变量,... |
vsego/python-lecture-notes | 05a-strings.ipynb | gpl-2.0 | string1 = 'This string is enclosed in single quotes, so we can use "double quotes" easily.'
string2 = "This string is enclosed in double quotes, so we can use 'single quotes' easily."
string3 = '''Triple quotes make it easy to put
anything (but those same triple quotes) in a string,
even a new line character!'''
string... |
DawesLab/LabNotebooks | Curve Fitting/Curve fitting.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
"""
Explanation: Curve fitting in python
A.M.C. Dawes - 2015
An introduction to various curve fitting routines useful for physics work.
The first cell is used to import additional features so they are available in our notebook. matplotlib provides p... |
HsKA-ThermalFluiddynamics/NSS-1 | 4_3-Potentialtheorie_Elementarstroemungen2.ipynb | mit | import math
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
nx = 400 # Anzahl der Punkte in x-Richtung
ny = 200 # Anzahl der Punkte in y-Richtung
x = np.linspace(-5, 15, nx) # 1D-Array mit x-Koordinaten
y = np.linspace(-5, 5, ny... |
dpiparo/swanExamples | notebooks/SimpleIO_py.ipynb | lgpl-2.1 | import ROOT
%jsroot on
"""
Explanation: Simple IO
<hr style="border-top-width: 4px; border-top-color: #34609b;">
This simple ROOTbook shows how to create a histogram, fill it and write it.
End of explanation
"""
def writeHisto(outputFileName):
outputFile = ROOT.TFile(outputFileName, "RECREATE")
h = ROOT.TH1... |
GoogleCloudPlatform/cloudml-samples | notebooks/scikit-learn/custom-pipeline.ipynb | apache-2.0 | PROJECT_ID = "<your-project-id>" #@param {type:"string"}
! gcloud config set project $PROJECT_ID
"""
Explanation: Prediction with a custom scikit-learn pipeline
<table align="left">
<td>
<a href="https://cloud.google.com/ml-engine/docs/scikit/custom-pipeline">
<img src="https://cloud.google.com/_static/im... |
nordam/TFY4305 | Notebooks/ODE.ipynb | gpl-3.0 | def f(x, t):
return x
# Initial conditions
x = 1/2
t = 0
Tmax = 10
# Timestep
h = 0.001
# Keep list of trajectories and times for plotting
Xs = [x]
Ts = [t]
while t < Tmax:
# At each step, use derivative at that position
x = x + h*f(x, t)
# Increment time
t += h
# Store time and posit... |
dolittle007/dolittle007.github.io | notebooks/BEST.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import pymc3 as pm
import pandas as pd
import seaborn as sns
sns.set(color_codes=True)
np.random.seed(20090425)
drug = (101,100,102,104,102,97,105,105,98,101,100,123,105,103,100,95,102,106,
109,102,82,102,100,102,102,101,102,102,103,103,97,97,103,101,97,104,
96,10... |
ES-DOC/esdoc-jupyterhub | notebooks/ipsl/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', 'ipsl', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: IPSL
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties:... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Analysis/Pandas/Data Input and Output.ipynb | mit | import numpy as np
import pandas as pd
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Data Input and Output
This notebook is the reference code for getting input and output, pandas can read a variety of file types using its pd.read_ methods. Let's take a look at the ... |
sablet/algo_trade | notebooks/data-describe-and-learning-model.ipynb | mit | panel = get_data.symbols2daily_values(kinds='sandp500')
panel
"""
Explanation: S&P500 daily stock value get and watch
what's S&P500?: http://www.investopedia.com/terms/s/sp500.asp
End of explanation
"""
panel.items
"""
Explanation: dim-1: key(item axis)
End of explanation
"""
panel.major_axis
"""
Explanation: d... |
EmissionsIndex/Emissions-Index | Code/EPA Emissions data.ipynb | gpl-3.0 | import io, time, json
import requests
from bs4 import BeautifulSoup
import pandas as pd
import urllib, urllib2
import re
import os
import numpy as np
import ftplib
from ftplib import FTP
import timeit
"""
Explanation: Download hourly EPA emissions
End of explanation
"""
# Replace the filename with whatever csv store... |
d00d/quantNotebooks | Notebooks/quantopian_research_public/tutorials/pipeline/pipeline_tutorial_lesson_3.ipynb | unlicense | from quantopian.pipeline import Pipeline
from quantopian.research import run_pipeline
# New from the last lesson, import the USEquityPricing dataset.
from quantopian.pipeline.data.builtin import USEquityPricing
# New from the last lesson, import the built-in SimpleMovingAverage factor.
from quantopian.pipeline.factor... |
liganega/Gongsu-DataSci | ref_materials/excs/Lab-06.ipynb | gpl-3.0 | while True:
try:
n = int(raw_input("Please enter a number: "))
print("정확히 입력되었습니다.")
break
except ValueError:
print("정수를 입력하시오.")
"""
Explanation: 연습문제
아래 문제들을 해결하는 코드를 lab06.py 파일에 작성하여 제출하라.
연습 1
아래 코드를 실행하고 23.5입력하면 ValueError 오류가 발생한다.
======
n = int(raw_input("Please enter... |
astroumd/GradMap | notebooks/Lectures2019/Lecture4/Lecture4-2BodyProblem2019-Instructor.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Introduction to numerical simulations: The 2 Body Problem
Many problems in statistical physics and astrophysics require solving problems consisting of many particles at once (sometimes on the order of thousands or more!) This can't ... |
mne-tools/mne-tools.github.io | 0.24/_downloads/e1c3654f77f904db443b548e9d93b8f9/50_decoding.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
import mne
from mne.datasets import sample
from mne.decoding import (SlidingEstimator, GeneralizingEstimator, Scaler,
... |
tbphu/fachkurs_master_2016 | 07_modelling/20160527_NumericalSolver.ipynb | mit | import numpy as np
# Lotka Volterra model
# initialise parameters
k1 = 1.5
k2 = 1.
k3 = 3.
k4 = 1.
def my_dxdt(s,t):
"""
Function returns values of derivatives of Lotka Volterra model
"""
return [k1*s[0] - k2*s[0]*s[1], - k3*s[1]+k4*s[0]*s[1]]
def my_euler_solver(dxdt, s0, timegrid):
"""
Impl... |
lionell/university-labs | eco_systems/lab6.ipynb | mit | A11 = np.array([[0.4, 0.2], [0.1, 0.2]])
A12 = np.array([[0.3, 0.2]]).T
A21 = np.array([[0.2, 0.3]])
A22 = np.array([0.5])
B1 = np.array([[0.2, 0.3], [0.7, 0.8]])
B2 = np.array([[0.1, 0]]).T
x1_0 = np.array([[1700, 1000]]).T
def c1(t): return np.array([1000, 500]) * np.exp(0.05*t)
c2 = 100
bounds = [0, 1.2]
t = np.... |
ryanjoneil/decision-models-for-data-science | ipynb/Chapter 2 - Basic linear models.ipynb | bsd-2-clause | import pulp
schedule = pulp.LpProblem('Schedule for next Monday', pulp.LpMaximize)
# Define a decision variable for each activity.
sleep = pulp.LpVariable('sleep', 7, 24)
work = pulp.LpVariable('work', 10, 24)
leisure = pulp.LpVariable('leisure', 0, 24)
# Our objective is to maximize happiness.
happiness = 1.5*sleep... |
mikelseverson/Udacity-Deep_Learning-Nanodegree | 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... |
mne-tools/mne-tools.github.io | dev/_downloads/1c191178a3423d922910711c4b574821/50_configure_mne.ipynb | bsd-3-clause | import os
import mne
"""
Explanation: Configuring MNE-Python
This tutorial covers how to configure MNE-Python to suit your local system and
your analysis preferences.
We begin by importing the necessary Python modules:
End of explanation
"""
print(mne.get_config('MNE_USE_CUDA'))
print(type(mne.get_config('MNE_USE_CU... |
rocketproplab/Guides | Guides/experimentalTechniquesAndSensors/Filters-FirstOrder.ipynb | mit | import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
"""
Explanation: First Order Filters
This notebook goes through calculations of first order low- and high-pass filters.
To start, lets import the libraries that will be used during this tutorial.
End of explanation
"""
# inputs
R = 1000 # ... |
jinntrance/MOOC | coursera/ml-regression/assignments/week-3-polynomial-regression-assignment-blank.ipynb | cc0-1.0 | import graphlab
"""
Explanation: Regression Week 3: Assessing Fit (polynomial regression)
In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will:
* Write a function to take a... |
jdossgollin/CWC_ANN | Week05/notebooks/edward_getting_started.ipynb | mit | %matplotlib inline
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from edward.models import Normal
plt.style.use('ggplot')
def build_toy_dataset(N=50, noise_st... |
enbanuel/phys202-2015-work | assignments/assignment10/ODEsEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 3
Imports
End of explanation
"""
g = 9.81 # m/s^2
l = 0.5 # length of pendulum... |
diegocavalca/Studies | phd-thesis/Hipótese - Gráfico de Recorrência.ipynb | cc0-1.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
plt.rc('text', usetex=False)
from matplotlib.image import imsave
import pandas as pd
import pickle as cPickle
import os, sys, cv2
from math import *
from pprint import pprint
from tqdm import tqdm_notebook
from mpl_toolkits.ax... |
ES-DOC/esdoc-jupyterhub | notebooks/bcc/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', 'bcc', 'sandbox-1', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: BCC
Source ID: SANDBOX-1
Sub-Topics: Radiative Forcings.
Properties: 85 (42 re... |
IS-ENES-Data/submission_forms | test/prov/prov-submission-test.ipynb | apache-2.0 | # for testing if module is not in python-path
# import sys
# sys.path.append('/home/stephan/Repos/ENES-EUDAT/submission_forms')
# sys.path.append('C:\\Users\\Stephan Kindermann\\Documents\\GitHub\\submission_forms')
%load_ext autoreload
%autoreload 2
"""
Explanation: Representation of data submission workflow compone... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/02_06/Begin/Merge.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
starting_date = '20160701'
sample_numpy_data = np.array(np.arange(24)).reshape((6,4))
dates_index = pd.date_range(starting_date, periods=6)
sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD'))
sample_df_2 = sample_df.copy()
sample_df_2['Fruits'] =... |
kubeflow/kfp-tekton | samples/lightweight-component/lightweight_component.ipynb | apache-2.0 | # Install the dependency packages
!pip install --upgrade pip
!pip install numpy tensorflow kfp-tekton
"""
Explanation: Lightweight python components
Lightweight python components do not require you to build a new container image for every code change. They're intended to use for fast iteration in notebook environment.... |
materials-data-facility/forge | docs/examples/Example_Aggregations.ipynb | apache-2.0 | import json
from mdf_forge.forge import Forge
mdf = Forge()
"""
Explanation: Example Aggregations
Aggregating data with MDF
Searches using Forge.search() are limited to 10,000 results. However, there are two methods to circumvent this restriction: Forge.aggregate_source() and Forge.aggregate().
End of explanation
"""... |
kwinkunks/lasio | notebooks/Speed test.ipynb | mit | %%timeit -n 15
lasio.examples.open("6038187_v1.2.las")
"""
Explanation: Speed
End of explanation
"""
import pickle
las = lasio.examples.open("logging_levels.las")
len(pickle.dumps(las))
las = lasio.examples.open("6038187_v1.2.las")
len(pickle.dumps(las))
"""
Explanation: prior to trying to fix #217: 6038... |
letsgoexploring/teaching | winter2017/econ129/python/Econ129_Class_15_Complete.ipynb | mit | # 1. Input model parameters
parameters = pd.Series()
parameters['rhoa'] = .9
parameters['sigma'] = 0.001
print(parameters)
# 2. Define a function that evaluates the equilibrium conditions
def equilibrium_equations(variables_forward,variables_current,parameters):
# Parameters
p = parameters
# Va... |
gwtsa/gwtsa | examples/notebooks/6_fix_parameters_leastquares.ipynb | mit | import pandas as pd
import pastas as ps
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: <figure>
<IMG SRC="https://raw.githubusercontent.com/pastas/pastas/master/doc/_static/TUD_logo.png" WIDTH=250 ALIGN="right">
</figure>
Time Series Analysis with Pastas
Developed by Mark Bak... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-hh/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-HH
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties:... |
Britefury/deep-learning-tutorial-pydata2016 | Deep learning loss functions.ipynb | mit | %matplotlib inline
"""
Explanation: Deep learning loss functions
Inline plots:
End of explanation
"""
import os
import numpy as np
import pandas as pd
import torch, torch.nn as nn, torch.nn.functional as F
from matplotlib import pyplot as plt
import seaborn as sns
sns.set()
EPSILON = 1.0e-12
SAVE_PLOTS = True
""... |
ljwolf/spvcm | spvcm/examples/using_the_sampler.ipynb | mit | import spvcm.api as spvcm #package API
spvcm.both.Generic # abstract customizable class, ignores rho/lambda, equivalent to MVCM
spvcm.both.MVCM # no spatial effect
spvcm.both.SESE # both spatial error (SE)
spvcm.both.SESMA # response-level SE, region-level spatial moving average
spvcm.both.SMASE # response-level SMA, ... |
Neuroglycerin/neukrill-net-work | notebooks/model_modifications/Fewer convolutional channels and no dropout experiment (large).ipynb | mit | tr = np.array(model.monitor.channels['valid_y_y_1_nll'].time_record) / 3600.
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(model.monitor.channels['valid_y_y_1_nll'].val_record)
ax1.plot(model.monitor.channels['train_y_y_1_nll'].val_record)
ax1.set_xlabel('Epochs')
ax1.legend(['Valid', 'Train'])
ax1.set_ylabel(... |
rsterbentz/phys202-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... |
pdh21/XID_plus | docs/notebooks/examples/bayesian_hierarchical_linear_regression.ipynb | mit | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
train = pd.read_csv('https://gist.githubusercontent.com/ucals/'
'2cf9d101992cb1b78c2cdd6e3bac6a4b/raw/'
'43034c39052dcf97d4b894d2ec1bc3f90f3623d9/'
'osic_pulmonary_fi... |
vahidpartovinia/pythonworkshop | jupyter/chapter05.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pylab as plt
%matplotlib inline
np.random.seed(0)
n = 100
X = np.vstack((np.random.multivariate_normal([0,0], [[1, 0], [0, 1]], n),
np.random.multivariate_normal([3, 3], [[1, 0], [0, 1]] , n)))
#Y =np.array([0] * n + [1] * n)
#There is no data label
plt.scatter(X[:,0]... |
piojanu/AtariAI | pg_pong/doc/jupyter/Presentation part 2 - Policy Gradient.ipynb | gpl-3.0 | import gym
env = gym.make('Pong-v0').unwrapped
observation = env.reset()
while True:
env.render()
observation, reward, done, _ = env.step(action)
# Record reward for future training
policy.rewards.append(reward)
reward_sum += reward
"""
Explanation: Reinforcement Learning with Policy Gradien... |
decisionstats/pythonfordatascience | Hierarchical+Clustering (1).ipynb | apache-2.0 | import numpy as np
from numpy import genfromtxt
data = genfromtxt('http://www.biz.uiowa.edu/faculty/jledolter/DataMining/protein.csv',delimiter=',',names=True,dtype=float)
"""
Explanation: Proteins example recreated in python from
https://rstudio-pubs-static.s3.amazonaws.com/33876_1d7794d9a86647ca90c4f182df93f0e8.htm... |
brettavedisian/phys202-2015-work | assignments/assignment06/InteractEx05.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display, SVG
"""
Explanation: Interact Exercise 5
Imports
Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.
En... |
ejolly/pymer4 | docs/auto_examples/example_05_misc_stats.ipynb | mit | # Import numpy and set random number generator
import numpy as np
np.random.seed(10)
# Import stats functions
from pymer4.stats import perm_test
# Generate two samples of data: X (M~2, SD~10, N=100) and Y (M~2.5, SD~1, N=100)
x = np.random.normal(loc=2, size=100)
y = np.random.normal(loc=2.5, size=100)
# Between gro... |
kgullikson88/keras_notebooks | notebooks/Nietzsche_lstm.ipynb | mit | # Imports
from __future__ import print_function
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.layers import LSTM
from keras.utils.data_utils import get_file
import numpy as np
import random
import sys
"""
Explanation: LSTM text generation from Nietzsche's writings
T... |
Olsthoorn/IHE-python-course-2017 | exercises/May09/comprehensions.ipynb | gpl-2.0 | from pprint import pprint
import numpy as np
"""
Explanation: <figure>
<IMG SRC="../../logo/logo.png" WIDTH=250 ALIGN="right">
</figure>
IHE Python course, 2017
List, dict and set comprehensions, list generators and filtering using a key function
T.N.Olsthoorn, Feb2017
List comprehensions (listcomps) dict comprehen... |
mfaytak/image-pca | echob-data-demo.ipynb | bsd-2-clause | import os
import numpy as np
import matplotlib.pyplot as plt
from ultratils.rawreader import RawReader
% matplotlib inline
"""
Explanation: EchoB binary data: unpacking, cleaning, manipulating
It is possible to directly extract and manipulate the data output by the Telemed Echo Blaster (EchoB), rather than making use ... |
CyberCRI/dataanalysis-herocoli-redmetrics | v1.52.2/Tests/8.1 RM-GF correlations tests.ipynb | cc0-1.0 | %run "../Functions/8. RM-GF correlations.ipynb"
allData = allDataPlaytestPhase1PretestPosttestUniqueProfilesVolunteers.copy()
"""
Explanation: 8.1 RM-GF correlations tests
End of explanation
"""
#def getScoresOnQuestionsFromAllData(allData, Qs):
"""
Explanation: Correlation between max chapter and answers
method 1... |
eds-uga/csci1360e-su17 | assignments/A1/A1_Q3.ipynb | mit | def reverse_list(inlist):
reverse = []
### BEGIN SOLUTION
### END SOLUTION
return reverse
t1 = [1, 2, 3]
t2 = [3, 2, 1]
assert set(t2) == set(reverse_list(t1))
t1 = [2, 6, 52, 64, 3.4, "something", 3, 6.2]
t2 = [6.2, 3, "something", 3.4, 64, 52, 6, 2]
assert set(t1) == set(reverse_list(t2))... |
materialsvirtuallab/matgenb | notebooks/2013-01-01-Molecule.ipynb | bsd-3-clause | from pymatgen.core import Molecule
# Create a methane molecule.
coords = [[0.000000, 0.000000, 0.000000],
[0.000000, 0.000000, 1.089000],
[1.026719, 0.000000, -0.363000],
[-0.513360, -0.889165, -0.363000],
[-0.513360, 0.889165, -0.363000]]
mol = Molecule(["C", "H", "H", "H", "H"]... |
mne-tools/mne-tools.github.io | 0.19/_downloads/e1c688e612e75986f5dc98445428685b/plot_mne_inverse_coherence_epochs.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import (apply_inverse, apply_inverse_epochs,
read_inverse_operator)
from mne.connectivity import seed_target_indices, spec... |
mhdella/scipy_2015_sklearn_tutorial | notebooks/03.5 Case Study - SMS Spam Detection.ipynb | cc0-1.0 | import os
with open(os.path.join("datasets", "smsspam", "SMSSpamCollection")) as f:
lines = [line.strip().split("\t") for line in f.readlines()]
text = [x[1] for x in lines]
y = [x[0] == "ham" for x in lines]
text[:10]
y[:10]
type(text)
type(y)
from sklearn.cross_validation import train_test_split
text_train,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.