repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
keras-team/keras-io | examples/keras_recipes/ipynb/better_knowledge_distillation.ipynb | apache-2.0 | !!pip install -q tensorflow-addons
"""
Explanation: Knowledge distillation recipes
Author: Sayak Paul<br>
Date created: 2021/08/01<br>
Last modified: 2021/08/01<br>
Description: Training better student models via knowledge distillation with function matching.
Introduction
Knowledge distillation (Hinton et al.) is a te... |
junhwanjang/DataSchool | Lecture/14. 선형 회귀 분석/8) patsy 패키지 소개.ipynb | mit | from patsy import dmatrix, dmatrices
np.random.seed(0)
x1 = np.random.rand(5) + 10
x2 = np.random.rand(5) * 10
x1, x2
dmatrix("x1")
"""
Explanation: patsy 패키지 소개
회귀 분석 전처리 패키지
encoding/transform/design matrix 기능
R-style formula 문자열 지원
design matrix
dmatrix(fomula[, data])
R-style formula 문자열을 받아서 X matrix 생성
자동으로... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/launching_into_ml/labs/supplemental/intro_linear_regression.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns # Seaborn is a Python data visualization library based on matplotlib.
%matplotlib inline
"""
Explanation: Introduction to Linear Regression
Learn... |
edwardd1/phys202-2015-work | assignments/assignment04/MatplotlibEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 2
Imports
End of explanation
"""
!head -n 30 open_exoplanet_catalogue.txt
"""
Explanation: Exoplanet properties
Over the past few decades, astronomers have discovered thousands of extrasolar planets. The follo... |
AllenDowney/ThinkStats2 | workshop/effect_size_soln.ipynb | gpl-3.0 | %matplotlib inline
import numpy
import scipy.stats
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.random.seed(17)
"""
Explanation: Effect Size
Examples and exercises for a tutor... |
mne-tools/mne-tools.github.io | stable/_downloads/a9e07affc8c71aa96bb4ffe855ff552c/morph_surface_stc.ipynb | bsd-3-clause | # Author: Tommy Clausner <tommy.clausner@gmail.com>
#
# License: BSD-3-Clause
import os
import os.path as op
import mne
from mne.datasets import sample
print(__doc__)
"""
Explanation: Morph surface source estimate
This example demonstrates how to morph an individual subject's
:class:mne.SourceEstimate to a common r... |
SnShine/aima-python | mdp.ipynb | mit | from mdp import *
from notebook import psource, pseudocode
"""
Explanation: Markov decision processes (MDPs)
This IPy notebook acts as supporting material for topics covered in Chapter 17 Making Complex Decisions of the book Artificial Intelligence: A Modern Approach. We makes use of the implementations in mdp.py modu... |
moosekaka/sweepython | Pipeline.ipynb | mit | %matplotlib inline
import sys
import errno
import os
import os.path as op
import cPickle as pickle
import wrappers as wr
from pipeline import pipefuncs as pf
from pipeline import _make_networkx as mn
from mayavi import mlab
from IPython.display import Image
from mombud.vtk_viz import vtkvizfuncs as vf
mlab.options.off... |
tensorflow/tfjs-models | speech-commands/training/browser-fft/tflite_conversion.ipynb | apache-2.0 | # We need scipy for .wav file IO.
!pip install tensorflowjs==2.1.0 scipy==1.4.1
# TensorFlow 2.3.0 is required due to https://github.com/tensorflow/tensorflow/issues/38135
# TODO: Switch to 2.3.0 final release when it comes out.
!pip install tensorflow-cpu==2.3.0
"""
Explanation: Converting a TensorFlow.js Speech-Comm... |
adamsteer/nci-notebooks | .ipynb_checkpoints/Point cloud to HDF-checkpoint.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
%matplotlib inline
#import plot_lidar
from datetime import datetime
"""
Explanation: What is the proposed task:
ingest some liDAR points into a HDF file
ingest the aircraft trajectory into the file
anything else
...and then extr... |
mdeff/ntds_2016 | algorithms/01_ex_graph_science.ipynb | mit | # Load libraries
# Math
import numpy as np
# Visualization
%matplotlib notebook
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy import ndimage
# Print output of LFR code
import subprocess
# Sparse matrix
import ... |
napsternxg/gensim | docs/notebooks/WMD_tutorial.ipynb | gpl-3.0 | from time import time
start_nb = time()
# Initialize logging.
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s')
sentence_obama = 'Obama speaks to the media in Illinois'
sentence_president = 'The president greets the press in Chicago'
sentence_obama = sentence_obama.lower().split()... |
goddoe/CADL | session-2/session-2.ipynb | apache-2.0 | # First check the Python version
import sys
if sys.version_info < (3,4):
print('You are running an older version of Python!\n\n' \
'You should consider updating to Python 3.4.0 or ' \
'higher as the libraries built for this course ' \
'have only been tested in Python 3.4 and higher.\n'... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160531화_10일차_Scikit-Learn & statsmodels 패키지 소개 Introduction to Scikit-Learn & statsmodels packages/4.Scikit-Learn 패키지의 샘플 데이터 - classification용.ipynb | mit | from sklearn.datasets import load_iris
iris = load_iris()
print(iris.DESCR)
df = pd.DataFrame(iris.data, columns=iris.feature_names)
sy = pd.Series(iris.target, dtype="category")
sy = sy.cat.rename_categories(iris.target_names)
df['species'] = sy
df
sns.pairplot(df, hue='species')
plt.show()
"""
Explanation: Scikit-... |
DillonNovak/Programming-for-Chemical-Engineering-Applications | Breast+Cancer+Diagnosis.ipynb | gpl-3.0 | %matplotlib inline
from sklearn.decomposition import PCA
import sys
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sklearn as sk
import seaborn as sns
sns.set_context('talk')
#import PCA models
from pandas.tools.plotting import scatter_matrix
from sklearn import model... |
fionapigott/Data-Science-45min-Intros | count-min-101/CountMinSketch.ipynb | unlicense | import sys
import random
import numpy as np
import heapq
import json
import time
BIG_PRIME = 9223372036854775783
def random_parameter():
return random.randrange(0, BIG_PRIME - 1)
class Sketch:
def __init__(self, delta, epsilon, k):
"""
Setup a new count-min sketch with parameters delta, epsi... |
gvasold/gdp17 | basics/funktionen.ipynb | apache-2.0 | def say_hello():
print('Hello!')
"""
Explanation: Funktionen
Funktionen sind Prozeduren oder, wenn man so will, Subprogramme, die aus dem Hauptprogramm heraus aufgerufen werden. Die Vorteile der Verwendung von Funktionen sind:
Funktionen sind wiederverwendbar: Eine einmal geschriebene Funktion kann in einem Progr... |
phoebe-project/phoebe2-docs | 2.3/examples/minimal_contact_binary.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Minimal Contact Binary System
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 # units
import nump... |
termanli/CLIOL | External_data_Drive,_Sheets,_and_Cloud_Storage.ipynb | lgpl-3.0 | from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(
name=fn, length=len(uploaded[fn])))
"""
Explanation: <a href="https://colab.research.google.com/github/termanli/CLIOL/blob/master/External_data_Drive,_She... |
GoogleCloudPlatform/tf-estimator-tutorials | 00_Miscellaneous/tf_train_eval_export/Tutorial - Optimising Learning Rate.ipynb | apache-2.0 | import math
import os
import pandas as pd
import numpy as np
from datetime import datetime
import tensorflow as tf
from tensorflow import data
print "TensorFlow : {}".format(tf.__version__)
SEED = 19831060
"""
Explanation: TensorFlow: Optimizing Learning Rate
End of explanation
"""
DATA_DIR='data'
# !mkdir $DATA_... |
statsmaths/stat665 | lectures/lec20/notebook20.ipynb | gpl-2.0 | %pylab inline
import copy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.datasets import imdb, reuters
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.optimizers import SGD, RMSprop
from keras.utils import np_utils
fr... |
sdpython/ensae_teaching_cs | _doc/notebooks/1a/recherche_dichotomique.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - Recherche dichotomique
Recherche dichotomique illustrée. Extrait de Recherche dichotomique, récursive, itérative et le logarithme.
End of explanation
"""
from pyquickhelper.helpgen import NbImage
NbImage("images/dicho.png")
"... |
nikita-mayorov/math_modelling | pendulum_model.ipynb | gpl-3.0 | # Імпортуємо необхідні модулі.
from ipywidgets import *
from numpy import sin, cos, sqrt, pi, radians, arange
import matplotlib.pyplot as plt
from matplotlib import rc
font = {'family': 'Verdana',
'weight': 'normal'}
rc('font', **font)
# Оголошуємо функції.
def ar():
return v0*sqrt(m1)*sqrt(l)*sin(sqrt(g)*... |
Hvass-Labs/TensorFlow-Tutorials | 17_Estimator_API.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
"""
Explanation: TensorFlow Tutorial #17
Estimator API
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
WARNING!
This tutorial does not work with TensorFlow v.2 and it would take too much effort to update this tutor... |
alepoydes/introduction-to-numerical-simulation | practice/Differentiation of differentiation methods.ipynb | mit | def f(x): return np.sin(x) # Функция
def dfdx(x): return np.cos(x) # и ее производная.
x0 = 1 # Точка, в которой производится дифференциирование.
dx = np.logspace(-16, 0, 100) # Приращения аргумента.
# Найдем приращения функции
df = f(x0+dx)-f(x0)
# и оценим производные.
approx_dfdx = df/dx
# Вычислим точное значен... |
mkarakoc/aim | examples/01_AIMpy_exp_cos_screened_coulomb_potential.ipynb | gpl-3.0 | # Python program to use AIM tools
from asymptotic import *
"""
Explanation: Application of the Asymptotic Iteration Method to <br> the Exponential Cosine Screened Coulomb Potential
O. Bayrak, et al. Int. J. Quant. Chem., 107 (2007), p. 1040
http://onlinelibrary.wiley.com/doi/10.1002/qua.21240/epdf
Atomic orbitals
1s... |
atulsingh0/MachineLearning | MasteringML_wSkLearn/03_Feature_Extraction_&_Preprocessing.ipynb | gpl-3.0 | from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, HashingVectorizer
from sklearn.metrics.pairwise import euclidean_distances
from sklearn import preprocessing
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem import PorterSt... |
liufuyang/deep_learning_tutorial | jizhi-pytorch-2/01_word_embedding/homework.ipynb | mit | # 加载必要的程序包
# PyTorch的程序包
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
# 数值运算和绘图的程序包
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# 加载机器学习的软件包,主要为了词向量的二维可视化
from sklearn.decomposition import PCA
#加载Word2Vec的... |
Gezort/YSDA_deeplearning17 | Seminar8/VAE_homework.ipynb | mit | #The following line fetches you two datasets: images, usable for autoencoder training and attributes.
#Those attributes will be required for the final part of the assignment (applying smiles), so please keep them in mind
from lfw_dataset import fetch_lfw_dataset
data,attrs = fetch_lfw_dataset()
import numpy as np
X_t... |
ExaScience/smurff | docs/notebooks/different_noise_models.ipynb | mit | import smurff
import logging
logging.basicConfig(level = logging.INFO)
ic50_train, ic50_test, ecfp = smurff.load_chembl()
"""
Explanation: Different noise models
In this notebook we look at the different noise models.
Prepare train, test and side-info
We first need to download and prepare the data files. This can be... |
vitojph/2016progpln | examen/progpln-examen-feb.ipynb | mit | tweets = []
RUTA = ''
for line in open(RUTA).readlines():
tweets.append(line.split('\t'))
"""
Explanation: Examen de Programación para el Procesamiento del Lenguaje Natural
Grado en Lingüística y Lenguas Aplicadas, UCM
9 de febrero de 2017
tl;dr
Vamos a analizar una colección de tweets en inglés publicados durante... |
hail-is/hail | notebook/worker/resources/Hail-Workshop-Notebook.ipynb | mit | print('Hello, world')
"""
Explanation: Hail workshop
This notebook will introduce the following concepts:
Using Jupyter notebooks effectively
Loading genetic data into Hail
General-purpose data exploration functionality
Plotting functionality
Quality control of sequencing data
Running a Genome-Wide Association Study ... |
FederatedAI/FATE | doc/tutorial/pipeline/pipeline_tutorial_upload.ipynb | apache-2.0 | !pipeline --help
"""
Explanation: Pipeline Upload Data Tutorial
install
Pipeline is distributed along with fate_client.
bash
pip install fate_client
To use Pipeline, we need to first specify which FATE Flow Service to connect to. Once fate_client installed, one can find an cmd enterpoint name pipeline:
End of explanat... |
tensorflow/hub | examples/colab/image_feature_vector.ipynb | apache-2.0 | # Copyright 2018 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... |
pastas/pasta | examples/groundwater_paper/Ex1_simple_model/Example1.ipynb | mit | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import pastas as ps
ps.set_log_level("ERROR")
ps.show_versions()
"""
Explanation: <IMG SRC="https://raw.githubusercontent.com/pastas/pastas/master/doc/_static/logo.png" WIDTH=250 ALIGN="right">
Example 1: Pastas Cookbook recipe
This n... |
gschivley/Supply-Curve | Supply Curve example.ipynb | mit | %matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path
from palettable.colorbrewer.qualitative import Paired_11
"""
Explanation: Supply curve figures of coal and petroleum resources
Sources I us... |
machinelearningnanodegree/stanford-cs231 | solutions/kvn219/assignment2/FullyConnectedNets.ipynb | mit | # As usual, a bit of setup
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solver import Solver
%matplotlib inline
... |
zzsza/Datascience_School | 10. 기초 확률론3 - 확률 분포 모형/04. 가우시안 정규 분포 (파이썬 버전).ipynb | mit | mu = 0
std = 1
rv = sp.stats.norm(mu, std)
rv
"""
Explanation: 가우시안 정규 분포
가우시안 정규 분포(Gaussian normal distribution), 혹은 그냥 간단히 정규 분포라고 부르는 분포는 자연 현상에서 나타나는 숫자를 확률 모형으로 모형화할 때 가장 많이 사용되는 확률 모형이다.
정규 분포는 평균 $\mu$와 분산 $\sigma^2$ 이라는 두 개의 모수만으로 정의되며 확률 밀도 함수(pdf: probability density function)는 다음과 같은 수식을 가진다.
$$ \mathcal{N... |
dwaithe/ONBI_image_analysis | day4_machineLearning/2015 clustering with ipython practical.ipynb | gpl-2.0 | #This line is very important: (It turns on inline the visuals!)
%pylab inline
import csv
#You will need these also. These functions extract the data from the results file.
def load_file_return_data(filepath):
data =[]
with open(filepath,'r') as f:
reader=csv.reader(f,delimiter='\t')
headers = r... |
michal-hradis/CNN_seminar | 03/keras_CNN_architectures.ipynb | bsd-3-clause | from tools import readCIFAR, mapLabelsOneHot
# First run ../data/downloadCIFAR.sh
# This reads the dataset
trnData, tstData, trnLabels, tstLabels = readCIFAR('../data/cifar-10-batches-py')
plt.subplot(1, 2, 1)
img = collage(trnData[:16])
print(img.shape)
plt.imshow(img)
plt.subplot(1, 2, 2)
img = collage(tstData[:16... |
ES-DOC/esdoc-jupyterhub | notebooks/cams/cmip6/models/cams-csm1-0/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cams', 'cams-csm1-0', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CAMS
Source ID: CAMS-CSM1-0
Sub-Topics: Radiative Forcings.
Properties: 85 ... |
rokkamsatyakalyan/Machine_Learning | Stylometry/Bag of Words/BagOfWords.ipynb | gpl-3.0 | import pandas as pd
df = pd.read_csv('scan1.csv',sep=',', header=None, names=['author_label','ass_num', 'author_writing'])
# df = pd.read_csv('bow3.csv',sep=',', header=None, names=['author_label', 'author_writing'])
# Output printing out last 5 columns
df = df.drop('ass_num', axis=1)
df.tail()
# print len(df['aut... |
ajdawson/python_for_climate_scientists | course_content/notebooks/cartopy_intro.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import cartopy.crs as ccrs
"""
Explanation: Cartopy in a nutshell
Cartopy is a Python package that provides easy creation of maps, using matplotlib, for the visualisation of geospatial data.
In order to create a map with cartopy and matplotlib, we typically need to import pyplot from ma... |
landlab/landlab | notebooks/tutorials/boundary_conds/set_watershed_BCs_raster.ipynb | mit | from landlab import RasterModelGrid
import numpy as np
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a>
Setting watershed boundary conditions on a raster grid
This tutorial ilustrates how to set watershed boundary conditions on a raster grid.
Note that a... |
liufuyang/ManagingBigData_MySQL_DukeUniv | week4/MySQL_Exercise_09_Subqueries_and_Derived_Tables.ipynb | mit | %load_ext sql
%sql mysql://studentuser:studentpw@mysqlserver/dognitiondb
%sql USE dognitiondb
%config SqlMagic.displaylimit=25
"""
Explanation: Copyright Jana Schaich Borg/Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
MySQL Exercise 9: Subqueries and Derived Tables
Now that you understand how joins work,... |
dpshelio/2015-EuroScipy-pandas-tutorial | solved - 06 - Reshaping data.ipynb | bsd-2-clause | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
try:
import seaborn
except ImportError:
pass
pd.options.display.max_rows = 8
"""
Explanation: Reshaping data with stack and unstack
End of explanation
"""
!head -1 ./data/BETR8010000800100hour.1-1-1990.31-12-2012
"""
... |
PythonBootCampIAG-USP/NASA_PBC2015 | Day_00/04_Numpy_Matplotlib/szhu_NumpyMatplotlib.ipynb | mit | import numpy as np
"""
Explanation: Numpy and Matplotlib
Reference documents
<A HREF="http://wiki.scipy.org/Tentative_NumPy_Tutorial">Tentative Numpy Tutorial</A>
<A HREF="http://docs.scipy.org/doc/numpy/reference">NumPy Reference</A>
<A HREF="http://mathesaurus.sourceforge.net/matlab-numpy.html">NumPy for MATLAB Use... |
esa-as/2016-ml-contest | CEsprey - RandomForest/Facies_Feature_Engineering_And_ML.ipynb | apache-2.0 | %matplotlib notebook
import pandas as pd
import numpy as np
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn import cross_validation
from sklearn.cross_validation import KFold
from sklearn.cross_validation import train_test_split
from sklearn import metrics
from sklearn... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_automl_tabular_classification_online_explain.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: AutoML training tabular classification model for online explanation
<table align="l... |
ryan-leung/PHYS4650_Python_Tutorial | notebooks/Jan2018/python-matplotlib.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
"""
Explanation: Matplotlib
<img src="images/matplotlib.svg" alt="matplotlib" style="width: 600px;"/>
Using matplotlib in Jupyter notebook
End of explanation
"""
x = np.arange(-np.pi,np.pi,0.01) # Create an array of x values from -pi to pi with 0... |
leonardodaniel/quant-project | analysis/stock_analysis.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figsize=(12,12))
"""
Explanation: Stock analysis: returns and volatility
This notebook aims to explore the Markowitz theory on modern portfolios with a little of code and a little of maths. The mo... |
georgetown-analytics/machine-learning | archive/notebook/Clustering Flag Data - Pipeline.ipynb | mit | import os
import requests
import numpy as np
import pandas as pd
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from sklearn import manifold
from sklearn.cluster import KMeans, AgglomerativeClustering
from sklearn.decomposition import PCA
from sklearn.metrics import silhouette_samples, silhouette_score
f... |
amanahuja/adaptive_resonance_networks | ipynb/ART2_demo_01.ipynb | mit | %load_ext autoreload
%autoreload 2
import os
import numpy as np
from IPython.display import Image
# make sure we're in the root directory
pwd = os.getcwd()
if pwd.endswith('ipynb'):
os.chdir('..')
#print os.getcwd()
"""
Explanation: ART2 demo
Adaptive Resonance Theory Neural Networks
by Aman Ahuja | gith... |
mne-tools/mne-tools.github.io | dev/_downloads/758680cba517820dcb0b486577bea58f/70_fnirs_processing.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import matplotlib.pyplot as plt
from itertools import compress
import mne
fnirs_data_folder = mne.datasets.fnirs_motor.data_path()
fnirs_cw_amplitude_dir = op.join(fnirs_data_folder, 'Participant-1')
raw_intensity = mne.io.read_raw_nirx(fnirs_cw_amplitude_dir, verbose=True)
ra... |
slowvak/MachineLearningForMedicalImages | notebooks/Module 6.ipynb | mit | # This is used to display images within the browser
%matplotlib inline
import os
import numpy as np
import matplotlib.pyplot as plt
import dicom as pydicom # library to load dicom images
try:
import cPickle as pickle
except:
import pickle
from sklearn.preprocessing import StandardScaler
import nibabel as nib... |
kadrlica/destools | notebook/intervals.ipynb | mit | %matplotlib inline
import numpy as np
import pylab as plt
import scipy.stats as stats
from scipy.stats import multivariate_normal as mvn
try:
import emcee
got_emcee = True
except ImportError:
got_emcee = False
try:
import corner
got_corner = True
except ImportError:
got_corner = False
plt.rcP... |
SeverTopan/AdjSim | tutorial/tutorial.ipynb | gpl-3.0 | import adjsim
import numpy as np # AdjSim also heavily relies on numpy. Its usage is recommended.
from matplotlib import pyplot
# Magic function to display matplotlib plots inline in the Jupyter Notebook. Not crucial for AdjSim.
%matplotlib inline
"""
Explanation: AdjSim Tutorial
AdjSim is an agent-based modelling e... |
softEcon/course | lectures/basics/python_overview/lecture.ipynb | mit | # This is an inline comment: Python3
print('hello world')
# Python2
print 'hello world'
"""
Explanation: This was our first Python command.
Basic Python Explorations
There are some minor differences between Python2 and Python3. Let us consider an example:
End of explanation
"""
1 * 1.0
a = 3
type(a)
b = 3 > 5
prin... |
google/rba | Regularized Regression.ipynb | apache-2.0 | ###########################################################################
#
# Copyright 2021 Google Inc.
#
# 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/... |
tsaqib/bike-sharing-time-series-nn-numpy | weather-forecasting-auto-reg/weather-forecasting-auto-reg.ipynb | mit | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as mp
from statsmodels.tsa.arima_model import ARMA, ARIMA
from statsmodels.tsa.stattools import adfuller, arma_order_select_ic
import warnings
from IPython.display import HTML
# At the time of writing, statsmodels... |
probml/pyprobml | deprecated/linreg_bayes_svi_hmc_pyro.ipynb | mit | #!pip install -q numpyro@git+https://github.com/pyro-ppl/numpyro
!pip3 install pyro-ppl
import os
from functools import partial
import torch
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import pyro
import pyro.distributions as dist
from pyro.nn import PyroSample
from p... |
musketeer191/job_analytics | getStats.ipynb | gpl-3.0 | import my_util as my_util; from my_util import *
HOME_DIR = 'd:/larc_projects/job_analytics/'
DATA_DIR = HOME_DIR + 'data/clean/'
title_df = pd.read_csv(DATA_DIR + 'new_titles_2posts_up.csv')
"""
Explanation: This script is dedicated to querying all needed statistics for the project.
End of explanation
"""
def dis... |
tpin3694/tpin3694.github.io | machine-learning/blurring_images.ipynb | mit | # Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Title: Blurring Images
Slug: blurring_images
Summary: How to blurring images using OpenCV in Python.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Images
Authors: Chris Albon
Preliminaries
End ... |
nathania/pysal | pysal/network/Network Usage.ipynb | bsd-3-clause | ntw.pointpatterns
dir(ntw.pointpatterns['crimes'])
"""
Explanation: A network is composed of a single topological representation of a road and $n$ point patterns which are snapped to the network.
End of explanation
"""
counts = ntw.count_per_edge(ntw.pointpatterns['crimes'].obs_to_edge,
... |
google/starthinker | colabs/dynamic_costs.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: Dynamic Costs Reporting
Calculate DV360 cost at the dynamic creative combination level.
License
Copyright 2020 Google LLC,
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Lic... |
DamienIrving/ocean-analysis | development/Frolicher2015_validation.ipynb | mit | import re
import glob
import numpy
import iris
import iris.coord_categorisation
from iris.experimental.equalise_cubes import equalise_attributes
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Heat budget validation
I'm doing an analysis of the CMIP5 single forcing experiments (historicalGHG and hi... |
LorenzoBi/courses | OODE/.ipynb_checkpoints/introduction_hints-checkpoint.ipynb | mit | from __future__ import print_function, division
import numpy as np # numpy will be used a lot, thus it is convenient to address it with np instead of numpy
"""
Explanation: Installation
The goal is to have working python with the following packages and bindings:
numpy (commonly used data types and algorithms in numer... |
robertoalotufo/ia898 | master/tutorial_numpy_1_7.ipynb | mit | import numpy as np
r,c = np.indices( (5, 10) )
print('r=\n', r)
print('c=\n', c)
"""
Explanation: <a href="https://colab.research.google.com/github/robertoalotufo/ia898/blob/master/master/tutorial_numpy_1_7.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/... |
xysmas/music_genre_classifier | src/report.ipynb | gpl-2.0 | %load_ext autoreload
%autoreload 2
import numpy as np
import sklearn.metrics as metrics
import utils as utils
from LogisticRegressionClassifier import LogisticRegressionClassifier
%pylab inline
"""
Explanation: Logistic Regression
Aaron Gonzales
CS529, Machine Learning
Project 3
Instructor: Trilce Estrada
Overview of... |
GoogleCloudPlatform/mlops-on-gcp | skew_detection/01_covertype_training_serving.ipynb | apache-2.0 | !pip install -q -U tensorflow==2.1
!pip install -U -q google-api-python-client
!pip install -U -q pandas
# Automatically restart kernel after installs
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
"""
Explanation: Serving a Keras Model on AI Platform Prediction with request-respon... |
stevesimmons/pydata-berlin2017-pandas-and-dask-from-the-inside | pandas-from-the-inside.ipynb | gpl-3.0 | # Sample code from the tutorial 'Pandas from the Inside'
# Stephen Simmons - mail@stevesimmons.com
# PyData Amsterdam, Fri 7 April 2017
#
# Requires python3, pandas and numpy.
# Jupyter/IPython are also useful.
# Best with pandas > 0.18.1.
# Pandas 0.18.0 requires a workaround for an indexing bug.
import csv
import... |
juloliveira/ipython | Apache Spark/Hello World Apache Spark.ipynb | gpl-2.0 | from pyspark import SparkContext
from pyspark.sql import Row
from pyspark.mllib.clustering import KMeans, KMeansModel
from sklearn import datasets
from numpy import array, sqrt
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Iniciando em PySpark
Este documento descreve basicamen... |
Caranarq/01_Dmine | Datasets/CFE/.ipynb_checkpoints/Usuarios Electricos (P0609)-checkpoint.ipynb | gpl-3.0 | descripciones = {
'P0609': 'Usuarios Electricos'
}
# Librerias utilizadas
import pandas as pd
import sys
import urllib
import os
import csv
import zipfile
# Configuracion del sistema
print('Python {} on {}'.format(sys.version, sys.platform))
print('Pandas version: {}'.format(pd.__version__))
import platform; prin... |
turbomanage/training-data-analyst | quests/serverlessml/01_explore/labs/explore_data.ipynb | apache-2.0 | from google.cloud import bigquery
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import shutil
"""
Explanation: Explore and create ML datasets
In this notebook, we will explore data corresponding to taxi rides in New York City to build a Machine Learning model in support o... |
SJSlavin/phys202-2015-work | assignments/assignment09/IntegrationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import integrate
"""
Explanation: Integration Exercise 2
Imports
End of explanation
"""
def integrand(x, a):
return 1.0/(x**2 + a**2)
def integral_approx(a):
# Use the args keyword argument to feed extra a... |
daneschi/berkeleytutorial | tutorial/02_runOptimizeModel/runOptimizeModel.ipynb | mit | # Import tulip
import sys
sys.path.insert(0, '../tuliplib/tulipBin/py')
import numpy as np
import matplotlib.pyplot as plt
# Import UQ Library
import tulipUQ as uq
# Import Computational Model Library
import tulipCM as cm
# Import Data Library
import tulipDA as da
# Import Action Library
import tulipAC as ac
# READ DA... |
juditacs/snippets | misc/function_map.ipynb | lgpl-3.0 | d = {'a': 'AB', 'b': 'C'}
funcs = {}
for key, value in d.items():
funcs[key] = lambda v: v in value
# True, True, False ?
print(funcs['a']('AB'), funcs['a']('A'), funcs['a']('C'))
# False, True ?
print(funcs['b']('AB'), funcs['b']('C'))
"""
Explanation: Create a function map for substring comparison
~~~
d = ... |
5x5x5x5/Machine_Learning_Life_Science | scikit-learn classification pipeline.ipynb | mit | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn import metrics
from rdkit import Chem
from rdkit.Chem import Draw
%matplotlib inline
"""
Explanation: Train-Validation-Test Set Split
Train models
parameter search over random space
Evaluation of fit
Setup Computa... |
nagordon/mechpy | tutorials/sundries.ipynb | mit | import numpy as np
y = '''62606.53409
59989.34659
62848.01136
80912.28693
79218.03977
81242.1875
59387.27273
73027.5974
69470.69805
66843.99351
82758.44156
81647.72727
77519.96753'''
y = [float(x) for x in np.array(y.replace('\n',',').split(','))]
print(y, end=" ")
"""
Explanation: Mechpy Tutorials
a mechanical engine... |
brian-rose/ClimateModeling_courseware | Lectures/Lecture25 -- Water, water everywhere!.ipynb | mit | # Ensure compatibility with Python 2 and 3
from __future__ import print_function, division
"""
Explanation: ATM 623: Climate Modeling
Brian E. J. Rose, University at Albany
Lecture 25: Water, water everywhere!
A brief look at the effects of evaporation on global climate
Warning: content out of date and not maintained... |
flightcom/freqtrade | freqtrade/templates/strategy_analysis_example.ipynb | gpl-3.0 | from pathlib import Path
from freqtrade.configuration import Configuration
# Customize these according to your needs.
# Initialize empty configuration object
config = Configuration.from_files([])
# Optionally, use existing configuration file
# config = Configuration.from_files(["config.json"])
# Define some constant... |
IanHawke/maths-with-python | 04-basic-plotting.ipynb | mit | from matplotlib import pyplot
%matplotlib inline
from matplotlib import rcParams
rcParams['figure.figsize']=(12,9)
from math import sin, pi
x = []
y = []
for i in range(201):
x_point = 0.01*i
x.append(x_point)
y.append(sin(pi*x_point)**2)
pyplot.plot(x, y)
pyplot.show()
"""
Explanation: Plotting
There ... |
watsonyanghx/CS231n | assignment1/.ipynb_checkpoints/features-checkpoint.ipynb | mit | import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloading extenrnal modu... |
AllenDowney/ModSim | python/soln/examples/hiv_model_soln.ipynb | gpl-2.0 | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
josef-pkt/statsmodels | examples/notebooks/recursive_ls.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
from pandas_datareader.data import DataReader
np.set_printoptions(suppress=True)
"""
Explanation: Recursive least squares
Recursive least squares is an expanding window version of ordinary least squa... |
qinwf-nuan/keras-js | notebooks/layers/recurrent/GRU.ipynb | mit | data_in_shape = (3, 6)
rnn = GRU(4, activation='tanh', recurrent_activation='hard_sigmoid')
layer_0 = Input(shape=data_in_shape)
layer_1 = rnn(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
weights = []
for i, w in enumerate(model.get_weights()):
np.... |
pacoqueen/ginn | extra/install/ipython2/ipython-5.10.0/examples/IPython Kernel/Beyond Plain Python.ipynb | gpl-2.0 | print("Hi")
"""
Explanation: IPython: beyond plain Python
When executing code in IPython, all valid Python syntax works as-is, but IPython provides a number of features designed to make the interactive experience more fluid and efficient.
First things first: running code, getting help
In the notebook, to run a cell of... |
ShorensteinCenter/Shorenstein-Center-Notebooks | Shorenstein_Center_Notebook_2.ipynb | mit | # set colors
c1='#18a45f' # subs
c2='#ec3038' # unsubs
c3='#3286ec' # cleaned
c4='#fecf5f' # pending
c_ev= '#cccccc'
c_nev='#000000'
c12m = '#016d2c'#'12 months'
c9m ='#31a354' #'9 months '
c6m = '#74c476' #'6 months'
c3m= '#bae4b3' #'3 months'
c1m = '#edf8e9'#'1 month'
# import libraries
%matplotlib inline
i... |
ContextLab/hypertools | docs/tutorials/normalize.ipynb | mit | import hypertools as hyp
import numpy as np
%matplotlib inline
"""
Explanation: Normalization
The normalize is a helper function to z-score your data. This is useful if your features (columns) are scaled differently within or across datasets. By default, hypertools normalizes across the columns of all datasets passed... |
julienchastang/unidata-python-workshop | notebooks/Bonus/Downloading GFS with Siphon.ipynb | mit | %matplotlib inline
from siphon.catalog import TDSCatalog
best_gfs = TDSCatalog('http://thredds.ucar.edu/thredds/catalog/grib/NCEP/GFS/'
'Global_0p25deg/catalog.xml?dataset=grib/NCEP/GFS/Global_0p25deg/Best')
best_gfs.datasets
"""
Explanation: <div style="width:1000 px">
<div style="float:right; ... |
4dsolutions/Python5 | Computing Volumes.ipynb | mit | import math
xyz_volume = math.sqrt(2)**3
ivm_volume = 3
print("XYZ units:", xyz_volume)
print("IVM units:", ivm_volume)
print("Conversion constant:", ivm_volume/xyz_volume)
"""
Explanation: Synergetics<br/>Oregon Curriculum Network
<h3 align="center">Computing Volumes in XYZ and IVM units</h3>
<h4 align="center">by Ki... |
pmgbergen/porepy | tutorials/mpfa.ipynb | gpl-3.0 | import numpy as np
import porepy as pp
# Create grid
n = 5
g = pp.CartGrid([n,n])
g.compute_geometry()
# Define boundary type
dirich = np.ravel(np.argwhere(g.face_centers[1] < 1e-10))
bound = pp.BoundaryCondition(g, dirich, 'dir')
# Create permeability matrix
k = np.ones(g.num_cells)
perm = pp.SecondOrderTensor(k)
... |
scottprahl/miepython | docs/09_backscattering.ipynb | mit | #!pip install --user miepython
import numpy as np
import matplotlib.pyplot as plt
try:
import miepython
except ModuleNotFoundError:
print('miepython not installed. To install, uncomment and run the cell above.')
print('Once installation is successful, rerun this cell again.')
"""
Explanation: Backscatte... |
joonasfo/python | Assignment_05.ipynb | mit | # Initial import statements
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.pyplot import *
from numpy import *
from numpy.linalg import *
"""
Explanation: Assignment: 05 LU decomposition etc.
Introduction to Numerical Problem Solving, Spring 2017
19.2.2017, Joonas Forsberg<br />... |
ML4DS/ML4all | TM2.Topic_Models/TM_py3_NSF/notebook/TM2_TopicModels_student.ipynb | mit | # Common imports
%matplotlib inline
import matplotlib.pyplot as plt
import pylab
import numpy as np
# import pandas as pd
# import os
from os.path import isfile, join
# import scipy.io as sio
# import scipy
import zipfile as zp
# import shutil
# import difflib
import gensim
"""
Explanation: Exploring and undertand... |
alias-org/alias | examples/demonstration-notebook.ipynb | gpl-3.0 | import alias as al
example = al.ArgumentationFramework('Example')
"""
Explanation: First, import the library and create a blank abstract argumentation framework:
Welcome to the ALIAS Demonstration Notebook!
This Ipython Notebook aims to demonstrate the key functionality of the ALIAS library.
End of explanation
"""
e... |
google-aai/sc17 | cats/step_5_to_8_part2.ipynb | apache-2.0 | # Enter your username:
YOUR_GMAIL_ACCOUNT = '******' # Whatever is before @gmail.com in your email address
# Libraries for this section:
import os
import datetime
import numpy as np
import pandas as pd
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import tensorflow as tf
from tensorflow.c... |
IntelPNI/brainiak | examples/reprsimil/bayesian_rsa_example.ipynb | apache-2.0 | %matplotlib inline
import scipy.stats
import scipy.spatial.distance as spdist
import numpy as np
from brainiak.reprsimil.brsa import BRSA, prior_GP_var_inv_gamma, prior_GP_var_half_cauchy
from brainiak.reprsimil.brsa import GBRSA
import brainiak.utils.utils as utils
import matplotlib.pyplot as plt
import logging
np.ran... |
henrysky/astroNN | demo_tutorial/VAE/.ipynb_checkpoints/variational_autoencoder_demo-checkpoint.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format='retina'
import numpy as np
import pylab as plt
from scipy.stats import norm
from tensorflow.keras.layers import Input, Dense, Lambda, Layer, Add, Multiply
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras import regularizers
import ten... |
mgeier/jupyter-presentation | jupyter-presentation.ipynb | cc0-1.0 | import soundfile as sf
sig, fs = sf.read('data/singing.wav')
"""
Explanation: Using Jupyter/IPython for Teaching
<p xmlns:dct="http://purl.org/dc/terms/">
<a rel="license"
href="http://creativecommons.org/publicdomain/zero/1.0/">
<img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-sty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.