repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
tpin3694/tpin3694.github.io | python/pandas_apply_operations_to_groups.ipynb | mit | # import modules
import pandas as pd
# Create dataframe
raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Dragoons', 'Dragoons', 'Scouts', 'Scouts', 'Scouts', 'Scouts'],
'company': ['1st', '1st', '2nd', '2nd', '1st', '1st', '2nd', '2nd','1st', '1st', '2n... |
ethen8181/machine-learning | python/algorithms/search_sort.ipynb | mit | from jupyterthemes import get_themes
from jupyterthemes.stylefx import set_nb_theme
themes = get_themes()
set_nb_theme(themes[1])
%load_ext watermark
%watermark -a 'Ethen' -d -t -v -p jupyterthemes
"""
Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span... |
hongguangguo/shogun | doc/ipython-notebooks/logdet/logdet.ipynb | gpl-3.0 | %matplotlib inline
from scipy.sparse import eye
from scipy.io import mmread
from matplotlib import pyplot as plt
matFile='../../../data/logdet/apache2.mtx.gz'
M = mmread(matFile)
rows = M.shape[0]
cols = M.shape[1]
A = M + eye(rows, cols) * 10000.0
plt.title("A")
plt.spy(A, precision = 1e-2, marker = '.', markersize =... |
flowmatters/veneer-py | doc/examples/network/TopologicalQueries.ipynb | isc | import veneer
%matplotlib inline
v = veneer.Veneer()
"""
Explanation: Network queries
veneer-py supports a number topological queries on the Source node-link network and including identifying outlets, upstream and downstream nodes, links and catchments.
These queries operate on the network object returned by v.networ... |
yafeunteun/wikipedia-spam-classifier | notebooks/.ipynb_checkpoints/feature_engineering-checkpoint.ipynb | mit | import sys
sys.path.append("/usr/local/lib/python3.4/dist-packages/")
sys.path.append("/usr/local/lib/python3.4/dist-packages/revscoring/")
sys.path.append("/usr/local/lib/python3.4/dist-packages/more_itertools/")
sys.path.append("/usr/local/lib/python3.4/dist-packages/deltas/")
!sudo pip3 install dependencies deltas
... |
fujii-team/GPinv | notebooks/Regression example.ipynb | apache-2.0 | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
# Import GPinv
import GPinv
# Import GPflow as comparison
import GPflow
"""
Explanation: An example of GPinv: For the regression purpose.
This notebook briefly shows a regression usage by GPflow
Keisuke Fujii 7th Oct. 2016
I... |
Kaggle/learntools | notebooks/nlp/raw/ex1.ipynb | apache-2.0 | import pandas as pd
# Set up code checking
from learntools.core import binder
binder.bind(globals())
from learntools.nlp.ex1 import *
print('Setup Complete')
"""
Explanation: Basic Text Processing with Spacy
You're a consultant for DelFalco's Italian Restaurant.
The owner asked you to identify whether there are any f... |
mne-tools/mne-tools.github.io | 0.19/_downloads/ff83425ee773d1d588a6994e5560c06c/plot_mne_dspm_source_localization.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
"""
Explanation: Source localization with MNE/dSPM/sLORETA/eLORETA
The aim of this tutorial is to teach you how to compute and apply a linear
inverse method s... |
juherask/YoungCodersIPythonNotebookFI | YoungCodersNotebook.ipynb | mit | 1+2
"""
Explanation: OPI PYTHONIN PERUSTEET
Tämä interaktiivinen harjoituskokoelma opettaa sinulle Python-ohjelmointikielen alkeet. Opas seurailee PyCon 2014 -tapahtumassa Barbara Shauretten ja Katie Cunninghamin pitämän Python-koulutuksen rakennetta.
Jos haluat tämän suomenkielisen oppaan sijaan tutustua englanninki... |
DOV-Vlaanderen/pydov | docs/notebooks/customizing_object_types.ipynb | mit | %matplotlib inline
"""
Explanation: Examples of object type customization
Listing techniques per CPT measurement
End of explanation
"""
from pydov.types.fields import XmlField, XsdType
from pydov.types.abstract import AbstractDovSubType
from pydov.types.sondering import Sondering
"""
Explanation: While performing ... |
backmari/moose | modules/level_set/tests/verification/1d_level_set_mms/LevelsetMMS.ipynb | lgpl-2.1 | %matplotlib inline
import glob
from sympy import *
import numpy
import matplotlib.pyplot as plt
import pandas
init_printing()
"""
Explanation: Transient MMS Verification for Levelset Equation
Computes the forcing function for a transient MMS test, the selected solution is designed to reach steady-state rapidly.
Load t... |
planet-os/notebooks | api-examples/gefs-api.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import dateutil.parser
import datetime
from urllib.request import urlopen, Request
import simplejson as json
import pandas as pd
def extract_reference_time(API_data_loc):
"""Find reference time that corresponds to most complete forecast. Should ... |
raschuetz/foundations-homework | 06/homework-6-schuetz.ipynb | mit | apikey = '34b41fe7b9db6c1bd5f8ea3492bca332'
coordinates = {'San Antonio': '29.4241,-98.4936', 'Miami': '25.7617,-80.1918', 'Central Park': '40.7829,-73.9654'}
import requests
url = 'https://api.forecast.io/forecast/' + apikey + '/' + coordinates['San Antonio']
response = requests.get(url)
data = response.json()
# #Is... |
hcp4715/AnalyzingExpData | HDDM/Within_models_from_tutorial.ipynb | cc0-1.0 | # check which python is in use.
import sys
print('Notebook is running:', sys.executable)
# further check your python version
from platform import python_version
print('The current HDDM version is', python_version())
# If you are sure that conda is installed, also check the package that install
#!conda list # list t... |
jcharit1/Identifying-Ad-Images | code/model_training.ipynb | mit | import os
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import json
from IPython.display import Image
from IPython.core.display import HTML
"""
Explanation: Model Training
Code for finding the best predictive model
Author: Jimmy Charité
Email: jimmy.charite@gmail.com
Dat... |
tsarouch/data_science_references_python | pyspark/pyspark_read_csv_template.ipynb | gpl-2.0 | from pyspark.sql import SQLContext, Row
sqlContext = SQLContext(sc)
"""
Explanation: """
This is done at a time where Spark did not support csv parsing 'in single line'
I m sure it will come soon...
"""
""" === e.g. the csv file looks like this:===
field1, field2, time
5768, 49.4,'2014-12-19 04:15:00+01',
1039, 26.1, ... |
piskvorky/gensim | docs/src/auto_examples/howtos/run_downloader_api.ipynb | lgpl-2.1 | import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
Explanation: How to download pre-trained models and corpora
Demonstrates simple and quick access to common corpora and pretrained models.
End of explanation
"""
import gensim.downloader as api
"""
Explanat... |
yandexdataschool/LHCb-topo-trigger | HLT2-TreesPruning.ipynb | apache-2.0 | sig_train_modes_names = [11114001, 11296013, 11874042, 12103035, 13246001, 13264021]
bck_train_mode_name = 30000000
sig_train_files = ['mod_{}.csv'.format(name) for name in sig_train_modes_names]
bck_train_files = 'mod_30000000.csv'
folder = "datasets/prepared_hlt_body/"
# concat all signal data
if not os.path.exists(... |
Kaggle/learntools | notebooks/data_cleaning/raw/ex5.ipynb | apache-2.0 | from learntools.core import binder
binder.bind(globals())
from learntools.data_cleaning.ex5 import *
print("Setup Complete")
"""
Explanation: In this exercise, you'll apply what you learned in the Inconsistent data entry tutorial.
Setup
The questions below will give you feedback on your work. Run the following cell to... |
bmorris3/gsoc2015 | landolt_standards_recipe.ipynb | mit | catalog_name = 'Landolt 1992'
observatory_name = 'Apache Point'
from astroquery.vizier import Vizier
from astropy.coordinates import SkyCoord
import astropy.units as u
catalog_list = Vizier.find_catalogs(catalog_name)
catalogs = Vizier.get_catalogs(catalog_list.keys())
Vizier.ROW_LIMIT = -1 # Otherwise would only s... |
ES-DOC/esdoc-jupyterhub | notebooks/uhh/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'uhh', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: UHH
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
AlexanderAda/NioGuardSecurityLab | Courses/ML in Cybersecurity/Classification/Phishing detection/Phishing detection with ML and feature scaling.ipynb | mit | # Load CSV
import pandas as pd
import numpy as np
filename = 'Examples - Phishing clasification2.csv'
# Specify the names of attributes if the header is not availabel in a CSV file
#names = ['Registrar', 'Lifetime', 'Country', 'Class']
# Loading with NumPy
#raw_data = open(filename, 'rt')
#data = numpy.loadtxt(raw... |
oasis-open/cti-python-stix2 | docs/guide/markings.ipynb | bsd-3-clause | from stix2 import Indicator, TLP_AMBER
indicator = Indicator(pattern_type="stix",
pattern="[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",
object_marking_refs=TLP_AMBER)
print(indicator.serialize(pretty=True))
"""
Explanation: Data Markings
Creating Objects With Da... |
bashtage/statsmodels | examples/notebooks/regression_diagnostics.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lzip
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
import matplotlib.pyplot as plt
# Load data
url = "https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Guerry.csv"
dat... |
tanghaibao/goatools | notebooks/goea_nbt3102_all_study_genes.ipynb | bsd-2-clause | # Get http://geneontology.org/ontology/go-basic.obo
from goatools.base import download_go_basic_obo
obo_fname = download_go_basic_obo()
"""
Explanation: Run a GOEA. Print study genes as either IDs symbols
We use data from a 2014 Nature paper:
Computational analysis of cell-to-cell heterogeneity
in single-cell RNA-se... |
Wx1ng/Python4DataScience.CH | Series_1_Scientific_Python/S1EP3_Pandas.ipynb | cc0-1.0 | import codecs
import requests
import numpy as np
import scipy as sp
import scipy.stats as spstat
import pandas as pd
import datetime
import json
r = requests.get("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data")
with codecs.open('S1EP3_Iris.txt','w',encoding='utf-8') as f:
f.write(r.text)
... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
mne-tools/mne-tools.github.io | 0.22/_downloads/17295dea468fcedae97ed8a6f9afc520/plot_decoding_csp_timefreq.ipynb | bsd-3-clause | # Authors: Laura Gwilliams <laura.gwilliams@nyu.edu>
# Jean-Remi King <jeanremi.king@gmail.com>
# Alex Barachant <alexandre.barachant@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne import... |
ODZ-UJF-AV-CR/osciloskop | vxi.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import sys
import os
import time
import h5py
import numpy as np
import glob
import vxi11
# Step 0:
# Connect oscilloscope via direct Ethernet link
# Step 1:
# Run "Record" on the oscilloscope
# and wait for 508 frames to be acquired.
# Step 2:
# Run this cell to initialize grabbing.
#... |
SheffieldML/GPclust | notebooks/MOHGP_demo.ipynb | gpl-3.0 | %matplotlib inline
%config InlineBackend.figure_format = 'png'#'svg' would be better, but eats memory for these big plots.
from matplotlib import pyplot as plt
import numpy as np
import GPy
import sys
sys.path.append('/home/james/work/gpclust/')
import GPclust
"""
Explanation: Mixtures of Gaussian processes with GPclu... |
garth-wells/notebooks-3D7 | 01-ElasticBarLinearFEM.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Use seaborn to style the plots and use accessible colors
import seaborn as sns
sns.set()
sns.set_palette("colorblind")
"""
Explanation: Finite element solver for an elastic rod
We create in this notebook a simple finite element solver for a linea... |
lyndond/Analyzing_Neural_Time_Series | chapter09.ipynb | mit | import numpy as np
import scipy.io
from matplotlib import pyplot as plt
"""
Explanation: 9. Overview of time-domain EEG analyses
End of explanation
"""
data = scipy.io.loadmat('sampleEEGdata')
#get all the data we need from the eeg file. Working with .mat files like this is not ideal, as you can clearly see below. ... |
maartenbreddels/vaex | docs/source/tutorial_jupyter.ipynb | mit | import vaex
import vaex.jupyter.model as vjm
import numpy as np
import matplotlib.pyplot as plt
df = vaex.example()
df
"""
Explanation: <div class="alert alert-info">
**Warning:** This notebook needs a running kernel to be fully interactive, please run it locally or on [mybinder](https://mybinder.org/v2/gh/vaexio/... |
robertoalotufo/ia898 | src/rgb2hsv.ipynb | mit | def rgb2hsv(rgb_img):
import numpy as np
r = rgb_img[:,:,0].ravel()
g = rgb_img[:,:,1].ravel()
b = rgb_img[:,:,2].ravel()
hsv_map = map(rgb2hsvmap, r, g, b)
hsv_img = np.array(list(hsv_map)).reshape(rgb_img.shape)
return hsv_img
def rgb2hsvmap(r, g, b):
maxc = m... |
xpharry/Udacity-DLFoudation | tutorials/sentiment_network/Sentiment Classification - Project 4 Solution.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()... |
mne-tools/mne-tools.github.io | 0.19/_downloads/05c57a644672d33707fd1264df7f5617/plot_time_frequency_global_field_power.ipynb | bsd-3-clause | # Authors: Denis A. Engemann <denis.engemann@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import somato
from mne.baseline import rescale
from mne.stats import boots... |
kubeflow/examples | jpx-tokyo-stock-exchange-kaggle-competition/jpx-tokyo-stock-exchange-prediction-kale.ipynb | apache-2.0 | !pip install -r requirements.txt --user --quiet
"""
Explanation: JPX Tokyo Stock Exchange Kale Pipeline
In this Kaggle competition
Japan Exchange Group, Inc. (JPX) is a holding company operating one of the largest stock exchanges in the world, Tokyo Stock Exchange (TSE), and derivatives exchanges Osaka Exchange (OSE... |
gojomo/gensim | docs/notebooks/soft_cosine_benchmark.ipynb | lgpl-2.1 | !git rev-parse HEAD
from copy import deepcopy
from datetime import timedelta
from itertools import product
import logging
from math import floor, ceil, log10
import pickle
from random import sample, seed, shuffle
from time import time
import numpy as np
import pandas as pd
from tqdm import tqdm_notebook
def tqdm(ite... |
vravishankar/Jupyter-Books | Closure.ipynb | mit | def print_msg(msg): # This is the outer enclosing function
def printer(): # This is the nested function
print(msg)
printer()
print_msg('Hello')
"""
Explanation: Closures
Before getting into closures lets understand nested functions. A function defined inside another function is called a nest... |
mdda/fossasia-2016_deep-learning | notebooks/work-in-progress/translation/3-parallel-texts-aggregate.ipynb | mit | import os
import csv
import time, random
import re
lang_from, lang_to = 'en', 'ko'
data_path = './data'
"""
Explanation: Aggregate Parallel Texts in directory
This assumes that we have a bunch of .csv files with the filename in the format ${source}-${lang}.csv, where each file has the header ts,txt to read in the te... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
ckmah/pokemon-tutorial | Welcome to Python for Data Science.ipynb | mit | print('This is a cell.')
"""
Explanation: Welcome to Python for Data Science
This a beginner/intermediate level Python tutorial about some of the most popular python packages in data science and scientific analysis.
This notebook was prepared by Clarence Mah. Source and license info is on GitHub.
Adapted from Andrew G... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/launching_into_ml/solutions/first_model.ipynb | apache-2.0 | import os
"""
Explanation: First BigQuery ML models for Taxifare Prediction
In this notebook, we will use BigQuery ML to build our first models for taxifare prediction.BigQuery ML provides a fast way to build ML models on large structured and semi-structured datasets.
Learning Objectives
Choose the correct BigQuery M... |
NikitaLoik/machineLearning_andrewNg | notebooks/8_anomaly_detection_recomender_system.ipynb | mit | anomalyfile_path = '../course_materials/ex8data1.mat'
anomalyData = loadmat(anomalyfile_path)
print(anomalyData.keys())
print(anomalyData['X'].shape)
print(anomalyData['Xval'].shape)
print(anomalyData['yval'].shape)
anomalyX = anomalyData['X']
plt.plot(anomalyX[:,:1], anomalyX[:,1:], 'o')
plt.axis('equal')
plt.show
"... |
IS-ENES-Data/submission_forms | test/forms/CORDEX/CORDEX_tt_tt1.ipynb | apache-2.0 | from dkrz_forms import form_widgets
form_widgets.show_status('form-submission')
"""
Explanation: CORDEX ESGF submission form
General Information
Data to be submitted for ESGF data publication must follow the rules outlined in the Cordex Archive Design Document <br /> (https://verc.enes.org/data/projects/documents/c... |
darioizzo/optimal_landing | examples/2 - Training - indirect method.ipynb | lgpl-3.0 | import matplotlib.pyplot as plt
%matplotlib inline
import sys
sys.path.append('../')
import numpy as np
import deep_control as dc
import pandas
import seaborn as sns
"""
Explanation: Training deep neural networks
@cesans
End of explanation
"""
import glob
import pickle
from tqdm import tqdm
files = glob.glob('..... |
dchandan/rebound | ipython_examples/Testparticles.ipynb | gpl-3.0 | import rebound
sim = rebound.Simulation()
sim.add(m=1.)
sim.add(m=1e-3, a=1, e=0.05)
sim.move_to_com()
sim.integrator = "whfast"
sim.dt = 0.05
sim.status()
"""
Explanation: Test particles
In this tutorial, we run a simulation with many test particles. Test particles have no mass and therefore do not perturb other par... |
julienchastang/unidata-python-workshop | failing_notebooks/Siphon Radar Server.ipynb | mit | from siphon.catalog import TDSCatalog
cat = TDSCatalog('http://thredds.ucar.edu/thredds/radarServer/catalog.xml')
list(cat.catalog_refs)
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; height:98px;">
<img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_stati... |
ianozsvald/example_conversion_of_excel_to_pandas | Load and Manipulate Sheet by Adding Logic.ipynb | mit | import pandas as pd
df = pd.read_excel("sheet_1_without_simple_logic.xls")
print(df)
# note the NaN (not-a-number) cells when we have no value
df.head(10) # this creates a Table view (non-interactive but prettier)
print("Column names:", df.columns)
print("Information about each row including data types:")
print("(n... |
eco32i/biodata | sessions/examples/CE PCA.ipynb | mit | !head ../../data/CE_exp.umi.tab
!tail ../../data/CE_exp.umi.tab
"""
Explanation: Read in expression matrix
mRNA-Seq from 10 individual C.elegans worms. Processed with CEL-Seq-pipeline (https://github.com/eco32i/CEL-Seq-pipeline)
End of explanation
"""
ce = pd.read_csv('../../data/CE_exp.umi.tab', sep='\t', skipfoot... |
gwaygenomics/pancancer | scripts/ras_differential_expression.ipynb | bsd-3-clause | import os
import sys
import pandas as pd
import scipy
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import seaborn as sns
import plotnine as gg
sys.path.insert(0, os.path.join('..', 'scripts', 'util'))
from tcga_util import integrate_copy_number
%matplotlib inline
plt.style.use('se... |
daniel-koehn/Theory-of-seismic-waves-II | 04_FD_stability_dispersion/lecture_notebooks/1_fd_stability_dispersion.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 parts of this notebook ... |
billzhao1990/CS231n-Spring-2017 | assignment2/ConvolutionalNetworks.ipynb | mit | # As usual, a bit of setup
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.cnn import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient
from cs231n.layers import *
fro... |
jmhsi/justin_tinker | data_science/courses/deeplearning2/kmeans_test.ipynb | apache-2.0 | import kmeans; reload(kmeans)
from kmeans import Kmeans
"""
Explanation: Clustering
Clustering techniques are unsupervised learning algorithms that try to group unlabelled data into "clusters", using the (typically spatial) structure of the data itself.
End of explanation
"""
n_clusters=6
n_samples =250
"""
Explana... |
fzotter/Ambisonic-Jupyter-Notebook | 02-rErVofVBAPandVBIPandMDAPonCircle.ipynb | mit | import numpy as np
from numpy.linalg import inv
def vectorpan(xys,xyls,simplices):
g=np.zeros(phils.shape[0])
for n in range(0,simplices.shape[0]):
na=simplices[n,0]
nb=simplices[n,1]
M=np.array([xyls[:,na],xyls[:,nb]]).T
gnm=np.dot(inv(M),xys)
if np.sum(gnm<-1e-3)==0:
... |
ehongdata/Network-Analysis-Made-Simple | 3. Hubs and Paths (Student).ipynb | mit | # Let's find out the number of neighbors that individual #7 has.
G.neighbors(7)
"""
Explanation: Hubs: How do we evaluate the importance of some individuals in a network?
Within a social network, there will be certain individuals which perform certain important functions. For example, there may be hyper-connected indi... |
Kaggle/learntools | notebooks/feature_engineering/raw/ex4.ipynb | apache-2.0 | # Set up code checking
from learntools.core import binder
binder.bind(globals())
from learntools.feature_engineering.ex4 import *
"""
Explanation: Introduction
In this exercise you'll use some feature selection algorithms to improve your model. Some methods take a while to run, so you'll write functions and verify the... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/interactions_anova.ipynb | bsd-3-clause | %matplotlib inline
from urllib.request import urlopen
import numpy as np
np.set_printoptions(precision=4, suppress=True)
import pandas as pd
pd.set_option("display.width", 100)
import matplotlib.pyplot as plt
from statsmodels.formula.api import ols
from statsmodels.graphics.api import interaction_plot, abline_plot
... |
DHBern/Tools-and-Techniques | lessons/07 Using the Maps API.ipynb | gpl-3.0 | import requests
"""
Explanation: Using the Google Maps API
A lot of the Google Maps geographic functionality can be got at programmatically! This can be really useful for getting information about a place, even when you don't want to show it on a map.
Here we will look at the 'Google Places' web API, and along the way... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/sandbox-1/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'sandbox-1', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: INM
Source ID: SANDBOX-1
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
fangohr/plot_vtk_matplotlib | tutorial/plot_vtk_matplotlib_tutorial.ipynb | bsd-2-clause | %matplotlib inline
# To generate the vector fields
import dolfin as df
import mshr
import numpy as np
import plot_vtk_matplotlib as pvm
# Matplotlib parameters can be tuned with rc.Params
# This library has modified values. For example:
# matplotlib.rcParams['font.size'] = 22
"""
Explanation: Plot VTK files using ... |
iutzeler/Introduction-to-Python-for-Data-Sciences | 3-3_Fancy_Visualization_with_Seaborn.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# Create some data
rng = np.random.RandomState(0)
x = np.linspace(0, 10, 500)
y = np.cumsum(rng.randn(500, 3), 0)
plt.plot(x, y)
plt.legend('one two three'.split(' '));
"""
Explanation: <table>
<tr>
<td width=15%><img src="./i... |
katychuang/ipython-notebooks | facebook_posting_activity_part2.ipynb | gpl-2.0 | from _keys.facebook import data_file
import json
with open(data_file) as json_data:
data = json.load(json_data)
print (len(data), "posts in this file")
"""
Explanation: Connecting to Facebook API (part 2)
Written by Kat Chuang @katychuang
Objective
The goal of this exercise is to connect with Facebook Graph ... |
jrg365/gpytorch | examples/03_Multitask_Exact_GPs/ModelList_GP_Regression.ipynb | mit | import math
import torch
import gpytorch
from matplotlib import pyplot as plt
%matplotlib inline
%load_ext autoreload
%autoreload 2
"""
Explanation: ModelList (Multi-Output) GP Regression
Introduction
This notebook demonstrates how to wrap independent GP models into a convenient Multi-Output GP model using a ModelLis... |
dismalpy/dismalpy | doc/notebooks/sarimax_stata.ipynb | bsd-2-clause | %matplotlib inline
import numpy as np
import pandas as pd
from dismalpy import ssm
import matplotlib.pyplot as plt
from datetime import datetime
"""
Explanation: SARIMAX: Introduction
This notebook replicates examples from the Stata ARIMA time series estimation and postestimation documentation.
First, we replicate th... |
ethen8181/machine-learning | model_selection/prob_calibration/deeplearning_prob_calibration.ipynb | mit | import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', '..', 'notebook_format'))
from formats import load_style
load_style(css_style='custom2.css', plot_style=False)
# 1. magic for inline plot
# 2. magic to print version
# 3. magic so that the notebook wi... |
Murali-group/PathLinker-Cytoscape | cytoscape-automation-example/simple_use_case.ipynb | gpl-3.0 | # necessary libraries and dependencies
import sys
from py2cytoscape.data.cyrest_client import CyRestClient
from py2cytoscape.data.style import StyleUtil
import networkx as nx
import pandas as pd
import json
import requests
print("python version: " + sys.version)
# The py2cytoscape module doesn't have a version. I ins... |
mayank-johri/LearnSeleniumUsingPython | Section 2 - Advance Python/Chapter S2.01 - Functional Programming/01.01_Functions_as_First_Class_citizens.ipynb | gpl-3.0 | a = 10
def test_function():
pass
print(id(a), dir(a))
print(id(test_function), dir(test_function))
"""
Explanation: Functions as First-Class citizens
In functional programming, functions can be treated as objects. That is, they can assigned to a variable, can be passed as arguments or even returned from other func... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
ML4DS/ML4all | P3.Python_datos/Old/Data_python_student.ipynb | mit | %matplotlib inline
# Needed to include the figures in this notebook, you can remove it
# to work with a normal script
import numpy as np
import csv
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsRegressor
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation impor... |
rashikaranpuria/Machine-Learning-Specialization | Clustering_&_Retrieval/Week2/Assignment2/.ipynb_checkpoints/1_nearest-neighbors-lsh-implementation_blank-checkpoint.ipynb | mit | import numpy as np
import graphlab
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import norm
from sklearn.metrics.pairwise import pairwise_distances
import time
from copy import copy
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Locality Sensitive Hashing
Locality Sensitive Hashing... |
barjacks/pythonrecherche | 02 jupyter notebook, intro python I/02 Jupyter Notebook & Python Intro.ipynb | mit | #dsfdskjfbskjdfbdkjbfkjdbf
#asdasd
"""
Explanation: Jupyter Notebook & Python Intro
Zuerst navigieren wir mit der Kommandozeile in den Folder, wo wir das Jupyter Notebook abspeichern wollen. Dann gehen wir in unser virtual environment und starten mit "jupyter notebook" unser Notebook auf. Jupyter Notebook ist eine Arb... |
BYUFLOWLab/MDOnotebooks | AD.ipynb | mit | from math import pi
import numpy as np
from math import sin, cos, acos, exp, sqrt
def inductionFactors(r, chord, Rhub, Rtip, phi, cl, cd, B,
Vx, Vy, useCd, hubLoss, tipLoss, wakerotation):
"""Computes induction factors and residual error at a given location
on the blade. Full details on inputs/output... |
setiQuest/ML4SETI | tutorials/Step_4_Classify_with_WatsonVR.ipynb | apache-2.0 | #!pip install --user --upgrade watson-developer-cloud
#Making a local folder to put my data.
#NOTE: YOU MUST do something like this on a Spark Enterprise cluster at the hackathon so that
#you can put your data into a separate local file space. Otherwise, you'll likely collide with
#your fellow participants.
my_tea... |
TutsWiki/source | static/QuestDB.ipynb | mit | import requests
import urllib.parse as par
q = 'create table weather'\
'(temp int,'\
'rain24H double,'\
'thunder boolean,'\
'timestamp timestamp)'\
'timestamp(timestamp)'
r = requests.get("http://localhost:9000/exec?query=" + q)
print(r.status_code)
"""
Explanation: Creating a Database in QuestDB
... |
rdipietro/tensorflow | tensorflow/tools/docker/notebooks/3_mnist_from_scratch.ipynb | apache-2.0 | from __future__ import print_function
from IPython.display import Image
import base64
Image(data=base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAAMYAAABFCAYAAAARv5krAAAYl0lEQVR4Ae3dV4wc1bYG4D3YYJucc8455yCSSIYrBAi4EjriAZHECyAk3rAID1gCIXGRgIvASIQr8UTmgDA5imByPpicTcYGY+yrbx+tOUWpu2e6u7qnZ7qXVFPVVbv2Xutfce+q7hlasmTJktSAXrnn8... |
OSGeo-live/CesiumWidget | GSOC/notebooks/Projects/CESIUM/CesiumWidget Example.ipynb | apache-2.0 | from CesiumWidget import CesiumWidget
from IPython import display
from czml_example import simple_czml, complex_czml
"""
Explanation: Cesium Widget Example
This is an example notebook to sow how to bind the Cesiumjs with the IPython interactive widget system.
End of explanation
"""
cesiumExample = CesiumWidget(width... |
jorisroovers/machinelearning-playground | datascience/NumPy.ipynb | apache-2.0 | # This is a regular python list
range(1,4)
# If you multiply or add to it, it extends the list
a = range(1, 10)
a * 2
a = range(1,11)
a + [ 11 ]
# Compare this to np.array:
import numpy as np
np.array(range(1,10))
# Multiplication is defined as multiplying each element in the array
a = np.array(range(1, 10))
a * 2... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/Print Formatting.ipynb | apache-2.0 | print 'This is a string'
"""
Explanation: Print Formatting
In this lecture we will briefly cover the various ways to format your print statements. As you code more and more, you will probably want to have print statements that can take in a variable into a printed string statement.
The most basic example of a print st... |
fantasycheng/udacity-deep-learning-project | tutorials/intro-to-tflearn/TFLearn_Digit_Recognition_Solution.ipynb | mit | # Import Numpy, TensorFlow, TFLearn, and MNIST data
import numpy as np
import tensorflow as tf
import tflearn
import tflearn.datasets.mnist as mnist
"""
Explanation: Handwritten Number Recognition with TFLearn and MNIST
In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9.
This... |
nilmtk/nilmtk | docs/manual/user_guide/disaggregation_and_metrics.ipynb | apache-2.0 | from __future__ import print_function, division
import time
from matplotlib import rcParams
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from six import iteritems
from nilmtk import DataSet, TimeFrame, MeterGroup, HDFDataStore
from nilmtk.legacy.disaggregate import CombinatorialOptimisation,... |
mdeff/ntds_2017 | projects/reports/wikipedia_hyperlink/ntds_project.ipynb | mit | import numpy as np
import seaborn as sns
import networkx as nx
import matplotlib.pyplot as plt
import operator
import community
import plotly
import plotly.graph_objs as go
import plotly.plotly as py
from networkx.drawing.nx_agraph import graphviz_layout
from scipy import linalg, cluster, sparse
from tqdm import tqdm_... |
cysuncn/python | study/machinelearning/tensorflow/TensorFlow-Examples-master/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb | gpl-3.0 | # Import MNIST
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
# Load data
X_train = mnist.train.images
Y_train = mnist.train.labels
X_test = mnist.test.images
Y_test = mnist.test.labels
"""
Explanation: MNIST Dataset Introduction
Most examples ... |
phoebe-project/phoebe2-docs | development/tutorials/ltte.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Rømer and Light Travel Time Effects (ltte)
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 # unit... |
squishbug/DataScienceProgramming | 05-Operating-with-Multiple-Tables/AdvancedTables_orig-Copy1.ipynb | cc0-1.0 | import pandas as pd
import numpy as np
"""
Explanation: Advanced Tables
Why are databases so complex?
Data stored in a database may be split into multiple tables, each containing multiple columns. A column stores a single attribute of the data; a table stores a collection of related attributes.
The database also keep... |
jasdumas/jasdumas.github.io | post_data/final_project_jasmine_dumas.ipynb | mit | ## load libraries
import sys
from numpy import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import operator
%matplotlib inline
from sklearn.feature_extraction import DictVectorizer
from sklearn import preprocessing
from sklearn import neighbors, tree, naive_bayes
from sklearn.metrics import ... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: INM
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
adolfoguimaraes/machinelearning | Introduction/Tutorial01_HelloWorld.ipynb | mit | # Vamos transformar as informações textuais em números: (0) irregular, (1) Suave.
# Os labels também serão transformados em números: (0) Maçã e (1) Laranja
features = [[140, 1], [130, 1], [150, 0], [170, 0]]
labels = [0, 0, 1, 1]
"""
Explanation: Tutorial 01 - Hello World em Aprendizagem de Máquina
Para começar o nos... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session14/Day2/DeeplearningBlank.ipynb | mit | # this module contains our dataset
!pip install astronn
#this is pytorch, which we will use to build our nn
import torch
#Standards for plotting, math
import matplotlib.pyplot as plt
import numpy as np
#for our objective function
from sklearn.metrics import accuracy_score, confusion_matrix, ConfusionMatrixDisplay
"""
... |
manuela98/Emergencias_911_ | Codigo/Documentación.ipynb | gpl-3.0 | %%bash
python descarga.py
"""
Explanation: Instalación
Para el correcto funcionamiento del código realizado para este proyecto es necesario seguir las siguientes indicaciones:
1. Instalar los paquetes beautifulsoup4 y Requests en Python:
+ pip install beautifulsoup4 Requests.
2. Instalar Numpy.
+ sudo pip install... |
mrcinv/moodle-questions | python/example_images.ipynb | gpl-3.0 | %pylab inline
from moodle import *
num_q(-1.2,0.001), multi_q([("12",50),("23",50),("34",-100)])
"""
Explanation: Exercise sample: images
Change this sample according to your needs. Run all the cells, and upload resulting .xml file to Moodle.
Auxilary functions
End of explanation
"""
from scipy.interpolate import in... |
karlstroetmann/Formal-Languages | Python/Test-NFA-2-DFA.ipynb | gpl-2.0 | %run NFA-2-DFA.ipynb
"""
Explanation: This notebook is used to test the conversion of non-deterministic <span style="font-variant:small-caps;">Fsm</span>s into deterministic <span style="font-variant:small-caps;">Fsm</span>s.
End of explanation
"""
%run FSM-2-Dot.ipynb
States = { 'q' + str(i) for i in range(8) }
St... |
longyangking/ML | Statistics/Distribution.ipynb | lgpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
n,p=50,0.1
plt.hist(np.random.binomial(n,p,size=5000))
plt.show()
"""
Explanation: Statistical Distribution
Discrete distribution
Contious distribution
Sample(small) distribution
Discrete Distribution
Binomial distribution $B(n,p)$
Hypergeometr... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/sandbox-1/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'sandbox-1', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: SANDBOX-1
Sub-Topics: Radiative Forcings.
Pro... |
trangel/Insight-Data-Science | general-docs/.ipynb_checkpoints/python_sql_dev_setups-checkpoint.ipynb | gpl-3.0 | ## Python packages - you may have to pip install sqlalchemy, sqlalchemy_utils, and psycopg2.
from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database
import psycopg2
import pandas as pd
"""
Explanation: Dev Setups -- Connecting Python and SQL
The purpose of this IPython notebo... |
bukosabino/btctrading | XGBoost_next_row.ipynb | mit | # get_data.get('data/datas.csv', period=settings.PERIOD, market=settings.MARKET)
"""
Explanation: Get Data
API: http://bitcoincharts.com/charts
period = ['1-min', '5-min', '15-min', '30-min', 'Hourly', '2-hour', '6-hour', '12-hour', 'Daily', 'Weekly']
market = ['krakenEUR', 'bitstampUSD'] -> list of markets: https://b... |
roatienza/Deep-Learning-Experiments | versions/2022/autoencoder/python/colorize_pytorch_demo.ipynb | mit | import torch
import torchvision
import wandb
import time
from torch import nn
from einops import rearrange, reduce
from argparse import ArgumentParser
from pytorch_lightning import LightningModule, Trainer, Callback
from pytorch_lightning.loggers import WandbLogger
from torch.optim import Adam
from torch.optim.lr_sche... |
voyageth/udacity-Deep_Learning_Foundations_Nanodegree | sentiment-rnn/Sentiment_RNN.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
dvirsamuel/MachineLearningCourses | Visual Recognision - Stanford/assignment3/ImageGradients.ipynb | gpl-3.0 | # As usual, a bit of setup
import time, os, json
import numpy as np
import skimage.io
import matplotlib.pyplot as plt
from cs231n.classifiers.pretrained_cnn import PretrainedCNN
from cs231n.data_utils import load_tiny_imagenet
from cs231n.image_utils import blur_image, deprocess_image
%matplotlib inline
plt.rcParams... |
MatthewDaws/OSMDigest | notebooks/Pythonify.ipynb | mit | import osmdigest.pythonify as pythonify
import os
basedir = os.path.join("/media/disk", "OSM_Data")
filename = "illinois-latest.osm.xz"
"""
Explanation: Pythonify
If you have a reasonable amount of ram, then it's possible to load quite big XML files fully into memory and to general python dictionaries from them. The... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.