repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
jeiranj/gensim
docs/notebooks/deepir.ipynb
gpl-3.0
import re contractions = re.compile(r"'|-|\"") # all non alphanumeric symbols = re.compile(r'(\W+)', re.U) # single character removal singles = re.compile(r'(\s\S\s)', re.I|re.U) # separators (any whitespace) seps = re.compile(r'\s+') # cleaner (order matters) def clean(text): text = text.lower() text = contr...
weikang9009/pysal
notebooks/model/spvcm/using_the_sampler.ipynb
bsd-3-clause
from pysal.model import spvcm as spvcm #package API spvcm.both_levels.Generic # abstract customizable class, ignores rho/lambda, equivalent to MVCM spvcm.both_levels.MVCM # no spatial effect spvcm.both_levels.SESE # both spatial error (SE) spvcm.both_levels.SESMA # response-level SE, region-level spatial moving averag...
batfish/pybatfish
docs/source/notebooks/forwarding.ipynb
apache-2.0
bf.set_network('generate_questions') bf.set_snapshot('generate_questions') """ Explanation: Packet Forwarding This category of questions allows you to query how different types of traffic is forwarded by the network and if endpoints are able to communicate. You can analyze these aspects in a few different ways. Trac...
rishuatgithub/MLPy
nlp/UPDATED_NLP_COURSE/01-NLP-Python-Basics/02-Stemming.ipynb
apache-2.0
# Import the toolkit and the full Porter Stemmer library import nltk from nltk.stem.porter import * p_stemmer = PorterStemmer() words = ['run','runner','running','ran','runs','easily','fairly'] for word in words: print(word+' --> '+p_stemmer.stem(word)) """ Explanation: <a href='http://www.pieriandata.com'> <i...
AkshanshChahal/BTP
Satellite/Try Test Learn.ipynb
mit
import numpy as np import pandas as pd # importing the dataset we prepared and saved using Baseline 1 Notebook ricep = pd.read_csv("/Users/macbook/Documents/BTP/Notebook/BTP/ricep.csv") ricep.head() ricep = ricep.drop(["Unnamed: 0"],axis=1) ricep["phosphorus"] = ricep["phosphorus"]*10 ricep["value"] = ricep["Producti...
mdeff/ntds_2016
toolkit/03_ex_hpc.ipynb
mit
def accuracy_python(y_pred, y_true): """Plain Python implementation.""" num_correct = 0 for y_pred_i, y_true_i in zip(y_pred, y_true): if y_pred_i == y_true_i: num_correct += 1 return num_correct / len(y_true) """ Explanation: A Python Tour of Data Science: High Performance Computin...
jameslao/Algorithmic-Pearls
0-1-Knapsack.ipynb
mit
def knapsack(v, w, limit, n): F = [[0] * (limit + 1) for x in range(n + 1)] for i in range(0, n): # F[-1] is all 0. for j in range(limit + 1): if j >= w[i]: F[i][j] = max(F[i - 1][j], F[i - 1][j - w[i]] + v[i]) else: F[i][j] = F[i -...
dborgesr/Euplotid
pipelines/fq2HiCInts.ipynb
gpl-3.0
annotation="/input_dir/mm9" tmp="/input_dir/" input_dir="/input_dir/" output_dir="/output_dir/" input_fq_1="HiC_mesc_1_1M.fq.gz" input_fq_2="HiC_mesc_2_1M.fq.gz" sample_name="test" bin_size="10000" """ Explanation: Call DNA-DNA interactions using raw HiC data Install instructions for HiCPro required after first image ...
tensorflow/docs-l10n
site/en-snapshot/tensorboard/text_summaries.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...
pycrystem/pycrystem
doc/demos/08 Pair Distribution Function Analysis.ipynb
gpl-3.0
%matplotlib inline import hyperspy.api as hs import pyxem as pxm import numpy as np """ Explanation: PDF Analysis Tutorial Introduction This tutorial demonstrates how to acquire a multidimensional pair distribution function (PDF) from both a flat field electron diffraction pattern and a scanning electron diffraction d...
datosgobar/pydatajson
samples/caso-uso-2-pydatajson-xlsx-justicia-no-valido.ipynb
mit
import arrow import os, sys sys.path.insert(0, os.path.abspath("..")) from pydatajson import DataJson #lib y clase from pydatajson.readers import read_catalog # lib, modulo ... metodo Lle el catalogo -json o xlsx o (local o url) dicc- y lo transforma en un diccionario de python from pydatajson.writers import write_json...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_sensor_regression.ipynb
bsd-3-clause
# Authors: Tal Linzen <linzen@nyu.edu> # Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.stats.regression import linear_regression print(__doc__) data_path = sample.data_path() """ Explanation: Sensor space lea...
shradhaN/python_git_sessiom
Session 4.ipynb
mit
import sqlite3 #import the driver ##psycopg2 for protsgeSQL # pymysql for MySQL conn = sqlite3.connect('example.sqlite3') #connecting to sqlite 3 and makes a new database file if file not already present cur = conn.cursor() #makes a file cursor we can make multiple cursors as well cur.execute('CREATE TABLE countries...
mattilyra/gensim
docs/notebooks/word2vec.ipynb
lgpl-2.1
# import modules & set up logging import gensim, logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) sentences = [['first', 'sentence'], ['second', 'sentence']] # train word2vec on the two sentences model = gensim.models.Word2Vec(sentences, min_count=1) """ Explanation...
Murali-group/2017-ICSB-graphspace-tutorial
session2.ipynb
gpl-3.0
!pip install graphspace_python==0.8.3 """ Explanation: Session 2: Integrating GraphSpace into network analysis projects Presenters: Aditya Bharadwaj, Jeffrey N. Law and T. M. Murali Introduction Required files for today Clone or download this repository: http://bit.ly/2017icsb IPython/Jupyter notebooks Datasets in t...
mlamoureux/PIMS_YRC
Using_Python.ipynb
mit
2+2 2/3 (1+2j)*(2+3j) """ Explanation: Using Python in Jupyter This is a typical notebook in Jupyter. It is organized as a series of cells. Each cell could contain text, code, or some raw format (Raw NBConvert). You can select which type of code you want to run. For this notebook, we are using Python 3. You could ...
DJCordhose/ai
notebooks/tf2/rnn-add-example.ipynb
mit
!pip install -q tf-nightly-gpu-2.0-preview import tensorflow as tf print(tf.__version__) """ Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/tf2/rnn-add-example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C...
mne-tools/mne-tools.github.io
0.18/_downloads/0cd97a6d68ec19255d6658b4ecac3774/plot_artifacts_correction_ssp.ipynb
bsd-3-clause
import numpy as np import mne from mne.datasets import sample from mne.preprocessing import compute_proj_ecg, compute_proj_eog # 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(raw_fname, preload=True) """ Explana...
jhillairet/scikit-rf
doc/source/examples/vectorfitting/vectorfitting_ex2_190ghz_active.ipynb
bsd-3-clause
import skrf import numpy as np import matplotlib.pyplot as mplt """ Explanation: Ex2: Measured 190 GHz Active 2-Port The Vector Fitting feature is demonstrated using a 2-port S-matrix of an active circuit measured from 140 GHz to 220 GHz. Additional explanations and background information can be found in the Vector Fi...
AllenDowney/ModSim
python/soln/examples/wall_soln.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename): from urllib.request import urlretrieve local, _ = urlretrieve...
adityaka/misc_scripts
python-scripts/data_analytics_learn/ipython_notebook_tutorial.ipynb
bsd-3-clause
# Hit shift + enter or use the run button to run this cell and see the results print 'hello world' # The last line of every code cell will be displayed by default, # even if you don't print it. Run this cell to see how this works. 2 + 2 # The result of this line will not be displayed 3 + 3 # The result of this line...
liganega/Gongsu-DataSci
previous/notes2017/old/NB-15-Recursion.ipynb
gpl-3.0
def factorial(n): return n * factorial(n-1) """ Explanation: 재귀함수 이번에 공부할 주제는 재귀(recursion)이다. 재귀는 한자용어로 "본래 있던 곳으로 다시 돌아온다"의 의미를 갖는다. 재귀를 이용하여 구현한 함수를 _재귀함수(recursive function)_라 부른다. 재귀함수 용법 재귀함수를 사용하면 복잡한 코드를 매우 간단하게 구현할 수 있다는 장점이 있다. 하지만 재귀함수를 호출하면 메모리 내부에서 어떤 변화가 어떻게 발생하는가를 이해하는 일이 경우에 따라 간단하지 않다. 또한 시간 및 공...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/end_to_end_ml/solutions/sample_babyweight.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: Creating a Sampled Dataset Learning Objectives Setup up the environment Sample the natality dataset to create train, eval, test sets Preprocess the data in Pandas dataframe Introduct...
coolharsh55/advent-of-code
2016/python3/Day17.ipynb
mit
with open('../inputs/day17.txt', 'r') as f: path_string = f.readline().strip() TEST_DATA = ( 'ihgpwlah', 'kglvqrro', 'ulqzkmiv' ) """ Explanation: Day 17: Two Steps Forward author: Harshvardhan Pandit license: MIT link to problem statement You're trying to access a secure vault protected by a 4x4 grid...
AshivDhondea/SORADSIM
example_notebooks/notebook_005_orbitpropa_sgp4_local_topo_visualization.ipynb
mit
from IPython.display import Image Image(filename='ashivorbit2017.png') # Note that this image belongs to me. I have created it myself. # Load the libraries required # These two are mine import AstroFunctions as AstFn import UnbiasedConvertedMeasurements as UCM import math import numpy as np # Libraries needed for ti...
mathLab/RBniCS
tutorials/17_navier_stokes/tutorial_navier_stokes_1_deim.ipynb
lgpl-3.0
from ufl import transpose from dolfin import * from rbnics import * """ Explanation: Tutorial 17 - Navier Stokes equations Keywords: DEIM, supremizer operator 1. Introduction In this tutorial, we will study the Navier-Stokes equations over the two-dimensional backward-facing step domain $\Omega$ shown below: <img src=...
iutzeler/Introduction-to-Python-for-Data-Sciences
3-2_Dataframes.ipynb
mit
import numpy as np import pandas as pd """ Explanation: <table> <tr> <td width=15%><img src="./img/UGA.png"></img></td> <td><center><h1>Introduction to Python for Data Sciences</h1></center></td> <td width=15%><a href="http://www.iutzeler.org" style="font-size: 16px; font-weight: bold">Franck Iutzeler</a> </td> </tr> ...
chengsoonong/crowdastro
notebooks/35_classifier_analysis.ipynb
mit
import csv import sys import astropy.wcs import h5py import matplotlib.pyplot as plot import numpy import sklearn.metrics sys.path.insert(1, '..') import crowdastro.train CROWDASTRO_H5_PATH = '../data/crowdastro.h5' CROWDASTRO_CSV_PATH = '../crowdastro.csv' TRAINING_H5_PATH = '../data/training.h5' ARCMIN = 1 / 60 %...
remenska/iSDM
notebooks/Demo-Climate-DEM.ipynb
apache-2.0
import logging root = logging.getLogger() root.addHandler(logging.StreamHandler()) import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Reading and manipulating Climate data layers just some logging/plotting magic to output in this notebook, nothing to care about. End of explanation """ from iSDM.envi...
bryanwweber/thermostate
docs/Plot-Tutorial.ipynb
bsd-3-clause
from thermostate import State, Q_, units from thermostate.plotting import IdealGas, VaporDome """ Explanation: Ploting Tutorial This tutorial acts as a guide to the plotting classes in ThermoState. It is designed to ease the creation of simple plots of thermodynamic states and processes for a variety of common substan...
anhaidgroup/py_entitymatching
notebooks/guides/step_wise_em_guides/Performing Blocking Using Built-In Blockers (Sorted Neighborhood Blocker).ipynb
bsd-3-clause
# Import py_entitymatching package import py_entitymatching as em import os import pandas as pd """ Explanation: Contents Introduction Block Using the Sorted Neighborhood Blocker Block Tables to Produce a Candidate Set of Tuple Pairs Handling Missing Values Window Size Stable Sort Order Sorted Neighborhood Blocker Li...
Vvkmnn/books
ThinkBayes/07_Prediction.ipynb
gpl-3.0
def EvalPoissonPmf(k, lam): return (lam)**k * math.exp(-lam) / math.factorial(k) """ Explanation: Prediction The Boston Bruins problem In the 2010-11 National Hockey League (NHL) Finals, my beloved Boston Bruins played a best-of-seven championship series against the despised Vancouver Canucks. Boston lost the firs...
IBMDecisionOptimization/docplex-examples
examples/cp/jupyter/sudoku.ipynb
apache-2.0
import sys try: import docplex.cp except: if hasattr(sys, 'real_prefix'): #we are in a virtual env. !pip install docplex else: !pip install --user docplex """ Explanation: Sudoku This tutorial includes everything you need to set up decision optimization engines, build constraint pro...
JasonNK/udacity-dlnd
dcgan-svhn/DCGAN.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/05_03/Final/Multiple.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: <h1>Multiples Lines, Single Plot</h1> End of explanation """ data_set_size = 15 low_mu, low_sigma = 50, 4.3 low_data_set = low_mu + low_sigma * np.random.randn(data_set_size) high_mu, high_sigma = 57, 5.2 ...
mne-tools/mne-tools.github.io
0.22/_downloads/81308ca6ca6807326a79661c989cfcba/plot_make_report.ipynb
bsd-3-clause
# Authors: Teon Brooks <teon.brooks@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from mne.report import Report from mne.datasets import sample from mne import read_evokeds from matplotlib import pyplot as plt data_path = sample.data_path() meg_path = data_path + '/MEG/sampl...
obestwalter/pet
ipynb/containers.ipynb
mit
aString = "123456" aList = [1, 2.0, 1j, 'hello', [], {}, (1, 2)] aSet = {1, 2.0, 1j, 'hello', (1, 2)} aTuple = (1, 2.0, 1j, 'hello', [], {}, (1, 2)) aDict = { 1: 1, 2.0: 2.0, 1j: 1j, (1, 2): (1, 2), 'hello': 'hello', 'list': [], 'dict': {}, } iterables = [ aString, aList, aSet, ...
mattmcd/PyBayes
scripts/dc_manipulating_time_series.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os import yfinance as yf %matplotlib inline def ddir(name=None): data_dir = 'dc_manipulating_time_series/stock_data/' if name is None: print(os.listdir(data_dir)) else: return os.path.join(d...
telecom-research/crtc-scraper
_code/notebooks/CRTC-Hearing-TextAnalysis.ipynb
mit
# importing code modules import json import ijson from ijson import items import pprint from tabulate import tabulate import matplotlib.pyplot as plt import re import csv import sys import codecs import nltk import nltk.collocations import collections import statistics from nltk.metrics.spearman import * from nltk....
thaophung/Udacity_deep_learning
sentiment-network/.ipynb_checkpoints/Sentiment_Classification_Projects-checkpoint.ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
skaae/Recipes
examples/Using a Caffe Pretrained Network - CIFAR10.ipynb
mit
!wget https://www.dropbox.com/s/blrajqirr1p31v0/cifar10_nin.caffemodel !wget https://gist.githubusercontent.com/ebenolson/91e2cfa51fdb58782c26/raw/b015b7403d87b21c6d2e00b7ec4c0880bbeb1f7e/model.prototxt """ Explanation: Introduction This example demonstrates how to convert a network from Caffe's Model Zoo for use wit...
EmuKit/emukit
notebooks/Emukit-tutorial-sensitivity-montecarlo.ipynb
apache-2.0
# General imports %matplotlib inline import numpy as np import matplotlib.pyplot as plt from matplotlib import colors as mcolors from matplotlib import cm ## Figures config colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) LEGEND_SIZE = 15 TITLE_SIZE = 25 AXIS_SIZE = 15 """ Explanation: Introduction to global...
zerothi/sisl
docs/visualization/viz_module/showcase/GridPlot.ipynb
mpl-2.0
import sisl import sisl.viz import numpy as np # This is just for convenience to retreive files siesta_files = sisl._environ.get_environ_variable("SISL_FILES_TESTS") / "sisl" / "io" / "siesta" """ Explanation: GridPlot GridPlot class will help you very easily display any Grid. <div class="alert alert-info"> Note De...
arogozhnikov/einops
docs/1-einops-basics.ipynb
mit
# Examples are given for numpy. This code also setups ipython/jupyter # so that numpy arrays in the output are displayed as images import numpy from utils import display_np_arrays_as_images display_np_arrays_as_images() """ Explanation: Einops tutorial, part 1: basics <!-- <img src='http://arogozhnikov.github.io/image...
sdpython/pyquickhelper
_unittests/ut_helpgen/data_gallery/notebooks/notebook_eleves/2014_2015/2015_page_rank.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: PageRank avec PIG auteurs : M. Amestoy M., A. Auffret L'algorithme PageRank propose une mesure de la pertinence d'un site. Il fut inventé par les fondateurs de google. L'implémentation proposée ici s'est appuyée sur celle proposée dans Da...
GoogleCloudPlatform/asl-ml-immersion
notebooks/kubeflow_pipelines/walkthrough/labs/kfp_walkthrough_vertex.ipynb
apache-2.0
import os import time import pandas as pd from google.cloud import aiplatform, bigquery from sklearn.compose import ColumnTransformer from sklearn.linear_model import SGDClassifier from sklearn.pipeline import Pipeline from sklearn.preprocessing import OneHotEncoder, StandardScaler """ Explanation: Using custom conta...
ecervera/ga-nb
First Example.ipynb
mit
from pyevolve import G1DList """ Explanation: First Example This notebook is adapted from a tutorial from the Pyevolve website To make the API easy to use, there are default parameters for almost every parameter in Pyevolve, for example, when you will use the <tt>G1DList.G1DList</tt> genome without specifying the Muta...
ellamil/bubblepopper
bubblepopper_3articleclusters.ipynb
mit
from sklearn import cluster import pandas as pd import numpy as np import pickle %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns num_topics = 20 doc_data = pickle.load(open('pub_probabs_topic'+str(num_topics)+'.pkl','rb')) lda_topics = ['topic'+str(i) for i in range(0,num_topics)] cluster_dim...
musketeer191/job_analytics
extract_feat.ipynb
gpl-3.0
HOME_DIR = 'd:/larc_projects/job_analytics/'; DATA_DIR = HOME_DIR + 'data/clean/' RES_DIR = HOME_DIR + 'results/' skill_df = pd.read_csv(DATA_DIR + 'skill_index.csv') """ Explanation: Load data End of explanation """ doc_skill = buildDocSkillMat(jd_docs, skill_df, folder=DATA_DIR) with(open(DATA_DIR + 'doc_skill.m...
mdiaz236/DeepLearningFoundations
intro-to-tflearn/TFLearn_Digit_Recognition.ipynb
mit
# Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist """ Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. This...
cosmolejo/Fisica-Experimental-3
Fourier/Tarea_Fourier/FT-2D.ipynb
gpl-3.0
import numpy as np import matplotlib import pylab as plt import scipy.misc as pim from scipy import stats % matplotlib inline """ Explanation: Análisis de Fourier 2D Última actualización: Edgar Rueda, marzo de 2016. End of explanation """ tam = 256 # tamaño matriz dx = 0.01 # resolución (m/pixel) x = np.arange(-dx*...
kwinkunks/axb
NumPy_reflectivity.ipynb
apache-2.0
import numpy as np import numpy.linalg as la import matplotlib.pyplot as plt from utils import plot_all %matplotlib inline from scipy import linalg as spla def convmtx(h, n): """ Equivalent of MATLAB's convmtx function, http://www.mathworks.com/help/signal/ref/convmtx.html. Makes the convolution matr...
fifabsas/talleresfifabsas
python/Extras/Labo3/Adquisicion_programada.ipynb
mit
import time import numpy as np import visa rm = visa.ResourceManager() # Creamos al Resource Manager rm.list_resources() # Esto les permitirá ver qué es lo que pyvisa reconoce conectado a la PC resource_name = 'USB0::0x0699::0x0346::C033250::INSTR' # Este es un nombre ejemplo con el cual Pyvisa reconoce al instrume...
robertclf/FAFT
FAFT_64-points_R2C/nbFAFT128_offset_xyz_3D.ipynb
bsd-3-clause
import numpy as np import ctypes from ctypes import * import pycuda.gpuarray as gpuarray import pycuda.driver as cuda import pycuda.autoinit from pycuda.compiler import SourceModule import matplotlib.pyplot as plt import matplotlib.mlab as mlab import math import time %matplotlib inline """ Explanation: 3D Fas...
stevetjoa/stanford-mir
mfcc.ipynb
mit
url = 'http://audio.musicinformationretrieval.com/simple_loop.wav' urllib.urlretrieve(url, filename='simple_loop.wav') """ Explanation: &larr; Back to Index Mel Frequency Cepstral Coefficients (MFCCs) The mel frequency cepstral coefficients (MFCCs) of a signal are a small set of features (usually about 10-20) which co...
karlnapf/shogun
doc/ipython-notebooks/metric/LMNN.ipynb
bsd-3-clause
import numpy import os import shogun as sg SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') x = numpy.array([[0,0],[-1,0.1],[0.3,-0.05],[0.7,0.3],[-0.2,-0.6],[-0.15,-0.63],[-0.25,0.55],[-0.28,0.67]]) y = numpy.array([0,0,0,0,1,1,2,2]) """ Explanation: Metric Learning with the Shogun Machine Learning Tool...
hetaodie/hetaodie.github.io
assets/media/uda-ml/fjd/ccjl/层次聚类/.ipynb_checkpoints/Hierarchical Clustering Lab-zh-checkpoint.ipynb
mit
from sklearn import datasets iris = datasets.load_iris() """ Explanation: 层次聚类 Lab 在此 notebook 中,我们将使用 sklearn 对鸢尾花数据集执行层次聚类。该数据集包含 4 个维度/属性和 150 个样本。每个样本都标记为某种鸢尾花品种(共三种)。 在此练习中,我们将忽略标签和基于属性的聚类,并将不同层次聚类技巧的结果与实际标签进行比较,看看在这种情形下哪种技巧的效果最好。然后,我们将可视化生成的聚类层次。 1. 导入鸢尾花数据集 End of explanation """ iris.data[:10] iris.target ...
VlachosGroup/VlachosGroupAdditivity
docs/source/WorkshopJupyterNotebooks/OpenMKM_demo/batch/batch.ipynb
mit
import matplotlib as mpl mpl.rcParams['figure.dpi'] = 500 import os import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' """ Explanation: Simulating Batch Reactor Here a batch reactor simulation is demoed with pure gas phase mechanism...
tensorflow/text
docs/tutorials/classify_text_with_bert.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...
stevetjoa/stanford-mir
evaluation_beat.ipynb
mit
y, sr = librosa.load('audio/prelude_cmaj.wav') ipd.Audio(y, rate=sr) """ Explanation: &larr; Back to Index Evaluation Example: Beat Tracking Documentation: mir_eval.beat Evaluation method: compute the error between the estimated beat times and some reference list of beat locations. Many metrics additionally compare t...
CGATOxford/CGATPipelines
CGATPipelines/pipeline_docs/pipeline_peakcalling/notebooks/template_peakcalling_filtering_Report_reads_per_chr.ipynb
mit
import sqlite3 import pandas as pd import numpy as np %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt import CGATPipelines.Pipeline as P import os import statistics import collections #load R and the R packages required %load_ext rpy2.ipython %R require(ggplot2) # use these f...
boffi/boffi.github.io
dati_2020/04/EP_Exact+Numerical.ipynb
mit
def resp_elas(m,c,k, cC,cS,w, F, x0,v0): wn2 = k/m ; wn = sqrt(wn2) ; beta = w/wn z = c/(2*m*wn) wd = wn*sqrt(1-z*z) # xi(t) = R sin(w t) + S cos(w t) + D det = (1.-beta**2)**2+(2*beta*z)**2 R = ((1-beta**2)*cS + (2*beta*z)*cC)/det/k S = ((1-beta**2)*cC - (2*beta*z)*cS)/det/k D = F/k ...
tpin3694/tpin3694.github.io
python/geocoding_and_reverse_geocoding.ipynb
mit
# Load packages from pygeocoder import Geocoder import pandas as pd import numpy as np """ Explanation: Title: Geocoding And Reverse Geocoding Slug: geocoding_and_reverse_geocoding Summary: Geocoding And Reverse Geocoding Date: 2016-05-01 12:00 Category: Python Tags: Data Wrangling Authors: Chris Albon Geocoding (co...
mvdbosch/AtosCodexDemo
Jupyter Notebooks/Explore the CBS Crime and Demographics Dataset.ipynb
gpl-3.0
%%bash cat /proc/cpuinfo | grep 'processor\|model name' %%bash free -g """ Explanation: Atos Codex - Data Scientist Workbench Explore the CBS Crime and Demographics Dataset First check some of the environment specs and see what we have here End of explanation """ from __future__ import print_function import pandas ...
gururajl/deep-learning
image-classification/dlnd_image_classification.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' # Use Floyd's cifar-10 dataset if present floyd_cifar10...
robertoalotufo/ia898
master/Rampa_solucoes.ipynb
mit
def rr_indices( lado): import numpy as np r,c = np.indices( (lado, lado), dtype='uint16' ) return c print(rr_indices(11)) """ Explanation: Análise das soluções do programa Rampa Esta página apresenta as principais soluções apresentadas no programa Rampa. O objetivo é entender as discrepâncias entre el...
souljourner/fab
EDA/temp.ipynb
mit
import matplotlib.pyplot as plt # Import matplotlib # This line is necessary for the plot to appear in a Jupyter notebook %matplotlib inline # Control the default size of figures in this Jupyter notebook %pylab inline pylab.rcParams['figure.figsize'] = (15, 9) # Change the size of plots import glob from collection...
cherryc/dynet
examples/python/tutorials/RNNs.ipynb
apache-2.0
# we assume that we have the dynet module in your path. # OUTDATED: we also assume that LD_LIBRARY_PATH includes a pointer to where libcnn_shared.so is. from dynet import * """ Explanation: RNNs tutorial End of explanation """ model = Model() NUM_LAYERS=2 INPUT_DIM=50 HIDDEN_DIM=10 builder = LSTMBuilder(NUM_LAYERS, ...
google/flax
examples/imagenet/imagenet.ipynb
apache-2.0
# Install ml-collections & latest Flax version from Github. !pip install -q clu ml-collections git+https://github.com/google/flax example_directory = 'examples/imagenet' editor_relpaths = ('configs/default.py', 'input_pipeline.py', 'models.py', 'train.py') repo, branch = 'https://github.com/google/flax', 'main' # (I...
kitu2007/dl_class
gan_mnist/Intro_to_GANs_Exercises.ipynb
mit
%matplotlib inline import pickle as pkl 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') """ Explanation: Generative Adversarial Network In this notebook, we'll be building a generativ...
NEONScience/NEON-Data-Skills
tutorials/Python/Hyperspectral/intro-hyperspectral/Intro_NEON_AOP_HDF5_Reflectance_Flightlines_py/Intro_NEON_AOP_HDF5_Reflectance_Flightlines_py.ipynb
agpl-3.0
#Check that you are using the correct version of Python (should be 3.4+, otherwise gdal won't work) import sys sys.version """ Explanation: syncID: 8491e02fec01499281d05f3b92409e27 title: "NEON AOP Hyperspectral Data in HDF5 format with Python - Flightlines" description: "Learn how to read NEON AOP hyperspectral flig...
ngast/rmf_tool
examples/BasicExample_SIR.ipynb
mit
# To load the library import rmftool as rmf import importlib importlib.reload(rmf) # To plot the results import numpy as np import matplotlib.pyplot as plt # %matplotlib inline %matplotlib notebook """ Explanation: This document demonstrate how to use the library to define a "density dependent population process"...
taku-y/bmlingam
doc/notebook/expr/20160915/20160902-eval-bml.ipynb
mit
%matplotlib inline %autosave 0 import sys, os sys.path.insert(0, os.path.expanduser('~/work/tmp/20160915-bmlingam/bmlingam')) from copy import deepcopy import hashlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import time from bmlingam import do_mcmc_bmlingam, InferPa...
UV-CDAT/tutorials
graphics/ParallelCoordinates.ipynb
bsd-2-clause
import vcs # For plots import vcsaddons # module containing pcoords import cdms2 # for data import glob # to list files in directories import pcmdi_metrics # for special json loader class """ Explanation: import necessary modules End of explanation """ import tempfile import base64 class VCSAddonsNotebook(object): ...
timothyb0912/pylogit
examples/.ipynb_checkpoints/Main PyLogit Example-checkpoint.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 ...
ChadFulton/statsmodels
examples/notebooks/statespace_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 This notebook replicat...
penguinmenac3/ml-notebooks
Machine Learning Basics with Sklearn.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Machine Learning Basics with Sklearn First some imports for the notebook and visualization. End of explanation """ from sklearn.datasets import load_iris iris = load_iris() """ Explanation: Choosing a dataset First of all you nee...
WNoxchi/Kaukasos
FADL2/darknet_loss_PR.ipynb
mit
%matplotlib inline %reload_ext autoreload %autoreload 2 from pathlib import Path from fastai.conv_learner import * # from fastai.models import darknet """ Explanation: PR: Adding LogSoftmax layer to Darknet for Cross Entropy Loss Wayne Nixalo - 2018/4/24 0. Proposed Change; Setup Dataset is the fast.ai ImageNet sampl...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_eco2/td2a_eco_5d_Travailler_du_texte_les_expressions_regulieres_correction.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.eco - Les expressions régulières : à quoi ça sert ? (correction) Chercher un mot dans un texte est une tâche facile, c'est l'objectif de la méthode find attachée aux chaînes de caractères, elle suffit encore lorsqu'on cherche un mot au...
liufuyang/deep_learning_tutorial
course-deeplearning.ai/course1-nn-and-deeplearning/Logistic+Regression+with+a+Neural+Network+mindset+v3.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import h5py import scipy from PIL import Image from scipy import ndimage from lr_utils import load_dataset %matplotlib inline """ Explanation: Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a ...
b4be1/ball_catcher
src3d/help/demo.ipynb
cc0-1.0
from casadi import * from casadi.tools import * # for dotdraw from matplotlib.pyplot import * %matplotlib inline x = SX.sym("x") # scalar symbolic primitives y = SX.sym("y") z = x*sin(x+y) # common mathematical operators print z dotdraw(z,direction="BT") J = jacobian(z,x) print J dotdraw(J,direction="BT") ""...
DJCordhose/ai
notebooks/ml/4-tf-keras-nn.ipynb
mit
import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline import pandas as pd print(pd.__version__) import tensorflow as tf tf.logging.set_verbosity(tf.logging.ERROR) print(tf.__version__) """ Explanation: Neural Networks with TensorFlow and Keras End of explanation """ df = pd.read_csv('...
Upward-Spiral-Science/team1
code/Spike Imaging.ipynb
apache-2.0
# Spike images from mpl_toolkits.mplot3d import axes3d import numpy as np import urllib2 import scipy.stats as stats import matplotlib.pyplot as plt from image_builder import get_image np.set_printoptions(precision=3, suppress=True) url = ('https://raw.githubusercontent.com/Upward-Spiral-Science' '/data/master/...
wso2/product-apim
modules/recommendation-engine/repository/resources/Word2vec_Model/.ipynb_checkpoints/Build_Word2vec_model-checkpoint.ipynb
apache-2.0
model_1 = gensim.models.Word2Vec (dataset, size=300, window=10, min_count=5, workers=10) model_1.train(dataset,total_examples=len(dataset),epochs=15) """ Explanation: The 'Dataset.txt' file consists of API descriptions of over 15,000 APIs. Using the 'Dataset_PW.txt' file, a dataset which consists of sentences, is crea...
moble/PostNewtonian
PNTerms/Precession.ipynb
mit
Precession_ellHat = PNCollection() Precession_chiVec1 = PNCollection() Precession_chiVec2 = PNCollection() """ Explanation: The following PNCollection objects will contain all the terms describing precession. End of explanation """ Precession_ellHat.AddDerivedVariable('gamma_PN_coeff', v**2) Precession_ellHat.AddD...
SheffieldML/notebook
GPy/coregionalized_regression_tutorial.ipynb
bsd-3-clause
%pylab inline import pylab as pb pylab.ion() import GPy """ Explanation: Coregionalized Regression Model (vector-valued regression) updated: 17th June 2015 by Ricardo Andrade-Pacheco This tutorial will focus on the use and kernel selection of the $\color{firebrick}{\textbf{coregionalized regression}}$ model in GPy. Se...
neildhir/DCBO
notebooks/nonstat_scm.ipynb
mit
%load_ext autoreload %autoreload 2 import sys sys.path.append("../src/") sys.path.append("..") from src.examples.example_setups import setup_nonstat_scm from src.utils.sem_utils.toy_sems import NonStationaryDependentSEM as NonStatSEM from src.utils.sem_utils.sem_estimate import build_sem_hat from src.experimental.exp...
preigemufc/1.2016.1.notebooks
Integração Numérica.ipynb
gpl-3.0
# Antes de tudo, importamos o pacote matemático numpy # que nos permite manipular matrizes e vetores. import numpy as np # Declaramos uma função onde colocaremos todo o código # para integração de Euler, que poderemos invocar facilmente # sempre que quisermos integrar numericamente uma equação # diferencial. def solv...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_objects_from_arrays.ipynb
bsd-3-clause
# Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi> # # License: BSD (3-clause) import numpy as np import neo import mne print(__doc__) """ Explanation: Creating MNE objects from data arrays In this simple example, the creation of MNE objects from numpy arrays is demonstrated. In the last example case, a NEO fil...
martinjrobins/hobo
examples/optimisation/transformed-parameters.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import pints import pints.toy as toy # Set some random seed so this notebook can be reproduced np.random.seed(10) # Load a logistic forward model model = toy.LogisticModel() """ Explanation: Optimisation in a transformed parameter space This example shows you how to...
uliang/First-steps-with-the-Python-language
Day 1 - Unit 1.1.ipynb
mit
# change this cell into a Markdown cell. Then type something here and execute it (Shift-Enter) """ Explanation: 1. Your first steps with Python 1.1 Introduction Python is a general purpose programming language. It is used extensively for scientific computing, data analytics and visualization, web development and soft...
tensorflow/docs-l10n
site/zh-cn/tutorials/load_data/text.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...
AnyBody-Research-Group/AnyPyTools
docs/Tutorial/02_Generating_macros.ipynb
mit
from anypytools.macro_commands import (MacroCommand, Load, SetValue, SetValue_random, Dump, SaveDesign, LoadDesign, SaveValues, LoadValues, UpdateValues, OperationRun) """ Explanation: Creating AnyScript Macros AnyPyTools can create AnyScript macros automatically. Doing so simpl...
WomensCodingCircle/CodingCirclePython
Lesson02_Conditionals/.ipynb_checkpoints/Conditional Execution-checkpoint.ipynb
mit
cleaned_room = True took_out_trash = False print(cleaned_room) print(type(took_out_trash)) """ Explanation: Conditional Execution Boolean Expressions We introduce a new type, the boolean. A boolean can have one of two values: True or False End of explanation """ print(5 == 6) print("Hello" != "Goodbye") # You can...
icoxfog417/enigma_abroad
pola/machine/topic_model_evaluation.ipynb
mit
# enable showing matplotlib image inline %matplotlib inline # autoreload module %load_ext autoreload %autoreload 2 PROJECT_ROOT = "/" def load_local_package(): import os import sys root = os.path.join(os.getcwd(), "../../") sys.path.append(root) # load project root return root PROJECT_ROOT = lo...
WillenZh/deep-learning-project
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: 语言翻译 在此项目中,你将了解神经网络机器翻译这一领域。你将用由英语和法语语句组成的数据集,训练一个...
GregDMeyer/dynamite
examples/2-Subspaces.ipynb
mit
from dynamite.operators import sigmax, sigmaz, index_sum, op_sum # the None default argument will be important later def build_hamiltonian(L): interaction = op_sum(index_sum(sigmax(0)*sigmax(i), size=L) for i in range(1,L)) uniform_field = 0.5*index_sum(sigmaz(), size=L) return interaction + uniform_field ...
kimmintae/MNIST
MNIST Competiton_9980/mnist_competition_9980_Final.ipynb
mit
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) # test data test_images = mnist.test.images.reshape(10000, 28, 28, 1) test_labels = mnist.test.labels[:] augmentation_size = 440000 images = np.concatenate((mnist.train.images.reshape(55000, 28, 28, 1), mnist.validation.images.reshape(5000, 28, 28, 1)), ax...
cdawei/flickr-photo
src/traj_Melb.ipynb
gpl-2.0
%matplotlib inline import os, sys, time import pandas as pd import numpy as np from datetime import datetime import matplotlib.pyplot as plt def print_progress(cnt, total): """Display a progress bar""" assert(cnt > 0 and total > 0 and cnt <= total) length = 80 ratio = cnt / total n = int(length * ...
ankoorb/scipy2015_tutorial
notebooks/3. Fitting Regression Models.ipynb
cc0-1.0
from io import StringIO data_string = """ Drugs Score 0 1.17 78.93 1 2.97 58.20 2 3.26 67.47 3 4.69 37.47 4 5.83 45.65 5 6.00 32.92 6 6.41 29.97 """ lsd_and_math = pd.read_table(StringIO(data_string), sep='\t', index_col=0) lsd_and_math """ Explanation: Regression modeling A general, primary goal of many statistical...