repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
ENCODE-DCC/pyencoded-tools | jupyter_notebooks/jennifer/plot_profiling.ipynb | mit | rc_url= 'https://v100rc2.demo.encodedcc.org/'
"""
Explanation: Enter the demo URL below
End of explanation
"""
%%capture --no-stderr --no-display output
prod_url="https://test.encodedcc.org"
qa = qancode.QANCODE(rc_url=rc_url, prod_url=prod_url)
num_trials = 50
item_types = [
"/search/?type=Experiment&biosample_... |
dsacademybr/PythonFundamentos | Cap03/Notebooks/DSA-Python-Cap03-01-If-Elif-Else.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 3</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Condi... |
opengeostat/pygslib | doc/source/Ipython_templates/declus_raw.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
#make the plots inline
%matplotlib inline
"""
Explanation: PyGSLIB
Declustering
This is how declustering works
End of explanation
"""
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file(... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/inm-cm5-h/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'inm-cm5-h', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: INM
Source ID: INM-CM5-H
Topic: Aerosol
Sub-Topics: Transport, Emissions, Concent... |
kpolimis/NFLCombineEvaluationNotebooks | plots.ipynb | bsd-3-clause | utils.plot_40dash()
"""
Explanation: Interactive NFL Player Performance Plots
The following bivariate plots examine the relationship between pre-draft combine measurables and NFL career yardage (rushing yards + receiving yards for RBs and WRs, passing yards for QBs) for players drafted between 1999-2008. Career yardag... |
Diyago/Machine-Learning-scripts | DEEP LEARNING/NLP/text analyses/NB-SVM strong linear baseline - classif.ipynb | apache-2.0 | import pandas as pd, numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')
subm = pd.read_csv('../input/sample_submission.csv')
"""
Explanation: Intr... |
Eomys/MoSQITo | tutorials/tuto_roughness_dw.ipynb | apache-2.0 | # Add MOSQITO to the Python path
import sys
sys.path.append('..')
# Import numpy
import numpy as np
# Import plot function
import matplotlib.pyplot as plt
# Import multiple spectrum computation tool
from scipy.signal import stft
# Import mosqito functions
from mosqito.utils import load
from mosqito.sq_metrics import r... |
tleonhardt/machine_learning | SL6_Kernel_Methods_and_SVMs.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import numbers
from sklearn.utils import check_array, check_random_state
from sklearn.utils import shuffle as shuffle_
def make_blobs(n_samples=100, n_features=2, centers=2, cluster_std=1.0,
center_box=(-10.0, 10.0), shuffle=True, ra... |
phoebe-project/phoebe2-docs | development/tutorials/requiv_crit_contact.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Critical Radii: Contact Systems
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import nu... |
phoebe-project/phoebe2-docs | development/examples/rossiter_mclaughlin.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Rossiter-McLaughlin Effect
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
import numpy as np
b = phoebe.default_bina... |
manumartin/examples | ml/mouse_recognition/model/FCN_Keras.ipynb | mit |
# Numbers
import numpy as np
# Keras
from keras.models import Sequential
from keras.layers.convolutional import Conv1D
from keras.layers.normalization import BatchNormalization
from keras.layers.advanced_activations import LeakyReLU
from keras.layers.pooling import GlobalAveragePooling1D
from keras.layers.core import... |
ML4DS/ML4all | R1.Intro_Regression/.ipynb_checkpoints/S2.2_DataPreparation-checkpoint.ipynb | mit | # INITIALIZATION
# To visualize plots in the notebook
%matplotlib inline
# Import some libraries that will be necessary for working with data and displaying plots
import numpy as np # For numerical computtions
import urllib # To load data from a url
# Sci-kit learn packages
from sklearn import datasets
from... |
pastephens/pysal | pysal/contrib/viz/mapping_guide.ipynb | bsd-3-clause | shp_link = ps.examples.get_path('columbus.shp')
shp = ps.open(shp_link)
some = [bool(rdm.getrandbits(1)) for i in ps.open(shp_link)]
fig = figure()
base = maps.map_poly_shp(shp)
base.set_facecolor('none')
base.set_linewidth(0.75)
base.set_edgecolor('0.8')
some = maps.map_poly_shp(shp, which=some)
some.set_alpha(0.5)
... |
UDST/activitysim | activitysim/examples/example_estimation/notebooks/16_nonmand_tour_scheduling.ipynb | bsd-3-clause | import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
"""
Explanation: Estimating Non-Mandatory Tour Scheduling
This notebook illustrates how to re-estimate the non-mandatory tour scheduling component for ActivitySim. This process
includes running ActivitySim in estimatio... |
GuillaumeDec/machine-learning | ai_newsweek/keras_autoencoder_ai_newsweek_conf.ipynb | gpl-3.0 | print("The answer should be three: " + str(1+2))
"""
Explanation: Trading Strategy for Finance using LSTMs
This lab was developed by Mike Imas, Onur Yilmaz Ph.D., and Andy Steinbach Ph.D.
1. Environment Verification
Before we begin, let's verify WebSockets are working on your system. To do this, execute the cell block... |
leoferres/prograUDD | labs/16_While_numeros_romanos.ipynb | mit | # suponemos que ponemos un año de verdad, por eso no pongo condiciones
año = int(input("Ingrese su año: "))
añooriginal = año
"""
Explanation: En este ejercicio ingresaremos un año y lo imprimiremos como numero romano.
End of explanation
"""
resultado = ""
while año != 0:
if año >= 1000:
veces = año // ... |
m2dsupsdlclass/lectures-labs | labs/03_neural_recsys/Short_Intro_to_Embeddings_with_Keras.ipynb | mit | import numpy as np
embedding_size = 4
vocab_size = 10
embedding_matrix = np.arange(embedding_size * vocab_size, dtype='float32')
embedding_matrix = embedding_matrix.reshape(vocab_size, embedding_size)
print(embedding_matrix)
"""
Explanation: Categorical Embeddings
We will use the embeddings through the whole lab. Th... |
jacksu/machine-learning | src/ml/kaggle/titanic/titanic.ipynb | mit | data_train.info()
"""
Explanation: 数据探索
上面数据是详细数据列表,一眼看不出来啥,先来看一下数据的大致情况。
End of explanation
"""
data_train.describe()
"""
Explanation: 从整体数据信息来看,总共包含891个顾客信息,总共有714个顾客有年龄信息,船舱信息缺失比较严重。
End of explanation
"""
#每个/多个 属性和最后的Survived之间有着什么样的关系
#中文乱码:http://blog.csdn.net/heloowird/article/details/46343519
import matp... |
mitchshack/data_analysis_with_python_and_pandas | 3 - NumPy Basics/3-2 NumPy Array Basics - Helpful Methods, Shortcuts, NaN Values, and Dtypes.ipynb | apache-2.0 | import sys
print(sys.version)
import numpy as np
print(np.__version__)
"""
Explanation: NumPy Array Basics - Helpful Methods and Shortcuts
End of explanation
"""
npa = np.arange(25)
npa
print(type(npa))
"""
Explanation: Now we’ve got our array and we’ve got a method or two that we can use to create them. Let’s le... |
phungkh/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
tensorflow/docs-l10n | site/ko/lattice/tutorials/canned_estimators.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... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_resample.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
#
# License: BSD (3-clause)
#
from __future__ import print_function
from matplotlib import pyplot as plt
import mne
from mne.datasets import sample
"""
Explanation: Resampling data
When performing experiments where timing is critical, a signal with a high
sampling... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160502월_1일차_분석 환경, 소개/17.데이터 분석의 소개.ipynb | mit | from sklearn.datasets import load_digits
digits = load_digits()
plt.imshow(digits.images[0], interpolation='nearest');
plt.grid(False)
digits.images[0]
from sklearn.datasets import fetch_20newsgroups
news = fetch_20newsgroups()
print(news.data[0])
from sklearn.feature_extraction.text import TfidfVectorizer
vec = Tfi... |
paolorivas/homeworkfoundations | homeworkdata/.ipynb_checkpoints/Homework_3_Paolo_Rivas_Legua-checkpoint.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html_str = urlopen("http://static.decontextualize.com/widgets2016.html").read()
document = BeautifulSoup(html_str, "html.parser")
"""
Explanation: Homework assignment #3
These problem sets focus on using the Beautiful Soup library to scrape web pages.
Pr... |
Kaggle/learntools | notebooks/computer_vision/raw/tut_tpus.ipynb | apache-2.0 | from petal_helper import *
import tensorflow as tf
"""
Explanation: Introduction
Welcome to the Petals to the Metal competition! In this competition, you’re challenged to build a machine learning model that identifies the type of flowers in a dataset of images.
In this tutorial notebook, you'll learn how to build an ... |
davidvartanian/dand-data-analysis-process | Investigate Data.ipynb | mit | # import libraries
import os
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display
%pylab inline
from bokeh.io import output_notebook, show
from bkcharts import Donut
output_notebook()
"""
Explanation: Introduction
In this analysis ... |
snegirigens/DLND | sentiment-network/Sentiment_Classification_Projects.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
CyberCRI/dataanalysis-herocoli-redmetrics | v1.52/Tests/4.2 User comparison tests graphs.ipynb | cc0-1.0 | %run "../Functions/4. User comparison.ipynb"
"""
Explanation: Table of Contents
Preparation
User data vectors
Graphs
Preparation
<a id=preparation />
End of explanation
"""
# small sample
#allData = getAllUserVectorData( getAllUsers()[:10] )
# complete set
#allData = getAllUserVectorData( getAllUsers() )
# subject... |
joshnsolomon/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
def random_line(m, b, sigma, size=10):
"""Create a line y = m*x + b + N(0,si... |
KECB/learn | BAMM.101x/sql_and_python.ipynb | mit | import pymysql
"""
Explanation: <h1>Python and MySQL</h1>
<h2>First import the python module containing the API</h2>
End of explanation
"""
db = pymysql.connect("localhost","root","None" ,database="schooldb")
cursor = db.cursor()
"""
Explanation: <h2>Set up a connection and create a cursor object</h2>
End of expl... |
root-mirror/training | NCPSchool2021/Examples/TMVA_CNN_Classification_py.ipynb | gpl-2.0 | import ROOT
from ROOT import TMVA
import os
ROOT.TMVA.Tools.Instance()
TMVA.PyMethodBase.PyInitialize()
## For PYMVA methods
TMVA.PyMethodBase.PyInitialize();
outputFile = ROOT.TFile.Open("CNN_ClassificationOutput.root", "RECREATE")
factory = ROOT.TMVA.Factory("TMVA_CNN_Classification", outputFile,
... |
statsmodels/statsmodels.github.io | v0.13.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.... |
pydata/xarray | doc/examples/apply_ufunc_vectorize_1d.ipynb | apache-2.0 | import xarray as xr
import numpy as np
xr.set_options(display_style="html") # fancy HTML repr
air = (
xr.tutorial.load_dataset("air_temperature")
.air.sortby("lat") # np.interp needs coordinate in ascending order
.isel(time=slice(4), lon=slice(3))
) # choose a small subset for convenience
air
"""
Expl... |
gVallverdu/cookbook | curve_fit.ipynb | gpl-2.0 | # manage data and fit
import pandas as pd
import numpy as np
# first part with least squares
from scipy.optimize import curve_fit
# second part about ODR
from scipy.odr import ODR, Model, Data, RealData
# style and notebook integration of the plots
import seaborn as sns
%matplotlib inline
sns.set(style="whitegrid")... |
paolorivas/homeworkfoundations | homeworkdata/.ipynb_checkpoints/Homework_4_Paolo_Rivas_Legua-checkpoint.ipynb | mit | numbers_str = '496,258,332,550,506,699,7,985,171,581,436,804,736,528,65,855,68,279,721,120'
"""
Explanation: Homework #4
These problem sets focus on list comprehensions, string operations and regular expressions.
Problem set #1: List slices and list comprehensions
Let's start with some data. The following cell contain... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a_eco/td2a_TD5_Traitement_automatique_des_langues_en_Python.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.eco - Traitement automatique de la langue en Python
Aperçu de ce qu'est le traitement automatique du langage naturel (NLP) et quelques exercices.
End of explanation
"""
import httplib2 # pip install httplib2
import json # déjà instal... |
ES-DOC/esdoc-jupyterhub | notebooks/fio-ronm/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'fio-ronm', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: FIO-RONM
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Tracers.
Pro... |
1x0r/pspis | lectures/lecture_04/demos-2.ipynb | mit | from sklearn.cluster import KMeans
"""
Explanation: Возьмем один из методов прошлой лекции для задачи классификации. Например, метод кластеризации $k$-средних.
End of explanation
"""
cls = KMeans(n_clusters=3, random_state=42)
"""
Explanation: Зададим предполагаемое количество кластеров равным количеству классу.
En... |
Charleo85/ml_project | resource/scribe/dataloader.ipynb | mit | import os
import pickle
import numpy as np
import xml.etree.ElementTree as ET
import random
from utils import *
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Scribe: Realistic Handwriting with TensorFlow
A deep learning project by Sam Greydanus. August 2016.
This iPython notebook simply explores... |
IIPBC/Material | parallel_atmo-geo/Download_remote_file.ipynb | mit | import urllib # import the module urllib
url = "https://nomads.ncdc.noaa.gov/data/gfs4/201702/20170201/" # Link of the directory with the files to download
outpath = "." # Define the directory where you want to store the data
"""
Explanation: Download file from website using urllib
In this notebook we present a simpl... |
feststelltaste/software-analytics | prototypes/GitHub Skizze Kursanalyse.ipynb | gpl-3.0 | import pandas as pd
csv_data = pd.read_csv("commits_of_all_repos.csv")
csv_data.head()
"""
Explanation: Idee
Anhand der Git-Commits der Studierenden wollen wir ansehen, ob diese eher frühzeitig Übungsaufgaben zum Kurs erledigen oder auf den letzten Drücker arbeiten.
Daten
In der CSV-Datei stecken alle Commits aller Gi... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/11. On the Importance of Errors (oh, and Operator Overloading).ipynb | mit | def net_force(mass, acceleration):
return mass * acceleration
"""
Explanation: On the Importance of Errors (oh, and Operator Overloading)
You may remember seeing the following code in the ‘Philosophy’ lectures we were talking about this function:
End of explanation
"""
# Function as above, but with DOCUMENTATION... |
bambinos/bambi | docs/notebooks/getting_started.ipynb | mit | import arviz as az
import bambi as bmb
import numpy as np
import pandas as pd
az.style.use("arviz-darkgrid")
"""
Explanation: Getting Started
Bambi requires a working Python interpreter (3.7+). We recommend installing Python and key numerical libraries using the Anaconda Distribution, which has one-click installers a... |
greg-ashby/deep-learning-nanodegree | intro-to-rnns/Anna_KaRNNa.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
dchandan/rebound | ipython_examples/Forces.ipynb | gpl-3.0 | import rebound
sim = rebound.Simulation()
sim.integrator = "whfast"
sim.add(m=1.)
sim.add(m=1e-6,a=1.)
sim.move_to_com() # Moves to the center of momentum frame
"""
Explanation: Additional forces
REBOUND is a gravitational N-body integrator. But you can also use it to integrate systems with additional, non-gravitatio... |
chbrandt/pynotes | moc/.ipynb_checkpoints/moc_notes-checkpoint.ipynb | gpl-2.0 | # Let's handle units
from astropy import units as u
# Structure to map healpix' levels to their angular sizes
#
healpix_levels = {
0 : 58.63 * u.deg,
1 : 29.32 * u.deg,
2 : 14.66 * u.deg,
3 : 7.329 * u.deg,
4 : 3.665 * u.deg,
5 : 1.832 * u.deg,
6 : 54.97 * u.arcmin,
7 : 27... |
Kunstenpunt/datakunstjes | functies_van_podiumkunstenaars/Functies van podiumkunstenaars.ipynb | apache-2.0 | import psycopg2
from configparser import ConfigParser
from pandas import DataFrame
from collections import Counter
"""
Explanation: Functies van podiumkunstenaars
Welke rollen nemen podiumkunstenaars op in hun producties? Een eerste blik op de rollen op basis van producties sinds 2010.
Eerst een aantal libraries om de... |
wobiskai/anomaly-detection-in-Bitcoin | Bitcoin Anomaly Analysis.ipynb | apache-2.0 | import numpy as np
import pandas as pd
column_names = ['txn_key', 'from_user', 'to_user', 'date', 'amount']
df = pd.read_csv('../data/bitcoin_uic_data_and_code_20130410/user_edges.txt', names=column_names)
df.head()
"""
Explanation: Load data
End of explanation
"""
df[ df.date < 20110000000000 ].to_csv('../data/su... |
cliburn/sta-663-2017 | notebook/Extras_01_The_Humble_For_Loop.ipynb | mit | n = 10
xs = []
for i in range(n):
xs.append(i**2)
xs
"""
Explanation: Bonus Material: The Humble For Loop
Much of numerical computing consists of populating an array of some sort. The general concept is looping, and there is a lot to discover about how to write loops in Python.
(1) Filling a list
Using a for loop
... |
phoebe-project/phoebe2-docs | development/tutorials/grav_redshift.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Gravitational Redshift (rv_grav)
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import n... |
ComputationalModeling/spring-2017-danielak | past-semesters/spring_2016/day-by-day/Example-Final-Project/example-final-data-analysis-project.ipynb | agpl-3.0 | import pandas
from pandas import read_csv
poverty_data = read_csv("povertydata.csv", header = 1)
poverty_data.head()
"""
Explanation: Introduction
In this notebook, I'm analyzing data to try to understand how many people in the U.S. live below the poverty line.
Data Source
Where I got my data
My data comes from the P... |
ITAM-DS/analisis-numerico-computo-cientifico | libro_optimizacion/temas/3.optimizacion_convexa/3.3/Ejemplos_problemas_UCO_e_intro_CIEO_y_PI.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import pprint
np.set_printoptions(precision=2, suppress=True)
np.random.seed(1989) #for reproducibility
mpoints = 20
x = np.random.randn(mpoints)
y = -3*x + np.random.normal(2,1,mpoints)
"""
Explanation: (EJUCOINTCIECOPI)=
3.3 Ejemplos de problemas UCO, introducci... |
mbeyeler/opencv-machine-learning | notebooks/03.05-Classifying-Iris-Species-Using-Logistic-Regression.ipynb | mit | import numpy as np
import cv2
from sklearn import datasets
from sklearn import model_selection
from sklearn import metrics
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
"""
Explanation: <!--BOOK_INFORMATION-->
<a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-... |
queirozfcom/python-sandbox | python3/notebooks/number-formatting-post/.ipynb_checkpoints/main-checkpoint.ipynb | mit | '{:.2f}'.format(8.499)
"""
Explanation: View the original blog post at http://queirozf.com/entries/python-number-formatting-examples
round to 2 decimal places
End of explanation
"""
'{:.2f}%'.format(10.12345)
"""
Explanation: format float as percentage
End of explanation
"""
import re
def truncate(num,decimal_pl... |
PedramNavid/MachineLearningNanodegree | 4_Boston_Housing/boston_housing.ipynb | gpl-3.0 | # Import libraries necessary for this project
import numpy as np
import pandas as pd
import visuals as vs # Supplementary code
from sklearn.cross_validation import ShuffleSplit
# Pretty display for notebooks
%matplotlib inline
# Load the Boston housing dataset
data = pd.read_csv('housing.csv')
prices = data['MEDV']
f... |
pybel/pybel-notebooks | summary/Summarizing Subgraph Contents.ipynb | apache-2.0 | import os
import sys
import time
import pandas as pd
import pybel
from pybel.constants import VERSION as PYBEL_VERSION
from pybel_tools import selection
from pybel_tools.summary import info_json, info_list
from pybel_tools.mutation import infer_central_dogma
print(sys.version)
print(time.asctime())
print(PYBEL_VER... |
tuanavu/coursera-university-of-washington | machine_learning/3_classification/assigment/week5/module-8-boosting-assignment-1-graphlab.ipynb | mit | import graphlab
"""
Explanation: Exploring Ensemble Methods
In this assignment, we will explore the use of boosting. We will use the pre-implemented gradient boosted trees in GraphLab Create. You will:
Use SFrames to do some feature engineering.
Train a boosted ensemble of decision-trees (gradient boosted trees) on t... |
simpleblob/ml_algorithms_stepbystep | algo_example_NN_multilayer_CNN_libraries.ipynb | mit | import pandas as pd
import numpy as np
from random import randint
from pandas import Series,DataFrame
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
import math
import time
%matplotlib inline
plt.rcParams['figure.figsize'] = (8, 6)
plt.rcParams['font.size'] = 14
def unpickle(file):
import ... |
cecileane/computingtools | assets/python/swcarpentry2.ipynb | mit | import glob
glob.glob("inflammation-??.csv")
filenames = glob.glob('inflammation*.csv')
for f in filenames:
data = numpy.loadtxt(fname=f, delimiter=',')
print("file",f[13:15],
", # rows and columns: ", data.shape, sep="")
import numpy
import matplotlib.pyplot
filenames = sorted(glob.glob('inflamma... |
datactive/bigbang | examples/word_analysis/SpecialWordsAnalysis.ipynb | mit | from bigbang.archive import Archive
from bigbang.archive import load as load_archive
import bigbang.parse as parse
import bigbang.graph as graph
import bigbang.mailman as mailman
import bigbang.process as process
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
from pprint import pprint as pp
i... |
B4cchus/wh40k-hitscalc | Mathammer-Truncation.ipynb | gpl-3.0 | profiles[0] = {'shots': 8, 'p_hit': 1 / 3 + 1 / 6 * 1 / 3, 'p_wound': 2 / 3, 'damage': 'd6'}
targets[0] = {'model': 6, 'total': 6, 'save': 1 / 3}
wound_chart(profiles, targets)
"""
Explanation: Visual mathhammer for 8th edition
The problem of averages
A common way to figure odds in Warhammer is by using the expectatio... |
SylvainCorlay/bqplot | examples/Marks/Object Model/HeatMap.ipynb | apache-2.0 | import numpy as np
from bqplot import (Figure, LinearScale,ColorScale,
Color, Axis, HeatMap, ColorAxis)
from ipywidgets import Layout
"""
Explanation: Heatmap
The HeatMap mark represents a 2d matrix of values as a color image. It can be used to visualize a 2d function, or a grayscale image for ins... |
ml4a/ml4a-guides | examples/tools/canvas.ipynb | gpl-2.0 | img1 = image.load_image('https://upload.wikimedia.org/wikipedia/commons/6/6a/Mona_Lisa.jpg', (220, 350))
img2 = canvas.modify_canvas(img1, {'rot_const': 0.2})
img3 = image.concatenate_images([img1, img2], margin=2)
image.display(img3)
"""
Explanation: Modifying an image
Basic example, rotates the image (rot_const) by ... |
awsteiner/o2sclpy | doc/static/examples/DSH.ipynb | gpl-3.0 | import o2sclpy
import matplotlib.pyplot as plot
import numpy
import sys
plots=True
if 'pytest' in sys.modules:
plots=False
"""
Explanation: DSH example for O$_2$sclpy
See the O$_2$sclpy documentation at
https://neutronstars.utk.edu/code/o2sclpy for more information.
End of explanation
"""
link=o2sclpy.linker()
... |
Benedicto/ML-Learning | Classifier_2_logistic_regression.ipynb | gpl-3.0 | import graphlab
import numpy as np
"""
Explanation: Implementing logistic regression from scratch
The goal of this notebook is to implement your own logistic regression classifier. You will:
Extract features from Amazon product reviews.
Convert an SFrame into a NumPy array.
Implement the link function for logistic r... |
fabiansinz/pipeline | jupyter/tutorial/pipeline_preprocess.ipynb | lgpl-3.0 | %pylab inline
pylab.rcParams['figure.figsize'] = (6, 6)
"""
Explanation: Previous: pipeline_vis ::: Next Synchronization
Schema preprocess
End of explanation
"""
import datajoint as dj
from pipeline.preprocess import *
"""
Explanation: The preprocess schema extracts, aligns, and synchronizes multiphoton trace dat... |
ContinuumIO/pydata-apps | Section_1_blaze.ipynb | mit | import pandas as pd
df = pd.read_csv('iris.csv')
df.head()
df.groupby(df.Species).PetalLength.mean() # Average petal length per species
"""
Explanation: <img src="images/continuum_analytics_logo.png"
alt="Continuum Logo",
align="right",
... |
InsightSoftwareConsortium/SimpleITK-Notebooks | Python/30_Segmentation_Region_Growing.ipynb | apache-2.0 | # To use interactive plots (mouse clicks, zooming, panning) we use the notebook back end. We want our graphs
# to be embedded in the notebook, inline mode, this combination is defined by the magic "%matplotlib notebook".
%matplotlib notebook
import SimpleITK as sitk
%run update_path_to_download_script
from downloadda... |
bpgc-cte/python2017 | Week 1/Lecture_1_Intro to Programming.ipynb | mit | a=1
b=3.14
# Assigning value 1 to variable a and 3.14 to variable b
"""
Explanation: Lecture 1: Introduction to Programming
Agenda for the Class:
Python in-built datatypes
Basic mathematical operators and Precedence order
Python Interpreter vs Python for Scripting
Firstly we'll focus on the datatypes.
1. Numeric
2. ... |
deculler/TableDemos | BerkeleySalary.ipynb | bsd-2-clause | # This useful nonsense just goes at the top
from datascience import *
import numpy as np
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
%matplotlib inline
# datascience version number of last run of this notebook
version.__version__
"""
Explanation: Illustration of datascience Tables on Open Data... |
mne-tools/mne-tools.github.io | dev/_downloads/f09e8bdde655732da390ecff38594068/muscle_ica.ipynb | bsd-3-clause | # Authors: Alex Rockhill <aprockhill@mailbox.org>
#
# License: BSD-3-Clause
import os.path as op
import mne
data_path = mne.datasets.sample.data_path()
raw_fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(raw_fname)
raw.crop(tmin=100, tmax=130) # take 30 seconds for spee... |
mdeff/ntds_2016 | algorithms/05_ass_convnet.ipynb | mit | # Import libraries
import numpy as np
import tensorflow as tf
import time
import collections
import os
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set d... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/text_classification/solutions/automl_for_text_classification.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: AutoML for Text Classification
Learning Objectives
Learn how to create a text classification dataset for AutoML using BigQuery
Learn how to train AutoML to build a text classification model
Learn how to ... |
Upward-Spiral-Science/team1 | code/test_assumptions.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import urllib2
import sklearn.mixture as mixture
import sklearn.preprocessing as preprocess
%matplotlib inline
np.random.seed(1)
url = ('https://raw.githubusercontent.com/Upward-Spiral-Science'
'/data/master/syn-density/output.csv')
data = urllib2.urlopen(url)... |
NREL/bifacial_radiance | docs/tutorials/4 - Medium Level Example - Debugging your Scene with Custom Objects (Fixed Tilt 2-up with Torque Tube + CLEAN Routine + CustomObject).ipynb | bsd-3-clause | import os
from pathlib import Path
testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_04'
# Another option using relative address; for some operative systems you might need '/' instead of '\'
# testfolder = os.path.abspath(r'..\..\bifacial_radiance\TEMP')
print ("Your simulation... |
metabolite-atlas/metatlas | notebooks/old/Workflow Notebook Metatlas 20200416.ipynb | bsd-3-clause | # optional: run this block to adjust the width of the notebook. Change the width percent.
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
"""
Explanation: Instructions
MetAltas analysis workflow
Run through with your initial atlas
Use the RT a... |
shikhar413/openmc | examples/jupyter/capi.ipynb | mit | %matplotlib inline
import openmc
import openmc.lib
"""
Explanation: Using the C/C++ API
This notebook shows how to use the OpenMC C/C++ API through the openmc.lib module. This module is particularly useful for multiphysics coupling because it allows you to update the density of materials and the temperatures of cells ... |
shogun-toolbox/shogun | doc/ipython-notebooks/regression/Regression.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from cycler import cycler
# import all shogun classes
import shogun as sg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
slope = 3
X_train = np.random.rand(30)*10
y_train = slope*(X_train)+np.random.randn(... |
mne-tools/mne-tools.github.io | 0.17/_downloads/0d18b25bb9787426fc4d02b53e22d813/plot_object_source_estimate.ipynb | bsd-3-clause | import os
from mne import read_source_estimate
from mne.datasets import sample
print(__doc__)
# Paths to example data
sample_dir_raw = sample.data_path()
sample_dir = os.path.join(sample_dir_raw, 'MEG', 'sample')
subjects_dir = os.path.join(sample_dir_raw, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_au... |
wikistat/Ateliers-Big-Data | Cdiscount/Part1-3-AIF-PythonScikitLearn-Prediction-Cdiscount.ipynb | mit | #Importation des librairies utilisées
import time
import numpy as np
import pandas as pd
import scipy as sc
import pickle
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import GridSear... |
samgoodgame/sf_crime | error_analysis.ipynb | mit | # Additional Libraries
%matplotlib inline
import matplotlib.pyplot as plt
# 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... |
NervanaSystems/neon_course | 09b Sentiment Analysis with LSTM (inference).ipynb | apache-2.0 | from neon.backends import gen_backend
be = gen_backend(backend='gpu', batch_size=1)
print be
"""
Explanation: Sentiment Analysis of Movie Reviews
In this tutorial, we will load a trained model and perform inference on a new movie review.
Setup
As before, we first create a computational backend to tell neon on what de... |
UWSEDS/LectureNotes | week_3/Functions.ipynb | bsd-2-clause | # Our prime number example from week 1
N = 10
for candidate in range(2, N):
# n is candidate prime. Check if n is prime
is_prime = True
for m in range(2, candidate):
if (candidate % m) == 0:
is_prime = False
break
if is_prime:
print("%d is prime!" % candidate)
""... |
h-mayorquin/time_series_basic | presentations/2016-02-17(Prediction using normal score for Wall Street Columns).ipynb | bsd-3-clause | import numpy as np
from sklearn import svm, cross_validation
import h5py
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import sys
sys.path.append("../")
"""
Explanation: Prediction using normal score for Wall Street Columns
In this notebook we extract we compare how the good are the featur... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session08/Day3/miniBrokerSolutions.ipynb | mit | # remove display of install details
%%capture --no-display
!pip install ipyparallel
import subprocess
subprocess.Popen(['ipcluster', 'start', '-n', '4'])
# authorize Google to access Google drive files
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.c... |
sybenzvi/3ML | examples/090217206.ipynb | bsd-3-clause | import matplotlib
%matplotlib inline
"""
Explanation: <center><img src="http://identity.stanford.edu/overview/images/emblems/SU_BlockStree_2color.png" width="200" style="display: inline-block"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/Main_fermi_logo_HI.jpg/682px-Main_fermi_logo_HI.jpg" width... |
Brett777/Predict-Churn | Customer Churn Modeling.ipynb | mit | %%capture
# Get our favorite packages from PyPI
! pip install cufflinks
# Import pre-installed packages
import numpy as np
import pandas as pd
# Suppress unwatned warnings
import warnings
warnings.filterwarnings('ignore')
import logging
logging.getLogger("requests").setLevel(logging.WARNING)
# Load our favorite vis... |
dennybritz/reinforcement-learning | DP/Gamblers Problem Solution.ipynb | mit | import numpy as np
import sys
import matplotlib.pyplot as plt
if "../" not in sys.path:
sys.path.append("../")
"""
Explanation: This is Example 4.3. Gambler’s Problem from Sutton's book.
A gambler has the opportunity to make bets on the outcomes of a sequence of coin flips.
If the coin comes up heads, he wins as m... |
AssembleSoftware/IoTPy | examples/SlidingWindows.ipynb | bsd-3-clause | import os
import sys
sys.path.append("../")
from IoTPy.core.stream import Stream, run
from IoTPy.agent_types.op import map_window
from IoTPy.helper_functions.recent_values import recent_values
def example():
x, y = Stream(), Stream()
map_window(func=sum, in_stream=x, out_stream=y, window_size=2, step_size=3)... |
tensorflow/docs-l10n | site/en-snapshot/lattice/tutorials/shape_constraints_for_ethics.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... |
mne-tools/mne-tools.github.io | 0.22/_downloads/ee17e3e8df43ce4f0119faeeeccc374f/plot_sensors_time_frequency.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
# Richard Höchenberger <richard.hoechenberger@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequenc... |
espenhgn/LFPy | doc/LFPy-logo.ipynb | gpl-3.0 | import LFPy
import numpy as np
import os
import sys
from urllib.request import urlopen
import ssl
import zipfile
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from os.path import join
"""
Explanation: Example plot for LFPy: Single-synapse contribution to the LFP
Copyright (C) 2017 C... |
NlGG/MCMC | IMH.ipynb | mit | %matplotlib inline
import numpy as np
import math
import matplotlib.pyplot as plt
"""
Explanation: メトロポリスヘイスティングスアルゴリズム
<P>1 初期値$μ^{(0)}$を決め、t=1とおく。</p>
<p>2 現在μ^(t-1)であるとき、次の点μ^tの候補μ'をμ'~N(x_bar, 1/n)により発生させて、$$ α(μ^{(t-1)}, μ'|x) = min \{ 1, \frac{π(μ')}{π(μ^{(t-1)})}\}$$とおく。</p>
<p>3 (0, 1)上の一様乱数uを発生させて、$$μ^{(t)}=... |
AllenDowney/ModSim | python/soln/examples/insulin_soln.ipynb | gpl-2.0 | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename):
from urllib.request import urlretrieve
local, _ = urlretrieve... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/cmip6/models/access-1-0/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csiro-bom', 'access-1-0', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: ACCESS-1-0
Topic: Ocean
Sub-Topics: Timestepping Framewor... |
velezj/ml-chats | time_series/notebooks/TimeSeries_Note0.ipynb | apache-2.0 | ## Setup the path for our codebase
import sys
sys.path.append( '../code/' )
## import our time_series codebase
import time_series.generated_datasets
import time_series.result_set
import time_series.algorithm
dataset_0 = time_series.generated_datasets.DSS[0]( 10 )
dataset_0.taxonomy
%matplotlib inline
import matplot... |
dtamayo/rebound | ipython_examples/EccentricComets.ipynb | gpl-3.0 | import rebound
import numpy as np
"""
Explanation: Integrating eccentric Comets with MERCURIUS
In this example, we study highly eccentric comets which interact with a Neptune mass planet.
MERCURIUS ia a hybrid integration scheme which combines the WHFAST and IAS15 algorithms. It smoothly transitions between the two in... |
NREL/bifacial_radiance | docs/tutorials/Webinar_Slides.ipynb | bsd-3-clause | import os
testfolder = os.path.abspath(r'..\..\bifacial_radiance\TEMP\Demo1')
print ("Your simulation will be stored in %s" % testfolder)
"""
Explanation: 1 - Introductory Example: Fixed-Tilt simple setup
This jupyter journal will walk us through the creation of the most basic fixed-tilt simulation possible with b... |
sastels/Onboarding | 2 - Strings.ipynb | mit | s = 'hi'
print s[1]
print len(s)
print s + ' there'
"""
Explanation: Python Strings
Python has a built-in string class named "str" with many handy features (there is an older module named "string" which you should not use). String literals can be enclosed by either double or single quotes, although single quotes ar... |
amcdawes/QMlabs | Chapter 13 - Hydrogen.ipynb | mit | from sympy.physics.hydrogen import R_nl
from sympy.functions.special.spherical_harmonics import Ynm
from sympy import *
"""
Explanation: Chapter 13 - Hydrogen functions
Start with some imports fro Symbolic Python library:
End of explanation
"""
var("r theta phi t w1 w2")
"""
Explanation: Define some variables, radi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.