repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
bashtage/statsmodels | examples/notebooks/exponential_smoothing.ipynb | bsd-3-clause | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.api import ExponentialSmoothing, SimpleExpSmoothing, Holt
%matplotlib inline
data = [
446.6565,
454.4733,
455.663,
423.6322,
456.2713,
440.5881,
425.3325,
485.1494,
506.0482,
5... |
KrisCheng/ML-Learning | archive/MOOC/Deeplearning_AI/ImprovingDeepNeuralNetworks/SettingupyourMachineLearningApplication/Initialization.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import sklearn
import sklearn.datasets
from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation
from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec
%matplotlib inline
plt.rcParams['f... |
asharel/ml | LAB2/Recursos/Red_Dimension1.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sklearn.feature_selection as FS
data = pd.read_csv("./wine_dataset.csv", delimiter=";")
data.head()
"""
Explanation: Práctica Reduccción de Dimensionalidad
Métodos de Filtrado
Métodos Wrapper
Métodos Extracción:
LDA
PCA
End of explanation
... |
kalfasyan/Data_Science_playground | seeds_PandasSeaborn.ipynb | gpl-3.0 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
"""
Explanation: We will make intuitive visualizations that will help us understand our 'Seeds' data
First we import the necessary libraries for processing (pandas) and ploting (seaborn, matplotlib).
End of explanation
"""
wheat = pd.read_csv(... |
AllenDowney/CompStats | hypothesis_soln.ipynb | mit | from __future__ import print_function, division
import numpy
import scipy.stats
import matplotlib.pyplot as pyplot
import first
# some nicer colors from http://colorbrewer2.org/
COLOR1 = '#7fc97f'
COLOR2 = '#beaed4'
COLOR3 = '#fdc086'
COLOR4 = '#ffff99'
COLOR5 = '#386cb0'
%matplotlib inline
"""
Explanation: Hypot... |
cathalmccabe/PYNQ | boards/Pynq-Z1/base/notebooks/arduino/arduino_analog.ipynb | bsd-3-clause | # Make sure the base overlay is loaded
from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
"""
Explanation: Arduino Analog Example
This example shows how to read out analog values on Arduino analog pins. Users can either wire the test pins, or use the PYNQ shield.
For this notebook, a PYNQ Ardui... |
pastas/pasta | examples/notebooks/08_threshold_non_linear.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pastas as pt
pt.set_log_level('WARNING')
pt.show_versions()
ml = pt.io.load('data_notebook_8/B28H1804_2.pas')
# the model is already solved, but we solve it again to be certain
ml.solve(noise=False, report=False)
# and we plot the results
ml... |
neurostorm/tutorials | ndstore/getmetadata.ipynb | apache-2.0 | from scipy import misc as scm
import os.path as op
import matplotlib.pyplot as plt
% matplotlib inline
datadir = '/tmp/113_1/'
im = scm.imread(op.join(datadir,'0090.png'))
plt.imshow(im, cmap='gray')
plt.show()
"""
Explanation: Get Metadata
Prior to any form of upload or ingest of your data into ndstore, or likely a... |
robertoalotufo/ia898 | master/tutorial_numpy_1_3.ipynb | mit | %matplotlib inline
import numpy as np
from PIL import Image
a = np.arange(20) # a é um vetor unidimensional de 20 elementos
print(a)
a = a.reshape(4,5) # a agora é um array 4x5 (4 linhas por 5 colunas)
print('a.reshape(4,5) = \n', a)
"""
Explanation: # Table of Contents
<div class="toc" style="margin-top: 1em;"><ul ... |
barjacks/foundations-homework | 05/.ipynb_checkpoints/Spotify_Homework_5_Skinner_Class_solutions-checkpoint.ipynb | mit | response = requests.get('https://api.spotify.com/v1/search?query=Lil&type=artist&limit=50&market=US')
Lil_data = response.json()
Lil_data.keys()
Lil_data['artists'].keys()
"""
Explanation: These are the search queries for the Spotify Web API
End of explanation
"""
Lil_artists = Lil_data['artists']['items']
for art... |
AndreiBarsan/dm-notes | 02-approximate-retrieval.ipynb | unlicense | def jaccard_sim(a, b):
"""The Jaccard similarity of the two sets a and b."""
return len(a & b) * 1.0 / len(a | b)
def jaccard_distance(a, b):
return 1 - jaccard_sim(a, b)
x = {1, 5, 6, 10}
y = {2, 5, 6, 20}
print("Similarity: %.2f" % jaccard_sim(x, y))
print("Distance: %.2f" % jaccard_distance(x, y))
"... |
kubeflow/pipelines | samples/contrib/mnist/01_Lightweight_Python_Components.ipynb | apache-2.0 | import kfp
import kfp.gcp as gcp
import kfp.dsl as dsl
import kfp.compiler as compiler
import kfp.components as comp
import kubernetes as k8s
# Required Parameters
PROJECT_ID='<ADD GCP PROJECT HERE>'
GCS_BUCKET='gs://<ADD STORAGE LOCATION HERE>'
"""
Explanation: Lightweight Python Components
To build a component, de... |
QuantStack/quantstack-talks | 2019-06-04-deRSE19-widgets/notebooks/3 - ipyleaflet.ipynb | bsd-3-clause | from ipyleaflet import Map, basemaps, basemap_to_tiles
center = (52.204793, 360.121558)
m = Map(
layers=(basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2018-11-12"), ),
center=center,
zoom=4
)
m
"""
Explanation: <center><img src="src/ipyleaflet.svg" width="50%"></center>
Repository: https://... |
bt3gl/Machine-Learning-Resources | ml_notebooks/feature_sets.ipynb | gpl-2.0 | # 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 the L... |
abhitrip/tensorflowPractice | lab.ipynb | mit | !which python
"""
Explanation: <h1 align="center">TensorFlow Neural Network Lab</h1>
<img src="image/notmnist.png">
In this lab, you'll use all the tools you learned from Introduction to TensorFlow to label images of English letters! The data you are using, <a href="http://yaroslavvb.blogspot.com/2011/09/notmnist-dat... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb | apache-2.0 | import datetime
import os
import shutil
import numpy as np
import pandas as pd
import tensorflow as tf
from matplotlib import pyplot as plt
from tensorflow import feature_column as fc
from tensorflow import keras
from tensorflow.keras import Model
from tensorflow.keras.callbacks import TensorBoard
from tensorflow.kera... |
schmooser/physics | Dynamical chaos.ipynb | mit | %pylab
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
#import matplotlib
#matplotlib.style.use('ggplot')
def iterator(f, x0=0, inf=1000):
"""
iterator function returns iterator for given function f.
Parameters:
f iterating function of one argumen... |
holdenk/spark-intro-ml-pipeline-workshop | Machine Learning Pipeline Example.ipynb | apache-2.0 | from pyspark import SparkContext
from pyspark.conf import SparkConf
from pyspark.sql.session import SparkSession
# Configure your SparkContext. You can set the master, by default this will use a local master unless you
# add setMaster or change your enviorment variables.
conf = SparkConf().setAppName("intro-to-ml")
# ... |
opengridcc/opengrid | notebooks/Gas Toggle Demo.ipynb | apache-2.0 | import opengrid as og
from opengrid import datasets
plt = og.plot_style()
"""
Explanation: Intro
This notebook is a demo of the count peaks analysis. It is a function that takes a time series as input, and returns the number of peaks in that series.
It is designed to take gas sensor data in Watt as input. This first ... |
honjy/foundations-homework | 07/pandas-homework-hon-june13.ipynb | mit | import pandas as pd
df = pd.read_csv("07-hw-animals.csv")
"""
Explanation: Building a pandas Cheat Sheet, Part 1
Import pandas with the right name
End of explanation
"""
#!pip install matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
#This lets your graph show you in your notebook
df
"""
Explanation:... |
mayank-johri/LearnSeleniumUsingPython | Section 3 - Machine Learning/ThirdParty-scikit-learn-videos-master/09_classification_metrics.ipynb | gpl-3.0 | # read the data into a Pandas DataFrame
import pandas as pd
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data'
col_names = ['pregnant', 'glucose', 'bp', 'skin', 'insulin', 'bmi', 'pedigree', 'age', 'label']
pima = pd.read_csv(url, header=None, names=col_na... |
rickiepark/tfk-notebooks | tensorflow_for_beginners/6. Convolutional Neural Networks.ipynb | mit | from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"""
Explanation: 텐서플로우 라이브러리를 임포트 하세요.
텐서플로우에는 MNIST 데이터를 자동으로 로딩해 주는 헬퍼 함수가 있습니다. "MNIST_data" 폴더에 데이터를 다운로드하고 훈련, 검증, 테스트 데이터를 자동으로 읽어 들입니다. one_hot 옵션을 설정하면 정답 레이블을 원핫벡터로 바꾸어 줍니다.
End of explana... |
isb-cgc/examples-Python | notebooks/RegulomeExplorer_1_Gexpr_CNV.ipynb | apache-2.0 | from google.colab import auth
try:
auth.authenticate_user()
print('You have been successfully authenticated!')
except:
print('You have not been authenticated.')
"""
Explanation: Regulome Explorer Notebook 1
Gene-gene correlations using PanCancer expression and copy number data.
Authentication and Setup
Authentic... |
WISE-Comp-Science/Kinematics | index.ipynb | gpl-3.0 | 3.0 + 5.0
#multiplication
3.0 * 5.0
#exponents with **
2.0**3
"""
Explanation: Some things about Python
This document will give you a brief introduction to some concepts that you will find useful
To run each cell, press Shift + Enter
Arithmetics
For example, let's add 3 plus 5
End of explanation
"""
(15.0 + 3.5) ... |
AlphaGit/deep-learning | 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... |
tpin3694/tpin3694.github.io | machine-learning/drop_highly_correlated_features.ipynb | mit | # Load libraries
import pandas as pd
import numpy as np
"""
Explanation: Title: Drop Highly Correlated Features
Slug: drop_highly_correlated_features
Summary: How to drop highly correlated features for machine learning in Python.
Date: 2017-09-14 12:00
Category: Machine Learning
Tags: Feature Selection
Authors: Chri... |
stefanthaler/tf-spikes | computation-graph/TFComputationGraph.ipynb | apache-2.0 | import tensorflow as tf
assert tf.__version__=="1.2.0" # we want that version
"""
Explanation: Introduction to the TensorFlow computation graph
When I started with deep learning, one of the concepts that took me quite a while to wrap my head around was the use of a computation graph within code. Furthermore, that the... |
SylvainCorlay/ipywidgets | docs/source/examples/Lorenz Differential Equations.ipynb | bsd-3-clause | %matplotlib inline
from ipywidgets import interact, interactive
from IPython.display import clear_output, display, HTML
import numpy as np
from scipy import integrate
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import cnames
from matplotlib import animation
""... |
junpenglao/Bayesian-Cognitive-Modeling-in-Pymc3 | ParameterEstimation/Gaussian.ipynb | gpl-3.0 | # Data
x = np.array([1.1, 1.9, 2.3, 1.8])
n = len(x)
with pm.Model() as model1:
# prior
mu = pm.Normal('mu', mu=0, tau=.001)
sigma = pm.Uniform('sigma', lower=0, upper=10)
# observed
xi = pm.Normal('xi',mu=mu, tau=1/(sigma**2), observed=x)
# inference
trace = pm.sample(1e3, njobs=2)
pm... |
pmorissette/bt | examples/ERC.ipynb | mit | mean = np.array([0.05/252 + 0.02/252, 0.03/252 + 0.02/252])
volatility = np.array([0.2/np.sqrt(252), 0.05/np.sqrt(252)])
variance = np.power(volatility,2)
correlation = np.array(
[
[1, 0.25],
[0.25,1]
]
)
covariance = np.zeros((2,2))
for i in range(len(variance)):
for j in range(len(variance... |
mitdbg/modeldb | client/workflows/demos/registry/xgboost-wine-end-to-end.ipynb | mit | import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import itertools
import time
import six
import numpy as np
import pandas as pd
import sklearn
from sklearn import datasets
from sklearn import model_selection
import xgboost as xgb
"""
Explanation: Deploying an XGBoost model on Verta
Within... |
Danghor/Algorithms | Python/Chapter-02/Fibonacci-Numbers.ipynb | gpl-2.0 | def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
[ (n,fibonacci(n)) for n in range(19) ]
"""
Explanation: The Fibonacci Numbers
The Fibonacci numbers $F_n$ are defined by induction for all $n\in\mathbb{N}$:
- $F_0 := 0$,
- $F_1 := 1$,
- $F_{n+2} = F_{n+1} + F_n$ for ... |
ajhenrikson/phys202-2015-work | assignments/assignment08/InterpolationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set_style('white')
from scipy.interpolate import griddata
"""
Explanation: Interpolation Exercise 2
End of explanation
"""
x1=np.arange(-5,6)
y1=5*np.ones(11)
f1=np.zeros(11)
x2=np.arange(-5,6)
y2=-5*np.ones(11)
f2=np.ze... |
L2V/like2vec | notebooks/01-JJA-L2V-Configuration-Files.ipynb | apache-2.0 | import yaml
import datetime
# %load CONFIGS/ex1-ml-1m-config.yml
JARS:
LLR_JAR: "llr-assembly-1.2.jar"
EMBEDDINGS_JAR: "n2v-assembly-3.7.jar"
PREDICTIONS_JAR: "prediction-assembly-2.2.jar"
EVALUATION_JAR: "evaluation-assembly-1.5.jar"
PATHS:
JARS: "s3://sandbox-l2v/JARs/"
OUTPUT: "s3://sandbox-... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/10_recommend/labs/hybrid_recommendations/hybrid_recommendations_preproc.ipynb | apache-2.0 | # Import helpful libraries and setup our project, bucket, and region
import os
PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID
BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# Do not change these
os.environ["... |
molgor/spystats | notebooks/Model by chunks.ipynb | bsd-2-clause | # Load Biospytial modules and etc.
%matplotlib inline
import sys
sys.path.append('/apps')
import django
django.setup()
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
## Use the ggplot style
plt.style.use('ggplot')
from external_plugins.spystats import tools
%run ../testvariogram.py
section.sha... |
quantumlib/Cirq | docs/tutorials/rigetti/getting_started.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... |
Diyago/Machine-Learning-scripts | time series regression/DL aproach for timeseries/PM2.5 MLP.ipynb | apache-2.0 | from __future__ import print_function
import os
import sys
import pandas as pd
import numpy as np
%matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import datetime
#set current working directory
os.chdir('D:/Practical Time Series')
#Read the dataset into a pandas.DataFrame
df = pd.read_csv... |
SciTools/courses | course_content/iris_course/6.Data_Processing.ipynb | gpl-3.0 | import iris
import numpy as np
"""
Explanation: Iris introduction course
6. Data Processing
Learning Outcome: by the end of this section, you will be able to apply arithmetic and statistical operations on a Cube.
Duration: 1 hour
Overview:<br>
6.1 Cube Arithmetic<br>
6.2 Aggregation and Statistics<br>
6.3 Exercise<br>... |
spm2164/foundations-homework | 07/homework-07-part2.ipynb | artistic-2.0 | import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
df=pd.read_excel('Billionaires.xlsx')
"""
Explanation: Answer your own selection out of the following questions, or any other questions you might be able to think of. Write the question down first in a markdown cell (use a # to make the question ... |
evanmiltenburg/python-for-text-analysis | Chapters-colab/Chapter_12_Importing_external_modules.ipynb | apache-2.0 | %%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d ./
!unzip Ext... |
AppliedMechanics-EAFIT/SolidsPy | examples/beam_convergence/beam_convergence.ipynb | mit | from __future__ import division, print_function
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from matplotlib import rcParams
from solidspy.preprocesor import rect_grid
import solidspy.postprocesor as pos
import solidspy.assemutil as ass
import solidspy.solutil as sol
%matpl... |
ChadFulton/statsmodels | examples/notebooks/robust_models_1.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function
from statsmodels.compat import lmap
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import statsmodels.api as sm
"""
Explanation: M-Estimators for Robust Linear Modeling
End of explanation
"""
norms = sm.robust.norms
def plot_weig... |
cbare/Etudes | python/Performance analysis of mean implementations.ipynb | apache-2.0 | def mean(a):
if isinstance(a, Sequence):
return sum(a)/float(len(a))
else:
s = n = 0
for x in a:
s += x
n += 1
return s/float(n)
"""
Explanation: On a hunch, I made two separate cases in this implementation of mean. I wanted to support any iterable, which... |
cathalmccabe/PYNQ | boards/Pynq-Z2/base/notebooks/rpi/rpi_touchpad.ipynb | bsd-3-clause | from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
base.select_rpi()
"""
Explanation: Reading Values from Touch Keypad
This demonstration shows how to interact with the Raspberry Pi Touch Keypad.
The Raspberry Pi Touch Keypad is required (https://www.seeedstudio.com/Raspberry-Pi-Touch-Keypad-p-... |
mit-crpg/openmc | examples/jupyter/nuclear-data-resonance-covariance.ipynb | mit | %matplotlib inline
import os
from pprint import pprint
import shutil
import subprocess
import urllib.request
import h5py
import numpy as np
import matplotlib.pyplot as plt
import openmc.data
"""
Explanation: Nuclear Data: Resonance Covariance
In this notebook we will explore features of the Python API that allow us ... |
Eomys/MoSQITo | tutorials/tuto_loudness_zwtv.ipynb | apache-2.0 | # Add MOSQITO to the Python path
import sys
sys.path.append('..')
# Import numpy
import numpy as np
# Import plot function
import matplotlib.pyplot as plt
# Import mosqito functions
from mosqito.utils import load
from mosqito.sq_metrics import loudness_zwtv
# Import MOSQITO color sheme [Optional]
from mosqito import ... |
grantjenks/pyannote-core | notebook/pyannote.core.scores.ipynb | mit | from pyannote.core import Scores
"""
Explanation: Scores (pyannote.core.scores.Scores)
End of explanation
"""
scores = Scores(
uri='TheBigBangTheory.Season01.Episode01',
modality='speaker'
)
"""
Explanation: Scores instances are used to describe classification scores.
For instance, one can use a Scores to ... |
gsvijayraajaa/workshop | Workshop_Exercise.ipynb | mit | import pandas as pd
url = 'data/bank-additional.csv'
bank = pd.read_csv(url, sep=';')
bank.head()
"""
Explanation: Exercise with bank marketing data
Introduction
Data from the UCI Machine Learning Repository: data, data dictionary
Goal: Predict whether a customer will purchase a bank product marketed over the phone
b... |
sainathadapa/fastai-courses | deeplearning1/nbs-custom-mine/lesson4_03.ipynb | apache-2.0 | ratings = pd.read_csv(path+'ratings.csv')
ratings.head()
len(ratings)
"""
Explanation: Set up data
We're working with the movielens data, which contains one rating per row, like this:
End of explanation
"""
movie_names = pd.read_csv(path+'movies.csv').set_index('movieId')['title'].to_dict()
users = ratings.userId.... |
suryaavala/stockprediction | Crypto/eth/PrepareData - Technical Indicators.ipynb | mit | def MACD(df,period1,period2,periodSignal):
EMA1 = pd.DataFrame.ewm(df,span=period1).mean()
EMA2 = pd.DataFrame.ewm(df,span=period2).mean()
MACD = EMA1-EMA2
Signal = pd.DataFrame.ewm(MACD,periodSignal).mean()
Histogram = MACD-Signal
return Histogram
def stochastics_oscillator(df,p... |
robblack007/clase-dinamica-robot | Practicas/practica2/visualizacion.ipynb | mit | from robots.robots import Robot
from numpy import pi
"""
Explanation: Práctica 2 - Cinemática directa y dinámica de manipuladores
En este documento se van a importar las librerias necesarias para graficar los datos simulados por medio de los métodos numéricos descritos en el documento (numerico.ipynb).
Este documento... |
Hackerfarm/awarenode | notebook/Workshop - 02 - Files and modules.ipynb | agpl-3.0 | # We can create a file object and store it inside a variable.
# you can see objects as a different type of data
f=open("awanode-farmlab-2017-08-14.txt")
print(f)
"""
Explanation: Reading and writing files
End of explanation
"""
f=open("awanode-farmlab-2017-08-14.txt")
# The read() function reads the content of a fi... |
rahulremanan/python_tutorial | Fundamentals_of_deep-learning/notebooks/03_Introduction_to_tensorflow.ipynb | mit | import tensorflow as tf
"""
Explanation: Introduction to tensorflow
Author: Dr. Rahul Remanan
CEO and Chief Imagination Officer, Moad Computer
This notebook is an introduction to tensorflow, a popular deep-learning framework. Tensorflow has brilliant integration with Python. This notebook uses the tensorflow python3 A... |
DS-100/sp17-materials | sp17/disc/disc11/disc11.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import patches, cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
from IPython.display import display, Latex, Markdown
from ipywidgets import interact, inte... |
ForestClaw/forestclaw | applications/geoclaw/bowl_radial/bowl.ipynb | bsd-2-clause | %run make_topo.py
%run make_data.py
"""
Explanation: Bowl
Initial Gaussian hump sends out ripples in a symmetric bowl-shaped pond. Refinment is focused near one edge of the pond.
Create topography files and data files
End of explanation
"""
!bowl
"""
Explanation: Run code in serial mode (will work, even if c... |
whitead/numerical_stats | unit_11/hw_2016/homework_8_key.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize as opt
"""
Explanation: Homework 8
CHE 116: Numerical Methods and Statistics
Prof. Andrew White
Version 1.0 (3/15/2016)
Short Exercises (48 Points)
Answer each using Python. Write out any constraints or rearrangements of ... |
rsignell-usgs/notebook | CSW/CSW_ISO_Queryables-IOOS.ipynb | mit | from pylab import *
from owslib.csw import CatalogueServiceWeb
from owslib.sos import SensorObservationService
from owslib import fes
import netCDF4
import pandas as pd
import datetime as dt
from IPython.core.display import HTML
HTML('<iframe src=http://www.nodc.noaa.gov/geoportal/ width=950 height=400></iframe>')
# ... |
square/pysurvival | notebooks/Employee retention - Knowing when your employees will quit.ipynb | apache-2.0 | # Importing modules
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from pysurvival.datasets import Dataset
%pylab inline
# Reading the dataset
raw_dataset = Dataset('employee_attrition').load()
print("The raw_dataset has the following shape: {}.".format(raw_dataset.shape))
raw_dataset.head... |
zomansud/coursera | ml-regression/week-5/Overfitting_Demo_Ridge_Lasso.ipynb | mit | import graphlab
import math
import random
import numpy
from matplotlib import pyplot as plt
%matplotlib inline
"""
Explanation: Overfitting demo
Create a dataset based on a true sinusoidal relationship
Let's look at a synthetic dataset consisting of 30 points drawn from the sinusoid $y = \sin(4x)$:
End of explanation
... |
ES-DOC/esdoc-jupyterhub | notebooks/niwa/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'niwa', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: NIWA
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties:... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a/matrix_dictionary.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Produit matriciel avec une matrice creuse
Les dictionnaires sont une façon assez de représenter les matrices creuses en ne conservant que les coefficients non nuls. Comment écrire alors le produit matriciel ?
End of explanation
"""
impo... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/cmip6/models/sandbox-2/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-2', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Timestepping Framework,... |
dnxbjyj/python-basic | useful-func/python-tricks.ipynb | mit | x = 1
y = 2
print ('no','yes')[x==y]
"""
Explanation: Python技巧大全
知乎上有一个问题:Python 有什么奇技淫巧?其中有各种不按套路出牌的招数,也不乏一些惊为天人的"奇技淫巧",会让你大呼:居然还有这种操作???
本文就是对日常使用过的或者觉得很精妙的"奇技淫巧"的归纳总结。
Python版问号表达式
End of explanation
"""
a = [1,2,3]
print a[False]
print a[True]
"""
Explanation: 这里巧妙地利用了Python会把False当做序列下标0、把True当做序列下标1的特性,把否定条件的... |
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies | ex22-Visualize GAR Global Flood Hazard Map with Python.ipynb | mit | import numpy as np
import numpy.ma as ma
from osgeo import gdal
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
%matplotlib inline
"""
Explanation: Visualize GAR Global Flood Hazard Map with Python
Flooding is one of the most damaging natural hazards, accounting for 31% of all economic losses... |
solowPy/solowPy | examples/3 Graphical analysis.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import sympy as sym
import solowpy
# define model parameters
ces_params = {'A0': 1.0, 'L0': 1.0, 'g': 0.02, 'n': 0.03, 's': 0.15,
'delta': 0.05, 'alpha': 0.33, 'sigma': 0.95}
# create an ins... |
mediagestalt/PeelXML | PeelMetadata.ipynb | mit | import csv # facilitates writing to a CSV file
import os # facilitates file directory navigation
import lxml # provides XML parsing functionality
from lxml import etree # allows for XML navigation via XPath
ns = {'v3': 'http://www.loc.gov/mods/v3'} # the namespace is known in the code as 'ns' for brevity
"""
Explanat... |
tien-le/uranus | tools_matplotlib.ipynb | mit | from __future__ import division, print_function, unicode_literals
"""
Explanation: Tools - matplotlib
This notebook demonstrates how to use the matplotlib library to plot beautiful graphs.
Table of Contents
<p><div class="lev1"><a href="#Plotting-your-first-graph-1"><span class="toc-item-num">1 </span>Plott... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/inm-cm4-8/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'inm-cm4-8', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: INM
Source ID: INM-CM4-8
Topic: Aerosol
Sub-Topics: Transport, Emissions, Concent... |
darkrun95/Applied-Data-Science | Applied Machine Learning in Python/Week 1/Week1.ipynb | gpl-3.0 | %matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
fruits = pd.read_table('fruit_data_with_colors.txt')
fruits.head()
# create a mapping from fruit label value to fruit name to make results easier to interpret
lookup_fruit_... |
phievo/phievo | Examples/immune/Analyse_pMHC.ipynb | lgpl-3.0 | import os,sys
#sys.path.append("immune")
sys.path.append("example_immune")
"""
Explanation: Analyse Run
This is a template notebook to browse the results of a evolution simulation.
WARNING: THIS IS THE IMMUNE ADD-ON. THIS NOTEBOOK SHOULD BE MOVED TO BE RUN IN THE SAME DIRECTORY AS run_evolution
Please Restart & Run Al... |
Dima806/udacity-mlnd-capstone | capstone-preprocessing-final.ipynb | apache-2.0 | import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import time
import gzip
import shutil
import seaborn
"""
Explanation: Udacity MLND Capstone Project
"Determination of students’ interaction patterns with an intelligent tutoring system and study of their correlation with successf... |
ajkavanagh/pyne-sqlalchemy-2015-04 | notebook/Core Examples.ipynb | gpl-3.0 | import sqlalchemy
sqlalchemy.__version__
"""
Explanation: SQL Alchemy Core Examples
This file contains SQLAlchemy core examples.
Test we have SQL Alchemy
End of explanation
"""
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
"""
Explanation: Fetch an SQLite engine and create an in ... |
cstrelioff/ARM-ipynb | Chapter3/chptr3.2-R.ipynb | mit | %%R
# I had to import foreign to get access to read.dta
library("foreign")
kidiq <- read.dta("../../ARM_Data/child.iq/kidiq.dta")
# I won't attach kidiq-- i generally don't attach to avoid confusion(s)
#attach(kidiq)
"""
Explanation: 3.2: Multiple predictors
Read the data
Data are in the child.iq directory of the ARM... |
tpin3694/tpin3694.github.io | machine-learning/split_data_into_training_and_test_sets.ipynb | mit | # Load libraries
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
"""
Explanation: Title: Split Data Into Training And Test Sets
Slug: split_data_into_training_and_test_sets
Summary: How to split data into training and test sets for mach... |
mne-tools/mne-tools.github.io | 0.19/_downloads/bf3ad991f7c7776e245520709f49cb04/plot_cwt_sensor_connectivity.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne import io
from mne.connectivity import spectral_connectivity, seed_target_indices
from mne.datasets import sample
from mne.time_frequency import AverageTFR
print(__doc__)
"""
Explanation: Compute... |
phoebe-project/phoebe2-docs | 2.2/examples/legacy_spots.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Comparing Spots in PHOEBE 2 vs PHOEBE Legacy
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"... |
macks22/gensim | docs/notebooks/WordRank_wrapper_quickstart.ipynb | lgpl-2.1 | from gensim.models.wrappers import Wordrank
wr_path = 'wordrank' # path to Wordrank directory
out_dir = 'model' # name of output directory to save data to
data = '../../gensim/test/test_data/lee.cor' # sample corpus
model = Wordrank.train(wr_path, data, out_dir, iter=11, dump_period=5)
"""
Explanation: WordRank wrap... |
iutzeler/Introduction-to-Python-for-Data-Sciences | 3-1_Pandas.ipynb | mit | import pandas as pd
import numpy as np
"""
Explanation: <table>
<tr>
<td width=15%><img src="./img/UGA.png"></img></td>
<td><center><h1>Introduction to Python for Data Sciences</h1></center></td>
<td width=15%><a href="http://www.iutzeler.org" style="font-size: 16px; font-weight: bold">Franck Iutzeler</a> </td>
</tr>
... |
ethen8181/machine-learning | keras/text_classification/keras_subword_tokenization.ipynb | mit | # code for loading the format for the notebook
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(plot_style=False)
os.chdir(path)
# 1. magic for inline plot
# 2. magic to print vers... |
frankbearzou/Data-analysis | Police Killings/Police Killing.ipynb | mit | police_killings = pd.read_csv('police_killings.csv', encoding='ISO-8859-1')
police_killings.dtypes
police_killings.head()
"""
Explanation: Data Exploration
End of explanation
"""
race_counts = police_killings['raceethnicity'].value_counts()
plt.bar(np.arange(race_counts.size), race_counts, align='center')
plt.xti... |
regata/rl-book | ch06.ipynb | mit | import numpy as np
ACTION_TO_XY = {
'left': (-1, 0),
'right': (1, 0),
'up': (0, 1),
'down': (0, -1),
'up_left': (-1, 1),
'down_left': (-1, -1),
'up_right': (1, 1),
'down_right': (1, -1),
'stop': (0, 0)
}
# convert tuples to np so we can do math with states
ACTION_TO_XY = {a: np.arr... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/boundless.ipynb | apache-2.0 | #@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
ramseylab/networkscompbio | class21_reveal_python3_template.ipynb | apache-2.0 | import pandas
import numpy
import itertools
"""
Explanation: Class 21: joint entropy and the REVEAL algorithm
We'll use the bladder cancer gene expression data to test out the REVEAL algorithm. First, we'll load the data and filter to include only genes for which the median log2 expression level is > 12 (as we did in... |
harmsm/pythonic-science | labs/00.1_programming-puzzles/Puzzles-Key.ipynb | unlicense | import copy
def palindrome(a_list):
"""
Determine whether a list is a palindrome.
"""
a_list = list(a_list)
b_list = copy.deepcopy(a_list)
b_list.reverse()
for i in range(len(a_list)):
if a_list[i] != b_list[i]:
return False
return True
"""
Expla... |
4dsolutions/Python5 | Abducted!.ipynb | mit | def UFO(abductee):
abductee.special_mark = True
return abductee
def subject_A():
pass
@UFO
def subject_B():
pass
print(subject_B.special_mark)
"""
Explanation: Python for Everyone!<br/>Oregon Curriculum Network
Abucted by Aliens
Decorators in Python
Note that Python functions, as top-level objects,... |
kiseyno92/SNU_ML | Practice6/3_char_rnn_train.ipynb | mit | # Now convert all text to index using vocab!
corpus = np.array(list(map(vocab.get, data)))
print ("Type of 'corpus' is %s, shape is %s, and length is %d"
% (type(corpus), corpus.shape, len(corpus)))
check_len = 10
print ("\n'corpus' looks like %s" % (corpus[0:check_len]))
for i in range(check_len):
_wordidx ... |
ad960009/dist-keras | examples/cifar-10-preprocessing.ipynb | gpl-3.0 | import cPickle as pickle
import csv
import numpy as np
from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.ml.feature import VectorAssembler
from pyspark.ml.feature import OneHotEncoder
from distkeras.trainers import *
from distkeras.predictors import *
from distkeras.transformers import *
... |
metpy/MetPy | dev/_downloads/83b6998284b63bb8a8f46a92e71d6000/isentropic_example.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, add_timestamp
from metpy.units import units
"""
Explanation: Isentropic Analysi... |
bradhowes/keystrokecountdown | src/articles/PDMPlayground/index.ipynb | mit | figWidth = 16 # Width of many of the figures
sampleFrequency = 1024 # Hz
bandwidth = sampleFrequency / 2 # 0-512 Hz (also Nyquist freq)
sampleDuration = 1.0 / sampleFrequency # time duration per cycle
signalTime = np.arange(0, 1, sampleDuration)
signal1Freq = 51 # Hz
signal1Samples = np.sin(2.0 * np.pi * signal1Freq ... |
tensorflow/docs-l10n | site/zh-cn/tutorials/generative/dcgan.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... |
hparik11/Deep-Learning-Nanodegree-Foundation-Repository | intro-to-tensorflow/intro_to_tensorflow_solution.ipynb | mit | # Problem 1 - Implement Min-Max scaling for grayscale image data
def normalize_grayscale(image_data):
"""
Normalize the image data with Min-Max scaling to a range of [0.1, 0.9]
:param image_data: The image data to be normalized
:return: Normalized image data
"""
a = 0.1
b = 0.9
grayscale... |
fluentpython/concurrency | lab-native-coros/native-coro-demos.ipynb | mit | import types
@types.coroutine
def gen():
yield 42
async def delegating():
await gen()
"""
Explanation: The simplest native coroutine demo
(that I could imagine)
End of explanation
"""
coro = delegating()
coro
coro.send(None)
# coro.send(None) # --> StopIteration
"""
Explanation: The driving code starts... |
benhoyle/udacity-tensorflow | 1_notmnist.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 os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
jorgemauricio/INIFAP_Course | ejercicios/Pandas/2_DataFrames.ipynb | mit | # librerias
import pandas as pd
import numpy as np
from numpy.random import randn
np.random.seed(101)
df = pd.DataFrame(randn(5,4),index='A B C D E'.split(),columns='W X Y Z'.split())
df
"""
Explanation: DataFrames
DataFrames es el tipo de dato utilizado por Pandas, inspirado de la programacion en R, se puede consi... |
musketeer191/job_analytics | minor/cluster_job_post.ipynb | gpl-3.0 | import my_util as my_util
import cluster_skill_helpers as cluster_skill_helpers
from cluster_skill_helpers import *
import random as rd
global doc_topic_distr
HOME_DIR = 'd:/larc_projects/job_analytics/'
SKILL_DAT = HOME_DIR + 'data/clean/skill_cluster/'
SKILL_RES = HOME_DIR + 'results/' + 'skill_cluster/new/'
JOB_... |
metpy/MetPy | dev/_downloads/e5685967297554788de3cf5858571b23/Natural_Neighbor_Verification.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import ConvexHull, Delaunay, delaunay_plot_2d, Voronoi, voronoi_plot_2d
from scipy.spatial.distance import euclidean
from metpy.interpolate import geometry
from metpy.interpolate.points import natural_neighbor_point
"""
Explanation: Natural Neighbo... |
acdarby/Python_lectures | Lecture_1.ipynb | gpl-3.0 | 3+5
5.5 -3.2
3*5
5>4
"""
Explanation: Introduction to Programming in Python 3
What is Python?
A programming language
Set of commands that can be interpreted by a piece of software
Python is also the name of the software that interprets the commands (3 is a version)
Python can be installed on any computer (runni... |
GoogleCloudPlatform/ml-design-patterns | 04_hacking_training_loop/hyperparameter_tuning.ipynb | apache-2.0 | import datetime
import os
import numpy as np
import pandas as pd
import tensorflow as tf
import time
from tensorflow import keras
from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, f1_score
"""
Explanation: Hyperparameter Tu... |
jepegit/cellpy | dev_utils/helpers/notebooks/cellpy_dev_strange_files.ipynb | mit | %load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cellpy
from cellpy import log
from cellpy import cellreader
from cellpy import prms
from cellpy import prmreader
from cellpy.utils import batch
# import holoviews as hv
%matplotlib inline
# hv.extension(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.