repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
kecnry/autofig | docs/gallery/phoebe_meshes_3d.ipynb | gpl-3.0 | import autofig
import numpy as np
import phoebe # PHOEBE 2.1.0
#autofig.inline()
times = np.linspace(0,1,21)
# create an "interesting" system in PHOEBE
b = phoebe.default_binary()
b.set_value('incl@orbit', 75)
b.set_value('q', 0.5)
b.set_value('requiv@secondary', 0.6)
# add datasets and compute the model
b.add_data... |
saashimi/code_guild | interactive-coding-challenges/graphs_trees/graph_path_exists/path_exists_challenge.ipynb | mit | %run ../graph/graph.py
%load ../graph/graph.py
def path_exists(start, end):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Determine whether there is a path between two nodes in a gr... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/solutions/keras.ipynb | apache-2.0 | # Import TensorFlow and TensorFlow Datasets
import tensorflow_datasets as tfds
import tensorflow as tf
import os
# Here we'll show the currently installed version of TensorFlow
print(tf.__version__)
"""
Explanation: Distributed Training with Keras
Learning Objectives
How to define distribution strategy and set inp... |
molgor/spystats | notebooks/Sandboxes/GMRF/Stationary_with_fft.ipynb | bsd-2-clause | # Load Biospytial modules and etc.
%matplotlib inline
import sys
sys.path.append('/apps')
sys.path.append('..')
#sys.path.append('../../spystats')
import django
django.setup()
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
## Use the ggplot style
plt.style.use('ggplot')
from external_plugins.sp... |
arkottke/pysra | examples/example-09.ipynb | mit | import json
import matplotlib.pyplot as plt
import numpy as np
import pysra
%matplotlib inline
# Increased figure sizes
plt.rcParams["figure.dpi"] = 120
"""
Explanation: Example 9: Quarter wavelength site amplification
Example of quarter-wavelength site amplification and fitting a profile to a target crustal ampli... |
jacobdein/alpine-soundscapes | examples/Playing with matplotlib.ipynb | mit | DEM_filepath = ""
sample_points_filepath = ""
"""
Explanation: Playing with matplotlib
Variable declarations
DEM_filepath – path to DEM raster <br />
sample_points_filepath – path to sample points shapefile
End of explanation
"""
import matplotlib.pylab as plt
%matplotlib inline
import rasterio
import fiona
"""
... |
sdhnshu/artistic-style-transfer-on-floydhub | style transfer.ipynb | gpl-3.0 | import scipy.io
vgg = scipy.io.loadmat('../input/imagenet-vgg-verydeep-19.mat')
# Uncomment the next line to see the huuuuuge matrix
# print (vgg['layers'])
# 1x43 matrix, each column is a layer
layers = vgg['layers'][0]
# Uncomment the next line to see the weights of the fifth layer
# print (layers[5][0][0][0][0][... |
shikhar413/openmc | examples/jupyter/mdgxs-part-ii.ipynb | mit | %matplotlib inline
import math
import matplotlib.pyplot as plt
import numpy as np
import openmc
import openmc.mgxs
"""
Explanation: Multigroup (Delayed) Cross Section Generation Part II: Advanced Features
This IPython Notebook illustrates the use of the openmc.mgxs.Library class. The Library class is designed to aut... |
slowvak/MachineLearningForMedicalImages | notebooks/Module 5.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
Data=pd.read_csv ('DataExample.csv')
Data.head()
ClassBrainTissuepost=(Data['ClassTissuePost'].values)
ClassBrainTissuepost= (np.asarray(ClassBrainTissuepost))
ClassBrainTissuepost=ClassBrainTissuepost[~np.isnan(ClassBrainTissu... |
Cyb3rWard0g/ThreatHunter-Playbook | docs/notebooks/windows/05_defense_evasion/WIN-190101151110.ipynb | gpl-3.0 | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Active Directory Replication User Backdoor
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/01/01 |
| modification date | 2020/09/20 |
| playbook rel... |
noammor/coursera-machinelearning-python | ex8/ml-ex8-anomaly-detection.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from scipy.stats import multivariate_normal
%matplotlib inline
#%qtconsole
"""
Explanation: Exercise 8 | Anomaly Detection
End of explanation
"""
ex7data1 = scipy.io.loadmat('ex8data1.mat')
X = ex7data1['X']
Xval = ex7data1['Xval']
yval = ex7data1['... |
SwissTPH/TBRU_serialTB | notebooks/1.5_ATR_pNS_calculations.ipynb | gpl-3.0 | #Python core packages
from collections import Counter
import string
import pickle
import datetime
import warnings
warnings.filterwarnings("ignore")
import random
#Additional Python packages
import tqdm
#Scientific packages
from scipy import stats as ss
import numpy as np
import matplotlib as mpl
import matplotlib.pyp... |
olifre/root | bindings/pyroot/cppyy/cppyy/doc/tutorial/CppyyTutorial.ipynb | lgpl-2.1 | import cppyy
"""
Explanation: Cppyy Tutorial
(Modified from Enrico Guiraud's cppyy tutorial.)
This tutorial introduces the basic concepts for using cppyy, the automatic Python-C++ generator. To install cppyy on your system, simply run (this may take a while as it will pull in and compile a custom version of LLVM):
$ p... |
RaRe-Technologies/gensim | docs/src/auto_examples/tutorials/run_fasttext.ipynb | lgpl-2.1 | import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
Explanation: FastText Model
Introduces Gensim's fastText model and demonstrates its use on the Lee Corpus.
End of explanation
"""
from pprint import pprint as print
from gensim.models.fasttext import FastTe... |
fastai/fastai | nbs/18_callback.fp16.ipynb | apache-2.0 | #|export
@delegates(GradScaler)
class MixedPrecision(Callback):
"Mixed precision training using Pytorch's `autocast` and `GradScaler`"
order = 10
def __init__(self, **kwargs): self.kwargs = kwargs
def before_fit(self):
self.autocast,self.learn.scaler,self.scales = autocast(),GradScaler(**self.k... |
martinjrobins/hobo | examples/sampling/nested-ellipsoidal-sampling.ipynb | bsd-3-clause | import pints
import pints.toy as toy
import numpy as np
import matplotlib.pyplot as plt
# Load a forward model
model = toy.LogisticModel()
# Create some toy data
r = 0.015
k = 500
real_parameters = [r, k]
times = np.linspace(0, 1000, 100)
signal_values = model.simulate(real_parameters, times)
# Add independent Gauss... |
thesby/CaffeAssistant | tutorial/ipynb/detection.ipynb | mit | !mkdir -p _temp
!echo `pwd`/images/fish-bike.jpg > _temp/det_input.txt
!../python/detect.py --crop_mode=selective_search --pretrained_model=../models/bvlc_reference_rcnn_ilsvrc13/bvlc_reference_rcnn_ilsvrc13.caffemodel --model_def=../models/bvlc_reference_rcnn_ilsvrc13/deploy.prototxt --gpu --raw_scale=255 _temp/det_in... |
ES-DOC/esdoc-jupyterhub | notebooks/dwd/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: DWD
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
npaulson/digit_classification | index.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import h5py
import support as sp
"""
Explanation: Handwritten Digit Indentification
This project demonstrates the use of various machine learning algorithms to identify handwritten digits. Machine learning algorithms from the scikit-learn package are implemented, w... |
ehudbaumatz/recsys | src/features/geo/scrape_video_geo_context_by_url.ipynb | mit | import numpy as np
import pandas as pd
from spacy.symbols import pobj
site_scrape_dict = {
# the following represents html selector to retrieve the header + 2 first test paragraphs
'aol.com': '#article-wrapper h1, #article-wrapper > div.article-content > p:nth-child(2) , #article-wrapper > div.article-content... |
dereneaton/RADmissing | emp_nb_Orestias.ipynb | mit | ### Notebook 4
### Data set 4 (Orestias)
### Authors: Takahashi & Moreno (2015)
### Data Location: DDBJ DRA DRA003595
"""
Explanation: Notebook 4:
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 ... |
RyanSkraba/beam | examples/notebooks/documentation/transforms/python/elementwise/map-py.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License")
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you u... |
kanhua/pypvcell | demos/Color_of_surface_tmm.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
from __future__ import division, print_function, absolute_import
from pypvcell.tmm_core import (coh_tmm, unpolarized_RT, ellips, absorp_in_each_layer,
position_resolved, find_in_structure_with_inf)
from numpy import pi, linspace, inf, array
import numpy as np
... |
oemof/examples | oemof_examples/oemof.solph/v0.1.x/sector_coupling/sector_coupling.ipynb | gpl-3.0 | from oemof.solph import EnergySystem
import pandas as pd
# initialize energy system
energysystem = EnergySystem(timeindex=pd.date_range('1/1/2016',
periods=168,
freq='H'))
"""
Explanation: Multisectoral energy sy... |
scientific-visualization-2016/ClassMaterials | Week-03/01_week_02_homeworksolution.ipynb | cc0-1.0 | %matplotlib inline
import urllib2
import StringIO
import itertools
import datetime
import numpy as np
"""
Explanation: Python Plotting with Subplots
Homework for Week 02 (Tue 19 Jan 2016)
You will use the code provided below which mines the ESRL(NOAA/NWS) data server for the daily weather in Boulder Colorado for... |
astrograzl/SymPyTut | notebooks/SymPyTut.ipynb | bsd-3-clause | from sympy import init_session
init_session()
"""
Explanation: Taming math and physics using SymPy
Tutorial based on the No bullshit guide series of textbooks by Ivan Savov
Abstract
Most people consider math and physics to be scary
beasts from which it is best to keep one's distance. Computers,
however, can help us ta... |
gevero/1DPyHC | examples/GaAs-AlAs Bragg Mirror.ipynb | gpl-3.0 | # importing libraries
import numpy as np # numpy
import matplotlib.pyplot as plt # matplotlib pyplot
import sys # sys to add py_matrix to the path
# adding folder containing 1DPyHC to path: by default is the folder for running in binder
sys.path.append('/home/main/notebooks')
import pyhc as phc # impo... |
pysal/spaghetti | notebooks/tsp.ipynb | bsd-3-clause | %config InlineBackend.figure_format = "retina"
%load_ext watermark
%watermark
import geopandas
from libpysal import examples
import matplotlib
import matplotlib_scalebar
from matplotlib_scalebar.scalebar import ScaleBar
import numpy
import pulp
import spaghetti
%matplotlib inline
%watermark -w
%watermark -iv
"""
Ex... |
castanan/w2v | mllib-scripts/Word2Vec with Twitter Data using Spark RDDs.ipynb | mit | import os, sys, codecs, json
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
from IPython.display import display
from pyspark.mllib.feature import Word2Vec
from pyspark.mllib.clustering import KMeans
from pyspark.mllib.linalg import Vectors
fro... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/pca_fertility_factors.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.multivariate.pca import PCA
plt.rc("figure", figsize=(16, 8))
plt.rc("font", size=14)
"""
Explanation: statsmodels Principal Component Analysis
Key ideas: Principal component analysis, world bank data, fertility
In this ... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/ukesm1-0-ll/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'ukesm1-0-ll', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MOHC
Source ID: UKESM1-0-LL
Sub-Topics: Radiative Forcings.
Properties: 85 ... |
koulakis/amazon-review-qa-analysis | Importing the large data sets to psql and computing their metrics.ipynb | mit | import timeit
def stopwatch(function):
start_time = timeit.default_timer()
result = function()
print('Elapsed time: %i sec' % int(timeit.default_timer() - start_time))
return result
"""
Explanation: Importing the large datasets to a postgresql server and computing their metrics
It is not possible to lo... |
mne-tools/mne-tools.github.io | stable/_downloads/141ddce18e923e8220337b357ba3dc45/ssd_spatial_filters.ipynb | bsd-3-clause | # Author: Denis A. Engemann <denis.engemann@gmail.com>
# Victoria Peterson <victoriapeterson09@gmail.com>
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne import Epochs
from mne.datasets.fieldtrip_cmc import data_path
from mne.decoding import SSD
"""
Explanation: Compute Spectro-Spa... |
DJCordhose/ai | notebooks/workshops/tss/speed-limit-signs.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
import matplotlib.pylab as plt
import numpy as np
from distutils.version import StrictVersion
import sklearn
print(sklearn.__version__)
assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1')
import tensorflow as tf
t... |
ottogroup/dstoolbox | notebooks/Examples_transformers.ipynb | apache-2.0 | import re
import numpy as np
import pandas as pd
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import BernoulliNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extrac... |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/zz_old/TensorFlow/SkFlow_DEPRECATED/Scikit-Learn + TensorFlow.ipynb | apache-2.0 | %matplotlib inline
# Things we'll need later
import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error as mse
from sklearn.metrics import r2_score
from sklearn.metrics import classification_report
from sklearn import cross_validation as cv
# Load the example datase... |
sassoftware/sas-viya-machine-learning | Python-integration/Python_Viya_Workshop.ipynb | apache-2.0 | import pandas as pd
"""
Explanation: Hands-On Workshop: Python and CAS Integration on SAS Viya
Exercise 1 - A Gentle Introduction to Pandas
Reading Data into DataFrames
Pandas is a Python package providing flexible and expressive data structures designed to make working with “relational” or “labeled” data straightforw... |
snowicecat/umich-eecs445-f16 | lecture02_linear-algebra-optimization/lecture02_linear-algebra-optimization.ipynb | mit | from IPython.core.display import HTML, Image
from IPython.display import YouTubeVideo
from sympy import init_printing, Matrix, symbols, Rational
import sympy as sym
from warnings import filterwarnings
init_printing(use_latex = 'mathjax')
filterwarnings('ignore')
%pylab inline
import numpy as np
"""
Explanation: EECS... |
UNH-CORE/RVAT-Re-dep | Documents/IPython notebooks/uncertainty.ipynb | mit | # Get things all setup
from __future__ import division, print_function
import os
import numpy as np
import scipy.stats
if os.path.split(os.getcwd())[-1] == "IPython notebooks":
print("Setting working directory to experiment root directory")
os.chdir("../../")
from pyrvatrd.processing import *
import matplotlib.... |
williamdjones/protein_binding | notebooks/Evaluation of Random Forest on Separate Kinases.ipynb | mit | import pandas as pd
import time
import glob
import numpy as np
from scipy.stats import randint as sp_randint
from prettytable import PrettyTable
from sklearn.preprocessing import Imputer
from sklearn.model_selection import train_test_split, cross_val_score, RandomizedSearchCV
from sklearn.metrics import f1_score, accur... |
jinzishuai/learn2deeplearn | deeplearning.ai/C4.CNN/week1_foundations/hw/Convolution+model+-+Application+-+v1.ipynb | gpl-3.0 | import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
import tensorflow as tf
from tensorflow.python.framework import ops
from cnn_utils import *
%matplotlib inline
np.random.seed(1)
"""
Explanation: Convolutional Neural Networks: Appli... |
anhaidgroup/py_entitymatching | notebooks/guides/end_to_end_em_guides/.ipynb_checkpoints/Basic EM Workflow Restaurants - 2-checkpoint.ipynb | bsd-3-clause | import sys
sys.path.append('/Users/pradap/Documents/Research/Python-Package/anhaid/py_entitymatching/')
import py_entitymatching as em
import pandas as pd
import os
# Display the versions
print('python version: ' + sys.version )
print('pandas version: ' + pd.__version__ )
print('magellan version: ' + em.__version__ )... |
gfeiden/Notebook | Projects/mlt_calib/run06_convergence.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Monitor Convergence for Run 6
Applying multiple convergence checks for run 6, which adopted a floating Y and alpha. Up to now, we have monitored convergence by visually inspecting trace plots. It would be useful to know if convergen... |
tanmay987/deepLearning | intro-to-tflearn/TFLearn_Sentiment_Analysis_Solution.ipynb | mit | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
"""
Explanation: Sentiment analysis with TFLearn
In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w... |
clazaro/elastica | 2DRodFF_2.ipynb | gpl-3.0 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
"""
Explanation: © C. Lázaro, Universidad Politécnica de Valencia, 2015
Form finding of planar flexible rods (2)
In the previous notebook we have developed a tool which finds the form o... |
PyPSA/PyPSA | examples/notebooks/power-to-gas-boiler-chp.ipynb | mit | import pypsa
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pyomo.environ import Constraint
%matplotlib inline
"""
Explanation: Power to Gas with Heat Coupling
This is an example for power to gas with optional coupling to heat sector (via boiler OR Combined-Heat-and-Power (CHP))
A locatio... |
tpin3694/tpin3694.github.io | python/test_for_a_specific_exception.ipynb | mit | import unittest
"""
Explanation: Title: Test For A Specific Exception
Slug: test_for_a_specific_exception
Summary: Using Python.
Date: 2017-02-02 12:00
Category: Python
Tags: Testing
Authors: Chris Albon
Preliminaries
End of explanation
"""
def add(x, y):
return x + y
"""
Explanation: Create A Function To Tes... |
LSSTTVS/WhitepaperNotebooks | notebooks/k_consecutive_visits.ipynb | bsd-3-clause | # Import modules.
import matplotlib.pyplot as plt
%matplotlib inline
import lsst.sims.maf.db as db
import lsst.sims.maf.metrics as metrics
import lsst.sims.maf.slicers as slicers
import lsst.sims.maf.plots as plots
from lsst.sims.maf.metricBundles import MetricBundle, MetricBundleGroup, makeBundlesDictFromList
from maf... |
jmhsi/justin_tinker | data_science/courses/deeplearning2/neural-style.ipynb | apache-2.0 | %matplotlib inline
import importlib
import utils2; importlib.reload(utils2)
from utils2 import *
from scipy.optimize import fmin_l_bfgs_b
from scipy.misc import imsave
from keras import metrics
from vgg16_avg import VGG16_Avg
# Tell Tensorflow to use no more GPU RAM than necessary
limit_mem()
"""
Explanation: Image... |
NuGrid/NuPyCEE | ChETEC_school/GCE Lab 4 - Dwarf Galaxy - Chemical Evolution Trend.ipynb | bsd-3-clause | # Import standard Python packages
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# One-zone galactic chemical evolution code
import NuPyCEE.omega as omega
# Stellar abundances plotting code
import NuPyCEE.stellab as stellab
# Matplotlib option
%matplotlib inline
"""
Explanation: GCE Lab 4 - Dw... |
jmuhlich/indra | models/ras_pathway/CyJS_Assembler.ipynb | bsd-2-clause | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
statement_path = 'ras_pathway.txt'
txt = open(statement_path, 'rt').read()
print(txt)
"""
Explanation: CyJS Assembler
Assemble a network from text using existing INDRA functionality
Translate this into a model supp... |
Ccaccia73/semimonocoque | 10_Stab_SF260.ipynb | mit | from pint import UnitRegistry
import sympy
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
#import sys
%matplotlib inline
#from IPython.display import display
"""
Explanation: SF 260 Stabilizer
End of explanation
"""
from Section import Section
"""
Explanation: Import Section class, which c... |
Kulbear/deep-learning-nano-foundation | lectures/intro_to_tensorflow/intro_to_tensorflow.ipynb | mit | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
jhjungCode/pytorch-tutorial | 16_MNIST-RNN(LSTM).ipynb | mit | %matplotlib inline
"""
Explanation: RNN(LSTM)를 이용한 Minist 예제
End of explanation
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision import datasets, transforms
from torch.autograd import Variable
import matplotlib.pyplot as plt
import numpy as np
is_cuda = torc... |
karlstroetmann/Formal-Languages | ANTLR4-Python/04-Calc/Parser.ipynb | gpl-2.0 | import sys
import antlr4
"""
Explanation: Parsing with a Visitor
This notebooks shows how we can parse and evaluate assignments using the visitor pattern.
End of explanation
"""
!cat Expr.g4
"""
Explanation: Our grammar is stored in the file Expr.g4. Let's have a look:
End of explanation
"""
!java -jar /usr/loc... |
gwu-libraries/notebooks | 20170515-getting-First-and-last-date-of-tweets-in-a-collection/20170515-getting-First-and-last-date-of-tweets-in-a-collection.ipynb | mit | # For users: Change the filenames as you like.
INPUTFILE = "POE_json2.json"
OUTPUTFILE = "results.csv"
"""
Explanation: Getting first and last date of tweets for each twitter user
The purpose of this notebook is to extract unique user id, screen name, date user created, date of first tweet in dataset, date of last tw... |
lukechen526/deep-learning | sentiment-rnn/.ipynb_checkpoints/Sentiment RNN-checkpoint.ipynb | mit | from collections import Counter
import numpy as np
import tensorflow as tf
from math import floor
with open('reviews.txt', 'r') as f:
reviews = f.read()
with open('labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a rec... |
EvenStrangest/tensorflow | tensorflow/examples/udacity/4_convolutions.ipynb | apache-2.0 | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
pickle_file = 'notMNIST.pickle'
with open(pickle_file, 'rb')... |
google/ehr-predictions | ehr_prediction_modeling/fake_data/Load_different_processing_stages_of_fake_data.ipynb | apache-2.0 | #@title Imports
# Protocol buffers must first be compiled using `protoc`: see https://developers.google.com/protocol-buffers/docs/pythontutorial for details.from ehr_prediction_modeling.proto import fake_records_pb2
from ehr_prediction_modeling.proto import fake_patient_pb2
from ehr_prediction_modeling.proto import fak... |
paulrozdeba/varanneal | examples/jupyter-tutorial/VarAnneal_tutorial.ipynb | mit | # Necessary package imports
import time
import numpy as np
%matplotlib nbagg
import matplotlib.pyplot as plt
from varanneal import va_ode # The ODE version of VarAnneal
"""
Explanation: VarAnneal Tutorial
Introduction
VarAnneal is a Python package for state and parameter estimation in partially observed dynamical sy... |
tuanavu/python-cookbook-3rd | notebooks/.ipynb_checkpoints/02_unpacking_elements_from_iterables_of_arbitrary_length-checkpoint.ipynb | mit | record = ('Dave', 'dave@example.com', '773-555-1212', '847-555-1212')
name, email, *phone_numbers = record
print (name)
print (email)
print (phone_numbers)
"""
Explanation: Unpacking Elements from Iterables of Arbitrary Length
Problem
You need to unpack N elements from an iterable, but the iterable may be longer tha... |
nslatysheva/data_science_blogging | ensembling/ensembling_no_hyperparam_opt.ipynb | gpl-3.0 | import wget
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
# Import the dataset
data_url = 'https://raw.githubusercontent.com/nslatysheva/data_science_blogging/master/datasets/wine/winequality-red.csv'
dataset = wget.download(data_url)
dataset = pd.read_csv(dataset, sep=";... |
diegocavalca/Studies | dsa-deep-learning-ii/1. Introducao/Reg01/Reg01-Exemplo.ipynb | cc0-1.0 | # Import
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
%matplotlib inline
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 12, 10
# Definindo array de input com valores randômicos
x = np.array([i*np.pi/180 for i in range(60,300,4)])
np.random.seed(10)
y = np.s... |
jswoboda/GeoDataPython | Examples/FusionExamplempl.ipynb | mit | %matplotlib inline
import matplotlib
from __future__ import division,print_function
import logging
import pdb
import os
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import numpy as np
# Import Geodata modules
from GeoData import GeoData
from GeoData.plotting import slice2DGD,plot3Dslicempl, plotbeam... |
GoogleCloudPlatform/tf-estimator-tutorials | 08_Text_Analysis/02 - Text Classification - SMS Ham vs. Spam - Document Embedding.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow import data
from datetime import datetime
import multiprocessing
import shutil
print(tf.__version__)
MODEL_NAME = 'sms-class-model-01'
TRAIN_DATA_FILES_PATTERN = 'data/sms-spam/train-*.tsv'
VALID_DATA_FILES_PATTERN = 'data/sms-spam/valid-*.tsv'
VOCAB_LIST_FILE = 'data/sms-spa... |
agrc/Presentations | UGIC/2021/IntroToPython/alpha.ipynb | mit | city_label = 'SALT LAKE CITY'.title() + ', Utah'
print(city_label)
"""
Explanation: Variables
Variables are names that refers to a value. They have a couple obvious and not-so-obvious advantages:
- Store results of operations
End of explanation
"""
salt_lake_median_income = get_median_income('Salt Lake', census_data... |
dwhswenson/openpathsampling | examples/toy_model_mstis/toy_mstis_4_repex_analysis.ipynb | mit | sset0 = storage.samplesets[0]
numeric_labels = {s.ensemble : s.replica for s in sset0}
string_labels = {s.ensemble : str(s.replica) for s in sset0}
numeric_to_string = {numeric_labels[e] : string_labels[e] for e in numeric_labels.keys()}
"""
Explanation: Defining labels
Everything is actually done in terms of ensemble... |
GoogleCloudPlatform/dialogflow-cx-bot-language-translation | CX-Bot-Translate_Translation.ipynb | apache-2.0 | # !python3 -V
# !python3 -m pip list | wc -l
# !python3 -m pip list | grep google
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:80% !important; }</style>"))
"""
Explanation: Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not ... |
smorton2/think-stats | code/chap14ex.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import pandas as pd
import random
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... |
cloudera/ibis | docs/source/tutorial/05-IO-Create-Insert-External-Data.ipynb | apache-2.0 | import os
import ibis
ibis.options.interactive = True
connection = ibis.sqlite.connect(os.path.join('data', 'geography.db'))
"""
Explanation: Creating and inserting data
Setup
End of explanation
"""
countries = connection.table('countries')
continent_name = (countries.continent
.case()
... |
dpaniukov/RulesFPC | thresholded_results/RulesFPC/model_1_FPC/model_1_FPC.ipynb | mit | import os
from IPython.display import IFrame
from IPython.display import Image
# This function renders interactive brain images
def render(name,brain_list):
#prepare file paths
brain_files = []
for b in brain_list:
brain_files.append(os.path.join("data",b))
wdata = """
<!DOCTYPE h... |
goerlitz/text-mining | python/Recipes - Word2Vec Variations.ipynb | apache-2.0 | import re # Regular Expressions
import pandas as pd # DataFrames & Manipulation
from gensim.models.word2vec import Word2Vec
train_input = "../data/recipes.tsv.bz2"
# preserve empty strings (http://pandas-docs.github.io/pandas-docs-travis/io.html#na-values)
t... |
jeffzhengye/pylearn | tensorflow_learning/tf2/notebooks/.ipynb_checkpoints/transfer_learning-中文-checkpoint-checkpoint.ipynb | unlicense | import numpy as np
import tensorflow as tf
from tensorflow import keras
"""
Explanation: 迁移学习与微调,Transfer learning & fine-tuning
Author: fchollet<br>
Date created: 2020/04/15<br>
Last modified: 2020/05/12<br>
Description: Complete guide to transfer learning & fine-tuning in Keras. <br>
翻译: 叶正
设置,Setup
End of explanati... |
brianray/puppy_dec_2015 | .ipynb_checkpoints/PCA demo-checkpoint.ipynb | apache-2.0 | import matplotlib
matplotlib.use('nbagg')
%matplotlib inline
import graphlab as gl
"""
Explanation: Let's apply PCA to analyze voting patterns
End of explanation
"""
reviews = gl.SFrame.read_csv('../data/yelp/yelp_training_set_review.json', header=False)
reviews = reviews.unpack('X1','')
reviews = reviews.unpack('v... |
a301-teaching/a301_code | notebooks/resample2.ipynb | mit | import h5py
import numpy as np
import pyproj
import pyresample
from pyresample import kd_tree,geometry
from matplotlib import pyplot as plt
from a301utils.modismeta_read import parseMeta
from a301utils.a301_readfile import download
from mpl_toolkits.basemap import Basemap
data_name='MYD021KM.A2016224.2100.006.20162251... |
qutip/qutip-notebooks | development/development-qobjevo-timing.ipynb | lgpl-3.0 | import qutip as qt
import numpy as np
from qutip import QobjEvo
%load_ext cython
N = 10
destroy, create, Id = qt.destroy(N), qt.create(N), qt.qeye(N)
def exp_i(t,args):
return np.exp(-1j*t)
def cos_w(t,args):
return np.cos(args["w"]*t)
tlist = np.linspace(0,10,10000)
tlistlog = np.logspace(-3,1,10000)
# state... |
nasa/CrisisMappingToolkit | ipython/CrisisMappingToolkitOverview.ipynb | apache-2.0 | import sys
import os
import ee
# This script assumes your authentification credentials are stored as operatoring system
# environment variables.
__MY_SERVICE_ACCOUNT = os.environ.get('MY_SERVICE_ACCOUNT')
__MY_PRIVATE_KEY_FILE = os.environ.get('MY_PRIVATE_KEY_FILE')
# Initialize the Earth Engine object, using your au... |
drericstrong/Blog | 20170510_RunningABokehServerOnHerokuPart1.ipynb | agpl-3.0 | ### Bokeh Linear Regression Example
### Written By: Eric Strong
### Last Updated: 2017/05/10
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression as LR
from bokeh.io import curdoc
from bokeh.plotting import figure
from bokeh.models.ranges import Range1d
from bokeh.models impor... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/tfx_pipelines/guided_projects/guided_project_3.ipynb | apache-2.0 | import os
"""
Explanation: Guided Project 3
Learning Objective:
Learn how to customize the tfx template to your own dataset
Learn how to modify the Keras model scaffold provided by tfx template
In this guided project, we will use the tfx template tool to create a TFX pipeline for the covertype project, but this time... |
conferency/find-my-reviewers | tutorials/Profiling_Reviewers.ipynb | mit | import pandas as pd
import sqlite3
import gensim
import nltk
import json
from gensim.corpora import BleiCorpus
from gensim import corpora
from nltk.corpus import stopwords
from textblob import TextBlob
from gensim.corpora import Dictionary
from gensim.models import LdaModel
import numpy as np
import pickle
import glob
... |
tensorflow/docs-l10n | site/ko/tutorials/generative/pix2pix.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... |
DOV-Vlaanderen/pydov | docs/notebooks/search_grondwaterfilters.ipynb | mit | %matplotlib inline
import inspect, sys
# check pydov path
import pydov
"""
Explanation: Example of DOV search methods for groundwater screens (grondwaterfilters)
Use cases:
Get groundwater screens in a bounding box
Get groundwater screens with specific properties
Get the coordinates of all groundwater screens in Gh... |
makcedward/nlpaug | example/lambada-train_model.ipynb | mit | from IPython.display import Image
Image(filename='../res/lambada_algo.png')
"""
Explanation: Introduction to language-model-based data augmentation (LAMBADA)
https://arxiv.org/pdf/1911.03118.pdf
LAMBADA (Anaby-Tavor et al., 2019) is proposed to generate synthetic data. We follow the approach with modification into nlp... |
ES-DOC/esdoc-jupyterhub | notebooks/cams/cmip6/models/sandbox-3/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cams', 'sandbox-3', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CAMS
Source ID: SANDBOX-3
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balan... |
eds-uga/csci1360e-su17 | lectures/L9.ipynb | mit | import numpy
"""
Explanation: Lecture 9: Vectorized Programming
CSCI 1360E: Foundations for Informatics and Analytics
Overview and Objectives
We've covered loops and lists, and how to use them to perform some basic arithmetic calculations. In this lecture, we'll see how we can use an external library to make these com... |
avicennax/jedi | notebooks/Noise axons and the binary DFORCE.ipynb | mit | import pylab as plt
import numpy as np
%matplotlib inline
from __future__ import division
from scipy.integrate import odeint,ode
from numpy import zeros,ones,eye,tanh,dot,outer,sqrt,linspace,cos,pi,hstack,zeros_like,abs,repeat
from numpy.random import uniform,normal,choice
%config InlineBackend.figure_format = 'retina'... |
beyondvalence/biof509_wtl | Wk11-regression-classification/Wk11-regression-classification.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
from sklearn import datasets
diabetes = datasets.load_diabetes()
# Description at http://www4.stat.ncsu.edu/~boos/var.select/diabetes.html
X = diabetes.data
y = diabetes.target
print(X.shape, y.shape)
from sklearn import linear_model
clf = li... |
lmcinnes/umap | notebooks/Parametric_UMAP/06.0-nonparametric-umap.ipynb | bsd-3-clause | from tensorflow.keras.datasets import mnist
(train_images, Y_train), (test_images, Y_test) = mnist.load_data()
train_images = train_images.reshape((train_images.shape[0], -1))/255.
test_images = test_images.reshape((test_images.shape[0], -1))/255.
"""
Explanation: Non-parametric embedding with UMAP.
This notebook show... |
QuantCrimAtLeeds/PredictCode | examples/Networks/Case study Chicago/Cross-Validation.ipynb | artistic-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.collections
import numpy as np
import shelve
import open_cp.network
import open_cp.geometry
import open_cp.network_hotspot
import open_cp.logger
open_cp.logger.log_to_true_stdout()
import pickle, lzma
with lzma.open("input_old.pic.xz", "rb") as f:
... |
enakai00/jupyter_ml4se_commentary | 07-pandas DataFrame-03.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
"""
Explanation: その他のデータフレーム操作
End of explanation
"""
data = {'City': ['Tokyo','Osaka','Nagoya','Okinawa'],
'Temperature': [25.0,28.2,27.3,30.9],
'Humidity': [44,42,np.nan,62]... |
ReactiveX/RxPY | notebooks/reactivex.io/Part V - Consolidating Streams.ipynb | mit | reset_start_time(O.filter) # alias: where
d = subs(O.range(0, 5).filter(lambda x, i: x % 2 == 0))
"""
Explanation: A Decision Tree of Observable Operators
Part 5: Consolidating Streams
source: http://reactivex.io/documentation/operators.html#tree.
(transcribed to RxPY 1.5.7, Py2.7 / 2016-12, Gunther Klessinger, axiro... |
chris1610/pbpython | notebooks/Altair-Article.ipynb | bsd-3-clause | import pandas as pd
from altair import Chart, X, Y, Axis, SortField
%matplotlib inline
"""
Explanation: Introduction to Data Visualization with Altair
Notebook to accompany article on PB Python.
http://pbpython.com/altair-intro.html
End of explanation
"""
budget = pd.read_csv("https://github.com/chris1610/pbpython/... |
BadWizard/coalexploration | deliver/Coal prediction of production.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import explained_variance_score, r2_score, mean_squared_error
sns.set();
"""
E... |
google/earthengine-community | tutorials/detecting-changes-in-sentinel-1-imagery-pt-2/index.ipynb | apache-2.0 | import ee
# Trigger the authentication flow.
ee.Authenticate()
# Initialize the library.
ee.Initialize()
"""
Explanation: Detecting Changes in Sentinel-1 Imagery (Part 2)
Author: mortcanty
Run me first
Run the following cell to initialize the API. The output will contain instructions on how to grant this notebook ac... |
eds-uga/csci1360e-su17 | lectures/L3.ipynb | mit | x = 2
"""
Explanation: Lecture 3: Python Variables and Syntax
CSCI 1360E: Foundations for Informatics and Analytics
Overview and Objectives
In this lecture, we'll get into more detail on Python variables, as well as language syntax. By the end, you should be able to:
Define variables of string and numerical types, co... |
NYUDataBootcamp/Projects | MBA_S17/Boddu-Jadwani-Kutty-American_Time_Use_Study.ipynb | mit | # Importing all the required libraries
%matplotlib inline
import sys
import pandas as pd # data manipulation package
import datetime as dt # date tools, used to note current date
import matplotlib.pyplot as plt # graphics package
import matplotlib as mpl # graphics pack... |
bhermanmit/openmc | docs/source/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... |
mne-tools/mne-tools.github.io | 0.23/_downloads/c7633c38a703b9d0a626a5a4fa161026/psf_ctf_label_leakage.ipynb | bsd-3-clause | # Authors: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Nicolas P. Rougier (graph code borrowed from his matplotlib gallery)
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot a... |
opengeostat/pygslib | doc/source/Ipython_templates/cova3_raw.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
#make the plots inline
%matplotlib inline
"""
Explanation: PyGSLIB
Cova3 test
This is a simple example on how to use raw cova3 to fit variograms
End of explanation
"""
#get the data in gslib format into a pand... |
dsblank/ProgLangBook | Chapter 04 - Compare and Constrast.ipynb | gpl-3.0 | (lambda i: i + 1)
(lambda i: i + 1)(7)
%%scheme
(lambda (i) (+ i 1))
%%scheme
((lambda (i) (+ i 1)) 7)
"""
Explanation: Limited lambda in Python
Python's lambda can only contain expressions (not statements). However, you don't need to use the word "return".
End of explanation
"""
%%scheme
(define for-repeat
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.