repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
GoogleCloudPlatform/asl-ml-immersion
notebooks/launching_into_ml/solutions/2_first_model.ipynb
apache-2.0
PROJECT = !gcloud config get-value project PROJECT = PROJECT[0] BUCKET = PROJECT REGION = "us-central1" %env PROJECT=$PROJECT %env BUCKET=$BUCKET %env REGION=$REGION """ Explanation: First BigQuery ML models for Taxifare Prediction Learning Objectives * Choose the correct BigQuery ML model type and specify options ...
mne-tools/mne-tools.github.io
stable/_downloads/9552276573be20bde95d1b4bc52b4768/20_event_arrays.ipynb
bsd-3-clause
import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False) raw.crop(tmax=60).load_data()...
google-research/computation-thru-dynamics
notebooks/LFADS Tutorial.ipynb
apache-2.0
# Numpy, JAX, Matplotlib and h5py should all be correctly installed and on the python path. from __future__ import print_function, division, absolute_import import datetime import h5py import jax.numpy as np from jax import random from jax.experimental import optimizers from jax.config import config #config.update("ja...
r-karasik/lanl-auth-cybersecurity
machine learning.ipynb
mit
df=pd.read_csv('md/msample1.csv', header=None) len(df) df[8].value_counts() """ Explanation: Load file sampled from data in auth.txt.gz so that number of fails is similar to the number of successes. End of explanation """ Y=(df[8]=='Success') """ Explanation: Creating clsssification label End of explanation """ ...
KaiSzuttor/espresso
doc/tutorials/11-ferrofluid/11-ferrofluid_part3.ipynb
gpl-3.0
import espressomd espressomd.assert_features('DIPOLES', 'LENNARD_JONES') from espressomd.magnetostatics import DipolarP3M import numpy as np """ Explanation: Ferrofluid - Part III Table of Contents Susceptibility with fluctuation formulas Derivation of the fluctuation formula Simulation Magnetization curve of a 3D...
lguduy/Data-Structure-and-Algorithms-in-Python
Note/第二章. 抽象数据类型和 Python 类.ipynb
mit
class Student(object): skills = [] def __init__(self, name): self.name = name stu = Student('ly') print Student.skills # 访问类数据属性 Student.skills.append('Python') print Student.skills print stu.skills # 通过实例也能访问类数据属性 print dir(Student) Student.age = 25 # 通过类名动态添加类数据属性 print di...
mne-tools/mne-tools.github.io
0.17/_downloads/1048fcdfaf4847afa747b1cc9df74e2d/plot_movement_compensation.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from os import path as op import mne from mne.preprocessing import maxwell_filter print(__doc__) data_path = op.join(mne.datasets.misc.data_path(verbose=True), 'movement') head_pos = mne.chpi.read_head_pos(op.join(data_path, 'simulated_qu...
GoogleCloudPlatform/asl-ml-immersion
notebooks/jax/solutions/jax_fundamentals.ipynb
apache-2.0
import jax import jax.numpy as jnp import numpy as np from matplotlib import pyplot as plt # Check connected accelerators. Depending on what runtime you're connected to, # this will show a single CPU/GPU, or 8 TPU cores (jf_2x2 aka JellyDonut). # You can start a TPU runtime via : "Connect to a runtime" -> "Start" -> ...
tpin3694/tpin3694.github.io
python/testable_documentation.ipynb
mit
import doctest """ Explanation: Title: Testable Documentation Slug: testable_documentation Summary: Testable Documentation in Python. Date: 2016-01-23 12:00 Category: Python Tags: Testing Authors: Chris Albon Interesting in learning more? Here are some good books on unit testing in Python: Python Testing: Beginner'...
probml/pyprobml
notebooks/book1/04/laplace_approx_beta_binom_jax.ipynb
mit
try: from probml_utils import latexify, savefig except: %pip install git+https://github.com/probml/probml-utils.git from probml_utils import latexify, savefig import jax import jax.numpy as jnp from jax import lax try: from tensorflow_probability.substrates import jax as tfp except ModuleNotFoundError...
WoodResourcesGroup/EPIC_AllPowerLabs
IOUdata/ReadFromDB-Copy1.ipynb
mit
import pandas as pd from sqlalchemy import create_engine """ Explanation: This notebook is intended to show how to use pandas, and sql alchemy to upload data into DB2-switch. Install using pip or any other package manager pandas, sqlalchemy and pg8000. The later one is the driver to connect to the db. End of explanati...
csc-training/python-introduction
notebooks/exercises/8 - Object oriented programming.ipynb
mit
class Car: def __init__(self, make, model, year, mpg=25, tank_capacity=30.0, miles=0): self.make = make self.model = model self.year = year self.mpg = mpg self.gallons_in_tank = tank_capacity # cars start with a full tank self.tank_capacity = tank_capacity ...
PMEAL/OpenPNM-Examples
Simulations/relative_diffusivity.ipynb
mit
import openpnm import numpy as np import matplotlib.pyplot as plt """ Explanation: Relative Diffusivity Generating the Network, adding Geometry and creating Phases This example shows you how to calculate a transport property relative to the saturation of the domain by a particular phase. In this case the property is t...
AllenDowney/ModSimPy
soln/chap07soln.ipynb
mit
# Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_assign' # import functions from the modsim.py module from modsim import * from pandas import read_html """ Expl...
mne-tools/mne-tools.github.io
0.23/_downloads/b7659d33d6ffe8531d004e9d6051f16f/forward_sensitivity_maps.ipynb
bsd-3-clause
# Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.source_space import compute_distance_to_sensors from mne.source_estimate import SourceEstimate import matplotlib.pyplot as plt print(__doc__) data_path = sample.data_path...
mayankjohri/LetsExplorePython
Section 1 - Core Python/Chapter S1.A - Review & Class work/Interview Questions - Core Python.ipynb
gpl-3.0
lst = [1, 2, 3, 44, 4, 2, 44, 55, 2, 34] print(list(set(lst))) """ Explanation: Interview Questions - Core Python I have only recently started collecting the Interview Questions for Core Python. I will keep on adding more interview questions. I am also planning to pen a seperate ebook with details questions and solut...
namco1992/algorithms_in_python
algorithms/tree.ipynb
mit
class BinaryTree(): def __init__(self, root_obj): self.key = root_obj self.left_child = None self.right_child = None def insert_left(self, new_node): # if the tree do not have a left child # then create a node: one tree without children if self.left_child is ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/tfx_pipelines/walkthrough/labs/tfx_walkthrough.ipynb
apache-2.0
import os import tempfile import time from pprint import pprint import absl import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_model_analysis as tfma import tensorflow_transform as tft import tfx from tensorflow_metadata.proto.v0 import ( anomalies_pb2, schema_pb2, statisti...
Kismuz/btgym
examples/model_based_stat_arb/analytic_data_model_an_introduction.ipynb
lgpl-3.0
# Import and visualize data: filename1 = './data/ETH_USD_hour_data.csv' filename2 = './data/BTC_USD_hour_data.csv' asset1 = pd.read_csv(filename1) asset2 = pd.read_csv(filename2) full_slice = slice(None, None) fig = plt.figure(num=0, figsize=(16, 8)) plt.title('Entire Dataset') ax1 = fig.add_subplot(111) ax1.plot...
parrt/msan501
notes/linked-list.ipynb
mit
class Node: def __str__(self): return "(%s,%s)" % (self.value, str(self.next)) def __repr__(self): return str(self) def __init__(self, value, next=None): self.value = value self.next = next """ Explanation: Linked lists We've studied arrays/lists that are built into Python b...
gregcaporaso/short-read-tax-assignment
ipynb/simulated-community/taxonomy-assignment.ipynb
bsd-3-clause
from os.path import join, expandvars from joblib import Parallel, delayed from glob import glob from os import system from tax_credit.simulated_communities import copy_expected_composition from tax_credit.framework_functions import (parameter_sweep, generate_per_method_biom_...
google-research/policy-learning-landscape
notebooks/ExampleLandscapes.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...
aliakbars/uai-ai
scripts/tugas1b.ipynb
mit
from __future__ import print_function, division # Gunakan print(...) dan bukan print ... import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import random import requests from sklearn.linear_model import LinearRegression, LogisticRegression from sklearn.metrics import accuracy_...
google/xarray-beam
docs/read-write.ipynb
apache-2.0
# hidden imports & helper functions import textwrap import apache_beam as beam import xarray_beam as xbeam import xarray def summarize_dataset(dataset): return f'<xarray.Dataset data_vars={list(dataset.data_vars)} dims={dict(dataset.sizes)}>' def print_summary(key, chunk): print(f'{key}\n with {summarize_da...
bayesimpact/bob-emploi
data_analysis/notebooks/datasets/rome/update_from_v335_to_v337.ipynb
gpl-3.0
import collections import glob import os from os import path import matplotlib_venn import pandas as pd rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv') OLD_VERSION = '335' NEW_VERSION = '337' old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION))) new_version_files = frozenset(...
thewtex/SimpleITK-Notebooks
33_Segmentation_Thresholding_Edge_Detection.ipynb
apache-2.0
import SimpleITK as sitk from downloaddata import fetch_data as fdata import matplotlib.pyplot as plt %matplotlib inline import numpy as np from scipy import linalg from ipywidgets import interact, fixed """ Explanation: <h1 align="center">Segmentation: Thresholding and Edge Detection</h1> In this notebook our go...
ageron/tensorflow
tensorflow/lite/tutorials/post_training_quant.ipynb
apache-2.0
! pip uninstall -y tensorflow ! pip install -U tf-nightly import tensorflow as tf tf.enable_eager_execution() ! git clone --depth 1 https://github.com/tensorflow/models import sys import os if sys.version_info.major >= 3: import pathlib else: import pathlib2 as pathlib # Add `models` to the python path. mo...
kit-cel/wt
wt/vorlesung/ch1_3/dice_even_odd.ipynb
gpl-2.0
# importing import numpy as np """ Explanation: Content and Objective Confirm results derived in the lecture when analyzing probability of sum of two dice being greater than 9, conditioned on the result of first dice being even and odd Dice are sampled and occurences of according events are being counted Import End ...
bjodah/aqchem
examples/ammonical_cupric_solution.ipynb
bsd-2-clause
from collections import defaultdict from chempy import atomic_number from chempy.chemistry import Species, Equilibrium from chempy.equilibria import EqSystem, NumSysLin, NumSysLog, NumSysSquare from IPython.display import Latex, display import matplotlib.pyplot as plt %matplotlib inline def show(s): # convenience func...
banneker-aztlan/python-week-2
Part 2/galaxy_spec.ipynb
mit
# only necessary if you're running Python 2.7 or lower from __future__ import print_function from __builtin__ import range import numpy as np # import plotting utility and define our naming alias from matplotlib import pyplot as plt # plot figures within the notebook rather than externally %matplotlib inline """ Ex...
mne-tools/mne-tools.github.io
0.24/_downloads/6965b7b1a563cc32b2b5388d95203d43/60_cluster_rmANOVA_spatiotemporal.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Eric Larson <larson.eric.d@gmail.com> # Denis Engemannn <denis.engemann@gmail.com> # # License: BSD-3-Clause import os.path as op import numpy as np from numpy.random import randn import matplotlib.pyplot as plt import mne from mne.stats ...
gaufung/Data_Analytics_Learning_Note
DesignPattern/CommandPattern.ipynb
mit
class backSys(): def cook(self,dish): pass class mainFoodSys(backSys): def cook(self,dish): print ("MAINFOOD:Cook %s"%dish) class coolDishSys(backSys): def cook(self,dish): print ("COOLDISH:Cook %s"%dish) class hotDishSys(backSys): def cook(self,dish): print ("HOTDISH:Coo...
amirziai/learning
machine-learning/Receiver Operating Characteristics (ROC).ipynb
mit
%matplotlib inline from IPython.display import Image import numpy as np import matplotlib.pyplot as plt # some classification metrics # more here: # http://scikit-learn.org/stable/modules/classes.html#module-sklearn.metrics from sklearn.metrics import (auc, roc_curve, roc_auc_score, acc...
Arcana/emoticharms.trade
viability.ipynb
gpl-2.0
def get_spending_of_attendee(): if random.random() < 0.03: # Let's say 3% doesn't even care about the secret shop return 0 return int((random.paretovariate(2) - 0.5) * 100) print([get_spending_of_attendee() for _ in range(100)]) """ Explanation: First I'm going to define a function which gets us an ...
obscode/bootcamp
MoreNotebooks/ModelFitting/ErrorsInXandY.ipynb
mit
import numpy as np import matplotlib.pyplot as plt N = 50 sig_x = 0.5 sig_y = 0.5 a_true = 5.0 b_true = 2.0 x_true = np.random.uniform(0,10,size=N) y_true = a_true + x_true*b_true x_obs = x_true + np.random.normal(0, sig_x, size=N) y_obs = y_true + np.random.normal(0, sig_y, size=N) fig,ax = plt.subplots(1) ax.error...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/03_model_performance/labs/b_feature_engineering_wd.ipynb
apache-2.0
import tensorflow as tf import numpy as np import shutil print(tf.__version__) """ Explanation: More Feature Engineering - Wide and Deep models Learning Objectives * Build a Wide and Deep model using the appropriate Tensorflow feature columns Introduction In this notebook we'll use what we learned about feature col...
metpy/MetPy
v0.11/_downloads/d4dcac00a3f9fe87c2dfb49b8fcc70fb/sigma_to_pressure_interpolation.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt from netCDF4 import Dataset, num2date from metpy.cbook import get_test_data from metpy.interpolate import log_interpolate_1d from metpy.plots import add_metpy_logo, add_timestamp from metpy.units import units """ Explanation...
HumanCompatibleAI/imitation
examples/6_train_mce.ipynb
mit
from imitation.algorithms.mce_irl import ( MCEIRL, mce_occupancy_measures, mce_partition_fh, TabularPolicy, ) import gym import imitation.envs.examples.model_envs from imitation.algorithms import base from imitation.data import rollout from imitation.envs import resettable_env from stable_baselines3.co...
yuanotes/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = '/input/data/small_vocab_en' target_path = '/input/data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_ml/td2a_cenonce_session_3B.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.ml - Arbres de décision / Random Forest Classification, régression, visualisation avec des méthodes ensemblistes (arbres, forêts, ...). End of explanation """ import os if not os.p...
mne-tools/mne-tools.github.io
0.23/_downloads/a3fade035778bc07f682b0807e91849e/decoding_csp_eeg.ipynb
bsd-3-clause
# Authors: Martin Billinger <martin.billinger@tugraz.at> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import ShuffleSplit, cross_val_score from mn...
arcyfelix/Courses
17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/04-Visualization-Matplotlib-Pandas/04a-Matplotlib/Matplotlib Exercises A - Solved! .ipynb
apache-2.0
import numpy as np x = np.arange(0,100) y = x * 2 z = x ** 2 """ Explanation: <a href='http://www.pieriandata.com'> <img src='../../Pierian_Data_Logo.png' /></a> Matplotlib Exercises Welcome to the exercises for reviewing matplotlib! Take your time with these, Matplotlib can be tricky to understand at first. These ar...
eds-uga/csci1360e-su17
assignments/A3/A3_Q3.ipynb
mit
v1 = safe_access({"one": [1, 2, 3], "two": [4, 5, 6], "three": "something"}, "three") assert v1 == "something" v2 = safe_access({"one": [1, 2, 3], "two": [4, 5, 6], "three": "something"}, "two", [10, 11, 12]) assert set(v2) == set((4, 5, 6)) default_val = 3 try: value = safe_access({"one": 1, "two": 2}, "three", ...
ernestyalumni/cuBlackDream
examples/LinReg.ipynb
mit
import timeit start_time = timeit.default_timer() result1500 = gradDesc(Xex1data1,yex1data1, Theta,b,0.01,1500) elapsedtime = timeit.default_timer() - start_time print(elapsedtime ) # in seconds a1,a1b = feedfwd(Xex1data1, Theta,b) res,J = costJ(Xex1data1,Theta,b,yex1data1) d_Theta,d_b,Theta1p1, btp1 = grad_desc_1(X...
metpy/MetPy
v0.12/_downloads/0c4dbfdebeb6fcd2f5364a69f0c6d4a8/Skew-T_Layout.ipynb
bsd-3-clause
import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.plots import add_metpy_logo, Hodograph, SkewT from metpy.units import units """ Explanation: Skew-T with Complex Layout Combine a Skew-T and a hodogra...
gaufung/PythonStandardLibrary
FileSystem/Codecs.ipynb
mit
import binascii def to_hex(t, nbytes): """Format text t as a sequence of nbyte long values separated by spaces. """ chars_per_item = nbytes * 2 hex_version = binascii.hexlify(t) return b' '.join( hex_version[start:start + chars_per_item] for start in range(0, len(hex_version), ...
tjwei/HackNTU_Data_2017
Week03/01-Read Tar and CSV.ipynb
mit
import tarfile # 檔案名稱格式 filename_format="M06A_{year:04d}{month:02d}{day:02d}.tar.gz".format xz_filename_format="xz/M06A_{year:04d}{month:02d}{day:02d}.tar.xz".format csv_format = "M06A/{year:04d}{month:02d}{day:02d}/{hour:02d}/TDCS_M06A_{year:04d}{month:02d}{day:02d}_{hour:02d}0000.csv".format # 打開剛才下載的檔案試試 data_conf...
mjones01/NEON-Data-Skills
code/Python/remote-sensing/lidar/create_hillshade_from_terrain_raster_py.ipynb
agpl-3.0
from osgeo import gdal import numpy as np import matplotlib.pyplot as plt %matplotlib inline import warnings warnings.filterwarnings('ignore') """ Explanation: Create a Hillshade from a Terrain Raster in Python In this tutorial, we will learn how to create a hillshade from a terrain raster in Python. First, let's imp...
steinam/teacher
jup_notebooks/data-science-ipython-notebooks-master/pandas/03.06-Concat-And-Append.ipynb
mit
import pandas as pd import numpy as np """ Explanation: <!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; the content is available on GitHub. The text is released under th...
woters/ds101
4_Titanic.ipynb
mit
# pandas import pandas as pd from pandas import DataFrame import re import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') %matplotlib inline # machine learning from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from skl...
zlpure/CS231n
assignment2/BatchNormalization.ipynb
mit
# 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 ...
altimesh/hybridizer-basic-samples
Jupyter/Labs/07_ConjugateGradient/HYB_CUDA_Csharp_ConjugateGradient.ipynb
mit
!hybridizer-cuda ./01-Naive/01-naive.cs ./Common_Files/SparseMatrixNaive.cs -o ./01-Naive/naive.exe -run """ Explanation: <div align="center"><h1>Resident Array on GPU</h1></div> Prerequisites To get the most out of this lab, you should already be able to: - Write, compile, and run C# programs that both call CPU fun...
willingc/jupyter-data-seeker
Sphinx GitHub.ipynb
gpl-2.0
import getpass from github3 import login """ Explanation: Sphinx dev tracker This notebook uses the github3py project maintained by Ian Cordasco. This notebook is a starter notebook for finding information about repositories that are managed by the Jupyter team. Repos are from the Jupyter and IPython GitHub organizati...
kunaltyagi/SDES
notes/python/p_norvig/word/xkcd1313-part2.ipynb
gpl-3.0
%matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt from __future__ import division, print_function from collections import Counter, defaultdict import re import itertools import random Set = frozenset # Data will be frozensets, so they can't be mutated. def words(text): "A...
fujii-team/GPinv
notebooks/Spectroscopic_Abel_inversion.ipynb
apache-2.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import sys # In ../testing/ dir, we prepared a small script for generating the above matrix A sys.path.append('../testing/') import make_LosMatrix # Import GPinv import GPinv """ Explanation: An example of the Nonlinear infe...
dcavar/python-tutorial-for-ipython
notebooks/Neural Network Example with Keras.ipynb
apache-2.0
from keras.models import Sequential from keras.layers import Dense """ Explanation: Neural Network Example with Keras (C) 2018-2019 by Damir Cavar Version: 1.1, January 2019 License: Creative Commons Attribution-ShareAlike 4.0 International License (CA BY-SA 4.0) This is a tutorial related to the L665 course on Machin...
sujitpal/polydlot
src/tensorflow/05a-experiment-from-layers.ipynb
apache-2.0
from __future__ import division, print_function from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib import matplotlib.pyplot as plt import numpy as np import os import shutil import tensorflow as tf DATA_DIR = "../../data" TRAIN_FILE = os.path.join(DATA_DIR, "mnist_train.csv") TEST_FI...
INM-6/Python-Module-of-the-Week
session10_PyTorch/introduction_to_pytorch_mnist.ipynb
mit
transform = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) trainset = torchvision.datasets.MNIST(root='./data', train=True, download=True, transform=transform) trainloader = torch.utils.data.DataLoader(trainset, batc...
jrbourbeau/cr-composition
notebooks/legacy/lightheavy/fraction-distribution.ipynb
mit
%load_ext watermark %watermark -u -d -v -p numpy,matplotlib,scipy,pandas,sklearn,mlxtend """ Explanation: <a id='top'> </a> Author: James Bourbeau End of explanation """ import sys sys.path.append('/home/jbourbeau/cr-composition') print('Added to PYTHONPATH') %matplotlib inline from __future__ import division, prin...
parambharat/ML-Programs
P0:_Titanic_Survival/Titanic_Survival_Exploration.ipynb
mit
import numpy as np import pandas as pd # RMS Titanic data visualization code from titanic_visualizations import survival_stats from IPython.display import display %matplotlib inline # Load the dataset in_file = 'titanic_data.csv' full_data = pd.read_csv(in_file) # Print the first few entries of the RMS Titanic data...
bMzi/ML_in_Finance
0103_Plotting.ipynb
mit
# Standard imports %matplotlib inline import numpy as np import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') """ Explanation: Plotting with Matplotlib Introduction Most certainly you are familiar with the frase "A pictures is worth a thousand words". Good graphics are tremendously helpful in visualizing...
d-k-b/udacity-deep-learning
intro-to-tensorflow/intro_to_tensorflow_solution.ipynb
mit
# Problem 1 - Implement Min-Max scaling for grayscale image data def normalize_grayscale(image_data): """ Normalize the image data with Min-Max scaling to a range of [0.1, 0.9] :param image_data: The image data to be normalized :return: Normalized image data """ a = 0.1 b = 0.9 grayscale...
jacobdein/alpine-soundscapes
archive/Index exploration 2.ipynb
mit
import pandas from Pymilio import database import numpy as np import matplotlib.pylab as plt %matplotlib inline """ Explanation: Index exploration 2 This notebook explores the indicies computed from sound files in a <a href="https://github.com/ljvillanueva/pumilio">pumilio</a> database. Required packages <a href="ht...
pelodelfuego/word2vec-toolbox
notebook/dataExploration/dimensionDistribution.ipynb
gpl-3.0
domainWordList = [open('../../data/domain/luu_animal.txt').read().splitlines(), open('../../data/domain/luu_plant.txt').read().splitlines(), open('../../data/domain/luu_vehicle.txt').read().splitlines()] def buildCptDf(d, domain, polar=False): cptList = cpe.buildConceptList(d, d...
ctralie/TUMTopoTimeSeries2016
SlidingWindow3-AudioApplications.ipynb
apache-2.0
##Do all of the imports and setup inline plotting %matplotlib notebook import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from scipy.interpolate import InterpolatedUnivariateSpline from ripser import ripser from persim import plot_diagrams import scipy.io.wavfile from IPython.dis...
jaety/ds-doodles
studies/01_WorldBank/World Bank Exploration.ipynb
mit
import wbdata %matplotlib inline wbdata.get_source() # List world bank data sources # List all available indicators from that source. Very long list. Nicely scrolled in local notebook, but # overwhelming on github cache # wbdata.get_indicator(source=2) # wbdata.get_data("EG.USE.PCAP.KG.OE") # Returns long list o...
lucasb-eyer/BiternionNet
Inspection - Regression.ipynb
mit
def extract_array(mat, ref, dtype=np.float32): N = len(ref) arr = np.empty(N, dtype=dtype) # mat[ref[0,0]].dtype for i in range(N): arr[i] = mat[ref[i,0]][0,0] return arr def read_tosato(folder): mat_full = h5py.File(pjoin(folder, 'or_label_full.mat')) def loadall(traintest): c...
ES-DOC/esdoc-jupyterhub
notebooks/cams/cmip6/models/sandbox-1/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cams', 'sandbox-1', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: CAMS Source ID: SANDBOX-1 Topic: Atmoschem Sub-Topics: Transport, Emissions ...
robertoalotufo/ia898
src/circle.ipynb
mit
import numpy as np def circle(s, r, c): rows, cols = s[0], s[1] rr0, cc0 = c[0], c[1] rr, cc = np.meshgrid(range(rows), range(cols), indexing='ij') g = (rr - rr0)**2 + (cc - cc0)**2 <= r**2 return g """ Explanation: Function circle Synopse This function creates a binary circle image. g = c...
GoogleCloudPlatform/analytics-componentized-patterns
retail/ltv/bqml/notebooks/bqml_automl_ltv_activate_lookalike.ipynb
apache-2.0
# Install libraries. # The magic cells insures that those libraries can be part of a custom container # if moving the code somewhere else. %pip install -q googleads %pip install -q -U kfp matplotlib Faker --user # Automatically restart kernel after installs # import IPython # app = IPython.Application.instance() # ap...
Mashimo/datascience
01-Regression/Regularisation.ipynb
apache-2.0
import pandas as pd # load up the Credit dataset # data = pd.read_csv("../datasets/credit.csv", index_col=0) data.shape data.columns data.head() data.describe() data.info() """ Explanation: Regularisation The basic idea of regularisation is to penalise or shrink the large coefficients of a regression model. Th...
xiongzhenggang/xiongzhenggang.github.io
data-science/.ipynb_checkpoints/24-simple_liner-checkpoint.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt #使用seaborn-whitegrid风格 plt.style.use('seaborn-whitegrid') import numpy as np """ Explanation: 简单线图 先设置ipython notebook 作图环境 End of explanation """ fig = plt.figure() ax = plt.axes() """ Explanation: 对于所有Matplotlib图,我们首先创建一个图形和一个轴。以最简单的形式,可以如下创建图形和轴: End of explanat...
rpaseity/udlnd
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...
ellisztamas/faps
docs/.ipynb_checkpoints/06 Simulating data-checkpoint.ipynb
mit
import numpy as np import faps as fp import matplotlib.pylab as plt import pandas as pd from time import time, localtime, asctime np.random.seed(37) allele_freqs = np.random.uniform(0.2, 0.5, 50) adults = fp.make_parents(10, allele_freqs, family_name='adult') """ Explanation: Simulating data and power analysis Tom ...
danielfather7/teach_Python
Class and Inheritance/Python_Class and Inheritance.ipynb
gpl-3.0
# Define a class named Pokemon class Pokemon(): def __init__(self, name, attack, defence): self.name = name self.attack = attack self.defence = defence print('Hello world') def poko_name(self): return self.name def poko_state(self): return self.attac...
geography-munich/sciprog
material/sub/koldunov/05 - Graphs and maps - Matplotlib and Basemap.ipynb
apache-2.0
%matplotlib inline import matplotlib.pylab as plt import numpy as np """ Explanation: Graphs and maps (Matplotlib and Basemap) Nikolay Koldunov koldunovn@gmail.com This is part of Python for Geosciences notes. ============= Matplotlib is a python 2D plotting library which produces publication quality figures in a vari...
barjacks/foundations-homework
06/Dark Sky Forecast_Homework_6_Graded.ipynb
mit
import requests response = requests.get("https://api.forecast.io/forecast/e554f37a8164ce189acd210d00a452e0/47.4079,9.4647") weather_data = response.json() weather_data.keys() print(weather_data['timezone']) """ Explanation: You'll be using the Dark Sky Forecast API from Forecast.io, available at https://developer.fo...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_read_bem_surfaces.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/subjects/sample/bem/sample-5120-5120-5120-bem-sol.fif' surfaces = mne.read_bem_surfaces(fname, patch_stats...
Dima806/udacity-mlnd-capstone
capstone-step1-sensitivity-check-run3.ipynb
apache-2.0
# Select test_size and random_state for splitting a subset test_size=0.1 random_state=2 import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cm import time import gzip import shutil import seaborn as sns from collections import Counter from sklearn.mixture ...
arcyfelix/Courses
17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/03-General Pandas/06-Merging-Joining-and-Concatenating.ipynb
apache-2.0
import pandas as pd df1 = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'], 'B': ['B0', 'B1', 'B2', 'B3'], 'C': ['C0', 'C1', 'C2', 'C3'], 'D': ['D0', 'D1', 'D2', 'D3']}, index = [0, 1, 2, 3]) df2 = pd.DataFrame({'A': ['A4', 'A5', 'A6', 'A7'], ...
tjwei/HackNTU_Data_2017
Week05/From NumPy to Logistic Regression.ipynb
mit
from PIL import Image import numpy as np %matplotlib inline import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('bmh') matplotlib.rcParams['figure.figsize']=(8,5) """ Explanation: 起手式,導入 numpy, matplotlib End of explanation """ import gzip import pickle with gzip.open('../Week02/mnist.pkl.gz', 'rb...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_source_label_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np 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_induced_power print(__doc__) """ Explanation...
googledatalab/notebooks
samples/Programming Language Correlation.ipynb
apache-2.0
import google.datalab.bigquery as bq import matplotlib.pyplot as plot import numpy as np import pandas as pd """ Explanation: Programming Language Correlation This sample notebook demonstrates working with GitHub activity, which has been made possible via the publicly accessible GitHub Timeline BigQuery dataset via th...
drublackberry/fantastic_demos
Probability/.ipynb_checkpoints/Calvin-checkpoint.ipynb
mit
MAX_TIME = 80. # max time waiting at traffic light class TrafficLightPath: '''Class that computes the probabilities of a traffic light path over itself and the future (children) traffic lights. ''' p = 0 # probability of this path T = 0 # expected time of this path Nw = 0 # r...
ewulczyn/talk_page_abuse
src/analysis/Attackers, Victims, and Trolls.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import warnings warnings.filterwarnings('ignore') import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd from matplotlib_venn import venn2 from load_utils import * from analysis_utils import * """ Explanation: Loading Packages...
DiracInstitute/kbmod
notebooks/precovery_demo.ipynb
bsd-2-clause
from precovery_utils import ssoisPrecovery """ Explanation: Gather precovery imaging This notebook shows how to get precovery imaging for objects found with KBMOD. Once we have an object identified we can record the observations we used in MPC format and use the following tools to search other telescope data for possi...
ThunderShiviah/code_guild
wk1/notebooks/wk1.3.ipynb
mit
a = {'one':1, 'two':2, 'three': 3} b = dict(one=1, two=2, three= 3) c = dict(zip(['one', 'two', 'three'], [1, 2, 3])) a == b == c """ Explanation: wk1.3 warm - up Create a dictionary called numbers with the keys 'one', 'two', 'three', and associated values 1, 2, 3 three different ways. End of explanation """ a['on...
lindsayrgwatt/kickstarter
kickstarter_technology_projects_v2.ipynb
mit
import json #data_path = '/Users/lindsayrgwatt/Dropbox/kickstarter_technology_032015.json' data_path = 'C:\Users\lindwatt\Dropbox\kickstarter_technology_032015.json' with open(data_path) as data_file: data = json.load(data_file) #print data.keys() print "Our scraping yielded %i records" % data['count'] ...
particle-physics-playground/playground
activities/activity00_cms_muons.ipynb
mit
# Import standard libraries # import numpy as np import matplotlib.pylab as plt %matplotlib notebook # Import custom tools # import h5hep import pps_tools as pps # Download the file # file = 'dimuons_1000_collisions.hdf5' pps.download_drive_file(file) print("Reading in the data....") # Read the data in as a list #...
xMyrst/BigData
python/howto/005_Estructuras de control.ipynb
gpl-3.0
x, y = 2, 0 if x > y: print("x es mayor que y") print("x sigue siendo mayor que y") if 1 < 0: print("1 es mayor que 0") # esto está dentro de bucle, pero no se escribe por que no cumple que 1 sea menor que 0 print("Esto se ejecuta siempre") # esto no está dentro del bloque y SE ejecuta siempre; ya que...
molgor/spystats
notebooks/.ipynb_checkpoints/spatial_autocorrelation_from_fitted_model_POISSON-checkpoint.ipynb
bsd-2-clause
new_data.crs = {'init':'epsg:4326'} """ Explanation: Let´s reproject to Alberts or something with distance End of explanation """ #new_data = new_data.to_crs("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs ") """ Explanation: Uncomment to reprojec...
ES-DOC/esdoc-jupyterhub
notebooks/hammoz-consortium/cmip6/models/mpiesm-1-2-ham/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'mpiesm-1-2-ham', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: HAMMOZ-CONSORTIUM Source ID: MPIESM-1-2-HAM Topic: Atmosch...
tabakg/potapov_interpolation
Dispersion_relation_chi_2_voxels_approach.ipynb
gpl-3.0
import sympy as sp import numpy as np import scipy.constants from sympy.utilities.autowrap import ufuncify import time import itertools #from scipy import interpolate import matplotlib.pyplot as plt %matplotlib inline from sympy import init_printing init_printing() import random def plot_arr(arr): fig = plt.fig...
geoneill12/phys202-2015-work
assignments/assignment08/InterpolationEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np sns.set_style('white') from scipy.interpolate import griddata """ Explanation: Interpolation Exercise 2 End of explanation """ #ignore# a = list(range(-5, 6)) b = list(range(-4, 5)) c = [5] d = [-5] e = [0] g = [1] x = np.h...
syednasar/datascience
optimization_algos/Optimization.ipynb
mit
import time import random import math people = [('Seymour','BOS'), ('Franny','DAL'), ('Zooey','CAK'), ('Walt','MIA'), ('Buddy','ORD'), ('Les','OMA')] # LaGuardia airport in New York destination='LGA' """Load this data into a dictionary with the origin and destina...
tensorflow/docs-l10n
site/ja/agents/tutorials/6_reinforce_tutorial.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...
sbrisard/janus
notebooks/using_scipy_iterative_solvers.ipynb
bsd-3-clause
import h5py as h5 import matplotlib.pyplot as plt import numpy as np import janus import janus.material.elastic.linear.isotropic as material import janus.operators as operators import janus.fft.serial as fft import janus.green as green from scipy.sparse.linalg import cg, LinearOperator %matplotlib inline plt.rcPara...
jacobdein/alpine-soundscapes
Compute distance to roads.ipynb
mit
points = 'sample_points_field' roads = 'highway' road_type_field = 'Type' distance_table_filename = "" """ Explanation: Compute distance to roads This notebook computes the distance to each of the nearest road types in a 'roads' vector map from a vector map of 'points' (sample locations). This notebook uses GRASS G...
dwiel/tensorflow_hmm
notebooks/gradient_descent_example.ipynb
apache-2.0
observations = np.random.random((1, 90, 2)) * 4 - 2 plot(observations[0,:,:]) grid() observations_variable = tf.Variable(observations) posterior_graph, _, _ = hmm_tf.forward_backward(tf.sigmoid(observations_variable)) # build error function sum_error_squared = tf.reduce_sum(tf.square(truth - posterior_graph)) # ca...
ES-DOC/esdoc-jupyterhub
notebooks/dwd/cmip6/models/sandbox-2/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-2', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: DWD Source ID: SANDBOX-2 Topic: Atmoschem Sub-Topics: Transport, Emissions Co...