repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
banyh/ShareIPythonNotebook | NLP_With_Python/Ch8.ipynb | gpl-3.0 | import nltk
from nltk import CFG
# 也可以將grammar存在檔案中,透過
# nltk.data.load('file:mygrammar.cfg')
# 來讀取
grammar1 = CFG.fromstring("""
S -> NP VP
VP -> V NP | V NP PP
PP -> P NP
V -> "saw" | "ate" | "walked"
NP -> "John" | "Mary" | "Bob" | Det N | Det N PP
Det -> "a" | "an" | "the" | "my"
N -... |
agile-geoscience/notebooks | To_make_a_wedge.ipynb | apache-2.0 | import numpy as np
from scipy.signal import ricker
import matplotlib.pyplot as plt
% matplotlib inline
"""
Explanation: To make a wedge
Make a wavelet, or import one from SciPy
End of explanation
"""
n_samples, n_traces = [600,500]
rock_grid = np.zeros((n_samples, n_traces))
def make_wedge(n_sampless, n_traces, la... |
WNoxchi/Kaukasos | FAI_old/Lesson7/TheanoRNN_PythonRNN_TheanoGRU.ipynb | mit | import theano
import os, sys
sys.path.insert(1, os.path.join('../utils'))
from utils import *
# %matplotlib inline
from __future__ import division, print_function
path = get_file('nietzsche.txt', origin="https://s3.amazonaws.com/text-datasets/nietzsche.txt")
text = open(path).read()
print('corpus length:', len(text))
... |
silburt/rebound2 | ipython_examples/OrbitalElements.ipynb | gpl-3.0 | import rebound
sim = rebound.Simulation()
sim.add(m=1., x=1., vz = 2.)
"""
Explanation: Orbital Elements
We can add particles to a simulation by specifying cartesian components:
End of explanation
"""
sim.add(m=1., a=1.)
sim.status()
"""
Explanation: Any components not passed automatically default to 0. REBOUND ca... |
watsonyanghx/CS231n | assignment1/knn.ipynb | mit | # Run some setup code for this notebook.
import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.... |
datactive/bigbang | examples/git-analysis/Git Commit Network.ipynb | mit | %matplotlib inline
from bigbang.archive import Archive
from bigbang.analysis import repo_loader;
from bigbang.ingress.git_repo import GitRepo;
import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
repo = GitRepo("..") #couldn't get get_repo to work, using the parent directory, bigbang itself, for d... |
hide-tono/python-training | python-machine-learning/ch04/ch04.ipynb | apache-2.0 | import pandas as pd
from io import StringIO
print('---欠測値を含むデータ---')
csv_data = '''A,B,C,D
1.0,2.0,3.0,4.0
5.0,6.0,,8.0
10.0,11.0,12.0,'''
df = pd.read_csv(StringIO(csv_data))
print(df)
print('---欠測値のカウント---')
print(df.isnull().sum())
"""
Explanation: 欠測データへの対処
ほとんどの計算ツールは欠測値に対処できないか、予期せぬ動作をする。
下記が欠測データの例
End of e... |
indirectlylit/whattowatch | data-utils/extract_data.ipynb | mit | import json
movie_data = []
with open('download/movies.json') as f:
movie_data.extend(json.load(f)['movies'])
with open('download/more_movies.json') as f:
movie_data.extend(json.load(f)['movies'])
len(movie_data)
sorted(movie_data[1].keys())
requiredFields = set([
'id',
'links',
'mpaa_ratin... |
blue-yonder/tsfresh | notebooks/advanced/visualize-benjamini-yekutieli-procedure.ipynb | mit | %matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from tsfresh.examples.robot_execution_failures import download_robot_execution_failures, load_robot_execution_failures
from tsfresh import defaults, extract_features
from tsfresh.feature_selection.relevance imp... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_tf_lcmv.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import compute_covariance
from mne.datasets import sample
from mne.event import make_fixed_length_events
from mne.beamformer import tf_lcmv
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = sample.data_path... |
biota/sourcetracker2 | ipynb/Sourcetracking using a Gibbs Sampler.ipynb | bsd-3-clause | table = pd.DataFrame(data=[[0, 10, 100], [3, 6, 9]],
columns=['F1', 'F2', 'F3'],
index=['Source1', 'Source2'])
table
"""
Explanation: This notebook explains the theory behind microbial sourcetracking using a Gibb's sampler.
The theory and examples are based on work detailed ... |
xiongzhenggang/xiongzhenggang.github.io | AI/ML/week3多类逻辑回归和前馈神经网络.ipynb | gpl-3.0 | # 这是一个MATLAB格式的.m文件,其中包含5000个20*20像素的手写字体图像,以及他对应的数字。另外,数字0的y值,对应的是10 用Python读取我们需要使用SciPy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from scipy.io import loadmat
from sklearn.metrics import classification_report#这个包是评价报告
data = loadmat('../data/andrew_ml_ex33507/ex3data1.... |
Ccaccia73/semimonocoque | 01_SemiMonoCoque.ipynb | mit | from pint import UnitRegistry
import sympy
import networkx as nx
#import numpy as np
import matplotlib.pyplot as plt
#import sys
%matplotlib inline
#from IPython.display import display
"""
Explanation: Semi-Monocoque Theory
End of explanation
"""
from Section import Section
"""
Explanation: Import Section class, wh... |
SubhankarGhosh/NetworkX | 2. Network(X) Basics (Instructor).ipynb | mit | G = cf.load_seventh_grader_network()
"""
Explanation: Nodes and Edges: How do we represent relationships between individuals using NetworkX?
As mentioned earlier, networks, also known as graphs, are comprised of individual entities and their representatives. The technical term for these are nodes and edges, and when w... |
jrbourbeau/cr-composition | notebooks/legacy/lightheavy/effective-area.ipynb | mit | %load_ext watermark
%watermark -u -d -v -p numpy,matplotlib,scipy,pandas,sklearn,mlxtend
"""
Explanation: <a id='top'> </a>
Author: James Bourbeau
End of explanation
"""
%matplotlib inline
from __future__ import division, print_function
from collections import defaultdict
import numpy as np
from scipy import optimiz... |
cuttlefishh/emp | code/04-subsets-prevalence/subset_samples_by_empo_and_study.ipynb | bsd-3-clause | %matplotlib inline
# make all necessary imports
import pandas as pd
import numpy as np
import sys
import random
import seaborn as sn
import matplotlib.pyplot as plt
import os
from commons import empo3_to_color
"""
Explanation: Author: stefan.m.janssen@gmail.com<br>
Date: 27 Dec 2016<br>
language: Python 3.5<br>
conda... |
DoWhatILove/turtle | programming/python/notebooks/scikit/clustering/plot_stock_market.ipynb | mit | print(__doc__)
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import datetime
import numpy as np
import matplotlib.pyplot as plt
try:
from matplotlib.finance import quotes_historical_yahoo_ochl
except ImportError:
# quotes_historical_yahoo_ochl was named quotes_historical_yah... |
keras-team/keras-io | examples/vision/ipynb/mixup.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras import layers
"""
Explanation: MixUp augmentation for image classification
Author: Sayak Paul<br>
Date created: 2021/03/06<br>
Last modified: 2021/03/06<br>
Description: Data augmentation using the mixup technique for imag... |
GoogleCloudPlatform/training-data-analyst | self-paced-labs/vertex-ai/vertex-pipelines/kfp/lab_exercise.ipynb | apache-2.0 | # Add installed depedencies to Python PATH variable.
PATH=%env PATH
%env PATH={PATH}:/home/jupyter/.local/bin
PROJECT_ID = !(gcloud config get-value core/project)
PROJECT_ID = PROJECT_ID[0]
REGION = 'us-central1'
BQ_DATASET_NAME = 'chicago_taxi'
BQ_TABLE_NAME = 'chicago_taxi_tips_raw'
BQ_LOCATION = 'US'
!echo {PROJE... |
marionleborgne/nupic.research | projects/neural_correlations/EXP3-NYCTaxi/NeuCorr_Exp3.ipynb | agpl-3.0 | import numpy as np
import random
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
from nupic.encoders import ScalarEncoder
from nupic.bindings.algorithms import TemporalMemory as TM
from nupic.bindings.algorithms import SpatialPooler as SP
from htmresearch.support.neural_corr... |
daviddesancho/BestMSM | example/fourstate/parallelpathways.ipynb | gpl-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import parallel
import itertools
import networkx as nx
import numpy as np
bhs = parallel.Parallel()
"""
Explanation: Parallel pathways model
We give another go at the estimation of highest flux paths using a slightly more complicated model involving six states. I adap... |
maxhutch/sem | BDFEX_mixing.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets.widgets import interact
from scipy.optimize import minimize
from scipy.optimize import basinhopping
"""
Explanation: Analysis of mixed BDF/EX time integration
End of explanation
"""
bdf1 = np.array([ 1., - 1., 0., 0., 0., ... |
hankcs/HanLP | plugins/hanlp_demo/hanlp_demo/zh/sts_stl.ipynb | apache-2.0 | !pip install hanlp -U
"""
Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2>
<div align="center">
<a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/sts_stl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Ope... |
dh7/ML-Tutorial-Notebooks | tf-MDN.ipynb | bsd-2-clause | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import math
def tf_assert_shape(tensors, requested_shape):
if not type(tensors) is list:
tensors = [tensors]
for tensor in tensors:
shape = tensor.get_shape().as_list()
error_msg = 'Tensor {} has shape {} while shape {}... |
jrg365/gpytorch | examples/03_Multitask_Exact_GPs/Batch_Independent_Multioutput_GP.ipynb | mit | import math
import torch
import gpytorch
from matplotlib import pyplot as plt
%matplotlib inline
"""
Explanation: Batch Independent Multioutput GP
Introduction
This notebook demonstrates how to wrap independent GP models into a convenient Multi-Output GP model.
It uses batch dimensions for efficient computation. Unli... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/statespace_varmax.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/')
dta.index = dta.qtr
dta.index.freq = dta.index.inferred_freq
endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dl... |
sarahmid/programming-bootcamp-v2 | lab1_exercises_ANSWERS.ipynb | mit | print "what's", "up"
print "what's" + "up"
print "I have", 5, "cats"
print "I have" + 5 + "cats"
print 9 - 6 * 2
print (9 - 6) * 2
print 24 % 6
print 24 % 7
print -3 ** 2
"""
Explanation: Programming Bootcamp 2016
Lesson 1 Exercises -- ANSWER KEY
Notes on using this notebook
Cells with In [] next to them ... |
miguelfrde/stanford-cs231n | assignment3/StyleTransfer-PyTorch.ipynb | mit | import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision
import torchvision.transforms as T
import PIL
import numpy as np
from scipy.misc import imread
from collections import namedtuple
import matplotlib.pyplot as plt
from cs231n.image_utils import SQUEEZENET_MEAN, SQUEEZENET_STD
%m... |
gnestor/jupyter-renderers | notebooks/nteract/vdom.ipynb | bsd-3-clause | display(
{
'application/vdom.v1+json': {
'tagName': 'h1',
'attributes': {
},
'children': 'Welcome to VDOM',
}
},
raw=True
)
"""
Explanation: Declarative layouts
This notebook demonstrates how to use an experimental display type called applicat... |
oroszl/szamprob | notebooks/Package02/feladat02.ipynb | gpl-3.0 | a=[12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717,365435296162, 591286729879,
956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, 17167680177565, 27777890035288,
44945570212853, 72723460248141, 117669030460994]
b=[832040, 1346269, 2... |
materialsproject/MPContribs | mpcontribs-portal/notebooks/contribs.materialsproject.org/experimental_thermo.ipynb | mit | PROJECT = 'Corrections'
"""
Explanation: Move Thermo data from MP Thermo to an MPContribs project
Header
Global variables
End of explanation
"""
import os
from pprint import pprint
from pathlib import Path
import re
from tqdm import tqdm
import numpy as np
import xlrd
from monty.serialization import loadfn, dumpfn
... |
prihandoko/prihandoko.github.io | _pages/learn/python/matriks-slide.ipynb | mit | import numpy as np
"""
Explanation: Matriks dengan Numpy
Matriks dengan Numpy
Numpy, sebagai salah satu library yang saling penting di pemrograman yang menggunakan matematika dan angka, memberikan kemudahan dalam melakukan operasi aljabar matriks. Bila deklarasi array a = [[1,0],[0,1]] memberikan array 2D biasa, maka ... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_fdr_stats_evoked.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
from mne.stats import bonferroni_correction, fdr_correction
print(__doc__)
"""
... |
KIPAC/StatisticalMethods | tutorials/demo.ipynb | gpl-2.0 | exec(open('tbc.py').read()) # define TBC and TBC_above
"""
Explanation: Tutorial: Demo
This notebook demonstrates the logistics of completing one of these assignments.
The first things to say is that you cannot complete one of these tutorials if you are viewing it as HTML in a web browser! You will need to be able to ... |
UDST/activitysim | activitysim/examples/example_estimation/notebooks/22_trip_dest.ipynb | bsd-3-clause | import larch # !conda install larch #for estimation
import pandas as pd
import numpy as np
import yaml
import larch.util.excel
import os
"""
Explanation: Estimating Trip Destination Choice
This notebook illustrates how to re-estimate a single model component for ActivitySim. This process
includes running ActivityS... |
YorkUIRLab/eosdb | experiment/textClassifier-master/TopicLSTM.ipynb | lgpl-3.0 | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... |
Kaggle/learntools | notebooks/data_viz_to_coder/raw/tut4.ipynb | apache-2.0 | #$HIDE$
import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
print("Setup Complete")
"""
Explanation: In this tutorial, you'll learn how to create advanced scatter plots.
Set up the notebook
As always, we begin by setting up the codin... |
mne-tools/mne-tools.github.io | 0.17/_downloads/cad32baf0f5636b4797b1120acaa4324/plot_artifacts_correction_ica.ipynb | bsd-3-clause | import numpy as np
import mne
from mne.datasets import sample
from mne.preprocessing import ICA
from mne.preprocessing import create_eog_epochs, create_ecg_epochs
# getting some data ready
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.read_raw_fif(... |
DJMedhaug/code_guild | wk0/notebooks/challenges/primes/primes_challenge.ipynb | mit | def list_primes(n):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Thunder Shiviah. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Implement list_primes(n), which returns a list of primes up to n (inclusive).
Constraints
Test Cases
Algorithm
C... |
jurgjn/relmapping | annot/notebooks/Fig2S3_import_Gu2012.ipynb | gpl-2.0 | #!cd ~/relmapping/wget; wget -m --no-parent https://ars.els-cdn.com/content/image/1-s2.0-S0092867412014080-mmc1.xlsx
fp_ = 'wget/ars.els-cdn.com/content/image/1-s2.0-S0092867412014080-mmc1_B._TS_sites_for_protein_genes.csv'
df_ = pd.read_csv(fp_, skiprows=11)
df_['assigned_to_an_annotation'] = df_['transcript'].map(lam... |
jonathf/chaospy | docs/user_guide/main_usage/problem_formulation.ipynb | mit | import numpy
coordinates = numpy.linspace(0, 10, 1000)
def model_solver(parameters):
"""
Simple ordinary differential equation solver.
Args:
parameters (numpy.ndarray):
Hyper-parameters defining the model initial
conditions alpha and growth rate beta.
Assumed ... |
jacobjma/PyQSTEM | examples/HRTEM_dft.ipynb | gpl-3.0 | from __future__ import print_function
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib as mpl
from ase.io import read
from pyqstem.util import atoms_plot
from pyqstem import PyQSTEM
from pyqstem.potentials import poisson_solv... |
CtheDataIO-sdpenaloza/Kaggle-Titanic-Machine-Learning-from-Disaster | Manual-Titanic/.ipynb_checkpoints/Kaggle - Titanic - Manual-checkpoint.ipynb | gpl-3.0 | # Imports for pandas, and numpy
import numpy as np
import pandas as pd
# imports for seaborn to and matplotlib to allow graphing
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="whitegrid")
%matplotlib inline
# import Titanic CSV - NOTE: adjust file path as neccessary
dTitTrain_DF = pd.read_csv... |
WNoxchi/Kaukasos | FAI_old/lesson2/L2HW.ipynb | mit | import keras
# Constants
Num_Classes = Num_Classes
batch_size = 4
lr = 0.01
# Helper Functions
# get_batches(..) copied from utils.py
# gen.flow_from_directory() is an iterator that yields batches of images
# from a directory indefinitely.
from keras.preprocessing import image
def get_batches(dirname, gen=image.Imag... |
Krastanov/cutiepy | examples/Schroedinger_Equation_Solver_Examples-vs-qutip.ipynb | bsd-3-clause | from cutiepy import *
import qutip
import numpy as np
cutiepy.interactive.INTERACTIVE = False
"""
Explanation: Table of Contents
Rabi Oscillations
Jaynes-Cummings Revival
End of explanation
"""
#setup
ω0 = 1
Δ = 0.002
Ω = 0.005
ts = 2*np.pi/Ω*np.linspace(0,1,40)
#cutiepy
initial_state = basis(2, 0)
H = ω0/2 * sigm... |
BeyondTheClouds/enoslib | docs/tutorials/jupyter_integration/index.ipynb | gpl-3.0 | import logging
from pathlib import Path
import enoslib as en
logging.basicConfig(level=logging.INFO)
job_name = "♥JupEnOS♥"
prod_network = en.G5kNetworkConf(id="n1", type="prod", roles=["my_network"], site="rennes")
conf = (
en.G5kConf.from_settings(job_name=job_name, job_type="allow_classic_ssh")
.add_net... |
peastman/deepchem | examples/tutorials/Generating_molecules_with_MolGAN.ipynb | mit | !pip install --pre deepchem
import deepchem
deepchem.__version__
"""
Explanation: Generating Molecules with MolGAN
In this tutorial, we will train a MolGAN network on the tox21 dataset which is a dataset of 12,060 training samples and 647 test samples of chemical compounds. The MolGAN network was first introduced in "... |
lukasmerten/CRPropa3 | doc/pages/example_notebooks/density/density_easy_example.ipynb | gpl-3.0 | from crpropa import *
"""
Explanation: First example code for use of densities
All densities are seperated in atomic hydrogen (HI), ioninised hydrogen (HII), and molecular hydrogen (H2).
This example contains
* constant densities
* superposition of different types
* superposition of same types
Further on, there is a... |
xpharry/Udacity-DLFoudation | your-first-network/dlnd-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... |
oscarmore2/deep-learning-study | 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... |
google/eng-edu | ml/cc/exercises/linear_regression_with_synthetic_data.ipynb | apache-2.0 | #@title Run this Colab on TensorFlow 2.x
%tensorflow_version 2.x
"""
Explanation: Simple Linear Regression with Synthetic Data
In this first Colab, you'll explore linear regression with a simple database.
Learning objectives:
After doing this exercise, you'll know how to do the following:
Run Colabs.
Tune the follow... |
ES-DOC/esdoc-jupyterhub | notebooks/ncar/cmip6/models/sandbox-1/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-1', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NCAR
Source ID: SANDBOX-1
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
mjabri/holoviews | doc/Tutorials/Introduction.ipynb | bsd-3-clause | import holoviews as hv
%reload_ext holoviews.ipython
"""
Explanation: Welcome to HoloViews!
This tutorial explains the basics of how to use HoloViews to explore your data. If this is your first contact with HoloViews, you may want to start by looking at our showcase to get a good idea of what can be achieved with Holo... |
intel-analytics/analytics-zoo | apps/image-augmentation/image-augmentation.ipynb | apache-2.0 | from zoo.common.nncontext import init_nncontext
from zoo.feature.image import *
import cv2
import numpy as np
from IPython.display import Image, display
sc = init_nncontext("Image Augmentation Example")
"""
Explanation: Image Augmentation
Image Augmentation augments datasets (especially small datasets) to train model.... |
samstav/scipy_2015_sklearn_tutorial | notebooks/02.4 Unsupervised Learning - Clustering.ipynb | cc0-1.0 | from sklearn.datasets import make_blobs
X, y = make_blobs(random_state=42)
X.shape
plt.scatter(X[:, 0], X[:, 1])
"""
Explanation: Clustering
Clustering is the task of gathering samples into groups of similar
samples according to some predefined similarity or dissimilarity
measure (such as the Euclidean distance).
In ... |
mayank-johri/LearnSeleniumUsingPython | Section 1 - Core Python/Chapter 05 - Data Types/5.2 Advance Data Types.ipynb | gpl-3.0 | import collections
# from collections import ChainMap
a = {'a': 'A', 'c': 'C'}
b = {'b': 'B', 'c': 'D'}
m = collections.ChainMap(a, b)
print('Individual Values')
print('a = {}'.format(m['a']))
print('b = {}'.format(m['b']))
print('c = {}'.format(m['c']))
print("-"*20)
print(type(m.keys()))
print('Keys = {}'.format(... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/SDK_Tabular_Custom_Model_Training_asynchronous.ipynb | apache-2.0 | !pip3 uninstall -y google-cloud-aiplatform
!pip3 install google-cloud-aiplatform
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
"""
Explanation: Feedback or issues?
For any feedback or questions, please open an issue.
Vertex SDK for Python: Custom Tabular Training (asynchronous) Exam... |
pyro-ppl/numpyro | notebooks/source/bad_posterior_geometry.ipynb | apache-2.0 | !pip install -q numpyro@git+https://github.com/pyro-ppl/numpyro
from functools import partial
import numpy as np
import jax.numpy as jnp
from jax import random
import numpyro
import numpyro.distributions as dist
from numpyro.diagnostics import summary
from numpyro.infer import MCMC, NUTS
assert numpyro.__version_... |
msanterre/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... |
Migal/opt_ctrl_lab_1 | lab_1/tests/lab_1_test_2.ipynb | bsd-3-clause | # Плотность источников тепла
def func(s, t):
#return 0.
return s + t * 4.
# Температура внешней среды
def p(t):
return math.cos(2 * t * math.pi)
#return t
def array(f, numval, numdh):
"""Создать N-мерный массив.
param: f - функция, которая приминает N аргументов.
param: numval... |
batfish/pybatfish | jupyter_notebooks/Pandas Examples.ipynb | apache-2.0 | # Import packages
%run startup.py
bf = Session(host="localhost")
# Initialize a network and a snapshot
bf.set_network("pandas-example")
SNAPSHOT_NAME = "snapshot"
SNAPSHOT_PATH = "networks/hybrid-cloud/"
bf.init_snapshot(SNAPSHOT_PATH, name=SNAPSHOT_NAME, overwrite=True)
"""
Explanation: Pandas Examples
Batfish ques... |
austinjalexander/sandbox | python/py/nanodegree/intro_ds/final_project/IntroDS-ProjectOne-Section2-first_submitted.ipynb | mit | import numpy as np
import pandas as pd
import scipy as sp
import scipy.stats as st
import statsmodels.api as sm
import scipy.optimize as op
import matplotlib.pyplot as plt
%matplotlib inline
filename = '/Users/excalibur/py/nanodegree/intro_ds/final_project/improved-dataset/turnstile_weather_v2.csv'
# import data
dat... |
ES-DOC/esdoc-jupyterhub | notebooks/pcmdi/cmip6/models/sandbox-1/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-1', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: PCMDI
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Ra... |
mne-tools/mne-tools.github.io | 0.20/_downloads/17295dea468fcedae97ed8a6f9afc520/plot_decoding_csp_timefreq.ipynb | bsd-3-clause | # Authors: Laura Gwilliams <laura.gwilliams@nyu.edu>
# Jean-Remi King <jeanremi.king@gmail.com>
# Alex Barachant <alexandre.barachant@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne import... |
miykael/nipype_tutorial | notebooks/basic_function_interface.ipynb | bsd-3-clause | # Create a small example function
def add_two(x_input):
return x_input + 2
"""
Explanation: Function Interface
Satra once called the Function module, the "do anything you want card". Which is a perfect description. Because it allows you to put any code you want into an empty node, which you then can put in your wo... |
smharper/openmc | examples/jupyter/pandas-dataframes.ipynb | mit | import glob
from IPython.display import Image
import matplotlib.pyplot as plt
import scipy.stats
import numpy as np
import pandas as pd
import openmc
%matplotlib inline
"""
Explanation: This notebook demonstrates how systematic analysis of tally scores is possible using Pandas dataframes. A dataframe can be automati... |
unnati-xyz/intro-python-data-science | onion/2-Acquire.ipynb | mit | # Import the library we need, which is Pandas
import pandas as pd
# Read all the tables from the html document
AllTables = pd.read_html('MonthWiseMarketArrivalsJan2016.html')
# Let us find out how many tables has it found?
len(AllTables)
"""
Explanation: 2. Acquire the Data
Finding Data Sources
There are three plac... |
kunbud1989/scraping-google-news-indonesia | 1_Scraping_Google_News_Indonesia.ipynb | mit | from bs4 import BeautifulSoup
import requests
import time
import datetime
google_news = '''https://news.google.com/?authuser=0&ned=en_id'''
def scrape_news_summaries():
news_summaries = []
time.sleep(2) # setting sleep 2 detik
r = requests.get(str(google_news))
content = r.text
soup = Beauti... |
RaoUmer/lightning-example-notebooks | plots/matrix.ipynb | mit | from lightning import Lightning
from numpy import random, arange, asarray, corrcoef, argsort, array
import networkx as nx
from sklearn import datasets
"""
Explanation: <img style='float: left' src="http://lightning-viz.github.io/images/logo.png"> <br> <br> Matrix plots in <a href='http:/... |
mmckerns/tuthpc | mpi.ipynb | bsd-3-clause | %%file hellompi.py
"""
Parallel Hello World
"""
from mpi4py import MPI
import sys
size = MPI.COMM_WORLD.Get_size()
rank = MPI.COMM_WORLD.Get_rank()
name = MPI.Get_processor_name()
sys.stdout.write(
"Hello, World! I am process %d of %d on %s.\n"
% (rank, size, name))
"""
Explanation: MPI and cluster computi... |
python-control/python-control | examples/describing_functions.ipynb | bsd-3-clause | import control as ct
import numpy as np
import matplotlib.pyplot as plt
import math
"""
Explanation: Describing function analysis
Richard M. Murray, 27 Jan 2021
This Jupyter notebook shows how to use the descfcn module of the Python Control Toolbox to perform describing function analysis of a nonlinear system. A brie... |
Kuni88/tutorial_python | text/Chapter4.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# matplotlibの表示をJupyter内で行うための「おまじない」
X = np.linspace(-np.pi, np.pi, 256, endpoint=True)
plt.plot(X, np.cos(X))
plt.plot(X, np.sin(X))
plt.figure(figsize=(8,6), dpi=80) # リサイズ
plt.xlim(-np.pi, np.pi) # x軸方向の最大値,最小値を決める
plt.xticks( [-np.pi, -np.pi... |
mne-tools/mne-tools.github.io | stable/_downloads/da9f4c4e77e7268fbe1384cfc1b249a5/70_eeg_mri_coords.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import nibabel
from nilearn.plotting import plot_glass_brain
import numpy as np
import mne
from mne.channels import compute_native_head_t, read_custom_montage
from mne.viz import plot_alignment
"""
Explanation: EEG sourc... |
Yu-Group/scikit-learn-sandbox | jupyter/backup_deprecated_nbs/23_wrapper_function_refined.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from sklearn.datasets import load_breast_cancer
import numpy as np
from functools import reduce
# Needed for the scikit-learn wrapper function
from sklearn.utils import resample
from sklearn.ensemble import RandomForestClassifier
from math import ceil
# Import our c... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-3/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-3', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-3
Topic: Atmos
Sub-Topics: Dynamical... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/Vertex_AI_SDK_AutoML_Forecasting_Model_Training_Example.ipynb | apache-2.0 | %%capture
!pip3 uninstall -y google-cloud-aiplatform
!pip3 install google-cloud-aiplatform
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
import sys
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()
"""
Explanation: Vertex AI SDK f... |
adaptive-learning/flocs | analysis/demo/demo.ipynb | gpl-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""
Explanation: Flocs Data Demo
How to Export Data
Both static and collected data can be exported by command make export-data-to-csv.
This command creates CSV tables for all models registered in flocs/management/commands/export_... |
LorenzoBi/courses | TSAADS/tutorial 9/.ipynb_checkpoints/9_LORENZO_BIASI_JULIUS_VERNIE-checkpoint.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
%matplotlib inline
def sigmoid(x):
return 1. / (1 + np.exp(-x))
def df(x, w=0, theta=0):
return w * sigmoid(x) * (1 - sigmoid(x))
def f(x, w=0, theta=0):
return w * sigmoid(x) + theta
def g(x, w, theta):
return f(x,... |
quantumlib/Cirq | cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb | apache-2.0 | import cirq
import numpy as np
import pandas as pd
from cirq.contrib.svg import SVGCircuit
import cirq.contrib.quimb as ccq
import quimb
import quimb.tensor as qtn
"""
Explanation: Cirq to Tensor Networks
Here we demonstrate turning circuits into tensor network representations of the circuit's unitary, final state ve... |
megatharun/basic-python-for-researcher | Tutorial 4 - The Sequence.ipynb | artistic-2.0 | List_num = [1,2,3,4,5]
print List_num
E = len(List_num)
print "There's %d elements in the list %s" % (E,List_num)
"""
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">4. The Sequence</span>
... |
mjabri/holoviews | doc/Tutorials/Composing_Data.ipynb | bsd-3-clause | import numpy as np
import holoviews as hv
%reload_ext holoviews.ipython
np.random.seed(10)
def sine_curve(phase, freq, amp, power, samples=102):
xvals = [0.1* i for i in range(samples)]
return [(x, amp*np.sin(phase+freq*x)**power) for x in xvals]
phases = [0, np.pi/2, np.pi, 3*np.pi/2]
powers = [1,... |
mtetkosk/European_Soccer_Prediction | notebooks/Combined_Error_Metric_Simulation.ipynb | mit | def ComputeErrorMetric(y_true,y_pred):
df = pd.DataFrame({'y_true':y_true, 'y_pred':y_pred})
# home_wins
hw_fp = ((df.y_true != 1) & (df.y_pred == 1))
hw_tp = ((df.y_true == 1) & (df.y_pred == 1))
hw_fn = ((df.y_true == 1) & (df.y_pred != 1))
hw_tn = ((df.y_true != 1) & (df.y_pred != 1))
... |
myfunprograms/deep_learning | project3/files/dlnd_tv_script_generation.ipynb | gpl-3.0 | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
AutuanLiu/Python | nbs/pathlib_glob.ipynb | mit | # 多行结果输出支持
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
from pathlib import Path, PurePath, PureWindowsPath
# 查看目录下的内容
p = Path('..')
[x for x in p.iterdir() if x.is_dir()]
# 所有的notebook文件
list(p.glob('**/*.ipynb'))
# 切换目录
dir1 = p / 'python'
dir1
# 获取绝... |
QuantEcon/rvlib | .ci/gitcount.ipynb | bsd-3-clause | # get date of last tag
from subprocess import Popen, PIPE
x, err = Popen('git log -1 --tags --simplify-by-decoration --pretty="%ai"| cat', stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True).communicate()
start_date = x.split()[0].decode('utf-8')
# today's date
import datetime
release_date = str(datetime.datetime.toda... |
opengeostat/pygslib | pygslib/Ipython_templates/.ipynb_checkpoints/gam_raw-checkpoint.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
#make the plots inline
%matplotlib inline
"""
Explanation: PyGSLIB
Introduction
This is a simple example on how to use raw pyslib to compute variograms with gridded data
End of explanation
"""
#get the data in GSLIB format into a pandas Da... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/hadgem3-gc31-hh/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'hadgem3-gc31-hh', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NERC
Source ID: HADGEM3-GC31-HH
Topic: Aerosol
Sub-Topics: Transport, Emis... |
davidgasquez/kaggle-airbnb | notebooks/Preprocessing.ipynb | mit | import numpy as np
import pandas as pd
"""
Explanation: Preprocessing
End of explanation
"""
train_users = pd.read_csv('../data/train_users_sample.csv')
test_users = pd.read_csv('../data/test_users_sample.csv')
sessions = pd.read_csv('../data/sessions_sample.csv')
"""
Explanation: Load the data, in this case a samp... |
FlavioBaccari/Hierarchy-for-nonlocality-detection | Notebook.ipynb | gpl-3.0 | from __future__ import print_function, division
from math import sqrt
from qutip import sigmax, sigmaz
from ncpol2sdpa import flatten, SdpRelaxation, generate_variables
from time import time
from sympy import S
from local_tools import generate_commuting_measurements, get_W_reduced, \
get_GHZ_reduced, get_moment_con... |
ffyu/Build-Model-from-Scratch | 4_K_Nearest_Neighbors.ipynb | mit | import numpy as np
import operator
class KNearestNeighbors():
def __init__(self, k, model_type='regression', weights='uniform'):
# model_type can be either 'classification' or 'regression'
# weights = 'uniform', the K nearest neighbors are equally weighted
# weights = 'distance', the K ne... |
tensorflow/docs-l10n | site/ko/r1/tutorials/eager/automatic_differentiation.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... |
upul/Aurora | examples/notebooks/mnist_cnn.ipynb | apache-2.0 | import numpy as np
import timeit
import aurora as au # import Aurora
import aurora.autodiff as ad # importing Aurora's automatic differentiation framework
import matplotlib.pyplot as plt
import seaborn as sbn
sbn.set()
BATCH_SIZE = 64
LR = 1e-4
USE_GPU = False
NUM_ITERS = 20
# utility functions
def display_images(i... |
agaveapi/SC17-container-tutorial | content/notebooks/03 - Hands on with Agave.ipynb | bsd-3-clause | !mkdir -p ~/agave
%cd ~/agave
!pip3 install --upgrade setvar
import re
import os
import sys
import json
from setvar import *
from time import sleep
# This cell enables inline plotting in the notebook
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
loadvar()
"""
Explanation:... |
myinxd/agn-ae | cae-tensorflow-ft/Tree_feature_tSNE_cmp.ipynb | mit | # l1
fname = "code_l1.pkl"
with open(os.path.join(folder,fname), 'rb') as fp:
dict_l1 = pickle.load(fp)
# Extract FR0s
code_l1 = dict_l1["code"]
label_l1 = dict_l1["label"]
idx_fr0 = np.where(label_l1 == 0)[0]
code_fr0 = code_l1[idx_fr0,:]
label_fr0 = label_l1[idx_fr0] + 1
"""
Explanation: load features
End of exp... |
timothyb0912/pylogit | examples/notebooks/Asymmetric Choice Models Example.ipynb | bsd-3-clause | from collections import OrderedDict # For recording the model specification
import pandas as pd # For file input/output
import numpy as np # For vectorized math operations
import pylogit as pl # For MNL model estimation and
... |
wesleyegberto/courses-projects | ia/machine-learning-aprendizado-supervisionado/626-Aula2.ipynb | apache-2.0 | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import numpy as np
"""
Explanation: Aula 2 Video 1 - A regressão linear múltipla
End of explanation
"""
movies = pd.read_csv('datasets/movies_multilinear_reg.csv')
type(movies)
movies.head(10... |
DominikDitoIvosevic/Uni | STRUCE/2018/.ipynb_checkpoints/SU-2017-LAB01-Regresija-checkpoint.ipynb | mit | # Učitaj osnovne biblioteke...
import numpy as np
import sklearn
import matplotlib.pyplot as plt
%pylab inline
"""
Explanation: Sveučilište u Zagrebu
Fakultet elektrotehnike i računarstva
Strojno učenje 2017/2018
http://www.fer.unizg.hr/predmet/su
Laboratorijska vježba 1: Regresija
Verzija: 1.1
Zadnji put ažurirano... |
awhite40/pymks | notebooks/filter.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Filter Example
This example demonstrates the connection between MKS and signal
processing for a 1D filter. It shows that the filter is in fact the
same as the influence coefficients and, thus, ap... |
CheungChanDevCoder/blog | python/data_analyze/用pandas做数据分析.ipynb | mit | import pandas as pd
x1 = pd.Series([1,2,3,4])
x2 = pd.Series(data=[1,2,3,4], index=['a', 'b', 'c', 'd'])
print("x1".center(100,"*"))
print(x1)
print("x2".center(100,"*"))
print(x2)
d = {'a':1, 'b':2, 'c':3, 'd':4}
x3 = pd.Series(d)
print(x3)
"""
Explanation: 用pandas做数据分析
关于数据分析
根据jetbrains公司2018年对python开发人员的调查, 从事数... |
dspak/ultradata | scripts/hardrock 100 entry model.ipynb | mpl-2.0 | import pandas as pd
import matplotlib.pyplot as plt
import pymc
import numpy as np
from scipy import stats
%matplotlib inline
"""
Explanation: how long until I get into the Hardrock 100?
The Hardrock 100 is a 100-mile footrace through the San Juan mountains of Colorado. It is considered a "post-graduate level" event... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.