repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
OceanPARCELS/parcels
parcels/examples/tutorial_SummedFields.ipynb
mit
%matplotlib inline from parcels import Field, FieldSet, ParticleSet, JITParticle, plotTrajectoriesFile, AdvectionRK4 import numpy as np """ Explanation: Tutorial on how to combine different Fields for advection into a SummedField object In some oceanographic applications, you may want to advect particles using a combi...
Danghor/Algorithms
Python/Chapter-05/Calculator-Frame.ipynb
gpl-2.0
import re """ Explanation: The Shunting Yard Algorithm (Operator Precedence Parsing) End of explanation """ def isWhiteSpace(s): whitespace = re.compile(r'[ \t]+') return whitespace.fullmatch(s) """ Explanation: The function $\texttt{isWhiteSpace}(s)$ checks whether $s$ contains only blanks and tabulators. ...
ES-DOC/esdoc-jupyterhub
notebooks/bnu/cmip6/models/sandbox-3/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bnu', 'sandbox-3', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: BNU Source ID: SANDBOX-3 Topic: Atmoschem Sub-Topics: Transport, Emissions Co...
OceanPARCELS/parcels
parcels/examples/tutorial_parcels_structure.ipynb
mit
from IPython.display import SVG SVG(filename='parcels_user_diagram.svg') """ Explanation: Getting started with Parcels: general structure There are many different ways in which to use Parcels for research. The flexibility of the parcels code enables this wide range of applicability and allows you to build complex sim...
exe0cdc/PyscesToolbox
example_notebooks/Thermokin.ipynb
bsd-3-clause
mod = pysces.model('lin4_fb') mod.doLoad() # this method call is necessary to ensure that future `doLoad` method calls are executed correctly tk = psctb.ThermoKin(mod) """ Explanation: Thermokin Thermokin is used to assess the kinetic and thermodynamic aspects of enzyme catalysed reactions in metabolic pathways [5]. I...
rreimche/infdiffusion
Diffusion of REAL news.ipynb
mit
client = pymongo.MongoClient("46.101.236.181") db = client.allfake # get collection names collections = sorted([collection for collection in db.collection_names()]) """ Explanation: Init config Select appropriate: - database server (line 1): give pymongo.MongoClient() an appropriate parameter, else it is localhost - ...
rigetticomputing/pyquil
docs/source/quilt_getting_started.ipynb
apache-2.0
from pyquil import Program, get_qc qc = get_qc("Aspen-8") """ Explanation: Getting Up and Running with Quil-T Language Documentation See https://github.com/rigetti/quil for documentation on the Quil-T language. Construct a QuantumComputer object linked to the Quil-T compiler End of explanation """ qc.compiler.get_ve...
Erotemic/ubelt
docs/notebooks/demo_CacheStamp.ipynb
apache-2.0
import ubelt as ub dpath = ub.Path.appdir('stamp-demo').delete().ensuredir() fpath1 = dpath / 'large-file1.txt' fpath2 = dpath / 'large-file2.txt' stamp = ub.CacheStamp('stamp-name', dpath=dpath, product=[fpath1, fpath2]) # If the stamp is expired, we need to recompute the process if stamp.expired(): fpath1.writ...
teuben/astr288p
notebooks/orbits-01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math """ Explanation: Two Dimensional Galactic Orbits set initial conditions (x0,y0) and (vx0,vy0) in the plane z=0 set integration time step set number of integrations or a final integration stop time define the potential and the forces as...
MingChen0919/learning-apache-spark
notebooks/06-machine-learning/classification/naive-bayes-classification.ipynb
mit
from pyspark import SparkContext sc = SparkContext(master = 'local') from pyspark.sql import SparkSession spark = SparkSession.builder \ .appName("Python Spark SQL basic example") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() """ Explanation: Create entry points to...
square/pysurvival
notebooks/Churn Prediction - Predicting when your customers will churn.ipynb
apache-2.0
# Importing modules import pandas as pd import numpy as np from matplotlib import pyplot as plt from pysurvival.datasets import Dataset %pylab inline # Reading the dataset raw_dataset = Dataset('churn').load() print("The raw_dataset has the following shape: {}.".format(raw_dataset.shape)) raw_dataset.head(2) """ Expl...
kikocorreoso/brythonmagic
notebooks/Brython usage in the IPython notebook.ipynb
mit
import IPython IPython.version_info """ Explanation: The brythonmagic extension has been tested on: End of explanation """ %install_ext https://raw.github.com/kikocorreoso/brythonmagic/master/brythonmagic.py %load_ext brythonmagic """ Explanation: brythonmagic installation Just type the following: End of explanati...
jhprinz/openpathsampling
examples/misc/tutorial_storage.ipynb
lgpl-2.1
import openpathsampling as paths """ Explanation: An introduction to Storage Introduction All we need is contained in the openpathsampling package End of explanation """ storage = paths.Storage('mstis.nc') storage """ Explanation: The storage itself is mainly a netCDF file and can also be used as such. Technically ...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/sandbox-1/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-1', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MIROC Source ID: SANDBOX-1 Topic: Ocean Sub-Topics: Timestepping Framework, Advecti...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch6-Problem_6-11.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 6 Problem 6-11 End of explanation """ fse = 60 # [Hz] n_nl = 1100 # [r/min] p = 6 """ Explanation: Description The input power to the rotor circuit of a six-pole, 60 Hz, induction motor running at 1100 r/min is 5 kW. E...
highb/deep-learning
autoencoder/Convolutional_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) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
ktmud/deep-learning
intro-to-tflearn/TFLearn_Digit_Recognition.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...
schaber/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...
diegocavalca/Studies
deep-learnining-specialization/2. improving deep neural networks/week3/programming-assignment/Tensorflow+Tutorial.ipynb
cc0-1.0
import math import numpy as np import h5py import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.framework import ops from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict %matplotlib inline np.random.seed(1) """ Explanation: TensorFlow Tutorial Welcome to this w...
albahnsen/ML_SecurityInformatics
notebooks/10_EnsembleMethods_cont.ipynb
mit
# read in and prepare the chrun data # Download the dataset import pandas as pd import numpy as np data = pd.read_csv('../datasets/churn.csv') # Create X and y # Select only the numeric features X = data.iloc[:, [1,2,6,7,8,9,10]].astype(np.float) # Convert bools to floats X = X.join((data.iloc[:, [4,5]] == 'no').ast...
Ironlors/SmartIntersection-Ger
Journal/data1.txt.ipynb
apache-2.0
#Create Lists time = [233.32,198.92,184.7,168.18,148.22,138.88,151.76,127.48,119.12,115.24,110.7,104.28,105.52,109.2,120.7401,147.027] motorTorque = [100,110,121,133.1,146.41,161.051,161.051,177.1561,194.8717,214.3589,235.7948,259.3743,285.3117,313.8429,345.2272,379.74992] print(time) print('elements in time: '+str(len...
crystalzhaizhai/cs207_yi_zhai
lectures/L13/L13.ipynb
mit
import reprlib class Sentence: def __init__(self, text): self.text = text self.words = text.split() def __getitem__(self, index): return self.words[index] def __len__(self): #completes sequence protocol, but not needed for iterable return len(self.word...
sdss/marvin
docs/sphinx/jupyter/Shanghai_Demo_Queries.ipynb
bsd-3-clause
# Python 2/3 compatibility from __future__ import print_function, division, absolute_import # import matplolib just in case import matplotlib.pyplot as plt # this line tells the notebook to plot matplotlib static plots in the notebook itself %matplotlib inline # this line does the same thing but makes the plots inter...
david4096/bioapi-examples
python_notebooks/1kg_metadata_service.ipynb
apache-2.0
from ga4gh.client import client c = client.HttpClient("http://1kgenomes.ga4gh.org") """ Explanation: GA4GH 1000 Genomes Metadata Service This example illustrates how to access the available datasets in a GA4GH server. Initialize client In this step we create a client object which will be used to communicate with the ...
hunterowens/data-pipelines
chicago/chicago_permits.ipynb
mit
%matplotlib inline import datetime from datetime import date import pickle import StringIO import zipfile import luigi import requests import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.colors import Normalize, rgb2hex from matplotlib.collections import P...
root-mirror/training
OldSummerStudentsCourse/2016/notebooks/FillHistogram_Example_py.ipynb
gpl-2.0
import ROOT """ Explanation: Access TTree in Python using PyROOT and fill a histogram <hr style="border-top-width: 4px; border-top-color: #34609b;"> First import the ROOT Python module. End of explanation """ %jsroot on """ Explanation: Optional: activate the JavaScript visualisation to produce interactive plots. ...
opensanca/trilha-python
04-python-prat/data_science/Python and Data Science.ipynb
mit
import pandas as pd import matplotlib %matplotlib inline """ Explanation: Python and Data Science Mariana Lopes 28/07/2016 Trabalhando com o Jupyter Ferramenta que permite criação de código, visualização de resultados e documentação no mesmo documento (.ipynb) Modo de comando: esc para ativar, o cursor fica inativo Mo...
Upward-Spiral-Science/team1
code/ScrapingImageData_Jay.ipynb
apache-2.0
import matplotlib.pyplot as plt %matplotlib inline import numpy as np import urllib2 from __future__ import division plt.style.use('ggplot') np.random.seed(1) url = ('https://raw.githubusercontent.com/Upward-Spiral-Science' '/data/master/syn-density/output.csv') data = urllib2.urlopen(url) csv = np.genfromtxt(d...
nkoep/pymanopt
examples/MoG.ipynb
bsd-3-clause
import autograd.numpy as np np.set_printoptions(precision=2) import matplotlib.pyplot as plt %matplotlib inline # Number of data points N = 1000 # Dimension of each data point D = 2 # Number of clusters K = 3 pi = [0.1, 0.6, 0.3] mu = [np.array([-4, 1]), np.array([0, 0]), np.array([2, -1])] Sigma = [np.array([[3, 0...
arogozhnikov/einops
docs/3-einmix-layer.ipynb
mit
from einops.layers.torch import EinMix as Mix """ Explanation: EinMix: universal toolkit for advanced MLP architectures Recent progress in MLP-based architectures demonstrated that very specific MLPs can compete with convnets and transformers (and even outperform them). EinMix allows writing such architectures in a mo...
peendebak/SPI-rack
examples/D4.ipynb
mit
# Import SPI Rack, D5a module and D4 module from spirack import SPI_rack, D4_module, D5a_module from time import sleep import numpy as np %matplotlib notebook import matplotlib.pyplot as plt """ Explanation: D4 example notebook Example notebook of the D4 2 channel, 24-bit ADC module. To use this notebook, we need a ...
idies/pyJHTDB
examples/isotropic_spectra_1D.ipynb
apache-2.0
import numpy as np import pyJHTDB from pyJHTDB.dbinfo import mhd1024, isotropic1024coarse from pyJHTDB import libJHTDB import time as tt #import mkl_fft """ Explanation: import numpy and pyJHTDB stuff End of explanation """ %matplotlib inline import matplotlib.pyplot as plt """ Explanation: now import matplotlib an...
mbohlool/client-python
examples/notebooks/intro_notebook.ipynb
apache-2.0
from kubernetes import client, config """ Explanation: Managing kubernetes objects using common resource operations with the python client Some of these operations include; create_xxxx : create a resource object. Ex create_namespaced_pod and create_namespaced_deployment, for creation of pods and deployments respecti...
fcollonval/coursera_data_visualization
BasicLinearRegression.ipynb
mit
# Magic command to insert the graph directly in the notebook %matplotlib inline # Load a useful Python libraries for handling data import pandas as pd import numpy as np import statsmodels.formula.api as smf import scipy.stats as stats import seaborn as sns import matplotlib.pyplot as plt from IPython.display import Ma...
pablormier/yabox
notebooks/yabox-de-animations.ipynb
apache-2.0
%matplotlib inline # Load local version of yabox import sys sys.path.insert(0, '../') from yabox import DE, PDE import numpy as np # Imports required for 3d animations import matplotlib import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from matplotlib import animation,...
jhconning/Dev-II
notebooks/Stata_in_jupyter.ipynb
bsd-3-clause
%matplotlib inline import seaborn as sns import pandas as pd import statsmodels.formula.api as smf import ipystata """ Explanation: Stata and R in a jupyter notebook The jupyter notebook project is now designed to be a 'language agnostic' web-application front-end for any one of many possible software language kernels...
carian2996/big_data
capstone_project/clustering/scripts/Week 3 pySpark MLlib Clustering.ipynb
gpl-2.0
import pandas as pd from pyspark.mllib.clustering import KMeans, KMeansModel from numpy import array """ Explanation: <br><br><br><br><br><h1 style="font-size:4em;color:#2467C0">Welcome to Week 3</h1><br><br><br> <div style="color:black;font-family: Arial; font-size:1.1em;line-height:65%"> <p style="line-height:31px;...
statsmodels/statsmodels.github.io
v0.12.1/examples/notebooks/generated/robust_models_1.ipynb
bsd-3-clause
%matplotlib inline from statsmodels.compat import lmap import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: M-Estimators for Robust Linear Modeling End of explanation """ norms = sm.robust.norms def plot_weights(support, weights_func, xlabels, xt...
bjshaw/phys202-project
galaxy_project/Ib) Base Question Visualization.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy.integrate import odeint from IPython.html.widgets import interact, interactive, fixed from IPython.display import YouTubeVideo from plotting_function import plotter,static_plot,com_plot,static_plot_com """ Explanation: Base Question Visu...
NREL/bifacial_radiance
docs/tutorials/8 - Advanced topics - Calculating Power Output and Electrical Mismatch.ipynb
bsd-3-clause
import bifacial_radiance import os from pathlib import Path testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP'/ 'Tutorial_08') if not os.path.exists(testfolder): os.makedirs(testfolder) simulationName = 'tutorial_8' moduletype = "test-module" albedo = 0.25 lat = 37.5 lon = -77.6 ...
rvuduc/cse6040-ipynbs
26--logreg-mle-numopt.ipynb
bsd-3-clause
import pandas as pd import seaborn as sns import numpy as np from IPython.display import display %matplotlib inline import plotly.plotly as py from plotly.graph_objs import * # @YOUSE: Fill in your credentials (user ID, API key) for Plotly here py.sign_in ('USERNAME', 'APIKEY') %reload_ext autoreload %autoreload 2 ...
bowenliu16/deepchem
examples/broken/protein_ligand_complex_notebook.ipynb
gpl-3.0
%load_ext autoreload %autoreload 2 %pdb off # set DISPLAY = True when running tutorial DISPLAY = False # set PARALLELIZE to true if you want to use ipyparallel PARALLELIZE = False import warnings warnings.filterwarnings('ignore') dataset_file= "../datasets/pdbbind_core_df.pkl.gz" from deepchem.utils.save import load_f...
Applied-Groundwater-Modeling-2nd-Ed/Chapter_4_problems-1
P4.4_Flopy_Hubbertville_areal_model_with_pumping.ipynb
gpl-2.0
%matplotlib inline import sys import os import shutil import numpy as np from subprocess import check_output # Import flopy import flopy """ Explanation: <img src="AW&H2015.tiff" style="float: left"> <img src="flopylogo.png" style="float: center"> Problem P4.4 Adding Pumping to Hubbertville Areal Model In Problem P4....
charlesll/RamPy
examples/Resample_and_flip_spectra.ipynb
gpl-2.0
%matplotlib inline import sys sys.path.append("../") import numpy as np import scipy from matplotlib import pyplot as plt import rampy as rp from sklearn import preprocessing """ Explanation: Use of resample and flipsp functions Spectral data are often delivered with decreasing and non-regularly sampled frequencies. ...
samzhang111/frontpages
analysis/data_exploration.ipynb
gpl-3.0
# <help> # <api> from collections import defaultdict import datetime import pandas as pd import numpy as np def load_data(clean=True, us=True): df = pd.read_sql_table('frontpage_texts', 'postgres:///frontpages') df_newspapers = pd.read_sql_table('newspapers', 'postgres:///frontpages') if clean:...
RedHatInsights/insights-core
docs/notebooks/Filters Tutorial.ipynb
apache-2.0
""" Some imports used by all of the code in this tutorial """ import sys sys.path.insert(0, "../..") from __future__ import print_function import os from insights import run from insights.specs import SpecSet from insights.core import IniConfigFile from insights.core.plugins import parser, rule, make_fail from insights...
ledeprogram/algorithms
class7/donow/Zhao_Shengying_DoNow_7.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data, plot, and create a logistic regressi...
gdementen/larray
doc/source/tutorial/tutorial_indexing.ipynb
gpl-3.0
from larray import * """ Explanation: Indexing, Selecting and Assigning Import the LArray library: End of explanation """ # let's start with population = load_example_data('demography_eurostat').population population """ Explanation: Import the test array population: End of explanation """ population['Belgium', '...
google/starthinker
colabs/airflow.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: Airflow Composer Example Demonstration that uses Airflow/Composer native, Airflow/Composer local, and StarThinker tasks in the same generated DAG. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "License"); ...
albahnsen/ML_RiskManagement
notebooks/07_decision_trees.ipynb
mit
# vehicle data import pandas as pd import zipfile with zipfile.ZipFile('../datasets/vehicles_train.csv.zip', 'r') as z: f = z.open('vehicles_train.csv') train = pd.io.parsers.read_table(f, index_col=False, sep=',') # before splitting anything, just predict the mean of the entire dataset train['prediction'] = t...
jdhp-docs/python_notebooks
nb_sci_ai/ai_ml_id3_fr.ipynb
mit
import pandas as pd """ Explanation: L'apprentissage d'arbres de décision avec ID3 TODO: - faire un document séparé pour ID3, CART, C4.5, etc. ou mettre tout dans ce notebook ??? End of explanation """ data_list = [['soleil', 'chaud', 'haute', 'faux', 'NePasJouer'], ['soleil', 'chaud', 'haute', 'vrai', ...
ES-DOC/esdoc-jupyterhub
notebooks/cmcc/cmip6/models/sandbox-3/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-3', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: CMCC Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topics: Tracers. Properties:...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/recommendation_systems/solutions/wals.ipynb
apache-2.0
import os PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1 # Do not change these os.environ["PROJECT"] = PROJECT os.environ["BUCKET"] = BUCKET os.environ["REGION"]...
ES-DOC/esdoc-jupyterhub
notebooks/inpe/cmip6/models/sandbox-2/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'inpe', 'sandbox-2', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: INPE Source ID: SANDBOX-2 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radi...
robblack007/clase-cinematica-robot
Practicas/practica4/Problemas.ipynb
mit
def DH_simbolico(a, d, α, θ): from sympy import Matrix, sin, cos # YOUR CODE HERE raise NotImplementedError() from sympy import Matrix, sin, cos, pi from nose.tools import assert_equal assert_equal(DH_simbolico(0,0,0,pi/2), Matrix([[0,-1,0,0],[1,0,0,0], [0,0,1,0],[0,0,0,1]])) assert_equal(DH_simbolico(0,0,...
palrogg/foundations-homework
Data_and_databases/Homework_4_Paul_Ronga_graded.ipynb
mit
numbers_str = '496,258,332,550,506,699,7,985,171,581,436,804,736,528,65,855,68,279,721,120' """ Explanation: Grade: 12 / 11 Homework #4 These problem sets focus on list comprehensions, string operations and regular expressions. Problem set #1: List slices and list comprehensions Let's start with some data. The followi...
brettavedisian/phys202-2015-work
assignments/assignment08/InterpolationEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np sns.set_style('white') from scipy.interpolate import griddata """ Explanation: Interpolation Exercise 2 End of explanation """ # Collaborated with James A. on this part x=np.empty(1,) x[0]=0 x=np.hstack((x,[-5]*11)) for i i...
jupyter/nbgrader
nbgrader/tests/apps/files/test-v2.ipynb
bsd-3-clause
def squares(n): """Compute the squares of numbers from 1 to n, such that the ith element of the returned list equals i^2. """ ### BEGIN SOLUTION if n < 1: raise ValueError("n must be greater than or equal to 1") return [i ** 2 for i in range(1, n + 1)] ### END SOLUTION """ Exp...
ramseylab/networkscompbio
class07_clustcoeff_python3_template.ipynb
apache-2.0
from igraph import Graph from igraph import summary import pandas import numpy import timeit from pympler import asizeof import bintrees """ Explanation: CS446/519 - Class Session 7 - Transitivity (Clustering Coefficients) In this class session we are going to compute the local clustering coefficient of all vertices i...
junhwanjang/DataSchool
Lecture/12. Scikit-Learn & statsmodels 패키지 소개/4) Scikit-Learn 패키지의 샘플 데이터 - classification용.ipynb
mit
from sklearn.datasets import load_iris iris = load_iris() print(iris.DESCR) df = pd.DataFrame(iris.data, columns=iris.feature_names) sy = pd.Series(iris.target, dtype="category") sy = sy.cat.rename_categories(iris.target_names) df['species'] = sy df.tail() sns.pairplot(df, hue="species") plt.show() """ Explanation: ...
metpy/MetPy
v0.10/_downloads/4d64a32e8cfca4a5a78f2d1f68ae3c83/Gradient.ipynb
bsd-3-clause
import numpy as np import metpy.calc as mpcalc from metpy.units import units """ Explanation: Gradient Use metpy.calc.gradient. This example demonstrates the various ways that MetPy's gradient function can be utilized. End of explanation """ data = np.array([[23, 24, 23], [25, 26, 25], ...
1x0r/pspis
lectures/lecture_04/demos-1.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt n = 19 print("Каждая цифра представлена матрицей формы ", digits.data[n, :].shape) """ Explanation: Какую задачу можно поставить для этого набора данных? End of explanation """ digit = 255 - digits.data[n, :].reshape(8, 8) plt.imshow(digit, cmap='gray', interpolatio...
yugangzhang/CHX_Pipelines
2017_3/Mask_pipeline_2017_V6.ipynb
bsd-3-clause
from chxanalys.chx_libs import (np, roi, time, datetime, os, getpass, db, get_images,LogNorm, plt,ManualMask) from chxanalys.chx_libs import cmap_albula, cmap_vge, random from chxanalys.chx_generic_functions import (get_detector, get_meta_data,create_user_folder, get_fields...
anthonyng2/FX-Trading-with-Python-and-Oanda
Oanda v20 REST-oandapyV20/06.00 Position Management.ipynb
mit
import pandas as pd import oandapyV20 import oandapyV20.endpoints.positions as positions import configparser config = configparser.ConfigParser() config.read('../config/config_v20.ini') accountID = config['oanda']['account_id'] access_token = config['oanda']['api_key'] client = oandapyV20.API(access_token=access_toke...
AtmaMani/pyChakras
udemy_ml_bootcamp/Python-for-Data-Analysis/NumPy/Numpy Indexing and Selection.ipynb
mit
import numpy as np #Creating sample array arr = np.arange(0,11) #Show arr """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> NumPy Indexing and Selection In this lecture we will discuss how to select elements or groups of elements from an array. End of explanation """ ...
geoneill12/phys202-2015-work
assignments/assignment07/AlgorithmsEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import numpy as np """ Explanation: Algorithms Exercise 2 Imports End of explanation """ def find_peaks(a): """Find the indices of the local maxima in a sequence.""" b = np.array(a) c = b.max() return b[c] p1 = find_peaks(...
JorisBolsens/PYNQ
Pynq-Z1/notebooks/examples/overlay_download.ipynb
bsd-3-clause
# Using base.bit located in pynq package from pynq import Overlay ol = Overlay("base.bit") """ Explanation: Downloading Overlays This notebook demonstrates how to download an FPGA overlay and examine programmable logic state. 1. Instantiating an overlay To instantiate an overlay, a bitstream file name is passed to t...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/robust_models_1.ipynb
bsd-3-clause
%matplotlib inline from statsmodels.compat import lmap import numpy as np from scipy import stats import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: M-Estimators for Robust Linear Modeling End of explanation """ norms = sm.robust.norms def plot_weights(support, weights_func, xlabels, xt...
metpy/MetPy
dev/_downloads/5f6dfc4b913dc349eba9f04f6161b5f1/GINI_Water_Vapor.ipynb
bsd-3-clause
import cartopy.feature as cfeature import matplotlib.pyplot as plt import xarray as xr from metpy.cbook import get_test_data from metpy.io import GiniFile from metpy.plots import add_metpy_logo, add_timestamp, colortables # Open the GINI file from the test data f = GiniFile(get_test_data('WEST-CONUS_4km_WV_20151208_2...
statkclee/ThinkStats2
code/chap02soln-kor.ipynb
gpl-3.0
%matplotlib inline import chap01soln resp = chap01soln.ReadFemResp() resp.columns """ Explanation: 통계적 사고 (2판) 연습문제 (thinkstats2.com, think-stat.xwmooc.org)<br> Allen Downey / 이광춘(xwMOOC) 여성 응답자 파일을 읽어들여 변수명을 표시하시오. End of explanation """ import thinkstats2 hist = thinkstats2.Hist(resp.totincr) """ Explanation: 응답...
JeffreyWang98/JeffreyWang98.github.io
Projects/Grains/Grains.ipynb
mit
import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt """ Explanation: Tutorial content This tutorial will show how to use the Feed Grains open data source, provided by the USDA Economic Research Service to learn about grain production and historical effects. This tutorial will also ...
dolittle007/dolittle007.github.io
notebooks/GP-introduction.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import matplotlib.cm as cmap cm = cmap.inferno import numpy as np import scipy as sp import theano import theano.tensor as tt import theano.tensor.nlinalg import sys sys.path.insert(0, "../../..") import pymc3 as pm """ Explanation: Gaussian Process Regression Gauss...
zingale/pyreaclib
library-examples-filtering.ipynb
bsd-3-clause
%matplotlib inline import pynucastro as pyna library_file = '20180201ReaclibV2.22' mylibrary = pyna.rates.Library(library_file) """ Explanation: Using RateFilter to Search Rates in a Library The Library class in pynucastro provides a high level interface for reading files containing one or more Reaclib rates and the...
laantoi/fun-with-python
coin_games.ipynb
mit
import numpy as np import matplotlib.pyplot as plt """ Explanation: Coin games: classical and quantum In this notebook we play a set of interesting coin tossing games using coins obeying classical (games 1-2) and quantum (game 3) mechanics. Game 1: Gambler's ruin A gambler enters the casino with a bankroll of size $k$...
thonstad/acoustical_monitoring
notebooks/Synchronization.ipynb
bsd-3-clause
# the cross-correlation function in statsmodels does not use FFT so it is really slow # from statsmodels.tsa.stattools import ccf # res = ccf(ts1[1][200000:400000,1],ts2[1][200000:400000,1]) """ Explanation: Let's try to find the lag of asynchrony by looking at the cross-correlation. End of explanation """ # Warning...
tpin3694/tpin3694.github.io
machine-learning/adaboost_classifier.ipynb
mit
# Load libraries from sklearn.ensemble import AdaBoostClassifier from sklearn import datasets """ Explanation: Title: Adaboost Classifier Slug: adaboost_classifier Summary: How to conduct adaboost classifier and boosting in scikit-learn for machine learning in Python. Date: 2017-09-18 12:00 Category: Machine Lea...
sysid/nbs
lstm/LTSM_BasicStockMarket.ipynb
mit
dpath = 'data/basic/' #path_to_dataset = dpath + 'household_power_consumption.txt' %mkdir -p dpath !wget -P $dpath https://raw.githubusercontent.com/jaungiers/LSTM-Neural-Network-for-Time-Series-Prediction/master/sinwave.csv !wget -P $dpath https://raw.githubusercontent.com/jaungiers/LSTM-Neural-Network-for-Time-Serie...
rsignell-usgs/notebook
ROMS/sandy_sgrid.ipynb
mit
from netCDF4 import Dataset url = ('http://geoport.whoi.edu/thredds/dodsC/clay/usgs/users/' 'jcwarner/Projects/Sandy/triple_nest/00_dir_NYB05.ncml') nc = Dataset(url) """ Explanation: pysgrid only works with raw netCDF4 (for now!) End of explanation """ import pysgrid # The object creation is a lit...
philmui/datascience
lecture06.stats/lecture06.eu.data.ipynb
mit
import pandas as pd df = pd.DataFrame() df """ Explanation: Data Import, Merge, Wrangle We will be using the real dataset for extra-EU trade percentages for a few different years to illutrate the real-world usage of data import, cleanse, merge and wrangle. End of explanation """ for chunk in pd.read_csv('data/ext_...
ubcgif/gpgLabs
notebooks/mag/Mag_Induced2D.ipynb
mit
import numpy as np from geoscilabs.mag import Mag, Simulator %matplotlib inline """ Explanation: This is the <a href="https://jupyter.org/">Jupyter Notebook</a>, an interactive coding and computation environment. For this lab, you do not have to write any code, you will only be running it. To use the notebook: - "Shi...
massimo-nocentini/on-python
vigenere/vigenere-cryptoanalysis.ipynb
mit
import itertools from itertools import * from copy import copy, deepcopy from heapq import * from random import * import matplotlib.pyplot as plt from collections import Counter from sympy import * init_printing() %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 10.0) """ Explanation: Vigenere cipher crypt...
umutkarahan/Project100
sample/Tuples.ipynb
bsd-2-clause
mancoloji = "Barış Manço", "Mançoloji", 1999 print(mancoloji) """ Explanation: Tuples Kullanımı Tuples'lar değişmeyen sıralardır. Bir kere tanımlandığı zaman değiştirmenin imkanı yoktur. Listelere göre tubles farklı tipteki elemanlara sahip olabilir. Örneğin; End of explanation """ benbilirim = ("Barış Manço", "Ben ...
decisionstats/pythonfordatascience
Web+Scraping.ipynb
apache-2.0
r = urllib.request.urlopen('https://www.rottentomatoes.com/franchise/batman_movies').read() #Using Beautiful Soup Library to parse the data soup = BeautifulSoup(r, "lxml") type(soup) len(str(soup.prettify())) soup soup.prettify() #We convert the data to a string format using str. #Note in R we use str for struct...
catalyst-cooperative/pudl
test/validate/notebooks/validate_bf_eia923.ipynb
mit
%load_ext autoreload %autoreload 2 import sys import pandas as pd import sqlalchemy as sa import pudl import warnings import logging logger = logging.getLogger() logger.setLevel(logging.INFO) handler = logging.StreamHandler(stream=sys.stdout) formatter = logging.Formatter('%(message)s') handler.setFormatter(formatter...
tylere/docker-tmpnb-ee
notebooks/2 - Earth Engine API Examples/2 - EE 101.ipynb
apache-2.0
from IPython.display import Image """ Explanation: Earth Engine 101 This workbook is an introdution to Earth Engine analysis in an IPython Notebook, using the Python API. The content is similar to what is covered in the Introduction to the Earth Engine API workshop using the Earth Engine Javascript "Playground". Let'...
sotirisnik/dqn
dqn.ipynb
mit
import gym import time import random import numpy as np from collections import deque import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' """ Explanation: Import essential libraries End of explanation """ import tensorflow as tf import keras.backend.tensorflow_backend as KTF def get_session(gpu_fraction=0.3): ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/machine_learning_in_the_enterprise/solutions/distributed-hyperparameter-tuning.ipynb
apache-2.0
import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLOUD_NOTEBOOK: USER_FLAG = "--user" # Install necess...
owenjhwilliams/ASIIT
FindSwirlLocs-AstroScriptV1.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import h5py from importlib import reload import sep f = h5py.File('/Users/Owen/Dropbox/Data/ABL/SBL PIV data/RNV45-RI2.mat') #list(f.keys()) Swirl = np.asarray(f['Swirl']) X = np.asarray(f['X']) Y = np.asarray(f['Y']) X = np.transpose(X,(1,0)) Y...
antoniomezzacapo/qiskit-tutorial
community/algorithms/iterative_phase_estimation_algorithm.ipynb
apache-2.0
from math import pi import numpy as np import scipy as sp import matplotlib.pyplot as plt %matplotlib inline # importing Qiskit from qiskit import Aer, IBMQ from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute from qiskit.tools.visualization import plot_histogram from qiskit...
nceder/nceder.github.io
course_materials/data-cleaning/data_cleaning.ipynb
gpl-3.0
#Using dir() and help() import pandas """ Explanation: # Extracting & Cleaning Data with Python $~$ “I Have a Data File, Now What?” $~$ Naomi Ceder naomi@naomiceder.tech @NaomiCeder projects.naomiceder.tech My main qualification? I'm quite old... <img src="/notebooks/old.jpg"> Who am I? Python since 2001 Author o...
olinguyen/shogun
doc/ipython-notebooks/pca/pca_notebook.ipynb
gpl-3.0
%pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') # import all shogun classes from shogun import * """ Explanation: Principal Component Analysis in Shogun By Abhijeet Kislay (GitHub ID: <a href='https://github.com/kislayabhi'>kislayabhi</a>) This notebook is about...
JakeColtman/BayesianSurvivalAnalysis
Full presentation.ipynb
mit
running_id = 0 output = [[0]] with open("E:/output.txt") as file_open: for row in file_open.read().split("\n"): cols = row.split(",") if cols[0] == output[-1][0]: output[-1].append(cols[1]) output[-1].append(True) else: output.append(cols) output = out...
jpn--/larch
book/example/101_swissmetro_mnl.ipynb
gpl-3.0
# TEST import os import pandas as pd pd.set_option("display.max_columns", 999) pd.set_option('expand_frame_repr', False) pd.set_option('display.precision', 3) import larch larch._doctest_mode_ = True from pytest import approx import larch.numba as lx import larch.numba as lx """ Explanation: 101: Swissmetro MNL Mode ...
TurkuNLP/BINF_Programming
supplementary/Sets and exceptions.ipynb
gpl-2.0
s=set() #this is how you create a set s.add(5) #this is how you add items to sets s.add("hi") s.add(5) s.add("ho") s.add("hi") s1=set([1,2,3,4,5]) #and you can also create sets from lists or any other iterables s2=set([4,5,6,7]) #sets allow basic set operations print("s1",s1) print("s2",s2) print("s1&s2",s1&s2) #int...
metpy/MetPy
v0.9/_downloads/53923345d98c487825399f76f4de00e7/Station_Plot_with_Layout.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import pandas as pd from metpy.calc import wind_components from metpy.cbook import get_test_data from metpy.plots import (add_metpy_logo, simple_layout, StationPlot, StationPlotLayout, wx_code_map) fr...
Scripta-Qumranica-Electronica/Data-Processing
Text_Extraction/Retrieving-text-with-the-SQE-API.ipynb
mit
import sys, json, copy from pprint import pprint try: import requests except ImportError: !conda install --yes --prefix {sys.prefix} requests import requests try: from genson import SchemaBuilder except ImportError: !conda install --yes --prefix {sys.prefix} genson from genson import Schem...
mattmcd/PyBayes
scripts/edward_simple.ipynb
apache-2.0
# Generative model mu_x = 10.0 sigma_x = 2.0 x_s = edm.Normal(mu_x, sigma_x) # Sample data produced by model n_samples = 100 samples = np.zeros(n_samples) with tf.Session() as sess: for i in range(n_samples): samples[i] = sess.run(x_s) # Descriptive statistics print('Mean: {}'.format(np.mean(samples))) pr...
pysg/caiq
CAIQ.ipynb
mit
pyplot.scatter(VolumenLiqVAP,PresionVAP, color = 'red', label = 'Líquido') pyplot.scatter(VolumenVapVAP,PresionVAP, color = 'blue', label = 'Vapor') pyplot.title('Diagrama Densidad-Presión') pyplot.legend(loc="upper right") pyplot.xlabel('Densidad [=] -') pyplot.ylabel('Presión [=] bar') """ Explanation: PyTher: UN...
besser82/shogun
doc/ipython-notebooks/structure/multilabel_structured_prediction.ipynb
bsd-3-clause
import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from __future__ import print_function try: from sklearn.datasets import make_classification except ImportError: import pip pip.main(['install', '--user', 'scikit-learn']) from sklearn.datasets import make_classification import...
BinRoot/TensorFlow-Book
ch02_basics/Concept01_defining_tensors.ipynb
mit
import tensorflow as tf import numpy as np """ Explanation: Ch 02: Concept 01 Defining tensors Import TensorFlow and Numpy: End of explanation """ m1 = [[1.0, 2.0], [3.0, 4.0]] m2 = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) m3 = tf.constant([[1.0, 2.0], [3.0, 4....