repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
pxcandeias/py-notebooks
DSP_FFT_psd.ipynb
mit
import sys import numpy as np import scipy as sp import matplotlib as mpl import pandas as pd import matplotlib.pyplot as plt %matplotlib inline print(sys.version) for package in (np, sp, mpl, pd): print('{:.<15} {}'.format(package.__name__, package.__version__)) """ Explanation: <a id='top'></a> DSP using FFT a...
google/starthinker
colabs/cm360_conversion_upload_from_sheets.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Conversion Upload From Sheets Move form Sheets to CM. 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 License. You may obtain a copy ...
ml4a/ml4a-guides
examples/dreaming/neural-net-painter.ipynb
gpl-2.0
%matplotlib inline import time from PIL import Image import numpy as np import keras from matplotlib.pyplot import imshow, figure from keras.models import Sequential from keras.layers import Dense """ Explanation: Neural net painter This notebook demonstrates a fun experiment in training a neural network to do regress...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/sandbox-1/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: NCC Source ID: SANDBOX-1 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
martinjrobins/hobo
examples/toy/distribution-simple-egg-box.ipynb
bsd-3-clause
import pints import pints.toy import numpy as np import matplotlib.pyplot as plt # Create log pdf sigma = 2 r = 4 log_pdf = pints.toy.SimpleEggBoxLogPDF(sigma, r) # Contour plot of pdf levels = np.linspace(-100, 0, 20) x = np.linspace(-15, 15, 100) y = np.linspace(-15, 15, 100) X, Y = np.meshgrid(x, y) Z = [[log_pdf(...
SSQ/Coursera-UW-Machine-Learning-Classification
Programming Assignment 3/module-4-linear-classifier-regularization-assignment-blank.ipynb
mit
from __future__ import division import graphlab """ Explanation: Logistic Regression with L2 regularization The goal of this second notebook is to implement your own logistic regression classifier with L2 regularization. You will do the following: Extract features from Amazon product reviews. Convert an SFrame into a...
tpin3694/tpin3694.github.io
machine-learning/dimensionality_reduction_with_kernel_pca.ipynb
mit
# Load libraries from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets import make_circles """ Explanation: Title: Dimensionality Reduction With Kernel PCA Slug: dimensionality_reduction_with_kernel_pca Summary: How to reduce the dimensions of the feature matrix using kernels for machine learning in P...
tensorflow/tensorflow
tensorflow/lite/g3doc/performance/post_training_float16_quant.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...
mworles/capstone_one
notebooks/inferential_statistics.ipynb
bsd-3-clause
# import packages used in the notebook import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV from sklearn.linear_model import LogisticRegression import statsmodels.api as sm from scipy import stats from sklearn.metrics import classification_report, f1...
lehnertu/TEUFEL
scripts/TestCase_BackwardDiffractionRadiation.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import scipy.integrate import scipy.special as func from scipy import constants from MeshedFields import * """ Explanation: Create a meshed screen to receive the emitted diffraction radiation End of explanation """ mesh = MeshedField.CircularMesh(R=1.0, ratio=1.0, l...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch5-Problem_5-10.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 5 Problem 5-10 End of explanation """ Ea = 460 # [V] EA_angle = -10/180*pi # [rad] EA = Ea * (cos(EA_angle) + 1j*sin(EA_angle)) Vphi = 480 # [V] VPhi_angle = 0/180*pi # [rad] VPhi = V...
tensorflow/docs-l10n
site/ko/probability/examples/A_Tour_of_TensorFlow_Probability.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...
ML4DS/ML4all
U_lab1.Clustering/Lab_ShapeSegmentation_student/LabSessionClustering_student.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.misc import imread """ Explanation: Lab Session: Clustering algorithms for Image Segmentation Author: Jesús Cid Sueiro Jan. 2017 End of explanation """ name = "birds.jpg" name = "Seeds.jpg" birds = imread("Images/" + name) birdsG = np....
SheffieldML/notebook
GPy/heteroscedastic_regression.ipynb
bsd-3-clause
import numpy as np import pylab as pb import GPy %pylab inline """ Explanation: Heteroscedastic Regression Updated on 27th November 2015 by Ricardo Andrade In this Ipython Notebook we will look at how to implement a GP regression with different noise terms using GPy. $\bf N.B.:$ There is currently no implementation t...
TiKeil/Master-thesis-LOD
notebooks/Figure_2.1-2.3_MsExampleFEM1d.ipynb
apache-2.0
import os import sys import numpy as np %matplotlib notebook import matplotlib.pyplot as plt from gridlod import util, world, fem from gridlod.world import World import femsolverCoarse """ Explanation: Multiscale example in one dimension This script applies the FEM to a one dimensional example of a multiscale proble...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/pipelines/lightweight_functions_component_io_kfp.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 AI Pipelines: Lightweight Python function-based components, and component I/O <table ali...
iRipVanWinkle/ml
Data Science UA - September 2017/Lecture 05 - Modeling Techniques and Regression/Linear_Regression.ipynb
mit
# imports import pandas as pd import matplotlib.pyplot as plt %matplotlib inline # read data into a DataFrame data = pd.read_csv('http://www-bcf.usc.edu/~gareth/ISL/Advertising.csv', index_col=0) data.head() """ Explanation: Introduction to Linear Regression Adapted from Chapter 3 of An Introduction to Statistical L...
dolittle007/dolittle007.github.io
notebooks/stochastic_volatility.ipynb
gpl-3.0
import numpy as np import pymc3 as pm from pymc3.distributions.timeseries import GaussianRandomWalk from scipy import optimize %pylab inline """ Explanation: Stochastic Volatility model End of explanation """ n = 400 returns = np.genfromtxt(pm.get_data("SP500.csv"))[-n:] returns[:5] plt.plot(returns) """ Explana...
CeciliaShi/STA-663-Final-Project
simulation_fastfsr.ipynb
mit
url1 = 'http://www4.stat.ncsu.edu/~boos/var.select/sim/x.quad.0.txt' url2 = 'http://www4.stat.ncsu.edu/~boos/var.select/sim/x.quad.70.txt' url3 = 'http://www4.stat.ncsu.edu/~boos/var.select/sim/h0_0.rs35.txt' url4 = 'http://www4.stat.ncsu.edu/~boos/var.select/sim/h1_0.rs35.txt' url5 = 'http://www4.stat.ncsu.edu/~boos/v...
juanshishido/experiments-guide
03-statistical-inference.ipynb
mit
import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt %matplotlib inline mpl.style.use('ggplot') mpl.rc('savefig', dpi=100) np.random.seed(42) # data mu, sigma = 0, 1 x = mu + sigma * np.random.randn(100000) # plot pd.Series(x).plot(kind='hist', bins=50, c...
QCaudron/pydata_pandas
coffee_analysis_solution.ipynb
mit
import pandas as pd """ Explanation: Introduction to data analytics with pandas Quentin Caudron PyData Seattle, July 2017 Systems check Do you have a working Python installation, with the pandas package ? End of explanation """ import pandas as pd %matplotlib inline """ Explanation: Note : This cell should run with...
SHDShim/pytheos
examples/6_p_scale_test_Dorogokupets2015_Au.ipynb
apache-2.0
%config InlineBackend.figure_format = 'retina' """ Explanation: For high dpi displays. End of explanation """ import matplotlib.pyplot as plt import numpy as np from uncertainties import unumpy as unp import pytheos as eos """ Explanation: 0. General note This example compares pressure calculated from pytheos and o...
bashtage/statsmodels
examples/notebooks/robust_models_1.ipynb
bsd-3-clause
%matplotlib inline from statsmodels.compat import lmap import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: M-Estimators for Robust Linear Modeling End of explanation """ norms = sm.robust.norms def plot_weights(support, weights_func, xlabels, xt...
el-ega/torneo-de-los-30
Torneo.de.los.30.ipynb
mit
# imports iniciales import matplotlib import numpy as np import matplotlib.pyplot as plt import pandas as pd # queremos que los gráficos se rendericen inline %matplotlib inline %pylab inline # configuración para los gráficos, estilo y dimensiones matplotlib.style.use('ggplot') figsize(12, 12) """ Explanation: Torneo...
johnhw/summerschool2015
CrashCourse_ExerciseAudio.ipynb
mit
# standard imports import numpy as np import scipy.io.wavfile as wavfile import scipy.signal as sig import matplotlib.pyplot as plt import sklearn.preprocessing, sklearn.cluster, sklearn.tree, sklearn.neighbors, sklearn.ensemble, sklearn.multiclass, sklearn.feature_selection import ipy_table import sklearn.svm, sklearn...
GEMScienceTools/rmtk
notebooks/vulnerability/derivation_fragility/hybrid_methods/CSM/CSM.ipynb
agpl-3.0
from rmtk.vulnerability.derivation_fragility.hybrid_methods.CSM import capacitySpectrumMethod from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: Capacity Spectrum Method (CSM) The Capacity Spectrum Method (CSM) is a procedure capable of estimating the nonlinear response of structures, uti...
fasiha/ebisu
EbisuHowto.ipynb
unlicense
import ebisu defaultModel = (4., 4., 24.) # alpha, beta, and half-life in hours """ Explanation: Ebisu howto A quick introduction to using the library to schedule spaced-repetition quizzes in a principled, probabilistically-grounded, Bayesian manner. See https://fasiha.github.io/ebisu/ for details! End of explanation...
rsignell-usgs/python-training
web-services/Dust_Bowl_GDP-Pandas.ipynb
cc0-1.0
from IPython.core.display import Image Image('http://www-tc.pbs.org/kenburns/dustbowl/media/photos/s2571-lg.jpg') """ Explanation: Exploring Climate Data: Past and Future Roland Viger, Rich Signell, USGS First presented at the 2012 Unidata Workshop: Navigating Earth System Science Data, 9-13 July. What if you were wat...
rlopc/datcom-labs
ugr-datcom-ncc_ni-labs/ugr-datcom-ncc_ni-lab_00/ex_02-leaky-integrate-and-fire model.ipynb
gpl-3.0
from neurodynex.leaky_integrate_and_fire import LIF print("resting potential: {}".format(LIF.V_REST)) """ Explanation: 2.1.1. Question: minimal current (calculation) For the default neuron parameters (see above) compute the minimal amplitude i_min of a step current to elicitate a spike. You can access these default va...
dataventures/workshops
0/Pandas.ipynb
mit
%pylab inline # Import pylab to provide scientific Python libraries (NumPy, SciPy, Matplotlib) %pylab --no-import-all #import pylab as pl # import the Image display module from IPython.display import Image """ Explanation: Pandas Dataframe Exploration - Restaurant Inspection Modified from an IPython Notebook created ...
Gordonei/MagicalTalkingTree
examples/TweetAnalysis.ipynb
gpl-3.0
with open("search_output-2016-10-16.bin",'rb') as tweet_file: results = [] while not tweet_file.closed: try: results += [pickle.load(tweet_file)] except EOFError: tweet_file.close() """ Explanation: Data In Reading in Tweepy data, and turning into a dictionary End of expla...
SN-Isotropy/Isotropy
examples/Example_MockDataCreation.ipynb
mit
mockDataFile = os.path.join(isotropy.example_data_dir, 'snFits.p.gz') sampleData, totalSN = isotropy.read_mockDataPickle(mockDataFile) sampleData.head() # Total number of SN in the simulation (before we threw away bad points) totalSN sampleData['mu_err'] = sampleData.mu_var.apply(np.sqrt) sampleData.head() # mu_e...
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/Final Project (Minesweeper)/_01. Building the Board (HW).ipynb
mit
import random def build_board(num_rows, num_cols, bomb_count=0, non_bomb_character="-"): board_temp = ["B"] * bomb_count + [non_bomb_character] * (num_rows * num_cols - bomb_count) if bomb_count: random.shuffle(board_temp) board = [] for i in range(0, num_rows*num_cols, num_cols): bo...
Yu-Group/scikit-learn-sandbox
jupyter/backup_deprecated_nbs/06_explore_binary_decision_tree.ipynb
mit
# Setup %matplotlib inline import matplotlib.pyplot as plt from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import confusion_matrix from sklearn.datasets import load_iris from sklearn import tree import ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/text_models/labs/rnn_encoder_decoder.ipynb
apache-2.0
pip install nltk import os import pickle import sys import nltk import numpy as np import pandas as pd import tensorflow as tf import utils_preproc from sklearn.model_selection import train_test_split from tensorflow.keras.layers import GRU, Dense, Embedding, Input from tensorflow.keras.models import Model, load_mode...
ES-DOC/esdoc-jupyterhub
notebooks/csir-csiro/cmip6/models/sandbox-3/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-3', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: CSIR-CSIRO Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topics: Tracers. ...
Diyago/Machine-Learning-scripts
DEEP LEARNING/Pytorch from scratch/MLP/Part 3 - Training Neural Networks (Solution).ipynb
apache-2.0
import torch from torch import nn import torch.nn.functional as F from torchvision import datasets, transforms # Define a transform to normalize the data transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)), ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/05_review/2_sample_dataset.ipynb
apache-2.0
PROJECT = "cloud-training-demos" # Replace with your PROJECT BUCKET = "cloud-training-bucket" # Replace with your BUCKET REGION = "us-central1" # Choose an available region for Cloud MLE TFVERSION = "1.14" # TF version for CMLE to use import os os.environ["BUCKET"] = BUCKET os.environ["PROJ...
ES-DOC/esdoc-jupyterhub
notebooks/cmcc/cmip6/models/cmcc-cm2-hr4/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-hr4', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CMCC Source ID: CMCC-CM2-HR4 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy...
JAmarel/LiquidCrystals
ElectroOptics/Plots V6.ipynb
mit
import numpy as np from scipy.integrate import quad, dblquad %matplotlib inline import matplotlib.pyplot as plt """ Explanation: TO DO: Need to be able to scatter plot measured values of Psi on top of the current Psi plot. Alpha and rho LaTeX not working in plots. Legend needs to be move in the Psi plot. Consider also...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/03_tensorflow/labs/b_estimator.ipynb
apache-2.0
import tensorflow as tf import pandas as pd import numpy as np import shutil print(tf.__version__) """ Explanation: <h1>2b. Machine Learning using tf.estimator </h1> In this notebook, we will create a machine learning model using tf.estimator and evaluate its performance. The dataset is rather small (7700 samples),...
DeepLearningUB/DeepLearningMaster
4. Tensorflow first learning models.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline # Load data. import numpy as np data = pd.read_csv('data/Advertising.csv',index_col=0) train_X = data[['TV']].values train_Y = data.Sales.values train_Y = train_Y[:,np.newaxis] n_samples = train_X.shape[0] print n_samples pr...
alexandrnikitin/algorithm-sandbox
courses/DAT256x/Module01/01-02-Linear Equations.ipynb
mit
import pandas as pd # Create a dataframe with an x column containing values from -10 to 10 df = pd.DataFrame ({'x': range(-10, 11)}) # Add a y column by applying the solved equation to x df['y'] = (3*df['x'] - 4) / 2 #Display the dataframe df """ Explanation: Linear Equations The equations in the previous lab inclu...
yvesdubief/UVM-ME249-CFD
ME249-Lecture-3.ipynb
gpl-2.0
%matplotlib inline # plots graphs within the notebook %config InlineBackend.figure_format='svg' # not sure what this does, may be default images to svg format from IPython.display import Image from IPython.core.display import HTML def header(text): raw_html = '<h4>' + str(text) + '</h4>' return raw_html def...
xR86/ml-stuff
labs-python/PythonLab-1-3.ipynb
mit
def gcd(a,b): while b: a,b = b,a%b return a def gcdMultiple(*args): #print(len(args)) #for i in args: #print(i) if len(args) < 2: return -1 for i in range(2,len(args)+1,2): res = gcd(args[i-2],args[i-1]) fin = gcd(res,args[i-2]) return fin ''' def a...
california-civic-data-coalition/python-calaccess-notebooks
project-management/mooc-students.ipynb
mit
import bs4 import numpy as np import pandas as pd from iso3166 import countries as iso3166 %matplotlib inline pd.options.display.max_rows = None """ Explanation: Python for Data Journalists MOOC participant analysis By Ben Welsh Import Python tools End of explanation """ html = open("./input/PDJ0517_ Participants....
althonos/pronto
docs/source/examples/ms.ipynb
mit
import pronto ms = pronto.Ontology.from_obo_library("ms.obo") """ Explanation: Exploring MzML files with the MS Ontology In this example, we will learn how to use pronto to extract a hierarchy from the MS Ontology, a controlled vocabulary developed by the Proteomics Standards Initiative to hold metadata about Mass Sp...
sdrogers/lda
notebooks/experimental_pipeline.ipynb
gpl-3.0
import luigi as lg import json import pickle import sys basedir = '/Users/joewandy/git/lda/code/' sys.path.append(basedir) from multifile_feature import SparseFeatureExtractor from lda import MultiFileVariationalLDA """ Explanation: New experimental MS2LDA workflow Based on Luigi, a Python-based pipeline engine. Als...
enbanuel/phys202-2015-work
assignments/assignment03/NumpyEx04.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns """ Explanation: Numpy Exercise 4 Imports End of explanation """ import networkx as nx K_5=nx.complete_graph(5) nx.draw(K_5) """ Explanation: Complete graph Laplacian In discrete mathematics a Graph is a set of vertices or n...
aleph314/K2
Getting and Cleaning Data/cleaning_exercises_all-advanced.ipynb
gpl-3.0
import pandas as pd import numpy as np sets = ['station', 'trip', 'weather'] cycle = {} for s in sets: cycle[s] = pd.read_csv('cycle_share/' + s + '.csv') cycle['trip'].head() """ Explanation: Cleaning: Cycle Share There are 3 datasets that provide data on the stations, trips, and weather from 2014-2016. Stati...
mne-tools/mne-tools.github.io
0.23/_downloads/548b4fc45f1ed79527138879cd79d3c8/muscle_detection.ipynb
bsd-3-clause
# Authors: Adonay Nunes <adonay.s.nunes@gmail.com> # Luke Bloy <luke.bloy@gmail.com> # License: BSD (3-clause) import os.path as op import matplotlib.pyplot as plt import numpy as np from mne.datasets.brainstorm import bst_auditory from mne.io import read_raw_ctf from mne.preprocessing import annotate_muscle_...
Diyago/Machine-Learning-scripts
DEEP LEARNING/Pytorch from scratch/TODO/Autoencoders/convolutional-autoencoder/Upsampling_Solution.ipynb
apache-2.0
import torch import numpy as np from torchvision import datasets import torchvision.transforms as transforms # convert data to torch.FloatTensor transform = transforms.ToTensor() # load the training and test datasets train_data = datasets.MNIST(root='data', train=True, download=True...
zomansud/coursera
ml-classification/week-7/module-10-online-learning-assignment-blank.ipynb
mit
from __future__ import division import graphlab """ Explanation: Training Logistic Regression via Stochastic Gradient Ascent The goal of this notebook is to implement a logistic regression classifier using stochastic gradient ascent. You will: Extract features from Amazon product reviews. Convert an SFrame into a Num...
sidazhang/udacity-dlnd
intro-to-tflearn/TFLearn_Sentiment_Analysis.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w...
glouppe/scikit-optimize
examples/hyperparameter-optimization.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (10, 6) """ Explanation: Tuning a scikit-learn estimator with skopt Gilles Louppe, July 2016. End of explanation """ from sklearn.datasets import load_boston from sklearn.ensemble import GradientBoostingRegressor f...
minesh1291/Practicing-Kaggle
MNIST_2017/dump_/MNIST_TensorFlow_script.ipynb
gpl-3.0
%matplotlib inline import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from sklearn.model_selection import ShuffleSplit from sklearn.preprocessing import StandardScaler, LabelEncoder, OneHotEncoder """ Explanation: A Convolutional Neural Network for MNIST Classification. This...
southpaw94/MachineLearning
TextExamples/3547_04_Code.ipynb
gpl-2.0
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scikit-learn # to install watermark just uncomment the following line: #%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py """ Explanation: Sebastian Raschka, 2015 Python Machine Learning Essentia...
shirtsgroup/physical-validation
doc/examples/kinetic_energy_distribution.ipynb
lgpl-2.1
# enable plotting in notebook %matplotlib notebook """ Explanation: Kinetic energy distribution Note: This notebook can be run locally by cloning the Github repository. The notebook is located in doc/examples/kinetic_energy_distribution.ipynb. Be aware that probabilistic quantities such as error estimates based on boo...
karlstroetmann/Artificial-Intelligence
Python/1 Search/Sliding-Puzzle.ipynb
gpl-2.0
def find_tile(tile, State): n = len(State) for row in range(n): for col in range(n): if State[row][col] == tile: return row, col """ Explanation: The Sliding Puzzle <img src="8-puzzle.png"> The picture above shows an instance of the $3 \times 3$ <a href="https://en.wikipedi...
phoebe-project/phoebe2-docs
development/tutorials/mpi.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" import phoebe """ Explanation: Advanced: Running PHOEBE in MPI Setup Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab). End of explanation """ print(phoebe.mpi.enabled) print(phoe...
ChadFulton/statsmodels
examples/notebooks/discrete_choice_example.ipynb
bsd-3-clause
%matplotlib inline from __future__ import print_function import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm from statsmodels.formula.api import logit, probit, poisson, ols print(sm.datasets.fair.SOURCE) print( sm.datasets.fair.NOTE) dta = sm.d...
antoniomezzacapo/qiskit-tutorial
community/games/game_engines/Making_your_own_hello_quantum.ipynb
apache-2.0
%matplotlib notebook import hello_quantum """ Explanation: Hello Quantum for Jupyter notebook Hello Quantum is a project based on the idea of visualizing two qubit states and gates, and making them accessible to a non-specialist audience. In the hello_quantum.py file you'll find some tools with which the 'Hello Quantu...
tensorflow/docs
site/en/tutorials/audio/music_generation.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...
ucsc-astro/coffee
18_01_26_optimizing_python/Speeding up python code.ipynb
gpl-3.0
import numpy as np """ Explanation: Overview Pre-mature optimization is the root of all evil A good framework to keep in mind is: Make it work -- you should first make sure your code is working properly, and make sure you save/version-control the correctly copy. Fast, but buggy code doesn't help anyone. Make it ...
vrbala/vrbala.github.io
machine-learning-nanodegree/student_intervention/student_intervention/new/.ipynb_checkpoints/student_intervention-checkpoint.ipynb
mit
# Import libraries import numpy as np import pandas as pd # Read student data student_data = pd.read_csv("student-data.csv") print "Student data read successfully!" # Note: The last column 'passed' is the target/label, all other are feature columns """ Explanation: Project 2: Supervised Learning Building a Student In...
parrt/dtreeviz
notebooks/dtreeviz_sklearn_pipeline_visualisations.ipynb
mit
random_state = 1234 dataset = pd.read_csv("../data/titanic/titanic.csv") # Fill missing values for Age dataset.fillna({"Age":dataset.Age.mean()}, inplace=True) # Encode categorical variables dataset["Sex_label"] = dataset.Sex.astype("category").cat.codes dataset["Cabin_label"] = dataset.Cabin.astype("category").cat.cod...
SudiptaBiswas/moose
modules/tensor_mechanics/test/tests/torque/validation.ipynb
lgpl-2.1
import math d = 2*0.95 D = 2 Iz = math.pi*(D**4-d**4)/32 md(f"$$I_z = {Iz}$$") """ Explanation: Hollow cylinder torsion validation Polar moment of inertia For a hollow cylinder with inner diameter $d$ and outer diameter $D$ the polar moment of inertia $I_z$ id $$ I_z = \frac{\pi\left(D^4-d^4\right)}{32} $$ Analytic...
hungiyang/StatisticalMethods
examples/SDSScatalog/quasars_jsb.ipynb
gpl-2.0
## get the data locally ... I put this on a gist !curl -k -O https://gist.githubusercontent.com/anonymous/53781fe86383c435ff10/raw/4cc80a638e8e083775caec3005ae2feaf92b8d5b/qso10000.csv !curl -k -O https://gist.githubusercontent.com/anonymous/2984cf01a2485afd2c3e/raw/964d4f52c989428628d42eb6faad5e212e79b665/star1000.csv...
grantjenks/pyannote-core
notebook/pyannote.core.segment.ipynb
mit
from pyannote.core import Segment """ Explanation: Segment (pyannote.core.segment.Segment) End of explanation """ # start time in seconds s = 1. # end time in seconds e = 9. segment = Segment(start=s, end=e) segment """ Explanation: Segment instances are used to describe temporal fragments (e.g. of an audio file). ...
MrKriss/ThinkStatsToolbox
stats_toolbox/examples/Histogram Example.ipynb
gpl-3.0
# Imports import os import sys import pandas as pd import seaborn as sb # Custom Imports sys.path.insert(0, '../../') import stats_toolbox as st from stats_toolbox.utils.data_loaders import load_fem_preg_2002 # Graphics setup %pylab inline --no-import-all sb.set_context('notebook', font_scale=1.5) """ Explanation: ...
cesarcontre/Simulacion2017
Modulo3/Clase21_AjusteCurvas.ipynb
mit
import numpy as np import matplotlib.pyplot as plt P1 = [0, 1] P2 = [1, 0] X = np.array([[1, 0], [1, 1]]) y = np.array([1, 0]) b0, b1 = np.linalg.inv(X).dot(y) b0, b1 x = np.linspace(-0.2, 1.2, 100) y = b1*x+b0 plt.figure(figsize=(8,6)) plt.plot([P1[0], P2[0]], [P1[1], P2[1]], 'r*', label = 'puntos') plt.plot(x, y,...
emiliom/ODM2PythonAPI
Examples/WaterQualityMeasurements_RetrieveVisualize.ipynb
bsd-3-clause
%matplotlib inline import sys import os import sqlite3 import matplotlib.pyplot as plt from shapely.geometry import Point import pandas as pd import geopandas as gpd import folium from folium.plugins import MarkerCluster import odm2api from odm2api.ODMconnection import dbconnection import odm2api.services.readServic...
Yu-Group/scikit-learn-sandbox
jupyter/backup_deprecated_nbs/25_wrapper_stability-BL.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer import numpy as np from functools import reduce # Needed for the scikit-learn wrapper function from sklearn.utils import resample from sklearn.ensemble import RandomForestClassifier from math import ceil # Import our c...
goodwordalchemy/thinkstats_notes_and_exercises
code/.ipynb_checkpoints/chap03ex-checkpoint.ipynb
gpl-3.0
%matplotlib inline import chap01soln resp = chap01soln.ReadFemResp() """ Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br> Allen Downey Read the female respondent file. End of explanation """ def BiasPmf(pmf, label=''): """Returns the Pmf with oversampling proportional to value. If ...
testedminds/sand
docs/Visualization with Cytoscape.ipynb
apache-2.0
from py2cytoscape.data.cynetwork import CyNetwork from py2cytoscape.data.cyrest_client import CyRestClient from py2cytoscape.data.style import StyleUtil import py2cytoscape.util.cytoscapejs as cyjs import py2cytoscape.cytoscapejs as renderer from IPython.display import Image import igraph as igraph import sand impor...
josephcslater/mousai
docs/algorithm/Algorithm.ipynb
bsd-3-clause
# Define our function (Python) def duff_osc_ss(x, params): omega = params['omega'] t = params['cur_time'] xd = np.array([[x[1]], [-x[0] - 0.1 * x[0]**3 - 0.1 * x[1] + 1 * sin(omega * t)]]) return xd # Arguments are name of derivative function, number of states, driving frequency, # f...
google/empirical_calibration
notebooks/survey_calibration_cvxr.ipynb
apache-2.0
from matplotlib import pyplot as plt import numpy as np import pandas as pd import seaborn as sns sns.set_style('whitegrid') %config InlineBackend.figure_format='retina' # install and import ec !pip install -q git+https://github.com/google/empirical_calibration import empirical_calibration as ec # install and import ...
psci2195/espresso-ffans
doc/tutorials/12-constant_pH/12-constant_pH.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np import scipy.constants # physical constants import espressomd import pint # module for working with units and dimensions from espressomd import electrostatics, polymer, reaction_ensemble from espressomd.interactions import HarmonicBond ureg = pint.UnitRegistry() # ...
agushman/coursera
src/cours_2/week_2/OverfittingTask.ipynb
mit
import pandas as pd import numpy as np from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Практическое задание к уроку 1 (2 неделя). Линейная регрессия: переобучение и регуляризация В этом задании мы на примерах увидим, как переобучаются линейные модели, разберем, почему так происходит, и выясним...
Heerozh/deep-learning
first-neural-network/Your_first_neural_network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
xuanhan863/polyglot
notebooks/CLI.ipynb
gpl-3.0
!polyglot --help """ Explanation: Command Line Interface polyglot package offer a command line interface along with the library access. For each task in polyglot, there is a subcommand with specific options for that task. Common options are gathered under the main command polyglot End of explanation """ !polyglot --...
NelisW/ComputationalRadiometry
02-PythonWhirlwindCheatSheet.ipynb
mpl-2.0
from IPython.display import display from IPython.display import Image from IPython.display import HTML from IPython.core.display import display, HTML # display(HTML(df.to_html())) import numpy as np import os.path """ Explanation: 2 Python and Numpy whirlwind cheat sheet This notebook forms part of a series on compu...
datactive/bigbang
examples/experimental_notebooks/IETF Participants.ipynb
mit
%matplotlib inline import bigbang.ingress.mailman as mailman import bigbang.analysis.graph as graph import bigbang.analysis.process as process from bigbang.parse import get_date from bigbang.archive import Archive import bigbang.utils as utils import pandas as pd import datetime import matplotlib.pyplot as plt import n...
pyreaclib/pyreaclib
examples/pp-CNO-example.ipynb
bsd-3-clause
%matplotlib inline import pynucastro as pyrl """ Explanation: Interactive Network Exploration with pynucastro This notebook shows off the interactive RateCollection network plot. You must have widgets enabled, e.g., via: jupyter nbextension enable --py --user widgetsnbextension for a user install or jupyter nbextensi...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/reduction_server/distributed-training-reduction-server.ipynb
apache-2.0
import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLOUD_NOTEBOOK: USER_FLAG = "--user" """ Explanation:...
agile-geoscience/welly
tutorial/03_Plotting.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import welly welly.__version__ """ Explanation: Plotting Some preliminaries... End of explanation """ from welly import Well w = Well.from_las('data/P-130_out.LAS') w.data.keys() w.data['GR'].plot() """ Explanation: Load a well and add deviation and a striplog ...
param411singh/inf1340-2015-notebooks
Week 5.ipynb
mit
# This program displays a rectangular pattern of asterisks width = 2 height = 2 for h in range(height): for w in range(width): print ("*"), print("") # This program displays a triangle pattern of asterisks # * # * * # * * * height = 10 for h in range(height): for w in range(h + 1): ...
materialsvirtuallab/matgenb
notebooks/2016-09-08-Data-driven First Principles Methods for the Study and Design of Alkali Superionic Conductors Part 1 - Structure Generation.ipynb
bsd-3-clause
from pymatgen.core import Structure from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation from pymatgen.io.vasp.sets import batch_write_input, MPRelaxSet """ Explanation: Introduction This notebook demonstrates how to pe...
landlab/landlab
notebooks/tutorials/overland_flow/soil_infiltration_green_ampt/infilt_green_ampt_with_overland_flow.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from landlab import imshow_grid, RasterModelGrid from landlab.io import read_esri_ascii from landlab.components import SoilInfiltrationGreenAmpt, KinwaveImplicitOverlandFlow """ Explanation: Green-Ampt infiltration and kinematic wave overland flow This tutorial shows ...
geodynamics/burnman
tutorial/tutorial_02_composition_class.ipynb
gpl-2.0
from burnman import Composition olivine_composition = Composition({'MgO': 1.8, 'FeO': 0.2, 'SiO2': 1.}, 'molar') """ Explanation: <h1>The BurnMan Tutorial</h1> Part 2: The Composition Class This file is part of BurnMan - a thermoelastic and thermo...
AssembleSoftware/IoTPy
examples/FunctionsStreamToStream.ipynb
bsd-3-clause
import os import sys sys.path.append("../") from IoTPy.core.stream import Stream, run from IoTPy.agent_types.op import map_element from IoTPy.agent_types.basics import fmap_e from IoTPy.helper_functions.recent_values import recent_values @fmap_e def f(v): return v+10 # f is a function that maps a stream to a stream ...
rflamary/POT
notebooks/plot_otda_mapping_colors_images.ipynb
mit
# Authors: Remi Flamary <remi.flamary@unice.fr> # Stanislas Chambon <stan.chambon@gmail.com> # # License: MIT License import numpy as np from scipy import ndimage import matplotlib.pylab as pl import ot r = np.random.RandomState(42) def im2mat(I): """Converts and image to matrix (one pixel per line)"""...
tritemio/multispot_paper
out_notebooks/usALEX-5samples-PR-raw-out-Dex-22d.ipynb
mit
ph_sel_name = "Dex" data_id = "22d" # ph_sel_name = "all-ph" # data_id = "7d" """ Explanation: Executed: Mon Mar 27 11:36:04 2017 Duration: 8 seconds. usALEX-5samples - Template This notebook is executed through 8-spots paper analysis. For a direct execution, uncomment the cell below. End of explanation """ from ...
grfiv/MNIST
svm.scikit/svm_rbf_pca.scikit_benchmark.ipynb
mit
from __future__ import division import os, time, math import cPickle as pickle import matplotlib.pyplot as plt import numpy as np import scipy import csv from operator import itemgetter from tabulate import tabulate from print_imgs import print_imgs # my own function to print a grid of square images from sklearn.pr...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/amr_stl.ipynb
apache-2.0
!pip install hanlp[amr] -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/amr_stl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt...
mne-tools/mne-tools.github.io
0.23/_downloads/e51cf7d76ca7b5745c35997ababd9c86/covariance_whitening_dspm.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import spm_face from mne.minimum_norm import apply_inverse, make_inverse_operator from mne.cov import compute_covariance print(__doc__)...
rileyrustad/pdxapartmentfinder
analysis/First_Analysis.ipynb
mit
# start with imports import numpy as np import pandas as pd from pandas import DataFrame import json import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: This is my first attempt at creating a model using sklearn alogithms The algorithms I am most familiar ...
phoebe-project/phoebe2-docs
2.2/tutorials/ORB.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: 'orb' Datasets and Options Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplotlib i...
gcgruen/homework
data-databases-homework/Homework_5_Gruen.ipynb
mit
from bs4 import BeautifulSoup from urllib.request import urlopen html = urlopen("http://static.decontextualize.com/cats.html").read() document = BeautifulSoup(html, "html.parser") """ Explanation: Homework #5 This homework presents a sophisticated scenario in which you must design a SQL schema, insert data into it, an...
willsa14/ras2las
data/kgs/DownloadLogs_v2.ipynb
mit
elogs = pd.read_csv('temp/ks_elog_scans.txt', parse_dates=True) lases = pd.read_csv('temp/ks_las_files.txt', parse_dates=True) elogs_mask = elogs['KID'].isin(lases['KGS_ID']) # Create mask for elogs both_elog = elogs[elogs_mask] # select items elog that fall in both both_elog.drop_duplicates('KID') # remove duplicate...