repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
probml/pyprobml
notebooks/misc/GCP_CC.ipynb
mit
# Hints from : # https://medium.com/analytics-vidhya/how-to-access-files-from-google-cloud-storage-in-colab-notebooks-8edaf9e6c020 # https://stackoverflow.com/questions/57772453/login-on-colab-with-gcloud-without-service-account """ Explanation: <a href="https://colab.research.google.com/github/probml/probml-notebooks...
Aniruddha-Tapas/Applied-Machine-Learning
Miscellaneous/Leaf Classification.ipynb
mit
import os from sklearn.tree import DecisionTreeClassifier, export_graphviz import pandas as pd import numpy as np from sklearn.cross_validation import train_test_split from sklearn import cross_validation, metrics from sklearn.ensemble import RandomForestClassifier from sklearn.naive_bayes import BernoulliNB from sklea...
rdhyee/webtech-learning
notebooks/qgrid_learning.ipynb
apache-2.0
import warnings warnings.filterwarnings('ignore') NEED_TO_INSTALL = True import qgrid if NEED_TO_INSTALL: qgrid.nbinstall(overwrite=True) # copies javascript dependencies to your /nbextensions folder qgrid.set_defaults(remote_js=False, precision=4) # https://github.com/quantopian/qgrid/pull/49#issue-1219...
yl565/statsmodels
examples/notebooks/recursive_ls.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from pandas_datareader.data import DataReader np.set_printoptions(suppress=True) """ Explanation: Recursive least squares Recursive least squares is an expanding window version of ordinary least squa...
sraejones/phys202-2015-work
days/day13/ODEs.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import seaborn as sns """ Explanation: Ordinary Differential Equations Learning Objectives: Understand the numerical solution of ODEs and use scipy.integrate.odeint to solve and explore ODEs numerically. Imports End of explanation """ tmax = 10.0 ...
geodynamics/burnman
contrib/ipython/Compute_seismic_velocities_beginner.ipynb
gpl-2.0
%matplotlib inline import os, sys, numpy as np, matplotlib.pyplot as plt sys.path.insert(1,os.path.abspath('../..')) """ Explanation: BurnMan - Compute seismic velocities - simple case Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU GPL v2 or later. Released under GPL v2 or later. This example s...
kgrodzicki/machine-learning-specialization
course-2-regression/notebooks/Overfitting_Demo_Ridge_Lasso.ipynb
mit
import graphlab import math import random import numpy from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Overfitting demo Create a dataset based on a true sinusoidal relationship Let's look at a synthetic dataset consisting of 30 points drawn from the sinusoid $y = \sin(4x)$: End of explanation ...
phoebe-project/phoebe2-docs
development/tutorials/compute.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: Compute Now that we have datasets added to our Bundle, our next step is to run the forward model and compute a synthetic model for each of these datasets. Setup Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running ...
texaspse/blog
media/f16-scientific-python/week4/week4.ipynb
mit
k = np.array([1,3,5,5,6,6,7,10,23123123,31232]) # create a new array k k[1] k[0] k[4] k[10] # even though the list has 9 items, the index actually goes from 0 to 9 k[9] """ Explanation: Review Before we start let's do some quick review from last time. Let's create a new numpy arrray. Fill it with any values yo...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch6-Problem_6-25.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 6 Problem 6-25 End of explanation """ Vstart_Vrun = 1/sqrt(3) print(''' Vstart_Vrun = {:.1f} % ===================='''.format(Vstart_Vrun*100)) """ Explanation: Description In this chapter, we learned that a step-down autotransforme...
karlstroetmann/Formal-Languages
Python/FSM-2-Dot.ipynb
gpl-2.0
def dfa2string(Fsm): states, sigma, delta, q0, final = Fsm result = '' n = 0 statesToNames = {} for q in states: statesToNames[q] = f'S{n}' n += 1 result += 'states: {S0, ..., ' + f'S{n-1}' + '}\n\n' result += f'start state: {statesToNames[q0]}' + '\n\n' result += 'sta...
danamkaplan/py-Goldsberry
docs/0. Introduction.ipynb
mit
import goldsberry import pandas as pd goldsberry.__version__ """ Explanation: An Introduction to py-Goldsberry py-Goldsberry is a Python package that makes it easy to interface with the http://stats.nba.com and retrieve the data in a more analyzable format. This is the first in a series of tutorials that walk through...
TomTranter/OpenPNM
examples/extractions/Working with Extracted Networks.ipynb
mit
import warnings import scipy as sp import numpy as np import porespy as ps import openpnm as op import matplotlib.pyplot as plt ws = op.Workspace() ws.settings["loglevel"] = 40 warnings.filterwarnings('ignore') %matplotlib inline np.random.seed(10) #NBVAL_IGNORE_OUTPUT im = ps.generators.overlapping_spheres(shape=[300...
srcole/qwm
burrito/.ipynb_checkpoints/Burrito_linear models-checkpoint.ipynb
mit
%config InlineBackend.figure_format = 'retina' %matplotlib inline import numpy as np import scipy as sp import matplotlib.pyplot as plt import pandas as pd import statsmodels.api as sm import seaborn as sns sns.set_style("white") """ Explanation: San Diego Burrito Analytics: Linear models Scott Cole 21 May 2016 This...
beeva-juanmanuelperez/beeva-best-practices
analytics/python/Ejercicio_practico_Titanic.ipynb
mit
import pandas input_file = 'static/titanic_data.csv' separador = "," dataset = pandas.read_csv(filepath_or_buffer=input_file, sep=separador) """ Explanation: Titanic Dataset Throughout this practice we will analyze the Titanic data set. In the [Kaggle website] (https://www.kaggle.com/c/titanic) we can find more info...
chapmanbe/nlm_clinical_nlp
MultiSentenceDocuments.ipynb
mit
import pyConTextNLP.pyConTextGraph as pyConText import pyConTextNLP.itemData as itemData from textblob import TextBlob import networkx as nx import pyConTextNLP.display.html as html from IPython.display import display, HTML reports = [ """IMPRESSION: Evaluation limited by lack of IV contrast; however, no evidence ...
alanhdu/AccessibleML
5. Dimensionality Reduction via Principal Components Analysis.ipynb
mit
from sklearn.decomposition import PCA import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D # 3D Plotting from scipy import stats import seaborn as sns # prettier styling for plots import ipywidgets # interactions %matplotlib inlin...
itzzthad/kaggle-exercises
rollingstones-dataset/ExploreAndVisualize.ipynb
mit
import pandas as pd from bokeh.charts import Donut, HeatMap, Histogram, Line, Scatter, show, output_notebook, output_file from bokeh.plotting import figure output_notebook() """ Explanation: Exploring and Visualizing the Rolling Stone's 500 Greatest Albums of All Time Data Source: https://www.kaggle.com/notgibs/500-g...
stephank16/enes_graph_use_case
neo4j_prov/notebooks/provio_intro.ipynb
gpl-3.0
%load_ext autoreload %autoreload 2 import os, sys # import_path = os.path.abspath('..') not necessary ? install_path = '/home/stephan/Repos/ENES-EUDAT/enes_graph_use_case' sys.path.append(install_path) from neo4j_prov import provio """ Explanation: Example notebook illustrating W3C prov --> neo4j graph generation ba...
kinshuk4/MoocX
misc/deep_learning_notes/Ch1 Intro to Deep Learning/004 - optimize batch training.ipynb
mit
%pylab inline %config InlineBackend.figure_format = 'retina' import numpy as np from random import random from IPython.display import FileLink, FileLinks def σ(z): return 1/(1 + np.e**(-z)) def σ_prime(z): return np.e**(z) / (np.e**z + 1)**2 def Plot(fn, *args, **kwargs): argLength = len(args); if ar...
machinelearningdeveloper/lc101-kc
December 12, 2016/Covered in class.ipynb
unlicense
class Animal: def __init__(self, name): self.name = name def pretty_version(self): return self.name def speak(self): pass def __str__(self): return '{} says {}'.format(self.pretty_version(), self.speak()) class Mammal(Animal): def __init...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session08/Day4/numba_intro.ipynb
mit
%matplotlib inline import matplotlib.pylab as plt import numpy as np import math from numba import jit, njit, vectorize """ Explanation: <a href="https://colab.research.google.com/github/evaneschneider/parallel-programming/blob/master/numba_intro.ipynb" target="_parent"><img src="https://colab.research.google.com/asse...
ivastar/clear
notebooks/grizli/grizli_model_and_fit.ipynb
mit
%matplotlib inline import time import os import numpy as np import matplotlib.pyplot as plt from astropy.io import fits import drizzlepac import grizli import glob from grizli import utils import importlib from grizli.prep import process_direct_grism_visit from hsaquery import query, overlaps from grizli.pipeline impor...
enakai00/jupyter_ml4se_commentary
Solutions/04-Graph-solution.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pandas import Series, DataFrame """ Explanation: グラフの描画 End of explanation """ data_x = np.linspace(-1,1,100) data_sin = np.sin(2*np.pi*data_x) data_cos = np.cos(2*np.pi*data_x) fig = plt.figure(figsize=(6,2)) subplot = fig.add_subplot(1,1,...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/building_production_ml_systems/solutions/4b_streaming_data_inference.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst import os import googleapiclient.discovery import shutil from google.cloud import bigquery from google.api_core.client_options import ClientOptions from matplotlib import pyplot as plt import numpy as np import tensorflow as tf from tensorflow import ...
ayush29feb/cs231n
assignment1/two_layer_net.ipynb
mit
# A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' # for auto-reloadi...
ReactiveX/RxPY
notebooks/reactivex.io/A Decision Tree of Observable Operators. Part I - Creation.ipynb
mit
reset_start_time(O.just) stream = O.just({'answer': rand()}) disposable = subs(stream) sleep(0.5) disposable = subs(stream) # same answer # all stream ops work, its a real stream: disposable = subs(stream.map(lambda x: x.get('answer', 0) * 2)) """ Explanation: A Decision Tree of Observable Operators Part 1: NEW Observ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/interactions_anova.ipynb
bsd-3-clause
%matplotlib inline from urllib.request import urlopen import numpy as np np.set_printoptions(precision=4, suppress=True) import pandas as pd pd.set_option("display.width", 100) import matplotlib.pyplot as plt from statsmodels.formula.api import ols from statsmodels.graphics.api import interaction_plot, abline_plot ...
mne-tools/mne-tools.github.io
dev/_downloads/9a8829bce25fe2d64489ddf54437cd3c/30_info.ipynb
bsd-3-clause
import os import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) """ Explanation: The Info data structure This tutori...
majkelx/astwro
examples/gapick_analyse.ipynb
mit
resultpath = '~/tmp/gapick_fine' """ Explanation: Analysis of gapick tool genetic algorithm's (GA) run Read more about PSF stars finding tool gapick in astwro documentation. Results directory gapick wrotes several results into directory specified by --out_dir parameter. Set path to results dir below: End of explanatio...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/mpi-esm-1-2-lr/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'mpi-esm-1-2-lr', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: MPI-M Source ID: MPI-ESM-1-2-LR Sub-Topics: Radiative Forcings. Propert...
google/starthinker
colabs/fred_series_to_bigquery.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: Federal Reserve Series Data Download federal reserve series. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/10_recommend/hybrid_recommendations/hybrid_recommendations_preproc.ipynb
apache-2.0
%%bash conda update -y -n base -c defaults conda source activate py2env pip uninstall -y google-cloud-dataflow conda install -y pytz pip install apache-beam[gcp]==2.9.0 """ Explanation: Neural network hybrid recommendation system on Google Analytics data preprocessing This notebook demonstrates how to implement a hybr...
TurkuNLP/BINF_Programming
lectures/week-2-entrez.ipynb
gpl-2.0
import Bio.SeqRecord as BSR """ Explanation: Sequence records, part 1 Instructions Read the chapter 4 and the sections 5.1, 9.3, 9.6, 9.15, and 9.16 of the Biopython tutorial. It is also recommended to read the sections 5.4, 5.5, 9.10, and 9.12, which are touched by this notebook. Objectives create and manipulate Seq...
glouppe/scikit-optimize
examples/strategy-comparison.ipynb
bsd-3-clause
import numpy as np np.random.seed(123) %matplotlib inline import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (10, 6) plt.set_cmap("viridis") """ Explanation: Comparing surrogate models Tim Head, July 2016. End of explanation """ from skopt.benchmarks import branin as _branin def branin(x, noise_level...
dereneaton/ipyrad
tests/ipsimdata.ipynb
gpl-3.0
## name for our sim data directory DIR = "./ipsimdata" ## A mouse MT genome used to stick our data into. INPUT_CHR = "/home/deren/Downloads/MusMT.fa" ## number of RAD loci to simulate NLOCI = 1000 ## number of inserts to reference genome and insert size N_INSERTS = 100 INSERT_SIZE = 50 """ Explanation: Simulate RAD...
walkon302/CDIPS_Recommender
notebooks/.ipynb_checkpoints/Feature_Weights-checkpoint.ipynb
apache-2.0
import sys import os sys.path.append(os.getcwd()+'/../') # our lib from lib.resnet50 import ResNet50 from lib.imagenet_utils import preprocess_input, decode_predictions #keras from keras.preprocessing import image from keras.models import Model # sklearn import sklearn from sklearn.linear_model import LogisticRegr...
jeanpat/DeepFISH
notebooks/Clean Dataset from their spurious pixels.ipynb
gpl-3.0
import os import h5py from matplotlib import pyplot as plt import numpy as np from numpy import newaxis from skimage import morphology as mo from scipy.ndimage import distance_transform_bf as distance def distanceTransform(bIm): #from pythonvision.org dist = distance(bIm) dist = dist.max() - dist dist...
Lattecom/HYStudy
scripts/[HYStudy 27th] Decorator Pattern 2.ipynb
mit
def statically_typed(*types, return_type=None): # Decorator factory def decorator(function): # 팩토리가 반환할 decorator 함수 @functools.wraps(function) def wrapper(*args, **kwargs): # Decorator가 반환할 래퍼 함수 if len(args) > len(types): raise ValueError("too many arguments") ...
BrownDwarf/ApJdataFrames
notebooks/Pecaut2013.ipynb
mit
%pylab inline %config InlineBackend.figure_format = 'retina' import seaborn as sns sns.set_context("notebook", font_scale=1.5) import warnings warnings.filterwarnings("ignore") from astropy.io import ascii """ Explanation: ApJdataFrames Pecault2013 Title: INTRINSIC COLORS, TEMPERATURES, AND BOLOMETRIC CORRECTIONS OF...
GoogleCloudPlatform/tf-estimator-tutorials
08_Text_Analysis/01 - Text Classification - SMS Ham vs. Spam - Data Preparation.ipynb
apache-2.0
import pandas as pd import string import re from sklearn import model_selection DATASET_FILE = 'data/sms-spam/SMSSpamCollection' dataset = pd.read_csv(DATASET_FILE, sep='\t', names=['class','sms']) dataset.head() print("Dataset Size: {}".format(len(dataset))) value_counts = dataset['class'].value_counts() print(value...
bhattacharjee/courses
CourseraDeepLearningSpecialization/2.HyperparameterTrainingRegularizationAndOptimization/Week1/Exercises/Gradient+Checking.ipynb
mit
# Packages import numpy as np from testCases import * from gc_utils import sigmoid, relu, dictionary_to_vector, vector_to_dictionary, gradients_to_vector """ Explanation: Gradient Checking Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking. You are ...
macks22/gensim
docs/notebooks/FastText_Tutorial.ipynb
lgpl-2.1
import gensim, os from gensim.models.wrappers.fasttext import FastText # Set FastText home to the path to the FastText executable ft_home = '/home/jayant/Projects/fastText/fasttext' # Set file names for train and test data data_dir = '{}'.format(os.sep).join([gensim.__path__[0], 'test', 'test_data']) + os.sep lee_tra...
drabastomek/learningPySpark
Chapter06/LearningPySpark_Chapter06.ipynb
gpl-3.0
import pyspark.sql.types as typ labels = [ ('INFANT_ALIVE_AT_REPORT', typ.IntegerType()), ('BIRTH_PLACE', typ.StringType()), ('MOTHER_AGE_YEARS', typ.IntegerType()), ('FATHER_COMBINED_AGE', typ.IntegerType()), ('CIG_BEFORE', typ.IntegerType()), ('CIG_1_TRI', typ.IntegerType()), ('CIG_2_TRI'...
AllenDowney/ProbablyOverthinkingIt
ess4.ipynb
mit
from __future__ import print_function, division import string import random import cPickle as pickle import numpy as np import pandas as pd import statsmodels.formula.api as smf import thinkstats2 import thinkplot import matplotlib.pyplot as plt import ess # colors by colorbrewer2.org BLUE1 = '#a6cee3' BLUE2 = '#1...
google-research/language
language/multiberts/coref.ipynb
apache-2.0
#@title Import libraries and multibootstrap code import re import os import numpy as np import pandas as pd import sklearn.metrics import scipy.stats from tqdm.notebook import tqdm # for progress indicator import multibootstrap #@title Import and configure plotting libraries import matplotlib from matplotlib impor...
gsentveld/lunch_and_learn
notebooks/Probabilistic_Graphical_Model.ipynb
mit
import os from dotenv import load_dotenv, find_dotenv # find .env automagically by walking up directories until it's found dotenv_path = find_dotenv() # load up the entries as environment variables load_dotenv(dotenv_path) """ Explanation: Exploring the files with Pandas Many statistical Python packages can deal wit...
dilanfd/fremont_bridge_bike_analysis
fremont_bridge_bike_analysis.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('seaborn') from module_code.data import get_fremont_data df = get_fremont_data() df.head() df.resample('W').sum().plot() # ugly looking graphs. Change to seaborn. # resample daily and find the rolling sum of 365 days. ax = df.resample('D').sum().roll...
zhouqifanbdh/liupengyuan.github.io
chapter2/homework/localization/4-5/201611680049(5).ipynb
mit
n = int(input('请输入你想取的整数的个数')) m = int(input('请输入取整范围的下限')) k = int(input('请输入取整范围的上限')) import random,math def get_num(): number = random.randint(m,k) return number i = 0 total = 0 while i < n: total = total + get_num() i = i + 1 print(get_num()) average = total/n math.sqrt(average) """ E...
queirozfcom/python-sandbox
python3/notebooks/boosting/.ipynb_checkpoints/effect-of-categories-credit-default-checkpoint.ipynb
mit
def fix_status(current_value): if current_value == -2: return 'no_consumption' elif current_value == -1: return 'paid_full' elif current_value == 0: return 'revolving' elif current_value in [1,2]: return 'delay_2_mths' elif current_value in [3,4,5,6,7,8,9]: return 'delay_3+_mths' else: return 'o...
wei-Z/Python-Machine-Learning
code/ch06/ch06.ipynb
mit
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scikit-learn # to install watermark just uncomment the following line: #%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py """ Explanation: Sebastian Raschka, 2015 https://github.com/rasbt/python-...
Unidata/unidata-python-workshop
notebooks/Bonus/Siphon_XARRAY_Cartopy_HRRR.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline # Resolve the latest HRRR dataset from siphon.catalog import get_latest_access_url hrrr_catalog = "http://thredds.ucar.edu/thredds/catalog/grib/NCEP/HRRR/CONUS_2p5km/catalog.xml" latest_hrrr_ncss = get_latest_access_url(hrrr_catalog, "NetcdfSubset"...
KushajveerSingh/Data-Science-Libraries
Python/Advancd Python.ipynb
mit
if __name__ == "__main__": # Do anything you want pass """ Explanation: Python is a programming language. Python is often refereed as a scripting language as scripting languages are often interpreted and not compiled.<br> End of explanation """ # If you want to give arguments to a function as a list def f(x,...
rjleveque/ptha_tutorial
Notebooks/Make_Transects_interactive.ipynb
bsd-2-clause
%pylab inline %matplotlib notebook from __future__ import print_function import sys, os from ipywidgets import interact from IPython.display import Image, display from ptha_paths import data_dir, events_dir """ Explanation: Make Transects (interactive) This notebook illustrates how to make transects of event results...
oditorium/blog
iPython/Various-ConvertingOsxKeychainToNotes.ipynb
agpl-3.0
path = '/Volumes/---/keychains' #!ls -l $path """ Explanation: Converting on OSX Keychain into Text Notes The purpose of this notebook is to export the secured notes from an Apple keychain into separate files. It is pretty rough, but generally this only needs to be done once (at least for me this was the case) so no...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/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', 'noaa-gfdl', 'sandbox-3', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topics: Tracers. P...
snth/ctdeep
PyconZA-2016.ipynb
mit
import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D batch_size = 128 nb_classes = 10 nb_epoch = 15 # input image dimensions img_rows, img_cols = 28, 28 # number of convolutional filters to use nb_filters = ...
ES-DOC/esdoc-jupyterhub
notebooks/csiro-bom/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', 'csiro-bom', 'sandbox-2', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CSIRO-BOM Source ID: SANDBOX-2 Topic: Seaice Sub-Topics: Dynamics, Thermodyna...
AllenDowney/ModSim
soln/chap23.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
mne-tools/mne-tools.github.io
0.23/_downloads/029173f022506572bcefa009b440732f/evoked_arrowmap.ipynb
bsd-3-clause
# Authors: Sheraz Khan <sheraz@khansheraz.com> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.datasets.brainstorm import bst_raw from mne import read_evokeds from mne.viz import plot_arrowmap print(__doc__) path = sample.data_path() fname = path + '/MEG/sample/samp...
michaelaye/planet4
notebooks/ground_projection.ipynb
isc
from hirise_tools.downloads import download_RED_product from hirise_tools.products import RED_PRODUCT_ID import logging from nbtools.logging import setup_live_logging from planet4 import io, region_data db = io.DBManager() roi = region_data.Potsdam() obsids = roi.all_obsids obsids obsids = db.obsids len(obsids) s...
coolharsh55/advent-of-code
2016/python3/Day20.ipynb
mit
import re numbers = re.compile('(\d+)') UPPER_LIMIT = 4294967295 with open('../inputs/day20.txt', 'r') as f: data = [ tuple(map( int, numbers.findall(line))) for line in f.readlines()] data.sort() rule_index = 0 n = 0 while n <= UPPER_LIMIT: for i in range(rule_index, le...
rpreen/xcsf
python/notebooks/example_rmux.ipynb
gpl-3.0
from __future__ import annotations import random from typing import Final import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm import xcsf """ Explanation: This example demonstrates XCSF (single-step) reinforcement learning applied to the real-multiplexer problem. Classifiers are composed of hyp...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/formulas.ipynb
bsd-3-clause
import numpy as np # noqa:F401 needed in namespace for patsy import statsmodels.api as sm """ Explanation: Formulas: Fitting models using R-style formulas Since version 0.5.0, statsmodels allows users to fit statistical models using R-style formulas. Internally, statsmodels uses the patsy package to convert formulas...
h2oai/h2o-dev
h2o-py/demos/H2O_tutorial_eeg_eyestate.ipynb
apache-2.0
import h2o # Start an H2O Cluster on your local machine h2o.init() """ Explanation: H2O Tutorial: EEG Eye State Classification Author: Erin LeDell Contact: erin@h2o.ai This tutorial steps through a quick introduction to H2O's Python API. The goal of this tutorial is to introduce through a complete example H2O's capab...
marcelomiky/PythonCodes
codes/back_to_basics/Codes_Mastering_Python.ipynb
mit
def filter_modulo(items, modulo): output_items = [] for i in range(len(items)): if items[i] % modulo: output_items.append(items[i]) return output_items def filter_modulo(items, modulo): for item in items: if item % modulo: yield item """ Explanation: Beautiful i...
martinjrobins/hobo
examples/toy/model-lotka-volterra.ipynb
bsd-3-clause
import pints import pints.toy model = pints.toy.LotkaVolterraModel() print('Outputs: ' + str(model.n_outputs())) print('Parameters: ' + str(model.n_parameters())) """ Explanation: Lotka-Volterra toy model The LotkaVolterraModel describes the relationship between two interacting species, where one preys on the other....
ueapy/ueapy.github.io
content/notebooks/2016-03-11-exceptions.ipynb
mit
try: # try executing this piece of code x = '2' + 3 # this will throw an error, because you can't add integer and string except: # if there is any error above, go here print('an error occured') """ Explanation: Today was an exceptional meeting. Why? Because we talked about such thing as exceptions in ...
halexan/cs231n
assignment2/FullyConnectedNets.ipynb
mit
# As usual, a bit of setup import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solver import Solver %matplotlib inline ...
bbglab/adventofcode
2020/claudia/2020_12_03/code.ipynb
mit
input_f = './input.txt' """ Explanation: Day 3 End of explanation """ def find_trees(input_f, move_right, move_down): """Find the trees in the path""" trees = 0 pointer = 0 number_of_columns = 0 with open(input_f, 'r') as fd: for row, line in enumerate(fd, 0): ...
AllenDowney/ModSim
python/soln/chap14.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
simkovic/simkovic.github.io
_ipynb/No Way Anova - Logistic Regression truimphs Anova.ipynb
mit
from scipy.stats import scoreatpercentile as sap clr=(0.2, 0.5, 0.6) %pylab inline plt.figure(figsize=(6,4)) plt.subplot(2,2,1);plt.title('alpha') x=np.arange(1,9,0.1) for a in np.arange(2,9).tolist(): y=1/(1+exp(a-1*x))*1+0 plt.plot(x,y,'b') plt.grid(b=False,axis='x');plt.ylim([0,1]);plt.xlim([1,8]) plt.subplo...
pbutenee/ml-tutorial
release/1/recommendation_engine.ipynb
mit
import numpy as np import pandas as pd import sklearn.metrics.pairwise """ Explanation: Recommendation Engine In this tutorial we are going to build a simple recommender system using collaborative filtering. You'll be learning about the popular data analysis package pandas along the way. 1. The import statements End o...
wgm2111/ellipsoidal-outlier-detector
example_ellipsoidal_outlier_filter_new_points.ipynb
gpl-3.0
%matplotlib inline # Future from __future__ import print_function # Numpy imports import numpy as np import numpy.random as random import scipy as sp import scipy.linalg as la # Import matplotlib.pyplot import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # My imports from ellipsoidal_outlie...
geoffbacon/semrep
semrep/data/evaluation/framenet/framenet.ipynb
mit
import numpy as np import pandas as pd from nltk.corpus import framenet as fn """ Explanation: FrameNet I see three ways of getting features from FrameNet: Does word $j$ evoke frame $i$? Something with frame relations Something with frame elements End of explanation """ def get_lus(frame): """Helper to get lexe...
jmhsi/justin_tinker
data_science/courses/deeplearning1/nbs/statefarm.ipynb
apache-2.0
from theano.sandbox import cuda cuda.use('gpu0') %matplotlib inline from __future__ import print_function, division path = "data/state/" #path = "data/state/sample/" import utils; reload(utils) from utils import * from IPython.display import FileLink batch_size=64 """ Explanation: Enter State Farm End of explanation...
maartenbreddels/vaex
docs/source/example_arrow.ipynb
mit
!ls -alh /Users/maartenbreddels/datasets/nytaxi/nyc_taxi2015.arrow import vaex """ Explanation: Arrow Vaex supports Arrow. We will demonstrate vaex+arrow by giving a quick look at a large dataset that does not fit into memory. The NYC taxi dataset for the year 2015 contains about 150 million rows containing informati...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/art_and_science_of_ml/labs/learning_rate.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Install Sklearn !python3 -m pip install --user sklearn import os import tensorflow.keras import matplotlib.pyplot as plt import pandas as pd import tensorflow as tf from tensorflow import feature_column as fc from tensorflow.keras import layers fr...
CSB-book/CSB
good_code/solutions/Jiang2013_solution.ipynb
gpl-3.0
import csv with open('../data/Jiang2013_data.csv') as csvfile: # set up csv reader and specify correct delimiter reader = csv.DictReader(csvfile, delimiter = '\t') taxa = [] r_values = [] for row in reader: taxa.append(row['Taxon']) r_values.append(float(row['r'])) """ Explanation:...
MarsUniversity/ece387
website/block_2_kinematics/lsn7/puma.ipynb
mit
%matplotlib inline # Let's grab some libraries to help us manipulate symbolic equations from __future__ import print_function from __future__ import division import numpy as np import sympy from sympy import symbols, sin, cos, pi, simplify def makeT(a, alpha, d, theta): # create a modified DH homogenious matrix ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb
apache-2.0
import numpy as np import tensorflow as tf from matplotlib import pyplot as plt print(tf.__version__) """ Explanation: Getting started with TensorFlow Learning Objectives 1. Practice defining and performing basic operations on constant Tensors 1. Use Tensorflow's automatic differentiation capability 1. Learn ho...
metpy/MetPy
v0.5/_downloads/upperair_soundings.ipynb
bsd-3-clause
from datetime import datetime import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import numpy as np import metpy.calc as mpcalc from metpy.io import get_upper_air_data from metpy.plots import Hodograph, SkewT """ Explanation: Upper Air Sounding Tutorial Upper air analysis is...
mathinmse/mathinmse.github.io
Lecture-09-Matrices-and-Rotations.ipynb
mit
%matplotlib inline import numpy as np import sympy as sp sp.init_session(quiet=True) ?sp.rot_axis3 x = sp.symbols('\\theta') sp.rot_axis3(x) """ Explanation: Laboratory 09: Matrices and Rotations (Crystallography) Background The purpose of this laboratory is to understand and apply the concept of an agebraic group ...
bearing/dosenet-analysis
Programming Lesson Modules/Module 5- Other Forms of Visualization.ipynb
mit
%matplotlib inline import csv import io import urllib.request import matplotlib.pyplot as plt from datetime import datetime import numpy as np url = 'https://radwatch.berkeley.edu/sites/default/files/pictures/rooftop_tmp/weather.csv' response = urllib.request.urlopen(url) reader = csv.reader(io.TextIOWr...
JustinShenk/sonic-face
PrepareData.ipynb
mit
import os import numpy as np import matplotlib matplotlib.use('TkAgg') # For displaying animation import pandas as pd import matplotlib.pyplot as plt import matplotlib.animation as animation from sklearn import svm as svm from sklearn.externals import joblib from sklearn import linear_model as lm from sklearn import p...
abhinav-upadhyay/intro-to-python
notebooks/Dictionary.ipynb
bsd-2-clause
empty_dictionary = {} print empty_dictionary """ Explanation: Python Dictionary Dictionaries can be used to store key, value pairs in Python for example: {'first_name': 'abhinav', 'last_name': 'upadhay'} Ordering of the items in the dictionary is not guranteed They are good for fast search or lookup operations Creat...
springcoil/PyDataLondonTutorial
.ipynb_checkpoints/LogisticRegScikitlearn-checkpoint.ipynb
mit
import pandas as pd import numpy as np from sklearn import linear_model from sklearn.cross_validation import train_test_split data = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data", header=None, names=['age', 'workclass', 'fnlwgt', 'education-categorical', 'edu...
tlkh/Generating-Inference-from-3D-Printing-Jobs
PCA Test.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from sklearn import decomposition from sklearn import datasets import csv %run 'preprocessor.ipynb' #our own preprocessor functions """ Explanation: PCA Test Principal component analysis (PCA) is the linear dimensionality reduction using Singular Value Decomposition...
marshal789/Lectures-On-Machine-Learning
K Nearest Neighbors/KNN.ipynb
mit
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np %matplotlib inline """ Explanation: K Nearest Neighbors For this we will use a classfied dataset.The feature column names are hidden but we are given the data and the target classes. We will use KNN to create a model that dire...
ES-DOC/esdoc-jupyterhub
notebooks/csiro-bom/cmip6/models/sandbox-3/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: CSIRO-BOM Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timestepping Framework,...
nvergos/DAT-ATX-1_Project
Notebooks/2c. Supervised Learning - Text Mining for Classification.ipynb
mit
import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns sns.set(rc={"axes.labelsize": 15}); # Some nice default configuration for plots plt.rcParams['figure.figsize'] = 10, 7.5; plt.rcParams['axes.grid'] = True;...
atulsingh0/MachineLearning
python_DC/IntoductionToDataBase_#1.3.ipynb
gpl-3.0
# import """ Explanation: Advanced SQLAlchemy Queries End of explanation """ # # Import create_engine function # from sqlalchemy import create_engine # # Create an engine to the census database # engine = create_engine('mysql+pymysql://student:datacamp@courses.csrrinzqubik.us-east-1.rds.amazonaws.com:3306/census') ...
tensorflow/text
docs/tutorials/text_generation.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
eds-uga/csci1360e-su17
lectures/L16.ipynb
mit
import numpy as np np.random.seed(3908544) # Generate two random datasets. data1 = np.random.normal(loc = 0, scale = 58, size = 1000) data2 = 200 * np.random.random(1000) - 100 # What are their means and variances? print("Dataset 1 average: {:.2f} (+/- {:.2f})".format(data1.mean(), data1.std())) print("Dataset 2 aver...
yw-fang/readingnotes
machine-learning/handson_scikitlearn_tf_2017/ch02-notebook.ipynb
apache-2.0
In the first example of chapter 02,we use this [dataset](./datasets/housing/housing.tgz) (Note that it's a compressed file with extension of tgz) Cerntaily, we can download the database from the github by hand, and then decompress this file into csv file, but it's preferable to create a small function to do that. It i...
jrossyra/adaptivemd
examples/tutorial/1_example_setup_project.ipynb
lgpl-2.1
from adaptivemd import Project """ Explanation: Tutorial 1- AdaptiveMD basics First we cover some basics demonstrating the use of AdaptiveMD objects to get you going. We will briefly talk about resources files generators how to run a simple trajectory All of these objects from the adaptivemd package are used to orga...
jepegit/cellpy
dev_utils/batch_notebooks/cellpy_batch_processing_DEV_ocv.ipynb
mit
%load_ext autoreload %autoreload 2 import numpy as np import pandas as pd import matplotlib.pyplot as plt import cellpy from cellpy import prms from cellpy import prmreader from cellpy.utils import batch import holoviews as hv %matplotlib inline hv.extension("bokeh") ################################################...
pdamodaran/yellowbrick
examples/ndanielsen/Yellowbrick in the Flower Garden.ipynb
apache-2.0
# read the iris data into a DataFrame import pandas as pd url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data' col_names = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'species'] iris = pd.read_csv(url, header=None, names=col_names) iris.head() """ Explanation: Using Yello...
tcstewar/testing_notebooks
Sparsity and SSPs.ipynb
gpl-2.0
def sparsity_to_x_intercept(d, p): sign = 1 if p > 0.5: p = 1.0 - p sign = -1 return sign * np.sqrt(1-scipy.special.betaincinv((d-1)/2.0, 0.5, 2*p)) """ Explanation: When working with learning and neural networks, it is useful to be able to control the sparsity of the network. In this cas...
ceteri/pytextrank
explain_algo.ipynb
apache-2.0
import warnings warnings.filterwarnings("ignore") import spacy nlp = spacy.load("en_core_web_sm") """ Explanation: Explain PyTextRank: the algorithm Let's look at the TextRank algorithm used to build a graph from a raw text, and then from that extract the top-ranked phrases. This work is based on "TextRank: Bringing...