repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sbu-python-summer/python-tutorial
day-5/ngram_models.ipynb
bsd-3-clause
def bigramize(filename): pass """ Explanation: $n$-gram extraction and text generation 1. Bigram extraction Write a function that extracts possible word combinations of the length $2$ from the same file, shore_leave.txt. Note that the last word of one sentence, and the first word of the next one are not a good com...
ayejay/reading-habits
notebook/Pocket Reading Habits.ipynb
mit
import json import glob import pandas as pd import datetime import requests import matplotlib.pyplot as plt import numpy as np from wordcloud import WordCloud from urllib.parse import urlparse """ Explanation: # Introduction This notebook includes a pattern about my reading habits. <a href="https://getpocket.com">Pock...
quantumlib/Cirq
docs/tutorials/google/floquet_calibration_example.ipynb
apache-2.0
try: import cirq except ImportError: print("installing cirq...") !pip install --quiet cirq --pre print("installed cirq.") from typing import Iterable, List, Optional, Sequence import matplotlib.pyplot as plt import numpy as np import os import cirq import cirq_google as cg # Contains the Floquet ca...
tornadozou/tensorflow
tensorflow/tools/docker/notebooks/3_mnist_from_scratch.ipynb
apache-2.0
from __future__ import print_function from IPython.display import Image import base64 Image(data=base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAAMYAAABFCAYAAAARv5krAAAYl0lEQVR4Ae3dV4wc1bYG4D3YYJucc8455yCSSIYrBAi4EjriAZHECyAk3rAID1gCIXGRgIvASIQr8UTmgDA5imByPpicTcYGY+yrbx+tOUWpu2e6u7qnZ7qXVFPVVbv2Xutfce+q7hlasmTJktSAXrnn8...
uber/pyro
tutorial/source/predictive_deterministic.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.datasets import make_regression import pyro.distributions as dist from pyro.infer import MCMC, NUTS, Predictive from pyro.infer.mcmc.util import summary from pyro.distributions import constraints import pyro import torch pyro.set_rng_s...
tomspur/blog
posts/0001-publication-ready-figures-with-matplotlib-and-ipython-notebook/matplotlib_plots.ipynb
mit
%matplotlib inline import seaborn as snb import numpy as np import matplotlib.pyplot as plt """ Explanation: Publication ready figures with matplotlib and Jupyter notebook A very convenient workflow to analyze data and create figures that can be used in various ways for publication is to use the IPython Notebook or Ju...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/assignment/week3/week-3-polynomial-regression-assignment-exercise.ipynb
mit
import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') 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 ...
ellisztamas/faps
docs/tutorials/.ipynb_checkpoints/02_genotype_data-checkpoint.ipynb
mit
import numpy as np import faps as fp print("Created using FAPS version {}.".format(fp.__version__)) """ Explanation: Genotype data in FAPS End of explanation """ allele_freqs = np.random.uniform(0.3,0.5,10) mypop = fp.make_parents(5, allele_freqs, family_name='my_population') """ Explanation: Tom Ellis, March 2017 ...
mromanello/SunoikisisDC_NER
participants_notebooks/Sunoikisis - Named Entity Extraction 1a_PG.ipynb
gpl-3.0
2 + 3 """ Explanation: Plan of the lecture Introduction: Information Extraction and Named Entity Recognition (NER) NER: definitions and tasks (extraction, classification, disambiguation) basic programming concepts in Python Doing NER with existing libraries: NER from Latin texts with CLTK NER from journal articles wi...
Xero-Hige/Notebooks
Algoritmos I/2018-1C/clase-23-03-2018.ipynb
gpl-3.0
def imprimir_fichas_domino(): ''' Imprime las fichas del dominó. ''' for i in range(7): for j in range(i,7): print(i,"/",j,end=" | ") print() def main(): imprimir_fichas_domino() main() """ Explanation: Práctica Alan - Clase del 23/03/2018 Ejercicio 2.7 Es...
simpeg/simpegdc
notebooks/DC_schumberger_FWD.ipynb
mit
cs = 25. npad = 11 hx = [(cs,npad, -1.3),(cs,41),(cs,npad, 1.3)] hy = [(cs,npad, -1.3),(cs,17),(cs,npad, 1.3)] hz = [(cs,npad, -1.3),(cs,20)] mesh = Mesh.TensorMesh([hx, hy, hz], 'CCN') mesh.plotGrid() """ Explanation: DC Forward Modeling of Schlumber array Here we test the accuracy of DC forward modeling using anal...
jstac/quantecon_nyu_2016
lecture14/james_graham_DOLO.ipynb
bsd-3-clause
from dolo import * import numpy as np import matplotlib.pyplot as plt filename = ('https://raw.githubusercontent.com/EconForge/dolo/master/examples/models/rbc.yaml') pcat(filename) # Print the model file """ Explanation: Introducing DOLO What is DOLO? A Python-based language to write and solve a variety of econo...
thom056/ada-parliament-ML
02-NLP_Sentiment/02-MLOnVotation.ipynb
gpl-2.0
import pandas as pd import glob import os import numpy as np from time import time import logging import gensim import bz2 import re from stop_words import get_stop_words """ Explanation: 02. Machine Learning on the Votations What we aim to perform now is predict the topics that are treated in a Vote, given the short ...
rahulremanan/python_tutorial
Hacker_Rank/03-Strings/11_Find_a_string.ipynb
mit
s = 'ABCD' for i in range(0, len(s)): print (s[i]) string = 'ABCABDEABCF' sub_string = 'ABC' string[5:7] def output_substring(string, sub_string): for i in range(0, len(string)-len(sub_string)+1): n = i print (string[n:(n+len(sub_string))]) output_substring(string, sub_string) """ Explanat...
RajeshThevar/Image-Classification
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...
joekasp/ionic_liquids
ionic_liquids/examples/Example_Workflow.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from rdkit import Chem from rdkit.Chem import AllChem, Descriptors from rdkit.ML.Descriptors.MoleculeDescriptors import MolecularDescriptorCalculator as Calculator import pandas as pd import numpy...
ananswam/bioscrape
inference examples/Gaussian prior example.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = "retina" from matplotlib import rcParams rcParams["savefig.dpi"] = 100 rcParams["figure.dpi"] = 100 rcParams["font.size"] = 20 """ Explanation: Parameter identification example Here is a simple toy model that we use to demonstrate the working of the inference p...
manparvesh/manparvesh.github.io
oldsitejekyll/markdown_generator/publications.ipynb
mit
!cat publications.tsv """ Explanation: Publications markdown generator for academicpages Takes a TSV of publications with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in publications.py. Run either from the m...
NREL/bifacial_radiance
docs/tutorials/19 - Example Simulation - East West Sheds.ipynb
bsd-3-clause
import os import numpy as np import pandas as pd from pathlib import Path import bifacial_radiance bifacial_radiance.__version__ testfolder = testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'Tutorial_01') if not os.path.exists(testfolder): os.makedirs(testfolder) demo = bifacial_radiance....
zhouqifanbdh/liupengyuan.github.io
201621198175.ipynb
mit
name = input("请输入您的姓名:") date = float(input("请输入您出生的月份.日期:")) if 3.21 <= date <= 4.19: print(name,",你是非常有性格的白羊座!") elif 4.20 <= date <= 5.20: print(name,",你是非常有性格的金牛座!") elif 5.21 <= date <= 6.21: print(name,",你是非常有性格的双子座!") elif 6.22 <= date <= 7.22: print(name,",你是非常有性格的巨蟹座!") elif 7.23 <= date <= 8....
intel-analytics/analytics-zoo
docs/docs/colab-notebook/orca/quickstart/autoestimator_pytorch_lenet_mnist.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed un...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_ml/td2a_timeseries_correction.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline """ Explanation: 2A.ml - Séries temporelles - correction Prédictions sur des séries temporelles. End of explanation """ import pandas data = pandas.read_csv("xavierdupre_sessions.csv", sep="\t") data.set_index("Date", inplace=True) d...
evanmiltenburg/python-for-text-analysis
Chapters-colab/Chapter_11_Functions_and_scope.ipynb
apache-2.0
%%capture !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip !unzip Data.zip -d ../ !unzip images.zip -d ./ !unzip Ext...
JohnGriffiths/ConWhAt
docs/examples/exploring_conwhat_atlases.ipynb
bsd-3-clause
# ConWhAt stuff from conwhat import VolConnAtlas,StreamConnAtlas,VolTractAtlas,StreamTractAtlas from conwhat.viz.volume import plot_vol_scatter,plot_vol_and_rois_nilearn # Neuroimaging stuff import nibabel as nib from nilearn.plotting import plot_stat_map,plot_surf_roi # Viz stuff %matplotlib inline from matplotlib i...
birdsarah/bokeh-miscellany
0.12.14 bugs - test in 0.12.5.ipynb
gpl-2.0
N = 10000 x = np.random.normal(0, np.pi, N) y = np.sin(x) + np.random.normal(0, 0.2, N) p = figure(webgl=True) p.scatter(x, y, alpha=0.1) show(p) """ Explanation: WebGL problems Drag around canvas is shifted down, cut off at top spilling over bottom. Bad in 0.12.14 and 0.12.15dev3 Good in 0.12.10 End of explanation ...
exa-analytics/atomic
docs/source/notebooks/01_basics.ipynb
apache-2.0
import exatomic exatomic.__version__ """ Explanation: Welcome to exatomic This notebook demonstrates some basics of working with exatomic. End of explanation """ exatomic.Universe? """ Explanation: Getting help in the Jupyter notebook is easy, just put a "?" after a class or function. Don't forget to use tab to hel...
mjuenema/ipython-notebooks
dnspython-resolver.ipynb
bsd-2-clause
import dns.rdataclass dns.rdataclass.IN """ Explanation: dnspython Resolver The socket module of the Python standard library provides basic functions for resolving hostnames (gethostbyname and gethostbyname_ex) as implemented by the C library. The resolver of the dnspython allows to bypass the C library and query DNS ...
Benedicto/ML-Learning
Clustering_0_nearest-neighbors-features-and-metrics_blank.ipynb
gpl-3.0
import graphlab import matplotlib.pyplot as plt import numpy as np %matplotlib inline """ Explanation: Nearest Neighbors When exploring a large set of documents -- such as Wikipedia, news articles, StackOverflow, etc. -- it can be useful to get a list of related material. To find relevant documents you typically * Dec...
saketkc/hatex
2015_Fall/MATH-578B/Homework3/Homework3.ipynb
mit
### Simulation %matplotlib inline from __future__ import division import numpy as np import matplotlib.pyplot as plt np.random.seed(1) import math N=1000 s=0 def R(x,y): return math.sqrt(x*x+y*y) for i in range(N): r=-100 y=0 x=0 while R(x,y)>r: S=np.random.uniform(size=2) x=S[0] ...
erickpeirson/statistical-computing
Markov Chain Monte Carlo.ipynb
cc0-1.0
%matplotlib inline import random import math from matplotlib import pyplot as plt import numpy as np import pandas as pd from scipy.stats import norm, uniform, multivariate_normal """ Explanation: Chapter 1 - Markov Chain Monte Carlo End of explanation """ U = [random.random() for i in xrange(10000)] """ Explanati...
mne-tools/mne-tools.github.io
0.17/_downloads/f79b821209d128d6d63d736e8cc0beb3/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__) """ ...
ocefpaf/folium
examples/plugin-Search.ipynb
mit
import geopandas states = geopandas.read_file( "https://rawcdn.githack.com/PublicaMundi/MappingAPI/main/data/geojson/us-states.json", driver="GeoJSON", ) cities = geopandas.read_file( "https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_populated_places_simple.geojson", driver="GeoJSON", ...
McIntyre-Lab/ipython-demo
hdf5.ipynb
gpl-2.0
# Import packages import numpy as np import tables as pt # PyTables import h5py as hp # h5py import pandas as pd import rpy2 %load_ext rpy2.ipython # Create a New HDF5 File h5file = pt.open_file('test.h5', mode='w', title='Test file') """ Explanation: HDF5 HDF5 stands for (Hierarchical Data Format 5), and it is...
tpin3694/tpin3694.github.io
regex/match_any_of_series_of_characters.ipynb
mit
# Load regex package import re """ Explanation: Title: Match Any Of A Series Of Options Slug: match_any_of_series_of_characters Summary: Match Any Of A Series Of Options Date: 2016-05-01 12:00 Category: Regex Tags: Basics Authors: Chris Albon Based on: Regular Expressions Cookbook Preliminaries End of explanation ""...
tensorflow/docs-l10n
site/ja/tutorials/load_data/pandas_dataframe.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...
samuxiii/notebooks
houses/House Prices.ipynb
apache-2.0
import numpy as np import pandas as pd #load the files train = pd.read_csv('input/train.csv') test = pd.read_csv('input/test.csv') data = pd.concat([train, test]) #size of training dataset train_samples = train.shape[0] #print some of them data.head() # remove the Id feature data.drop(['Id'],1, inplace=True); data...
abhinavsingh/proxy.py
tutorial/http_parser.ipynb
bsd-3-clause
from proxy.http.methods import httpMethods from proxy.http.parser import HttpParser, httpParserTypes, httpParserStates from proxy.common.constants import HTTP_1_1 get_request = HttpParser(httpParserTypes.REQUEST_PARSER) get_request.parse(memoryview(b'GET / HTTP/1.1\r\nHost: jaxl.com\r\n\r\n')) print(get_request.build...
jpn--/larch
book/example/017_mnl_final.ipynb
gpl-3.0
# TEST import larch.numba as lx import larch import pandas as pd pd.set_option("display.max_columns", 999) pd.set_option('expand_frame_repr', False) pd.set_option('display.precision', 3) larch._doctest_mode_ = True """ Explanation: 17: MTC Expanded MNL Mode Choice End of explanation """ import larch.numba as lx d = ...
Yu-Group/scikit-learn-sandbox
jupyter/backup_deprecated_nbs/14_Check_Utils_pep8.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from sklearn.datasets import load_iris from sklearn.datasets import load_breast_cancer import numpy as np from functools import reduce # Import our custom utilities from imp import reload from utils import irf_jupyter_utils from utils import irf_utils reload(irf_jupy...
USCDataScience/parser-indexer-py
notebooks/all-ner/MTE_NER.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline from snorkel import SnorkelSession import os import numpy as np import re, string import codecs # Open Session session = SnorkelSession() """ Explanation: NER using Data Programming Project Mars Target Encyclopedia This notebook does not explain much, however, th...
SunPower/pvfactors
docs/tutorials/Account_for_AOI_losses.ipynb
bsd-3-clause
# Import external libraries import os import numpy as np import matplotlib.pyplot as plt from datetime import datetime import pandas as pd import warnings # Settings %matplotlib inline np.set_printoptions(precision=3, linewidth=300) warnings.filterwarnings('ignore') plt.style.use('seaborn-whitegrid') plt.rcParams.upda...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/04_features/labs/a_features.ipynb
apache-2.0
import math import shutil import numpy as np import pandas as pd import tensorflow as tf print(tf.__version__) tf.logging.set_verbosity(tf.logging.INFO) pd.options.display.max_rows = 10 pd.options.display.float_format = '{:.1f}'.format """ Explanation: Trying out features Learning Objectives: * Improve the accuracy...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/text_classification/labs/custom_tf_hub_word_embedding.ipynb
apache-2.0
!pip freeze | grep tensorflow-hub==0.7.0 || pip install tensorflow-hub==0.7.0 import os import tensorflow as tf import tensorflow_hub as hub """ Explanation: Custom TF-Hub Word Embedding with text2hub Learning Objectives: 1. Learn how to deploy AI Hub Kubeflow pipeline 1. Learn how to configure the run parameter...
ANTsX/ANTsPy
docs/other/ANTsPy Tutorial.ipynb
apache-2.0
import ants import matplotlib.pyplot as plt %matplotlib inline img = ants.image_read( ants.get_ants_data('r16'), 'float' ) plt.imshow(img.numpy(), cmap='Greys_r') plt.show() mask = ants.get_mask(img) plt.imshow(mask.numpy()) plt.show() """ Explanation: ANTsPy Tutorial In this tutorial, I will show of some of the co...
jforbess/pvlib-python
docs/tutorials/tmy_and_diffuse_irrad_models.ipynb
bsd-3-clause
# built-in python modules import os import inspect # scientific python add-ons import numpy as np import pandas as pd # plotting stuff # first line makes the plots appear in the notebook %matplotlib inline import matplotlib.pyplot as plt # seaborn makes your plots look better try: import seaborn as sns sns.s...
YeEmrick/learning
cs231/assignment/assignment2/.ipynb_checkpoints/BatchNormalization-checkpoint.ipynb
apache-2.0
# As usual, a bit of setup import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solver import Solver %matplotlib inline ...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a/pandas_iterator_correction.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() from sklearn.datasets import load_iris data = load_iris() import pandas df = pandas.DataFrame(data.data) df.column = "X1 X2 X3 X4".split() df["target"] = data.target df.head(n=2) """ Explanation: 2A.data - Pandas et itérateurs - correction pandas a tenda...
jasonarita/Kaggle-Titanic-R-Python
0-Basic Model-All Survive or Die.ipynb
mit
import csv as csv import numpy as np """ Explanation: The Most Basic-est Model of Them All They all survive End of explanation """ test_file = open('./data/test.csv', 'rb') # Open the test data test_file_object = csv.reader(test_file) header = test_file_object.next() header """ Explanation: The op...
bspalding/research_public
lectures/drafts/Measures of Dispersion.ipynb
apache-2.0
import numpy as np import math np.random.seed(121) X = np.sort(np.random.randint(100, size=20)) print 'X:', X mu = np.mean(X) print 'Mean of X:', mu """ Explanation: Dispersion By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie Notebook released under the Creative Commons Attribution 4.0 License. Dispers...
Cyb3rWard0g/ThreatHunter-Playbook
docs/notebooks/windows/05_defense_evasion/WIN-190510202010.ipynb
gpl-3.0
from openhunt.mordorutils import * spark = get_spark() """ Explanation: WDigest Downgrade Metadata | | | |:------------------|:---| | collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] | | creation date | 2019/05/10 | | modification date | 2020/09/20 | | playbook related | [] | Hypothesis A...
cogitare-ai/cogitare
docs/source/quickstart.ipynb
mit
# adapted from https://github.com/pytorch/examples/blob/master/mnist/main.py from cogitare import Model from cogitare import utils from cogitare.data import DataSet, AsyncDataLoader from cogitare.plugins import EarlyStopping from cogitare.metrics.classification import accuracy import cogitare import torch.nn as nn imp...
landlab/landlab
notebooks/tutorials/overland_flow/kinwave_implicit/kinwave_implicit_overland_flow.ipynb
mit
import copy import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from landlab import RasterModelGrid, imshow_grid from landlab.components.overland_flow import KinwaveImplicitOverlandFlow from landlab.io.esri_ascii import read_esri_ascii print(KinwaveImplicitOverlandFlow.__doc__) """ Explanation...
OpenSourceBrain/IzhikevichModel
numba/faster_izhikevich_model.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import collections import quantities as pq import izhikevich as izhi import numpy as np %matplotlib inline from utils import reduced_cells, transform_input, plot_model DELAY = 0*pq.ms DURATION = 250 *pq.ms """ Explanation: This is a reproduction of the MATLAB script 2007.m The code is i...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session07/Day2/Clustering-Astronomical-Sources.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import glob import os from time import time from matplotlib.pyplot import imshow from matplotlib.image import imread from sklearn.cluster import KMeans from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn import metrics from sk...
tpin3694/tpin3694.github.io
machine-learning/model_selection_using_grid_search.ipynb
mit
# Load libraries import numpy as np from sklearn import datasets from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline # Set random seed np.random.seed(0) """ Explanation: Title: Mo...
marisanest/content-management
Assignment01/Assignment01.ipynb
apache-2.0
import csv import re import pandas as pd from pandas import * import numpy from numpy import * import math %matplotlib inline import matplotlib.pyplot as plt from random import randint """ Explanation: Graded Assignment 01: Titanic: Machine Learning from Disaster 2017-05-17 (c) Marisa Nest 2017 Imports End of explanat...
tensorflow/docs
site/en/tutorials/images/classification_with_model_garden.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...
tpin3694/tpin3694.github.io
machine-learning/select_best_number_of_components_in_lda.ipynb
mit
# Load libraries from sklearn import datasets from sklearn.discriminant_analysis import LinearDiscriminantAnalysis """ Explanation: Title: Selecting The Best Number Of Components For LDA Slug: select_best_number_of_components_in_lda Summary: How to select the best number of components for linear discriminant analysi...
davofis/computational_seismology
07_spectral_elements/se_homo_1d_solution.ipynb
gpl-3.0
# Import all necessary libraries, this is a configuration step for the exercise. # Please run it before the simulation code! import numpy as np import matplotlib.pyplot as plt from gll import gll from lagrange1st import lagrange1st from ricker import ricker # Show the plots in the Notebook. plt.switch_backend("nbagg...
PDBeurope/PDBe_Programming
search_interface/notebooks/search_facets.ipynb
apache-2.0
from mysolr import Solr PDBE_SOLR_URL = "http://wwwdev.ebi.ac.uk/pdbe/search/pdb" solr = Solr(PDBE_SOLR_URL, version=4) UNLIMITED_ROWS = 10000000 # necessary because default in mysolr is mere 10 import logging, sys #reload(logging) # reload is just a hack to make logging work in the notebook, it's usually unnecessary...
ES-DOC/esdoc-jupyterhub
notebooks/bcc/cmip6/models/bcc-esm1/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'bcc-esm1', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: BCC Source ID: BCC-ESM1 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radiativ...
adukic/nd101
autoencoder/Convolutional_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) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
dkillick/courses
course_content/notebooks/numpy_intro.ipynb
gpl-3.0
# numpy is generally imported as 'np' import numpy as np print(np) print(np.__version__) """ Explanation: A Workshop Introduction to NumPy The Python language is an excellent tool for general-purpose programming, with a highly readable syntax, rich and powerful data types (strings, lists, sets, dictionaries, arbitrary...
ClementPhil/deep-learning
first-neural-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...
ESSS/notebooks
interpolation_to_a_structured_grid_from_a_cloud_of_points.ipynb
mit
# Imports import math import seaborn import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm from sklearn.neighbors import NearestNeighbors from sklearn.preprocessing import normalize """ Explanation: Interpolation to a structured grid from a cloud of points First of all, we ha...
AllenDowney/ThinkStats2
code/chap12ex.ipynb
gpl-3.0
from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename): from urllib.request import urlretrieve local, _ = urlretrieve(url, filename) print("Downloaded " + local) download("https://github.com/AllenDowney/ThinkStats2/raw/master/code/th...
IBMDecisionOptimization/docplex-examples
examples/cp/jupyter/truck_fleet.ipynb
apache-2.0
from sys import stdout 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: The Truck Fleet puzzle This tutorial includes everything you need to set up decision optimization e...
davicsilva/dsintensive
notebooks/eda-miniprojects/human_temp/sliderule_dsi_inferential_statistics_exercise_1.ipynb
apache-2.0
import pandas as pd df = pd.read_csv('data/human_body_temperature.csv') # Your work here. # Load Matplotlib + Seaborn and SciPy libraries import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy import stats from scipy.stats import norm from statsmodels.stats.weightstats import ztest %matp...
tensorflow/docs-l10n
site/ko/guide/function.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...
josh-gree/maths-with-python
05-classes-oop.ipynb
mit
p_normal = (12, -14, 0, 2) """ Explanation: Classes and Object Oriented Programming We have looked at functions which take input and return output (or do things to the input). However, sometimes it is useful to think about objects first rather than the actions applied to them. Think about a polynomial, such as the cub...
SamLau95/nbinteract
docs/notebooks/recipes/recipes_layout.ipynb
bsd-3-clause
df_interact(videos) # nbi:left options = { 'title': 'Views for Trending Videos', 'xlabel': 'Date Trending', 'ylabel': 'Views', 'animation_duration': 500, 'aspect_ratio': 1.0, } def xs(channel): return videos.loc[videos['channel_title'] == channel].index def ys(xs): return videos.loc[xs, '...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session11/Day3/PSFphotometrySolutions.ipynb
mit
import numpy as np from astropy.io import fits import matplotlib.pyplot as plt import astropy.convolution import pandas as pd f = fits.open("calexp-0527247_10.fits") image = f[1].data """ Explanation: PSF Photometry Version 0.1 We're going to try to piece together the different elements of a PSF photometry pipeline ...
satishgoda/learning
python/libs/rxpy/support/A Decision Tree of Observable Operators. Part I - Creation.ipynb
mit
reset_start_time(O.just) stream = O.just({'answer': rand()}) disposable = subs(stream) sleep(0.5) disposable = subs(stream) # same answer # all stream ops work, its a real stream: disposable = subs(stream.map(lambda x: x.get('answer', 0) * 2)) """ Explanation: A Decision Tree of Observable Operators Part 1: NEW Observ...
ComputationalModeling/spring-2017-danielak
past-semesters/spring_2016/homework_assignments/Homework_6.ipynb
agpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math def calc_accel(velocity, use_resistance=True): ''' This function calculates and returns the acceleration vector from a launched t-shirt, given an input velocity. Optionally, you can turn on and off air resistance for c...
metpy/MetPy
v0.10/_downloads/0fad3c70b425eaed875fe7cd5ea738b8/Advanced_Sounding.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import add_metpy_logo, SkewT from metpy.units import units """ Explanation: Advanced Sounding Plot a sounding using MetPy with more advanced features. Beyond just p...
fdmazzone/Ecuaciones_Diferenciales
Teoria_Basica/scripts/EjerciciosGruposLie.ipynb
gpl-2.0
from sympy import * init_printing() x,epsilon=symbols('x,epsilon') y=Function('y')(x) x1=x*(x+y)/(y+(1+epsilon)*x) y1=(epsilon*x+y)*(x+y)/(y+(1+epsilon)*x) exp1=y1.diff(x)/x1.diff(x) exp2=exp1.subs(y.diff(x),(x**2*sin(x+y)+y)/x/(1-x*sin(x+y))) x1,y1=symbols('x1,y1') exp2=exp2.simplify() exp3=exp2.subs({y:(-epsilon*x1+y...
LorenzoBi/courses
UQ/assignment_3/Assignment 3.ipynb
mit
import numpy as np from scipy.special import binom import matplotlib.pylab as plt from scipy.misc import factorial as fact %matplotlib inline def binomial(p, n, k): return binom(n, k) * p ** k * (1 - p) ** (n-k) """ Explanation: Lorenzo Biasi and Michael Aichmüller End of explanation """ p = 1. / 365 1 - np.su...
Upward-Spiral-Science/team1
code/Assignment11_Akash.ipynb
apache-2.0
from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt %matplotlib inline import numpy as np import urllib2 import scipy.stats as stats np.set_printoptions(precision=3, suppress=True) url = ('https://raw.githubusercontent.com/Upward-Spiral-Science' '/data/master/syn-density/output.csv') data =...
mne-tools/mne-tools.github.io
0.14/_downloads/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(...
idekerlab/deep-cell
data-builder/tree_generator-clixo-final.ipynb
mit
# Load data sets import pandas as pd treeSourceUrl = './data/preds_yeastnet_no_gi_0.04_0.5.txt.propagate.small_parent_tree' geneCountFile = './data/preds_yeastnet_no_gi_0.04_0.5.txt.propagate.term_sizes' alignmentFile = './data/alignments_FDR_0.1_t_0.1' geneAssignment = './data/preds_yeastnet_no_gi_0.04_0.5.txt.propag...
ML4DS/ML4all
C1.Intro_Classification/Intro_Classification_student.ipynb
mit
# To visualize plots in the notebook %matplotlib inline # Import some libraries that will be necessary for working with data and displaying plots import csv # To read csv files import random import matplotlib.pyplot as plt import numpy as np from scipy import spatial from sklearn import neighbors, datasets """ E...
dcavar/python-tutorial-for-ipython
notebooks/Python Word Sense Disambiguation.ipynb
apache-2.0
from nltk.corpus import wordnet """ Explanation: Python Word Sense Disambiguation (C) 2017-2019 by Damir Cavar Version: 1.2, November 2019 License: Creative Commons Attribution-ShareAlike 4.0 International License (CA BY-SA 4.0) This is a tutorial related to the discussion of a WordSense disambiguation and various mac...
akront1104/World_Bank_Data
sliderule_dsi_json_exercise.ipynb
mit
import pandas as pd """ Explanation: JSON examples and exercise get familiar with packages for dealing with JSON study examples with JSON strings and files work on exercise to be completed and submitted reference: http://pandas.pydata.org/pandas-docs/stable/io.html#io-json-reader data source: http://jsonstudio....
kubeflow/pipelines
samples/tutorials/gpu/gpu.ipynb
apache-2.0
import kfp from kfp import dsl def gpu_smoking_check_op(): return dsl.ContainerOp( name='check', image='tensorflow/tensorflow:latest-gpu', command=['sh', '-c'], arguments=['nvidia-smi'] ).set_gpu_limit(1) @dsl.pipeline( name='GPU smoke check', description='smoke check a...
kimkipyo/dss_git_kkp
Python 복습/11일차.목_Pandas/11일차_3T_ajax 로 이루어진 select, option 정보 가져오기 ( feat, 건강보험심사평가원 ).ipynb
mit
import requests from bs4 import BeautifulSoup #requests한 것을 parsiing하기 위해서 response = requests.get("http://www.hira.or.kr/re/diag/getDiagAmtList.do") dom = BeautifulSoup(response.text, "html.parser") dom.select_one("#sidoCd") select_element = dom.select_one("#sidoCd") print(select_element) """ Explanation: 3T_aj...
sdpython/pyquickhelper
_unittests/ut_helpgen/data_gallery/notebooks/2a/notebook_convert.ipynb
mit
%%javascript var kernel = IPython.notebook.kernel; var body = document.body, attribs = body.attributes; var command = "theNotebook = " + "'"+attribs['data-notebook-name'].value+"'"; kernel.execute(command); if "theNotebook" in locals(): a=theNotebook else: a="pas trouvé" a """ Explanation: Convert a not...
mne-tools/mne-tools.github.io
0.17/_downloads/af4923da095ff8767e419fa9e705bbba/plot_dipole_orientations.ipynb
bsd-3-clause
from mayavi import mlab import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse data_path = sample.data_path() evokeds = mne.read_evokeds(data_path + '/MEG/sample/sample_audvis-ave.fif') left_auditory = evokeds[0].apply_baseline() fwd = mne.read_forward_solution( ...
ctuning/ck-math
script/explore-clblast-matrix-size/clblast-distribution-tuner-sizes-analysis.ipynb
bsd-3-clause
import os import sys import json import re """ Explanation: [PUBLIC] Analysis of CLBlast tuning <a id="overview"></a> Overview This Jupyter Notebook analyses the performance that CLBlast achieves across a range of routines, sizes and configurations. Run first clblast-tuning-benchmarking.py <a id="data"></a> Get the e...
abevieiramota/data-science-cookbook
2017/05-naive-bayes/Naive_Bayes_Tutorial_01.ipynb
mit
import csv def loadCsv(filename): lines = csv.reader(open(filename, "r")) dataset = list(lines) for i in range(len(dataset)): dataset[i] = [float(x) for x in dataset[i]] return dataset """ Explanation: Naive Bayes Introdução Neste tutorial iremos apresentar a implentação do algoritmo Naive Ba...
rebeccabilbro/rebeccabilbro.github.io
_drafts/mushroom_tutorial_reboot.ipynb
mit
from yellowbrick.datasets import load_mushroom X, y = load_mushroom() print(X[:5]) # inspect the first five rows """ Explanation: Model Selection Tutorial with Yellowbrick In this tutorial, we are going to look at scores for a variety of scikit-learn models and compare them using visual diagnostic tools from Yellowbr...
reece/ga4gh-examples
nb/Search VariantAnnotations using SO term sets.ipynb
apache-2.0
import itertools import pprint import re from IPython.display import HTML, display import ga4gh.client import prettytable import requests print(ga4gh.__version__) gc = ga4gh.client.HttpClient("http://localhost:8000") region_constraints = dict(referenceName="1", start=0, end=int(1e10)) variant_set_id = 'YnJjYTE6T1I...
Vvkmnn/books
AutomateTheBoringStuffWithPython/lesson39.ipynb
gpl-3.0
# Test the requests module by importing it import requests # Store a website url in a response object that can be queried res = requests.get('https://automatetheboringstuff.com/files/rj.txt') """ Explanation: Lesson 39: Downloading from the Web with the Requests Module The requests module lets you easily download fil...
zach-hartwig/IPyLogbook
mgmt/IPyLogbookExtensions.ipynb
gpl-3.0
# Enable Python variables to by inserted into Markdown cells via the "{{}}" syntax use_python_markdown = True # Enable cells to be 'read-only' via 'lock' click button up above-right use_read_only = True # Enable all input cells to be hidden via ' bars'click button above-right use_hide_input_all = True # Enable png/j...
rflamary/POT
docs/source/auto_examples/plot_otda_color_images.ipynb
mit
# Authors: Remi Flamary <remi.flamary@unice.fr> # Stanislas Chambon <stan.chambon@gmail.com> # # License: MIT License import numpy as np from scipy import ndimage import matplotlib.pylab as pl import ot r = np.random.RandomState(42) def im2mat(I): """Converts an image to matrix (one pixel per line)"""...
ml-ensemble/ml-ensemble.github.io
info/_downloads/parallel.ipynb
mit
from mlens.parallel import ParallelProcessing, Job, Learner from mlens.index import FoldIndex from mlens.utils.dummy import OLS import numpy as np np.random.seed(2) X = np.arange(20).reshape(10, 2) y = np.random.rand(10) indexer = FoldIndex(folds=2) learner = Learner(estimator=OLS(), indexer=index...
jhaip/livedata-mqtt
notebooks/D3 MQTT 9DOF.ipynb
mit
from IPython.core.display import display, HTML from string import Template import pandas as pd import json, random %%javascript require.config({paths: {d3: "https://d3js.org/d3.v4.min"}}); require(['d3'], function(d3) { window.d3 = d3; }) html_template = Template(''' <svg id="graph-div"></div> <script> $js_text <...
leizhipeng/ml
titanic_survival_exploration/titanic_survival_exploration.ipynb
gpl-3.0
# Import libraries necessary for this project import numpy as np import pandas as pd from IPython.display import display # Allows the use of display() for DataFrames # Import supplementary visualizations code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inline # Load the dataset in_file...
pagutierrez/tutorial-sklearn
notebooks-spanish/05-aprendizaje_supervisado_clasificacion.ipynb
cc0-1.0
from sklearn.datasets import make_blobs X, y = make_blobs(centers=2, random_state=0) print('X ~ n_samples x n_features:', X.shape) print('y ~ n_samples:', y.shape) print('\n5 primeros ejemplos:\n', X[:5, :]) print('\n5 primeras etiquetas:', y[:5]) """ Explanation: Aprendizaje supervisado parte 1 -- Clasificación Pa...
elastic/examples
Machine Learning/Query Optimization/notebooks/2 - Query tuning - best_fields.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 import importlib import os import sys from elasticsearch import Elasticsearch from skopt.plots import plot_objective # project library sys.path.insert(0, os.path.abspath('..')) import qopt importlib.reload(qopt) from qopt.notebooks import evaluate_mrr100_dev, optimize_query_mrr10...
DJCordhose/ai
notebooks/rl/berater-v8.ipynb
mit
!pip install git+https://github.com/openai/baselines >/dev/null !pip install gym >/dev/null """ Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/rl/berater-v8.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab...