repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
SteveDiamond/cvxpy | examples/notebooks/WWW/water_filling_BVex5.2.ipynb | gpl-3.0 | #!/usr/bin/env python3
# @author: R. Gowers, S. Al-Izzi, T. Pollington, R. Hill & K. Briggs
import numpy as np
import cvxpy as cp
def water_filling(n, a, sum_x=1):
'''
Boyd and Vandenberghe, Convex Optimization, example 5.2 page 145
Water-filling.
This problem arises in information theory, in alloca... |
tensorflow/docs-l10n | site/ja/hub/tutorials/spice.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 ... |
rishuatgithub/MLPy | nlp/UPDATED_NLP_COURSE/01-NLP-Python-Basics/00-Spacy-Basics.ipynb | apache-2.0 | # Import spaCy and load the language library
import spacy
nlp = spacy.load('en_core_web_sm')
# Create a Doc object
doc = nlp(u'Tesla is looking at buying U.S. startup for $6 million')
# Print each token separately
for token in doc:
print(token.text, token.pos_, token.dep_)
"""
Explanation: <a href='http://www.pi... |
lknelson/text-analysis-2017 | 04-Dictionaries/00.1-DictionaryMethod_AdditionalExercises_Solutions.ipynb | bsd-3-clause | import pandas as pd
import nltk
import string
import matplotlib.pyplot as plt
#read in our data
df = pd.read_csv("../Data/childrens_lit.csv.bz2", sep = '\t', encoding = 'utf-8', compression = 'bz2', index_col=0)
df = df.dropna(subset=["text"])
df
"""
Explanation: Additional Exercises for 02.27: Dictionary Method
Ex.... |
qinwf-nuan/keras-js | notebooks/layers/embedding/Embedding.ipynb | mit | input_dim = 5
output_dim = 3
input_length = 7
data_in_shape = (input_length,)
emb = Embedding(input_dim, output_dim, input_length=input_length, mask_zero=False)
layer_0 = Input(shape=data_in_shape)
layer_1 = emb(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibil... |
tclaudioe/Scientific-Computing | SC1v2/Bonus - 11 - BVP linear and nonlinear with Finite Difference and the Shooting Method.ipynb | bsd-3-clause | import numpy as np
import scipy as sp
# To solve IVP, notice this is different that odeint!
from scipy.integrate import solve_ivp
# To integrate use one of the followings:
from scipy.integrate import quad, quadrature, trapezoid, simpson
# For least-square problems
from scipy.sparse.linalg import lsqr
from scipy.linalg ... |
mreid-moz/jupyter-spark | examples/Jupyter Spark example.ipynb | mpl-2.0 | import sys
from random import random
from operator import add
from pyspark.sql import SparkSession
"""
Explanation: Example jupyter_spark notebook
This is an example notebook to demonstrate the jupyter_spark notebook plugin.
It is based on the approximating pi example in the pyspark documentation. This works by samp... |
jonathf/chaospy | docs/user_guide/main_usage/monte_carlo_integration.ipynb | mit | from problem_formulation import joint
joint
"""
Explanation: Monte Carlo integration
Monte Carlo is the simplest of all collocation methods.
It consist of the following steps:
Generate (pseudo-)random samples $Q_1, ..., Q_N$.
Evaluate model solver $U_1=u(Q_1), ..., U_N=u(Q_N)$ for each sample.
Use empirical metrics ... |
kellyrowland/openmc | docs/source/pythonapi/examples/mgxs-part-i.ipynb | mit | from IPython.display import Image
Image(filename='images/mgxs.png', width=350)
"""
Explanation: This IPython Notebook introduces the use of the openmc.mgxs module to calculate multi-group cross sections for an infinite homogeneous medium. In particular, this Notebook introduces the the following features:
General equ... |
sanjanedic/SBARepay | SBARepayEDA.ipynb | mit | # Import necessary Python packages
# Data analysis tools
import numpy as np
import pandas as pd
import datetime
from dateutil.relativedelta import relativedelta
# Plotting tools and figure display options
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import graphviz
sns.set(context = 'pos... |
JrtPec/opengrid | notebooks/Demo/Demo_Units_and_Conversions.ipynb | apache-2.0 | import pandas as pd
import charts
from opengrid.library import misc, houseprint
"""
Explanation: This demo notebook shows how units are treated and how to apply unit conversions
Opengrid makes use of the python library pint for unit conversions
End of explanation
"""
hp = houseprint.Houseprint()
sensors = hp.search... |
terrydolan/lfc | lfc.ipynb | mit | %%html
<! left align the change log table in next cell >
<style>
table {float:left}
</style>
"""
Explanation: LFC Data Analysis: From Rafa to Rodgers
Lies, Damn Lies and Statistics
See Terry's blog LFC: From Rafa To Rodgers for a discussion of of the data generated by this analysis.
This notebook analyses Liverpool FC... |
jameshensman/pymc3 | pymc3/examples/GLM-linear.ipynb | apache-2.0 | %matplotlib inline
from pymc3 import *
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: The Inference Button: Bayesian GLMs made easy with PyMC3
Author: Thomas Wiecki
This tutorial appeared as a post in a small series on Bayesian GLMs on my blog:
The Inference Button: Bayesian GLMs made easy wit... |
csaladenes/csaladenes.github.io | test/eis-metadata-validation/Planon metadata validation4.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: EIS metadata validation script
Used to validate Planon output with spreadsheet input
1. Data import
End of explanation
"""
planon=pd.read_excel('EIS Assets.xlsx',index_col = 'Code')
master_loggerscontrollers = ... |
lexieheinle/jour407homework | USstatesNaturalBeauty/natural-amenities-analysis.ipynb | mit | import agate
"""
Explanation: Import agate, the very neat data program
End of explanation
"""
text = agate.Text()
tester = agate.TypeTester(force={
'FIPS': text,
'CombinedFIPS': text,
})
natural = agate.Table.from_csv('naturalamenities.csv', column_types=tester)
"""
Explanation: Import in the natural ameni... |
cosmolejo/Fisica-Experimental-3 | Calculo_Error/.ipynb_checkpoints/tstudent_v2-checkpoint.ipynb | gpl-3.0 | Ima = misc.imread('speckle.png')
Ima = Ima[:,:,0] # la imagen importada tenía 4 "canales" pero solo nos interesa uno
plt.rcParams['figure.figsize'] = 20, 6 # para modificar el tamaño de la figura
plt.figure(1)
plt.imshow(Ima, cmap='gray')
plt.colorbar()
mediaS = np.mean(Ima) # Comando directo de python
devstdS = np.st... |
mediagestalt/Collocation | Collocation.ipynb | mit | # This is where the modules are imported
import csv
import sys
import codecs
import nltk
import nltk.collocations
import collections
import statistics
from nltk.metrics.spearman import *
from nltk.collocations import *
from nltk.stem import WordNetLemmatizer
from os import listdir
from os.path import splitext
from os.p... |
microsoft/dowhy | docs/source/example_notebooks/identifying_effects_using_id_algorithm.ipynb | mit | from dowhy import CausalModel
import pandas as pd
import numpy as np
from IPython.display import Image, display
"""
Explanation: Identifying Effect using ID Algorithm
This is a tutorial notebook for using the ID Algorithm in the causal identification step of causal inference.
Link to paper: https://ftp.cs.ucla.edu/pu... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_evoked_whitening.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.datasets import sample
from mne.cov import compute_covariance
print(__doc__)
"""
Explanation: Whitening evoked data with ... |
kcyu1993/ML_course_kyu | labs/ex02/template/ex02.ipynb | mit | import datetime
from helpers import *
height, weight, gender = load_data(sub_sample=False, add_outlier=False)
x, mean_x, std_x = standardize(height)
y, tx = build_model_data(x, weight)
y.shape, tx.shape
print(tx)
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
ax1.scatter(height,weight, marker=".", color='b', s=5)
"... |
thehyve/transmart-api-training | transmart-rest-api-py-client.ipynb | gpl-3.0 | import getpass
from transmart_api import TransmartApi
api = TransmartApi(
host = 'http://localhost:8080',
user = raw_input('Username:'),
password = getpass.getpass('Password:'))
api.access()
"""
Explanation: <img style="float: right;" src="files/thehyve_logo.png">
Examples of interaction with TranSMART R... |
zedyang/oaForex | notes.ipynb | mit | from api import*
myConfig = Config()
myConfig.view()
"""
Explanation: Introduction To OANDA-System
Environment:
Python-Anaconda 2.7
pandas, json, requests
Config Class
Contains infomations that we need to connect to OANDA server and make requests.
End of explanation
"""
q1 = EventQueue()
q2 = EventQueue()
q = {... |
myselfHimanshu/UdacityDSWork | Machine Learning Nanodegree/Building a Student Intervention System/student_intervention.ipynb | gpl-2.0 | # Import libraries
import numpy as np
import pandas as pd
# Read student data
student_data = pd.read_csv("student-data.csv")
print "Student data read successfully!"
# Note: The last column 'passed' is the target/label, all other are feature columns
#student_data.head()
"""
Explanation: Project 2: Supervised Learning
... |
datapolitan/lede_algorithms | class6_1/.ipynb_checkpoints/cluster_crime-checkpoint.ipynb | gpl-2.0 | data = list(csv.DictReader(open('data/columbia_crime.csv', 'r').readlines()))
# This part just splits out the latitude and longitude coordinate fields for each incident, which we need for mapping.
coords = [(float(d['lat']), float(d['lng'])) for d in data if len(d['lat']) > 0]
print coords[:10]
# And this creates a m... |
diging/methods | 1.3. Feature selection/1.3.2 Features in Texts - N-grams.ipynb | gpl-3.0 | documents.words()[:7]
"""
Explanation: 1.3.2 Features in texts: N-grams
In earlier notebooks, we treated individual tokens as separate and independent features in our texts. But words are rarely independent. First of all, they are often part of more complex phrases that refer to abstract concepts. In the context of co... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session07/Day1/Code testing and CI.ipynb | mit | !conda install pytest pytest-cov
"""
Explanation: Code Testing and CI
The notebook contains problems about code testing and continuous integration with Travis CI.
Original by E Tollerud 2017 for LSSTC DSFP Session3 and AstroHackWeek, modified by B Sipocz
Problem 1: Set up py.test in you repo
In this problem we'll aim... |
galozano/FlightPrediction | MainCodeDoc.ipynb | apache-2.0 | import pandas as pd
import statsmodels.api as sm
from sklearn.cross_validation import train_test_split
import math
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: FLIGHT TRUST
Summary
Simple python script that runs a regression to predict actual flight time and probability of delay of airlines by r... |
mjames-upc/python-awips | examples/notebooks/Model_Sounding_Data.ipynb | bsd-3-clause | from awips.dataaccess import DataAccessLayer
import matplotlib.tri as mtri
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from math import exp, log
import numpy as np
from metpy.calc import get_wind_components, lcl, dry_lapse, parcel_profile, dewpoint
from metpy.calc import... |
mne-tools/mne-tools.github.io | stable/_downloads/c4c1adf6983ad491e45e3941a0c10d6e/time_frequency_mixed_norm_inverse.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
#
# License: BSD-3-Clause
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
from mne.inverse_sparse import tf_mixed_nor... |
ameliecordier/iutdoua-info_algo2015 | 2015-10-19 - TD9 - Les chaînes de caractères.ipynb | cc0-1.0 | txt1 = "Ceci est un texte"
txt2 = 'ceci est un autre texte'
print("A" < txt1)
print("B" < txt2)
print("A" >"a")
print("Z" < "a" and "z" < "é")
print(txt1 + txt2)
print(len(txt1))
print(len(txt2))
print(txt1[2])
"""
Explanation: Quelques rappels sur les chaînes de caractères
Les chaînes de caractères s'écrivent entre... |
karlstroetmann/Artificial-Intelligence | Python/3 Games/Game.ipynb | gpl-2.0 | gCache = {}
"""
Explanation: Utilities
The global variable gCache is used as a cache for the function evaluate defined later. Instead of just storing the values for a given State, the cache stores pairs of the form
* ('=', v),
* ('≤', v), or
* ('≥', v).
The first component of these pairs is a flag that specifies wh... |
jrmontag/Data-Science-45min-Intros | time-series/03 - Seasonal-Trend Decomposition.ipynb | unlicense | import pandas as pd
import numpy as np
import scipy as sp
import statsmodels.api as sm
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib.rc('figure', figsize=(10,8))
"""
Explanation: Time Series Modeling, Pt. 3: Seasonal-Trend Decomposition
2017-{07..08}, Josh Montague
This is Part 3 of ... |
gcallah/Indra | notebooks/IntroToABM.ipynb | gpl-3.0 | from IPython.display import HTML
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/pCpLWbHVNhk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>')
"""
Explanation: Agent-Based Modeling
What Is It? What's It For?
This is a... |
NYUDataBootcamp/Materials | Code/notebooks/bootcamp_graphics_s17_UG.ipynb | mit | # make plots show up in notebook
%matplotlib inline
import pandas as pd # data package
import matplotlib.pyplot as plt # pyplot module
"""
Explanation: Python graphics: Matplotlib fundamentals
We illustrate three approaches to graphing data with Python's Matplotlib pack... |
probml/pyprobml | deprecated/gp_deep_kernel_learning.ipynb | mit | try:
import tinygp
except ImportError:
!pip install -q tinygp
try:
import flax
except ImportError:
!pip install -q flax
try:
import optax
except ImportError:
!pip install -q optax
from jax.config import config
config.update("jax_enable_x64", True)
"""
Explanation: <a href="https://colab.res... |
tensorflow/docs-l10n | site/ja/neural_structured_learning/tutorials/graph_keras_mlp_cora.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 u... |
Brett777/Predict-Churn | CustomerChurnwithAutoML.ipynb | mit | !pip freeze
%%capture
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('model_management')
from model_management.sklearn_model import SklearnModel
import numpy as np
import pandas as pd
import h2o
from h2o.automl import H2OAutoML
from __future__ import print_function
import pandas_profiling
# Suppress... |
m2dsupsdlclass/lectures-labs | labs/01_keras/Demo_RetinaNet.ipynb | mit | %pip install -q keras-retinanet
"""
Explanation: Object Detection using RetinaNet
RetinaNet is a neural network architecture for object detection described in Focal Loss for Dense Object Detection by Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He and Piotr Dollár.
The following shows how to use a Keras based imp... |
NathanYee/ThinkBayes2 | code/report03.ipynb | gpl-2.0 | from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import math
import numpy as np
from thinkbayes2 import Pmf, Cdf, Suite, Joint
import thinkplot
"""
Explanation: Report03 - Nathan Yee
This notebook contains report03 for computational baysian statis... |
achave11/bioapi-examples | python_notebooks/1kg_metadata_service.ipynb | apache-2.0 | import ga4gh_client.client as client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
"""
Explanation: GA4GH 1000 Genomes Metadata Service
This example illustrates how to access the available datasets in a GA4GH server.
Initialize client
In this step we create a client object which will be used to communicate with... |
turi-code/tutorials | strata-sj-2016/ml-in-production/deploy-dress-recommender.ipynb | apache-2.0 | if os.path.exists('dress_sf_processed.sf'):
reference_sf = graphlab.SFrame('dress_sf_processed.sf')
else:
reference_sf = graphlab.SFrame('https://static.turi.com/datasets/dress_sf_processed.sf')
reference_sf.save('dress_sf_processed.sf')
if os.path.exists('dress_nn_model'):
nn_model = graphlab.load_mod... |
sorig/shogun | doc/ipython-notebooks/converter/Tapkee.ipynb | bsd-3-clause | import numpy
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
def generate_data(curve_type, num_points=1000):
if curve_type=='swissroll':
tt = numpy.array((3*numpy.pi/2)*(1+2*numpy.random.rand(num_points)))
height = numpy.array((numpy.random.rand(num_points)-0.5))
X = numpy.array([tt*nump... |
DES-SL/EasyLens | notebooks/ExampleWorksheet.ipynb | mit | # External modules - try "pip install <module>" if you get an error.
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
import pickle
import numpy as np
import os
import easylens
# It'll make the notebook clearer if we get a few tools out and give them easy names:
from easylens.Data.lens_system import LensSy... |
google/earthengine-community | tutorials/histogram-matching/index.ipynb | apache-2.0 | import ee
ee.Authenticate()
ee.Initialize()
"""
Explanation: Histogram Matching
Author: jdbcode
Modified from the Medium blog post by Noel Gorelick
Histogram matching is a quick and easy way to "calibrate" one image to match another. In mathematical terms, it's the process of transforming one image so that the cumulat... |
Boialex/MIPT-ML | hw2/DecisionTree.ipynb | gpl-3.0 | class Tree(object):
def __init__(self, indices, feature=0, threshold=0.):
self.indices = np.array(indices)
self.left, self.right = None, None
self.feature = feature
self.threshold = threshold
def H(R):
if len(R) == 0:
return 10.**300
R = np.array(R)
... |
UWSEDS/LectureNotes | save/07-Visualization-in-Python/Visualization in Python.ipynb | bsd-2-clause | import pandas as pd
import matplotlib.pyplot as plt
# The following ensures that the plots are in the notebook
%matplotlib inline
# We'll also use capabilities in numpy
import numpy as np
df = pd.read_csv("2015_trip_data.csv")
df.head()
"""
Explanation: Visualization in Python - Case Study
There are many python packa... |
saudijack/unfpyboot | Day_02/01_ObjectOrientedProgramming/00_Object_Oriented_Programming.ipynb | mit | import sys
def function(): pass
print type(1)
print type("")
print type([])
print type({})
print type(())
print type(object)
print type(function)
print type(sys)
"""
Explanation: Object Oriented Programming
Object Oriented Programming (OOP) is a programming paradigm that uses objects and their interactions to design... |
mne-tools/mne-tools.github.io | 0.23/_downloads/23237b92405a4b223d89222e217ffffd/morph_volume_stc.ipynb | bsd-3-clause | # Author: Tommy Clausner <tommy.clausner@gmail.com>
#
# License: BSD (3-clause)
import os
import nibabel as nib
import mne
from mne.datasets import sample, fetch_fsaverage
from mne.minimum_norm import apply_inverse, read_inverse_operator
from nilearn.plotting import plot_glass_brain
print(__doc__)
"""
Explanation: M... |
mathLab/RBniCS | tutorials/17_navier_stokes/tutorial_navier_stokes_1_exact.ipynb | lgpl-3.0 | from ufl import transpose
from dolfin import *
from rbnics import *
"""
Explanation: Tutorial 17 - Navier Stokes equations
Keywords: exact parametrized functions, supremizer operator
1. Introduction
In this tutorial, we will study the Navier-Stokes equations over the two-dimensional backward-facing step domain $\Omega... |
mne-tools/mne-tools.github.io | 0.23/_downloads/47923e53e0be940f05f054346a1ec113/elekta_epochs.ipynb | bsd-3-clause | # Author: Jussi Nurminen (jnu@iki.fi)
#
# License: BSD (3-clause)
import mne
import os
from mne.datasets import multimodal
fname_raw = os.path.join(multimodal.data_path(), 'multimodal_raw.fif')
print(__doc__)
"""
Explanation: Getting averaging info from .fif files
Parse averaging information defined in Elekta Vec... |
rokroskar/sparkhpc | example.ipynb | mit | import findspark; findspark.init()
"""
Explanation: Example of simple sparkhpc usage in the Jupyter notebook
Configure python for using the spark python libraries with findspark
End of explanation
"""
import sparkhpc
sj = sparkhpc.sparkjob.LSFSparkJob(ncores=4)
sj.wait_to_start()
sj
sj2 = sparkhpc.sparkjob.LSFSpa... |
scikit-rf/scikit-rf | doc/source/examples/mixedmodeanalysis/Mixed Mode Basics.ipynb | bsd-3-clause | import re
import skrf as rf
import numpy as np
import matplotlib.pyplot as plt
sedatafile = r'mixedmodebasics_files/load_se.s4p'
mmdatafile = r'mixedmodebasics_files/load_truemode_balbal.s4p'
for file in [sedatafile, mmdatafile]:
with open(file, encoding='cp1252') as f:
for line in f:
print(li... |
mne-tools/mne-tools.github.io | dev/_downloads/8b7a85d4b98927c93b7d9ca1da8d2ab2/compute_mne_inverse_volume.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
from nilearn.plotting import plot_stat_map
from nilearn.image import index_img
from mne.datasets import sample
from mne import read_evokeds
from mne.minimum_norm import apply_inverse, read_inverse_operator
print(__doc__)
data_path ... |
FRESNA/atlite | examples/historic-comparison-germany.ipynb | gpl-3.0 | import atlite
import xarray as xr
import pandas as pd
import scipy.sparse as sp
import numpy as np
import pgeocode
from collections import OrderedDict
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set_style('whitegrid')
"""
Explanation: Historic comparison PV and wind
In this example ... |
dtamayo/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... |
griffinfoster/fundamentals_of_interferometry | 1_Radio_Science/1_11_modern_interferometric_arrays.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: Outline
Glossary
1. Radio Science using Interferometric Arrays
Previous: 1.10 The Limits of Single Dish Astronomy
Next: 1.x Further reading and refer... |
ML4DS/ML4all | R2.kNN_Regression/.ipynb_checkpoints/regression_knn-checkpoint.ipynb | mit | # Import some libraries that will be necessary for working with data and displaying plots
# To visualize plots in the notebook
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pylab
# Packages used to read datasets
import scipy.io # To read matlab files
import pan... |
facaiy/book_notes | Reinforcement_Learing_An_Introduction/Finite_Markov_Decision_Processes/note.ipynb | cc0-1.0 | Image('./res/fig3_1.png')
"""
Explanation: Chapter 3: Finite Markov Decision Processes
MDP(Markov Decision Processes): actions influence not just immediate rewards, but also subsequential situations.
3.1 The Agent-Environment Interface
End of explanation
"""
# Transition Graph
Image('./res/ex3_3.png')
"""
Explanati... |
atlury/deep-opencl | DL0110EN/4.3.1lactivationfuction.ipynb | lgpl-3.0 | import torch.nn as nn
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
"""
Explanation: <div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="http://cocl.us/pytorch_link_top"><img src = "http://cocl.us/Pytorch_top" width = 950, align = "center"></a>
<img src = "htt... |
ajrader/timeseries | notebooks/Prophet_TrendChangepoints_Example.ipynb | apache-2.0 | #wp_R_dataset_url = 'https://github.com/facebookincubator/prophet/blob/master/examples/example_wp_R.csv'
wp_peyton_manning_filename = '../datasets/example_wp_peyton_manning.csv'
import pandas as pd
import numpy as np
from fbprophet import Prophet
"""
Explanation: Working with FB Prophet
Trend Changepoints example fro... |
HazyResearch/snorkel | tutorials/advanced/Categorical_Classes.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
import numpy as np
from snorkel import SnorkelSession
session = SnorkelSession()
"""
Explanation: Categorical Variables in Snorkel
This is a short tutorial on how to use categorical variables (i.e. more values than binary) in Snorkel. We'll use a comple... |
sync-for-science/sync-for-science.github.io | proxy-api-calls/SMART.ipynb | mit | import requests
from pprint import pprint
redirect_uri = 'https://not-a-real-site/authorized'
data = {
'client_name': 'Fake Research Application',
'redirect_uris': [redirect_uri],
'scope': 'launch/patient patient/*.read offline_access'
}
response = requests.post('https://portal.demo.syncfor.science/oauth/... |
arne-cl/alt-mulig | python/rstdt-batch-tokenization.ipynb | gpl-3.0 | import os
from stanford_corenlp_pywrapper import sockwrap
CORENLP_PYWRAPPER_DIR = os.path.expanduser('~/repos/stanford_corenlp_pywrapper')
jars = ("stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1.jar",
"stanford-corenlp-full-2014-08-27/stanford-corenlp-3.4.1-models.jar")
p=sockwrap.SockWrap("pos",
... |
tensorflow/docs-l10n | site/ko/r1/tutorials/keras/basic_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... |
enlighter/learnML | mini-projects/p0 - titanic survival exploration/unused notebook/Titanic_Survival_Exploration.ipynb | mit | import numpy as np
import pandas as pd
# RMS Titanic data visualization code
from titanic_visualizations import survival_stats
from IPython.display import display
%matplotlib inline
# Load the dataset
in_file = 'titanic_data.csv'
full_data = pd.read_csv(in_file)
# Print the first few entries of the RMS Titanic data... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_covariance_whitening_dspm.ipynb | bsd-3-clause | # Author: Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import numpy as np
from scipy.misc import imread
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import spm_face
from mne.minimum_norm import apply_inverse, make_inverse_o... |
rcrehuet/Python_for_Scientists_2017 | notebooks/extras/Numpy_elegance_and_smoothing.ipynb | gpl-3.0 | def smoothListGaussian(list,degree=5):
list =[list[0]]*(degree-1) + list + [list[-1]]*degree
window=degree*2-1
weight=np.array([1.0]*window)
weightGauss=[]
for i in range(window):
i=i-degree+1
frac=i/float(window)
gauss=1/(np.exp((4*(frac))**2))
weightGa... |
geektoni/shogun | doc/ipython-notebooks/clustering/GMM.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import shogun as sg
from matplotlib.patches import Ellipse
# a tool for visualisation
def get_gaussian_ellipse_artist(mean, cov, nstd=1.96, color="red", linewidth=3):
"""
... |
pk-ai/training | natural-language-processing/spacy/Linguistic_features.ipynb | mit | # Importing the necessary symbols
from spacy.symbols import nsubj, VERB
# Finding a verb with a subject from below — good
verbs = set()
for possible_subject in doc:
if possible_subject.dep == nsubj and possible_subject.head.pos == VERB:
verbs.add(possible_subject.head)
# Printing the verbs
print(verbs)
""... |
fernandojvdasilva/nlp-python-lectures | nlp_classification_pt-br.ipynb | gpl-3.0 | import nltk
nltk.download('nps_chat')
from nltk.corpus import nps_chat
print(nps_chat.fileids())
"""
Explanation: <h1 align="center"> Introdução ao Processamento de Linguagem Natural (PLN) Usando Python </h1>
<h3 align="center"> Professor Fernando Vieira da Silva MSc.</h3>
<h2>Problema de Classificação</h2>
<p>Ne... |
Mashimo/datascience | 01-Regression/LRinference.ipynb | apache-2.0 | import pandas as pd
diamondData = pd.read_csv("../datasets/diamond.dat.txt", delim_whitespace=True, header=None, names=["carats","price"])
diamondData.head()
"""
Explanation: Inference statistics for linear regression
We have seen how we can fit a model to existing data using linear regression. Now we want to assess... |
arviz-devs/arviz | doc/source/user_guide/pystan_refitting.ipynb | apache-2.0 | import arviz as az
import stan
import numpy as np
import matplotlib.pyplot as plt
# enable PyStan on Jupyter IDE
import nest_asyncio
nest_asyncio.apply()
"""
Explanation: (pystan_refitting)=
Refitting PyStan (3.0+) models with ArviZ
ArviZ is backend agnostic and therefore does not sample directly. In order to take ad... |
Kuni88/tutorial_python | text/Chapter5.ipynb | mit | # 1. データセットを用意する
from sklearn import datasets
iris = datasets.load_iris() # ここではIrisデータセットを読み込む
print(iris.data[0], iris.target[0]) # 1番目のサンプルのデータとラベル
# 2.学習用データとテスト用データに分割する
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target)
# 3. 線形SVMという手... |
mlperf/training_results_v0.5 | v0.5.0/google/cloud_v2.512/resnet-tpuv2-512/code/resnet/model/tpu/tools/colab/Regression_Sine_data_with_Keras.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow 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 appl... |
arimvydas/tinklamatis | tinklamatis.ipynb | gpl-3.0 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import folium
from folium import Map
import branca.colormap as cm
import seaborn as sns
import csv
%matplotlib inline
"""
Explanation: t i n k l a m a t i s
Kaip veikia mobiliojo ryšio tinklai? Kas yra ir kuo ... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/tfx_pipelines/walkthrough/labs/tfx_walkthrough_vertex.ipynb | apache-2.0 | import os
import time
from pprint import pprint
import absl
import tensorflow as tf
import tensorflow_data_validation as tfdv
import tensorflow_model_analysis as tfma
import tensorflow_transform as tft
import tfx
from tensorflow_metadata.proto.v0 import schema_pb2
from tfx.components import (
CsvExampleGen,
Ev... |
mne-tools/mne-tools.github.io | dev/_downloads/47923e53e0be940f05f054346a1ec113/elekta_epochs.ipynb | bsd-3-clause | # Author: Jussi Nurminen (jnu@iki.fi)
#
# License: BSD-3-Clause
import mne
import os
from mne.datasets import multimodal
fname_raw = os.path.join(multimodal.data_path(), 'multimodal_raw.fif')
print(__doc__)
"""
Explanation: Getting averaging info from .fif files
Parse averaging information defined in Elekta Vector... |
Pybonacci/notebooks | Jupytor.ipynb | bsd-2-clause | %load_ext jupytor
"""
Explanation: Esta será una microentrada para presentar una extensión para el notebook que estoy usando en un curso interno que estoy dando en mi empresa.
Si a alguno más os puede valer para mostrar cosas básicas de Python (2 y 3, además de Java y Javascript) para muy principiantes me alegro.
Nomb... |
hparik11/Deep-Learning-Nanodegree-Foundation-Repository | Project3/Generate_TV_Scripts/dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
sdss/marvin | docs/sphinx/jupyter/my_query_results.ipynb | bsd-3-clause | from marvin import config
config.setRelease('MPL-4')
from marvin.tools.query import Query, Results, doQuery
# make a query
myquery = 'nsa.sersic_logmass > 10.3 AND nsa.z < 0.1'
q = Query(search_filter=myquery)
# run a query
r = q.run()
"""
Explanation: Marvin query Results
Now that you have performed your first qu... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-lmec/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-lmec', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-LMEC
Topic: Ocean
Sub-Topics: Timestepping Framework, Advec... |
quole/gensim | docs/notebooks/online_w2v_tutorial.ipynb | lgpl-2.1 | from gensim.corpora.wikicorpus import WikiCorpus
from gensim.models.word2vec import Word2Vec, LineSentence
from pprint import pprint
from copy import deepcopy
from multiprocessing import cpu_count
"""
Explanation: Online word2vec tutorial
So far, word2vec cannot increase the size of vocabulary after initial training. ... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/scikit-learn/scikit-learn-linear-reg.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn;
from sklearn.linear_model import LinearRegression
import pylab as pl
seaborn.set()
"""
Explanation: scikit-learn-linear-reg
Credits: Forked from PyCon 2015 Scikit-learn Tutorial by Jake VanderPlas
Linear Regression
End of explanat... |
karhohs/boardgame-bookie | boardgames/seafall/captains_log/campaign_0/SeaFall_Results.ipynb | bsd-3-clause | %matplotlib inline
import itertools
import matplotlib
import matplotlib.pyplot
import numpy
import pandas
import scipy.misc
import scipy.special
import scipy.stats
import seaborn
import trueskill
import xlrd
"""
Explanation: SeaFall Results
This SeaFall campaign ended after 14 games, so the leaderboard has a bit of h... |
kthyng/tracpy | docs/manual.ipynb | mit | # Normal Python libraries
import numpy as np
import netCDF4 as netCDF
import tracpy
import tracpy.plotting
from tracpy.tracpy_class import Tracpy
matplotlib.rcParams.update({'font.size': 20})
"""
Explanation: Initialization of a numerical experiment
Before running a drifter simulation, a number of parameters need to b... |
rvperry/phys202-2015-work | assignments/assignment04/MatplotlibEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 1
Imports
End of explanation
"""
import os
assert os.path.isfile('yearssn.dat')
"""
Explanation: Line plot of sunspot data
Download the .txt data for the "Yearly mean total sunspot number [1700 - now]" from th... |
sky111111111/study | test2.ipynb | gpl-3.0 | # sequence_to_sequence_implementation course assignment was used a lot to finish this hw
# A live help person highly suggested I worked through it again. --- 10000% correct. this was vital
### AKA the UDACITY seq2seq assignment, /deep-learning/seq2seq/sequence_to_sequence_implementation.ipynb
"""
DON'T MODIFY ANYTHI... |
tlkh/Generating-Inference-from-3D-Printing-Jobs | Clustering Test.ipynb | mit | from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn import metrics
import csv
%run 'preprocessor.ipynb' #our own preprocessor functions
with open('data_w1w4.csv', 'r') as f:
reader = csv.reader(f)
data = list(reader)
matrix = obtain_data_matrix(data)
samples = len(ma... |
kubeflow/kfp-tekton-backend | components/gcp/dataproc/submit_spark_job/sample.ipynb | apache-2.0 | %%capture --no-stderr
KFP_PACKAGE = 'https://storage.googleapis.com/ml-pipeline/release/0.1.14/kfp.tar.gz'
!pip3 install $KFP_PACKAGE --upgrade
"""
Explanation: Name
Data preparation using Spark on YARN with Cloud Dataproc
Label
Cloud Dataproc, GCP, Cloud Storage, Spark, Kubeflow, pipelines, components, YARN
Summary
... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-cm6-1/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-cm6-1', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-CM6-1
Sub-Topics: Radiative Forcings.
P... |
NEONScience/NEON-Data-Skills | tutorials/Python/Hyperspectral/hyperspectral-classification/Classification_Scikit_SVM_py/Classification_Scikit_SVM_py.ipynb | agpl-3.0 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy import linalg
from scipy import io
from sklearn import linear_model as lmd
"""
Explanation: syncID: 1497c1da6ed64a7591e56ff1f2fce18d
title: "Classification of Hyperspectral Data with Support Vector Machine (SVM) Using SciKit in Python"
de... |
astarostin/MachineLearningSpecializationCoursera | course4/week1 - Доверительные интервалы для доли - demo.ipynb | apache-2.0 | import numpy as np
np.random.seed(1)
statistical_population = np.random.randint(2, size = 100000)
random_sample = np.random.choice(statistical_population, size = 1000)
#истинное значение доли
statistical_population.mean()
"""
Explanation: Доверительные интервалы для доли
Генерация данных
End of explanation
"""
... |
mdpiper/topoflow-notebooks | Meteorology-P-GridSequence-2.ipynb | mit | mps_to_mmph = 1000 * 3600
"""
Explanation: Precipitation in the Meteorology component
Goal: In this example, I give the Meteorology component a grid sequence of linearly increasing precipitation values and check whether it produces output when the model state is updated.
Define a helpful constant:
End of explanation
"... |
ES-DOC/esdoc-jupyterhub | notebooks/cccma/cmip6/models/sandbox-1/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-1', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CCCMA
Source ID: SANDBOX-1
Topic: Ocean
Sub-Topics: Timestepping Framework, Advecti... |
AllenDowney/ThinkBayes2 | examples/height.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
import numpy as np
import pandas as pd
from thinkbayes2 import Pmf, Cdf, Suite, Joint
import thinkplot
... |
phoebe-project/phoebe2-docs | 2.1/tutorials/gravb_bol.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Gravity Brightening/Darkening (gravb_bol)
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
... |
eggie5/ipython-notebooks | avengers/.ipynb_checkpoints/Avengers-checkpoint.ipynb | mit | import pandas as pd
avengers = pd.read_csv("avengers.csv")
avengers.head(5)
"""
Explanation: Avengers Data
Life and Death of the Avengers
The Avengers are a well-known and widely loved team of superheroes in the Marvel universe that were introduced in the 1960's in the original comic book series. They've since become... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/cord_19_embeddings_keras.ipynb | apache-2.0 | # Copyright 2019 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... |
dipanjanS/BerkeleyX-CS100.1x-Big-Data-with-Apache-Spark | Week 1 - Data Science Background and Course Software Setup/lab0_student.ipynb | mit | # Check that Spark is working
largeRange = sc.parallelize(xrange(100000))
reduceTest = largeRange.reduce(lambda a, b: a + b)
filterReduceTest = largeRange.filter(lambda x: x % 7 == 0).sum()
print reduceTest
print filterReduceTest
# If the Spark jobs don't work properly these will raise an AssertionError
assert reduce... |
rddy/leitnerq | nb/mnemosyne_data.ipynb | apache-2.0 | public_itemids = defaultdict(set)
fs = [x for x in os.listdir(os.path.join('data', 'shared_decks')) if '.xml' in x]
for f in fs:
try:
e = xml.etree.ElementTree.parse(os.path.join('data', 'shared_decks', f)).getroot()
for x in e.findall('log'):
public_itemids[x.get('o_id')].add(f)
exc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.