repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
TurkuNLP/BINF_Programming
exercises/week-1-exercises.ipynb
gpl-2.0
def trim(s): # implement this function pass # test case import Bio.Seq as BS s = BS.Seq("ACGCGGCGTG") print(s, "has length", len(s)) # write a piece of code here which will # print the translated sequence 'TRR' # without any errors """ Explanation: Exercise 1.1 Trim sequence to multiples of three characters ...
PWhiddy/kbmod
notebooks/kbmod_demo.ipynb
bsd-2-clause
import numpy as np import matplotlib.pyplot as plt from searchImage import searchImage from analyzeImage import analyzeImage %matplotlib inline %load_ext autoreload %autoreload 2 """ Explanation: KBMOD Demo The purpose of this demo is to showcase how KBMOD can be used to search through images for moving objects. The i...
Diegoparrape/testgit-Diego
Parcial_1SimMatDiegoP.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline def theta_t(theta_0, theta_0_dot, g, l, t): omega_0 = np.sqrt(g/l) return theta_0 * np.cos(omega_0 * t) + theta_0_dot * np.sin(omega_0 * t)/omega_0 """ Explanation: <font color = blue>Primer examen parcial </font> <font color= #8A0829> Simu...
minrk/launchabel
pub-mpi.ipynb
bsd-2-clause
from ipyparallel import Client, error cluster = Client() view = cluster[:] """ Explanation: Load IPython support for working with MPI tasks End of explanation """ %matplotlib inline import numpy as np import matplotlib.pyplot as plt """ Explanation: Let's also load the plotting and numerical libraries so we have th...
synthicity/synthpop
demos/non_census_synthesis.ipynb
bsd-3-clause
hh_marginal_file = 'input_data/hh_marginals.csv' person_marginal_file = 'input_data/person_marginals.csv' hh_sample_file = 'input_data/household_sample.csv' person_sample_file = 'input_data/person_sample.csv' """ Explanation: Specify sample data csv paths. See the files listed here for expected structure. Marginal tab...
ES-DOC/esdoc-jupyterhub
notebooks/csir-csiro/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', 'csir-csiro', 'sandbox-2', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: CSIR-CSIRO Source ID: SANDBOX-2 Topic: Ocean Sub-Topics: Timestepping Framewor...
DavidVargasMora/SimulationLabs
160002934JuanVargas.ipynb
cc0-1.0
def generadorCongruencial(n): m = 91 a = 11 b = 4 Xo = 17 lastXn = Xo Xi = [] Ui = [] ls = 1 first = 0 print "Used parameters: " print "a = "+str(a)+" b = "+str(b)+" m = "+str(m) print "Random numbers generated: " for i in range(n): Xn = float((a*lastXn +...
AdityaSoni19031997/Machine-Learning
Coursera_DL/Logistic+Regression+with+a+Neural+Network+mindset+v4.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import h5py import scipy from PIL import Image from scipy import ndimage from lr_utils import load_dataset %matplotlib inline """ Explanation: Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a ...
arne-cl/alt-mulig
information-status/tuebadz-data-extraction.ipynb
gpl-3.0
import os import discoursegraphs as dg import discourseinfostat as di TUEBADZ8_FILE = dg.corpora.TUEBADZ_PATH corpus = dg.read_exportxml(TUEBADZ8_FILE, debug=False) doc = corpus.next() debug_corpus = dg.read_exportxml(TUEBADZ8_FILE, debug=True) debug_doc = debug_corpus.next() edg = dg.readwrite.exportxml.ExportXML...
SHDShim/pytheos
examples/3_calculate_thermal_terms_ConstQ.ipynb
apache-2.0
%config InlineBackend.figure_format = 'retina' """ Explanation: For high dpi displays. End of explanation """ import numpy as np import matplotlib.pyplot as plt import uncertainties as uct from uncertainties import unumpy as unp import pandas as pd import pytheos as eos """ Explanation: 0. General note This noteboo...
danlamanna/scratch
notebooks/02_Raster_Data.ipynb
apache-2.0
%matplotlib inline from matplotlib import pylab as plt """ Explanation: Loading raster data on to the map In this notebook we'll take a look at using the built in tile server to render raster data to the map. The tile server used is based on KTile a fork of TileStache and is directly integrated into the Jupyter Notebo...
dato-code/tutorials
notebooks/linear_regression_benchmark.ipynb
apache-2.0
import graphlab as gl """ Explanation: <h2>How fast are Out-of-Core Algorithms? A Linear Regression Benchmark</h2> In this notebook we demonstrate the capabilities of GraphLab Create on the basic task of linear regression, comparing it to the widely used machine learning package scikit-learn. Scikit-learn contains a ...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/assignment/week5/week-5-lasso-assignment-2-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 5: LASSO (coordinate descent) In this notebook, you will implement your very own LASSO solver via coordinate descent. You will: * Write a function to normalize features * Implement coordinate descent for LASSO * Explore effects of L1 penalty Fire up graphlab create Make...
ga7g08/ga7g08.github.io
_notebooks/2016-09-07-Example-of-zero-padding-using-Scipy.ipynb
mit
N = 600 T = 1.0 / 800.0 f = 50.0 x = np.linspace(0.0, N*T, N) y = np.sin(f * 2.0*np.pi*x) yf = fft(y) xf = np.linspace(0.0, 1.0/(2.0*T), N/2) fig, (ax1, ax2) = plt.subplots(nrows=2) ax1.plot(x, y) ax2.plot(xf, 2.0/N * np.abs(yf[0:N/2])) ax2.set_xlim(0, ) plt.show() """ Explanation: Example of zero-padding using Scip...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/explainable_ai/sdk_custom_tabular_regression_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: Custom training tabular regression model for online prediction with explainabilty <...
pdamodaran/yellowbrick
examples/pbwitt/testing.ipynb
apache-2.0
%matplotlib inline import os import json import time import pickle import requests import numpy as np import pandas as pd import yellowbrick as yb import matplotlib.pyplot as plt df=pd.read_csv("/Users/pwitt/Documents/machine-learning/examples/pbwitt/Dataset/Training/Features_Variant_1.csv") # Fetch the data if ...
Mashimo/datascience
01-Regression/multipleLogRegSky.ipynb
apache-2.0
import pandas as pd sdss = pd.read_csv('../datasets/Skyserver_SQL2_27_2018 6_51_39 PM.csv', skiprows=1) sdss.head(2) """ Explanation: Sloan Digital Sky Survey Classification In this notebook - through a logistic regression classifier - we classify observations of space objects to be either stars, galaxies or quasars...
DawesLab/LabNotebooks
control-pulseoptim-QFT.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import datetime from qutip import Qobj, identity, sigmax, sigmay, sigmaz, tensor, mesolve from qutip.qip.algorithms import qft import qutip.logging_utils as logging logger = logging.get_logger() #Set this to None or logging.WARN for 'quiet' executio...
harmsm/pythonic-science
labs/02_regression/02_model-fitting.ipynb
unlicense
def first_order(t,A,k): """ First-order kinetics model. """ return A*(1 - np.exp(-k*t)) def first_order_r(param,t,obs): """ Residuals function for first-order model. """ return first_order(t,param[0],param[1]) - obs def fit_model(t,obs,param_guesses=(1,1)): """ Fit the fi...
alkamid/The-Analytics-Edge-in-IPython
Week 3/3.1 Modelling the Expert.ipynb
gpl-2.0
98/(98+33) """ Explanation: The baseline model has the accuracy of End of explanation """ from sklearn.cross_validation import train_test_split train, test = train_test_split(quality, train_size=0.75, random_state=1) qualityTrain = pd.DataFrame(train, columns=quality.columns) qualityTest = pd.DataFrame(test, colum...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/06_structured/5_train_keras.ipynb
apache-2.0
# Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.1 """ Explanation: <h1>Training Keras model on Cloud AI Platform</h1> This notebook illustrates distributed training on Cloud AI Platform. This uses Keras and requires TensorFlow 2.1 End of explanation """ # change these to try ...
GustavoRP/IA369Z
dev/DTI_open_01-05-17_GRP.ipynb
gpl-3.0
# import modules and libs import io, os, sys, types import numpy as np # image and graphic from IPython.display import Image from IPython.display import display import matplotlib.pyplot as plt %matplotlib #import specific modules sys.path.append('C:/iPython/DTIlib') import DTIlib as DTI """ Explanation: Openig DTI d...
WomensCodingCircle/CodingCirclePython
Lesson04_Iteration/Iterations.ipynb
mit
count = 5 count = count + 10 count = count - 3 print(count) """ Explanation: Iterations Updating Variables You don't need to make a new variable name every time you want to update its value (this is part of why it is called a 'variable', because its contents are variable). It is common to update a single variable. # B...
dancingdan/tensorflow
tensorflow/contrib/eager/python/examples/generative_examples/image_captioning_with_attention.ipynb
apache-2.0
# Import TensorFlow and enable eager execution # This code requires TensorFlow version >=1.9 import tensorflow as tf tf.enable_eager_execution() # We'll generate plots of attention in order to see which parts of an image # our model focuses on during captioning import matplotlib.pyplot as plt # Scikit-learn includes ...
italoPontes/Machine-learning
Tarefas/Regressão-Linear-Simples-do-Zero/Task 01.ipynb
lgpl-3.0
%matplotlib notebook #!/usr/bin/env python # -*- coding: utf-8 -*- #Federal University of Campina Grande (UFCG) #Author: Ítalo de Pontes Oliveira #Adapted from: Siraj Raval #Available at: https://github.com/llSourcell/linear_regression_live #The optimal values of m and b can be actually calculated with way less effort...
agutieda/QuantEcon.py
solutions/arellano_solutions.ipynb
bsd-3-clause
%matplotlib inline from __future__ import division import numpy as np import matplotlib.pyplot as plt import quantecon as qe from quantecon.models import Arellano_Economy """ Explanation: quant-econ Solutions: Default Risk and Income Fluctuations Solutions for http://quant-econ.net/py/arellano.html End of explanation...
ehrlinger/MachineLearningSamples-PredictiveMaintenance
Code/2_feature_engineering.ipynb
mit
## Setup our environment by importing required libraries import time import os import glob # Read csv file from URL directly import pandas as pd # For creating some preliminary EDA plots. %matplotlib inline import matplotlib.pyplot as plt from ggplot import * import datetime from pyspark.sql.functions import to_date...
josh-gree/maths-with-python
02-programs.ipynb
mit
import math x = math.sin(1.2) """ Explanation: Programs Using the Python console to type in commands works fine, but has serious drawbacks. It doesn't save the work for the future. It doesn't allow the work to be re-used. It's frustrating to edit when you make a mistake, or want to make a small change. Instead, we wan...
statsmodels/statsmodels.github.io
v0.12.2/examples/notebooks/generated/ets.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline from statsmodels.tsa.exponential_smoothing.ets import ETSModel plt.rcParams['figure.figsize'] = (12, 8) """ Explanation: ETS models The ETS models are a family of time series models with an underlying state space model consistin...
omoju/udacityUd120Lessons
Validation.ipynb
gpl-3.0
import pickle import sys sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit data_dict = pickle.load(open("../final_project/final_project_dataset.pkl", "r") ) ### first element is our labels, any added elements are predictor ### features. Keep this the same for the mini-project,...
GoogleCloudPlatform/training-data-analyst
quests/vertex-ai/vertex-challenge-lab/vertex-challenge-lab.ipynb
apache-2.0
# Add installed library dependencies to Python PATH variable. PATH=%env PATH %env PATH={PATH}:/home/jupyter/.local/bin # Retrieve and set PROJECT_ID and REGION environment variables. # TODO: fill in PROJECT_ID. PROJECT_ID = "" REGION = "us-central1" # TODO: Create a globally unique Google Cloud Storage bucket for art...
hetaodie/hetaodie.github.io
assets/media/uda-ml/supervisedlearning/bys/垃圾邮件分类/Bayesian_Inference_solution-zh.ipynb
mit
''' Solution ''' import pandas as pd # Dataset from - https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection df = pd.read_table('smsspamcollection/SMSSpamCollection', sep='\t', header=None, names=['label', 'sms_message']) # Output printing out first 5 col...
turbomanage/training-data-analyst
quests/endtoendml/labs/3_keras_dnn.ipynb
apache-2.0
# change these to try this notebook out BUCKET = 'cloud-training-demos-ml' PROJECT = 'cloud-training-demos' REGION = 'us-east1' #'us-central1' import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT os.environ['REGION'] = REGION %%bash if ! gsutil ls | grep -q gs://${BUCKET}/; then gsutil mb -l ${RE...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/text_classification/solutions/word2vec.ipynb
apache-2.0
# Use the chown command to change the ownership of repository to user. !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install -q tqdm # You can use any Python source file as a module by executing an import statement in some other Python source file. # The import statement combines two operati...
Danghor/Algorithms
Python/Chapter-10/Monte-Carlo-Pi.ipynb
gpl-2.0
import random as rnd import math """ Explanation: Computing <a href="https://en.wikipedia.org/wiki/Pi">$\pi$</a> with the Monte-Carlo-Method End of explanation """ def approximate_pi(n): k = 0 for _ in range(n): x = 2 * rnd.random() - 1 y = 2 * rnd.random() - 1 r = x * x + y * y ...
Jackporter415/phys202-2015-work
assignments/assignment04/MatplotlibEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 1 Imports End of explanation """ import os assert os.path.isfile('yearssn.dat') """ Explanation: Line plot of sunspot data Download the .txt data for the "Yearly mean total sunspot number [1700 - now]" from th...
dacr26/CompPhys
01_00_numerical_differentiation.ipynb
mit
dx = 1. x = 1. while(dx > 1.e-10): dy = (x+dx)*(x+dx)-x*x d = dy / dx print("%6.0e %20.16f %20.16f" % (dx, d, d-2.)) dx = dx / 10. """ Explanation: A primer on numerical differentiation In order to numerically evaluate a derivative $y'(x)=dy/dx$ at point $x_0$, we approximate is by using finite di...
alanmitchell/fnsb-benchmark
ddc/siemens_reader.ipynb
mit
import csv import string import datetime import pandas as pd import numpy as np # import matplotlib pyplot commands from matplotlib.pyplot import * # Show Plots in the Notebook %matplotlib inline rcParams['figure.figsize']= (10, 8) # set Chart Size rcParams['font.size'] = 14 # set Font size in Chart ...
amitkaps/applied-machine-learning
Module-01a-Frame-Regression.ipynb
mit
#Load the libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt #Defualt Variables %matplotlib inline plt.rcParams['figure.figsize'] = (16,9) plt.style.use('fivethirtyeight') pd.set_option('display.float_format', lambda x: '%.2f' % x) #Load the dataset df = pd.read_csv('data/loan_data.csv')...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_mne_dspm_source_localization.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import (make_inverse_operator, apply_inverse, write_inverse_operator) """ Explanation: Source localization with MNE/dSPM/sLORETA The aim of this tutorials is to teach you h...
tensorflow/probability
tensorflow_probability/examples/jupyter_notebooks/Learnable_Distributions_Zoo.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # 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, sof...
ES-DOC/esdoc-jupyterhub
notebooks/awi/cmip6/models/sandbox-3/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'awi', 'sandbox-3', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: AWI Source ID: SANDBOX-3 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
weikang9009/pysal
notebooks/explore/giddy/Mobility measures.ipynb
bsd-3-clause
from pysal.explore.giddy import markov,mobility mobility.markov_mobility? """ Explanation: Measures of Income Mobility Author: Wei Kang &#119;&#101;&#105;&#107;&#97;&#110;&#103;&#57;&#48;&#48;&#57;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;, Serge Rey &#115;&#106;&#115;&#114;&#101;&#121;&#64;&#103;&#109;&...
DJCordhose/ai
notebooks/tensorflow/tf_low_level_intro.ipynb
mit
# import and check version import tensorflow as tf # tf can be really verbose tf.logging.set_verbosity(tf.logging.ERROR) print(tf.__version__) # a small sanity check, does tf seem to work ok? hello = tf.constant('Hello TF!') sess = tf.Session() print(sess.run(hello)) sess.close() """ Explanation: <a href="https://co...
opesci/devito
examples/userapi/03_subdomains.ipynb
mit
from devito import Grid shape = (10, 10, 10) grid = Grid(shape=shape, extent=shape) """ Explanation: Subdomains tutorial This tutorial is designed to introduce users to the concept of subdomains in Devito and how to utilize them within simulations for a variety of purposes. We will begin by exploring the subdomains cr...
ajgpitch/qutip-notebooks
examples/pulse-wise-two-photon-interference.ipynb
lgpl-3.0
%matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import interp2d from qutip import * """ Explanation: QuTiP Lecture: Pulse-wise two-photon interference of emission from a two-level system K.A. Fischer, Stanford University Thi...
Diyago/Machine-Learning-scripts
DEEP LEARNING/image classification/fastai/Dog breeds fastAI.ipynb
apache-2.0
%reload_ext autoreload %autoreload 2 %matplotlib inline from fastai.imports import * from fastai.torch_imports import * from fastai.transforms import * from fastai.conv_learner import * from fastai.model import * from fastai.dataset import * from fastai.sgdr import * from fastai.plots import * torch.cuda.set_device(0...
kemerelab/NeuroHMM
ModelSelection.ipynb
mit
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import sys from IPython.display import display, clear_output sys.path.insert(0, 'helpers') from efunctions import * # load my helper function(s) to save pdf figures, etc. from hc3 import load_data, get_sessions from hmmlearn...
keras-team/keras-io
examples/vision/ipynb/token_learner.ipynb
apache-2.0
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_addons as tfa from datetime import datetime import matplotlib.pyplot as plt import numpy as np import math """ Explanation: Learning to tokenize in Vision Transformers Authors: Aritra Roy Gosthipaty, Sayak Pau...
mountaindust/Parasitoids
docs/Bayesian_Model.ipynb
gpl-3.0
%matplotlib inline import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt a, b = 5,1 plt.figure() x = np.linspace(0,1,100) plt.plot(x,stats.beta.pdf(x,a,b),label='beta pdf') plt.legend(loc='best') plt.show() """ Explanation: Incorporating the Parasitoid Model into a Stochastic Model for Param...
yangw1234/BigDL
apps/ray/parameter_server/sharded_parameter_server.ipynb
apache-2.0
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import ray import time """ Explanation: This notebook is adapted from: https://github.com/ray-project/tutorial/tree/master/examples/sharded_parameter_server.ipynb Sharded Parameter Servers G...
ManchesterBioinference/BranchedGP
notebooks/SyntheticData.ipynb
apache-2.0
import pickle import numpy as np import pandas as pd from matplotlib import pyplot as plt from BranchedGP import VBHelperFunctions as bplot plt.style.use("ggplot") %matplotlib inline """ Explanation: Branching GP Regression on synthetic data Alexis Boukouvalas, 2017 Branching GP regression with Gaussian noise on th...
VokhmintcevKirill/ti-nic_competition2
Titanic 2.0.ipynb
mit
data = pd.concat([train, test], ignore_index = True) data.head() data.describe() data.isnull().sum() """ Explanation: Проведем краткое исследование данных, построим бейзлайн, результаты которого попытаемся улучшить End of explanation """ data['Age'] = data['Age'].fillna(np.median(data['Age'].loc[(data['Age'].isnul...
dipanjank/ml
simple_implementations/Language_Models.ipynb
gpl-3.0
import nltk nltk.download('gutenberg') from nltk.corpus import gutenberg gutenberg.fileids() import re words = gutenberg.words('austen-emma.txt') # filter out numbers, etc. words = [w.lower() for w in words if re.match('^[a-zA-Z]+$', w)] words[:10] """ Explanation: <h1 align="center">Language Models</h1> Before we...
dspmathguru/af6uyDitDahReader
Usage.ipynb
mit
import ditDahReader as dd import numpy as np import matplotlib.pyplot as plt """ Explanation: AF6UY ditDahReader Library Usage The AF6UY ditDahReader python3 library is a morse code (CW) library with its final goal of teach the author (AF6UY) morse code by playing IRC streams in morse code. Along the way it will have...
google/starthinker
colabs/bulkdozer.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Bulkdozer Editor Bulkdozer is a tool that can reduce trafficking time in Campaign Manager by up to 80%% by providing automated bulk editing capabilities. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the...
diana-hep/carl
examples/Diagnostics for approximate likelihood ratios.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import theano from scipy.stats import chi2 from itertools import product np.random.seed(314) """ Explanation: Diagnostics for approximate likelihood ratios Kyle Cranmer, Juan Pavez, Gilles Louppe, March 2016. This is an extension of the example in...
hpparvi/ldtk
notebooks/01_Example_basics.ipynb
gpl-2.0
%pylab inline from IPython.display import display, Latex import seaborn as sb sb.set_context('notebook') sb.set_style('ticks') """ Explanation: LDTk example 1: basics Last updated: 2.5.2020<br> LDTk version: 1.1 This first example covers the basics of LDTk. We learn how to set up filters, how to use LDPSetCreator to c...
henchc/Rediscovering-Text-as-Data
01-Text-as-Data/Intro.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from collections import Counter terms = pd.read_csv('data/terms.csv') counts = Counter(terms['Terms in Attendance'].replace("—", "0")).most_common() ax = sns.barplot(x=[x[0] for x in counts], y=[x[1] for x in counts], order=...
CalPolyPat/phys202-2015-work
assignments/assignment12/FittingModelsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 1 Imports End of explanation """ a_true = 0.5 b_true = 2.0 c_true = -4.0 """ Explanation: Fitting a quadratic curve For this problem we are going to work with the following mod...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/introduction_to_tensorflow/labs/4_keras_functional_api.ipynb
apache-2.0
# Use the chown command to change the ownership of the repository. !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.3.0 || pip install tensorflow==2.3.0 """ Explanation: Introducing the Keras Functional API on Ve...
kimkipyo/dss_git_kkp
통계, 머신러닝 복습/160607화_12일차_(확률론적)선형 회귀 분석 Linear Regression Analysis/1.확률론적 선형 회귀 모형.ipynb
mit
from sklearn.datasets import make_regression X0, y, coef = make_regression(n_samples=100, n_features=1, noise=20, coef=True, random_state=0) dfX0 = pd.DataFrame(X0, columns=["X1"]) dfX = sm.add_constant(dfX0) dfy = pd.DataFrame(y, columns=["y"]) model = sm.OLS(dfy, dfX) result = model.fit() print(result.params) """...
GoogleCloudPlatform/training-data-analyst
quests/serverlessml/03_tfdata/labs/input_pipeline.ipynb
apache-2.0
%%bash export PROJECT=$(gcloud config list project --format "value(core.project)") echo "Your current GCP Project Name is: "$PROJECT !pip install tensorflow==2.1.0 --user """ Explanation: Input pipeline into Keras In this notebook, we will look at how to read large datasets, datasets that may not fit into memory, usi...
tpin3694/tpin3694.github.io
sql/edit_tables.ipynb
mit
# Ignore %load_ext sql %sql sqlite:// %config SqlMagic.feedback = False """ Explanation: Title: Edit Tables Slug: edit_tables Summary: Edit tables in SQL. Date: 2017-01-16 12:00 Category: SQL Tags: Basics Authors: Chris Albon Note: This tutorial was written using Catherine Devlin's SQL in Jupyter Notebooks l...
daniestevez/jupyter_notebooks
CE5/CE-5 high-speed frame.ipynb
gpl-3.0
def load_frames(path): frame_size = 1024 frames = np.fromfile(path, dtype = 'uint8') frames = frames[:frames.size//frame_size*frame_size].reshape((-1, frame_size)) # drop ccsds header frames = frames[:, 4:] return frames frames = np.concatenate([load_frames(f) for f in sorted(pathlib.Path('uhf...
DavidObando/carnd
Term1/Project1/.ipynb_checkpoints/P1-checkpoint.ipynb
apache-2.0
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline #reading in an image image = mpimg.imread('test_images/solidWhiteRight.jpg') #printing out some stats and plotting print('This image is:', type(image), 'with dimesions:', im...
phungkh/phys202-2015-work
assignments/assignment05/InteractEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 2 Imports End of explanation """ def plot_sinl(a,b): x=np.linspace(0,4*np.pi,1000) plt.figure(figsiz...
agile-geoscience/notebooks
Fastest_dimension_of_array.ipynb
apache-2.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt """ Explanation: Which is the fastest axis of an array? I'd like to know: which axes of a NumPy array are fastest to access? End of explanation """ a = np.arange(9).reshape(3, 3) a ' '.join(str(i) for i in a.ravel(order='C')) ' '.join(str(i) fo...
maxlit/pyEdgeworthBox
README.ipynb
mit
#!pip install pyEdgeworthBox %matplotlib inline import pyEdgeworthBox as eb EB=eb.EdgeBox( u1 = lambda x,y: x**0.6*y**0.4 , u2 = lambda x,y: x**0.1*y**0.9 , IE1 = [10,20] , IE2 = [20,10]) EB.plot() """ Explanation: How to use it pyEdgeworthBox provides with a tool to plot the...
karlstroetmann/Artificial-Intelligence
Python/1 Search/Bidirectional-A-Star-Search-Slim.ipynb
gpl-2.0
import heapq """ Explanation: Bidirectional A$^*$ First Search The module <a href="https://docs.python.org/3.7/library/heapq.html">heapq</a> provides <a href="https://en.wikipedia.org/wiki/Priority_queue">priority queues</a> that are implemented as <a ref="https://en.wikipedia.org/wiki/Heap_(data_structure)">heaps<...
hannorein/rebound
ipython_examples/RemovingParticlesFromSimulation.ipynb
gpl-3.0
import rebound import numpy as np sim = rebound.Simulation() sim.add(m=1., hash=0) for i in range(1,10): sim.add(a=i, hash=i) sim.move_to_com() print("Particle hashes:{0}".format([sim.particles[i].hash for i in range(sim.N)])) """ Explanation: Removing particles from the simulation This tutorial shows the differ...
phoebe-project/phoebe2-docs
2.2/examples/mesh_wd.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" %matplotlib inline """ Explanation: Wilson-Devinney Style Meshing NOTE: Wilson-Devinney Style meshing requires developer mode in PHOEBE and is meant to be used for testing, not used for science. Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can...
bennyrowland/suspect
docs/notebooks/tut04_quant.ipynb
mit
import suspect import numpy as np from matplotlib import pyplot as plt %matplotlib nbagg data = suspect.io.load_rda("/home/jovyan/suspect/tests/test_data/siemens/SVS_30.rda") """ Explanation: 4. External Quantification Tools End of explanation """ # create a parameters dictionary to set the basis set to use params ...
ljvmiranda921/pyswarms
docs/examples/tutorials/options_handler.ipynb
mit
# Import modules import matplotlib.pyplot as plt import numpy as np from IPython.display import Image # Import PySwarms import pyswarms as ps from pyswarms.utils.functions import single_obj as fx from pyswarms.utils.plotters import (plot_cost_history, plot_contour) from pyswarms.backend.handlers import OptionsHandler...
wil-langford/FishFace2
lib/jupyter/prioritize tagging.ipynb
gpl-2.0
## EXAMPLE: Get all images from experiment 11. xp_11_images = all_data_images.filter(xp_id=156) ## EXAMPLE: Get all images from CJRs 140, 158, and 161. selected_cjrs_images = all_data_images.filter(cjr_id__in=[140,158,161]) ## EXAMPLE: Get all images from experiments 11 and 94. selected_xps_images = all_data_images.f...
jegibbs/phys202-2015-work
assignments/assignment12/FittingModelsEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 2 Imports End of explanation """ decay = np.load('decay_osc.npz') tdata = decay['tdata'] ydata = decay['ydata'] dy = decay['dy'] plt.errorbar(tdata, ydata, dy, fmt...
jerkos/cobrapy
documentation_builder/io.ipynb
lgpl-2.1
import cobra.test import os print("mini test files: ") print(", ".join([i for i in os.listdir(cobra.test.data_directory) if i.startswith("mini")])) textbook_model = cobra.test.create_test_model("textbook") ecoli_model = cobra.test.create_test_model("ecoli") salmonella_model = cobra.test.create_test_model("salmonella"...
tensorflow/docs-l10n
site/zh-cn/tutorials/text/text_classification_rnn.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...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/06_structured/5_train_bqml.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.1 # change these to try this notebook out PROJECT = 'cloud-training-demos' REGION = 'us-central1' import os os.environ['PROJECT'] = PROJECT os.environ['REGION'] =...
Olsthoorn/TransientGroundwaterFlow
readthedocs/Course2016_jupyter/docs/source/TheisWellFunction.ipynb
gpl-3.0
import scipy.special as sp import numpy as np from scipy.special import expi def W(u): return -expi(-u) def W1(u): """Returns Theis' well function axpproximation by numerical intergration Works only for scalar u """ if not np.isscalar(u): raise ValueError("","u must be a scalar") ...
kgourgou/stochastic-simulations-class
ipython_notebooks/langevin.ipynb
mit
a = -1; b = 1; def U(x,a=-1,b=1): return (b-a/2)*(x**2-1)**2+a/2*(x+1) x = np.linspace(-1.5,1.5) pl.plot(x,U(x),color=pale_red,linewidth=5) pl.title('The potential $U(x)$ with $a=-1$ and $b=1$',fontsize=20) """ Explanation: Overdamped Langevin Equation The overdamped Langevin equation is defined as $$ dX_t=-\nab...
DigNeurosurgeon/seeg
notebooks/2 seeg_predict_implantation_accuracy-regresion.ipynb
gpl-3.0
# import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns; sns.set() %matplotlib inline import warnings; warnings.simplefilter('ignore') %xmode plain; # shorter error messages # global setting whether to save figures or not # will save as 300 dpi PNG - all filename...
undercertainty/ou_nlp
semeval_experiments/.ipynb_checkpoints/Building a dataframe from a core file v.2-checkpoint.ipynb
apache-2.0
filename='semeval2013-task7/semeval2013-Task7-5way/beetle/train/Core/FaultFinding-BULB_C_VOLTAGE_EXPLAIN_WHY1.xml' """ Explanation: A simple (ie. no error checking or sensible engineering) notebook to extract the student answer data from a single xml file. I'll also export the data to a csv file at the end of this, s...
tritemio/pybroom
doc/notebooks/pybroom-example-multi-datasets-scipy-robust-fit.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format='retina' # for hi-dpi displays import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.pylab import normpdf import seaborn as sns from lmfit import Model import lmfit print('lmfit: %s' % lmfit.__version__) sns.set_style('whitegrid')...
phoebe-project/phoebe2-docs
2.3/tutorials/logg.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: Surface Gravity (logg) 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 numpy as np...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/01_bigquery/labs/a_sample_explore_clean.ipynb
apache-2.0
PROJECT = "cloud-training-demos" # Replace with your PROJECT REGION = "us-central1" # Choose an available region for Cloud MLE import os os.environ["PROJECT"] = PROJECT os.environ["REGION"] = REGION """ Explanation: Sample, Explore, and Clean Taxifare Dataset Learning Objectives - Practice querying BigQue...
mcamack/Jupyter-Notebooks
keras/keras202-VGG16FineTuning.ipynb
apache-2.0
#GBs required for 16 image mini-batch size = ((15184000 + 3*4096000) * 4 * 2 * 16) / (1024**3) print(str(round(size,2)) + 'GB') """ Explanation: VGG16 This notebook will recreate the VGG16 model from FastAI Lesson 1 (wiki) and FastAI Lesson 2 (wiki) The Oxford Visual Geometry Group created a 16 layer deep ConvNet whic...
donaghhorgan/COMP9033
labs/09a - K-means clustering.ipynb
gpl-3.0
%matplotlib inline import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn import cluster from sklearn import datasets """ Explanation: Lab 09a: K-means clustering Introduction This lab focuses on $K$-means clustering using the Iris flower data set. At the end of the lab, you should b...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch3-Animation_ThreePhaseFluxes.ipynb
unlicense
%pylab notebook """ Explanation: Electric Machinery Fundamentals 5th edition Chapter 3 Animation: Three-phase fluxes (based on Example 3-1) Calculate the net magetic field produced by a three-phase stator (adapted for 50Hz). Import the PyLab namespace (provides set of useful commands and constants like $\pi$): End of ...
rohinkumar/galsurveystudy
old/healpix_lin_coasting_V02.ipynb
mit
import healpix_util as hu import astropy as ap import numpy as np from astropy.io import fits from astropy.table import Table import astropy.io.ascii as ascii from astropy.constants import c import matplotlib.pyplot as plt import math import scipy.special as sp """ Explanation: Healpix pixelization of DR72 SDSS Databa...
mne-tools/mne-tools.github.io
0.22/_downloads/34fd5b71616977c61ebac55c010819c1/plot_beamformer_lcmv.ipynb
bsd-3-clause
# Authors: Britta Westner <britta.wstnr@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample, fetch_fsaverage from mne.beamformer import make_lcmv, apply_lcmv """ Explanation: Source reconstruction using an L...
otavio-r-filho/AIND-Deep_Learning_Notebooks
intro-to-tensorflow/intro_to_tensorflow.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile print('All m...
jorisvandenbossche/DS-python-data-analysis
notebooks/pandas_02_basic_operations.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt # redefining the example DataFrame countries = pd.DataFrame({'country': ['Belgium', 'France', 'Germany', 'Netherlands', 'United Kingdom'], 'population': [11.3, 64.3, 81.3, 16.9, 64.9], 'area': [30510, 671308, 357050, 41526, 244820...
numeristical/introspective
examples/Ames_Housing_Analysis.ipynb
mit
# "pip install ml_insights" in terminal if needed import pandas as pd import numpy as np import matplotlib.pyplot as plt import ml_insights as mli # To Plot matplotlib figures inline on the notebook %matplotlib inline from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestReg...
ecell/ecell4-notebooks
en/tests/Birth_Death.ipynb
gpl-2.0
%matplotlib inline from ecell4.prelude import * """ Explanation: Birth-Death This is for an integrated test of E-Cell4. Here, we test a simple birth-death process in volume. End of explanation """ D = 1 # 0.01 radius = 0.005 N = 20 # a number of samples y0 = {} # {'A': 60} duration = 3 V = 8 """ Explanation: Pa...
james-prior/cohpy
20181027-ccc-or-operator.ipynb
mit
# meld is a great visual difference program # http://meldmerge.org/ # the following command relies on the directory structure on my computer # tdd-demo comes from https://github.com/james-prior/tdd-demo/ #!cd ~/projects/tdd-demo;git difftool -t meld -y 389df2a^ 389df2a !cd ~/20181027/tdd-demo/;git difftool -t meld -y...
mne-tools/mne-tools.github.io
0.20/_downloads/f01121873dbae065a1740e6c0c20d1d5/plot_eeg_no_mri.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Joan Massich <mailsik@gmail.com> # # License: BSD Style. import os.path as op import mne from mne.datasets import eegbci from mne.datasets import fetch_fsaverage # Download fsaverage files fs_dir = fetch_fsaverage(verbose=True) subjects_dir = op....
jmhsi/justin_tinker
data_science/courses/deeplearning1/fastai-course-1-pytorch/lesson1-pytorch.ipynb
apache-2.0
import torch import torchvision.models as models import torchvision.transforms as transforms import torchvision.datasets as datasets from torchvision.utils import make_grid from PIL import Image import matplotlib.pyplot as plt import torch.nn as nn import torch.optim as optim import torch.utils.trainer as trainer impor...
johntanz/ROP
Old Code/Masimo Analysis - Template150919.ipynb
gpl-2.0
#the usual beginning import pandas as pd import numpy as np from pandas import Series, DataFrame from datetime import datetime, timedelta from pandas import concat """ Explanation: Masimo Analysis For Pulse Ox. Analysis, make sure the data file is the right .csv format: a) Headings on Row 1 b) Open the csv file throug...
FordyceLab/AcqPack
notebooks/ExperimentTemplate - Copy.ipynb
mit
# WELL # all valves closed st = 'A01' x1,y1,z1 = locs[st] Z.move(42) XY.move_xy(x1,y1) Z.move(z1) log.append([time.ctime(time.time()), 'AT '+st]) # ACQUIRE 120 frames 11000 ms # OPEN Hep_1 + W_1 (tree in + out) log.append([time.ctime(time.time()), 'OPEN tree in + out']) # flow 20 min (fill tube + tree) # ACQUIRE 1...