repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sgkang/simpegAIP
notebook/StoltzaAndMacnae1998_simple_stepon.ipynb
mit
def AofT(time,T, ai, taui): return ai*np.exp(-time/taui)/(1.+np.exp(-T/(2*taui))) from SimPEG import * import sys sys.path.append("./DoubleLog/") from plotting import mapDat class LinearSurvey(Survey.BaseSurvey): nD = None def __init__(self, time, **kwargs): self.time = time self.nD = tim...
albahnsen/PracticalMachineLearningClass
exercises/P2-MovieGenrePrediction.ipynb
mit
import pandas as pd import os import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.preprocessing import MultiLabelBinarizer from sklearn.multiclass import OneVsRestClassifier from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from sklearn.metrics import r2_...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_source_label_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.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...
robertoalotufo/ia898
master/Revisao_NumerosComplexos.ipynb
mit
import numpy as np C = np.complex(3,4) print('C=', C) print(type(C)) """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#IA898-Revisão-em-números-complexos" data-toc-modified-id="IA898-Revisão-em-números-complexos-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>IA898 Revisão em números comple...
vitojph/2016progpln
notebooks/2-Python-control-flujo.ipynb
mit
# asignamos unos cuantos valores a variables numero1 = 2 numero2 = 34 print(numero1 == numero2) print(numero1 != numero2) print(numero1 == numero1) print(numero2 <= 10) print(19 >= (10 * numero1)) print("------------------") print(10 == (5*2)) print(MiVariable != 10) """ Explanation: Control de flujo Hasta ahora ...
aaschroeder/Titanic_example
Final_ensemble.ipynb
gpl-3.0
import numpy as np import pandas as pd titanic=pd.read_csv('./titanic_clean_data.csv') """ Explanation: In this section, we're going to Setup the titanic data for ensembling Call the five individual models Ensemble the models (We use another Gradient Booster Output for submission End of explanation """ cols_to_nor...
gboeing/urban-data-science
modules/08-urban-networks-ii/lecture.ipynb
mit
import geopandas as gpd import matplotlib.pyplot as plt import networkx as nx import numpy as np import osmnx as ox import pandana import pandas as pd from shapely.geometry import Point # consistent randomization np.random.seed(0) # configure OSMnx cache_folder = '../../data/cache2' ox.config(log_console=True, use_ca...
khrapovs/metrix
notebooks/computing_ols.ipynb
mit
import numpy as np import matplotlib.pylab as plt import seaborn as sns from numpy.linalg import inv, lstsq sns.set_context('notebook') """ Explanation: Different ways to compute OLS Import all necessary modules End of explanation """ %matplotlib inline """ Explanation: If you want to embed plots inside IPython n...
dennys-bd/Coursera-Machine-Learning-Specialization
Course 2 - ML, Regression/week-2-multiple-regression-assignment-1-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 2: Multiple Regression (Interpretation) The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions. In this notebook you will use data on house sales in King County to predict prices using multiple regressi...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/image_classification/solutions/4_tpu_training.ipynb
apache-2.0
import os os.environ["BUCKET"] = "your-bucket-here" """ Explanation: Transfer Learning on TPUs In the <a href="3_tf_hub_transfer_learning.ipynb">previous notebook</a>, we learned how to do transfer learning with TensorFlow Hub. In this notebook, we're going to kick up our training speed with TPUs. Learning Objectives ...
Kyubyong/numpy_exercises
2_Array_manipulation_routines_Solutions.ipynb
mit
import numpy as np np.__version__ """ Explanation: Array manipulation routines End of explanation """ x = np.ones([10, 10, 3]) out = np.reshape(x, [-1, 150]) print out assert np.allclose(out, np.ones([10, 10, 3]).reshape([-1, 150])) """ Explanation: Q1. Let x be a ndarray [10, 10, 3] with all elements set to one. ...
tpin3694/tpin3694.github.io
machine-learning/replace_characters.ipynb
mit
# Import library import re """ Explanation: Title: Replace Characters Slug: replace_characters Summary: How to remove characters to clean unstructured text data for machine learning in Python. Date: 2016-09-06 12:00 Category: Machine Learning Tags: Preprocessing Text Authors: Chris Albon Preliminaries End of explanat...
pglauner/misc
src/cs730/1_notmnist.ipynb
gpl-2.0
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import os import sys import tarfile from IPython.display import display, Image from scipy import ndimage from sklearn.line...
tpin3694/tpin3694.github.io
sql/select_rows_that_contain_an_item_in_a_list.ipynb
mit
# Ignore %load_ext sql %sql sqlite:// %config SqlMagic.feedback = False """ Explanation: Title: Select Rows That Contain An Item In A List Slug: select_rows_that_contain_an_item_in_a_list Summary: Select rows that contain an item in a list. Date: 2016-05-01 12:00 Category: SQL Tags: Basics Authors: Chris Albon Note...
destrys/euler
python/notebooks/Problem1.ipynb
mit
%psource p1.natural_3and5_brute from destryseuler import p1 p1.natural_3and5_brute?? %pfile ../destryseuler/p1.py def natural3and5Brute(upper=1000): output = 0 for i in range(1,upper): if i % 3 == 0: output += i continue if i % 5 == 0: output += i ...
quantopian/research_public
notebooks/lectures/Introduction_to_Research/notebook.ipynb
apache-2.0
2 + 2 """ Explanation: Introduction to the Research Environment The research environment is powered by IPython notebooks, which allow one to perform a great deal of data analysis and statistical validation. We'll demonstrate a few simple techniques here. Code Cells vs. Text Cells As you can see, each cell can be eithe...
adrianstaniec/deep-learning
03_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...
jhconning/Dev-II
notebooks/Vollrath.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from ipywidgets import interact, fixed from scipy.optimize import fsolve, brentq, minimize def F(la, A, alpha): return A * la**alpha def y(la= 0.5, Aa = 1, Am = 1, alpA = 0.5, alpM = 0.5, p = 1): '''GDP per capita''' return F(la, Aa, alpA) + p * F(1-la...
hamogu/Cepheids
CompanionPSF.ipynb
mit
import numpy as np import astropy.units as u from astropy.coordinates import SkyCoord from astroquery.gaia import Gaia from astropy import table from astropy.table import Table from astropy.wcs import WCS from astropy.io import fits from astropy.nddata import NDData from photutils.psf import extract_stars import she...
laserkelvin/Molecule-Tools
Coulomb Matrix.ipynb
gpl-3.0
Atoms = ["C", "B", "H"] """ Explanation: Atoms Atoms are defined as a list of strings here. End of explanation """ Coordinates = [] for AtomNumber in range(len(Atoms)): Coordinates.append(np.random.rand(3)) """ Explanation: Generate some random coordinates Making some random $x,y,z$ coordinates up End of explan...
ALEXKIRNAS/DataScience
Coursera/Machine-learning-data-analysis/Course 2/Week_04/grad_boosting.ipynb
mit
import sklearn.datasets as datasets import numpy as np from matplotlib import pyplot as plt import pandas as pd %matplotlib inline data = datasets.load_boston() target = data['target'] data = data['data'] data.shape x_train, x_test, y_train, y_test = data[:380], data[380:], target[:380], target[380:] """ Explanati...
landlab/landlab
notebooks/teaching/geomorphology_exercises/hillslope_notebooks/north_carolina_piedmont_hillslope_class_notebook.ipynb
mit
# Code Block 1 import numpy as np from landlab.io import read_esri_ascii from landlab.plot.imshow import imshow_grid import matplotlib.pyplot as plt # below is to make plots show up in the notebook %matplotlib inline """ Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_h...
cxxgtxy/tensorflow
tensorflow/lite/g3doc/tutorials/model_maker_image_classification.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...
huilyu2/DataVisualization
Assignment+3_Hui+Lyu.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import csv """ Explanation: Assignment: Week 04 This week, we will be putting to use some of the skills we have developed over the last couple weeks. You will be tasked with examining a new dataset, constructing a class that operates on it, and plo...
y2ee201/Deep-Learning-Nanodegree
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...
quantopian/research_public
notebooks/data/eventvestor.earnings_releases/notebook.ipynb
apache-2.0
# import the dataset from quantopian.interactive.data.eventvestor import earnings_releases # or if you want to import the free dataset, use: # from quantopian.interactivedata.eventvestor import earnings_releases_free # import data operations from odo import odo # import other libraries we will use import pandas as pd ...
henriquepgomide/caRtola
src/python/desafio_valorizacao/Descobrindo o algoritmo de valorização do Cartola FC - Parte II.ipynb
mit
# Importar bibliotecas import pprint import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import lightgbm as lgb from sklearn import linear_model from sklearn.metrics import (mean_squared_error, r2_score) from sklearn import ensemble from sklearn.model_selection import train_test...
mne-tools/mne-tools.github.io
0.22/_downloads/542dc1082b4eb8bba1ec06e757cdf52d/plot_interpolate_bad_channels.ipynb
bsd-3-clause
# Authors: Denis A. Engemann <denis.engemann@gmail.com> # Mainak Jas <mainak.jas@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/MEG/sample/sample_audvis-ave.fif' evoked = mne.read_evokeds(fnam...
connordurkin/CPSC_458
final_project.ipynb
mit
%matplotlib inline import yahoo_finance from yahoo_finance import Share import numpy as np import pandas import matplotlib.pyplot as plt import datetime import cvxopt as opt from cvxopt import blas, solvers # We will do a lot of optimizations, # and don't want to see each step. solvers.options['show_progress'] = False...
beangoben/HistoriaDatos_Higgs
Dia1/1_Computacion_con_Jupyter.ipynb
gpl-2.0
!pwd print("hola bolivia") """ Explanation: 1 Introduccion a IPython notebooks/ Jupyter Que es exactamente? Una libreta IPython/Jupyter es un ambiente interactivo para escribir y correr codigo de python. Es un historial completo y auto-contenido de un calculo y puede ser convertido a otros formatos para compartir ...
EmuKit/emukit
notebooks/Emukit-tutorial-basic-use-of-the-library.ipynb
apache-2.0
# General imports and parameters of figures should be loaded at the beginning of the overview import numpy as np """ Explanation: Basic use of Emukit Overview End of explanation """ from emukit.test_functions import branin_function from emukit.core import ParameterSpace, ContinuousParameter from emukit.core.initia...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_ems_filtering.ipynb
bsd-3-clause
# Author: Denis Engemann <denis.engemann@gmail.com> # Jean-Remi King <jeanremi.king@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io, EvokedArray from mne.datasets import sample from mne.decoding import EMS, compute_ems from sklearn.model_...
ES-DOC/esdoc-jupyterhub
notebooks/mohc/cmip6/models/hadgem3-gc31-mm/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-mm', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MOHC Source ID: HADGEM3-GC31-MM Topic: Ocean Sub-Topics: Timestepping Framewor...
asharel/ml
LAB3/src/LAB3.ipynb
gpl-3.0
print ('benign=>', (all_classes<0.5).sum()) print ('malignant=>', (all_classes>0.5).sum()) """ Explanation: Datos de partida: ¿Cuántas clases hay? ¿Cuántos ejemplos de cada? Hay dos clases en nuestro grupo de datos, muestras malignas y muestras benignas, que se representan el las imagenes de la celda 4. Tenemos 6691 m...
gtrichards/PHYS_T480
NonlinearDimensionReduction.ipynb
mit
import numpy as np from sklearn.manifold import LocallyLinearEmbedding X = np.random.normal(size=(1000,2)) # 1000 points in 2D R = np.random.random((2,10)) # projection matrix X = np.dot(X,R) # now a 2D linear manifold in 10D space k = 5 # Number of neighbors to use in fit n = 2 # Number of dimensions to fit lle = Loca...
junhwanjang/DataSchool
Lecture/18. 문서 전처리/2) NLTK 자연어 처리 패키지 소개.ipynb
mit
nltk.download('averaged_perceptron_tagger') nltk.download("gutenberg") nltk.download('punkt') nltk.download('reuters') nltk.download("stopwords") nltk.download("taggers") nltk.download("webtext") nltk.download("wordnet") nltk.corpus.gutenberg.fileids() emma_raw = nltk.corpus.gutenberg.raw("austen-emma.txt") print(emm...
IST256/learn-python
content/lessons/13-Visualization/WMC1-Matplotlib.ipynb
mit
# Jupyter Directive %matplotlib inline # imports import matplotlib import pandas as pd import numpy as np import matplotlib.pyplot as plt matplotlib.rcParams['figure.figsize'] = (20.0, 10.0) # larger figure size """ Explanation: Watch Me Code 1: Matplotlib We will demonstrate Pythons data visualization library Matp...
balarsen/pymc_learning
Counting/Counting multi detector Dead TIme.ipynb
bsd-3-clause
%matplotlib inline from pprint import pprint import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymc3 as mc import spacepy.toolbox as tb import spacepy.plot as spp import tqdm from scipy import stats import seaborn as sns sns.set() matplotlib.pyplot.rc('figure', figsize=(1...
prasants/pyds
.ipynb_checkpoints/01.Unix_and_Shell_Command_Basics-checkpoint.ipynb
mit
!pwd """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Overview" data-toc-modified-id="Overview-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Overview</a></div><div class="lev2 toc-item"><a href="#pwd---Print-Working-Directory" data-toc-modified-id="pwd---Print-Working-Directory-11"><span ...
M4573R/BerkeleyX-CS190.1x-Scalable-Machine-Learning
Week 1 - Course Overview and Machine Learning Basics/ML_lab1_review_student.ipynb
mit
labVersion = 'cs190_week1_v_1_2' """ Explanation: Math and Python review and CTR data download This notebook reviews vector and matrix math, the NumPy Python package, and Python lambda expressions. It also covers downloading the data required for Lab 4, where you will analyze website click-through rates. Part 1 cove...
waltervh/BornAgain-tutorial
talks/day_3/complex_samples_2_M/diffuse_scattering.ipynb
gpl-3.0
# %load density_grad.py import numpy as np import bornagain as ba from bornagain import deg, angstrom, nm # define used SLDs sld_D2O = 6.34e-06 sld_polymer = 4.0e-06 sld_Si = 2.07e-06 h = 100.0*nm # thickness of the non-uniform polymer layer nslices = 100 # number of slices to slice the polymer layer def get_sl...
cjbrasher/LipidFinder
docs/LipidFinder2_manual.ipynb
mit
config_params.py -m peakfilter """ Explanation: Welcome to LipidFinder 2 LipidFinder is an open-source Python workflow designed to facilitate further targeted lipidomics analysis. LipidFinder categorises and removes noise and artifacts from liquid chromatography/mass spectrometry (LC/MS) datasets, searches the outcome...
AtmaMani/pyChakras
udemy_ml_bootcamp/Python-for-Data-Visualization/Matplotlib/Advanced Matplotlib Concepts.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline x = np.linspace(0, 5, 11) y = x**2 fig, axes = plt.subplots(1, 2, figsize=(10,4)) axes[0].plot(x, x**2, x, np.exp(x)) axes[0].set_title("Normal scale") axes[1].plot(x, x**2, x, np.exp(x)) axes[1].set_yscale("log") axes[1].set_title("Logarit...
trolldbois/python-haystack
docs/Haystack_basic_usage.ipynb
gpl-3.0
!cat ../test/src/test-ctypes3.c """ Explanation: Let's look at a basic usage example for Haystack. First we have a program which allocates structures on the HEAP: End of explanation """ !clang2py ../test/src/test-ctypes3.c #-o ../test/src/clang3_gen64.py """ Explanation: Then, using ctypeslib, we have generated pyt...
keras-team/keras-io
examples/nlp/ipynb/lstm_seq2seq.ipynb
apache-2.0
import numpy as np import tensorflow as tf from tensorflow import keras """ Explanation: Character-level recurrent sequence-to-sequence model Author: fchollet<br> Date created: 2017/09/29<br> Last modified: 2020/04/26<br> Description: Character-level recurrent sequence-to-sequence model. Introduction This example dem...
Kaggle/learntools
notebooks/ml_intermediate/raw/tut2.ipynb
apache-2.0
#$HIDE$ import pandas as pd from sklearn.model_selection import train_test_split # Load the data data = pd.read_csv('../input/melbourne-housing-snapshot/melb_data.csv') # Select target y = data.Price # To keep things simple, we'll use only numerical predictors melb_predictors = data.drop(['Price'], axis=1) X = melb_...
cwhite1026/Py2PAC
examples/Calculating_correlation_functions.ipynb
bsd-3-clause
import AngularCatalog_class as ac import numpy.random as rand import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (10, 6) """ Explanation: Calculating correlation functions This document walks through using Py2PAC to calculate correlation functions with or without error estimates. We...
molgor/spystats
notebooks/Sandboxes/TensorFlow/BiospytialGaussianModels.ipynb
bsd-2-clause
run ../../../../traversals/tests.py """ Explanation: In this notebook I´ll create functions for easing the development of geostatistical models using the GPFlow (James H, et.al )the library for modelling gaussian processes in Tensor Flow (Google) (Great Library, btw). Requirements Inputs Design Matrix X composed of c...
googledatalab/notebooks
tutorials/BigQuery/BigQuery APIs.ipynb
apache-2.0
import google.datalab.bigquery as bq """ Explanation: BigQuery APIs Google Cloud Datalab provides an integrated environment for working with Google BigQuery for both ad-hoc, exploratory work as well as pipeline development. You've already seen the use of %%bq in the Hello BigQuery notebook, and various commands in the...
zacwentzell/BIA-660-C-Spring2017
In-class Lectures/March 09/Lecture_March_9.ipynb
mit
import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') # Pandas has a ton of built-in visualizations # Play and Learn # http://pandas.pydata.org/pandas-docs/stable/visualization.html df.plot.scatter(x='Start_Date', y='Price') df['Price'].plot.box() color = dict(boxes='DarkGreen', whiskers=...
paolorivas/homeworkfoundations
classes and excersises/class9/.ipynb_checkpoints/09 - Functions-checkpoint.ipynb
mit
len """ Explanation: Class 9: Functions A painful analogy What do you do when you wake up in the morning? I don't know about you, but I get ready. "Obviously," you say, a little too snidely for my liking. You're particular, very detail-oriented, and need more information out of me. Fine, then. Since you're going to be...
keras-team/keras-io
examples/generative/ipynb/cyclegan.ipynb
apache-2.0
import os import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_addons as tfa import tensorflow_datasets as tfds tfds.disable_progress_bar() autotune = tf.data.AUTOTUNE """ Explanation: CycleGAN Author: A_K_Nain...
mbakker7/timml
notebooks/timml_xsection.ipynb
mit
from pylab import * %matplotlib inline from timml import * """ Explanation: TimML Notebook Cross-sectional model End of explanation """ ml = ModelMaq(kaq=[1, 2], z=[4, 3, 2, 1, 0], c=[1000, 1000], \ topboundary='semi', hstar=5) ls = HeadLineSink1D(ml, xls=0, hls=2, layers=0) ml.solve() x = linspace(-2...
SKA-ScienceDataProcessor/crocodile
examples/notebooks/predict.ipynb
apache-2.0
%matplotlib inline import sys sys.path.append('../..') from matplotlib import pylab from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt pylab.rcParams['figure.figsize'] = 12, 10 import functools import numpy import scipy import scipy.special from crocodile.clean import * from crocodile.synthesi...
adolfoguimaraes/machinelearning
SupervisedLearning/Tutorial03_ArvoreDeDecisao.ipynb
mit
from sklearn import tree import pandas as pd data = pd.read_csv('http://www.data2learning.com/machinelearning/datasets/exemplo_jogar.csv') data """ Explanation: Aprendizado Supervisionado Árvore de Decisão Na primeira parte do curso apresentamos dois algoritmos clássicos de aprendizagem de máquian: o KNN e o algorit...
mathinmse/mathinmse.github.io
Lecture-10A-Taylors-Series.ipynb
mit
%matplotlib inline import numpy as np import sympy as sp import matplotlib.pyplot as plt # You can change the default figure size to be a bit larger if you want, # uncomment the next line for that: plt.rc('figure', figsize=(10, 6)) """ Explanation: In-Class Demonstration and Visualization End of explanation """ def...
opengeostat/pygslib
pygslib/Ipython_templates/.ipynb_checkpoints/nscore_ttable_raw-checkpoint.ipynb
mit
#general imports import matplotlib.pyplot as plt import pygslib from matplotlib.patches import Ellipse import numpy as np import pandas as pd #make the plots inline %matplotlib inline """ Explanation: Testing the nscore transformation table End of explanation """ #get the data in gslib format into a pandas ...
csdms/coupling
docs/demos/cem_and_waves.ipynb
mit
%matplotlib inline import numpy as np """ Explanation: <img src="../_static/pymt-logo-header-text.png"> Coastline Evolution Model + Waves Link to this notebook: https://github.com/csdms/pymt/blob/master/docs/demos/cem_and_waves.ipynb Install command: $ conda install notebook pymt_cem This example explores how to use...
HaoMood/cs231n
assignment1/assignment1sol/features/main.ipynb
gpl-3.0
# Run some setup code import numpy as np import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'ne...
peterdalle/mij
1 Introduction to Python/Introduction.ipynb
gpl-3.0
print("Hello World!") # We can write comments like this. print("Hello World!") # Or here. You can write anything you want. # It's a good way of describing what your code does. # Note: we can't use upper case. We will get a "NameError". PRINT("Hello World!") """ Explanation: Introduction to Python and Jupyter Notebo...
weleen/mxnet
example/notebooks/recommendation_systems/cdl/collaborative-dl.ipynb
apache-2.0
import mxnet as mx import numpy as np import logging import data from math import sqrt from autoencoder import AutoEncoderModel import os """ Explanation: MXNet for Collaborative Deep Learning in Recommender Systems In this tutorial, we build on MXNet to implement the Collaborative Deep Learning (CDL) [1] model for re...
JoseGuzman/myIPythonNotebooks
MachineLearning/PCA_new.ipynb
gpl-2.0
%pylab inline %config InlineBackend.figure_format = 'retina' from matplotlib import style style.use('https://raw.githubusercontent.com/JoseGuzman/minibrain/master/minibrain/paper.mplstyle') from scipy.stats import norm """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class...
IS-ENES-Data/submission_forms
dkrz_forms/Templates/CORDEX_submission_form.ipynb
apache-2.0
# Evaluate this cell to identifiy your form from dkrz_forms import form_widgets, form_handler, checks form_infos = form_widgets.show_selection() # Evaluate this cell to generate your personal form instance form_info = form_infos[form_widgets.FORMS.value] sf = form_handler.init_form(form_info) form = sf.sub.entity_o...
spulido99/Programacion
Margarita/.ipynb_checkpoints/Taller 2 - Archivos y Bases de Datos-checkpoint.ipynb
mit
import pandas as pd df = pd.read_csv('datoss.tsv', sep='\t') df [1:1] """ Explanation: Archivos y Bases de datos La idea de este taller es manipular archivos (leerlos, parsearlos y escribirlos) y hacer lo mismo con bases de datos estructuradas. Ejercicio 1 Baje el archivo de "All associations with added ontology anno...
pysal/pysal
notebooks/viz/splot/libpysal_non_planar_joins_viz.ipynb
bsd-3-clause
from pysal.lib.weights.contiguity import Queen import pysal.lib from pysal.lib import examples import matplotlib.pyplot as plt import geopandas as gpd %matplotlib inline from pysal.viz.splot.pysal.lib import plot_spatial_weights """ Explanation: splot.pysal.lib: assessing neighbors & spatial weights In spatial analys...
rasilab/ferrin_elife_2017
scripts/run_simulations_based_on_experiment_fits.ipynb
gpl-3.0
%%writefile simulation_run_3.py #!/usr/bin/env python #SBATCH --mem=8000 import subprocess as sp import os import sys jobindex = int(sys.argv[1]) currentindex = -1 mrnafiles = filter(lambda x: x.startswith('yfp'), os.listdir('../annotations/simulations/run3/')) mrnafiles = ['../annotations/simulations/run3/' + File ...
mne-tools/mne-tools.github.io
0.20/_downloads/90c71f0d36d740bc290fd9fa30bddd8c/plot_compute_covariance.ipynb
bsd-3-clause
import os.path as op import mne from mne.datasets import sample """ Explanation: Computing a covariance matrix Many methods in MNE, including source estimation and some classification algorithms, require covariance estimations from the recordings. In this tutorial we cover the basics of sensor covariance computations...
PyDataMadrid2016/Conference-Info
talks_materials/20160409_1815_Lightning_talks/02_poliastro/Going to Mars with Python in 5 minutes.ipynb
mit
%matplotlib notebook import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import astropy.units as u from astropy import time from poliastro import iod from poliastro.plotting import plot from poliastro.bodies import Sun, Earth from poliastro.twobody import State from poliastro im...
antoniomezzacapo/qiskit-tutorial
qiskit/aqua/artificial_intelligence/qsvm_kernel_classification.ipynb
apache-2.0
from qsvm_datasets import * from qiskit_aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name from qiskit_aqua.input import get_input_instance from qiskit_aqua import run_algorithm # setup aqua logging import logging from qiskit_aqua._logging import set_logging_config, build_logging_config # set_...
eaton-lab/eaton-lab.github.io
slides/ipyrad-analysis/ipyrad-analysis.ipynb
mit
# conda install -c ipyrad ipyrad structure clumpp bpp # conda install -c eaton-lab toytree toyplot # conda install -c bioconda raxml """ Explanation: The ipyrad.analysis tool kit Deren Eaton Install software All required software for this walkthrough is available on conda. End of explanation """ # ipcluster start...
bwgref/nustar_pysolar
notebooks/20210114/Planning 20210114.ipynb
mit
fname = io.download_occultation_times(outdir='../data/') print(fname) """ Explanation: Download the list of occultation periods from the MOC at Berkeley. Note that the occultation periods typically only are stored at Berkeley for the future and not for the past. So this is only really useful for observation planning. ...
bio-guoda/guoda-examples
02_iDigBio_and_GBIF_Specimens_By_Continent_Over_Time.ipynb
mit
# col() selects columns from a data frame, year() works on dates, and udf() creates user # defined functions from pyspark.sql.functions import col, year, udf # Plotting library and configuration to show graphs in the notebook import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Continuing Graphs of Spe...
bengranett/minimask
demos/mosaic.ipynb
mit
%matplotlib notebook import os import numpy as np import tempfile import matplotlib.pyplot as pyplot import logging logging.basicConfig(level=logging.INFO) import minimask.mask as mask import minimask.healpix_projection as hp import minimask.io.mosaic as mosaic """ Explanation: minimask mosaic example Construct a m...
zerothi/sisl
docs/visualization/viz_module/basic-tutorials/Demo.ipynb
mpl-2.0
import sisl # We define the root directory where our files are siesta_files = sisl._environ.get_environ_variable("SISL_FILES_TESTS") / "sisl" / "io" / "siesta" """ Explanation: First steps End of explanation """ import sisl.viz from sisl.viz import Plot """ Explanation: Activating the viz framework The first thing ...
diegocavalca/Studies
deep-learnining-specialization/1. neural nets and deep learning/resources/Building your Deep Neural Network - Step by Step v3.ipynb
cc0-1.0
import numpy as np import h5py import matplotlib.pyplot as plt from testCases_v2 import * from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['imag...
tensorflow/docs
site/en/r1/guide/keras.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/structured/solutions/4b_keras_dnn_babyweight.ipynb
apache-2.0
import datetime import os import shutil import matplotlib.pyplot as plt import tensorflow as tf print(tf.__version__) """ Explanation: LAB 4b: Create Keras DNN model. Learning Objectives Set CSV Columns, label column, and column defaults Make dataset of features and label from CSV files Create input layers for raw f...
d-k-b/udacity-deep-learning
batch-norm/Batch_Normalization_Exercises.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...
noammor/coursera-machinelearning-python
ex7/ml-ex7-pca.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy.io import itertools %matplotlib inline """ Explanation: # Exercise 7 | Principle Component Analysis End of explanation """ ex7data1 = scipy.io.loadmat('ex7data1.mat') X = ex7data1['X'] def plot_data(X, ax): ax.plot(X[:,0], X[:,1], 'bo') fig, ...
vk3105/Data-Intensive-Programming-CSE-587
Lab5/Lab5-Task1.ipynb
apache-2.0
import pyspark import string import re import time import os from pylab import * from itertools import * from pyspark.sql import SQLContext, Row """ Explanation: LAB 5 : TASK 1 - GENERATING THE 2-GRAM & 3-GRAM Load the libraries End of explanation """ regex = re.compile('[%s]' % re.escape(string.punctuation)) """ E...
Linusp/panic-notebook
ipynb/stdlib.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: Python 标准库 End of explanation """ import collections """ Explanation: collections End of explanation """ d = {'id': 1, 'content': 'hello world'} d['author'] """ Explanation: collections 中实现了一些高性能、易用的容器类型 defaultdict 继承...
benwaugh/NuffieldProject2016
notebooks/SimpleMassHistogram.ipynb
mit
import pylab import matplotlib.pyplot as plt %matplotlib inline pylab.rcParams['figure.figsize'] = 12,8 """ Explanation: These commands give us access to some tools for plotting histograms and other graphs: End of explanation """ data_file = open('Invariant_Masses.txt') masses = [] # Create an ...
eriksalt/jupyter
Python Quick Reference/Functions.ipynb
mit
def print_text(): print('this is text') # call the function print_text() """ Explanation: Python Function Quick Reference Table of contents <a href="#1.-Declaring-Functions">Declaring Functions</a> <a href="#2.-Return-Values">Return Values</a> <a href="#3.-Parameters">Parameters</a> <a href="#4.-DocStrings">DocS...
enbanuel/phys202-2015-work
assignments/assignment12/FittingModelsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 1 Imports End of explanation """ a_true = 0.5 b_true = 2.0 c_true = -4.0 """ Explanation: Fitting a quadratic curve For this problem we are going to work with the following mod...
marcino239/notebooks
nlp_bag_of_words.ipynb
gpl-2.0
%matplotlib inline import numpy as np import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from bs4 import BeautifulSoup from matplotlib import pyplot as plt from sklearn.ensemble import GradientBoostingClassifier from sklearn.feature_selection import SelectKBest, chi2 from sklearn.metrics ...
mrGeen/metaseq
doc/source/example_session_2.ipynb
mit
# Enable in-line plots for this IPython Notebook %matplotlib inline """ Explanation: Example 2: Differential expression scatterplots This example looks more closely at using the results table part of :mod:metaseq, and highlights the flexibility in plotting afforded by :mod:metaseq. End of explanation """ import meta...
jshudzina/keras-tutorial
notebooks/02-Yellowstone-visitors-part2.ipynb
apache-2.0
from pandas import DataFrame from pandas import Series from pandas import concat from pandas import read_csv from pandas import datetime from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential from keras.layers import Dense from keras.layers impo...
gasabr/AtoD
examples/hero_example.ipynb
mit
am = Hero(1) # You can use attributes to get some hero properties which depends on lvl, examples: print('Anti-Mage stats on lvl {}'.format(am.lvl)) print('\tstrength = {}'.format(am.str)) print('\tagility = {}'.format(am.agi)) print('\tintellect = {}'.format(am.int)) print('\t...') """ Explanation: Hero creation...
ernestyalumni/Propulsion
Physique/Physique_jupyter.ipynb
gpl-2.0
import os, sys """ Explanation: Physique Mini Table of Contents Using Physique from a working directory not containing Physique itself NIST Fundamental Constants NIST Official Conversions (to metric) Webscraping example: JPL Solar System Dynamics (JPL SSD) - Planets and Pluto Using Physique from a working directory...
probprog/pyprob
examples/gaussian_unknown_mean_marsaglia.ipynb
bsd-2-clause
class GaussianUnknownMean(Model): def __init__(self): super().__init__(name='Gaussian with unknown mean (Marsaglia)') # give the model a name self.prior_mean = 1 self.prior_std = math.sqrt(5) self.likelihood_std = math.sqrt(2) def marsaglia(self, mean, stddev): u...
agconti/kaggle-titanic
Titanic.ipynb
apache-2.0
import matplotlib.pyplot as plt %matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.nonparametric.kde import KDEUnivariate from statsmodels.nonparametric import smoothers_lowess from pandas import Series, DataFrame from patsy import dmatrices from sklearn import datas...
GoogleCloudPlatform/vertex-ai-samples
community-content/tf_keras_image_classification_distributed_multi_worker_with_vertex_sdk/multi_worker_vertex_training_on_gpu_with_custom_container.ipynb
apache-2.0
PROJECT_ID = "YOUR PROJECT ID" BUCKET_NAME = "gs://YOUR BUCKET NAME" REGION = "YOUR REGION" SERVICE_ACCOUNT = "YOUR SERVICE ACCOUNT" content_name = "tf-keras-img-cls-dist-multi-worker-gpu-cust-cont" """ Explanation: TF-Keras Image Classification Distributed Multi-Worker Training on GPU using Vertex Training with Cust...
AstroHackWeek/AstroHackWeek2017
day1/notebooks/demo-SDSS.ipynb
mit
from os import path from astropy.table import Table import h5py import matplotlib.pyplot as plt plt.style.use('notebook.mplstyle') %matplotlib inline import numpy as np data_path = '../data/' """ Explanation: SDSS/BOSS spectroscopic data The SDSS dataset contains 100,000 spectra and catalog data for the same sources...
msampathkumar/data_science_sessions
Session-1-Introduction_to_Data_Sciences/Data Science Presentation.ipynb
mit
%%sh # ls -l ~/Downloads/G20*csv # mv ~/Downloads/G20*csv G20.csv """ Explanation: INDIA, G-20 AND THE WORLD - Statistical Year Book India 2016 Navigation Path: Home > Statistical Year Book India 2016 > INDIA, G-20 AND THE WORLD The G20 (or G-20 or Group of Twenty) is an international forum for the governments and...
stallmanifold/cs229-machine-learning-stanford-fall-2016
src/homework2/q3/homework2_3.ipynb
apache-2.0
import numpy as np import pandas as pd import read_matrix as rm import nb_train import nb_test import svm_train import svm_test """ Explanation: Homework 2 Problem 3 End of explanation """ df_train = rm.read_data('spam_data/MATRIX.TRAIN') nb_model = nb_train.train(df_train) """ Explanation: Part 3.a The first mach...
ramseylab/networkscompbio
class18_motifs_python3_template.ipynb
apache-2.0
import igraph import random import collections """ Explanation: Example implementation of the ESU subgraph enumeration algorithm in python Load the packages that we will need End of explanation """ def exclusive_neighborhood(graph, v, Vp): assert type(graph)==igraph.Graph assert type(v)==int assert type(...
keras-team/keras-io
examples/nlp/ipynb/text_classification_from_scratch.ipynb
apache-2.0
import tensorflow as tf import numpy as np """ Explanation: Text classification from scratch Authors: Mark Omernick, Francois Chollet<br> Date created: 2019/11/06<br> Last modified: 2020/05/17<br> Description: Text sentiment classification starting from raw text files. Introduction This example shows how to do text cl...
mtpain/metacorps
notebooks/Results Plots Walkthrough.ipynb
bsd-3-clause
metaphors_url = 'http://metacorps.io/static/viomet-snapshot-project-df.csv' project_df = get_project_data_frame(metaphors_url) print(project_df.columns) """ Explanation: Publically-available .csv for reproducibility I generate two files currently named viomet-snapshot-project-df.csv and viomet-2012-snapshot-project-d...
openstreams/wflow
notebooks/wflow-test-sbm.ipynb
gpl-3.0
%pylab inline # First import the model. Here we use the HBV version from wflow.wflow_sbm import * import IPython from IPython.display import display, clear_output #clear_output = IPython.core.display.clear_output """ Explanation: Use of the wflow OpenStreams framework API This ipython notebook demonstrates how to lo...
hubenjm/scrapediscogs
discogs_client_example.ipynb
gpl-3.0
import discogs_client token = open('./token.txt').readline().strip() print token d = discogs_client.Client('MusicDBCreater/0.1', user_token=token) """ Explanation: discogs_client brief overview: End of explanation """ results = d.search('Bob Dylan - Time Out of Mind', type = 'release') type(results) len(results...