repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
GEMScienceTools/oq-subduction | openquake/sub/notebooks/multiple_cross_sections.ipynb | agpl-3.0 | fin = open('./../data/trench.xy', 'r')
trench = []
for line in fin:
aa = re.split('\s+', re.sub('^\s+', '', line))
trench.append((float(aa[0]), float(aa[1])))
fin.close()
trench = Trench(numpy.array(trench))
cat = pickle.load(open("./../data/catalogue_ext_cac.p", "rb" ))
"""
Explanation: Resources
http://ni... |
phoebe-project/phoebe2-docs | 2.3/tutorials/ltte.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Rømer and Light Travel Time Effects (ltte)
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # unit... |
blackjax-devs/blackjax | examples/use_with_pymc.ipynb | apache-2.0 | import jax
import numpy as np
import pymc as pm
import pymc.sampling_jax
import blackjax
print(f"Running on PyMC v{pm.__version__}")
"""
Explanation: Use BlackJAX with PyMC
Author: Kaustubh Chaudhari
BlackJAX can take any log-probability function as long as it is compatible with JAX's JIT. In this notebook we show h... |
flothesof/presidentielles2017 | ipynb/Text mining des programmes.ipynb | mit | from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
from ipywidgets import interact
def make_df_from_props_sources(props_sources):
"Makes a big dataframe from props_sources."
dfs = []
for key in props_sources:
df = pd.DataFrame(props_sources[key], columns=['proposition'])
... |
napsternxg/DataMiningPython | Optical digits Viewer.ipynb | gpl-3.0 | #training data
#fn = 'data/ocr/optdigits.tra'
#testing data
fn = 'data/ocr/optdigits.tes'
header="x11,x12,x13,x14,x15,x16,x17,x18,x21,x22,x23,x24,x25,x26,x27,x28,x31,x32,x33,x34,x35,x36,x37,x38,x41,x42,x43,x44,x45,x46,x47,x48,x51,x52,x53,x54,x55,x56,x57,x58,x61,x62,x63,x64,x65,x66,x67,x68,x71,x72,x73,x74,x75,x76,x77,... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-2/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-2', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-2
Topic: Landice
Sub-Topics: Gla... |
outlace/Machine-Learning-Experiments | VariableOutput.ipynb | mit | import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[0,0],[0,0,0],[0,0,0,0]])
def sigmoid(x):
return np.matrix(1.0 / (1.0 + np.exp(-x)))
def relu(x):
alpha = 0.01
return np.maximum(x, (alpha * x))
#initialize random weights
numIn, numHid, numOut = 2, 3, 2
theta1 = np.array( 0.5 ... |
tpin3694/tpin3694.github.io | blog/.ipynb_checkpoints/aisle_seat_probabilities-checkpoint.ipynb | mit | # Import required modules
import pandas as pd
import numpy as np
# Set plots to display in the iPython notebook
%matplotlib inline
"""
Explanation: Title: What Is The Probability An Economy Class Seat Is An Aisle Seat?
Slug: aisle_seat_probabilities
Summary: What Is The Probability An Economy Class Seat Is An Aisle S... |
nehal96/Deep-Learning-ND-Exercises | Intro to TensorFlow/tf_neural_network_lab.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... |
tensorflow/docs-l10n | site/ko/r1/tutorials/keras/basic_text_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... |
eds-uga/csci1360-fa16 | lectures/L9.ipynb | mit | def pet_names(name1, name2):
print("Pet 1: {}".format(name1))
print("Pet 2: {}".format(name2))
pet1 = "King"
pet2 = "Reginald"
pet_names(pet1, pet2)
pet_names(pet2, pet1)
"""
Explanation: Lecture 9: Functions II
CSCI 1360: Foundations for Informatics and Analytics
Overview and Objectives
In the previous lectu... |
pvillela/ServerSim | .ipynb_checkpoints/TutorialAndExample-checkpoint.ipynb | mit | # %load simulate_deployment_scenario.py
from __future__ import print_function
from typing import List, Tuple, Sequence
from collections import namedtuple
import random
import simpy
from serversim import *
def simulate_deployment_scenario(num_users, weight1, weight2, server_range1,
... |
mne-tools/mne-tools.github.io | 0.17/_downloads/e327516e16a734ff2984dcae335b2433/plot_left_cerebellum_volume_source.ipynb | bsd-3-clause | # Author: Alan Leggitt <alan.leggitt@ucsf.edu>
#
# License: BSD (3-clause)
import numpy as np
from scipy.spatial import ConvexHull
from mayavi import mlab
from mne import setup_source_space, setup_volume_source_space
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_pa... |
atulsingh0/MachineLearning | scikit-learn/Matplotlib_Tutorial_02.ipynb | gpl-3.0 | # import
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# generating some data points
X = np.linspace(-np.pi, np.pi, 20, endpoint=True)
C, S = np.cos(X), np.sin(X)
# Simply plotting these in same plot
plt.plot(X, C,
X, S)
plt.plot(X, C,
X, C, 'oy',
X, S,
X... |
MatteusDeloge/opengrid | notebooks/Demo_WaterGasElekVisualisation.ipynb | apache-2.0 | import os
import sys
import inspect
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.dates import HourLocator, DateFormatter, AutoDateLocator
import datetime as dt
import pytz
import pandas as pd
import pdb
import tmpo
from opengrid import config
from opengrid.library import houseprint
c = config.Co... |
aam-at/tensorflow | tensorflow/lite/g3doc/models/style_transfer/overview.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... |
mwaskom/seaborn | doc/nextgen/demo.ipynb | bsd-3-clause | import seaborn.objects as so
"""
Explanation: Demonstration of next-generation seaborn interface
The basic interface
The new interface exists as a set of classes that can be acessed through a single namespace import:
End of explanation
"""
import seaborn
seaborn.set_theme()
"""
Explanation: This is a clean namespac... |
t--wagner/python_in_the_lab | 04_numpy.ipynb | gpl-3.0 | ary = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
ary
"""
Explanation: Numpy
Creation
From lists
End of explanation
"""
np.linspace(0, 1, 101)
"""
Explanation: With linspace, always useful for plotting data
End of explanation
"""
np.arange(0, 1, 0.01)
"""
Explanation: If you prefer the stepsize
End of explanation
"... |
dtamayo/reboundx | ipython_examples/InnerDiskEdge.ipynb | gpl-3.0 | import rebound
import reboundx
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Inner Disk Edge
This provides a useful prescription for when you need an inner planet trap to halt migration (though it should not be considered a realistic model of the inner edge of a disk).
End of explanation
"""
si... |
Think-Machine/Zillow-Demo | Data Preprocessing.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
"""
Explanation: Data preprocessing
Overview
Before we get deeply involved in this project, we need to get our data into a useable form. In this notebook we walk through that process for one file, and we will then use that logic to create a module that will go through the rest of... |
mroberge/hydrofunctions | docs/notebooks/DailyMean_vs_Instant.ipynb | mit | # Start our Jupyter Notebook the usual way:
import hydrofunctions as hf
import matplotlib.pyplot as plt
print(hf.__version__)
%matplotlib inline
"""
Explanation: Daily Mean vs. Instant
The NWIS provides continuous discharge data in two different formats: 'Daily Mean Discharge' and 'Instantaneous Values'.
The Daily Mea... |
rkora/MetaKaggle | Meta Kaggle - Team sizes of competition winners.ipynb | apache-2.0 | import pandas as pd
import sqlite3
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
cnx = sqlite3.connect('database.sqlite')
"""
Explanation: In this notebook, I am exploring the Meta Kaggle data (https://www.kaggle.com/c/meta-kaggle). The dataset is available in both csv and sqlite database format... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/06_structured/5_train.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.5
# change these to try this notebook out
BUCKET = 'cloud-training-demos-ml'
PROJECT = 'cloud-training-demos'
REGION = 'us-central1'
import os
os.environ['BUCKET'... |
FlorentSilve/Udacity_ML_nanodegree | projects/digit_recognition/digit_recognition.ipynb | mit | # 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 matplotlib.pyplot as plt
import numpy as np
import random
import os
import sys
import tarfile
import cPickle
import gzip
import theano
import theano.tensor as T
from ... |
andfanilo/wikipediaforecast | notebooks/0.3_draft_evaluate_submission.ipynb | mit | import numpy as np
import pandas as pd
df = pd.read_csv('../data/processed/df.csv', encoding='iso-8859-1')
keys = pd.read_csv('../data/raw/key_1.csv.zip', encoding='iso-8859-1', compression='zip')
sample_submission = pd.read_csv('../data/raw/sample_submission_1.csv.zip', encoding='iso-8859-1', compression='zip')
df.h... |
radical-cybertools/supercomputing2015-tutorial | 01_hadoop/MapReduce.ipynb | apache-2.0 | HADOOP_EXAMPLES="/usr/hdp/2.3.2.0-2950/hadoop-mapreduce/hadoop-mapreduce-examples.jar"
HADOOP_STREAMING="/usr/hdp/2.3.2.0-2950/hadoop-mapreduce/hadoop-streaming.jar"
"""
Explanation: Running Jobs on Hadoop
The aim of this exercise is to become familiar with Hadoop. We will show how to run Hadoop application and create... |
Kaggle/learntools | notebooks/data_viz_to_coder/raw/ex7.ipynb | apache-2.0 | import pandas as pd
pd.plotting.register_matplotlib_converters()
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
print("Setup Complete")
"""
Explanation: Now it's time for you to demonstrate your new skills with a project of your own!
In this exercise, you will work with a dataset of your choo... |
mne-tools/mne-tools.github.io | dev/_downloads/8de61cd59c9d83353f96a413e8484686/compute_mne_inverse_raw_in_label.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import apply_inverse_raw, read_inverse_operator
print(__doc__)
data_path = sample.data_path()
fname_inv = (
data_path / 'MEG' / 's... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/image_enhancing.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... |
openaps/openomni | analysis/crcplay.ipynb | mit |
poly = 0x104c1
crc = crcmod.mkCrcFun(poly, initCrc=0, xorOut=0x0, rev=False)
# Now consider two CRC values obtained from two 1-bit messages,
# where the 1 bits are in adjacent positions. The resulting CRCs
# will differ by just one shift-xor cycle. To be precise, if
# C1 corresponds to the message with a 1 in posit... |
danielgoncalvesti/BIGDATA2017 | Atividade04/Lab4b_classificacao.ipynb | gpl-3.0 | # Data for manual OHE
# Note: the first data point does not include any value for the optional third feature
sampleOne = [(0, 'mouse'), (1, 'black')]
sampleTwo = [(0, 'cat'), (1, 'tabby'), (2, 'mouse')]
sampleThree = [(0, 'bear'), (1, 'black'), (2, 'salmon')]
sampleDataRDD = sc.parallelize([sampleOne, sampleTwo, sampl... |
luisvalesilva/random_forests | random_forests.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
# Generate data
from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples=300, n_features=2, centers=3,
cluster_std=4, random_state=42)
# Plot data
plt.plot(X[:, 0][y==0], X[:, 1][y==0], "yo", marker='.')
plt.plot(X[:, 0][y==1], X[:, 1][y=... |
robertoalotufo/ia898 | src/ellipse.ipynb | mit | import numpy as np
def ellipse(s, r, c, theta=0):
rows, cols = s[0], s[1]
rr0, cc0 = c[0], c[1]
rr, cc = np.meshgrid(range(rows), range(cols), indexing='ij')
rr = rr - rr0
cc = cc - cc0
cos = np.cos(theta)
sen = np.sin(theta)
i = cos/r[1]
j = sen/r[0]
m = -sen/r[1]
n = co... |
adelavega/neurosynth-mfc | clustering.ipynb | mit | import seaborn as sns
from nilearn import plotting as niplt
from matplotlib.colors import ListedColormap
import numpy as np
"""
Explanation: Clustering analysis
In this first notebook, we conduct a k-means clustering analysis on using an included MFC mask.
Fortunately, Neurosynth includes a set of functions to make th... |
fascow/bruker_compass_scripts | LibraryEditor/Bruker_LibraryEditor_Export_Parser.ipynb | mit | source = 'Example.library'
destination = 'Example.json'
"""
Explanation: Bruker LibraryEditor Export Parser
Read .library files exported from the Bruker Compass LibraryEditor 4.2 and save as JSON
End of explanation
"""
import re
import codecs
import json
def dpstr2dict(filename, data_points_string, meta_count):
... |
mne-tools/mne-tools.github.io | 0.18/_downloads/7df5cd97aa959dd7e2627aba5e552081/plot_forward.ipynb | bsd-3-clause | import os.path as op
import mne
from mne.datasets import sample
data_path = sample.data_path()
# the raw file containing the channel location + types
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
# The paths to Freesurfer reconstructions
subjects_dir = data_path + '/subjects'
subject = 'sample'
"""
Expl... |
wllmtrng/udacity_data_analyst_nanodegree | P2 Statistical Significance/.ipynb_checkpoints/P2_Analyzing_the_NYC_Subway_Dataset-checkpoint.ipynb | mit | df = pd.read_csv("./turnstile_weather_v2.csv")
df_rain = df[df['rain'] == 1]
df_no_rain = df[df['rain'] == 0]
df_rain_entries = df_rain.ENTRIESn_hourly
df_no_rain_entries = df_no_rain.ENTRIESn_hourly
gp.ggplot(gp.aes(x="ENTRIESn_hourly", fill='rain',color='rain'), data=df) +\
gp.geom_histogram(alpha=0.6, binwidt... |
vanheck/blog-notes | Essentials/Exponential weighted moving average.ipynb | mit | import datetime
start = datetime.datetime(2018, 1, 1)
end = datetime.datetime(2019, 1, 1)
spy_data = pdr.data.DataReader('SPY', 'yahoo', start, end)
spy_data.drop(['High', 'Low', 'Open', 'Close', 'Volume'], axis=1, inplace=True) # these columns are not needed
spy_data.head(5)
"""
Explanation: Exponential Weighted Mov... |
ericmjl/Network-Analysis-Made-Simple | archive/4-cliques-triangles-structures-student.ipynb | mit | # Load the network.
G = cf.load_physicians_network()
# Make a Circos plot of the graph
from nxviz import CircosPlot
c = CircosPlot(G)
c.draw()
"""
Explanation: Load Data
As usual, let's start by loading some network data. This time round, we have a physician trust network, but slightly modified such that it is undir... |
rldotai/rlbench | rlbench/simple_demo_errors_off_policy.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import algos
import features
import parametric
import policy
import chicken
from agents import OffPolicyAgent, OnPolicyAgent
from rlbench import *
"""
Explanation: Testing Algorithm Performance in Off-Policy Sett... |
yedivanseven/LPDE | LegPolyDE-1D_2.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import seaborn as sbn
import numpy as np
import numpy.polynomial.legendre as npl
from scipy.optimize import minimize
"""
Explanation: ORTHOGONAL POLYNOMIAL DENSITY ESTIMATION
Preliminaries
Imports
End of explanation
"""
%matplotlib notebook
sbn.set_style('white')
legend_params = {'l... |
fangohr/oommf-python | new/notebooks/standard_problem4.ipynb | bsd-2-clause | !rm -rf standard_problem4/
"""
Explanation: Micromagnetic standard problem 4
Author: Marijan Beg
Date: 11 May 2016
Problem specification
The simulated sample is a thin film cuboid with dimensions:
- length $L_{x} = 500 \,\text{nm}$,
- width $L_{y} = 125 \,\text{nm}$, and
- thickness $t = 3 \,\text{nm}$.
The material p... |
aylward/ITKTubeTK | examples/archive/Demo-TubeNumPyArrayAndPropertyHistograms.ipynb | apache-2.0 | import os
import sys
from itk import tubes_from_file
tubes = tubes_from_file("data/Normal071-VascularNetwork.tre")
"""
Explanation: This notebook illustrates the TubeTK tube NumPy array data structure and how to create histograms of the properties of a VesselTube.
First, import the function for reading a tube file i... |
mne-tools/mne-tools.github.io | stable/_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 ... |
mkinet/mkinet.github.io | _upcoming_posts/2017-07-18.ipynb | mit | from math import *
import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Some simple non-linear regression models
Here I will explore some basic extensions of the linear regression to perform non-linear regressions.
End of explanation
"... |
donaghhorgan/COMP9033 | labs/07a - Decision tree classification.ipynb | gpl-3.0 | import pandas as pd
from sklearn.dummy import DummyClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import classification_report
from sklearn.model_selection import GridSearchCV, StratifiedKFold, cross_val_predict
from sklea... |
arviz-devs/arviz | doc/source/user_guide/pystan2_refitting.ipynb | apache-2.0 | import arviz as az
import pystan
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: (pystan2_refitting)=
Refitting PyStan (2.x) models with ArviZ
ArviZ is backend agnostic and therefore does not sample directly. In order to take advantage of algorithms that require refitting models several times, Arvi... |
inakic/matsoft | basemap.ipynb | unlicense | # osnovne biblioteke koje ćemo koristiti
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
%matplotlib inline
import numpy as np
"""
Explanation: Basemap
Basemap je dio Matplotlib biblioteke s funkcijama i metodama za pravljenje geografskih karata. Korištenje Basemapa ilustrirat ćemo na nekim pr... |
bassio/omicexperiment | doc/02_experiment_transforms.ipynb | bsd-3-clause | %load_ext autoreload
%autoreload 2
#Load our data
from omicexperiment.experiment.microbiome import MicrobiomeExperiment
mapping = "example_map.tsv"
biom = "example_fungal.biom"
tax = "blast_tax_assignments.txt"
exp = MicrobiomeExperiment(biom, mapping,tax)
exp.data_df
exp.mapping_df
"""
Explanation: Experiment tr... |
jakobrunge/tigramite | tutorials/tigramite_tutorial_pcmci_fullci.ipynb | gpl-3.0 | # Imports
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
%matplotlib inline
## use `%matplotlib notebook` for interactive figures
# plt.style.use('ggplot')
import sklearn
import tigramite
from tigramite import data_processing as pp
from tigramite.toymodels import structural_causal_proce... |
karlstroetmann/Algorithms | Python/Chapter-10/Union-Find-Naive.ipynb | gpl-2.0 | def union_find(M, R):
print(f'R = {R}')
P = [ {x} for x in M ] # the trivial partition of M
print(f'P = {P}')
for x, y in R:
A = find(x, P) # find A
B = find(y, P) # find B
if A != B:
print(f'{x} ≅ {y}: combining {set(A)} and {set(B)}')
P.remove(A)
... |
Kaggle/learntools | notebooks/geospatial/raw/tut3.ipynb | apache-2.0 | #$HIDE_INPUT$
import pandas as pd
import geopandas as gpd
import math
import folium
from folium import Choropleth, Circle, Marker
from folium.plugins import HeatMap, MarkerCluster
"""
Explanation: Introduction
In this tutorial, you'll learn how to create interactive maps with the folium package. Along the way, you'l... |
tensorflow/docs-l10n | site/zh-cn/tutorials/customization/custom_training_walkthrough.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... |
sadahanu/DataScience_SideProject | Movie_Rating/.ipynb_checkpoints/Culture_difference_movie_rating-checkpoint.ipynb | mit | imdb_dat = pd.read_csv("movie_metadata.csv")
imdb_dat.info()
"""
Explanation: Data from <font color = "red"> the "IMDB5000"</font> database
End of explanation
"""
import requests
import re
from bs4 import BeautifulSoup
import time
import string
# return the douban movie rating that matches the movie name and year
# ... |
BeatHubmann/17F-U-DLND | first-neural-network/DLND Your first neural network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
metpy/MetPy | v0.11/_downloads/3f80eaf969d597174a3c39544b2f3037/Mesonet_Stationplot.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, StationPlot
from metpy.units import units
"""
Explanation: Mesonet Station Plot
Make a surface sta... |
ondrejiayc/StatisticalMethods | examples/XrayImage/Modeling.ipynb | gpl-2.0 | from __future__ import print_function
import astropy.io.fits as pyfits
import astropy.visualization as viz
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 10.0)
"""
Explanation: Forward Modeling the X-ray Image data
In this notebook, we'll take a closer loo... |
dipanjanS/BerkeleyX-CS100.1x-Big-Data-with-Apache-Spark | Week 5 - Introduction to Machine Learning with Apache Spark/lab4_machine_learning_student.ipynb | mit | import sys
import os
from test_helper import Test
baseDir = os.path.join('data')
inputPath = os.path.join('cs100', 'lab4', 'small')
ratingsFilename = os.path.join(baseDir, inputPath, 'ratings.dat.gz')
moviesFilename = os.path.join(baseDir, inputPath, 'movies.dat')
"""
Explanation: version 1.0.2
+
Introduction to M... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/24_embeddings_and_word2vec/notebooks/01-embeddings/Skip-Gram_word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
sempwn/ABCPRC | Tutorial_SIS.ipynb | mit | %pylab inline
import ABCPRC as prc
import seaborn as sns
import scipy.stats as stats
"""
Explanation: Stochastic SIS ABC fitting example
End of explanation
"""
def createData(beta,gamma,n=100,T=100,I0=1):
S,I = np.zeros(T),np.zeros(T)
S[0] = n-I0
I[0] = I0
eps=0.1
for i in np.arange(1,T):
... |
scikit-multilearn/scikit-multilearn | docs/source/labelrelations.ipynb | bsd-2-clause | from skmultilearn.dataset import load_dataset
X_train, y_train, feature_names, label_names = load_dataset('emotions', 'train')
X_test, y_test, _, _ = load_dataset('emotions', 'test')
"""
Explanation: Exploring Label Relations
Multi-label classification tends to have problems with overfitting and underfitting classifie... |
DEIB-GECO/PyGMQL | examples/notebooks/02b_Mixing_Local_Remote_Processing_COMPLETE.ipynb | apache-2.0 | import gmql as gl
gl.set_remote_address("http://gmql.eu/gmql-rest/")
gl.login()
"""
Explanation: Mixing local and remote processing
In this tutorial you will learn:
1. How to connect to a remote GMQL instance and run remote queries
2. How to interleave remote and local GMQL processing
3. How to manipulate the GDatafr... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_tf_lcmv.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import compute_covariance
from mne.datasets import sample
from mne.event import make_fixed_length_events
from mne.beamformer import tf_lcmv
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = sample.data_path... |
cdpetty/Pixal | VidAnalysis/Dalton_RF.ipynb | apache-2.0 | import pandas as pd
from os import path
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from sklearn.ensemble import ExtraTreesClassifier
import sklearn
# Edit path if need be (shouldn't need to b/c we all have the same folder structure)
CSV_PATH_1 = '../Videos/all_data'
CSV_PATH_2 = '../Videos2... |
robertoalotufo/ia898 | master/tutorial_pehist_2.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import sys,os
ia898path = os.path.abspath('/etc/jupyterhub/ia898_1s2017/')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
hout = np.concatenate((np.arange(128),np.arange(128,0,-1)... |
recepkabatas/Spark | 5_word2vec.ipynb | apache-2.0 | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
import collections
import math
import numpy as np
import os
import random
import tensorflow as tf
import urllib
import zipfile
from matplotlib import pylab
from sklearn.manifold import TSNE
"""
Explanation: Dee... |
jackbrucesimpson/Machine-Learning-Workshop | images_features.ipynb | mit | import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
%matplotlib inline
"""
Explanation: Image and feature analysis
Let's start by loading the libraries we'll need:
End of explanation
"""
rect_image = cv2.imread('data/I/27.png', cv2.IMREAD_GRAYSCALE)
circle_image = cv2.imread(... |
quaquel/EMAworkbench | docs/source/indepth_tutorial/general-introduction.ipynb | bsd-3-clause | import math
# more or less default imports when using
# the workbench
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.optimize import brentq
def get_antropogenic_release(xt, c1, c2, r1, r2, w1):
"""
Parameters
----------
xt : float
po... |
kuo77122/deep-learning-nd | Lesson14-Sentiment Analysis/sentiment-network/Sentiment_Classification_Projects.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
TomTranter/OpenPNM | examples/percolation/Part D - Meniscus Model Comparison.ipynb | mit | import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import sympy as syp
from sympy import lambdify, symbols
from sympy import atan as sym_atan
from sympy import cos as sym_cos
from sympy import sin as sym_sin
from sympy import sqrt as sym_sqrt
from sympy import pi as sym_pi
from ipyw... |
wbinventor/openmc | examples/jupyter/candu.ipynb | mit | %matplotlib inline
from math import pi, sin, cos
import numpy as np
import openmc
"""
Explanation: In this example, we will create a typical CANDU bundle with rings of fuel pins. At present, OpenMC does not have a specialized lattice for this type of fuel arrangement, so we must resort to manual creation of the array ... |
mpacer/nb_struct2app | course101/release/ps1/problem1.ipynb | mit | example_belief = {'a', 'b'}
"""
Explanation: The idea of reasoning by following simple rules provides an attractively straightforward characterization of cognition. However, production systems can be very difficult to design in ways that are guaranteed to always work. In this problem, you will write some functions to ... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/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', 'mohc', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: MOHC
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radi... |
edarin/ENSAE_projects | TopicModelingLDA/StudyNYDSK.ipynb | gpl-3.0 | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Latent Dirichlet Allocation applied to real data
End of explanation
"""
#get raw data
import xml.etree.ElementTree as ET
tree = ET.parse('../dataset/nysk.xml')
root = tree.getroot()
root1 = root.getchildren()[150].getchildren()
texts=[... |
leriomaggio/deep-learning-keras-tensorflow | 2. Deep Learning Frameworks/2.3 Introduction to Keras.ipynb | mit | from kaggle_data import load_data, preprocess_data, preprocess_labels
import numpy as np
import matplotlib.pyplot as plt
X_train, labels = load_data('../data/kaggle_ottogroup/train.csv', train=True)
X_train, scaler = preprocess_data(X_train)
Y_train, encoder = preprocess_labels(labels)
X_test, ids = load_data('../dat... |
voyageth/udacity-Deep_Learning_Foundations_Nanodegree | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
balarsen/pymc_learning | Learning/CountingStats1.ipynb | bsd-3-clause | samples = tb.logspace(1, 10000, 10)
fore = [np.random.binomial(100, 0.50, size=v) for v in samples]
print(tb.logspace(1, 1000, 10))
for v in fore[::-1]:
h = np.histogram(v, 20)
plt.hist(v, 20, label='{0}'.format(np.floor(len(v))))
plt.yscale('log')
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
... |
finalwind/deep_fantasy | scrape_nba.ipynb | mit | urls = soup_teams.find_all(href = re.compile('/nba/teams/stats'))
team_urls = [base_url + url['href'] for url in urls]
urls = soup_teams.find_all(href = re.compile('http://www.espn.com/nba/team/_/name/'))
team_name = [url['href'].split('/')[-1] for url in urls]
team_name_abbrv = [url.split('=')[-1] for url in team_urls... |
open-forcefield-group/openforcefield | examples/deprecated/testing/OE_bondorder_testing.ipynb | mit | # NBVAL_SKIP
from openeye.oechem import *
mol = OEMol()
#smiles = 'CC(c1ccccc1)C(=O)[O-]'
smiles = 'C[NH2+]CC(c1ccccc1)C(=O)[O-]'
OEParseSmiles(mol, smiles)
OEAddExplicitHydrogens(mol)
OEAssignAromaticFlags(mol)
OETriposAtomNames(mol)
"""
Explanation: Test creation of molecules in OpenEye
This is to help with https://... |
malogrisard/NTDScourse | toolkit/01_demo_acquisition_exploration.ipynb | mit | # While packages are usually imported at the top, they can
# be imported wherever you prefer, in whatever scope.
import numpy as np
# Show matplotlib graphs inside the notebook.
%matplotlib inline
import sys
print('Python {}.{}'.format(sys.version_info.major, sys.version_info.minor))
"""
Explanation: A Python Tour o... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/text_classification/solutions/reusable_embeddings.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: Reusable Embeddings
Learning Objectives
1. Learn how to use a pre-trained TF Hub text modules to generate sentence vectors
1. Learn how to incorporate a pre-trained TF-Hub module into a Keras model
1. Lea... |
mattcieslak/MITTENS | notebooks/GraphBuilding.ipynb | bsd-2-clause | from mittens import MITTENS
mitn = MITTENS(fibgz_file="101915/data/input/101915.src.gz.odf8.f5rec.fy.gqi.1.25.fib.gz")
"""
Explanation: Processing a HCP Dataset
Here we have run an HCP dataset through DSI Studio using the recommended parameters from the documentation. This includes
Gradient unwarping
Motion/Eddy corr... |
syednasar/datascience | deeplearning/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... |
jppreti/AlphaCosmeticos | Copy_of_LP20221.ipynb | mit | nome1 = "Maria" # criando uma variável texto
idade1 = 42
nome2 = input("Digite seu nome: ") # pedindo dados ao usuário
idade2 = int(input("Digite sua idade: "))
print(type(idade2)) # verificando o tipo da variável
print(ida... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session14/Day1/Clustering.ipynb | mit | from sklearn import datasets
iris = # complete
"""
Explanation: Clustering
Version 0.1
By AA Miller (Northwestern/CIERA)
03 Mar 2022
In this notebook, we will explore the use of clustering methods in low dimensional data spaces.
Problem 1) Load and plot Iris data set
Problem 1a
Import the iris data set from scikit-... |
tensorflow/docs-l10n | site/ja/tutorials/distribute/multi_worker_with_estimator.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... |
deep-learning-indaba/practicals2017 | practical1_SOLUTION.ipynb | mit | import numpy as np # Numpy is an efficient linear algebra library.
import matplotlib.pyplot as plt # Matplotlib is used to generate plots of data.
centre = 1.0
points_in_class = 20
# Setting a random seed allows us to recreate the same data each time we run the cell.
np.random.seed(0)
# Generate ra... |
hetaodie/hetaodie.github.io | assets/media/uda-ml/supervisedlearning/jc/为慈善机构寻找捐助者/.ipynb_checkpoints/finding_donors-checkpoint.ipynb | mit | # TODO:总的记录数
n_records = len(data)
# # TODO:被调查者 的收入大于$50,000的人数
n_greater_50k = len(data[data.income.str.contains('>50K')])
# # TODO:被调查者的收入最多为$50,000的人数
n_at_most_50k = len(data[data.income.str.contains('<=50K')])
# # TODO:被调查者收入大于$50,000所占的比例
greater_percent = (n_greater_50k / n_records) * 100
# 打印结果
print ("To... |
jhillairet/ICRH | notebooks/WEST/Capacitor/Capacitor Equivalent Circuit.ipynb | mit | %matplotlib inline
import skrf as rf
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
rf.stylely()
"""
Explanation: In this notebook, we try to deduce the equivalent circuit of a WEST ICRH capacitor which has been simulated under HFSS.
End of explanation
"""
capas = rf.read_all... |
herruzojm/udacity-deep-learning | embeddings/.ipynb_checkpoints/Skip-Grams-Solution-checkpoint.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
samuelsinayoko/kaggle-housing-prices | ols/data_exploration_categorical_features.ipynb | mit | target = pd.read_csv('../data/train_target.csv')
target.describe()
"""
Explanation: Sale price distribution
First step is to look at the target sale price for the training data set, i.e. the column we're trying to predict.
End of explanation
"""
target = target / 1000
logtarget = np.log1p(target)
"""
Explanation... |
VectorBlox/PYNQ | Pynq-Z1/notebooks/examples/overlay_integration.ipynb | bsd-3-clause | BASE_ADDRESS = 0x40000000
CMD_OFFSET = 0x800
ACK_OFFSET = 0x804
RAW_DATA_OFFSET = 0
PROCESSED_DATA_OFFSET = 0x400
from pynq import MMIO
class my_new_accelerator:
"""Brief description of Module goes here.
Attributes
----------
array_size : int
Describe parameters used in this mod... |
gboeing/urban-data-science | modules/04-data-cleaning-exploration/lecture.ipynb | mit | import ast
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats
"""
Explanation: Data Cleaning and Exploration
Overview of today's topics:
- Data cleaning and feature engineering with real world data sets
- Exploring data sets with descriptive stats and visualization
To set this lec... |
weleen/mxnet | example/notebooks/basic/mixed.ipynb | apache-2.0 | import mxnet as mx
num_classes = 10
net = mx.sym.Variable('data')
net = mx.sym.FullyConnected(data=net, name='fc1', num_hidden=128)
net = mx.sym.Activation(data=net, name='relu1', act_type="relu")
net = mx.sym.FullyConnected(data=net, name='fc2', num_hidden=num_classes)
net = mx.sym.SoftmaxOutput(data=net, name='out')
... |
emmajagu/contiamo-client-python | demo-notebooks/heatmap.ipynb | mit | import pandas as pd
import contiamo
import seaborn as sns
import numpy as np
"""
Explanation: Heatmap of revenue depending on application type and customer age
This is a demo notebook that can be used to explore Contiamo Labs. It uses a demo database created by Contiamo containing transaction information for a mobile... |
joshnsolomon/phys202-2015-work | assignments/assignment03/NumpyEx01.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 1
Imports
End of explanation
"""
def checkerboard(size):
"""Return a 2d checkboard of 0.0 and 1.0 as a NumPy array"""
a =... |
mne-tools/mne-tools.github.io | 0.20/_downloads/da7833d7ecb983c452e4eef48095435a/plot_stats_cluster_spatio_temporal_repeated_measures_anova.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Denis Engemannn <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
import matplotlib.pyplot as plt
import mne
from mne.stat... |
softEcon/course | lectures/basics/object_oriented_programming/lecture.ipynb | mit | Image(filename='images/profiling.png')
"""
Explanation: Object-Oriented Programming
In this lecture, we will study Object-Oriented Programming (OOP) and discover that there is a tight link between this programming paradigm and economics. To keep economics front and center, we will explore the usefulness of the OOP by ... |
sisnkemp/deep-learning | embeddings/Skip-Grams-Solution.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
grfiv/MNIST | vw/VW_benchmark_pca.ipynb | mit | from __future__ import division
import re
import numpy as np
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
%matplotlib inline
#%qtconsole
"""
Explanation: MNIST classification with Vowpal Wabbit
PCA data
End of explanation
"""
!rm train.vw.cache
!rm pca_train.model
!vw -d data/mnis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.