repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
daniel-koehn/Theory-of-seismic-waves-II
05_2D_acoustic_FD_modelling/6_fdac2d_marmousi_model_exercise.ipynb
gpl-3.0
# Execute this cell to load the notebook's style sheet, then ignore it from IPython.core.display import HTML css_file = '../style/custom.css' HTML(open(css_file, "r").read()) """ Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 by D. Koehn, heterogeneou...
tensorflow/lucid
notebooks/feature-visualization/regularization.ipynb
apache-2.0
# 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 the L...
jamesjia94/BIDMach
tutorials/CreateModels.ipynb
bsd-3-clause
import BIDMat.{CMat,CSMat,DMat,Dict,IDict,FMat,FND,GDMat,GMat,GIMat,GLMat,GSDMat,GSMat, HMat,IMat,Image,LMat,Mat,SMat,SBMat,SDMat} import BIDMat.MatFunctions._ import BIDMat.SciFunctions._ import BIDMat.Solvers._ import BIDMat.JPlotting._ import BIDMach.Learner import BIDMach.models.{FM,GLM,KMeans,KMeans...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/ml_ops/stage6/get_started_with_matching_engine_twotowers.ipynb
apache-2.0
import os # The Vertex AI Workbench Notebook product has specific requirements IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME") IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists( "/opt/deeplearning/metadata/env_version" ) # Vertex AI Notebook requires dependencies to be installed with '--user' USER_FLAG = ...
Krekelmans/Train_prediction_kaggle
BDS_Lab09_FILL_IN-plots.ipynb
mit
import os os.getcwd() %matplotlib inline %pylab inline import pandas as pd import numpy as np from collections import Counter, OrderedDict import json import matplotlib import matplotlib.pyplot as plt import re from scipy.misc import imread from sklearn.linear_model import LogisticRegression from sklearn.model_select...
pligor/predicting-future-product-prices
02_preprocessing/exploration04-price_history_dfa.ipynb
agpl-3.0
# -*- coding: UTF-8 -*- from __future__ import division import numpy as np import pandas as pd import sys import math from sklearn.preprocessing import LabelEncoder, OneHotEncoder import re import os import csv from helpers.outliers import MyOutliers from skroutz_mobile import SkroutzMobile from sklearn.ensemble import...
arcyfelix/Courses
18-03-07-Deep Learning With Python by François Chollet/Chapter 6.2 - Understanding recurrent neural networks.ipynb
apache-2.0
from keras.models import Sequential from keras.layers import Embedding, SimpleRNN model = Sequential() model.add(Embedding(10000, 32)) model.add(SimpleRNN(32)) model.summary() """ Explanation: Chapter 6.2 - Understanding recurrent neural networks Simple RNN SimpleRNN layer takes input of shape (batch_size, timesteps,...
metpy/MetPy
v1.1/_downloads/87fd6ee8be4ea1587fa2ad7f4206407a/Combined_plotting.ipynb
bsd-3-clause
import xarray as xr from metpy.cbook import get_test_data from metpy.plots import ContourPlot, ImagePlot, MapPanel, PanelContainer from metpy.units import units # Use sample NARR data for plotting narr = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False)) """ Explanation: Combined Plotting Demonstra...
JarnoRFB/qtpyvis
notebooks/tensorflow/train.ipynb
mit
from IPython.display import clear_output, Image, display, HTML # Helper functions for TF Graph visualization def strip_consts(graph_def, max_const_size=32): """Strip large constant values from graph_def.""" strip_def = tf.GraphDef() for n0 in graph_def.node: n = strip_def.node.add() n.Mer...
karst87/ml
dev/pyml/datacamp/kaggle-python-tutorial-on-machine-learning/01_getting-started-with-python.ipynb
mit
#Compute x = 4 * 3 and print the result x = 4 * 3 print(x) #Compute y = 6 * 9 and print the result y = 6 * 9 print(y) """ Explanation: getting-started-with-python https://campus.datacamp.com/courses/kaggle-python-tutorial-on-machine-learning/getting-started-with-python?ex=1 1. How it works https://campus.datacamp.com...
philippgrafendorfe/stackedautoencoders
ROBO_SAE_Comments.ipynb
mit
IPython.display.Image("images/robo1_nn.png") """ Explanation: Title of Database: Wall-Following navigation task with mobile robot SCITOS-G5 The data were collected as the SCITOS G5 navigates through the room following the wall in a clockwise direction, for 4 rounds. To navigate, the robot uses 24 ultrasound sensors ar...
TimofeyBalashov/MagnetizationTunneling
Using the code.ipynb
mit
%pylab inline from ipywidgets import interact from pyatoms.J.SingleAtom import SingleAtom import mpmath as mp """ Explanation: Calculation of atomic spectra in crystal field This notebook introduces the code for calculating the energy spectrum of single magnetic atoms in environments of various symmetry. Loading the l...
wheeler-microfluidics/teensy-minimal-rpc
teensy_minimal_rpc/notebooks/dma-examples/Example - Multi-channel ADC using DMA.ipynb
gpl-3.0
from arduino_rpc.protobuf import resolve_field_values from teensy_minimal_rpc import SerialProxy import teensy_minimal_rpc.DMA as DMA import teensy_minimal_rpc.ADC as ADC # Disconnect from existing proxy (if available) try: del proxy except NameError: pass proxy = SerialProxy() """ Explanation: Overview Use...
empet/Math
Joukowski-airfoil.ipynb
bsd-3-clause
import numpy as np import numpy.ma as ma import matplotlib.pyplot as plt %matplotlib inline def Juc(z, lam):#Joukowski transformation return z+(lam**2)/z def circle(C, R): t=np.linspace(0,2*np.pi, 200) return C+R*np.exp(1j*t) def deg2radians(deg): return deg*np.pi/180 plt.rcParams['figure.figsize'] ...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/vertex_endpoints/tf_hub_obj_detection/deploy_tfhub_object_detection_on_vertex_endpoints.ipynb
apache-2.0
import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLOUD_NOTEBOOK: USER_FLAG = "--user" ! pip install {U...
phoebe-project/phoebe2-docs
2.1/tutorials/pitch_yaw.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Misalignment (Pitch & Yaw) Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplotlib i...
spectralDNS/shenfun
binder/sphere-helmholtz.ipynb
bsd-2-clause
from shenfun import * from shenfun.la import SolverGeneric1ND import sympy as sp """ Explanation: Spherical coordinates in shenfun The Helmholtz equation is given as $$ -\nabla^2 u + \alpha u = f. $$ In this notebook we will solve this equation on a unitsphere, using spherical coordinates. To verify the implementation...
phockett/ePSproc
notebooks/plottingDev/ITK_tests_070320.ipynb
gpl-3.0
import numpy as np from itkwidgets import view """ Explanation: ITK widgets tests See also pyVista_tests_070320.ipynb End of explanation """ number_of_points = 3000 gaussian_1_mean = [0.0, 0.0, 0.0] gaussian_1_cov = [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 0.5]] point_set_1 = np.random.multivariate_normal(gau...
agarwal-shubham/ACNN
deep_learning_for_3D_shape_analysis_anisotropic.ipynb
mit
import sys import os import numpy as np import scipy.io import time import theano import theano.tensor as T import theano.sparse as Tsp import lasagne as L import lasagne.layers as LL import lasagne.objectives as LO from lasagne.layers.normalization import batch_norm sys.path.append('..') from icnn import aniso_util...
kinnala/sp.fem
learning/Example 1 - Stokes equations.ipynb
agpl-3.0
import sys sys.path.append('../') import numpy as np import matplotlib.pyplot as plt from spfem.geometry import GeometryMeshPyTriangle %matplotlib inline """ Explanation: Problem statement The Stokes problem is a classical example of a mixed problem. Initialize End of explanation """ g = GeometryMeshPyTriangle(np.a...
WomensCodingCircle/CodingCirclePython
Lesson12_TabularData/Tabular Data.ipynb
mit
import csv """ Explanation: Using Tabular Data in Python csv module Python has a csv reader/writer as part of its built in library. It is called csv. This is the simplest way to read tabular data (data in table format). The type of data you used to use excel to process (hopefully you will try out python now). It must ...
chetnapriyadarshini/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
laic/gensim
docs/notebooks/doc2vec-IMDB.ipynb
lgpl-2.1
import locale import glob import os.path import requests import tarfile import sys import codecs dirname = 'aclImdb' filename = 'aclImdb_v1.tar.gz' locale.setlocale(locale.LC_ALL, 'C') if sys.version > '3': control_chars = [chr(0x85)] else: control_chars = [unichr(0x85)] # Convert text to lower-case and stri...
BYUFLOWLab/MDOnotebooks
MonteCarlo.ipynb
mit
def func(x): return x[0]**2 + 2*x[1]**2 + 3*x[2]**2 def con(x): return x[0] + x[1] + x[2] - 3.5 # rewritten in form c <= 0 x = [1.0, 1.0, 1.0] sigma = [0.00, 0.06, 0.2] """ Explanation: Monte Carlo This is the simple Monte Carlo example you worked on in class. Consider the following objective and constraint...
miaecle/deepchem
examples/notebooks/deepchem_tensorflow_eager.ipynb
mit
import tensorflow as tf import tensorflow.contrib.eager as tfe """ Explanation: TensorGraph Layers and TensorFlow eager In this tutorial we will look at the working of TensorGraph layer with TensorFlow eager. But before that let's see what exactly is TensorFlow eager. Eager execution is an imperative, define-by-run i...
ComputationalModeling/spring-2017-danielak
past-semesters/spring_2016/day-by-day/day22-traveling-salesman-problem/TravelingSalesman_Problem_SOLUTIONS.ipynb
agpl-3.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt from IPython.display import display, clear_output def calc_total_distance(table_of_distances, city_order): ''' Calculates distances between a sequence of cities. Inputs: N x N table containing distances between each pair of the N ...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_object_evoked.ipynb
bsd-3-clause
import os.path as op import mne """ Explanation: The :class:Evoked &lt;mne.Evoked&gt; data structure: evoked/averaged data End of explanation """ data_path = mne.datasets.sample.data_path() fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif') evokeds = mne.read_evokeds(fname, baseline=(None, 0), pro...
hannorein/rebound
ipython_examples/HybridIntegrationsWithMercurius.ipynb
gpl-3.0
import math import rebound, rebound.data %matplotlib inline sim = rebound.Simulation() rebound.data.add_outer_solar_system(sim) # add some particles for testing for i in range(1,sim.N): sim.particles[i].m *= 50. sim.integrator = "WHFast" # This will end badly! sim.dt = sim.particles[1].P * 0.002 # Timestep a small ...
kcyu1993/ML_course_kyu
labs/ex01/solutions/taskB.ipynb
mit
np.random.seed(10) p, q = (np.random.rand(i, 2) for i in (4, 5)) p_big, q_big = (np.random.rand(i, 80) for i in (100, 120)) print(p, "\n\n", q) """ Explanation: Data Generation End of explanation """ def naive(p, q): result = np.zeros((p.shape[0], q.shape[0])) for i in range(p.shape[0]): for j in ra...
mayankjohri/LetsExplorePython
Section 1 - Core Python/Chapter 06 - Functions/1. Functions.ipynb
gpl-3.0
def caps(val): """ caps returns double the value of the provided value """ return val*2 a = caps("TEST ") print(a) print(caps.__doc__) """ Explanation: Functions Functions are blocks of code identified by a name, which can receive ""predetermined"" parameters or not ;). In Python, functions: return o...
sbenthall/bigbang
examples/experimental_notebooks/Single Word Trend.ipynb
agpl-3.0
df = pd.DataFrame(columns=["MessageId","Date","From","In-Reply-To","Count"]) for row in archives[0].data.iterrows(): try: w = row[1]["Body"].replace("'", "") k = re.sub(r'[^\w]', ' ', w) k = k.lower() t = nltk.tokenize.word_tokenize(k) subdict = {} count = 0 ...
sysid/nbs
LP/Introduction-to-linear-programming/Introduction to Linear Programming with Python - Part 6.ipynb
mit
def make_io_and_constraint(y1, x1, x2, target_x1, target_x2): """ Returns a list of constraints for a linear programming model that will constrain y1 to 1 when x1 = target_x1 and x2 = target_x2; where target_x1 and target_x2 are 1 or 0 """ binary = [0,1] assert target_x1 in binary a...
JannesKlaas/MLiFC
Week 1/Ch. 5 - Multiclass Regression.ipynb
mit
# Package imports # Matplotlib is a matlab like plotting library import matplotlib import matplotlib.pyplot as plt # Numpy handles matrix operations import numpy as np # SciKitLearn is a useful machine learning utilities library import sklearn # The sklearn dataset module helps generating datasets import sklearn.datase...
NYUDataBootcamp/Projects
UG_F16/Qian-DevEconCorrelation .ipynb
mit
import pandas as pd # data package import matplotlib.pyplot as plt # graphics import seaborn as sns # seaborn graphics package import numpy as np # foundation for pandas import sys # system module import datetime as dt ...
bloomberg/bqplot
examples/Tutorials/Brush Interval Selector.ipynb
apache-2.0
import numpy as np from ipywidgets import Layout, HTML, VBox import bqplot.pyplot as plt """ Explanation: Linking Plots Using Brush Interval Selector Details on how to use the brush interval selector can be found in this notebook. Brush interval selectors can be used where continuous updates are not desirable (for ex...
DawesLab/LabNotebooks
Timescales in QuTiP.ipynb
mit
from qutip import * import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Timescales in QuTiP Andrew M.C. Dawes — 2016 An overview to one frequently asked question about QuTiP. Introduction QuTiP is a python package, if you are new to QuTiP, you should first read the tutorial materials...
denglert/manuals
python/modules/matplotlib/legend/notebooks/legend_outside_figure.ipynb
mit
import matplotlib.pyplot as plt import matplotlib.patches as mpatches import matplotlib.lines as mlines import numpy as np %matplotlib inline x = np.linspace(0.0, 2.0*np.pi, 100) y = np.sin(x) """ Explanation: Legend outside the axis References: - https://matplotlib.org/examples/pylab_examples/figlegend_demo.html End...
heatseeknyc/data-science
src/bryan analyses/Hack for Heat #6.ipynb
mit
#Like before, we're going to select the relevant columns from the database: connection = psycopg2.connect('dbname= threeoneone user=threeoneoneadmin password=threeoneoneadmin') cursor = connection.cursor() cursor.execute('''SELECT createddate, closeddate, borough FROM service;''') data = cursor.fetchall() data = pd.Da...
seg/2016-ml-contest
MandMs/03_Facies_classification-MandMs_RandomForest_EngineeredFeatures_SFSelection_ValidationCurves.ipynb
apache-2.0
%matplotlib inline import numpy as np import scipy as sp from scipy.stats import randint as sp_randint from scipy.signal import argrelextrema import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd from sklearn import preprocessing from sklearn.metrics import f1_score, make_scorer from sklearn.mod...
scheib/chromium
third_party/tensorflow-text/src/docs/tutorials/uncertainty_quantification_with_sngp_bert.ipynb
bsd-3-clause
#@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...
griffinfoster/fundamentals_of_interferometry
3_Positional_Astronomy/3_1_equatorial_coordinates.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS from IPython.display import HTML HTML('../style/code_toggle.html') import healpy as hp %pylab inline pylab.rcParams['figure.figsize'] = (15, 10) import matplotlib impor...
piskvorky/gensim
docs/src/auto_examples/tutorials/run_annoy.ipynb
lgpl-2.1
LOGS = False # Set to True if you want to see progress in logs. if LOGS: import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) """ Explanation: Fast Similarity Queries with Annoy and Word2Vec Introduces the Annoy library for similarity queries on top of vec...
me-surrey/dl-gym
05_support_vector_machines.ipynb
apache-2.0
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs np.random.seed(42) # To plot pretty figures %matplotlib inline import matplotlib import matplotlib.pyplot as plt ...
pucdata/pythonclub
sessions/05-astropy/Astropy Explored.ipynb
gpl-3.0
#Preamble. These are some standard things I like to include in IPython Notebooks. import astropy from astropy.table import Table, Column, MaskedColumn import numpy as np import matplotlib.pyplot as plt from astropy.io import fits from astropy import units as u from astropy.coordinates import SkyCoord, Angle import astr...
russellclarke82/CV
Pi/String formatting for printing.ipynb
apache-2.0
print('This is a String {}'.format('INSERTED')) print('This is an example of MultiIndex insertions {} {} {}'.format('INSERTION1', 'INSERTION2', 'INSERTION3')) a = 'I1' b = 'I2' c = 'I3' print('This is me jumping the gun and testing a theory {} {} {}'.format(a, b, c)) print('Now testing MultiIndexed Insertions witho...
GoogleCloudPlatform/rad-lab
modules/data_science/scripts/build/notebooks/Quantum_Simulation_qsimcirq.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...
tsaqib/bike-sharing-time-series-nn-numpy
cnn-tensorflow/cnn-tensorflow.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile import helper import numpy as np from sklearn.preprocessing import LabelBinarizer import pickle import tensorflow as tf import random %matplotlib inline %config InlineBackend....
sdpython/ensae_teaching_cs
_doc/notebooks/sklearn_ensae_course/01_data_manipulation.ipynb
mit
# Start pylab inline mode, so figures will appear in the notebook %matplotlib inline """ Explanation: 2A.ML101.1: Introduction to data manipulation with scientific Python In this section we'll go through the basics of the scientific Python stack for data manipulation: using numpy and matplotlib. Source: Course on mach...
jpn--/larch
larch/doc/example/107_latent_class.ipynb
gpl-3.0
import larch import pandas from larch.roles import P,X """ Explanation: 107: Latent Class Models In this example, we will replicate the latent class example model from Biogeme. End of explanation """ from larch import data_warehouse raw = pandas.read_csv(larch.data_warehouse.example_file('swissmetro.csv.gz')) """ E...
datactive/bigbang
examples/activity/Cohort Visualization.ipynb
mit
url = "6lo" arx = Archive(url,archive_dir="../archives") arx.data[:1] """ Explanation: One interesting question for open source communities is whether they are growing. Often the founding members of a community would like to see new participants join and become active in the community. This is important for community...
Zweedeend/interactive-2d-gvdw
gvdw-bokeh.ipynb
mit
import inspect from math import sqrt, pi import numpy as np import pandas as pd from bokeh.io import show, output_notebook, push_notebook from bokeh.plotting import figure from ipywidgets import interact from scipy.integrate import quad output_notebook() """ Explanation: Equation of State using Generalized van der W...
AEW2015/PYNQ_PR_Overlay
Pynq-Z1/notebooks/Video_PR/Image_Duotone_Overlay_Filter.ipynb
bsd-3-clause
from pynq.drivers.video import HDMI from pynq import Bitstream_Part from pynq.board import Register from pynq import Overlay Overlay("demo.bit").download() """ Explanation: Don't forget to delete the hdmi_out and hdmi_in when finished Image Overlay Duotone Color Filter Example In this notebook, we will overlay an ima...
WNoxchi/Kaukasos
pytorch/fastai-pytorch-tutorial-scratch-notes.ipynb
mit
from pathlib import Path import requests data_path = Path('data') path = data_path/'mnist' path.mkdir(parents=True, exist_ok=True) url = 'http://deeplearning.net/data/mnist/' filename = 'mnist.pkl.gz' (path/filename) if not (path/filename).exists(): content = requests.get(url+filename).content (path/filenam...
feststelltaste/software-analytics
prototypes/Complexity over Time.ipynb
gpl-3.0
import pandas as pd diff_raw = pd.read_csv( "../../buschmais-spring-petclinic_fork/git_diff.log", sep="\n", names=["raw"]) diff_raw.head(16) """ Explanation: The idea In my previous blog post, we got to know the idea of "indentation-based complexity". We took a static view on the Linux kernel to spot the ...
mne-tools/mne-tools.github.io
0.24/_downloads/5f078eabe74f0448d3e1662c12313289/source_space_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, source_band_induced_power print(__doc__) """ Explanation: Compute induced power in t...
mohanprasath/Course-Work
coursera/python_for_data_science/4.2Writing_and_Saving_Files.ipynb
gpl-3.0
with open('/resources/data/Example2.txt','w') as writefile: writefile.write("This is line A") """ Explanation: <a href="http://cocl.us/topNotebooksPython101Coursera"><img src = "https://ibm.box.com/shared/static/yfe6h4az47ktg2mm9h05wby2n7e8kei3.png" width = 750, align = "center"></a> <a href="https://www.bigdataun...
InsightLab/data-science-cookbook
2019/04-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...
chemo-wakate/tutorial-6th
beginner/mario/MachineLearning.ipynb
mit
# 数値計算やデータフレーム操作に関するライブラリをインポートする import numpy as np import pandas as pd import scipy as sp from scipy import stats # URL によるリソースへのアクセスを提供するライブラリをインポートする。 # import urllib # Python 2 の場合 import urllib.request # Python 3 の場合 # 図やグラフを図示するためのライブラリをインポートする。 %matplotlib inline import matplotlib.pyplot as plt # 機械学習関連のライブラ...
Yangqing/caffe2
caffe2/python/tutorials/create_your_own_dataset.ipynb
apache-2.0
# First let's import some necessities from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals %matplotlib inline import urllib2 # for downloading the dataset from the web. import numpy as np from matplotlib import pyplot from ...
lmoresi/UoM-VIEPS-Intro-to-Python
Notebooks/SphericalMeshing/SphericalTriangulations/Ex7-Refinement-of-Triangulations.ipynb
mit
import stripy as stripy import numpy as np """ Explanation: Example 7 - Refining a triangulation We have seen how the standard meshes can be uniformly refined to finer resolution. The routines used for this task are available to the stripy user for non-uniform refinement as well. Notebook contents Uniform meshes Re...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_stats_cluster_spatio_temporal_2samp.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Eric Larson <larson.eric.d@gmail.com> # License: BSD (3-clause) import os.path as op import numpy as np from scipy import stats as stats import mne from mne import spatial_tris_connectivity, grade_to_tris from mne.stats import spatio_...
GoogleCloudPlatform/mlops-on-gcp
workshops/kfp-caip-sklearn/lab-01-caip-containers/lab-01.ipynb
apache-2.0
import json import os import numpy as np import pandas as pd import pickle import uuid import time import tempfile from googleapiclient import discovery from googleapiclient import errors from google.cloud import bigquery from jinja2 import Template from kfp.components import func_to_container_op from typing import N...
agile-geoscience/xlines
notebooks/05_Read_and_write_SHP.ipynb
apache-2.0
import numpy as np import fiona import matplotlib.pyplot as plt import folium import pprint with fiona.open('../data/offshore_wells_2011_Geographic_NAD27.shp') as src: pprint.pprint(src[0]) """ Explanation: x lines of Python Read and write SHP files This notebook goes with the blog post of the same name, publishe...
mcflugen/bmi-tutorial
notebooks/coupled_example.ipynb
mit
%matplotlib inline import numpy as np """ Explanation: <img src="images/csdms_logo.jpg"> Using a BMI: Coupling Waves and Coastline Evolution Model This example explores how to use a BMI implementation to couple the Waves component with the Coastline Evolution Model component. Links CEM source code: Look at the files ...
rhiever/scipy_2015_sklearn_tutorial
notebooks/02.2 Supervised Learning - Regression.ipynb
cc0-1.0
x = np.linspace(-3, 3, 100) print(x) rng = np.random.RandomState(42) y = np.sin(4 * x) + x + rng.uniform(size=len(x)) plt.plot(x, y, 'o') """ Explanation: Regression In regression we try to predict a continuous output variable. This can be most easily visualized in one dimension. We will start with a very simple toy...
emilhe/tmm
examples.ipynb
mit
from __future__ import division, print_function, absolute_import from tmm import (coh_tmm, unpolarized_RT, ellips, position_resolved, find_in_structure_with_inf) from numpy import pi, linspace, inf, array from scipy.interpolate import interp1d import matplotlib.pyplot as plt %matplotlib inline ...
ivukotic/ML_platform_tests
PerfSONAR/AnomalyDetection/BDT/Testing BDT AD on simulated data.ipynb
gpl-3.0
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib matplotlib.rc('xtick', labelsize=14) matplotlib.rc('ytick', labelsize=14) from sklearn.model_selection import train_test_split from sklearn.model_selection import cross_val_score from sklearn.ensemble import...
Rotvig/cs231n
Deep Learning/Exercise 1/Q2.ipynb
mit
# As usual, a bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient from cs231n.layers import * %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolati...
yl565/statsmodels
examples/notebooks/statespace_dfm_coincident.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt np.set_printoptions(precision=4, suppress=True, linewidth=120) from pandas.io.data import DataReader # Get the datasets from FRED start = '1979-01-01' end = '2014-12-01' indprod = DataReader('IPMAN...
ysasaki6023/NeuralNetworkStudy
examples/visualization.ipynb
mit
def target(x): return np.exp(-(x - 2)**2) + np.exp(-(x - 6)**2/10) + 1/ (x**2 + 1) x = np.linspace(-2, 10, 1000) y = target(x) plt.plot(x, y) """ Explanation: Target Function Lets create a target 1-D function with multiple local maxima to test and visualize how the BayesianOptimization package works. The target ...
folivetti/BIGDATA
Spark/Lab5b_kmeans_quantiza.ipynb
mit
import os import numpy as np def parseRDD(point): """ Parser for the current dataset. It receives a data point and return a sentence (third field). Args: point (str): input data point Returns: str: a string """ data = point.split('\t') return (int(data[0]),data[2]) ...
emmaqian/DataScientistBootcamp
DS_HW1_Huimin Qian_052617.ipynb
mit
# import the necessary package at the very beginning import numpy as np import pandas as pd print(str(float(100*177/891)) + '%') """ Explanation: 数据应用学院 Data Scientist Program Hw1 End of explanation """ def foolOne(x): # note: assume x is a number y = x * 2 y -= 25 return y ## Type Your Answer Below ##...
trungdong/datasets-provanalytics-dmkd
Extra 2.2 - Unbalanced Data - Application 2.ipynb
mit
import pandas as pd df = pd.read_csv("collabmap/depgraphs.csv", index_col='id') df.head() df.describe() """ Explanation: Extra 2.1 - Unbalanced Data - Application 1: CollabMap Data Quality Assessing the quality of crowdsourced data in CollabMap from their provenance In this notebook, we compared the classification a...
lneuhaus/pyrpl
docs/source/user_guide/tutorial/tutorial.ipynb
mit
import pyrpl print pyrpl.__file__ """ Explanation: Introduction to pyrpl 1) Introduction The RedPitaya is an affordable FPGA board with fast analog inputs and outputs. This makes it interesting also for quantum optics experiments. The software package PyRPL (Python RedPitaya Lockbox) is an implementation of many devic...
egentry/lamat-2016-solutions
day5/ODE_practice.ipynb
mit
y_0 = 1 t_0 = 0 t_f = 10 def dy_dt(y): return .5*y def analytic_solution_1st_order(t): return np.exp(.5*t) dt = .5 t_array = np.arange(t_0, t_f, dt) y_array = np.empty_like(t_array) y_array[0] = y_0 for i in range(len(y_array)-1): y_array[i+1] = y_array[i] + (dt * dy_dt(y_array[i])) plt.plot(t_ar...
kit-cel/wt
wt/vorlesung/ch1_3/laplace_hypergeometric.ipynb
gpl-2.0
# importing import numpy as np from scipy import special import matplotlib.pyplot as plt import matplotlib # showing figures inline %matplotlib inline # plotting options font = {'size' : 20} plt.rc('font', **font) plt.rc('text', usetex=True) matplotlib.rc('figure', figsize=(18, 6) ) """ Explanation: Content an...
phoebe-project/phoebe2-docs
2.2/tutorials/optimizing.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" import phoebe b = phoebe.default_binary() """ Explanation: Advanced: Optimizing Performance with PHOEBE Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update ...
giotta/EUR8217
labo/tests/test-r-in-python.ipynb
mit
%load_ext rpy2.ipython """ Explanation: Jupyter, R et Python Exemple ci-dessous est le même que celui de test-r.ipynb mais le présent notebook a le kernel Python 3 (les code cells sont interprétées en Python par défaut. En suivant la procédure présentée dans le README.md, on arrive à utiliser R dans ce note book Pytho...
bjshaw/phys202-2015-work
assignments/assignment10/ODEsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy.integrate import odeint from IPython.html.widgets import interact, fixed """ Explanation: Ordinary Differential Equations Exercise 1 Imports End of explanation """ def solve_euler(derivs, y0, x): """Solve a 1d ...
pschragger/big-data-python-class
Lectures/Week 2 - Python and Jupyter for Big-Data/Lecture 2 continued.ipynb
mit
import re print all([ not re.match("a","cat"), re.search("a","cat"), not re.search("c","dog"), 3 == len(re.split("[ab]","carbs")), "R-D-" == re.sub("[0-9]","-","R2D2") ]) # prints true if all are true """ Explanation: Lecture 2 continued regular expressions Provides a way to search text. Looking f...
gwtsa/gwtsa
examples/groundwater_paper/Ex2_monitoring_network/Example2.ipynb
mit
# Import the packages import pandas as pd import pastas as ps import numpy as np import os import matplotlib.pyplot as plt %matplotlib inline # This notebook has been developed using Pastas version 0.9.9 and Python 3.7 print("Pastas version: {}".format(ps.__version__)) print("Pandas version: {}".format(pd.__version_...
rashikaranpuria/Machine-Learning-Specialization
Regression/Assignment_six/week-6-local-regression-assignment-blank.ipynb
mit
import graphlab """ Explanation: Predicting house prices using k-nearest neighbors regression In this notebook, you will implement k-nearest neighbors regression. You will: * Find the k-nearest neighbors of a given query input * Predict the output for the query input using the k-nearest neighbors * Choose the be...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/05_06/Final/Data Frame Plots.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: Data Frame Plots documentation: http://pandas.pydata.org/pandas-docs/stable/visualization.html End of explanation """ ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000)) ts...
harishkrao/Machine-Learning
Titanic - Machine Learning from Disaster - data analysis and visualization.ipynb
mit
sns.barplot(x='Pclass',y='Survived',data=train, hue='Sex') """ Explanation: The plot shows that the number of female survivors were significantly more than the male survivors. There were more survivors overall in first class than in any other class. There were also less survivors overall in third class than in any oth...
mne-tools/mne-tools.github.io
0.19/_downloads/006560919734f06efa76c80dc321a748/plot_object_source_estimate.ipynb
bsd-3-clause
import os from mne import read_source_estimate from mne.datasets import sample print(__doc__) # Paths to example data sample_dir_raw = sample.data_path() sample_dir = os.path.join(sample_dir_raw, 'MEG', 'sample') subjects_dir = os.path.join(sample_dir_raw, 'subjects') fname_stc = os.path.join(sample_dir, 'sample_au...
csadorf/signac
doc/signac_101_Getting_Started.ipynb
bsd-3-clause
import signac assert signac.__version__ >= '0.8.0' """ Explanation: 1.1 Getting started Prerequisites Installation This tutorial requires signac, so make sure to install the package before starting. The easiest way to do so is using conda: $ conda config --add channels conda-forge $ conda install signac or pip: pip in...
deepmind/enn
enn/colabs/epinet_demo.ipynb
apache-2.0
# Copyright 2022 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
anhquan0412/deeplearning_fastai
deeplearning1/nbs/char-rnn.ipynb
apache-2.0
path = get_file('nietzsche.txt', origin="https://s3.amazonaws.com/text-datasets/nietzsche.txt") text = open(path).read().lower() print('corpus length:', len(text)) !tail -n 25 {path} chars = sorted(list(set(text))) vocab_size = len(chars)+1 print('total chars:', vocab_size) chars.insert(0, "\0") ''.join(chars[1:-6]...
google-research/google-research
activation_clustering/examples/cifar10/train.ipynb
apache-2.0
import numpy as np import tensorflow as tf import tensorflow_datasets as tfds from activation_clustering import ac_model, utils # The same dataset preprocessing as used in the baseline cifar10 model training. def input_fn(batch_size, ds, label_key='label'): dataset = ds.batch(batch_size, drop_remainder=True).pre...
microsoft/dowhy
docs/source/example_notebooks/do_sampler_demo.ipynb
mit
import os, sys sys.path.append(os.path.abspath("../../../")) import numpy as np import pandas as pd import dowhy.api N = 5000 z = np.random.uniform(size=N) d = np.random.binomial(1., p=1./(1. + np.exp(-5. * z))) y = 2. * z + d + 0.1 * np.random.normal(size=N) df = pd.DataFrame({'Z': z, 'D': d, 'Y': y}) (df[df.D ==...
fdion/infographics_research
nfl_viz.ipynb
mit
!wget http://nflsavant.com/pbp_data.php?year=2015 -O pbp-2015.csv %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import seaborn as sns sns.set_context("talk") plt.figure(figsize=(10, 8)) df = pd.read_csv('pbp-2015.csv') # What do we have? df.columns def event_to_datetime(row): """Calcula...
derekjchow/models
research/deeplab/deeplab_demo.ipynb
apache-2.0
import os from io import BytesIO import tarfile import tempfile from six.moves import urllib from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np from PIL import Image import tensorflow as tf """ Explanation: Overview This colab demonstrates the steps to use the DeepLab model to pe...
google/starthinker
colabs/cm360_conversion_upload_from_bigquery.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Conversion Upload From BigQuery Move from BigQuery to CM. License Copyright 2020 Google LLC, 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 c...
broundy/udacity
nanodegrees/deep_learning_foundations/unit_1/lesson_11_handwriting_recognition/handwritten-digit-recognition-with-tflearn-exercise.ipynb
unlicense
# 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...
opentraffic/reporter-quality-testing-rig
notebooks/GPS Processing.ipynb
lgpl-3.0
import pandas as pd from matplotlib import pyplot as plt import os import sys; sys.path.insert(0, os.path.abspath('..')); import validator.validator as val import numpy as np import time as t import glob import seaborn as sns %matplotlib inline """ Explanation: Open Traffic Reporter: Speed Error Comparison with Real-W...
rkburnside/python_development
bootcamp/.ipynb_checkpoints/Functions and Methods Homework-checkpoint.ipynb
gpl-2.0
def vol(rad): pass """ Explanation: Functions and Methods Homework Complete the following questions: Write a function that computes the volume of a sphere given its radius. End of explanation """ def ran_check(num,low,high): pass """ Explanation: Write a function that checks whether a number is in a given ...
slundberg/shap
notebooks/tabular_examples/neural_networks/Census income classification with Keras.ipynb
mit
from sklearn.model_selection import train_test_split from keras.layers import Input, Dense, Flatten, Concatenate, concatenate, Dropout, Lambda from keras.models import Model from keras.layers.embeddings import Embedding from tqdm import tqdm import shap # print the JS visualization code to the notebook shap.initjs() ...
joshspeagle/frankenz
demos/2 - Photometric Inference.ipynb
mit
from __future__ import print_function, division import sys import pickle import numpy as np import scipy import matplotlib from matplotlib import pyplot as plt from six.moves import range # import frankenz code import frankenz as fz # plot in-line within the notebook %matplotlib inline np.random.seed(83481) # re-de...
davakian/playground
notebooks/sierpinski_cube_plotly.ipynb
mit
def sierp_cube_iter(x0, x1, y0, y1, z0, z1, cur_depth, max_depth=3, n_pts=10, cur_index=0): if cur_depth >= max_depth: x = np.linspace(x0, x1, n_pts) y = np.linspace(y0, y1, n_pts) z = np.linspace(z0, z1, n_pts) xx, yy, zz = np.meshgrid(x, y, z) rr = np...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex01-Read SST NetCDF data, subsample and save.ipynb
mit
%matplotlib inline import numpy as np from netCDF4 import Dataset # http://unidata.github.io/netcdf4-python/ """ Explanation: Read SST NetCDF data, Subsample and Save This notebook carries out some basic operations: * Open a data file * Check variables * Indexing to subsampe a variable * Save data 1. Load basic libr...