repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
dipanjank/ml
data_analysis/concrete_slump.ipynb
gpl-3.0
import numpy as np import pandas as pd %pylab inline pylab.style.use('ggplot') import seaborn as sns data = pd.read_csv('concrete_slump.csv') data = data.drop('No', axis=1) data.head() """ Explanation: Concrete Slump Test - UCI Analysis of the <a href="https://archive.ics.uci.edu/ml/datasets/Concrete+Slump+Test">co...
arasdar/DL
impl-dl/cnn-tensorflow-from-scratch.ipynb
unlicense
# GPUs or CPU import tensorflow as tf # Check TensorFlow Version print('TensorFlow Version: {}'.format(tf.__version__)) # Check for a GPU print('Default GPU Device: {}'.format(tf.test.gpu_device_name())) """ Explanation: CNN from scratch In this notebook, we're going to build a convolutional neural network for recog...
dataventures/workshops
6/Applications in Finance.ipynb
mit
import datetime as dt import matplotlib.pyplot as plt import numpy as np import numpy.linalg as la import pandas as pd import scipy.cluster.hierarchy as sch import seaborn as sns from pandas.io.data import DataReader from scipy.stats import mode from scipy.stats.stats import pearsonr from IPython.display import Ima...
philferriere/tfoptflow
tfoptflow/pwcnet_train_lg-6-2-cyclic-chairsthingsmix.ipynb
mit
""" pwcnet_train.ipynb PWC-Net model training. Written by Phil Ferriere Licensed under the MIT License (see LICENSE for details) Tensorboard: [win] tensorboard --logdir=E:\\repos\\tf-optflow\\tfoptflow\\pwcnet-lg-6-2-cyclic-chairsthingsmix [ubu] tensorboard --logdir=/media/EDrive/repos/tf-optflow/tfoptflow/...
pschragger/big-data-python-class
Lectures/Week 5 - MapReduce - MRJob/MapReduce Intro.ipynb
mit
def cube(x): return x*x*x map(cube,range(1,11)) """ Explanation: Challenge of processing large amounts of data <ul> <li>How to process is quickly? <li>So how do we go about making the problem map so that it can be distributed computation? <li> Distributed/Parrallel Programming is hard </ul> Mapreduce addresses all t...
phoebe-project/phoebe2-docs
development/tutorials/fti.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: Finite Time of Integration (fti) 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 """ import phoebe from phoebe import u # units import n...
hparik11/Deep-Learning-Nanodegree-Foundation-Repository
Project4/language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/01_bigquery/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...
jldinh/multicell
examples/07 - Gierer-Meinhardt with growth and divisions.ipynb
mit
%matplotlib notebook """ Explanation: In this example, we will use Multicell to simulate the self-reorganization of a geometrical Turing pattern, based on equations developed by Gierer and Meinhardt, as the cells of the underlying tissue grow and divide. Preparation End of explanation """ import multicell import num...
apozas/BIST-Python-Bootcamp
7_BestPractices_Testing_Performance.ipynb
gpl-3.0
import this """ Explanation: 7 Best Practices, Testing and Performance Advanced bits marked with ⚠ might be more for reference later. PEP8 -- Style Guide for Python Code Intendation is significant in Python, preventing the worst mess. The remaining stylistic questions, like naming conventions, used in the standard lib...
bjornstenqvist/faunus
examples/multipole/multipole.ipynb
mit
%matplotlib inline import matplotlib import matplotlib.cm as cm import unittest import numpy as np import matplotlib.pyplot as plt import sys plt.rcParams.update({'font.size': 18, 'figure.figsize': [8.0, 6.0]}) """ Explanation: Decomposition of electrostatic interaction energy between two multipolar molecules This is ...
DanielAndreasen/Programmers-Club
previous_versions/notebook/Adding locality to regressors - CAUP.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from astroML.linear_model import NadarayaWatson import statsmodels.api as sm import scipy.stats as stats %matplotlib inline sns.set_context('talk') sns.set_style('whitegrid', {"grid.color": ".95", 'grid.linestyle': u'-'}) def make_fake_data(): ...
tolaoniyangi/dmc
notebooks/week-4/01-tensorflow ANN for regression.ipynb
apache-2.0
%matplotlib inline import math import random import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from sklearn.datasets import load_boston import numpy as np import tensorflow as tf sns.set(style="ticks", color_codes=True) """ Explanation: Lab 4 - Tensorflow ANN for regression In this lab we wi...
ugo-nama-kun/pydata_okinawa2017
introduction_deep_rl.ipynb
mit
# 数値計算に必須のもろもろ import numpy as np # 可視化パッケージ import matplotlib.pyplot as plt from IPython import display %matplotlib inline # seaborn を入れてない人は以下をコメントアウト import seaborn as sns sns.set_style('darkgrid') """ Explanation: keras-rl で深層強化学習入門 深層強化学習とは? keras-rl とは? Karlsruhe Institute of Technology (カールスルーエ工科大学, KIT) の人た...
InsightLab/data-science-cookbook
2019/06-decision-tree/Exercise_Tree_Decision.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.tree import DecisionTreeRegressor from sklearn.model_selection import KFold, cross_val_score import numpy as np dataset = pd.read_csv(...
csdms/pymt
notebooks/gipl.ipynb
mit
import pymt.models import matplotlib.pyplot as plt import seaborn as sns import numpy as np import matplotlib.colors as mcolors from matplotlib.colors import LinearSegmentedColormap sns.set(style='whitegrid', font_scale= 1.2) """ Explanation: Basic use of the GIPL model Before you begin, install: conda install -c cond...
csaladenes/csaladenes.github.io
present/sapientia1/projects/meteorit/v2/Meteorite.ipynb
mit
df """ Explanation: Jo lenne tudni pontosabban, hogy mit jelent itt a neha.. End of explanation """ df=pd.read_csv(csv_path) df[(df[u'year'] <= 2016)] """ Explanation: lassuk lepesekben: End of explanation """ print pd.Timestamp.min print pd.Timestamp.max """ Explanation: ugy nez ki ez a kifejezes a hibas a 2016...
dereneaton/RADmissing
emp_nb_Phrynosomatidae.ipynb
mit
### Notebook 2 ### Data set 2 (Phrynosomatidae) ### Authors: Leache et al. (2015) ### Data Location: NCBI SRA SRP063316 """ Explanation: Notebook 2: This is an Jupyter/IPython notebook. Most of the code is composed of bash scripts, indicated by %%bash at the top of the cell, otherwise it is IPython code. This notebook...
bjornaa/ladim
examples/jupyter/line.ipynb
mit
# Basic from io import StringIO import numpy as np from netCDF4 import Dataset # Plotting import matplotlib.pyplot as plt import matplotlib.animation as animation from IPython.display import HTML %matplotlib inline # Ladim import ladim from postladim import ParticleFile """ Explanation: Jupyter notebook version of t...
antoniomezzacapo/qiskit-tutorial
community/teach_me_qiskit_2018/state_distribution_in_qubit_chains/qubit_chain_mod_many.ipynb
apache-2.0
from pprint import pprint import math import numpy as np # importing the Qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import Aer, execute # import state tomography functions from qiskit.tools.visualization import plot_histogram, plot_state # Definition of matchgate def gat...
QuantStack/quantstack-talks
2019-06-04-deRSE19-widgets/notebooks/1 - ipywidgets.ipynb
bsd-3-clause
from ipywidgets import IntSlider slider = IntSlider() slider slider.value slider.value = 20 slider """ Explanation: <center><img src="src/ipywidgets.svg" width="50%"></center> Repository: https://github.com/jupyter-widgets/ipywidgets Installation: conda install -c conda-forge ipywidgets Simple slider for driving ...
mitdbg/modeldb
client/workflows/demos/tf-text-classification.ipynb
mit
# Python 3.6 !pip install verta !pip install wget !pip install pandas !pip install tensorflow==1.14.0 !pip install scikit-learn !pip install lxml !pip install beautifulsoup4 """ Explanation: StackOverflow Question Multiclassification (Keras) This example uses a dataset from stackoverflow, with the input being posts an...
daniestevez/jupyter_notebooks
Lucy/Lucy frames EB3FRN 2021-10-19.ipynb
gpl-3.0
def timestamps(packets): epoch = np.datetime64('2000-01-01T12:00:00') t = np.array([struct.unpack('>I', p[ccsds.SpacePacketPrimaryHeader.sizeof():][:4])[0] for p in packets], 'uint32') return epoch + t * np.timedelta64(1, 's') def load_frames(path): frame_size = 223 * 5 - 2 frames...
IsacLira/data-science-cookbook
2017/05-naive-bayes/naiveBayes_otacilio_bezerra.ipynb
mit
# Libraries import numpy as np import pandas as pd from sklearn.naive_bayes import MultinomialNB, GaussianNB from sklearn.cross_validation import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.metrics import accuracy_score, classification_report # Creating a class for the Naive Bayes clas...
yorkerlin/shogun
doc/ipython-notebooks/neuralnets/autoencoders.ipynb
gpl-3.0
%pylab inline %matplotlib inline from scipy.io import loadmat from modshogun import RealFeatures, MulticlassLabels, Math # load the dataset dataset = loadmat('../../../data/multiclass/usps.mat') Xall = dataset['data'] # the usps dataset has the digits labeled from 1 to 10 # we'll subtract 1 to make them in the 0-9 r...
thehackerwithin/berkeley
code_examples/nltk/THW_NLTK.ipynb
bsd-3-clause
text = '''Hello, my name is Chris. I'll be talking about the python library NLTK today. NLTK is a popular tool to conduct text processing tasks in NLP.''' from nltk.tokenize import word_tokenize print("Notice the difference!") print() print(word_tokenize(text)) print() print("vs.") print() print(text.split()) ""...
sebp/scikit-survival
doc/user_guide/00-introduction.ipynb
gpl-3.0
from sksurv.datasets import load_veterans_lung_cancer data_x, data_y = load_veterans_lung_cancer() data_y """ Explanation: Introduction to Survival Analysis with scikit-survival scikit-survival is a Python module for survival analysis built on top of scikit-learn. It allows doing survival analysis while utilizing the...
jrg365/gpytorch
examples/08_Advanced_Usage/Simple_GP_Regression_Derivative_Information_2d.ipynb
mit
import torch import gpytorch import math from matplotlib import cm from matplotlib import pyplot as plt import numpy as np %matplotlib inline %load_ext autoreload %autoreload 2 """ Explanation: GPyTorch regression with derivative information in 2d Introduction In this notebook, we show how to train a GP regression mo...
timzhangau/ml_nano
practice_projects/imdb/Student_Admissions.ipynb
mit
import pandas as pd data = pd.read_csv('student_data.csv') data """ Explanation: Predicting Student Admissions In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data: - GRE Scores (Test) - GPA Scores (Grades) - Class rank (1-4) The dataset originally came from here: ht...
daniel-koehn/Theory-of-seismic-waves-II
02_Mesh_generation/1_Cartesian_Finite_Difference_grid.ipynb
gpl-3.0
# Execute this cell to load the notebook's style sheet, then ignore it from IPython.core.display import HTML css_file = '../style/custom.css' HTML(open(css_file, "r").read()) """ Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 D. Koehn, notebook style s...
ksooklall/deep_learning_foundation
transfer-learning/Transfer_Learning.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_01/Final/.ipynb_checkpoints/Create-checkpoint.ipynb
bsd-3-clause
import pandas as pd import numpy as np """ Explanation: Creating Data Frames documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html DataFrame is a 2-dimensional labeled data structure with columns of potentially different types. You can think of it like a spreadsheet or SQL table, o...
ioos/notebooks_demos
notebooks/2016-12-19-exploring_csw.ipynb
mit
from datetime import datetime # Region: Northwest coast. bbox = [-127, 43, -123.75, 48] min_lon, max_lon = -127, -123.75 min_lat, max_lat = 43, 48 bbox = [min_lon, min_lat, max_lon, max_lat] crs = "urn:ogc:def:crs:OGC:1.3:CRS84" # Temporal range of 1 week. start = datetime(2017, 4, 14, 0, 0, 0) stop = datetime(2017,...
brettavedisian/phys202-2015-work
days/day20/Cython.ipynb
mit
import numpy as np %load_ext Cython """ Explanation: Short Tour of Cython In general, Python is slower than other programming languages such as C, C++ and Java. Much of this comes from the fact that Python is dynamically typed. This means that when Python is compiling code to be run by the interpreter, it doesn't ma...
jcmgray/quijy
docs/tensor-basics.ipynb
mit
bra = qtn.Tensor(qu.rand_ket(4).reshape(2, 2), inds=('b0', 'b1'), tags={'BRA'}) TN = ket.H & X & Y & bra print(TN) TN.graph(color=['KET', 'PAULI', 'BRA'], figsize=(4, 4)) """ Explanation: And finally, a random 'bra' to complete the inner product: End of explanation """ TN.graph(color=['KET', 'X', 'BRA', 'Y'], figs...
idf/NumPy-Quicksheet
Vectorization.ipynb
bsd-3-clause
v = np.array([1, 2, 3]) np.repeat(v[:, np.newaxis], 3, 1) np.repeat(v[np.newaxis, :], 3, 0) """ Explanation: Vectorization - use a single matrix multiplication to avoid for-loop vector multiplicaions. Axis Repeat Repeat a vector to matrix End of explanation """ def my_func(a): """Average first and last eleme...
SciTools/cube_browser
doc/write_your_own/components/OptionsCascade.ipynb
bsd-3-clause
import ipywidgets import IPython.display import iris import numpy as np import iris.quickplot as iplt """ Explanation: Options List This example shows how to construct a set of widgets that can be used to select a series of plot customization options. End of explanation """ cube = iris.load_cube(iris.sample_data_pa...
zhuanxuhit/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
DFEC-R2D2/r2d2
docs/trades/motor_controller/motors.ipynb
mit
from __future__ import division from __future__ import print_function %matplotlib inline import matplotlib.pyplot as plt import numpy as np from math import sin, pi, tan """ Explanation: Motor Controller Sizing There are a lot of things that go into sizing a motor controller. This will look at the torque needed to cli...
mrphyja/bioinfo-intro-python
bioinformatics_intro_python.ipynb
mit
YouTubeVideo('fCd6B5HRaZ8', start=135) """ Explanation: The Source Code of Life: Using Python to Explore Our DNA Researchers just found the gene responsible for mistakenly thinking we've found the gene for specific things. It's the region between the start and the end of every chromosome, plus a few segments in our m...
csaladenes/aviation
code/airport_freq_parser.ipynb
mit
L=json.loads(file('../json/L.json','r').read()) M=json.loads(file('../json/M.json','r').read()) N=json.loads(file('../json/N.json','r').read()) import requests AP={} for c in M: if c not in AP:AP[c]={} for i in range(len(L[c])): AP[c][N[c][i]]=L[c][i] """ Explanation: Load airports of each country En...
cgpotts/cs224u
tutorial_pytorch_models.ipynb
apache-2.0
__author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2022" """ Explanation: Tutorial: Using and extending the course PyTorch models End of explanation """ %ls torch* """ Explanation: Contents Overview Set-up General optimization choices Classifiers Softmax classifier A deeper neural classifier ...
zchq88/DLminiProject
handwritten-digit-recognition/handwritten-digit-recognition-with-tflearn-exercise.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...
mne-tools/mne-tools.github.io
0.23/_downloads/4d3b714a9291625bb4b01d7f9c7c3a16/compute_source_psd_epochs.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, compute_source_psd_epochs print(__doc__) data_path = sample.data_path() fname_inv = data_path + '/MEG/sampl...
supergis/git_notebook
other/aiyagari_continuous_time.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy import sparse from scipy.sparse.linalg import spsolve """ Explanation: Aiyagari (1994) in Continuous Time By SeHyoun Ahn and Benjamin Moll The material in this notebook is based on Achdou et al. (2015) "Heterogeneous Agent Models in Conti...
astro4dev/OAD-Data-Science-Toolkit
Teaching Materials/Programming/Python/PythonISYA2018/04.Astropy/04_query.ipynb
gpl-3.0
# Required to see plots when running on mybinder import matplotlib matplotlib.use('Agg') import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Python standard-libraries to download data from the web from urllib.parse import urlencode from urllib.request import urlretrieve #Some astropy submodule...
phobson/statsmodels
examples/notebooks/statespace_dfm_coincident.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt np.set_printoptions(precision=4, suppress=True, linewidth=120) from pandas.io.data import DataReader # Get the datasets from FRED start = '1979-01-01' end = '2014-12-01' indprod = DataReader('IPMAN...
AWS-Spot-Analysis/spot-analysis
TSC_1.ipynb
apache-2.0
import pandas as pd import numpy as np import matplotlib.pylab as plt x=np.linspace(0,50,100) ts1=pd.Series(3.1*np.sin(x/1.5)+3.5) ts2=pd.Series(2.2*np.sin(x/3.5+2.4)+3.2) ts3=pd.Series(0.04*x+3.0) #ts1.plot() #ts2.plot() #ts3.plot() #plt.ylim(-2,10) #plt.legend(['ts1','ts2','ts3']) #plt.show() """ Explanation: Tim...
datactive/bigbang
examples/activity/Plot Activity.ipynb
mit
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.functions import * from bigbang.archive import Archive """ Explanation: This notebook shows how BigBang can help you explore a mailing list archiv...
OMS-NetZero/FAIR
notebooks/Example-Usage.ipynb
apache-2.0
%matplotlib inline import fair import numpy as np from matplotlib import pyplot as plt plt.style.use('seaborn-darkgrid') plt.rcParams['figure.figsize'] = (16, 9) """ Explanation: FaIR This notebook gives some simple examples of how to run and use the Finite Amplitude Impulse Response (FaIR) model. The Finite Amp...
YufeiZhang/Principles-of-Programming-Python-3
Lectures/Lecture_2/Jupyter_notebook_sheets/functions.ipynb
gpl-3.0
a = 0 m = 0 n = 0 x = 0 print('PRINT 0: a =', a, ' m =', m, ' n =', n, ' x =', x) def f_1(): m = 1 global n n = 1 x = 1 y = 1 z = 1 print('PRINT 1: a =', a, ' m =', m, ' n =', n, ' x =', x, ' y =', y, ' z =', z) def f_2(): gl...
Kaggle/learntools
notebooks/sql/raw/tut6.ipynb
apache-2.0
#$HIDE_INPUT$ from google.cloud import bigquery # Create a "Client" object client = bigquery.Client() # Construct a reference to the "github_repos" dataset dataset_ref = client.dataset("github_repos", project="bigquery-public-data") # API request - fetch the dataset dataset = client.get_dataset(dataset_ref) # Const...
Djabbz/PythonTuto
python_prebootcamp_tuto.ipynb
bsd-2-clause
# Here is a comment """ Explanation: Introduction This course is meant to provide a very gentle introduction to the python scientific ecosystem. We will try to cover as much as humanly possible within the timespan of 2 hours. It is essentially a warm-up before the upcoming machine learning bootcamps for those who woul...
gaufung/PythonStandardLibrary
DataStructures/collection/ChainMap.ipynb
mit
import collections a = {'a':'A', 'c':'C'} b = {'b':'B', 'd':'D'} m = collections.ChainMap(a, b) for k, v in m.items(): print('{}={}'.format(k, v)) """ Explanation: The ChainMap class manages a sequence of dictionaries, and searches through them in the order they are given to find values associated with keys. A Cha...
grokkaine/biopycourse
day3/DL1_FFN.ipynb
cc0-1.0
import tensorflow as tf from tensorflow.keras.datasets import mnist (train_images, train_labels), (test_images, test_labels) = mnist.load_data() print(train_images.shape) print(train_labels.shape) # reshape (flatten) and scale images train_images = train_images.reshape((60000, 28 * 28)) train_images = train_images.a...
EliseJ/astroABC
examples/supernovae.ipynb
mit
%matplotlib inline import matplotlib import matplotlib.pyplot as plt import seaborn as sns sns.set(color_codes=True) import numpy as np from scipy.stats import skewnorm import math import astroabc from distance_calc import DistanceCalc from bin_data import * """ Explanation: Supernova Example Introduction In this t...
luofan18/deep-learning
transfer-learning/Transfer_Learning_Solution.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
jskksj/cv2stuff
cv2stuff/.ipynb_checkpoints/pathlib-checkpoint.ipynb
isc
p = Path('.') [x for x in p.iterdir() if x.is_dir()] list(p.glob('**/*.py')) p = Path('/etc') p q = p / 'init.d' / 'reboot' q q.resolve() q.exists() q.is_dir() with q.open() as f: print(f.readline()) """ Explanation: Path is the basic operator for portability. End of explanation """ PurePosixPath('foo') ...
gilgeorges/antsearch
AntSearch for CHPswarm.ipynb
mit
a, b, P_el = sympy.symbols("a b P_el ") eta_el = a * sympy.log(P_el) + b t_op, E_th, eta_th = sympy.symbols("t_op E_th eta_th") P_th = P_el / eta_el * (1 - eta_el) * eta_th sols = sympy.solve(sympy.Eq(P_th, E_th/t_op), sympy.log(P_el)) assert len(sols) == 1 sols[0] """ Explanation: Ant Colony Optimization for Energy...
AnasFullStack/Awesome-Full-Stack-Web-Developer
algorithms/algorithms_in_python.ipynb
mit
class Stack(): def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def isEmpty(self): return self.items == [] ...
mne-tools/mne-tools.github.io
0.23/_downloads/d194fa1c3e67c7ada95e4807f9e5f3e5/50_artifact_correction_ssp.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt import mne from mne.preprocessing import (create_eog_epochs, create_ecg_epochs, compute_proj_ecg, compute_proj_eog) """ Explanation: Repairing artifacts with SSP This tutorial covers the basics of signal-space projection (SSP) ...
fw1121/Roary
contrib/roary_plots/roary_plots.ipynb
gpl-3.0
# Plotting imports %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') # Other imports import os import pandas as pd import numpy as np from Bio import Phylo """ Explanation: Roary pangenome plots <h6><a href="javascript:toggle()" target="_self">Toggle source code</a></h6...
DEIB-GECO/PyGMQL
examples/notebooks/01_A_simple_example.ipynb
apache-2.0
import gmql as gl """ Explanation: Simple example of local processing In this first tutorial we will show a complete example of usage of the library using some example datasets provided with it. Importing the library Importing the library End of explanation """ dataset1 = gl.get_example_dataset("Example_Dataset_1") ...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/feature_engineering/solutions/3_keras_basic_feat_eng.ipynb
apache-2.0
# Install Sklearn !python3 -m pip install --user sklearn # Ensure the right version of Tensorflow is installed. !pip3 freeze | grep 'tensorflow==2\|tensorflow-gpu==2' || \ !python3 -m pip install --user tensorflow==2 import os import tensorflow.keras import matplotlib.pyplot as plt import pandas as pd import tensorf...
jseabold/statsmodels
examples/notebooks/robust_models_0.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std """ Explanation: Robust Linear Models End of explanation """ data = sm.datasets.stackloss.load(as_pandas=False) data.exog = sm.add_constant(data.ex...
arnoldlu/lisa
ipynb/tutorial/07_PerfAnalysis.ipynb
apache-2.0
import logging from conf import LisaLogging LisaLogging.setup() # Execute this cell to report devlib debugging information logging.getLogger('ssh').setLevel(logging.DEBUG) # Generate plots inline %pylab inline import json import os """ Explanation: Tutorial Goal This tutorial aims to show how RTApp performance metr...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session07/Day1/MachLearnAstroData.ipynb
mit
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline """ Explanation: An Astronomical Application of Machine Learning: Separating Stars and Galaxies from SDSS Version 0.1 By AA Miller 2018 Nov 06 The problems in the following notebook develop an end-to-end ma...
rahulremanan/python_tutorial
Beginners/notebook/Objects_Classes_Constructors_and_Functions.ipynb
mit
a = int(input()) b = int(input()) print (a+b) """ Explanation: Object oriented programming in python: Author: Dr. Rahul Remanan CEO and Chief Imagination Officer Moad Computer Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Class...
tensorflow/docs-l10n
site/ko/guide/keras/masking_and_padding.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...
Dima806/udacity-mlnd-capstone
capstone-step1-sensitivity-check-run2.ipynb
apache-2.0
# Select test_size and random_state for splitting a subset test_size=0.1 random_state=1 import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cm import time import gzip import shutil import seaborn as sns from collections import Counter from sklearn.mixture ...
tensorflow/docs-l10n
site/ko/tutorials/text/text_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...
LucaCanali/Miscellaneous
Impala_SQL_Jupyter/Impala_SQL_Magic.ipynb
apache-2.0
%load_ext sql """ Explanation: Apache Impala and SQL magic for IPython/Jupyter notebooks 1. Load SQL magic extension (uses ipython-sql by Catherine Devlin) End of explanation """ %%sql impala://impalasrv-test:21050/test2 """ Explanation: 2. Connect to the target database (requires Cloudera impyla) End of explanatio...
Flaviolib/dx
02_dx_models.ipynb
agpl-3.0
from dx import * import seaborn as sns; sns.set() np.set_printoptions(precision=3) """ Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4"> Model Classes The model classes represent the fundamental building blocks to model a financial market. They are ...
Danghor/Algorithms
Python/Chapter-04/Merge-Sort.ipynb
gpl-2.0
def sort(L): n = len(L) if n < 2: return L L1, L2 = L[:n//2], L[n//2:] return merge(sort(L1), sort(L2)) """ Explanation: Merge Sort In order to sort a list $L$ using <em style="color:blue;">merge sort</em> we proceed as follows: If $L$ has less than two elements, then $L$ is already sorted. T...
ericmjl/scikit-learn-tutorial
04 Regression & Comparing Models.ipynb
mit
# Load the sequence data as a Pandas dataframe. seqids = [s.id for s in SeqIO.parse('data/hiv-protease-sequences-expanded.fasta', 'fasta')] sequences = [s for s in SeqIO.parse('data/hiv-protease-sequences-expanded.fasta', 'fasta')] sequences = MultipleSeqAlignment(sequences) sequences = pd.DataFrame(np.array(sequence...
shareactorIO/pipeline
oreilly.ml/high-performance-tensorflow/notebooks/05_Debug_Model.ipynb
apache-2.0
%%bash cat /root/src/main/python/debug/debug_model_cpu.py """ Explanation: Debug Models Using tfdbg Open a Terminal through Jupyter Notebook (Menu Bar -> Terminal -> New Terminal) Run the Next Cell to Display the Code Find the DebugWrapper around the tf.Session sess = tf.Session(config=config) sess = tf_debug.LocalC...
swirlingsand/deep-learning-foundations
gans/batch-norm/.ipynb_checkpoints/Batch_Normalization_Exercises-checkpoint.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
Hades1996/nummeth
finding roots/primerPunto.ipynb
mit
import math def funcion(x): return (math.pow(math.e,6*x))+(1.44*math.pow(math.e,2*x))-(2.079*math.pow(math.e,4*x))-(0.333) def biseccion(intA, intB, errorA, noMaxIter): if(funcion(intA)*funcion(intB)<0): noIter = 0 errorTmp = 1 intTmp = 0 oldInt = intA ...
banneker-aztlan/python-week-2
Part 1/Introductory Exercises (Part 1).ipynb
mit
# Ensures compatibility between Python 2 and 3. from __future__ import print_function, division from __builtin__ import range """ Explanation: Introductory Exercises These exercises are meant to supplement the lecture notes based on Jack VanderPlas's excellent book as well as material from http://introtopython.org. Yo...
afedynitch/MCEq
examples/Simple_zenith_averaged_neutrinos.ipynb
bsd-3-clause
#basic imports and ipython setup import matplotlib.pyplot as plt import numpy as np #import solver related modules from MCEq.core import MCEqRun #import primary model choices import crflux.models as pm mceq_run = MCEqRun( #provide the string of the interaction model interaction_model='SIBYLL2.3c', #primary cosmic ray...
voyageth/udacity-Deep_Learning_Foundations_Nanodegree
first-neural-network/dlnd-your-first-neural-network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
LDSSA/learning-units
units/16-tuning-hyper-parameters/examples/hyper_parameter_tuning_example.ipynb
mit
path_to_data = r'E:\Universidade\Projects\DSSA\learning-units\units\16-tuning-hyper-parameters\data\affairs.csv' data = pd.read_csv(path_to_data) data.head(10) """ Explanation: Import the data: During this example we will be using a dataset of politicians affairs. This dataset has a number of politicians, their attri...
evanmiltenburg/python-for-text-analysis
Chapters/Chapter 08 - Comparison of lists and sets.ipynb
apache-2.0
list1 = [1, 2, 1, 3, 4, 1] set1 = {1, 2, 3, 4} set2 = {1, 2, 1, 3, 4, 1} print('list1', list1) print('set1', set1) print('set2', set2) print('set1 is the same as set2:', set1 == set2) """ Explanation: Chapter 8 - Comparison of lists and sets You've been introduced to two containers in this topic: lists and sets. How...
arcyfelix/Courses
18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/Part 7 - Loading Image Data.ipynb
apache-2.0
%matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import torch from torchvision import datasets, transforms import helper """ Explanation: Loading Image Data So far we've been working with fairly artificial datasets that you wouldn't typically be using in real project...
goodwordalchemy/thinkstats_notes_and_exercises
code/chap04_Cdfs_notes.ipynb
gpl-3.0
def PercentileRank(scores, your_score): count = 0 for score in scores: if score <= youre_score: count += 1 percentile_rank = 100.0 * count / len(scores) return percentile_rank def Percentile(scores, percentile_rank): scores.sort() for score in scores: if PercentileRa...
theonaun/notebooks
presentations/python_data_tools/03_python.ipynb
mit
# Remember, lines starting with # comments and are not run. a = 5 '''Multiline comments done like this.''' if a > 1: print('Greater than 1.') else: print('Not greater than 1.') """ Explanation: <img style="margin-right: 0;" src="static/small.jpg"> <hr> <div style="display: table; width: 100%"> ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/production_ml/solutions/tfdv_advanced_taxi.ipynb
apache-2.0
!pip install pyarrow==5.0.0 !pip install numpy==1.19.2 !pip install tensorflow-data-validation """ Explanation: Advanced Visualizations with TensorFlow Data Validaiton Learning Objectives Install TFDV Compute and visualize statistics Infer a schema Check evaluation data for errors Check for evaluation anomalies and f...
JackDi/phys202-2015-work
assignments/assignment06/ProjectEuler17.ipynb
mit
number={} number[0]="zero" number[1]="one" number[2]="two" number[3]="three" number[4]='four' number[5]='five' number[6]='six' number[7]='seven' number[8]='eight' number[9]='nine' number[10]='ten' number[11]='eleven' number[12]='twelve' number[13]='thirteen' number[14]='fourteen' number[15]='fifteen' number[16]='teen' ...
tiegz/ThreatExchange
ipynb/Getting Started with Sharing.ipynb
bsd-3-clause
from pytx.access_token import access_token # Specify the location of your token via one of several ways: # https://pytx.readthedocs.org/en/latest/pytx.access_token.html access_token() """ Explanation: Getting Started with ThreatExchange Sharing Purpose The ThreatExchange APIs are designed to make the sharing of indic...
undercertainty/ou_nlp
06_decision_trees.ipynb
apache-2.0
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs np.random.seed(42) # To plot pretty figures %matplotlib inline import matplotlib import matplotlib.pyplot as plt ...
oscarvarto/oscarvarto.github.io
content/immutability-principles.ipynb
apache-2.0
x = [1, 2, 3] x.reverse() x """ Explanation: title: Immutability Principles author: Oscar Vargas Torres date: 2018-09-12 category: Functional Programming tags: Immutability Mutability is hard to reason about A lot of programming languages support mutability. For example, some objects in Python are mutable: End of ex...
SKA-ScienceDataProcessor/algorithm-reference-library
workflows/notebooks/mpc_simulation.ipynb
apache-2.0
%matplotlib inline from data_models.parameters import arl_path results_dir = arl_path('test_results') import numpy from astropy.coordinates import SkyCoord from astropy import units as u from astropy.wcs.utils import pixel_to_skycoord from matplotlib import pyplot as plt from data_models.memory_data_models import...
mattweirick/mattweirick.github.io
markdown_generator/.ipynb_checkpoints/talks-checkpoint.ipynb
mit
import pandas as pd import os """ Explanation: Talks markdown generator for academicpages Takes a TSV of talks with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in talks.py. Run either from the markdown_gener...
Raag079/self-driving-car
Term01-Computer-Vision-and-Deep-Learning/Labs/04-Keras/traffic-sign-classification-with-keras.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile from tqdm import tqdm class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_size=None): self.total = total_size self.update((block_num - self.last_block) * block_size) self.last_block = b...
pastas/pasta
examples/notebooks/17_changing_responses.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt import pastas as ps ps.set_log_level("ERROR") ps.show_versions(numba=True) """ Explanation: Changing response functions R.A. Collenteur, University of Graz, 2021 In this notebook the new ChangeModel is tested, based on the work by Obergfjell et al...
tpin3694/tpin3694.github.io
python/matplotlib_simple_scatterplot.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np # Set ipython's max row display pd.set_option('display.max_row', 1000) # Set iPython's max column width to 50 pd.set_option('display.max_columns', 50) """ Explanation: Title: Scatterplot In MatPlotLib Slug: matplotlib_simple_sc...
tpin3694/tpin3694.github.io
sql/select_rows_based_on_conditionals.ipynb
mit
# Ignore %load_ext sql %sql sqlite:// %config SqlMagic.feedback = False """ Explanation: Title: Selecting Rows Based On Conditionals Slug: select_rows_based_on_conditionals Summary: Selecting Rows Based On Conditionals in SQL. Date: 2017-01-16 12:00 Category: SQL Tags: Basics Authors: Chris Albon Note: This ...
jsub10/MLCourse
Notebooks/Regression-with-a-Single-Feature.ipynb
mit
# Share functions used in multiple notebooks %run Shared-Functions.ipynb """ Explanation: Regression With a Single Feature Using a single feature to make a numerical prediction TO DO - nothing for the moment End of explanation """ # Load up the packages to investigate the data import numpy as np import pandas as pd ...
monicathieu/cu-psych-r-tutorial
public/tutorials/python/4_plotting/challenge_key.ipynb
mit
# load packages we will be using for this challenge import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') sns.set(rc={'figure.figsize':(12,8)}) """ Explanation: Python Plotting Challenge Goals of this Challenge Students will test their ability to:...
xaibeing/cn-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: 你的第一个神经网络 在此项目中,你将构建你的第一个神经网络,并用该网络预测每日自行车租客人数。我们提供了一些代码,但是需要你来实现神经网络(大部分内容)。提交此项目后,欢迎进一步探索该数据和模型。 End of explanation """ data_path = 'Bike-Sharing-Dataset/hour.c...