repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
harmsm/pythonic-science | chapters/00_inductive-python/06_numpy-arrays.ipynb | unlicense | x = []
for i in range(1,11):
if i > 2:
x.append(i**2)
print(x[3])
"""
Explanation: Warm up
What will the following code spit out? (Don't just type it -- pencil and paper it).
End of explanation
"""
some_list = [1,2,3]
a_list_copy = some_list
some_list[1] = 273
"""
Explanation: How would you fix the fol... |
DistrictDataLabs/PyCon2016 | notebooks/tutorial/Intro to NLTK.ipynb | mit | # Take a moment to explore what is in this directory
dir(nltk)
"""
Explanation: What is NLP?
Natural Language Processing (NLP) is often taught at the academic level from the perspective of computational linguists. However, as data scientists, we have a richer view of the natural language world - unstructured data that... |
ewulczyn/ewulczyn.github.io | ipython/what_if_ab_testing_is_like_science/what_if_ab_testing_is_like_science_copy.ipynb | mit | import numpy as np
from statsmodels.stats.weightstats import ztest
from statsmodels.stats.power import tt_ind_solve_power
from scipy.stats import bernoulli
class Test():
def __init__(self, significance, power, mde, optimistic):
self.significance = significance
self.power = power
self.m... |
kit-cel/wt | ccgbc/ch4_LDPC_Analysis/RegularLDPC_BEC.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plot
from ipywidgets import interactive
import ipywidgets as widgets
import math
%matplotlib inline
"""
Explanation: Regular LDPC Codes on the BEC
This code is provided as supplementary material of the lecture Channel Coding 2 - Advanced Methods.
This code illustrates
*... |
JShadowMan/package | python/course/ch02-syntax-and-container/.ipynb_checkpoints/基本语法及常用容器-checkpoint.ipynb | mit | year = 2019 # 赋值表达式, 一行可以只写一个语句
month = 7; day = 23; hour = 22; minute = 11; second = 0 # 一行也可以写多个语句, 使用 ; 进行分隔
if 1900 < year < 2100 and 1 <= month <= 12 \
and 1 <= day <= 31 and 0 <= hour < 24 \
and 0 <= minute < 60 and 0 <= second < 60: # 多个物理行组成一个逻辑行
print("时间正确")
"""
Explanation: Python中的基本语法
Pyth... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/12_tensorflow/notebooks/07 Mini-batch.ipynb | mit | print("Train features size = ", train_features.size * 4)
print("Train labels size = ", train_labels.size * 4)
print("Weights size =", 784 * 10 * 4)
print("Bias size = ", 10 * 4)
"""
Explanation: Question 1
Calculate the memory size of train_features, train_labels, weights, and bias in bytes. Ignore memory for overhead... |
kunalj101/scipy2015-blaze-bokeh | 1.6 Layout.ipynb | mit | # Import the functions from your file
# Create your plots with your new functions
# Test the visualizations in the notebook
from bokeh.plotting import show, output_notebook
# Show climate map
# Show legend
# Show timeseries
"""
Explanation: <img src=images/continuum_analytics_b&w.png align="left" width="15%" sty... |
saga-survey/saga-code | ipython_notebooks/DECALS low-SB_brick selection and data download.ipynb | gpl-2.0 | bricks = Table.read('decals_dr3/survey-bricks.fits.gz')
bricksdr3 = Table.read('decals_dr3/survey-bricks-dr3.fits.gz')
fn_in_sdss = 'decals_dr3/in_sdss.npy'
try:
bricksdr3['in_sdss'] = np.load(fn_in_sdss)
except:
bricksdr3['in_sdss'] = ['unknown']*len(bricksdr3)
bricksdr3
goodbricks = (bricksdr3['in_sdss'] ... |
a301-teaching/a301_code | notebooks/heating_rate_npz.ipynb | mit | import h5py
import numpy as np
import datetime as dt
from datetime import timezone as tz
import matplotlib
from matplotlib import pyplot as plt
import pyproj
from numpy import ma
from a301utils.a301_readfile import download
from a301lib.cloudsat import get_geo
from IPython.display import Image, display
from datetime im... |
sdpython/pyquickhelper | _unittests/ut_helpgen/notebooks_python/td1a_cenonce_session1.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: TD 1 : Premiers pas en Python
End of explanation
"""
x = 5
y = 10
z = x + y
print (z) # affiche z
"""
Explanation: Partie 1
Un langage de programmation permet de décrire avec précision des opérations très simples sur des données. Co... |
norsween/data-science | springboard-answers-to-exercises/Mini_Project_Linear_Regression-Answers.ipynb | gpl-3.0 | # special IPython command to prepare the notebook for matplotlib and other libraries
%matplotlib inline
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
import sklearn
import seaborn as sns
# special matplotlib argument for improved plots
from matplotlib import rcPa... |
GoogleCloudPlatform/mlops-on-gcp | environments_setup/mlops-composer-mlflow/environment-test.ipynb | apache-2.0 | import os
import re
import mlflow
import mlflow.sklearn
import numpy as np
from sklearn.linear_model import LogisticRegression
import pymysql
from IPython.core.display import display, HTML
mlflow_tracking_uri = mlflow.get_tracking_uri()
MLFLOW_EXPERIMENTS_URI = os.environ['MLFLOW_EXPERIMENTS_URI']
print("MLflow track... |
WNoxchi/Kaukasos | FAI02_old/Lesson9/neural_sr_attempt2.ipynb | mit | %matplotlib inline
import importlib
import os, sys; sys.path.insert(1, os.path.join('../utils'))
import utils2; importlib.reload(utils2)
from utils2 import *
from scipy.optimize import fmin_l_bfgs_b
from scipy.misc import imsave
from keras import metrics
from vgg16_avg import VGG16_Avg
from bcolz_array_iterator im... |
tpin3694/tpin3694.github.io | python/beautiful_soup_drill_down.ipynb | mit | # Import required modules
import requests
from bs4 import BeautifulSoup
import pandas as pd
"""
Explanation: Title: Drilling Down With Beautiful Soup
Slug: beautiful_soup_drill_down
Summary: Drilling Down With Beautiful Soup
Date: 2016-05-01 12:00
Category: Python
Tags: Web Scraping
Authors: Chris Albon
Preliminarie... |
hannorein/rebound | ipython_examples/OrbitPlot.ipynb | gpl-3.0 | import rebound
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=0.1, e=0.041, a=0.4, inc=0.2, f=0.43, Omega=0.82, omega=2.98)
sim.add(m=1e-3, e=0.24, a=1.0, pomega=2.14)
sim.add(m=1e-3, e=0.24, a=1.5, omega=1.14, l=2.1)
sim.add(a=-2.7, e=1.4, f=-1.5,omega=-0.7) # hyperbolic orbit
"""
Explanation: Orbit Plot
REBOUND c... |
infilect/ml-course1 | keras-notebooks/Frameworks/2.3.1 Keras Backend.ipynb | mit | import keras.backend as K
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from kaggle_data import load_data, preprocess_data, preprocess_labels
X_train, labels = load_data('../data/kaggle_ottogroup/train.csv', train=True)
X_train, scaler = preprocess_data(X_train)
Y_train, encoder = preprocess_... |
SKA-ScienceDataProcessor/algorithm-reference-library | workflows/notebooks/imaging-wterm_arlexecute.ipynb | apache-2.0 | %matplotlib inline
import os
import sys
sys.path.append(os.path.join('..', '..'))
from data_models.parameters import arl_path
results_dir = arl_path('test_results')
from matplotlib import pylab
import numpy
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy.wcs.utils import pixe... |
fantasycheng/udacity-deep-learning-project | tutorials/intro-to-tflearn/TFLearn_Sentiment_Analysis.ipynb | mit | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
"""
Explanation: Sentiment analysis with TFLearn
In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w... |
tensorflow/docs-l10n | site/en-snapshot/probability/examples/STS_approximate_inference_for_models_with_non_Gaussian_observations.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
cfelton/myhdl_exercises | 01_mex_shifty.ipynb | mit | def shifty(clock, reset, load, load_value, output_bit, initial_value=0):
"""
Ports:
load: input, load strobe, load the `load_value`
load_value: input, the value to be loaded
output_bit: output, The most significant
initial_value: internal shift registers initial value (value after r... |
ini-python-course/ss15 | notebooks/Fast Online Plotting with PyQtGraph.ipynb | mit | import pyqtgraph.examples
pyqtgraph.examples.run()
"""
Explanation: PyQtGraph
Fast Online Plotting in Python
"PyQtGraph is a pure-python graphics and GUI library built on PyQt4 / PySide and numpy. It is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, ... |
llondon6/kerr_public | examples/plot_qnm_frequency.ipynb | mit | # Define which base QNM to use. Note that the same QNM with m --> -m may be used at some point.
l,m,n = 2,1,0
# Useful to development: turn module reloading
%load_ext autoreload
# Inline plotting
%matplotlib inline
# Force module recompile
%autoreload 2
# Import kerr and numpy
from kerr import leaver
from kerr.formul... |
gboeing/urban-data-science | modules/10-spatial-models/lecture.ipynb | mit | import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
import pysal as ps
# load CA tracts
tracts_ca = gpd.read_file('../../data/tl_2017_06_tract/').set_index('GEOID')
# keep LA, ventura, orange counties only (and drop offshore island tracts)
to_drop = ['06037599100', '06037599000', '06111980000'... |
pacoqueen/ginn | extra/install/ipython2/ipython-5.10.0/examples/IPython Kernel/Script Magics.ipynb | gpl-2.0 | import sys
"""
Explanation: Running Scripts from IPython
IPython has a %%script cell magic, which lets you run a cell in
a subprocess of any interpreter on your system, such as: bash, ruby, perl, zsh, R, etc.
It can even be a script of your own, which expects input on stdin.
End of explanation
"""
%%script python2
i... |
chetan51/nupic.research | projects/dynamic_sparse/notebooks/replicateDense.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 2
# general imports
import os
import numpy as np
# torch imports
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as schedulers
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torchsummary import s... |
wzxiong/DAVIS-Machine-Learning | labs/lab2.ipynb | mit | # %load ../standard_import.txt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import scale
from sklearn.linear_model import LinearRegression, Ridge, RidgeCV, Lasso, LassoCV
from sklearn.decomposition import PCA
from sklearn.metrics import mean_squared_error
%matplot... |
tensorflow/docs-l10n | site/ko/hub/tutorials/tf_hub_delf_module.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. 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 app... |
peterwittek/qml-rg | Archiv_Session_Spring_2017/Exercises/05_aps_capcha.ipynb | gpl-3.0 | import os
import numpy as np
import tools as im
from matplotlib import pyplot as plt
from skimage.transform import resize
%matplotlib inline
path=os.getcwd()+'/' # finds the path of the folder in which the notebook is
path_train=path+'images/train/'
path_test=path+'images/test/'
path_real=path+'images/real_world/'
""... |
Neuroglycerin/neukrill-net-work | notebooks/troubleshooting_and_sysadmin/Opening test.py pickles.ipynb | mit | import pickle
cd /disk/scratch/neuroglycerin/dump/
ls
with open("test.py.pkl","rb") as f:
p = pickle.load(f)
len(p)
p[0].shape[0]*80
"""
Explanation: Two important submission csvs were written wrong, but in anticipation of this problem we pickled the results. Opening them now.
End of explanation
"""
import ... |
feststelltaste/software-analytics | courses/20191014_ML-Summit/Analyzing Java Dependencies with jdeps (Demo Notebook).ipynb | gpl-3.0 | from ozapfdis import jdeps
deps = jdeps.read_jdeps_file(
"../datasets/jdeps_dropover.txt",
filter_regex="at.dropover")
deps.head()
"""
Explanation: Questions
Which types / classes have unwanted dependencies in our code?
Which group of types / classes is highly cohesive but lowly coupled?
Idea
Using JDK's jd... |
rvm-segfault/edx | python_for_data_sci_dse200x/week3/Intro Notebook.ipynb | apache-2.0 | 365 * 24 * 60 * 60
print(str(_/1e6) + ' million')
x = 4 + 3
print (x)
"""
Explanation: Number of seconds in a year
End of explanation
"""
%matplotlib inline
from matplotlib.pyplot import plot
plot([0,1,0,1])
"""
Explanation: This is a markdown cell
This is heading 2
This is heading 3
Hi!
One Fish
Two Fish
Red ... |
HumanCompatibleAI/imitation | examples/1_train_bc.ipynb | mit | from stable_baselines3 import PPO
from stable_baselines3.ppo import MlpPolicy
import gym
env = gym.make("CartPole-v1")
expert = PPO(
policy=MlpPolicy,
env=env,
seed=0,
batch_size=64,
ent_coef=0.0,
learning_rate=0.0003,
n_epochs=10,
n_steps=64,
)
expert.learn(1000) # Note: set to 10000... |
danielfrg/pelican-ipynb | pelican_jupyter/tests/pelican/markup-nbdata/content/nbdata-file.ipynb | apache-2.0 | a = 1
a
b = 'pew'
b
%matplotlib inline
import matplotlib.pyplot as plt
from pylab import *
x = linspace(0, 5, 10)
y = x ** 2
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()
import numpy as np
num_points = 130
y = np.random.random(num_points)
plt.plot(y)
"""
Explanation: This Jupyter no... |
walkon302/CDIPS_Recommender | notebook_versions/Exploring_Data_v2.ipynb | apache-2.0 | import sys
import os
sys.path.append(os.getcwd()+'/../')
# other
import numpy as np
import glob
import pandas as pd
import ntpath
#keras
from keras.preprocessing import image
# plotting
import seaborn as sns
sns.set_style('white')
import matplotlib.pyplot as plt
%matplotlib inline
# debuggin
from IPython.core.debu... |
byque/programacion_en_python | b-variables_y_tipos_simples_de_datos/variables_y_tipos_de_datos.ipynb | gpl-3.0 | # La siguiente línea imprime ¡Hola! como salida en el monitor
print("¡Hola!")
"""
Explanation: Variables y Tipos Simples de Datos
Comentarios
Los comentarios empiezan con un '#' y sirven para añadir notas al programa para describir la solución implementada en el código.
Todo lo que está después de un '#' es ignorado p... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/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', 'csir-csiro', 'sandbox-1', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-1
Topic: Atmoschem
Sub-Topics: Transport... |
abulbasar/machine-learning | SparkML - 07 Click Prediction (Outbrain dataset).ipynb | apache-2.0 | from datetime import datetime
import matplotlib.pyplot as plt
import pyspark.sql.functions as F
from pyspark.sql.window import Window
import numpy as np
import pandas as pd
from sklearn import metrics
pd.options.display.max_columns = 1000
pd.options.display.max_rows = 10
fast_mode = True
%matplotlib inline
from ... |
JelleAalbers/xeshape | S1_psd_mc_Erik.ipynb | mit | import numpy as np
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
from scipy import stats
# import warnings
# warnings.filterwarnings('error')
from multihist import Hist1d, Histdd
"""
Explanation: Imports
End of explanation
"""
# Digitizer sample size
dt = 2
# Waveform time labels
spe_ts = ... |
tpin3694/tpin3694.github.io | machine-learning/remove_backgrounds.ipynb | mit | # Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Title: Remove Backgrounds
Slug: remove_backgrounds
Summary: How to remove the backgrounds in images using OpenCV in Python.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Images
Authors: Chris A... |
feststelltaste/software-analytics | notebooks/Checking the modularization based on changes (3D Version).ipynb | gpl-3.0 | import pandas as pd
from sklearn.metrics.pairwise import cosine_distances
from sklearn.manifold import MDS
import numpy as np
from matplotlib import cm
from matplotlib.colors import rgb2hex
import ipyvolume as ipv
# read, filter and prepare data
git_log = pd.read_csv("https://git.io/Jez2h")
prod_code = git_log.copy()
... |
psas/liquid-engine-analysis | archive/electric_pump_calcs/pump_sizing.ipynb | gpl-3.0 | import math as m
# propellant properties and physical constants
rho = 789 # propellant density (ethanol and LOX respectively) [kg/m^3]
p_v = 8.84E3 # propellant vapor pressure [Pa]
g_0 = 9.81 # gravitational acceleration [m/s/s]
# rocke... |
adrn/thejoker | docs/examples/5-Calibration-offsets.ipynb | mit | import astropy.table as at
import astropy.units as u
from astropy.visualization.units import quantity_support
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
import corner
import pymc3 as pm
import pymc3_ext as pmx
import exoplanet as xo
import exoplanet.units as xu
import arviz as az
import thej... |
sangheestyle/ml2015project | howto/model25_using_acc_cat_for_users.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from utils import load_buzz, select, write_result
from features import featurize, get_pos
from containers import Questions, Users, Categories
from nlp import extract_entities
"""
Explanation: Model25: using category accuracy per users
End of explan... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/custom/showcase_hyperparmeter_tuning_text_binary_classification.ipynb | apache-2.0 | import os
import sys
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install -U google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex client library: Hyperparameter tuning text binary classification model
<table align=... |
catalystcomputing/DSIoT-Python-sessions | Session4/code/01 Loading EPOS Category Data for modelling.ipynb | apache-2.0 | # Imports
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
import pandas as pd
# Training Data
training_raw = pd.read_table("../data/training_data.dat")
df_training = pd.DataFrame(training_raw)
df_training.head()
# test Data
test_raw = pd.read_table("../data/test_data.dat")
df_test = pd.Dat... |
WNoxchi/Kaukasos | FADL1/keras_lesson1.ipynb | mit | %reload_ext autoreload
%autoreload 2
%matplotlib inline
PATH = "data/dogscats/"
sz = 224
batch_size=64
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from keras.layers import Dropout, Flatten, Dense
from keras.models import Model, Sequential
from kera... |
jasontlam/snorkel | test/learning/test_TF_notebook.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
os.environ['SNORKELDB'] = 'sqlite:///{0}{1}crowdsourcing.db'.format(os.getcwd(), os.sep)
from snorkel import SnorkelSession
session = SnorkelSession()
"""
Explanation: Testing TFNoiseAwareModel
We'll start by testing the textRNN model on a categorical p... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/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', 'csiro-bom', 'sandbox-1', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: SANDBOX-1
Topic: Atmoschem
Sub-Topics: Transport, ... |
anoopsarkar/nlp-class-hw | chunker/default.ipynb | apache-2.0 | from default import *
import os
"""
Explanation: chunker: default program
End of explanation
"""
chunker = LSTMTagger(os.path.join('data', 'train.txt.gz'), os.path.join('data', 'chunker'), '.tar')
decoder_output = chunker.decode('data/input/dev.txt')
"""
Explanation: Run the default solution on dev
End of explanati... |
missmoss/python-scraper | google_places_scraper.ipynb | mit | import json #for reading oauth info and save the results
import io
from googleplaces import GooglePlaces, types, lang
from pprint import pprint
with io.open('google_places_key.json') as cred:
creds = json.load(cred)
google_places = GooglePlaces(**creds)
"""
Explanation: Prepare the connection
Apply a Googl... |
kubeflow/pipelines | samples/core/lightweight_component/lightweight_component.ipynb | apache-2.0 | # Install the SDK
!pip3 install 'kfp>=0.1.31.2' --quiet
import kfp.deprecated as kfp
import kfp.deprecated.components as components
"""
Explanation: Lightweight python components
Lightweight python components do not require you to build a new container image for every code change.
They're intended to use for fast ite... |
amitkaps/hackermath | Module_3b_principal_component_analysis.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (10, 6)
"""
Explanation: Principle Component Analysis (PCA)
Key Equation: $Ax = \lambda b ~~ \text{for} ~~ n \times n $
PCA is an orthogonal... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_artifacts_correction_rejection.ipynb | bsd-3-clause | import numpy as np
import mne
from mne.datasets import sample
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.read_raw_fif(raw_fname)
"""
Explanation: .. _tut_artifacts_reject:
Rejecting bad data (channels and segments)
End of explanation
"""
raw.inf... |
edeno/Jadhav-2016-Data-Analysis | notebooks/2017_06_22_Repository_Data_Access.ipynb | gpl-3.0 | from src.parameters import ANIMALS
ANIMALS
"""
Explanation: Repository and Data Access
Fork my github repository
Clone the forked repository to a local directory
Install miniconda (or anaconda) if it isn't already installed. Type into bash:
bash
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x... |
gtesei/DeepExperiments | Recurrent_Neural_Networks_1.1.0.ipynb | apache-2.0 | # Common imports
import numpy as np
import numpy.random as rnd
import os
# to make this notebook's output stable across runs
rnd.seed(42)
# To plot pretty figures
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.rcParams['axes.labelsize'] = 14
plt.rcParams['xtick.labelsize'] = 12
plt.rcParams[... |
cgrudz/cgrudz.github.io | teaching/stat_775_2021_fall/activities/activity-2021-09-01.ipynb | mit | import numpy as np
"""
Explanation: Introduction to Python part IV (And a discussion of linear transformations)
Activity 1: Discussion of linear transformations
Orthogonality also plays a key role in understanding linear transformations. How can we understand linear transformations in terms of a composition of rota... |
donovanr/letter_ladders | letter_ladders.ipynb | gpl-2.0 | import networkx as nx
import letter_ladders as ll
"""
Explanation: Try out letter ladder code on some different word corpuses
End of explanation
"""
# get default dict into list, add all words as nodes to graph, group words by length
built_in_wordlist = [w.strip() for w in open('/usr/share/dict/words') if len(w.stri... |
ioos/system-test | content/downloads/notebooks/2015-11-09-Scenario_1A_Model_Strings.ipynb | unlicense | known_csw_servers = ['http://data.nodc.noaa.gov/geoportal/csw',
'http://cwic.csiss.gmu.edu/cwicv1/discovery',
'http://geoport.whoi.edu/geoportal/csw',
'https://edg.epa.gov/metadata/csw',
'http://www.ngdc.noaa.gov/geoportal/csw',
... |
cliburn/sta-663-2017 | homework/09_Multivariate_Optimization_Solutions.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Multivariate Optimization
In this homework, we will implement the conjugate graident descent algorithm. While you should nearly always use an optimization routine from a library for practical data analyiss, this exercise is useful b... |
ES-DOC/esdoc-jupyterhub | notebooks/hammoz-consortium/cmip6/models/mpiesm-1-2-ham/atmos.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', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: HAMMOZ-CONSORTIUM
Source ID: MPIESM-1-2-HAM
Topic: Atmos
Sub-Topic... |
pligor/predicting-future-product-prices | 04_time_series_prediction/06_price_history_varlen-no-outliers.ipynb | agpl-3.0 | from __future__ import division
import tensorflow as tf
from os import path
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper import show_graph
... |
tata-antares/tagging_LHCb | experiments_MC_data_reweighting/not_simulated_tracks_removing.ipynb | apache-2.0 | %pylab inline
figsize(8, 6)
import sys
sys.path.insert(0, "../")
"""
Explanation: Idea
Результат (ожидаемый)
обучение происходит на своем родном канале на симулированных данных
учитываются различия симуляции и данных (см. ниже алгоритм)
оценка качества (как и калибровка) будут несмещенными
качество лучше, чем baseli... |
pfctdayelise/aomp | How many Australian Open players need photos in Wikipedia?.ipynb | mit | import mwclient
site = mwclient.Site('en.wikipedia.org')
PLAYERSFILE = 'sampleplayers.txt'
def getPage(name):
return site.Pages[name]
def hasImage(page):
# TODO
return False
hasimage = []
needsimage = []
with open(PLAYERSFILE) as players:
for player in players:
page = getPage(player)
... |
robblack007/clase-metodos-numericos | Practicas/P1/Practica 1 - Introduccion a Jupyter.ipynb | mit | 2 + 3
2*3
2**3
sin(pi)
"""
Explanation: Introducción a Jupyter
Expresiones aritmeticas y algebraicas
Empezaremos esta práctica con algo de conocimientos previos de programación. Se que muchos de ustedes no han tenido la oportunidad de utilizar Python como lenguaje de programación y mucho menos Jupyter como ambiente... |
cmawer/pycon-2017-eda-tutorial | notebooks/0-Intro/0-Introduction-to-Jupyter-Notebooks.ipynb | mit | # in select mode, shift j/k (to select multiple cells at once)
# split cell with ctrl shift -
# merge with shift M
first = 1
second = 2
third = 3
"""
Explanation: Keyboard shortcuts
For help, ESC + h
End of explanation
"""
import numpy as np
np.random.choice()
"""
Explanation: Different heading levels
With text... |
privong/pythonclub | sessions/03-matplotlib_aplpy/01 Matplotlib tutorial 2.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import pickle
# This is my custom object which holds the structure for my grains
from GrainStructure import Grain_Structure
"""
Explanation: Advanced matplotlib (or Problems I faced with matplotlib)
Alejandro Sazo Gómez<br />
Ingeniero Civil Informático, UTFSM.<br />
... |
rrbb014/data_science | fastcampus_dss/2016_05_17/0517_02__SymPy를 사용한 함수 미분.ipynb | mit | def f(x):
return 2*x
x = 10
y = f(x)
print(x, y)
"""
Explanation: SymPy를 사용한 함수 미분
데이터 분석에서 미분의 필요성
그다지 관련이 없어 보이지만 사실 데이터 분석에도 미분(differentiation)이 필요하다. 데이터 분석의 목표 중 하나는 확률 모형의 모수(parameter)나 상태 변수(state)를 추정(estimation)하는 작업이다. 이러한 작업은 근본적으로 함수의 최소점 혹은 최대점을 찾는 최적화(optimization) 작업이며 미분 혹은 편미분을 사용한 도함수를 필요로 한다... |
geoscixyz/computation | docs/case-studies/TDEM/Kevitsa_VTEM.ipynb | mit | from SimPEG import Mesh, EM, Utils, Maps
from matplotlib.colors import LogNorm
%pylab inline
import numpy as np
from scipy.constants import mu_0
from ipywidgets import interact, IntSlider
import cPickle as pickle
url = "https://storage.googleapis.com/simpeg/kevitsa_synthetic/"
files = ['dc_mesh.txt', 'dc_sigma.txt']
k... |
robertoalotufo/ia898 | master/tutorial_pehist_1.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import sys,os
ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
f = mpimg.imread('../data/cameraman.tif')
ia.adshow(f, 'f... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/sandbox-2/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Pro... |
QuantScientist/Deep-Learning-Boot-Camp | day03/1.1 Introduction - Deep Learning and ANN.ipynb | mit | # Import the required packages
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import scipy
# Display plots in notebook
%matplotlib inline
# Define plot's default figure size
matplotlib.rcParams['figure.figsize'] = (10.0, 8.0)
#read the datasets
train = pd.read_csv("data/intr... |
machinelearningnanodegree/stanford-cs231 | solutions/vijendra/assignment1/two_layer_net.ipynb | mit | # A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.neural_net import TwoLayerNet
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloadi... |
cs207-project/TimeSeries | docs/vptree_demo.ipynb | mit | def find_similar_pt():
rn = lambda: random.randint(0, 10000)
aset = [(rn(), rn()) for i in range(40000)]
q = (rn(), rn())
rad = 9990
distance = lambda a, b: math.sqrt(sum([((x-y)**2) for x, y in zip(a, b)]))
s = time.time()
print("creating vptree...")
root = VpNode(aset, distance=distan... |
UltronAI/Deep-Learning | CS231n/reference/CS231n-master/assignment3/ImageGradients.ipynb | mit | # As usual, a bit of setup
import time, os, json
import numpy as np
import skimage.io
import matplotlib.pyplot as plt
from cs231n.classifiers.pretrained_cnn import PretrainedCNN
from cs231n.data_utils import load_tiny_imagenet
from cs231n.image_utils import blur_image, deprocess_image
%matplotlib inline
plt.rcParams... |
GoogleCloudPlatform/training-data-analyst | courses/unstructured/Unstructured-ML.ipynb | apache-2.0 | APIKEY="AIzaSyBQrrl4SZhE3QtxsnbjY2WTdgcBz0G0Rfs" # CHANGE
print APIKEY
PROJECT_ID = "qwiklabs-gcp-14067121d7b1d12c" # CHANGE
print PROJECT_ID
BUCKET = "qwiklabs-gcp-14067121d7b1d12c" # CHANGE
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT_ID
from googleapiclient.discovery import build... |
kunalj101/scipy2015-blaze-bokeh | 2. Blaze.ipynb | mit | import pandas as pd
df = pd.read_csv('data/iris.csv')
df.head()
df.groupby(df.Species).PetalLength.mean() # Average petal length per species
"""
Explanation: <img src=images/continuum_analytics_b&w.png align="left" width="15%" style="margin-right:15%">
<h1 align='center'>Introduction to Blaze</h1>
In this tutorial ... |
ejolly/Python | forFun/echoPy.ipynb | mit | from pyechonest import config, artist, song
import pandas as pd
config.ECHO_NEST_API_KEY = 'XXXXXXXX' #retrieved from https://developer.echonest.com/account/profile
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
"""
Explanation: Some code playing with the Echonest API pytho... |
GoogleCloudPlatform/cloudml-samples | notebooks/scikit-learn/HyperparameterTuningWithScikitLearnInCMLE.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... |
feststelltaste/software-analytics | notebooks/Reading a Git log file output with Pandas.ipynb | gpl-3.0 | with open (r'data/gitlog_aim42.log') as log:
[print(line, end='') for line in log.readlines()[:8]]
"""
Explanation: Context
Reading data from a software version control system can be pretty useful if you want to answer some evolutionary questions like
* Who are our main committers to the software?
* Are there any ... |
roebius/deeplearning1_keras2 | 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]... |
indiependente/Social-Networks-Structure | results/RandomGraph Results Analysis.ipynb | mit | #!/usr/bin/python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from stats import parse_results, get_percentage, get_avg_per_seed, draw_pie, draw_bars, draw_bars_comparison, draw_avgs
"""
Explanation: Random Graph Experiments Output Visualization
End of explanation
"""
pr, eigen, bet = parse_... |
anhquan0412/deeplearning_fastai | deeplearning1/nbs/statefarm-sample.ipynb | apache-2.0 | from __future__ import division, print_function
%matplotlib inline
# path = "data/state/"
path = "data/state/sample/"
from importlib import reload # Python 3
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
batch_size=64
#batch_size=1
"""
Explanation: Enter State Farm
End of expla... |
dataewan/deep-learning | autoencoder/Simple_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
"""
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to compres... |
jmhsi/justin_tinker | data_science/courses/temp/courses/ml1/lesson2-rf_interpretation.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.imports import *
from fastai.structured import *
from pandas_summary import DataFrameSummary
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from IPython.display import display
from sklearn import metrics
set_plot_sizes(12,1... |
grokkaine/biopycourse | day1/data.ipynb | cc0-1.0 | #use like this: cat file.txt | python script.py
import sys
for line in sys.stdin:
# do suff
print(line)
"""
Explanation: Python and the data
Text and binary: streaming, serialization, regular expression
The Web: XML parsing, html scraping, web frameworks, API calls
Data Storage: SQLite, SQL querrying, Chunkin... |
phoebe-project/phoebe2-docs | 2.3/examples/distortion_method_none.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Black Hole Binary (distortion_method='none')
Attempting to set a very cool temperature for a star with a large mass to mimic a black hole will likely cause out-of-bounds errors in atmosphere tables. You can get around this slightly by using blackbody atmospheres fo... |
marcinofulus/teaching | ML_SS2017/Numpy_cwiczenia.ipynb | gpl-3.0 | import numpy as np
x = np.linspace(0,10,23)
f = np.sin(x)
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(x,f,'o-')
plt.plot(4,0,'ro')
# f1 = f[1:-1] * f[:]
print(np.shape(f[:-1]))
print(np.shape(f[1:]))
ff = f[:-1] * f[1:]
print(ff.shape)
x_zero = x[np.where(ff < 0)]
x_zero2 = x[np.where(ff < 0)[0] +... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/10_recommend/labs/composer_gcf_trigger/composertriggered.ipynb | apache-2.0 | import os
PROJECT = 'your-project-id' # REPLACE WITH YOUR PROJECT ID
REGION = 'us-central1' # REPLACE WITH YOUR REGION e.g. us-central1
# do not change these
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
"""
Explanation: Triggering a Cloud Composer Pipeline with a Google Cloud Function
In this advance... |
neuro-data-mining/materials | Convolution/What's a Convolution?.ipynb | mit | from __future__ import division
import matplotlib
matplotlib.use("TkAgg")
%pylab inline
plt.xkcd();
from scipy.stats import multivariate_normal
from scipy.io import wavfile
from IPython.display import Audio
import matplotlib.animation as animation
import base64
import scipy.signal
from PIL import Image
import plo... |
hvillanua/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 = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
andrew-lundgren/detchar | Notebooks/NoiseHunting/IncoherentSubtraction.ipynb | gpl-3.0 | fftlen=32
overlap=24
coh=darm.coherence(aux,fftlen,overlap)
psd=darm.psd(fftlen,overlap)
"""
Explanation: Find the PSD of DARM, and the coherence with the aux channel.
End of explanation
"""
coh_long=zeros(len(psd),dtype=coh.dtype)
coh_long[:len(coh)]=coh.value
psd_sub=(1.-coh_long)*psd
p1=psd.plot()
p1.gca().plot... |
chapman-phys227-2016s/hw-1-seama107 | Homework1Notebook.ipynb | mit | def some_function(x):
return x**4 + x**2
print(p1.adaptive_trapezint(some_function, 0, 20))
"""
Explanation: Homework 2
Michael Seaman
2/12/16
Problem 3.8: Adaptive Trapazoid Approximation
Using the trapazoid approximation to find areas under the curve, we can get a good guess at bounded integration, however, we c... |
phoebe-project/phoebe2-docs | 2.0/tutorials/beaming_boosting.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Beaming and Boosting
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 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 inline
... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/tf2_object_detection.ipynb | apache-2.0 | #@title Copyright 2020 The TensorFlow Hub Authors. 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 ... |
NYUDataBootcamp/Projects | UG_F16/Kukoff-NYC.ipynb | mit | # import packages
import pandas as pd
import matplotlib.pyplot as plt
import sys
from itertools import cycle, islice
import math
import numpy as np
%matplotlib inline
"""
Explanation: Misdemeanor Amounts New York City
Data Bootcamp Final Project (Fall 2016)
by Zak Kukoff (kukoff@nyu.edu)
Ab... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/Errors and Exceptions Handling-checkpoint.ipynb | apache-2.0 | print 'Hello
"""
Explanation: Errors and Exception Handling
In this lecture we will learn about Errors and Exception Handling in Python. You've definitely already encountered erros by this point in the course. For example:
End of explanation
"""
try:
f = open('testfile','w')
f.write('Test write this')
except... |
rcrehuet/Python_for_Scientists_2017 | notebooks/2_0_Loops.ipynb | gpl-3.0 | for t in range(41):
if t % 5 == 0:
print(t+273.15)
for t in range(0,41,5):
print(t+273.15)
"""
Explanation: Introductory exercices: Loops
Celsius to Kelvin
Print the conversion from Celsius degrees to Kelvin, from 0ºC to 40ºC, with a step of 5. That is, 0, 5, 10, 15...
End of explanation
"""
for n i... |
massimo-nocentini/simulation-methods | notes/matrices-functions/fibonacci-generation-matrix.ipynb | mit | from sympy import *
from sympy.abc import n, i, N, x, lamda, phi, z, j, r, k, a
from commons import *
from matrix_functions import *
from sequences import *
import functions_catalog
init_printing()
"""
Explanation: <p>
<img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg"
alt="UniFI l... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session11/Day1/InvestigatingDetectorsSolutions.ipynb | mit | from astropy.io import fits
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['figure.dpi'] = 120
"""
Explanation: Investigating Detectors
Version 0.1
Understanding the behavior of the CCDs in a camera requires digging deep into calibration exposures. That is where you can unco... |
xdnian/pyml | code/ch02/ch02.ipynb | mit | %load_ext watermark
%watermark -a '' -u -d -v -p numpy,pandas,matplotlib
"""
Explanation: Copyright (c) 2015, 2016
Sebastian Raschka
Li-Yi Wei
https://github.com/1iyiwei/pyml
MIT License
Python Machine Learning - Code Examples
Chapter 2 - Training Machine Learning Algorithms for Classification
Note that the optional w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.