repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
shahariarrabby/Mail_Server
Receive and server Mail.ipynb
mit
__author__ = 'Shahariar Rabby' import email import imaplib import ctypes import getpass import threading from playsound import playsound """ Explanation: Recive Mail This file is imported by Server and Check ME. All function is define here. Importing all dependency End of explanation """ def user(): # ORG_EMAIL ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/markov_autoregression.ipynb
bsd-3-clause
%matplotlib inline from datetime import datetime from io import BytesIO import matplotlib.pyplot as plt import numpy as np import pandas as pd import requests import statsmodels.api as sm # NBER recessions from pandas_datareader.data import DataReader usrec = DataReader( "USREC", "fred", start=datetime(1947, 1,...
mne-tools/mne-tools.github.io
0.20/_downloads/460fe4a441caf01fe3a0ace1c9325a0d/plot_tf_lcmv.ipynb
bsd-3-clause
# Author: Roman Goj <roman.goj@gmail.com> # # License: BSD (3-clause) import mne from mne import compute_covariance from mne.datasets import sample from mne.event import make_fixed_length_events from mne.beamformer import tf_lcmv from mne.viz import plot_source_spectrogram print(__doc__) data_path = sample.data_path...
mne-tools/mne-tools.github.io
stable/_downloads/f1d68aba13226287585e777005a39f0a/15_handling_bad_channels.ipynb
bsd-3-clause
import os from copy import deepcopy import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False) ""...
metpy/MetPy
v1.1/_downloads/f8c7f51c50c58b17901913e49a5b977e/Inverse_Distance_Verification.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np from scipy.spatial import cKDTree from metpy.interpolate.geometry import dist_2 from metpy.interpolate.points import barnes_point, cressman_point from metpy.interpolate.tools import average_spacing, calc_kappa def draw_circle(ax, x, y, r, m, label): th = np.lins...
jrg365/gpytorch
examples/01_Exact_GPs/GP_Regression_Fully_Bayesian.ipynb
mit
import math import torch import gpytorch import pyro from pyro.infer.mcmc import NUTS, MCMC from matplotlib import pyplot as plt %matplotlib inline %load_ext autoreload %autoreload 2 # Training data is 11 points in [0,1] inclusive regularly spaced train_x = torch.linspace(0, 1, 6) # True function is sin(2*pi*x) with ...
ituethoslab/navcom-2017
repro/DAMD hashtag counts/DAMD hashtag counts.ipynb
gpl-3.0
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline """ Explanation: DAMD hashtag counts What other hashtags appear in the DAMD data than #damd. Which ones are popular, and how are the hashtags distributed? End of explanation """ damd = pd.read_csv("", index_col="tweet_id") damd['hashtags'] = dam...
numenta/nupic.research
projects/archive/continuous_learning/Correlation_experiments.ipynb
agpl-3.0
config_file = "experiments.cfg" experiment = SparseCorrExperiment(config_file=config_file) """ Explanation: Activity correlation metrics for networks trained on GSC This notebook shows a number of examples illustrating how correlated the activations of sparse or dense neural networks are when different GSC class input...
YaleDHLab/lab-workshops
apis/apis.ipynb
mit
import requests url = 'https://api.datamuse.com/words?sp=t??k' # get the content at the requested url response = requests.get(url) # get the JSON data in the response object data = response.json() print(data) """ Explanation: Getting Started with Application Programming Interfaces (APIs) APIs make it easy to colle...
jhprinz/openpathsampling
examples/tests/test_netcdfplus.ipynb
lgpl-2.1
import openpathsampling as paths from openpathsampling.netcdfplus import ( NetCDFPlus, ObjectStore, StorableObject, NamedObjectStore, UniqueNamedObjectStore, DictStore, ImmutableDictStore, VariableStore, StorableNamedObject ) import numpy as np from __future__ import print_functio...
H-E-L-P/XID_plus
docs/build/html/notebooks/examples/XID+IR_SED-Example-GP.ipynb
mit
from astropy.io import ascii, fits import pylab as plt %matplotlib inline from astropy import wcs import numpy as np import xidplus from xidplus import moc_routines import pickle """ Explanation: Import required modules End of explanation """ #Folder containing maps pswfits='/Users/pdh21/astrodata/COSMOS/P4/COSMO...
UWSEDS/LectureNotes
Spring2019/06a_Objects/Building Software With Objects.ipynb
bsd-2-clause
from IPython.display import Image Image(filename='Classes_vs_Objects.png') """ Explanation: Why Objects? Provide modularity and reuse through hierarchical structures Object oriented programming is a different way of thinking. Programming With Objects End of explanation """ # Definiting a Car class class Car(objec...
esa-as/2016-ml-contest
GCC_FaciesClassification/01 - Facies Classification - GCC-VALIDATION.ipynb
apache-2.0
# Initial imports for reading data and first observations import pandas as pd import bokeh.plotting as bk import numpy as np from sklearn import preprocessing from sklearn.model_selection import train_test_split from tpot import TPOTClassifier bk.output_notebook() # Input file paths train_path = r'../training_data....
natashabatalha/PandExo
notebooks/JWST_Running_Pandexo.ipynb
gpl-3.0
import warnings warnings.filterwarnings('ignore') import pandexo.engine.justdoit as jdi # THIS IS THE HOLY GRAIL OF PANDEXO import numpy as np import os #pip install pandexo.engine --upgrade """ Explanation: Getting Started Before starting here, all the instructions on the installation page should be completed! Here ...
manojkumar-github/NLP-TextAnalytics
EssayScoringSystem/BaselineModel.ipynb
mit
data.head() """ Explanation: Data Exploration End of explanation """ data["essay"][0] """ Explanation: To have a look how an essay content looks End of explanation """ for i in range(data.shape[0]): message = TextBlob(data["essay"][i]) #number of words data.set_value(i,'Essay_Length',len(mes...
imatge-upc/activitynet-2016-cvprw
notebooks/18 Visualization of Results Comparison.ipynb
mit
import random import os import numpy as np from work.dataset.activitynet import ActivityNetDataset dataset = ActivityNetDataset( videos_path='../dataset/videos.json', labels_path='../dataset/labels.txt' ) videos = dataset.get_subset_videos('validation') videos = random.sample(videos, 8) examples = [] for v in...
WomensCodingCircle/CodingCirclePython
Lesson08_Dictionaries/Dictionary - after class.ipynb
mit
fruit_season = { 'raspberry': 'May', 'apple' : 'September', 'peach' : 'July', 'grape' : 'August' } print(type(fruit_season)) print(fruit_season) """ Explanation: Dictionaries A dictionary is datatype that contains a series of key-value pairs. It is similar to a list except for that the indic...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_cluster_stats_evoked.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import io from mne.stats import permutation_cluster_test from mne.datasets import sample print(__doc__) """ Explanation: Permutation F-test on sensor data with 1D c...
CyberCRI/dataanalysis-herocoli-redmetrics
v1.52.2/Tests/2.1 Google form analysis tests.ipynb
cc0-1.0
%run "../Functions/2. Google form analysis.ipynb" # Localplayerguids of users who answered the questionnaire (see below). # French #localplayerguid = 'a4d4b030-9117-4331-ba48-90dc05a7e65a' #localplayerguid = 'd6826fd9-a6fc-4046-b974-68e50576183f' #localplayerguid = 'deb089c0-9be3-4b75-9b27-28963c77b10c' #localplayergu...
ssanderson/notebooks
quanto/examples/Groupby Example.ipynb
apache-2.0
pricing.head(10) """ Explanation: pricing is a DataFrame with the same structure as the return value of history on quantopian. End of explanation """ from pandas.tseries.tools import normalize_date def my_grouper(ts): "Function to apply to the index of the DataFrame to break it into groups." # Returns midni...
SJSlavin/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.""" maxima = np.array([]) if a[0] > a[1]: maxima = n...
Yatekii/glal3
versuch2/M1.ipynb
gpl-3.0
# define base values and measurements v1_s = 0.500 v1_sb1 = 1.800 v1_sb2 = 1.640 v1_m = np.mean([0.47, 0.46, 0.46, 0.46, 0.46, 0.47, 0.46, 0.46, 0.46, 0.46, 4.65 / 10]) * 1e-3 v1_T = np.mean([28.68 / 10, 28.91 / 10]) v1_cw = 0.75 v1_cw_u = 0.08 v1_A = 4*1e-6 v1_pl = 1.2041 def air_resistance(s, v): k = v1_cw * v...
mne-tools/mne-tools.github.io
0.23/_downloads/cfbef36033f8d33f28c4fe2cfa35314a/30_cluster_ftest_spatiotemporal.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Eric Larson <larson.eric.d@gmail.com> # License: BSD (3-clause) import os.path as op import numpy as np from scipy import stats as stats import mne from mne import spatial_src_adjacency from mne.stats import spatio_temporal_cluster_test, summariz...
minh-doan/deepometry
STEP_4_Test_and_Visualization_built-in_CNN.ipynb
bsd-3-clause
# Location of digested data input_directory = '/digested/' # Location of saved trained model model_directory = '/model_directory/' # Desired location for outputs output_directory = '/output_directory/' """ Explanation: ------------- User's settings ------------- End of explanation """ %matplotlib inline import ker...
c24b/c24b.github.io
projects/crawtext/Crawler2.ipynb
gpl-2.0
tocrawl = [] def crawl(url): html = download(url) page = parse(html) urls = extract_links(page) tocrawl.append(urls) return tocrawl starter_url = "www.example.com" tocrawl = crawl(starter_url) while len(tocrawl) != 0: for url in tocrawl: crawl(url) """ Explanation: # Cours 5 Introduct...
GoogleCloudPlatform/professional-services
examples/bigquery-table-access-pattern-analysis/pipeline-output_only.ipynb
apache-2.0
import src.pipeline_analysis as pipeline_analysis import ipywidgets as widgets from IPython.display import display import pandas as pd limited_imbalance_tables = [] def get_limited_imbalance_tables_df(limit): global limited_imbalance_tables limited_imbalance_tables_df = pipeline_analysis.get_tables_read_write_...
deepmind/deepmind-research
option_keyboard/gpe_gpi_experiments/generate_figures.ipynb
apache-2.0
#@title Util functions import csv import os from matplotlib import pyplot as plt import pandas as pd import seaborn as sns import tensorflow.compat.v1 as tf from tensorflow.compat.v1.io import gfile def read_csv_as_dataframe(path): with gfile.GFile(path, "r") as file: reader = csv.reader(file, delimiter=" ") ...
francesco-mannella/neunet-basics
course/perceptron-MNIST-simulation.ipynb
mit
%matplotlib inline from pylab import * from utils import * """ Explanation: The perceptron - Recognising the MNIST digits <div>Table of contents</div> <div id="toc"></div> End of explanation """ #----------------------------------------------------------- # training # Set the number of patterns n_patterns = 500 ...
parrt/msan501
notes/sqrt.ipynb
mit
def sqrt(n): "compute square root of n" PRECISION = 0.00000001 # stop iterating when we converge with this delta x_0 = 1.0 # pick any old initial value x_prev = x_0 while True: # Python doesn't have repeat-until loop so fake it #print(x_prev) x_new = 0.5 * (x_prev + n/x_prev) ...
gaufung/PythonStandardLibrary
FileSystem/mmap.ipynb
mit
import mmap with open('lorem.txt', 'r') as f: with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m: print('First 10 bytes via read :', m.read(10)) print('First 10 bytes via slice:', m[:10]) print('2nd 10 bytes via read :', m.read(10)) """ Explanation: Memory-map...
raphaelshirley/regphot
examples/NGC450.ipynb
mit
from regphot import git_version print("This notebook was run with regphot version: \n{}".format(git_version())) #Import relevant modules import matplotlib.pyplot as plt %matplotlib inline from astropy.io import fits from astropy.wcs import WCS from astropy.nddata import Cutout2D import numpy as np import aplpy from re...
InsightLab/data-science-cookbook
2020/04-unsupervised-learning-clustering/Notebook_Clustering_Assignment.ipynb
mit
# import libraries # linear algebra import numpy as np # data processing import pandas as pd # library of math import math # data visualization from matplotlib import pyplot as plt # datasets from sklearn import datasets # Scikit Learning hierarchical clustering from sklearn.cluster import AgglomerativeClustering ...
Python4AstronomersAndParticlePhysicists/PythonWorkshop-ICE
notebooks/10_03_Astronomy_PhotUtils.ipynb
mit
%matplotlib inline import numpy as np import math import matplotlib.pyplot as plt import seaborn from astropy.io import fits from astropy import units as u from astropy.coordinates import SkyCoord plt.rcParams['figure.figsize'] = (12, 8) plt.rcParams['font.size'] = 14 plt.rcParams['lines.linewidth'] = 2 plt.rcParams['x...
fest-research/deep-coin-demo
intro/tensorflow_intro.ipynb
apache-2.0
# first we need some data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) """ Explanation: Intro to TensorFlow The following is a small intro to how computational frameworks (theano, tensorflow) work in general. The MNIST dataset It's just a set...
Mdround/fastai-deeplearning1
deeplearning1/nbs/lesson5.ipynb
apache-2.0
import utils_MDR from utils_MDR import * """ Explanation: MDR: and needs by GPU-fan code, too... End of explanation """ from keras.datasets import imdb idx = imdb.get_word_index() """ Explanation: Setup data We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment....
letsgoexploring/teaching
winter2017/econ129/python/Econ129_Class_05_Complete.ipynb
mit
# Use the requests module to download money growth and inflation data url = 'http://www.briancjenkins.com/data/quantitytheory/csv/qtyTheoryData.csv' r = requests.get(url,verify=True) with open('qtyTheoryData.csv','wb') as newFile: newFile.write(r.content) """ Explanation: Class 5: Pandas Pandas is a Python p...
starbuck10/CS109a_DataScience_UserRatings_Team_Project
Final Milestone/MovieLens/.ipynb_checkpoints/Final Milestone-checkpoint.ipynb
mit
EUCLIDEAN = 'euclidean' MANHATTAN = 'manhattan' PEARSON = 'pearson' def read_ratings_df(): date_parser = lambda time_in_secs: datetime.utcfromtimestamp(float(time_in_secs)) return pd.read_csv('ml-latest-small/ratings.csv', parse_dates=['timestamp'], date_parser=date_parser) class MovieData(object): def ...
fonnesbeck/scientific-python-workshop
notebooks/High-level Plotting.ipynb
cc0-1.0
%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt # Set some Pandas options pd.set_option('display.notebook_repr_html', False) pd.set_option('display.max_columns', 20) pd.set_option('display.max_rows', 25) normals = pd.Series(np.random.normal(size=10)) normals.plot() """ Expla...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_artifacts_correction_maxwell_filtering.ipynb
bsd-3-clause
import mne from mne.preprocessing import maxwell_filter data_path = mne.datasets.sample.data_path() """ Explanation: Artifact correction with Maxwell filter This tutorial shows how to clean MEG data with Maxwell filtering. Maxwell filtering in MNE can be used to suppress sources of external intereference and compensa...
albahnsen/PracticalMachineLearningClass
exercises/E4-Regression-Linear&Logistic.ipynb
mit
import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt # read the data and set the datetime as the index income = pd.read_csv('https://github.com/albahnsen/PracticalMachineLearningClass/raw/master/datasets/income.csv.zip', index_col=0) income.head() income.shape """ Explanation: ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/building_production_ml_systems/labs/2_hyperparameter_tuning.ipynb
apache-2.0
PROJECT = "<YOUR PROJECT>" BUCKET = "<YOUR BUCKET>" REGION = "<YOUR REGION>" TFVERSION = "2.3.0" # TF version for AI Platform to use import os os.environ["PROJECT"] = PROJECT os.environ["BUCKET"] = BUCKET os.environ["REGION"] = REGION os.environ["TFVERSION"] = TFVERSION """ Explanation: Hyper-paramet...
abhi1509/deep-learning
sentiment-rnn/Sentiment_RNN_Solution.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
NYUDataBootcamp/Projects
MBA_S17/John-Chihyun-US SUV Demand.ipynb
mit
# import packages import pandas as pd # data management import matplotlib.pyplot as plt # graphics import numpy as np # numerical calculations import datetime as dt # handles dates import seaborn as seab # better graphics import pandas_datare...
hannorein/rebound
ipython_examples/EscapingParticles.ipynb
gpl-3.0
import rebound import numpy as np def setupSimulation(): sim = rebound.Simulation() sim.add(m=1., hash="Sun") sim.add(x=0.4,vx=5., hash="Mercury") sim.add(a=0.7, hash="Venus") sim.add(a=1., hash="Earth") sim.move_to_com() return sim sim = setupSimulation() sim.status() """ Explanation: Esc...
DavidNorman/tensorflow
tensorflow/lite/experimental/micro/examples/hello_world/create_sine_model.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...
dimtics/Network-Intrusion-Detection-Using-Machine-Learning-Techniques
Intrusion Detection using Machine Learning Techniques.ipynb
mit
# import relevant modules %matplotlib inline import matplotlib import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns import sklearn import imblearn # Ignore warnings import warnings warnings.filterwarnings('ignore') # Settings pd.set_option('display.max_columns', None) np.set_pr...
openconnectome/ndprojects
kasthuri2015_ramon_v1/Vesicle Count.ipynb
apache-2.0
import ndio.remote.OCP as OCP oo = OCP() token = "kasthuri2015_ramon_v1" """ Explanation: A count of the total number of annotated vesicles within the bounds (694×1794, 1750×2460, 1004×1379). End of explanation """ vesicle_cutout = oo.get_cutout(token, 'vesicle', 694, 1794, 1750, 2460, 1004, 1379, resolution=3) ""...
IsaacLab/LaboratorioIntangible
T3/.ipynb_checkpoints/T3.3-Social-Minimal-Interaction-checkpoint.ipynb
agpl-3.0
%matplotlib inline import numpy as np import scipy.io import scipy.signal as signal from matplotlib import pyplot as plt from pyeeg import dfa as dfa def readFilePerceptualCrossing(filename): data = scipy.io.loadmat(filename) size = len(data['dataSeries']) series = [data['dataSeries'][i][0] for i in range...
bjornstenqvist/faunus
examples/temper/temper.ipynb
mit
%matplotlib inline import matplotlib import matplotlib.cm as cm import numpy as np import matplotlib.pyplot as plt import jinja2, json, yaml, sys from math import log, fabs, pi, cos, sin from scipy.stats import ks_2samp number_of_replicas = 6 scale_array = np.geomspace(1, 0.1, number_of_replicas) temper = True # run w...
lancekrogers/Pycon2015PandasLesson
Exercises-1.ipynb
mit
titles.count() """ Explanation: How many movies are listed in the titles dataframe? End of explanation """ titles.sort('year').head() """ Explanation: 212811 What are the earliest two films listed in the titles dataframe? End of explanation """ t = titles t[t.title == 'Hamlet'].count() """ Explanation: Reproduct...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/10_recommend/cf_softmax_model/target/cfmodel_softmax_model_target.ipynb
apache-2.0
# Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.6 from __future__ import print_function import numpy as np import pandas as pd import collections from mpl_toolkits.mplot3d import Axes3D from IPython import display from matplotlib import pyplot as plt import sklearn import sklea...
CLEpy/CLEpy-MotM
Pandas/Pandas-motm.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Pandas CLEPY - August Module of the month Anurag Saxena @_asaxena Pandas - Python Data Analysis Library pandas.pydata.org Open Source High Performance Easy to use Data Structures and Data Analysis Tools End of explanation """ obj = pd.Series([1,3,4,5,6,7,8,9]) ...
karlstroetmann/Algorithms
Python/Chapter-05/Dual-Pivot-Quicksort-Array.ipynb
gpl-2.0
import random as rnd """ Explanation: An Array-Based Implementation of Dual-Pivot-Quicksort End of explanation """ def sort(L): quickSort(0, len(L) - 1, L) """ Explanation: The function $\texttt{sort}(L)$ sorts the list $L$ in place. End of explanation """ def quickSort(a, b, L): if b <= a: return...
xypan1232/pypdb
demos/advanced_demos.ipynb
mit
%pylab inline from IPython.display import HTML from pypdb.pypdb import * import pprint """ Explanation: pypdb advanced demos This is a set of basic examples of the ways that algorithmic querying with PyPDB can be used to perform advanced search tasks. Most of these examples combine multiple functions in the API in o...
dimonaks/siman
tutorials/surfaces.ipynb
gpl-2.0
import sys from IPython.display import Image from siman import header from siman.calc_manage import smart_structure_read from siman.geo import create_supercell, create_surface2, supercell %matplotlib inline """ Explanation: Instruction This tutorial explain how to build specific surfaces on the example of (111) surfa...
hbutler/InverseCCP
3 - Generate coupon probabilities - exponential.ipynb
mit
n = 20 #number of coupons scale = 1/n #scipy uses the scale parameter instead of lambda. Scale and lambda are reciprocals of each other. x = np.arange(n)+0.5 #arange goes from 0 to n-1, and I want it to go from 1 to n p_x = stat.expon.ppf(x/n, loc=0, scale=scale) print('unfilled probability: ', 1-np.sum(p_x)) p_x = p_...
tpin3694/tpin3694.github.io
regex/match_words_with_certain_ending.ipynb
mit
# Load regex package import re """ Explanation: Title: Match Words With A Certain Ending Slug: match_words_with_certain_ending Summary: Match Words With A Certain Ending Date: 2016-05-01 12:00 Category: Regex Tags: Basics Authors: Chris Albon Source: Regular Expressions Cookbook Preliminaries End of explanation """ ...
aasensio/elecciones2016
.ipynb_checkpoints/Sondeos Elecciones 2015-checkpoint.ipynb
mit
book = xlrd.open_workbook("sondeos.xlsx") sh = book.sheet_by_index(0) PP = [] PSOE = [] IU = [] UPyD = [] Podemos = [] Ciudadanos = [] fecha = [] mesEsp = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'] mesEng = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct'...
IBMDecisionOptimization/docplex-examples
examples/mp/jupyter/load_balancing.ipynb
apache-2.0
import sys try: import docplex.mp except: raise Exception('Please install docplex. See https://pypi.org/project/docplex/') """ Explanation: Use decision optimization to determine Cloud balancing. This tutorial includes everything you need to set up decision optimization engines, build mathematical programming ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/statespace_sarimax_faq.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd rng = np.random.default_rng(20210819) eta = rng.standard_normal(5200) rho = 0.8 beta = 10 epsilon = eta.copy() for i in range(1, eta.shape[0]): epsilon[i] = rho * epsilon[i - 1] + eta[i] y = beta + epsilon y = y[200:] from statsmodels.tsa.api import SARIM...
marcelomiky/PythonCodes
scikit-learn/scikit-learn-book/Chapter 2 - Supervised Learning - Text Classification with Naive Bayes.ipynb
mit
%pylab inline import IPython import sklearn as sk import numpy as np import matplotlib import matplotlib.pyplot as plt print 'IPython version:', IPython.__version__ print 'numpy version:', np.__version__ print 'scikit-learn version:', sk.__version__ print 'matplotlib version:', matplotlib.__version__ """ Explanation:...
xesscorp/skidl
examples/spice-sim-intro/spice-sim-intro.ipynb
mit
from IPython.core.display import HTML HTML(open('custom.css', 'r').read()) """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Spicing-It-Up!-(Sorry)" data-toc-modified-id="Spicing-It-Up!-(Sorry)-1"><span class="toc-item-num">1&nbsp;&nbsp;<...
google-coral/tutorials
train_lstm_timeseries_ptq_tf2.ipynb
apache-2.0
# 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 the L...
gschivley/ERCOT_power
Raw Data/ERCOT/Hourly wind generation/.ipynb_checkpoints/Exploring hourly wind data-checkpoint.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns fn2009 = 'rpt.00013424.0000000000000000.20141016.182537070.ERCOT_2009_Hourly_Wind_Output.xls' fn2015 = 'rpt.00013424.0000000000000000.ERCOT_2015_Hourly_Wind_Output.xlsx' df_2009 = pd.read_excel(fn2009, index...
probml/pyprobml
notebooks/book1/08/opt_flax.ipynb
mit
import sklearn import scipy import scipy.optimize import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") import itertools import time from functools import partial import os import numpy as np # np.set_printoptions(precision=3) np.set_printoptions(formatter={"float": lambda x: "{0:0.5f}".f...
ageron/tensorflow-safari-course
08_artifical_neural_networks_ex7ex8.ipynb
apache-2.0
from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf tf.__version__ import numpy as np %matplotlib inline import matplotlib.pyplot as plt """ Explanation: Try not to peek at the solutions when you go through the exercises. ;-) First let's make sure this notebook ...
mne-tools/mne-tools.github.io
dev/_downloads/bdc99305dd93336f2d973c05e0c46d24/25_automated_coreg.ipynb
bsd-3-clause
# Author: Jon Houck <jon.houck@gmail.com> # Guillaume Favelier <guillaume.favelier@gmail.com> # # License: BSD-3-Clause import numpy as np import mne from mne.coreg import Coregistration from mne.io import read_info data_path = mne.datasets.sample.data_path() # data_path and all paths built from it are pathl...
sspickle/sci-comp-notebooks
P09-RootFinding.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as pl N=100 z0=2.0 z=np.linspace(0,1.5,N) def leftS(z): return np.cos(z) def rightS(z,z0=z0): return z/z0 def f(z,z0=z0): return leftS(z)-rightS(z,z0) pl.grid() pl.title("Investigating $\cos(z)=z/z_0$") pl.ylabel("left, right and difference...
Hvass-Labs/TensorFlow-Tutorials
02_Convolutional_Neural_Network.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import confusion_matrix import time from datetime import timedelta import math # Use TensorFlow v.2 with this old v.1 code. # E.g. placeholder variables and sessions have changed in TF2. import tensorflow.compat.v1 as tf tf.disa...
AllenDowney/ModSimPy
notebooks/rabbits3.ipynb
mit
%matplotlib inline from modsim import * """ Explanation: Modeling and Simulation in Python Rabbit example Copyright 2017 Allen Downey License: Creative Commons Attribution 4.0 International End of explanation """ system = System(t0 = 0, t_end = 20, juvenile_pop0 = 0, ...
jrrembert/cybernetic-organism
dato/deeplearning/Deep Features for Image Classification.ipynb
gpl-2.0
import graphlab """ Explanation: Using deep features to build an image classifier Fire up GraphLab Create End of explanation """ image_train = graphlab.SFrame('image_train_data/') image_test = graphlab.SFrame('image_test_data/') """ Explanation: Load a common image analysis dataset We will use a popular benchmark d...
hglanz/phys202-2015-work
assignments/assignment04/MatplotlibEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math """ Explanation: Matplotlib Exercise 1 Imports End of explanation """ import os assert os.path.isfile('yearssn.dat') """ Explanation: Line plot of sunspot data Download the .txt data for the "Yearly mean total sunspot number [1700 - n...
mp4096/controlboros
examples/simple_linear_siso_system.ipynb
bsd-3-clause
from controlboros import StateSpaceBuilder import matplotlib.pyplot as plt import numpy as np from scipy import signal %matplotlib inline %config InlineBackend.figure_format = 'retina' """ Explanation: Simulating a simple linear SISO system Mikhail Pak, 2017 End of explanation """ t_begin, t_end = 0.0, 10.0 """ Ex...
QuantEcon/QuantEcon.notebooks
ddp_ex_optgrowth_py.ipynb
bsd-3-clause
%matplotlib inline from __future__ import division, print_function import numpy as np import scipy.sparse as sparse import matplotlib.pyplot as plt from quantecon import compute_fixed_point from quantecon.markov import DiscreteDP """ Explanation: DiscreteDP Example: Discrete Optimal Growth Model Daisuke Oyama Faculty...
toros-astro/epio2017_EELT_MCDM
slides/slides.ipynb
bsd-3-clause
display(data) """ Explanation: European Extremely Large Telescope site selection A comparison between real selection and multicriteria-decision-analysis suggestions Juan B Cabral – Bruno O Sanchez – Manuel Starck Cuffini Instituto de Astronomía Teórica y Experimental jbcabral@oac.unc.edu.ar- bruno@oac.unc.edu.ar- mst...
adbuerger/casiopeia
examples/ipython_notebooks/demo_casiopeia.ipynb
lgpl-3.0
import pylab as pl import casadi as ca import casiopeia as cp """ Explanation: A Schur Complement Method for Optimum Experimental Design in the Presence of Process Noise Adrian Bürger (1,2), Dimitris Kouzoupis (2), Angelika Altmann-Dieses (1), Moritz Diehl (2,3) (1) Faculty of Management Science and Engineering, Kar...
phoebe-project/phoebe2-docs
development/tutorials/MESH.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: 'mesh' Datasets and Options Setup Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab). End of explanation """ import phoebe logger = phoebe.logger() b = phoebe.defa...
pysg/pyther
parameters_eos.ipynb
mit
import numpy as np import pandas as pd import pyther as pt """ Explanation: Parámetros de ecuaciones cúbicas de estado En esta sección se presenta la clase ## que es la encargada de establecer los parámetros que se utilizan para las ecuaciones de estado SRK, PR y RKPR. En el caso de las dos primeras se tiene un enfoqu...
bt3gl/Machine-Learning-Resources
ml_notebooks/first_steps_with_tensor_flow.ipynb
gpl-2.0
# 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 the L...
intel-analytics/BigDL
python/chronos/use-case/network_traffic/network_traffic_autots_forecasting_deprecated.ipynb
apache-2.0
def get_drop_dates_and_len(df, allow_missing_num=3): """ Find missing values and get records to drop """ missing_num = df.total.isnull().astype(int).groupby(df.total.notnull().astype(int).cumsum()).sum() drop_missing_num = missing_num[missing_num > allow_missing_num] drop_datetimes = df.iloc[dro...
julienchastang/unidata-python-workshop
notebooks/Metpy_Introduction/Introduction to MetPy.ipynb
mit
# Import the MetPy unit registry from metpy.units import units length = 10.4 * units.inches width = 20 * units.meters print(length, width) """ Explanation: <div style="width:1000 px"> <div style="float:right; width:98 px; height:98px;"> <img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_st...
pycrystem/pycrystem
doc/demos/01 GaAs Nanowire - Data Inspection - Preprocessing - Unsupervised Machine Learning.ipynb
gpl-3.0
# Changing the matplotlib background will give you interactive #%matplotlib qt5 %matplotlib inline import hyperspy.api as hs import pyxem as pxm import numpy as np """ Explanation: Data Inspection- Preprocessing - Unsupervised ML This tutorial demonstrates the most important basic steps involved in the analysis of s...
higee/amazon-helpful-review
3_model selection_evalutation.ipynb
mit
# baseline confirmation, implying that model has to perform at least as good as it from sklearn.dummy import DummyClassifier clf_Dummy = DummyClassifier(strategy='most_frequent') clf_Dummy = clf_Dummy.fit(X_train, y_train) print('baseline score =>', round(clf_Dummy.score(X_test, y_test), 2)) """ Explanation: RandomFo...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/cmip6/models/sandbox-2/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-2', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-2 Sub-Topics: Radiative Forcings. Propertie...
jhjungCode/pytorch-tutorial
02_Linear_regression.ipynb
mit
import torch from torch.autograd import Variable x = Variable(torch.Tensor([[1], [2], [3]])) y = Variable(torch.Tensor([[1], [2], [3]])) w = Variable(torch.randn(1, 1), requires_grad = True) b = Variable(torch.randn(1), requires_grad = True) learning_rate = 1e-2 # trainning for i in range(1000) : # network mod...
csadorf/signac
doc/signac_204_External_Tools.ipynb
bsd-3-clause
%%bash signac --help """ Explanation: 2.4 External Tools The following section demonstrates how to use the signac command line interface (CLI) in conjunction with other tools. End of explanation """ % pwd % rm -rf projects/tutorial/cli % mkdir -p projects/tutorial/cli % cp idg projects/tutorial/cli """ Explanation:...
ioos/system-test
content/downloads/notebooks/2015-12-07-NGDC_CSW_QueryForIOOSRAs_UUID.ipynb
unlicense
from owslib.csw import CatalogueServiceWeb endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw' csw = CatalogueServiceWeb(endpoint, timeout=30) """ Explanation: In the previous example we investigated if it was possible to query the NGDC CSW Catalog to extract records matching an IOOS RA acronym. However, we could not...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/62_Registration_Tuning.ipynb
apache-2.0
import SimpleITK as sitk # Utility method that either downloads data from the network or # if already downloaded returns the file name for reading from disk (cached data). %run update_path_to_download_script from downloaddata import fetch_data as fdata # Always write output to a separate directory, we don't want to p...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session09/Day1/gps/02-Inference.ipynb
mit
!tar -zxvf s9_gp_dat.tar.gz !mv *.txt data/ """ Explanation: Inference with GPs The dataset needed for this worksheet can be downloaded. Once you have downloaded s9_gp_dat.tar.gz, and moved it to this folder, execute the following cell: End of explanation """ import numpy as np from scipy.linalg import cho_factor ...
ireapps/cfj-2017
exercises/15. Web scraping (Part 5)-working.ipynb
mit
# base URL # results page URL # pattern for inmate detail URLs """ Explanation: Let's scrape some inmate data Our goal in this exercise is to scrape the roster of inmates in the Hennepin County Jail into a CSV. Step 1: Can we get everyone? What happens when we click the search box without entering a first or last...
dtamayo/MachineLearning
Day1/08_featureselection_cv.ipynb
gpl-3.0
import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.feature_selection import SelectKBest, f_regression from sklearn.cross_validation import cross_val_score # read in the advertising dataset data = pd.read_csv('data/Advertising.csv', index_col=0) # create a Python list...
evangelistalab/forte
tutorials/Tutorial_01.01_forte_api.ipynb
lgpl-3.0
import psi4 import forte """ Explanation: Forte Tutorial 1.01: Running forte in Jupyter notebooks In this tutorial we are going to explore how to interact with forte in Jupyter notebooks using the Python API. Import modules The first step necessary to interact with forte is to import psi4 and forte End of explanation...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/migration/UJ2,12 Custom Training Prebuilt Container TF Keras.ipynb
apache-2.0
! pip3 install -U google-cloud-aiplatform --user """ Explanation: Vertex SDK: Train & deploy a TensorFlow model with hosted runtimes (aka pre-built containers) Installation Install the latest (preview) version of Vertex SDK. End of explanation """ ! pip3 install google-cloud-storage """ Explanation: Install the Goo...
cliburn/sta-663-2017
notebook/10B_Numba.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt """ Explanation: Just-in-time compilation (JIT) For programmer productivity, it often makes sense to code the majority of your application in a high-level language such as Python and only optimize code bottlenecks identified by profiling. One way to speed up these bot...
daniel-koehn/Theory-of-seismic-waves-II
01_Analytical_solutions/lecture_notebooks/5_Greens_function_acoustic_1-3D.ipynb
gpl-3.0
# Execute this cell to load the notebook's style sheet, then ignore it from IPython.core.display import HTML css_file = '../../style/custom.css' HTML(open(css_file, "r").read()) """ Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 parts of this notebook ...
IanHawke/ET-NumericalMethods-2016
solutions/03-hyperbolic-pdes.ipynb
mit
import numpy from matplotlib import pyplot %matplotlib notebook """ Explanation: Hyperbolic PDEs Most formulations of the Einstein equations for the spacetime (with $c=1$) look roughly like wave equations $$ \frac{\partial^2 \phi}{\partial t^2} = \nabla^2 \phi. $$ We will focus on the simple $1+1$d case $$ \frac{\part...
xaibeing/cn-deep-learning
tutorials/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...
timcera/tsgettoolbox
notebooks/tsgettoolbox-nwis-api.ipynb
bsd-3-clause
%matplotlib inline from tsgettoolbox import tsgettoolbox """ Explanation: tsgettoolbox and tstoolbox - Python Programming Interface 'tsgettoolbox nwis ...': Download data from the National Water Information System (NWIS) This notebook is to illustrate the Python API usage for 'tsgettoolbox' to download and work with d...
olivertomic/hoggorm
examples/RV_&_RV2/RV_and_RV2_on_sensory_and_fluorescence_data.ipynb
bsd-2-clause
import hoggorm as ho import hoggormplot as hop import pandas as pd import numpy as np """ Explanation: RV and RV2 coefficient on Sensory and Fluorescence data This notebook illustrates how to use the hoggorm package to carry out partial least squares regression (PLSR) on multivariate data. Furthermore, we will learn h...
alienmortar/GREAT2014
Untitled0.ipynb
mit
apple = 5 orange = 6 total = apple + orange print(total) mugs = 12 plates = 5 tea_cup = 8 total = 3 * mugs + 2 * plates + tea_cup print(total) age = 32 name = 'Jacky' married = True height = 1.75 # Hi I am just a line of comment # print('Ignore me....') print("You can only see me") result = 1/3 print (result) n...