repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
google/timesketch
notebooks/Stolen_Szechuan_Sauce_Data_Upload.ipynb
apache-2.0
# @title Import libraries # @markdown This cell loads libraries that we will use througout the notebook. import io import os import codecs import altair as alt import numpy as np import pandas as pd from timesketch_api_client import config from timesketch_import_client import helper from timesketch_import_client impo...
mne-tools/mne-tools.github.io
0.23/_downloads/c822037c0666a082e89228795c70bde1/10_background_stats.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # License: BSD (3-clause) from functools import partial import numpy as np from scipy import stats import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # noqa, analysis:ignore import mne from mne.stats import (ttest_1samp_no_p, bonferroni_correctio...
ES-DOC/esdoc-jupyterhub
notebooks/messy-consortium/cmip6/models/emac-2-53-vol/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'messy-consortium', 'emac-2-53-vol', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MESSY-CONSORTIUM Source ID: EMAC-2-53-VOL Topic: Land Sub-Topics: Soil...
RittmanResearch/maybrain
docs/04 - More About the Brain Class.ipynb
apache-2.0
from maybrain import constants as ct from maybrain import resources as rr from maybrain import brain as mbt a = mbt.Brain() a.import_adj_file(rr.DUMMY_ADJ_FILE_500) a.import_spatial_info(rr.MNI_SPACE_COORDINATES_500) a.apply_threshold() """ Explanation: More About the Brain Class Besides the basic functionalities alre...
opengridcc/opengrid
notebooks/Compute degree-days.ipynb
apache-2.0
import opengrid as og import pandas as pd plt = og.plot_style() """ Explanation: Compute degree-days for heating and cooling This notebook shows how to compute degree-days for heating and/or cooling from the ambient temperature. We compute degree-days with different base temperatures. This is a very useful input fo...
anugrah-saxena/pycroscopy
jupyter_notebooks/Loading_Visualization_Format.ipynb
mit
# Make sure pycroscopy and wget are installed !pip install pycroscopy !pip install -U wget # Ensure python 3 compatibility from __future__ import division, print_function, absolute_import # Import necessary libraries: import h5py import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches ...
marius311/cosmoslik
cosmoslik_plugins/models/cosmo_derived/cosmo_derived.ipynb
gpl-3.0
from cosmoslik import * cosmo_derived = get_plugin('models.cosmo_derived')() """ Explanation: cosmo_derived This plugin calculates the following "derived" cosmological quantities: * $H(z)$ * $D_A(z)$ * $r_s(z)$ * $\theta_s(z)$ * $z_{\rm drag}$ (Hu & Sugiyama fitting formula) It can also be used as a $\theta$ to $H_0$...
wuafeing/Python3-Tutorial
02 strings and text/02.05 search and replace text.ipynb
gpl-3.0
text = 'yeah, but no, but yeah, but no, but yeah' text.replace("yeah", "yep") """ Explanation: Previous 2.5 字符串搜索和替换 问题 你想在字符串中搜索和匹配指定的文本模式 解决方案 对于简单的字面模式,直接使用 str.repalce() 方法即可,比如: End of explanation """ text = 'Today is 11/27/2012. PyCon starts 3/13/2013.' import re re.sub(r"(\d+)/(\d+)/(\d+)", r"\3-\1-\2", text)...
palandatarxcom/sklearn_tutorial_cn
notebooks/04.1-Dimensionality-PCA.ipynb
bsd-3-clause
from __future__ import print_function, division %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy import stats # 使用默认的seaborn设置 import seaborn as sns; sns.set() """ Explanation: 这个分析笔记由Jake Vanderplas编辑汇总。 源代码和license文件在GitHub。 中文翻译由派兰数据在派兰大数据分析平台上完成。 源代码在GitHub上。 降维:深入探索主成分分析 在本节中我们会探...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a/td2a_correction_session_2C.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.soft - IPython et commandes magiques - correction Aperçu des commandes magiques pour automatiser un peu plus les tâches courantes. End of explanation """ from IPython.core.magic imp...
indiependente/Social-Networks-Structure
results/Generalized Watts-Strogatz Results Analysis.ipynb
mit
#!/usr/bin/python %matplotlib inline import numpy as np import matplotlib.pyplot as plt from stats import parse_results, get_percentage, get_avg_per_seed, draw_pie, draw_bars, draw_bars_comparison, draw_avgs """ Explanation: Generalized Watts-Strogatz Graph Experiments Output Visualization End of explanation """ pr,...
atlury/deep-opencl
DL0110EN/1.3derivativesandGraphsinPytorch_v2.ipynb
lgpl-3.0
# These are the libraries will be useing for this lab. import torch import matplotlib.pylab as plt import torch.functional as F """ Explanation: <a href="http://cocl.us/NotebooksPython101"> <img src="https://ibm.box.com/shared/static/yfe6h4az47ktg2mm9h05wby2n7e8kei3.png" width="750" alt="IBM 10TB Storage" /> </a...
openfisca/openfisca-web-notebook
2016-04-01-hackathon-CodeImpot/reforme_revenu_de_base_nouvelles_simulations_rdb_adultes.ipynb
agpl-3.0
TaxBenefitSystem = init_country() tax_benefit_system = TaxBenefitSystem() from openfisca_core import reforms ReformeRevenuDeBase = reforms.make_reform( key = 'reforme_rdb', name = u"Réforme Revenu de base", reference = tax_benefit_system, ) """ Explanation: Système socio-fiscal End of explanation """...
CalPolyPat/phys202-2015-work
assignments/midterm/AlgorithmsEx03.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact """ Explanation: Algorithms Exercise 3 Imports End of explanation """ def char_probs(s): """Find the probabilities of the unique characters in the string s. Parameters ---------- ...
campagnucci/api_sof
SOF_Execucao_Orcamentaria_PMSP.ipynb
gpl-3.0
import pandas as pd import requests import json import numpy as np TOKEN = '198f959a5f39a1c441c7c863423264' base_url = "https://gatewayapi.prodam.sp.gov.br:443/financas/orcamento/sof/v2.1.0" headers={'Authorization' : str('Bearer ' + TOKEN)} """ Explanation: Explorando as despesas da cidade de São Paulo Um tutorial d...
Unidata/unidata-python-workshop
notebooks/Pythonic_Data_Analysis/Pythonic Data Analysis.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter, DayLocator from siphon.simplewebservice.ndbc import NDBC %matplotlib inline # Read in some data df = NDBC.realtime_observations('42039') # Trim to the last 7 days df = df[df['time'] > (pd.Timestamp.utcnow() - pd.Timedelta...
anisfeld/MachineLearning
Pipeline construction 1.ipynb
mit
import pandas as pd import numpy as np import pylab as pl import seaborn as sns from sklearn import svm, datasets from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import pipeline.util as u import pipeline.process as pr import pipeline.read as r import pipeline.explore...
juditacs/morph-segmentation-experiments
notebooks/sandbox/seq2seq_attention.ipynb
mit
PROJECT_DIR = "../../" use_toy_data = False LOG_DIR = 'logs' # Tensorboard log directory if use_toy_data: batch_size = 8 embedding_dim = 5 cell_size = 32 max_len = 6 else: batch_size = 64 embedding_dim = 20 cell_size = 128 max_len = 33 use_attention = True use_bidirectional_encode...
josh-gree/maths-with-python
07-sympy.ipynb
mit
import sympy sympy.init_printing() """ Explanation: In standard mathematics we routinely write down abstract variables or concepts and manipulate them without ever assigning specific values to them. An example would be the quadratic equation \begin{equation} a x^2 + b x + c = 0 \end{equation} and its roots $x_{\pm}$...
natashabatalha/PandExo
notebooks/HST_WFC3_w_ExoMAST.ipynb
gpl-3.0
import sys sys.path.append('..') import pandexo.engine.justdoit as jdi """ Explanation: HST's Tranisting Exoplanet Noise Simulator This file demonstrates how to predict the: 1. Transmission/emission spectrum S/N ratio 2. Observation start window for any system observed with WFC3/IR. Background information Pand...
theonaun/notebooks
presentations/python_data_tools/07_pandas.ipynb
mit
# Import pandas under the name pd import pandas as pd import numpy as np import matplotlib %matplotlib inline matplotlib.style.use('fivethirtyeight') # Create a dataframe from a CSV file df = pd.read_csv('data/cfpb_complaints_with_fictitious_data.csv') # Any dataframe at end of cell gets HTML representation # Head l...
AllenDowney/ModSim
soln/chap03.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
dynaryu/rmtk
rmtk/plotting/hazard_outputs/plot_hazard_curves.ipynb
agpl-3.0
%matplotlib inline import matplotlib.pyplot as plt from plot_hazard_outputs import HazardCurve, UniformHazardSpectra hazard_curve_file = "../sample_outputs/hazard/hazard_curve.xml" hazard_curves = HazardCurve(hazard_curve_file) """ Explanation: Hazard Curves and Uniform Hazard Spectra This IPython notebook allows the...
darkomen/TFG
medidas/20072015/.ipynb_checkpoints/Conclusiones-checkpoint.ipynb
cc0-1.0
%pylab inline #Importamos las librerías utilizadas import numpy as np import pandas as pd import seaborn as sns #Mostramos las versiones usadas de cada librerías print ("Numpy v{}".format(np.__version__)) print ("Pandas v{}".format(pd.__version__)) print ("Seaborn v{}".format(sns.__version__)) #Abrimos los ficheros c...
spulido99/Programacion
Alex/Taller 3 y 4.ipynb
mit
from sklearn import datasets import pandas as pd from sklearn.datasets import load_digits digits = load_digits() #dataset de clasificacion brio= pd.read_csv('C:/Users/Alex/Documents/eafit/semestres/X semestre/programacion/briofitos.csv') #dataset regresion #digits.DESCR digits.target """ Explanation: Taller 3 Regr...
TomTranter/OpenPNM
examples/paper_recreations/Wu et al. (2010)/Wu et al. (2010) - Part C.ipynb
mit
import scipy as sp import numpy as np import openpnm as op import matplotlib.pyplot as plt import openpnm.models.geometry as gm import openpnm.topotools as tt %matplotlib inline np.random.seed(10) """ Explanation: Example: Regenerating Data from R. Wu et al. / Elec Acta 54 25 (2010) 7394–7403 Import the modules End of...
folivetti/CRUFABC
ExercicioRec.ipynb
mit
G2 = nx.barabasi_albert_graph(6,3) nx.draw_shell(G2) pos = nx.shell_layout(G2) labels = dict( enumerate(G2.nodes()) ) nx.draw_networkx_labels(G2,pos,labels,font_size=16); print "Dist. media: ", nx.average_shortest_path_length(G2) print "Diametro: ", nx.diameter(G2) print "Coef. Agrupamento médio: ", nx.average_cluster...
bgroveben/python3_machine_learning_projects
oreilly_GANs_for_beginners/oreilly_GANs_for_beginners/introduction_to_ml_with_python/1_Introduction.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd import mglearn from IPython.display import display %matplotlib inline """ Explanation: Chapter 1: Introduction End of explanation """ import numpy as np x = np.array([[1,2,3],[4,5,6]]) print("x:\n{}".format(x)) """ Explanation: Essential Librar...
matthewljones/computingincontext
CiC_lecture_04_text_mining_topics.ipynb
gpl-2.0
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt pd.set_option('display.mpl_style', 'default') # Make the graphs a bit prettier plt.rcParams['figure.figsize'] = (15, 5) """ Explanation: Computing In Context Social Sciences Track Lecture 4--topics, trends, and dimensional scaling Matthew L. Jones...
rvuduc/cse6040-ipynbs
10b--csv-to-db.ipynb
bsd-3-clause
from sqlalchemy import create_engine # database connection import datetime as dt # for timing import pandas as pd # for data frames """ Explanation: CSE 6040, Fall 2015 [10-B]: CSV to DB This notebook is optional and was not covered in class. It shows how we converted the raw comma-separated values (CSV) file correspo...
wem3/gems_vs_bomb
rez/all_bandits_best_model.ipynb
mit
# imports / display plots in cell output %matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.stats as ss import pandas as pd import seaborn as sns import statsmodels """ Explanation: Reinforcement Learning Models of Social Group Preferences Bandit Experiments 1-7 End of explanation """ ...
gldmt-duke/CokerAmitaiSGHMC
logistic_regression/logistic_regression_compare_sghmc.ipynb
mit
# Load data X = np.concatenate((np.ones((pima.shape[0],1)),pima[:,0:8]), axis=1) Y = pima[:,8] Xs = (X - np.mean(X, axis=0))/np.concatenate((np.ones(1),np.std(X[:,1:], axis=0))) n, p = X.shape M = np.identity(p) ### HMC version def logistic(x): return 1/(1+np.exp(-x)) def U(theta, Y, X): return - (Y.T @ X @...
anthonyng2/FX-Trading-with-Python-and-Oanda
Oanda v1 REST-oandapy/02.00 Rates Information.ipynb
mit
import pandas as pd import oandapy import configparser config = configparser.ConfigParser() config.read('../config/config_v1.ini') account_id = config['oanda']['account_id'] api_key = config['oanda']['api_key'] """ Explanation: <!--NAVIGATION--> < Algorithmic Trading Architecture | Contents | Account Information > Ra...
AaronRanAn/Pyton-for-Data-Analytics
4 - pandas Basics/4-4 pandas DataFrame Basics.ipynb
apache-2.0
import string upcase = [x for x in string.ascii_uppercase] lcase = [x for x in string.ascii_lowercase] print(upcase[:5], lcase[:5]) """ Explanation: Now fundamentally the data frame is just an abstraction but it provides a ton of useful tools that you’re going to get to see. This video is just going to go over the ba...
mssalvador/Fifa2018
Teknisk Tirsdag Tutorial (Un-Supervised).ipynb
apache-2.0
#PURE PYTHON!!!! import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sb from sklearn import cluster """ Explanation: Teknisk Tirsdag: Unsupervised Learning Tillykke du er i anden uge af din ansættelse i den norske virksomhed, som operere med data science. Din leder var meget tilfre...
msultan/msmbuilder
examples/Fs-Peptide-with-Pipeline.ipynb
lgpl-2.1
# Download example dataset from msmbuilder.example_datasets import FsPeptide fs_peptide = FsPeptide() xyz = fs_peptide.get().trajectories print(fs_peptide.description()) """ Explanation: Modeling dynamics of FS Peptide This example shows how to use sklearn's Pipeline object to rapidly construct MSMs MSMBuilder include...
spencer2211/deep-learning
dcgan-svhn/DCGAN_Exercises.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
mavillan/SciProg
03_memmap/03_memmap.ipynb
gpl-3.0
%matplotlib inline %load_ext memory_profiler import numpy as np import matplotlib.pyplot as plt import scipy as sp import scipy.sparse import sys import h5py def get_size(obj, seen=None): """ Recursively finds size of objects ref: https://goshippo.com/blog/measure-real-size-any-python-object/ """ ...
QuantScientist/Deep-Learning-Boot-Camp
day03/additional materials/5.1 Custom Layer.ipynb
mit
from keras.models import Sequential from keras.layers import Dense, Dropout, Layer, Activation from keras.datasets import mnist from keras import backend as K from keras.utils import np_utils """ Explanation: Custom Keras Layer Idea: We build a custom activation layer called Antirectifier, which modifies the shape of ...
albahnsen/PracticalMachineLearningClass
notebooks/20-DeepLearning_keras.ipynb
mit
from sklearn.datasets import load_boston boston_dataset = load_boston() print(boston_dataset.DESCR) """ Explanation: 20 - Deep Learning using keras by Alejandro Correa Bahnsen and Jesus Solano version 1.4, May 2019 Part of the class Practical Machine Learning This notebook is licensed under a Creative Commons Attribut...
angelmtenor/data-science-keras
student_admissions.ipynb
mit
%matplotlib inline import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import keras import helper helper.reproducible(seed=0) sns.set() """ Explanation: Student Admissions Predicting student admissions to graduate school at UCLA based on GRE Scores, GPA Scores, and ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/contrasts.ipynb
bsd-3-clause
import numpy as np import statsmodels.api as sm """ Explanation: Contrasts Overview End of explanation """ import pandas as pd url = "https://stats.idre.ucla.edu/stat/data/hsb2.csv" hsb2 = pd.read_table(url, delimiter=",") hsb2.head(10) """ Explanation: This document is based heavily on this excellent resource fr...
5agado/data-science-learning
deep learning/GANs - Intro.ipynb
apache-2.0
import time from PIL import Image import numpy as np import pdb import os import sys import seaborn as sns import matplotlib import matplotlib.pyplot as plt from matplotlib import animation from keras.models import Sequential from keras.layers.core import Reshape, Dense, Dropout, Activation, Flatten from keras.layers...
poppy-project/community-notebooks
tutorials-education/poppy-torso__vrep_Prototype d'ininitiation à l'informatique pour les lycéens/decouverte/Decouverte TP2.ipynb
lgpl-3.0
import time from poppy.creatures import PoppyTorso poppy = PoppyTorso(simulator='vrep') """ Explanation: Decouverte – Niveau 1 - Python TP2 Pour commencer votre programme python devra contenir les lignes de code ci-dessous et le logiciel V-REP devra être lancé. Dans V-REP (en haut à gauche) utilise les deux icones fl...
tanghaibao/goatools
notebooks/dcnt_and_tinfo.ipynb
bsd-2-clause
from goatools.base import get_godag godag = get_godag("go-basic.obo") """ Explanation: How to get Descendants Count and Information Content Download Ontologies, if necessary Choose a set of GO IDs to print GoSubDag contains descendants count Print the descendants count (dcnt) Compare information content (tinfo) for ...
Kaggle/learntools
notebooks/pandas/raw/ex_0.ipynb
apache-2.0
import pandas as pd pd.set_option('max_rows', 5) from learntools.core import binder; binder.bind(globals()) from learntools.pandas.creating_reading_and_writing import * print("Setup complete.") """ Explanation: Introduction The first step in most data analytics projects is reading the data file. In this exercise, you'...
mne-tools/mne-tools.github.io
0.21/_downloads/f760cc2f1a5d6c625b1e14a0b05176dd/plot_ecog.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Chris Holdgraf <choldgraf@gmail.com> # Adam Li <adam2392@gmail.com> # # License: BSD (3-clause) import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import mne from mne.viz import plot_align...
raoyvn/deep-learning
intro-to-rnns/Anna_KaRNNa.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
I2MAX-LearningProject/Flask-server
Tests/Prophet_trial2_8_16-Copy1.ipynb
mit
rawArrayDatas=[["2017-08-11", "2017-08-12", "2017-08-13", "2017-08-14", "2017-08-15","2017-08-16"], [20.0, 30.0, 40.0, 50.0, 60.0,20.0]] processId=12 forecastDay=4 """ Explanation: 실제함수 input End of explanation """ mockForecast={} rmse={} forecast=[] realForecast={} trainSize=int(len(rawArrayDatas[0]...
texib/deeplearning_homework
LogisticRegression.ipynb
mit
import numpy as np import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("./pokemon.csv") alldata = df[ (df['attack_strong_type'] == 'Normal') |(df['attack_strong_type'] == 'Flying') ] # alldata = alldata[df['attack_strong_type'] == 'Flying'] f1 = alldata['height'].tolist() f2 = ...
mne-tools/mne-tools.github.io
stable/_downloads/f31e73ee907864d95a2b617fdc76b71e/source_label_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, source_induced_power print(__doc__) """ Explanation: Compute powe...
xpharry/Udacity-DLFoudation
tutorials/sentiment_network/Sentiment Classification - Mini Project 5.ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
michael-isaev/cse6040_qna
PythonQnA_3_funcs_returns.ipynb
apache-2.0
def function_of_no_return(a): print ("Parameter passed to the function is {0}".format(a)) x = function_of_no_return(42) print ('Function returns', x) """ Explanation: 3. Point of No Return What a function returns and what it does not can cause a lot of confusion, especially if the function causes some side ef...
GoogleCloudPlatform/asl-ml-immersion
notebooks/ml_fairness_explainability/inclusive_ml/labs/1_inclusive_ml.ipynb
apache-2.0
!pip freeze | grep httplib2==0.18.1 || pip install httplib2==0.18.1 import os import warnings warnings.filterwarnings("ignore") import numpy as np import pandas as pd import witwidget from witwidget.notebook.visualization import WitConfigBuilder, WitWidget pd.options.display.max_columns = 50 PROJECT = !(gcloud conf...
google/trax
trax/examples/NMT_with_Transformers_Reformers_using_Trax.ipynb
apache-2.0
#@title # Copyright 2021 Google LLC. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing...
fionapigott/Data-Science-45min-Intros
python-interfaces/python-interfaces.ipynb
unlicense
# imports import math,decimal,random """ Explanation: Interfaces in Python References This tutorial is primarily inspired by chapters 9,11,12 in Luciano Ramalho's book "Fluent Python". End of explanation """ class Animal: """ the Animal class can be used to describe something that has a well-defined number ...
aflaxman/siaman16-va-minitutorial
1-tutorial-notebooks/4-va_csmf.ipynb
gpl-3.0
import numpy as np, pandas as pd """ Explanation: We won't work through this notebook We won't have time. But I thought I'd include it, in case you want to see exactly how I implement my population-level quality metric. End of explanation """ def measure_prediction_quality(csmf_pred, y_test): """Calculate popul...
gaargly/gaargly.github.io
2021_06_18_Lira_Samanta_Assignment1_Dr_Kasaran_class.ipynb
mit
import numpy as np # List to Array list1 = [1, 2, 3, 4, 5, 6, 7, 8] np.array(list1) # Tuple to Array tuple1 = (1, 2, 3, 4, 5, 6, 7, 8) np.array(tuple1) """ Explanation: <a href="https://colab.research.google.com/github/gaargly/gaargly.github.io/blob/master/2021_06_18_Lira_Samanta_Assignment1_Dr_Kasaran_class.ipynb" ...
christophebertrand/ada-epfl
HW04-Applied ML/HW04-1-Preprocessing.ipynb
mit
print('Number of diad: ', len(data)) print('Number of players: ', len(data.playerShort.unique())) print('Number of referees: ', len(data.refNum.unique())) """ Explanation: 1. Observation and clean of the data End of explanation """ complete = len(data.dropna()) all_ = len(data_total) print('Number of row with comple...
ContextLab/hypertools
docs/tutorials/reduce.ipynb
mit
import hypertools as hyp %matplotlib inline """ Explanation: Dimensionality reduction The reduce function reduces the dimensionality of an array or list of arrays. The default is to use Principal Component Analysis to reduce to three dimensions, but a variety of models are supported and users may specify a desired nu...
balarsen/pymc_learning
Bernoulli/Bernoulli hierarchical.ipynb
bsd-3-clause
observations = np.array([20, 6, 6, 6, 6, 6]) with pm.Model(): probs = pm.Dirichlet('probs', a=np.ones(6)) # flat prior rolls = pm.Multinomial('rolls', n=50, p=probs, observed=observations) trace = pm.sample(5000) pm.plot_posterior(trace); pm.traceplot(trace) """ Explanation: Coin flip learn things along...
flohorovicic/pynoddy
docs/notebooks/.ipynb_checkpoints/Gippsland-drillhole-uncertainty-checkpoint.ipynb
gpl-2.0
from IPython.core.display import HTML css_file = 'pynoddy.css' HTML(open(css_file, "r").read()) %matplotlib inline # here the usual imports. If any of the imports fails, make sure that pynoddy is installed # properly, ideally with 'python setup.py develop' or 'python setup.py install' import sys, os import matplotlib...
stijnvanhoey/phd_ipynb_respiro_showcases
bayesian_story/pyIDEAS_bayes.ipynb
bsd-2-clause
# https://github.com/dfm/corner.py import corner import hydropy as hp mpl.rcParams['font.size'] = 16 mpl.rcParams['axes.labelsize'] = 18 mpl.rcParams['xtick.labelsize'] = 16 mpl.rcParams['ytick.labelsize'] = 16 import pylab as p p.rc('mathtext', default='it') """ Explanation: Depenencies for using pyIDEAS/Biointen...
Code-Girls/2016Summer
Day6/code/notebook_debugging.ipynb
mit
# for inline plotting in the notebook %matplotlib inline import numpy as np import matplotlib.pyplot as plt def plot_log(): figure, axis = plt.subplots(2, 1) x = np.linspace(1, 2, 10) axis.plot(x, np.log(x)) plt.show() plot_log() # Call the function, generate plot """ Explanation: A significant po...
OSGeoLabBp/tutorials
english/python/regexp_in_python.ipynb
cc0-1.0
import re """ Explanation: <a href="https://colab.research.google.com/github/OSGeoLabBp/tutorials/blob/master/english/python/regexp_in_python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Regular expressions in Python Regular expression (regexp) i...
hich28/mytesttxx
tests/python/piperead.ipynb
gpl-3.0
for a in spot.automata('ltl2tgba -s "a U b"; ltl2tgba --lbtt "b"|', 'ltl2tgba -H "GFa" "a & GFb"|'): display(a) """ Explanation: Reading automata output from processes If an argument of spot.automata ends with |, then it is interpreted as a shell command that outputs one automaton or more. End of explanation """ ...
jmschrei/pomegranate
tutorials/B_Model_Tutorial_4b_Bayesian_Network_Structure_Learning.ipynb
mit
%pylab inline %load_ext memory_profiler from pomegranate import BayesianNetwork import seaborn, time seaborn.set_style('whitegrid') X = numpy.random.randint(2, size=(2000, 7)) X[:,3] = X[:,1] X[:,6] = X[:,1] X[:,0] = X[:,2] X[:,4] = X[:,5] model = BayesianNetwork.from_samples(X, algorithm='exact') print(model.struc...
tensorflow/docs
site/en/tutorials/quickstart/advanced.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...
Neuroglycerin/hail-seizure
ipynotebooks/Compare regularisation runs.ipynb
apache-2.0
df1 = pd.read_csv(csvfnm, sep='\t', header=0) # Drop any duplicated rows from repeated runs of the same thing #df = df.drop_duplicates(inplace=True) df1 """ Explanation: Load the CSV with Pandas End of explanation """ # We need to parse the RUN_NAME column to extract the features which couldn't go into the CSV file ...
ruleva1983/udacity-selfdrivingcar
term1/P2_traffic_signs/Traffic_Sign_Classifier.ipynb
gpl-3.0
# Load pickled data import pickle import numpy as np import seaborn as sns training_file = "data/train.p" validation_file = "data/valid.p" testing_file = "data/test.p" with open(training_file, mode='rb') as f: train = pickle.load(f) with open(validation_file, mode='rb') as f: valid = pickle.load(f) with open...
atavory/ibex
examples/iris_feature_transform.ipynb
bsd-3-clause
import pandas as pd import numpy as np from ibex.sklearn import datasets from ibex.sklearn.decomposition import PCA as PdPCA from ibe...
ajdawson/python_for_climate_scientists
course_content/notebooks/python_introduction.ipynb
gpl-3.0
import this """ Explanation: Python 101 This introduction is based heavily on the introduction notes found here: https://github.com/scipy-lectures/scipy-lecture-notes The (climate) scientists needs To get, potentially very large, datasets from simulation, observation, or experiment To manipulate and process it To vis...
AtmaMani/pyChakras
udemy_ml_bootcamp/Big-Data-and-Spark/Introduction to Spark and Python.ipynb
mit
from pyspark import SparkContext """ Explanation: Introduction to Spark and Python Let's learn how to use Spark with Python by using the pyspark library! Make sure to view the video lecture explaining Spark and RDDs before continuing on with this code. This notebook will serve as reference code for the Big Data sectio...
osamoylenko/YSDA_deeplearning17
Seminar3/HW3_Modules.ipynb
mit
class Module(object): def __init__ (self): self.output = None self.gradInput = None self.training = True """ Basically, you can think of a module as of a something (black box) which can process `input` data and produce `ouput` data. This is like applying a function which is ...
armgilles/presentation
EPSI/I4/Datamining/c1/notebook/Pokemon.ipynb
mit
pokemon = data[data.Generation == 1].copy() Image(url="http://i.giphy.com/yidUzHnBk32Um9aMMw.gif") pokemon """ Explanation: On souhaite regarder uniquement les pokémons de 1ère génération. Il va donc falloir filtrer nos données On va donc crée une nouvelle variable qui aura uniquement les pokémons de "Generation" = ...
ktsaou/netdata
ml/notebooks/netdata_anomaly_detection_deepdive.ipynb
gpl-3.0
# uncomment the line below (when running in google colab) to install the netdata-pandas library, comment it again when done. #!pip install netdata-pandas from datetime import datetime, timedelta import itertools import random import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ...
ThyrixYang/LearningNotes
MOOC/stanford_cnn_cs231n/assignment1/knn.ipynb
gpl-3.0
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt from __future__ import print_function # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inlin...
ellisonbg/ipyleaflet
examples/Numpy.ipynb
mit
import requests import os from tqdm import tqdm import zipfile import rasterio from affine import Affine import numpy as np import scipy.ndimage from rasterio.warp import reproject, Resampling import PIL import matplotlib.pyplot as plt from base64 import b64encode try: from StringIO import StringIO py3 = False ...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_rereference_eeg.ipynb
bsd-3-clause
# Authors: Marijn van Vliet <w.m.vanvliet@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample from matplotlib import pyplot as plt print(__doc__) # Setup for reading the raw data data_path = sample.data_path() raw_f...
bmbutle2/ethereum_blockchain
notebooks/random_forest.ipynb
gpl-3.0
train = pd.read_csv('./../data/training.csv') label = pd.read_csv('./../data/labels.csv', header=None) train.drop('Unnamed: 0', axis=1, inplace=True) # label encode type le = LabelEncoder() train['type_enc'] = le.fit_transform(train['type']) label.columns = ['0', 'p_label2'] label.drop('0', axis=1, inplace=True) y_lab...
tkurfurst/deep-learning
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
akshaybabloo/Car-ND
Term_1/TrafficSignalClassifier_6/TrafficSignalClassifier_Project.ipynb
mit
# Load pickled data import pickle # TODO: Fill this in based on where you saved the training and testing data training_file = 'train.p' validation_file= 'valid.p' testing_file = 'test.p' with open(training_file, mode='rb') as f: train = pickle.load(f) with open(validation_file, mode='rb') as f: valid = pickl...
DavidLeoni/relmath
relmath-debug.ipynb
apache-2.0
get_ipython().display_formatter.formatters import math def normalize(m): for row in m.g: norm = math.sqrt(sum((x**2 for x in row))) for i in range(len(row)): row[i] = row[i] / norm getattr("ciao", "upper")() """ Explanation: Relmath debug Notebook for debugging stuff - to see some ...
jgarciab/wwd2017
class2/class2a_programming_after_class.ipynb
gpl-3.0
##Some code to run at the beginning of the file, to be able to show images in the notebook ##Don't worry about this cell #Print the plots in this screen %matplotlib inline #Be able to plot images saved in the hard drive from IPython.display import Image #Make the notebook wider from IPython.core.display import dis...
CUBoulder-ASTR2600/lectures
lecture_05_summer_sublists_functions.ipynb
isc
for fIndex, y in enumerate(range(2, 5)): countdown = y yFactorial = 1 wIndex = 0 while countdown > 1: yFactorial *= countdown ##### CHECKPOINT! ##### countdown -= 1 wIndex += 1 print("RESULT: %d! = %d" % (y, yFactorial)) # Question 3 ...
yuggo/SOW
chen_model_intro.ipynb
mit
#you have to make sure that you have all of these installed import cProfile import re import math import numpy as np import scipy as sp from scipy import stats from scipy import optimize as opt import pandas as pd import random as rnd from matplotlib import pyplot as plt import time import numpy.random import warnings ...
harcel/bayes_workshop
Exercises.ipynb
bsd-2-clause
P_positive_if_ill = .99 P_positive_if_notill = .01 P_ill = 1.e-3 def P_ill_if_positive(P_positive_if_ill=.99, P_positive_if_notill=.01, P_ill=1.e-3): """Function that simply plugs the numbers into Bayes' theorem""" P_notill = 1 - P_ill return P_positive_if_ill * P_ill / (P_positive_if_ill * P_ill + P_posi...
dataworkshop/xgboost
step3.ipynb
mit
import pandas as pd import xgboost as xgb import numpy as np import seaborn as sns from sklearn.dummy import DummyRegressor from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor, ExtraTreesRegressor from sklearn.ensemble import GradientBoostingRegressor, AdaBoostRegressor, B...
tritemio/multispot_paper
out_notebooks/usALEX-5samples-PR-raw-AND-gate-out-7d.ipynb
mit
ph_sel_name = "None" data_id = "7d" # data_id = "7d" """ Explanation: Executed: Mon Mar 27 11:36:20 2017 Duration: 7 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 fretbursts import * init...
astroumd/GradMap
notebooks/Lectures2017/Lecture4/Lecture4-m31.ipynb
gpl-3.0
data_file = 'm31-rubin.tab' """ Explanation: Dark Matter in M31 .. in 1970 (Rubin & Ford) As a tribute to Vera Rubin's work here is a notebook discussing one of her well known papers on the topic of dark matter. During the Greenbank observing we un-covered rotation in our galaxy, and how we could find out that there...
rflamary/POT
docs/source/auto_examples/plot_gromov.ipynb
mit
# Author: Erwan Vautier <erwan.vautier@gmail.com> # Nicolas Courty <ncourty@irisa.fr> # # License: MIT License import scipy as sp import numpy as np import matplotlib.pylab as pl from mpl_toolkits.mplot3d import Axes3D # noqa import ot """ Explanation: Gromov-Wasserstein example This example is designed to s...
oasis-open/cti-python-stix2
docs/guide/serializing.ipynb
bsd-3-clause
from stix2 import Indicator indicator = Indicator(name="File hash for malware variant", pattern_type="stix", pattern="[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']") print(indicator.serialize(pretty=True)) """ Explanation: Serializing STIX Objects The string repre...
nwfpug/meetings
2017-04-10/xml_processing.ipynb
gpl-3.0
# import the appropriate libraries import xml.etree.ElementTree as ET # xml processing # read the XML file tree = ET.parse('input/menu.xml') print('tree element:\t', tree) # get the root of the tree root = tree.getroot() print 'root element:\t ', root # here is the name of the root element root.tag # get the c...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_info.ipynb
bsd-3-clause
import mne import os.path as op """ Explanation: The :class:Info &lt;mne.Info&gt; data structure The :class:Info &lt;mne.Info&gt; data object is typically created when data is imported into MNE-Python and contains details such as: date, subject information, and other recording details the sampling rate information ab...
tylere/docker-tmpnb-ee
notebooks/1 - IPython Notebook Examples/IPython Project Examples/IPython Kernel/Rich Output.ipynb
apache-2.0
from IPython.display import display """ Explanation: Rich Output In Python, objects can declare their textual representation using the __repr__ method. IPython expands on this idea and allows objects to declare other, rich representations including: HTML JSON PNG JPEG SVG LaTeX A single object can declare some or a...
jlawman/jlawman.github.io
content/deep-learning/Activation Functions.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline #Create array of possible z values z = np.linspace(-5,5,num=1000) def draw_activation_plot(a,quadrants=2,y_ticks=[0],two_quad_y_lim=[0,5], four_quad_y_lim=[-1,1]): """ Draws plot of activation function Parameters ---------- ...
google/learned_optimization
docs/notebooks/Part1_Introduction.ipynb
apache-2.0
import numpy as np import jax.numpy as jnp import jax from matplotlib import pylab as plt !pip install git+https://github.com/google/learned_optimization.git import numpy as np import jax.numpy as jnp import jax from matplotlib import pylab as plt from learned_optimization.outer_trainers import full_es from learned_...
WilliamHPNielsen/broadbean
docs/Making output for Tektronix AWG70000A.ipynb
mit
# We make a sequence consisting of a bsic element with: # a wait time, a ramp up, a sine, a ramp down, and more wait time # And then we vary the sine frequency %matplotlib notebook import broadbean as bb from broadbean.plotting import plotter import numpy as np sine = bb.PulseAtoms.sine ramp = bb.PulseAtoms.ramp ####...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_sensor_connectivity.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import numpy as np from scipy import linalg import mne from mne import io from mne.connectivity import spectral_connectivity from mne.datasets import sample print(__doc__) """ Explanation: Compute all-to-all connectivity in sensor spa...
napsternxg/gensim
docs/notebooks/translation_matrix.ipynb
gpl-3.0
import os from gensim import utils from gensim.models import translation_matrix from gensim.models import KeyedVectors """ Explanation: Tranlation Matrix Tutorial What is it ? Suppose we are given a set of word pairs and their associated vector representaion ${x_{i},z_{i}}{i=1}^{n}$, where $x{i} \in R^{d_{1}}$ is the...