repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
scotthuang1989/Python-3-Module-of-the-Week | data_persistence_exchange/Parsing_xml_document.ipynb | apache-2.0 | from xml.etree import ElementTree
with open('podcasts.opml', 'rt') as f:
tree = ElementTree.parse(f)
print(tree)
"""
Explanation: Example xml file:
```
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>My Podcasts</title>
<dateCreated>Sat, 06 Aug 2016 15:53:26 GMT</dateCreated... |
dh7/ML-Tutorial-Notebooks | RNN.ipynb | bsd-2-clause | """
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('methamorphosis.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
print 'data has %d characters, %d un... |
paoloRais/lightfm | examples/movielens/learning_schedules.ipynb | apache-2.0 | import numpy as np
import data
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from lightfm import LightFM
from lightfm.datasets import fetch_movielens
from lightfm.evaluation import auc_score
movielens = fetch_movielens()
train, test = movielens['train'], movielens['test']
... |
feststelltaste/software-analytics | demos/20190404_Duesseldorf/DataScienceMeetsSoftwareData.ipynb | gpl-3.0 | import pandas as pd
log = pd.read_csv("../dataset/linux_blame_log.csv.gz")
log.head()
"""
Explanation: Data Science meets Software Data
<b>Markus Harrer</b>, Software Development Analyst
@feststelltaste
<small>INNOQcon 2019, Düsseldorf, 04.04.2019</small>
<img src="../resources/innoq_logo.jpg" width=20% height="20%" ... |
qingshuimonk/LolStats | getMatchList.ipynb | mit | from lolcrawler_util import read_key, get_summoner_info
api_key = read_key()
name = 'Doublelift'
summoner = get_summoner_info(api_key, name)
usr_id = summoner[name.lower()]['id']
print usr_id
"""
Explanation: Get Match list of a player, and analyze the information
First we need to find the player's id, it would be fu... |
Lstyle1/Deep_learning_projects | batch-norm/Batch_Normalization_Lesson.ipynb | mit | # Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"... |
JavascriptMick/deeplearning | language-translation/dlnd_language_translation.ipynb | mit | import helper
import problem_unittests as tests
"""
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: L... |
smorton2/think-stats | code/chap03ex.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
import thinkstats2
import thinkplot
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/... |
maartenbreddels/ipyvolume | docs/source/examples/volshow.ipynb | mit | import numpy as np
import ipyvolume as ipv
V = np.zeros((128,128,128)) # our 3d array
# outer box
V[30:-30,30:-30,30:-30] = 0.75
V[35:-35,35:-35,35:-35] = 0.0
# inner box
V[50:-50,50:-50,50:-50] = 0.25
V[55:-55,55:-55,55:-55] = 0.0
ipv.figure()
ipv.volshow(V, level=[0.25, 0.75], opacity=0.03, level_width=0.1, data_min... |
mne-tools/mne-tools.github.io | 0.20/_downloads/e6f2b45ae501bec73cddc70f08093041/plot_40_visualize_raw.ipynb | bsd-3-clause | import os
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)
raw.crop(tmax=60).load_data()
"""
Explanation: Built-in plotti... |
ES-DOC/esdoc-jupyterhub | notebooks/nims-kma/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nims-kma', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NIMS-KMA
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Em... |
joshnsolomon/phys202-2015-work | assignments/assignment03/NumpyEx03.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 3
Imports
End of explanation
"""
def brownian(maxt, n):
"""Return one realization of a Brownian (Wiener) process with n steps... |
xmunoz/sodapy | examples/basic_queries.ipynb | mit | import os
import pandas as pd
import numpy as np
from sodapy import Socrata
"""
Explanation: Example 01: Basic Queries
Retrieving data from Socrata databases using sodapy
Setup
End of explanation
"""
# Enter the information from those sections here
socrata_domain = 'opendata.socrata.com'
socrata_dataset_identifier ... |
wuafeing/Python3-Tutorial | 02 strings and text/02.08 regexp for multiline partterns.ipynb | gpl-3.0 | import re
comment = re.compile(r"/\*(.*?)\*/")
text1 = '/* this is a comment */'
text2 = '''/* this is a
multiline comment */
'''
comment.findall(text1)
comment.findall(text2)
"""
Explanation: Previous
2.8 多行匹配模式
问题
你正在试着使用正则表达式去匹配一大块的文本,而你需要跨越多行去匹配。
解决方案
这个问题很典型的出现在当你用点 (.) 去匹配任意字符的时候,忘记了点 (.) 不能匹配换行符的事实。 比如,假设你想试着去... |
gaufung/Data_Analytics_Learning_Note | Probability-Theory/Chapter_02.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
plt.plot([1,2], [1,1], linewidth=2,c='k')
plt.plot([1,1], [0,1],'k--', linewidth=2)
plt.plot([2,2], [0,1],'k--', linewidth=2)
plt.plot([0,1], [1,1],'k--')
plt.xticks([1,2],[r'$a$',r'$b$'])
plt.yticks([1],[r'$\frac{1}{b-a}$'])
plt.xlabel('x')
plt.ylabel(r'$f(x)$')
plt.a... |
samgoodgame/sf_crime | supporting_notebook.ipynb | mit | # Import relevant libraries:
import time
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
from sklearn.naive_bayes import BernoulliNB
from sklearn.na... |
peterhanlon/botdefender | ECI_Presentation.ipynb | mit | !pip install transformers
!pip install torch
!pip install keybert
"""
Explanation: <a href="https://colab.research.google.com/github/peterhanlon/botdefender/blob/master/ECI_Presentation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Examples from t... |
gigjozsa/HI_analysis_course | chapter_12_abs/01_00_introduction.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
"""
Explanation: Content
Glossary
1. Somename
Next: 1.1 Somename 2
Import standard modules:
End of explanation
"""
pass
HTML('../style/code_toggle.html')
"""
... |
google-research/google-research | building_detection/open_buildings_spatial_analysis_examples.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... |
ocelot-collab/ocelot | demos/ipython_tutorials/1_introduction.ipynb | gpl-3.0 | from IPython.display import Image
# Image(filename='gui_example.png')
"""
Explanation: This notebook was created by Sergey Tomin (sergey.tomin@desy.de). Source and license info is on GitHub. April 2020.
An Introduction to Ocelot
Ocelot is a multiphysics simulation toolkit designed for studying FEL and storage ring bas... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/statespace_arma_0.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.graphics.api import qqplot
"""
Explanation: Autoregressive Moving Average (ARMA): Sunspots data
This notebook replicates the existing ARMA notebook using th... |
astroumd/GradMap | notebooks/Lectures2021/Lecture2/challenge_problem2_student_version.ipynb | gpl-3.0 | # your code here
"""
Explanation: Welcome to your projectile motion challenge problem! Here you'll write code that will plot the trajectory of a projectile in ideal conditions, with the standard assumptions of no air resistance and constant gravitational acceleration. You'll use the path-length function you created ea... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/mediation_survival.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.stats.mediation import Mediation
"""
Explanation: Mediation analysis with duration data
This notebook demonstrates mediation analysis when the
mediator and outcome are duration variables, modeled
using proportional hazards regression.... |
mauroalberti/gsf | checks/Check Runge-Kutta-Fehlberg interpolation.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
"""
Explanation: Preliminary settings
Created by Mauro Alberti
Last run: 2019-06-22
In order to plot fields, we run the following commands:
End of explanation
"""
import math
"""
Explanation: We import the math library:
End of explanation
"""
from pygsf.mathemati... |
gcallah/Indra | notebooks/AFirstModel.ipynb | gpl-3.0 | from indra.agent import Agent, AgentEncoder
from indra.composite import Composite
from indra.env import Env
"""
Explanation: A First Model Using Indra2
The aim of re-writing the library code upon which Indra models relied was to reduce the complexity of the system, and achieve greater expressiveness with fewer lines o... |
tensorflow/examples | courses/udacity_intro_to_tensorflow_for_deep_learning/l05c02_dogs_vs_cats_with_augmentation.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... |
Alexoner/skynet | notebooks/TransferLearning.ipynb | mit | # A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from time import time
%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-reloading extenrnal modules
# see http:/... |
PAIR-code/what-if-tool | keras_sklearn_compare_caip_e2e.ipynb | apache-2.0 | import sys
python_version = sys.version_info[0]
# If you're running on Colab, you'll need to install the What-if Tool package and authenticate
def pip_install(module):
if python_version == '2':
!pip install {module} --quiet
else:
!pip3 install {module} --quiet
try:
import google.colab
... |
IanHawke/Southampton-PV-NumericalMethods-2016 | notebooks/03-Root-finding.ipynb | mit | from __future__ import division
import numpy
from matplotlib import pyplot
%matplotlib notebook
def f(Rs):
return 3.5 -3.2*(numpy.exp((10+3*Rs)/20.0 - 1.0) - 1.0) - (10.0 + 3.0*Rs)/300.0 - 3
Rs = numpy.linspace(0, 10)
pyplot.figure(figsize=(10,6))
pyplot.plot(Rs, f(Rs))
pyplot.xlabel(r"$R_s$")
pyplot.ylabel(r"$f$... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/official/migration/UJ11 Vertex SDK Hyperparameter Tuning.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex AI: Vertex AI Migration: Hyperparameter Tuning
<table align="left">
<td>
<a href="... |
thaophung/Udacity_deep_learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
jorisvanzundert/reynaert-as-graph | notebook/07 The Distracting Interface.ipynb | gpl-3.0 | from IPython.display import HTML
HTML('''
<script src="resources/d3/d3.min.js"></script>
<script src="resources/d3/d3.hive.min.js"></script>
''')
"""
Explanation: Chapter 7 — The Distracting Interface
As I (and others) have argued elsewhere (<a href="#bibref_001" name="backref_bibref_001" id="backref_bibref_... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/td1a_correction_session9.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - Optimisation sous contrainte (correction)
Un peu plus de détails dans cet article : Damped Arrow-Hurwicz algorithm for sphere packing.
End of explanation
"""
from cvxopt import solvers, matrix
import random
def fonction(x=Non... |
shikhar413/openmc | examples/jupyter/mdgxs-part-i.ipynb | mit | from IPython.display import Image
Image(filename='images/mdgxs.png', width=350)
"""
Explanation: Multigroup (Delayed) Cross Section Generation Part I: Introduction
This IPython Notebook introduces the use of the openmc.mgxs module to calculate multi-energy-group and multi-delayed-group cross sections for an infinite h... |
sbailey/knltest | doc/extract-size.ipynb | bsd-3-clause | %pylab inline
import numpy as np
from astropy.table import Table
knl = Table.read('../doc/data/extract-size/knl.txt', format='ascii')
hsw = Table.read('../doc/data/extract-size/hsw.txt', format='ascii')
hsw.colnames
knl.sort('ntot')
hsw.sort('ntot')
def table2rate2d(data):
nwave_opts = sorted(set(data['nwave'])... |
simonsfoundation/CaImAn | demos/notebooks/demo_pipeline.ipynb | gpl-2.0 | import bokeh.plotting as bpl
import cv2
import glob
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
try:
cv2.setNumThreads(0)
except():
pass
try:
if __IPYTHON__:
# this is used for debugging purposes only. allows to reload classes
# when changed
get_ipyt... |
lionell/laboratories | num_methods/first/lab2.ipynb | mit | def is_square(a):
return a.shape[0] == a.shape[1]
def has_solutions(a, b):
return np.linalg.matrix_rank(a) == np.linalg.matrix_rank(np.append(a, b[np.newaxis].T, axis=1))
"""
Explanation: Linear systems
<img src="https://i.ytimg.com/vi/7ujEpq7MWfE/maxresdefault.jpg" width="400" />
Given square matrix $A_{nxn}... |
satishgoda/learning | web/jquery.ipynb | mit | %%javascript
console.info($);
window.alert($);
"""
Explanation: Back to Html
jQuery
https://jquery.org
https://en.wikipedia.org/wiki/JQuery
https://weblogs.asp.net/scottgu/jquery-and-microsoft
Overview
Press CTRL + SHIFT + I to open the Browser debug console
End of explanation
"""
%%javascript
var sequence = [1,... |
jorgemauricio/INIFAP_Course | ejercicios/Numpy/1_Arreglos Numpy.ipynb | mit | my_list = [1,2,3]
my_list
np.array(my_list)
my_matrix = [[1,2,3],[4,5,6],[7,8,9]]
my_matrix
"""
Explanation: Crear Numpy Arrays
De una lista de python
Creamos el arreglo directamente de una lista o listas de python
End of explanation
"""
np.arange(0,10)
np.arange(0,11,2)
"""
Explanation: Métodos
arange
End of ex... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_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 mne... |
PythonFreeCourse/Notebooks | week04/5_Builtins.ipynb | mit | print(abs(-5))
numbers = [5, -5, 1.337, -1.337]
for number in numbers:
print(f"abs({number:>6}) = {abs(number)}")
"""
Explanation: <img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומ... |
robertoalotufo/ia898 | src/logfilter.ipynb | mit | import numpy as np
def logfilter(f, sigma):
import ia898.src as ia
f = np.array(f)
if len(f.shape) == 1: f = f[newaxis,:]
x = (np.array(f.shape)//2).astype(int)
h = ia.log(f.shape, (np.array(f.shape)//2).astype(int), sigma)
h = ia.dftshift(h)
H = np.fft.fft2(h)
if not ia.isccs... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/automl/showcase_automl_image_object_detection_export_edge.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: AutoML image object detection model for export to edge
<table align=... |
mitdbg/modeldb | client/workflows/demos/setup-script.ipynb | mit | import six
from verta import Client
from verta.utils import ModelAPI
HOST = "app.verta.ai"
PROJECT_NAME = "Part-of-Speech Tagging"
EXPERIMENT_NAME = "NLTK"
client = Client(HOST)
proj = client.set_project(PROJECT_NAME)
expt = client.set_experiment(EXPERIMENT_NAME)
run = client.set_experiment_run()
"""
Explanation:... |
ChadFulton/statsmodels | examples/notebooks/statespace_local_linear_trend.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from scipy.stats import norm
import statsmodels.api as sm
import matplotlib.pyplot as plt
"""
Explanation: State space modeling: Local Linear Trends
This notebook describes how to extend the Statsmodels statespace classes to create and estimate a custom model.... |
garth-wells/notebooks-3M1 | 02-LeastSquares.ipynb | bsd-2-clause | %matplotlib inline
import matplotlib.pyplot as plt
# Use seaborn to style the plots and use accessible colors
import seaborn as sns
sns.set()
sns.set_palette("colorblind")
import numpy as np
N = 100
x = np.linspace(-1, 1, N)
def runge(x):
return 1 /(25 * (x**2) + 1)
plt.xlabel('$x$')
plt.ylabel('$y$')
plt.title... |
Hguimaraes/gtzan.keras | nbs/1.0-handcrafted_features.ipynb | mit | import os
import librosa
import itertools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import kurtosis
from scipy.stats import skew
import sklearn
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion... |
jahuth/convis | examples/Quickstart - Fitting models to data.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pylab as plt
import convis
inp, out = convis.samples.generate_sample_data(input='random',size=(2000,20,20))
print(inp.shape)
"""
Explanation: First, you need to get your data in a certain format:
- videos or stimuli can be time by x by y numpy arrays, or 1 by ch... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/05_artandscience/c_neuralnetwork.ipynb | apache-2.0 | import math
import shutil
import numpy as np
import pandas as pd
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
pd.options.display.max_rows = 10
pd.options.display.float_format = '{:.1f}'.format
"""
Explanation: Neural Network
Learning Objectives:
* Use the DNNRegressor class in TensorFlow to pre... |
dereneaton/RADmissing | emp_nb_Barnacles.ipynb | mit | ### Notebook 8
### Data set 8: Barnacles
### Authors: Herrera et al. 2015
### Data Location: SRP051026
"""
Explanation: Notebook 8:
This is an IPython notebook. Most of the code is composed of bash scripts, indicated by %%bash at the top of the cell, otherwise it is IPython code. This notebook includes code to downloa... |
open2c/bioframe | docs/tutorials/tutorial_assign_motifs_to_peaks.ipynb | mit | import bioframe
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import pearsonr, spearmanr
base_dir = '/tmp/bioframe_tutorial_data/'
assembly = 'GRCh38'
"""
Explanation: How to: assign TF Motifs to ChIP-seq peaks
This tutorial demonstrates one way to assign CTCF motifs to CTCF... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-esm2-hr5/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-esm2-hr5', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-ESM2-HR5
Topic: Aerosol
Sub-Topics: Transport, Emission... |
Naereen/notebooks | A tiny regex challenge solved without another regex.ipynb | mit | import sys
print(sys.version)
from typing import List, Tuple
Position = int
Interval = Tuple[Position, Position]
"""
Explanation: A tiny regex challenge solved without another regex
This notebook presents a small challenge a friend of mine asked me (in Python).
I'll write Python code valid for versions $\geq$ 3.6, a... |
bashtage/statsmodels | examples/notebooks/markov_autoregression.ipynb | bsd-3-clause | %matplotlib inline
from datetime import datetime
from io import BytesIO
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
import statsmodels.api as sm
# NBER recessions
from pandas_datareader.data import DataReader
usrec = DataReader(
"USREC", "fred", start=datetime(1947, 1,... |
bmorris3/gsoc2015 | timezones.ipynb | mit | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.time import Time
import astropy.units as u
from astropy.coordinates import EarthLocation
import pytz
import datetime
from astroplan import Observer
# Set up an observer at ~Subaru
location = Eart... |
tsarouch/data_science_references_python | core/regression_business-questions.ipynb | gpl-2.0 | from sklearn.datasets import load_boston
boston = load_boston()
# features
df = pd.DataFrame(boston.data)
df.columns = boston.feature_names
# dependent variable
df['PRICE'] = boston.target
df.head(3)
"""
Explanation: Get Data
End of explanation
"""
# Lets use only one feature
df1 = df[['LSTAT', 'PRICE']]
X = df1['L... |
strandbygaard/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
pyGrowler/Growler | examples/ExampleNotebook_1.ipynb | apache-2.0 | import growler
growler.__meta__.version_info
"""
Explanation: Growler Example in Jupyter
End of explanation
"""
app = growler.App("NotebookServer")
"""
Explanation: Create growler application with name NotebookServer
End of explanation
"""
@app.use
def print_client_info(req, res):
ip = req.ip
reqpath = r... |
grokkaine/biopycourse | day2/ML_DR.ipynb | cc0-1.0 | %matplotlib inline
"""
Explanation: Dimension Reduction
Feature selection
Feature extraction
PCA
ICA
FA
Application: tSNE
End of explanation
"""
from sklearn.svm import LinearSVC
from sklearn.datasets import load_iris
from sklearn.feature_selection import SelectFromModel
iris = load_iris()
X, y = iris.data, iris.... |
zentonllo/tfg-tensorflow | cloud/datalab/notebooks_ejemplo/BigQuery+Magic+Commands+and+DML.ipynb | mit | %%bq query --name UniqueNames2013
WITH UniqueNames2013 AS
(SELECT DISTINCT name
FROM `bigquery-public-data.usa_names.usa_1910_2013`
WHERE Year = 2013)
SELECT * FROM UniqueNames2013
"""
Explanation: BigQuery Magic Commands and DML
The examples in this notebook introduce features of BigQuery Standard SQL and BigQuer... |
bashtage/statsmodels | examples/notebooks/formulas.ipynb | bsd-3-clause | import numpy as np # noqa:F401 needed in namespace for patsy
import statsmodels.api as sm
"""
Explanation: Formulas: Fitting models using R-style formulas
Since version 0.5.0, statsmodels allows users to fit statistical models using R-style formulas. Internally, statsmodels uses the patsy package to convert formulas... |
NumCosmo/NumCosmo | notebooks/DataNCount/cmp_cluster_ccl_numcosmo.ipynb | gpl-3.0 | #CCL cosmology
cosmo_ccl = ccl.Cosmology(Omega_c = 0.30711 - 0.048254, Omega_b = 0.048254, h = 0.677, sigma8 = 0.8822714165197718, n_s=0.96, Omega_k = 0, transfer_function='eisenstein_hu')
ccl_cosmo_set_high_prec (cosmo_ccl)
cosmo, dist, ps_lin, ps_nln, hmfunc = create_nc_obj (cosmo_ccl)
psf = hmfunc.peek_psf ()
"""... |
IanHawke/msc-or-python | 02-loops-functions.ipynb | mit | def add(x, y):
"""
Add two numbers
Parameters
----------
x : float
First input
y : float
Second input
Returns
-------
x + y : float
"""
return x + y
add(1, 2)
"""
Explanation: Functions
Storing individual Python commands for re-use is one... |
relopezbriega/mi-python-blog | content/notebooks/RegexPython.ipynb | gpl-2.0 | # importando el modulo de regex de python
import re
"""
Explanation: Expresiones Regulares con Python
Esta notebook fue creada originalmente como un blog post por Raúl E. López Briega en Mi blog sobre Python. El contenido esta bajo la licencia BSD.
<img alt="Expresiones regulares" title="Expresiones regulares" src="... |
phoebe-project/phoebe2-docs | 2.3/tutorials/solver_times.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Advanced: solver_times
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
import numpy as np
import matplotlib.pyplot as ... |
tensorflow/tensorflow | tensorflow/lite/g3doc/models/modify/model_maker/image_classification.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... |
Olsthoorn/TransientGroundwaterFlow | readthedocs/Course2016_jupyter/docs/source/PartialPenetration.ipynb | gpl-3.0 | from scipy.special import k0 # bessel function K0
import numpy as np
def dWpp(r, z, a, b, D):
"""Returns additional drawdown caused by partial penetration
Solution by Hantush. See Kruseman and De Ridder (1994), p159.
The real extra drawdown is Q/(2 pi kD) * dW
Parmeters:
----------
r : dis... |
gabicfa/RedesSociais | encontro02/3-bellman.ipynb | gpl-3.0 | import sys
sys.path.append('..')
import socnet as sn
"""
Explanation: Encontro 02, Parte 3: Algoritmo de Bellman-Ford
Este guia foi escrito para ajudar você a atingir os seguintes objetivos:
implementar o algoritmo de Bellman-Ford;
praticar o uso da biblioteca da disciplina.
Primeiramente, vamos importar a bibliote... |
UCSD-E4E/radio_collar_tracker_drone | doc/Precision Analysis.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt; plt.ion()
from scipy.optimize import least_squares
from scipy import stats as st
"""
Explanation: This notebook presents the techniques of displaying the precision of the Radio Telemetry Tracker system.
End of explanation
"""
def receivePowerModel(d, k, n):
ret... |
nikodtbVf/aima-si | search.ipynb | mit | from search import *
"""
Explanation: Solving problems by Searching
This notebook serves as supporting material for topics covered in Chapter 3 - Solving Problems by Searching and Chapter 4 - Beyond Classical Search from the book Artificial Intelligence: A Modern Approach. This notebook uses implementations from searc... |
retnuh/deep-learning | autoencoder/Simple_Autoencoder.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... |
kingb12/languagemodelRNN | report_notebooks/encdec_noing15_bow_200_512_04drb.ipynb | mit | report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing15_bow_200_512_04drb/encdec_noing15_bow_200_512_04drb.json'
log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing15_bow_200_512_04drb/encdec_noing15_bow_200_512_04drb_logs.json'
import json
import ... |
tensorflow/examples | lite/examples/digit_classifier/ml/mnist_tflite.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... |
DJCordhose/ai | notebooks/tf2/time-series-advanced.ipynb | mit | !pip install -q tf-nightly-gpu-2.0-preview
import tensorflow as tf
print(tf.__version__)
# univariate data preparation
import numpy as np
# split a univariate sequence into samples
def split_sequence(sequence, n_steps):
X, y = list(), list()
for i in range(len(sequence)):
# find the end of this pattern
end_ix ... |
Santana9937/Regression_ML_Specialization | Week_4_Ridge_Regression/assign_2_ridge-regression.ipynb | mit | import graphlab
import numpy as np
import pandas as pd
from sklearn import linear_model
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('darkgrid')
%matplotlib inline
"""
Explanation: Regression Week 4: Ridge Regression (gradient descent)
In this notebook, we will implement... |
tensorflow/probability | tensorflow_probability/examples/jupyter_notebooks/Linear_Mixed_Effects_Model_Variational_Inference.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... |
widdowquinn/SI_Holmes_etal_2017 | notebooks/02-full_model_fit.ipynb | mit | %pylab inline
import os
import pickle
import warnings; warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import pystan
import scipy
import seaborn as sns; sns.set_context('notebook')
from Bio import SeqIO
import tools
"""
Explanation: <img src="images/JHI_STRAP_Web.png" style="width: 150px; ... |
ffmmjj/desafio-dados-2016 | experiments/Analise Exploratoria.ipynb | apache-2.0 | from preprocessamento_escola_2011 import escolas_info_train, escolas_info_test
"""
Explanation: Carregamento e junção dos dados
End of explanation
"""
escolas_info_train.info()
"""
Explanation: O módulo acima carrega os dados e os divide entre conjunto de treinamento(Para análise exploratória) e conjunto de teste(p... |
JorgeDeLosSantos/nusa | docs/nusa-info/es/truss-element.ipynb | mit | %matplotlib inline
from nusa import * # Importando nusa
E,A = 210e9, 3.1416*(10e-3)**2
n1 = Node((0,0))
n2 = Node((2,0))
n3 = Node((0,2))
e1 = Truss((n1,n2),E,A)
e2 = Truss((n1,n3),E,A)
e3 = Truss((n2,n3),E,A)
m = TrussModel()
for n in (n1,n2,n3): m.add_node(n)
for e in (e1,e2,e3): m.add_element(e)
m.add_constraint(n1... |
ucsd-ccbb/VAPr | VAPr Quick-Start Guide.ipynb | mit | import os
from IPython.display import Image, display, HTML
Image(filename=os.path.dirname(os.path.realpath('__file__')) + '/simpler.jpg')
"""
Explanation: Introduction to the VAPr package for the aggregation and analysis of genomic variant annotations
Author: C. Mazzaferro, A. Mark, A. Birmingham, Kathleen Fisch
Conta... |
Scoppio/a-gazeta-de-geringontzan | TobParser.ipynb | mit | from collections import namedtuple
import sqlite3
DROP_ALL_TABLES = False
"""
Explanation: To read and parse the data from Track-o-Bot
End of explanation
"""
conn = sqlite3.connect('agazeta.db')
c = conn.cursor()
"""
Explanation: Dora R. is a great investigator, and she has access to a large database that she is ... |
lukasmerten/CRPropa3 | doc/pages/example_notebooks/galactic_lensing/lensing_liouville.v4.ipynb | gpl-3.0 | import crpropa
import matplotlib.pyplot as plt
import numpy as np
n = 10000000
# Simulation setup
sim = crpropa.ModuleList()
# We just need propagation in straight lines here to demonstrate the effect
sim.add(crpropa.SimplePropagation())
# collect arriving cosmic rays at Observer 19 kpc outside of the Galactic cente... |
RaoUmer/distarray | examples/gauss_elimination/ge_notebook.ipynb | bsd-3-clause | # utility imports
from __future__ import print_function
from pprint import pprint
from matplotlib import pyplot as plt
# main imports
import numpy as np
import distarray.globalapi as da
from distarray.plotting import plot_array_distribution
# output goodness
np.set_printoptions(precision=2)
# display figures inline
... |
ComputationalModeling/spring-2017-danielak | past-semesters/spring_2016/day-by-day/day09-random-walks/Random_Walks.ipynb | agpl-3.0 | # put your code for Part 1 here. Add extra cells as necessary!
"""
Explanation: Random Walks
In many situations, it is very useful to think of some sort of process that you wish to model as a succession of random steps. This can describe a wide variety of phenomena - the behavior of the stock market, models of po... |
tensorflow/docs-l10n | site/zh-cn/guide/graph_optimization.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... |
NorfolkDataSci/presentations | 2018-04_Stock_prediction/linear regression stock prediction project.ipynb | mit | import pandas as pd
import numpy as np
import datetime
import pandas_datareader.data as web
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import style
from sklearn import preprocessing
from sklearn import linear_model
import quandl, math
quandl.ApiConfig.api_key = "_1LjZZVx4HV... |
jpilgram/phys202-2015-work | assignments/assignment10/ODEsEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def lorentz_derivs(yvec, t, sigma, rho, beta):
"""Compute the the de... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.0 || pip install tensorflow==2.0
"""
Explanation: Introducing the Keras Functional API
Learning Objectives
1. Understand embeddings and how to create them with the feature column API
1. Understand Deep and Wide models and when ... |
sraejones/phys202-2015-work | assignments/assignment05/InteractEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
from math import pi
"""
Explanation: Interact Exercise 2
Imports
End of explanation
"""
def plot_sin1(a, b):
x = np.linspace(0, 4 * pi, 10... |
yingchi/fastai-notes | deeplearning1/nbs/lesson3_yingchi.ipynb | apache-2.0 | from theano.sandbox import cuda
from importlib import reload
import utils; reload(utils)
from utils import *
from __future__ import division, print_function
%matplotlib inline
path = 'data/dogscats/'
model_path = path + 'models/'
if not os.path.exists(model_path): os.mkdir(model_path)
batch_size=64
"""
Explanat... |
DSSatPitt/katz-python-workshop | jupyter-notebooks/Running Code.ipynb | cc0-1.0 | a = 10
print(a)
"""
Explanation: Running Code
First and foremost, the Jupyter Notebook is an interactive environment for writing and running code. The notebook is capable of running code in a wide range of languages. However, each notebook is associated with a single kernel. This notebook is associated with the IPyt... |
landlab/landlab | notebooks/tutorials/terrain_analysis/hack_calculator/hack_calculator.ipynb | mit | import copy
import numpy as np
import matplotlib as mpl
from landlab import RasterModelGrid, imshow_grid
from landlab.io import read_esri_ascii
from landlab.components import FlowAccumulator, HackCalculator
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png"><... |
rajeshb/SelfDrivingCar | T1P1-Finding-Lane-Lines/P1.ipynb | mit | # importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
# calculate running average for line coordinates
def running_average(avg, sample, n=12):
if (avg == 0):
return sample
avg -= avg / n;
avg += sample / n;... |
lukas/scikit-class | examples/notebooks/Lesson-2-Feature-Extraction.ipynb | gpl-2.0 | import pandas as pd
import numpy as np
df = pd.read_csv('../scikit/tweets.csv')
target = df['is_there_an_emotion_directed_at_a_brand_or_product']
text = df['tweet_text']
# We need to remove the empty rows from the text before we pass into CountVectorizer
fixed_text = text[pd.notnull(text)]
fixed_target = target[pd.no... |
zzsza/TIL | python/pyecharts.ipynb | mit | import pyecharts
import pandas as pd
import numpy as np
attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = pyecharts.Bar("... |
ianozsvald/example_conversion_of_excel_to_pandas | joining_two_sheets/Joining On a CSV and XLS File.ipynb | mit | import pandas as pd
# load both sheets as new dataframes
shows_df = pd.read_csv("show_category.csv")
views_df = pd.read_excel("views.xls")
"""
Explanation: Join two sheets, groupby and sum on the joined data
End of explanation
"""
shows_df.head()
shows_df = shows_df.set_index('showname')
shows_df.head()
"""
Expla... |
NII-cloud-operation/Jupyter-LC_docker | sample-notebooks/01_About NII Extensions - NII謹製の機能拡張について.ipynb | bsd-3-clause | ! echo "This is 1st step" > foo; cat foo
! echo ".. 2nd step..." >> foo && cat foo
!echooooo ".. 3rd step... will fail" >> foo && cat foo
"""
Explanation: Literate Computing for Reproducible Infrastructure
<img src="./images/literate_computing-logo.png" alt='LC_LOGO' align='left'/>
NII Cloud Operation is a team sup... |
jgarciab/wwd2017 | class1/class_1b_data_structures.ipynb | gpl-3.0 | ##Some code to run at the beginning of the file, to be able to show images in the notebook
##Don't worry about this cell
#Print the plots in this screen
%matplotlib inline
#Be able to plot images saved in the hard drive
from IPython.display import Image
#Make the notebook wider
from IPython.core.display import dis... |
4dsolutions/Python5 | Martian Math.ipynb | mit | from tetravolume import S3, Tetrahedron
from qrays import Qvector
print("S3:", S3)
"""
Explanation: Oregon Curriculum Network <br />
Discovering Math with Python
Martian Multiplication
<a data-flickr-embed="true" href="https://www.flickr.com/photos/kirbyurner/42107444461/in/dateposted-public/" title="5 x 2 = 10"... |
bearing/dosenet-analysis | Programming Lesson Modules/Module 6- Data Binning.ipynb | mit | %matplotlib inline
import csv
import io
import urllib.request
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
url = 'http://radwatch.berkeley.edu/sites/default/files/dosenet/etch_roof.csv'
response = urllib.request.urlopen(url)
reader = csv.reader(io.TextIOWrapper(respons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.