repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
tiagoantao/biopython-notebook
notebooks/05 - Sequence Input and Output.ipynb
mit
from Bio import SeqIO help(SeqIO) """ Explanation: Source of the materials: Biopython Tutorial and Cookbook (adapted) Sequence Input/Output In this notebook we'll discuss in more detail the Bio.SeqIO module, which was briefly introduced before. This aims to provide a simple interface for working with assorted sequenc...
junhwanjang/DataSchool
Lecture/14. 선형 회귀 분석/1) 회귀 분석용 가상 데이터 생성 방법.ipynb
mit
from sklearn.datasets import make_regression X, y, c = make_regression(n_samples=10, n_features=1, bias=0, noise=0, coef=True, random_state=0) print("X\n", X) print("y\n", y) print("c\n", c) plt.scatter(X, y, s=100) plt.show() """ Explanation: 회귀 분석용 가상 데이터 생성 방법 Scikit-learn 의 datasets 서브 패키지에는 회귀 분석 시험용 가상 데이터를 생성하...
jmhsi/justin_tinker
data_science/lendingclub_bak/dataprep_and_modeling/1.0.0_pytorch_regression.ipynb
apache-2.0
platform = 'lendingclub' use_cuda = True dtype = torch.cuda.FloatTensor save_path = "model_dump/nn_1_0_0/" store = pd.HDFStore( dc.home_path+'/justin_tinkering/data_science/lendingclub/{0}_store.h5'. format(platform), append=True) loan_info = store['train_filtered_columns'] columns = loan_info.columns.val...
GoogleCloudPlatform/tf-estimator-tutorials
01_Regression/05.0 - TF Regression Model - Custom Estimator.ipynb
apache-2.0
MODEL_NAME = 'reg-model-04' TRAIN_DATA_FILES_PATTERN = 'data/train-*.csv' VALID_DATA_FILES_PATTERN = 'data/valid-*.csv' TEST_DATA_FILES_PATTERN = 'data/test-*.csv' RESUME_TRAINING = False PROCESS_FEATURES = True EXTEND_FEATURE_COLUMNS = True MULTI_THREADING = True """ Explanation: Steps to use the TF Experiment APIs...
probml/pyprobml
notebooks/misc/git_lfs_colab_demo.ipynb
mit
!curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash !sudo apt-get install git-lfs """ Explanation: <a href="https://colab.research.google.com/github/always-newbie161/probml-notebooks/blob/lfs_git/notebooks/git_lfs_colab_demo.ipynb" target="_parent"><img src="https://colab.re...
pybel/pybel-notebooks
algorithms/Subgraph Comparison.ipynb
apache-2.0
import logging import os import sys import time from collections import Counter, defaultdict from operator import itemgetter import matplotlib.pyplot as plt import networkx as nx import pandas as pd import numpy as np import seaborn as sns import pybel import pybel_tools as pbt from pybel.constants import * from pybe...
oditorium/blog
iPython/ECB-DataImport.ipynb
agpl-3.0
import urllib.request as req class DataImport: """ web data import base class delimiter_row - if files are parsed, what delimits rows (default "\n") delimiter_col - if files are parsed, what delimits cols (default ",") DEPENDENCIES urllib.request """ __version__ = "...
abezuglov/ANN
Storm-Surge/notebooks/ANN Analysis on synthetic hurricanes.ipynb
gpl-3.0
import scipy import scipy.stats diff = (network_out-true_out[:,8:]) #print(diff.shape) y = diff[:,5] print(y.shape) #y = np.square(y) x = np.arange(-3,3,0.01) size = diff.shape[0] h = plt.hist(y, bins=100, color='w') plt.xlim(-3,3) plt.ylim(0,1000) dist_names = ['t'] for dist_name in dist_names: dist = getattr...
marcelomiky/PythonCodes
scikit-learn/scikit-learn-book/Chapter 1 (2nd ed.) - A Gentle Introduction to Machine Learning with Python and Scikit-learn.ipynb
mit
%pylab inline """ Explanation: A Gentle Introduction to Machine Learning with Python and Scikit-learn Guillermo Moncecchi, Diego Garat, Raúl Garreta This Python 3 IPython notebook is based on the planned version of the Second Edition of the "Learning Scikit-learn: Machine Learning with Python". We do not know if this ...
ronnydw/data-science-projects
historical-merchandise-export-USA-vs-CHN/evolution-merchandise-export-by-USA-CHN.ipynb
mit
import pandas as pd import numpy as np import random import matplotlib.pyplot as plt data = pd.read_csv('./world-development-indicators/Indicators.csv') data.shape data.head() """ Explanation: Evolution of the worlds biggest exporters: USA vs China Load the Dataset and select the indicator and countries End of expla...
google-research/google-research
time_varying_optimization/tvsdp.ipynb
apache-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...
willettk/insight
notebooks/neural_networks_and_deep_learning.ipynb
apache-2.0
%matplotlib inline from matplotlib import pyplot as plt import numpy as np import random """ Explanation: Work with http://neuralnetworksanddeeplearning.com/ End of explanation """ def sigmoid(z): return 1./(1. + np.exp(-z)) def sigmoid_vector(w,x,b): return 1./(1. + np.exp(-1 * np.sum(w * x) - b)...
yevheniyc/Projects
1j_NLP_Python/ex02.ipynb
mit
x = "Rinôçérôse screams flow not unlike an encyclopædia, \ 'TECHNICIÄNS ÖF SPÅCE SHIP EÅRTH THIS IS YÖÜR CÄPTÅIN SPEÄKING YÖÜR ØÅPTÅIN IS DEA̋D' to Spın̈al Tap." type(x) """ Explanation: Exercise 02: concerns about characters The following shows examples of how to use codecs and normalize unicode, and draws heavily fro...
eneskemalergin/Data_Structures_and_Algorithms
Chapter3/3-Sets_and_Maps.ipynb
gpl-3.0
from linearset import Set smith = Set() smith.add("CSCI-112") smith.add("MATH-121") smith.add("HIST-340") smith.add("ECON-101") robert = Set() robert.add('POL-101') robert.add('ANTH-230') robert.add('CSCI-112') robert.add('ECON-101') if smith == robert: print("Smith and Robert are taking the same courses.") else...
OceanPARCELS/parcels
parcels/examples/documentation_stuck_particles.ipynb
mit
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4, Variable, Field from glob import glob import numpy as np import xarray as xr from datetime import timedelta as delta import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib....
liumengjun/cn-deep-learning
tutorials/intro-to-tflearn/TFLearn_Digit_Recognition.ipynb
mit
# Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist """ Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. This...
YangDS/recommenders
notebooks/Example 2 Collaborative Filtering Recommenders.ipynb
gpl-3.0
import pandas as pd from scipy.spatial.distance import cosine # Data was already dlownloaded. data = pd.read_csv('data/lastfm/lastfm-matrix-germany.csv') # check out the data set you can do so using data.head(): data.head(6).ix[:,2:10] """ Explanation: Collaborative Filtering with Python (Python 2.7) Originate from ...
dianafprieto/SS_2017
05_NB_VTKPython_Scalar.ipynb
mit
%gui qt import vtk from vtkviewer import SimpleVtkViewer #help(vtk.vtkRectilinearGridReader()) """ Explanation: <img src="imgs/header.png"> Visualization techniques for scalar fields in VTK + Python Recap: The VTK pipeline <img src="imgs/vtk_pipeline.png", align=left> $~$ Visualizing data within a rectilinear grid The...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/assignment/week1/week-1-simple-regression-assignment-exercise.ipynb
mit
import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') import graphlab """ Explanation: Regression Week 1: Simple Linear Regression In this notebook we will use data on house sales in King County to predict house prices using simple (one input) linear regression. You will: * Use graphlab SArray and...
esa-as/2016-ml-contest
HouMath/Face_classification_HouMath_XGB_02.ipynb
apache-2.0
%matplotlib inline import pandas as pd from pandas.tools.plotting import scatter_matrix import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns import matplotlib.colors as colors import xgboost as xgb import numpy as np from sklearn.metrics import confusion_matrix, f1_score, accuracy_score from ...
danielfather7/teach_Python
lecture/06.Procedural_Python.part3.ipynb
gpl-3.0
instructors = ['Dave', 'Jim', 'Dorkus the Clown'] if 'Dorkus the Clown' in instructors: print('#fakeinstructor') """ Explanation: Procedural programming in python Topics Flow control, part 2 Functions In class exercise: Functionalize this! From nothing to something: Pairwise correlation between rows in a pandas ...
xtr33me/deep-learning
dcgan-svhn/DCGAN.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
mkcor/advanced-pandas
notebooks/04_testing.ipynb
cc0-1.0
import pandas as pd df = pd.read_csv('../data/tidy_who.csv') df.sample(5) """ Explanation: Testing for data analysis In a data analysis context, we want to test our code, as usual, but also our data (i.e., expected schema; e.g., data types) and our statistics (i.e., expected properties of distributions; e.g., value ...
Benedicto/ML-Learning
Clustering_2_kmeans-with-text-data_blank.ipynb
gpl-3.0
import graphlab import matplotlib.pyplot as plt import numpy as np import sys import os from scipy.sparse import csr_matrix %matplotlib inline '''Check GraphLab Create version''' from distutils.version import StrictVersion assert (StrictVersion(graphlab.version) >= StrictVersion('1.8.5')), 'GraphLab Create must be ve...
gfeiden/Notebook
Daily/20160712_Seasonal_Variation_Halflife.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Seasonal Time Dilation due to Earth's Eccentric Orbit Just curious to see how large the effect is. End of explanation """ d_perihelion = 1.47098074e11 # m d_aphelion = 1.52097701e11 # m d_average = 1.4959787e11 # m GMsun...
modin-project/modin
examples/tutorial/jupyter/execution/pandas_on_ray/local/exercise_4.ipynb
apache-2.0
import modin.pandas as pd import numpy as np from tqdm import tqdm from modin.config import ProgressBar ProgressBar.enable() frame_data = np.random.randint(0, 100, size=(2**18, 2**8)) df = pd.DataFrame(frame_data).add_prefix("col") """ Explanation: <center><h2>Scale your pandas workflows by changing one line of code<...
google/assortment-quality-for-shopping-ads
Colab - Setup Guide.ipynb
apache-2.0
#@title Copyright 2021 Google LLC. # 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,...
charlesreid1/empirical-model-building
ipython/Factorial - Two-Level Four-Factor Design.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np from numpy.random import rand, seed import seaborn as sns import scipy.stats as stats from matplotlib.pyplot import * effects = {} effects[0] = {'x0': 0.0} effects[1] = {'x1': 0.4, 'x2': -7.6, 'x3': 14.1, 'x4': 66.7} ...
barjacks/pythonrecherche
06 Rückblick, Scraping Beispiele/01 Rückblick For-Loop-Übungen.ipynb
mit
lst = [2, 3, 5, 7] for prime in lst: print(prime) """ Explanation: 10 For-Loop-Rückblick-Übungen In den Teilen der folgenden Übungen habe ich den Code mit "XXX" ausgewechselt. Es gilt in allen Übungen, den korrekten Code auszuführen und die Zelle dann auszuführen. 1.Drucke alle diese Prim-Zahlen aus: End of expla...
ctherien/pysptools
pysptools/ml/nbex/nbex_xgb_cv.ipynb
apache-2.0
%matplotlib inline from __future__ import print_function import os import os.path as osp import numpy as np import pysptools.ml as ml import pysptools.skl as skl from sklearn.model_selection import train_test_split home_path = os.environ['HOME'] source_path = osp.join(home_path, 'dev-data/CZ_hsdb') result_path = ...
muatik/my-coding-challenges
algorithm-questions.ipynb
mit
def rev(s): b, e = 0, 0 for i in range(len(s)): c = s[i] if c != " " and i+1 != len(s): e+=1 continue if i+1 == len(s): e += 1 for j in range((e-b)//2): s[b+j], s[e-1-j]=s[e-1-j], s[b+j] e +=...
SciTools/cube_browser
doc/write_your_own/components/ValueCatcher.ipynb
bsd-3-clause
import ipywidgets import IPython.display """ Explanation: Text Input Box Example showing how to construct a text input widget that can be used to capture a string (such as a filepath). End of explanation """ args = ipywidgets.Text( description='Input string:', value='cube') IPython.display.display(args) ""...
SylvainCorlay/bqplot
examples/Tutorials/Brush Interval Selector.ipynb
apache-2.0
import numpy as np from ipywidgets import Layout, HTML, VBox import bqplot.pyplot as plt """ Explanation: Linking Plots Using Brush Interval Selector Details on how to use the brush interval selector can be found in this notebook. Brush interval selectors can be used where continuous updates are not desirable (for ex...
bzamecnik/ml
snippets/scikit-learn/OneHotEncoder_decoding.ipynb
mit
from sklearn.preprocessing import OneHotEncoder import numpy as np orig = np.array([6, 9, 8, 2, 5, 4, 5, 3, 3, 6]) """ Explanation: Decoding values from OneHotEncoder Let's say we encoded a categorical variable into one-hot encoding, ie. a binary vector with each column indicating one of the values. The scikit-learn ...
billzhao1990/CS231n-Spring-2017
assignment2/.ipynb_checkpoints/Dropout-checkpoint.ipynb
mit
# As usual, a bit of setup from __future__ import print_function 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.solv...
ubcgif/gpgLabs
notebooks/seismic/Seis_Refraction.ipynb
mit
plotWavelet() """ Explanation: Interpretation and data acquisition strategies of seismic refraction data In the <a href="https://www.3ptscience.com/app/SeismicRefraction">3pt Science app</a>, you explored the expected arrival times for refractions and reflections from a two-layer over a half-space model. In this note...
mitdbg/modeldb
client/workflows/demos/registry/multiple-framework-example-end-to-end.ipynb
mit
from __future__ import print_function import warnings from sklearn.exceptions import ConvergenceWarning warnings.filterwarnings("ignore", category=ConvergenceWarning) warnings.filterwarnings("ignore", category=FutureWarning) import itertools import os import time import six import numpy as np import pandas as pd i...
spro/practical-pytorch
glove-word-vectors/glove-word-vectors.ipynb
mit
import torch import torchtext.vocab as vocab glove = vocab.GloVe(name='6B', dim=100) print('Loaded {} words'.format(len(glove.itos))) """ Explanation: Practical PyTorch: Exploring Word Vectors with GloVe When working with words, dealing with the huge but sparse domain of language can be challenging. Even for a small...
mne-tools/mne-tools.github.io
0.17/_downloads/f44d9c0360e7806c2f8988ccd7a3b432/plot_point_spread.ipynb
bsd-3-clause
import os.path as op import numpy as np from mayavi import mlab import mne from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, apply_inverse from mne.simulation import simulate_stc, simulate_evoked """ Explanation: Corrupt known signal with point spread The aim of this tutorial is to...
daviddesancho/MasterMSM
examples/mueller_potential/mueller_potential_openmm.ipynb
gpl-2.0
%matplotlib inline %load_ext autoreload %autoreload 2 import time import numpy as np import h5py import scipy.stats import matplotlib.pyplot as plt import seaborn as sns sns.set(style="ticks", color_codes=True, font_scale=1.5) sns.set_style({"xtick.direction": "in", "ytick.direction": "in"}) from collections import Ord...
rvuduc/cse6040-ipynbs
08--pandas-seaborn.ipynb
bsd-3-clause
import pandas as pd """ Explanation: CSE 6040, Fall 2015 [08]: Data analysis and visualization In todays class, we will first introduce a data analysis tools called Pandas, and then show how to visualize the data using a module called Seaborn. Most of the examples come from Pandas tutorial and Seaborn tutorial. Part ...
QuantCrimAtLeeds/PredictCode
examples/Self-exciting point processes 2.ipynb
artistic-2.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import datetime import open_cp """ Explanation: A grid based model SEPP model In (1), an explicitly grid-based self-exciting point process (SEPP) model was considered. The paper (1) is mostly concerned with two field-trials of the SEPP or epidemic-...
ivannz/crossing_paper2017
experiments/full_experiment.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt """ Explanation: the Monte Carlo experiment End of explanation """ import time, gzip import os, pickle def save(obj, path, prefix=None): prefix_ = "" if prefix is None else "%s_"%(prefix,) filename_ = os.path.join(path, "%s%s.gz"%(prefix...
mdiaz236/DeepLearningFoundations
tensorboard/Anna_KaRNNa_Summaries.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
evanmiltenburg/python-for-text-analysis
Chapters/Chapter 11 - Functions and scope.ipynb
apache-2.0
print("Happy Birthday to you!") print("Happy Birthday to you!") print("Happy Birthday, dear Emily.") print("Happy Birthday to you!") """ Explanation: Chapter 11: Functions and scope We use an example from this website to show you some of the basics of writing a function. We use some materials from this other Python c...
cfcdavidchan/Deep-Learning-Foundation-Nanodegree
face_generation/dlnd_face_generation.ipynb
mit
data_dir = './data' # FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe" #data_dir = '/input' """ DON'T MODIFY ANYTHING IN THIS CELL """ import helper helper.download_extract('mnist', data_dir) helper.download_extract('celeba', data_dir) """ Explanation: Face Generation In this project, you'll use generative adv...
exowanderer/SpitzerDeepLearningNetwork
Notebooks/tensorflow_CoreTF_Spitzer - ELU.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf tf.logging.set_verbosity(tf.logging.ERROR) import warnings warnings.filterwarnings("ignore") %matplotlib inline from matplotlib import pyplot as plt from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, Min...
MonicaGutierrez/PracticalMachineLearningClass
exercises/06-Titanic_cross_validation.ipynb
mit
import pandas as pd url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/titanic.csv' titanic = pd.read_csv(url, index_col='PassengerId') titanic.head() """ Explanation: Exercise 06 Data preparation and model evaluation exercise with Titanic data We'll be working with a dataset from Kaggle's Titanic c...
zakandrewking/cobrapy
documentation_builder/sampling.ipynb
lgpl-2.1
from cobra.test import create_test_model from cobra.flux_analysis import sample model = create_test_model("textbook") s = sample(model, 100) s.head() """ Explanation: Flux sampling Basic usage The easiest way to get started with flux sampling is using the sample function in the flux_analysis submodule. sample takes a...
dnc1994/MachineLearning-UW
ml-regression/blank/week-3-polynomial-regression-assignment-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 3: Assessing Fit (polynomial regression) In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will: * Write a function to take a...
IS-ENES-Data/submission_forms
test/forms/test/test_testsuite_1234.ipynb
apache-2.0
from dkrz_forms import form_widgets form_widgets.show_status('form-submission') MY_LAST_NAME = "...." # e.gl MY_LAST_NAME = "schulz" #------------------------------------------------- from dkrz_forms import form_handler, form_widgets form_info = form_widgets.check_pwd(MY_LAST_NAME) sf = form_handler.init_form(form_...
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/06. Variable Names.ipynb
mit
print = 10.20 # Rule 1: "print" is a reserved word in Python and therefore we cannot use it. 0sales = 10.20 # Rule 2: cannot start a name with a number. this has spaces = 10.20 # Rule 2: space character is punctation. thisnamehasa+init = 10.20 # Rule 3: Fails because "+" is a special charac...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2019_2.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - Enoncé 23 octobre 2018 (2) Correction du second énoncé de l'examen du 23 octobre 2018. L'énoncé propose une méthode pour renseigner les valeurs manquantes dans une base de deux variables. End of explanation """ import numpy.rando...
fullmetalfelix/ML-CSC-tutorial
ACSF-Dimer.ipynb
gpl-3.0
# --- INITIAL DEFINITIONS --- from sklearn.neural_network import MLPRegressor import numpy, math, random import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from ase import Atoms from visualise import view # cutoff for all ACSF Rcut = 5.0 # cutoff function def fcut(r): if r >= Rcut: return 0 ...
paoloRais/lightfm
examples/movielens/example.ipynb
apache-2.0
import numpy as np from lightfm.datasets import fetch_movielens movielens = fetch_movielens() """ Explanation: An implicit feedback recommender for the Movielens dataset Implicit feedback For some time, the recommender system literature focused on explicit feedback: the Netflix prize focused on accurately reproducin...
DJCordhose/ai
notebooks/2019_tf/autoencoders_intro.ipynb
mit
import tensorflow as tf tf.logging.set_verbosity(tf.logging.ERROR) print(tf.__version__) from tensorflow.keras.datasets import mnist import numpy as np (x_train, _), (x_test, _) = mnist.load_data() """ Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/2019_tf/autoencod...
rohanfray/Wk6_Proj
IS620_wk6_project.ipynb
mit
nReviewers = 24983 nJokes = 100 G=nx.generators.empty_graph(nReviewers+nJokes) G.clear() G.name="Jester Dataset 1" Jokes = [] for i in range(0,100): Jokes.append('Joke' + str(i)) with open('jester-data-1.csv', 'rb') as csvfile: book = csv.reader(csvfile) i = 0 for row in book: for j in range(...
tofgarion/lp-visu
lp_visu/ilp_visu_ex.ipynb
gpl-3.0
from lp_visu import LPVisu """ Explanation: You can use LPVisu to visualize Integer Linear Programming problems in Jupyter notebooks. First import the LPVisu class: End of explanation """ # problem definition A = [[1.0, 0.0], [1.0, 2.0], [2.0, 1.0]] b = [8.0, 15.0, 18.0] c = [-4.0, -3.0] x1_bounds = (0, None) x2_bo...
llulai/deep-learning
autoencoder/Convolutional_Autoencoder_Solution.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
bryanwweber/thermostate
docs/Tutorial.ipynb
bsd-3-clause
from thermostate import State, Q_, units, set_default_units """ Explanation: Tutorial This tutorial will guide you in the basic use of ThermoState. The ThermoState package is designed to ease the evaluation of thermodynamic properties for common substances used in Mechanical Engineering courses. Rather than looking up...
CyberCRI/dataanalysis-herocoli-redmetrics
v1.52.2/Functions/0.2 GF French localization.ipynb
cc0-1.0
%run "../Functions/0.1 GF English localization.ipynb" """ Explanation: French localization End of explanation """ processGFormFR = not ('gformFR1522' in globals()) if processGFormFR: try: gformFR1522 = pd.read_csv(\ frPath,\ dtype=str,\ ...
aschaffn/phys202-2015-work
days/day12/Integration.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np """ Explanation: Numerical Integration Learning Objectives: Learn how to numerically integrate 1d and 2d functions that are represented as Python functions or numerical arrays of data using scipy.integrate. This lesson was orgi...
GoogleCloudPlatform/asl-ml-immersion
notebooks/introduction_to_tensorflow/labs/3_keras_sequential_api_vertex.ipynb
apache-2.0
import datetime import os import shutil import numpy as np import pandas as pd import tensorflow as tf from google.cloud import aiplatform from matplotlib import pyplot as plt from tensorflow import keras from tensorflow.keras.callbacks import TensorBoard from tensorflow.keras.layers import Dense, DenseFeatures from t...
alberto-antonietti/nest-simulator
doc/model_details/IAF_neurons_singularity.ipynb
gpl-2.0
import sympy as sp sp.init_printing(use_latex=True) from sympy.matrices import zeros tau_m, tau_s, C, h = sp.symbols('tau_m, tau_s, C, h') """ Explanation: IAF neurons singularity This notebook describes how NEST handles the singularities appearing in the ODE's of integrate-and-fire model neurons with alpha- or expone...
leosartaj/scipy-2016-tutorial
tutorial_exercises/04-Matrices.ipynb
bsd-3-clause
rot = Matrix([[r*cos(theta), -r*sin(theta)], [r*sin(theta), r*cos(theta)]]) rot """ Explanation: Matrices The SymPy Matrix object helps us with small problems in linear algebra. End of explanation """ rot.det() rot.inv() rot.singular_values() """ Explanation: Standard methods End of explanation """...
linamnt/studyGroup
lessons/python/intro/IntroPython_HG_Code_along.ipynb
apache-2.0
# % is the modulus operator # x % y -> return the remainder of x / y """ Explanation: Intro to Python UofT Coders, Sep 26 2019 Instructor: Haidy Giratallah Lesson repeat from: UofT coder lessons (https://github.com/UofTCoders/studyGroup/blob/gh-pages/lessons/python/intro/IntroPython-AH.ipynb) Before getting started...
ContinuumIO/pydata-apps
Section_0_Introduction.ipynb
mit
from IPython.display import IFrame IFrame('http://blaze.pydata.org/en/latest/', width='100%', height=350) """ Explanation: <img src="images/continuum_analytics_logo.png" alt="Continuum Logo", align="right", width="30%"> Bu...
ecell/ecell4-notebooks
en/tutorials/tutorial04.ipynb
gpl-2.0
from ecell4_base.core import * """ Explanation: 4. How to Run a Simulation In sections 2 and 3, we explained the way to build a model and to setup the intial state. Now, it is the time to run a simulation. Corresponding to World classes, six Simulator classes are there: spatiocyte.SpatiocyteSimulator, egfrd.EGFRDSimul...
bwinkel/cygrid
notebooks/B01_OTF-map_exposure_calculator.ipynb
gpl-3.0
%load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import matplotlib.pyplot as pl from astropy.wcs import WCS from scipy import constants import cygrid np.set_printoptions(precision=1) def gaincurve(elev, a0, a1, a2): ''' Radio telescope ...
kpolimis/kpolimis.github.io-src
output/downloads/notebooks/google_location_history.ipynb
gpl-3.0
with open('LocationHistory.json', 'r') as fh: raw = json.loads(fh.read()) ld = pd.DataFrame(raw['locations']) del raw #free up some memory # convert to typical units ld['latitudeE7'] = ld['latitudeE7']/float(1e7) ld['longitudeE7'] = ld['longitudeE7']/float(1e7) ld['timestampMs'] = ld['timestampMs'].map(lambda x: ...
fabriziocosta/EDeN_examples
graph_format.ipynb
gpl-2.0
%matplotlib inline %load_ext autoreload %autoreload 2 from eden.util import configure_logging import logging logger = logging.getLogger() configure_logging(logger,verbosity=1) import pylab as plt import networkx as nx G=nx.Graph() G.add_node(0, label='A') G.add_node(1, label='B') G.add_node(2, label='C') G.add_edge(...
IanHawke/Southampton-PV-NumericalMethods-2016
solutions/03-Root-finding.ipynb
mit
from __future__ import division import numpy from matplotlib import pyplot %matplotlib notebook def f(Rs): return 3.5 -3.2*(numpy.exp((10+3*Rs)/20.0 - 1.0) - 1.0) - (10.0 + 3.0*Rs)/300.0 - 3 Rs = numpy.linspace(0, 10) pyplot.figure(figsize=(10,6)) pyplot.plot(Rs, f(Rs)) pyplot.xlabel(r"$R_s$") pyplot.ylabel(r"$f$...
crystalzhaizhai/cs207_yi_zhai
lectures/L12/L12.ipynb
mit
import collections Card = collections.namedtuple('Card', ['rank', 'suit']) class FrenchDeck(): ranks = [str(n) for n in range(2, 11)] + list('JQKA') suits = 'spades diamonds clubs hearts'.split() def __init__(self): self._cards = [Card(rank, suit) for suit in self.suits for rank in self.ranks...
kgrodzicki/machine-learning-specialization
course-2-regression/notebooks/week-4-ridge-regression-assignment-1-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 4: Ridge Regression (interpretation) In this notebook, we will run ridge regression multiple times with different L2 penalties to see which one produces the best fit. We will revisit the example of polynomial regression as a means to see the effect of L2 regularization....
deepmind/deepmind-research
enformer/enformer-usage.ipynb
apache-2.0
import tensorflow as tf # Make sure the GPU is enabled assert tf.config.list_physical_devices('GPU'), 'Start the colab kernel with GPU: Runtime -> Change runtime type -> GPU' !pip install kipoiseq==0.5.2 --quiet > /dev/null # You can ignore the pyYAML error """ Explanation: Copyright 2021 DeepMind Technologies Limit...
flowersteam/explauto
notebook/DivaDMP.ipynb
gpl-3.0
from __future__ import print_function import os import numpy as np from explauto.environment.diva import DivaEnvironment diva_cfg = dict(diva_path=os.path.join(os.getenv("HOME"), 'software/DIVAsimulink/'), synth="octave", m_mins = np.array([-1]*7), # motor bounds m_maxs...
crhaithcock/RushHour
RushHourPy/analysis_prototypes/solution_path_nodes_prototype.ipynb
cc0-1.0
%matplotlib inline import os import pandas as pd import copy from IPython.display import HTML import sqlite3 as db import networkx as nx import collections con = db.connect('C:/Users/cliff/workspace/rushHour/Data Model and SQL/Schema Definition and Bulk Load/rush_hour.db') c = con.cursor() """ Explanation: The goals...
ccasotto/rmtk
rmtk/vulnerability/derivation_fragility/NLTHA_on_SDOF/MSA_on_SDOF.ipynb
agpl-3.0
import MSA_on_SDOF from rmtk.vulnerability.common import utils import numpy as np import MSA_utils %matplotlib inline """ Explanation: Multiple Stripe Analysis (MSA) for Single Degree of Freedom (SDOF) Oscillators In this method, a single degree of freedom (SDOF) model of each structure is subjected to non-linear tim...
squishbug/DataScienceProgramming
07-Data-Visualization/CrimeData_descriptive_statistics_and_visualization.ipynb
cc0-1.0
import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt # load data set df = pd.read_csv('/home/data/APD/COBRA-YTD-multiyear.csv.gz') print "Shape of table: ", df.shape """ Explanation: Atlanta Police Department The Atlanta Police Department provides Part 1 crime data at http://www...
maxday/spark.samples
streaming-twitter/notebook/Twitter Sentiment with Pixiedust.ipynb
apache-2.0
import pixiedust pixiedust.installPackage("https://github.com/ibm-cds-labs/spark.samples/raw/master/dist/streaming-twitter-assembly-1.6.jar") """ Explanation: Install Twitter Sentiment with Watson scala library from Github End of explanation """ from pixiedust.utils.javaBridge import * demo = JavaWrapper("com.ibm.cd...
mne-tools/mne-tools.github.io
dev/_downloads/5b9edf9c05aec2b9bb1f128f174ca0f3/40_cluster_1samp_time_freq.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Stefan Appelhoff <stefan.appelhoff@mailbox.org> # # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt import scipy.stats import mne from mne.time_frequency import tfr_morlet from mne.stats import permutation_cluster_1samp_te...
rvernagus/data-science-notebooks
Data Science From Scratch/11 - Machine Learning.ipynb
mit
def split_data(data, prob): """split data into fractions [prob, 1 - prob]""" results = [], [] for row in data: results[0 if random.random() < prob else 1].append(row) return results """ Explanation: Modeling Models are specifications of a mathematical (or probabilistic) relationship between var...
cdawei/digbeta
dchen/music/multilabel_example.ipynb
gpl-3.0
%matplotlib inline import os, sys, time import pickle as pkl import numpy as np import pandas as pd import sklearn as sk import cython import itertools from scipy.io import arff from scipy.optimize import minimize from scipy.optimize import check_grad from sklearn.linear_model import LogisticRegression from sklearn....
MIT-LCP/mimic-code
mimic-iii/benchmark/benchmark-concepts.ipynb
mit
import os import re import psycopg2 import getpass from collections import OrderedDict # database config sqluser=getpass.getuser() # keep sqlpass blank if using peer authentication sqlpass='' # database sqldb='mimic' sqlschema='public,mimiciii' query_schema = 'set search_path to ' + sqlschema + ';' if (not sqlpass)...
katie-truong/Udacity-DA
Project4/Stroop effect.ipynb
mit
import pandas as pd import numpy as np import scipy.stats as st import matplotlib.pyplot as plt import seaborn as sns import math """ Explanation: Test a Perceptual Phenomenon - Stroop data Katie Truong End of explanation """ stroopdata = pd.read_csv("stroopdata.csv") stroopdata """ Explanation: Introduction In a S...
weixuanfu/tpot
tutorials/MAGIC Gamma Telescope/MAGIC Gamma Telescope.ipynb
lgpl-3.0
# Import required libraries from tpot import TPOTClassifier from sklearn.model_selection import train_test_split import pandas as pd import numpy as np #Load the data telescope=pd.read_csv('MAGIC Gamma Telescope Data.csv') telescope.head(5) """ Explanation: MAGIC Gamma Telescope - TPOT Classification Study The below...
bioasp/meneco
meneco.ipynb
gpl-3.0
pip install meneco """ Explanation: Meneco demo First you need to install Meneco. For example with pip ... End of explanation """ from clyngor.as_pyasp import TermSet,Atom from urllib.request import urlopen from meneco.meneco import query, utils, sbml """ Explanation: then you can import the necessary modules ... E...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-lme/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-lme', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-LME Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Ra...
jorisvandenbossche/DS-python-data-analysis
notebooks/case2_observations.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.style.use('seaborn-whitegrid') """ Explanation: <p><font size="6"><b>CASE - Observation data</b></font></p> © 2021, Joris Van den Bossche and Stijn Van Hoey (&#106;&#111;&#114;&#105;&#115;&#118;&#97...
empirical-org/WikipediaSentences
notebooks/BERT-1 Experiments.ipynb
agpl-3.0
import torch from pytorch_transformers.tokenization_bert import BertTokenizer from pytorch_transformers.modeling_bert import BertForSequenceClassification BERT_MODEL = 'bert-base-uncased' BATCH_SIZE = 16 if "base" in BERT_MODEL else 2 GRADIENT_ACCUMULATION_STEPS = 1 if "base" in BERT_MODEL else 8 tokenizer = BertTok...
rouxinol/HybridSystem
Simulation - CPW-Filter-qubit/.ipynb_checkpoints/SimPSI - Qubit-Cavity-NR Dispersive limit-checkpoint.ipynb
cc0-1.0
from sympy import * init_printing() from sympsi import * from sympsi.boson import * from sympsi.pauli import * """ Explanation: Symbolic derivation qubit-cavity Hamiltonian <style> p { font-family: "Liberation Serif", serif; font-size: 12pt; } </style> Based on: J. R. Johansson (robert@riken.jp), http://jrjo...
urinieto/msaf
examples/Run MSAF.ipynb
mit
from __future__ import print_function import msaf import librosa import seaborn as sns # and IPython.display for audio output import IPython.display # Setup nice plots sns.set(style="dark") %matplotlib inline """ Explanation: Running MSAF The main MSAF functionality is demonstrated here. End of explanation """ # C...
buntyke/DeepLearningMOOC
Udacity/2_fullyconnected.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. import numpy as np import tensorflow as tf from six.moves import range from __future__ import print_function from six.moves import cPickle as pickle """ Explanation: Deep Learning Assignment 2 Previously in 1_n...
tkoyama010/getfem_presentation
doc/demo_tripod_alt.ipynb
cc0-1.0
import getfem as gf import numpy as np """ Explanation: この例では、GIDで生成されたメッシュを使用しています。メッシュは四面体要素です。 End of explanation """ file_msh = 'tripod.GiD.msh' degree = 2 linear = False incompressible = False # ensure that degree > 1 when incompressible is on.. E = 1e3 Nu = 0.3 Lambda = E*Nu/((1+Nu)*(1-2*Nu)) Mu = E/(2*(1+Nu))...
cliburn/sta-663-2017
scratch/Lecture11.ipynb
mit
%mkdir hello %cd hello %%file hello.cpp #include <iostream> using std::cout; using std::endl; int main() { cout << "Hello, world" << endl; } ! g++ hello.cpp -o hello ! ./hello %cd .. """ Explanation: Using C++ Lecture 11 will cover the baiscs of C++ progamming. Lecture 12 will cover how to c...
AEW2015/PYNQ_PR_Overlay
Pynq-Z1/notebooks/Video_PR/Edge_Detection_Filter.ipynb
bsd-3-clause
from pynq.drivers.video import HDMI from pynq import Bitstream_Part from pynq.board import Register from pynq import Overlay Overlay("demo.bit").download() """ Explanation: Don't forget to delete the hdmi_out and hdmi_in when finished Edge Detection Filter Example In this notebook we will demonstrate a hardware accel...
samuelsinayoko/kaggle-housing-prices
research/encoding_categorical_data.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Encoding Categorical Data End of explanation """ data = pd.DataFrame(data=[[0, 0, 3], [1, 1, 0], [0, 2, 1], [1, 0, 2]], columns=['feature 1', 'feature 2', 'feature 3']) data """ Explanation: Simple data frame with categorical data Represent each category as a...
c22n/ion-channel-ABC
docs/examples/human-atrial/nygren_ina_original.ipynb
gpl-3.0
import os, tempfile import logging import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import numpy as np from ionchannelABC import theoretical_population_size from ionchannelABC import IonChannelDistance, EfficientMultivariateNormalTransition, IonChannelAcceptor from ionchannelABC.experimen...
ronojoy/pylearn
presentations/.ipynb_checkpoints/PyCon-ReasoningUnderUncertainty-Lea-checkpoint.ipynb
mit
from lea import * # the canonical random variable : a fair coin faircoin = Lea.fromVals('Head', 'Tail') # toss the coin a few times faircoin.random(10) # Amitabh Bachan's coin from Sholay sholaycoin = Lea.fromVals('Head', 'Head') # Amitabh always wins (and, heroically, sacrifices himself for Dharamendra!) sholaycoi...
googleinterns/bizview-semi-supervised-learning
Mixmatch/streetview_dataset/OCR_lib_test.ipynb
apache-2.0
from OCR_lib import word_to_vec, reshape_embeddings, detect_text import spacy import tensorflow as tf import numpy as np from PIL import Image, ImageShow import IPython.display as display """ Explanation: OCR_lib_test This file includes test scripts for the OCR_lib functions. End of explanation """ TEST_STRING = "Te...