repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
samstav/scipy_2015_sklearn_tutorial
notebooks/04.3 Analyzing Model Capacity.ipynb
cc0-1.0
import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn.svm import SVR from sklearn import cross_validation np.random.seed(0) n_samples = 200 kernels = ['linear', 'poly', 'rbf'] true_fun = lambda X: X ** 3 X = np.sort(5 * (np.random.rand(n_samples) - .5)) y = true_fun(X)...
tdhoang0412/python-class
Monday_2017-04-24/06_Homework_1.ipynb
gpl-3.0
# do not forget to put the following '%matplotlib inline' # within Jupyter notebooks. If you forget it, external # windows are opened for the plot but we would like to # have the plots integrated in the notebooks # The line only needs to be give ONCE per notebook! %matplotlib inline # Verification of scipys Bessel func...
mcocdawc/chemcoord
Tutorial/Cartesian.ipynb
lgpl-3.0
import chemcoord as cc from chemcoord.xyz_functions import get_rotation_matrix import numpy as np import time water = cc.Cartesian.read_xyz('water_dimer.xyz', start_index=1) small = cc.Cartesian.read_xyz('MIL53_small.xyz', start_index=1) middle = cc.Cartesian.read_xyz('MIL53_middle.xyz', start_index=1) """ Explanatio...
weleen/mxnet
example/notebooks/moved-from-mxnet/class_active_maps.ipynb
apache-2.0
# -*- coding: UTF-8 –*- import matplotlib.pyplot as plt %matplotlib inline from IPython import display import os ROOT_DIR = '.' import sys sys.path.insert(0, os.path.join(ROOT_DIR, 'lib')) import cv2 import numpy as np import mxnet as mx import matplotlib.pyplot as plt """ Explanation: This demo shows the method pro...
BYUFLOWLab/BYUFLOWLab.github.io
onboarding/PythonPrimer.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt """ Explanation: Why Python For this comparison I'm going to assume most of you are primarily Matlab users. Matlab is great, especially in a university environment. It's an easy to use, interpreted, high-level language with automatic memory manag...
wutienyang/facebook_fanpage_analysis
Facebook粉絲頁分析三部曲-分析和輸出報表篇.ipynb
mit
import math import datetime import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline # 讀取粉絲頁posts page_id = "appledaily.tw" path = 'post/'+page_id+'_post.csv' df = pd.read_csv(path, encoding = 'utf8') """ Explanation: 如何分析Facebook粉絲頁資料並匯出excel報表? 接下來會以前面爬下來的蘋果日報粉絲頁當作本文範例 使用套件 p...
ES-DOC/esdoc-jupyterhub
notebooks/cas/cmip6/models/fgoals-f3-l/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cas', 'fgoals-f3-l', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CAS Source ID: FGOALS-F3-L Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Ra...
quasars100/Resonance_testing_scripts
python_tutorials/Checkpoints.ipynb
gpl-3.0
import rebound rebound.add(m=1.) rebound.add(m=1e-6, a=1.) rebound.add(a=2.) rebound.save("checkpoint.bin") """ Explanation: Checkpoints You can easily save and load particle positions to a binary file with REBOUND. The binary file includes the masses, positions and velocities of all particles, as well as the current ...
microsoft/dowhy
docs/source/example_notebooks/dowhy_mediation_analysis.ipynb
mit
import numpy as np import pandas as pd from dowhy import CausalModel import dowhy.datasets # Warnings and logging import warnings warnings.filterwarnings('ignore') """ Explanation: Mediation analysis with DoWhy: Direct and Indirect Effects End of explanation """ # Creating a dataset with a single confounder an...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/interro_rapide_20_minutes_2014_12.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - Correction de l'interrogation écrite du 14 novembre 2014 dictionnaires End of explanation """ def make_squares(n): squares = [i**2 for i in range(n)] """ Explanation: Enoncé 1 Q1 Le code suivant produit une erreur. Laquelle ...
srikarpv/CV_PA1
PA1-Q3-1.ipynb
mit
import math from scipy import ndimage from PIL import Image from numpy import * from matplotlib import pyplot as plt from pylab import * import cv2 import time # input image # x vertex of corner # y vertex of corner def plott (I,x,y): plt.figure() plt.imshow(I,cmap = cm.gray) # plots the image ...
chengsoonong/didbits
Estimation/SVM_rbf_gamma.ipynb
apache-2.0
import itertools import numpy as np import matplotlib.pyplot as plt from sklearn import svm from sklearn import datasets from sklearn.model_selection import train_test_split %matplotlib inline """ Explanation: Picking the gamma value for a SVM with a Radial Basis Function kernel End of explanation """ iris = datase...
UoS-SNe/LSST_tools
opsimout/notebooks/OpSim_basics_notebook.ipynb
gpl-3.0
from __future__ import print_function ## Force python3-like printing %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import time import sqlite3 from sqlalchemy import create_engine opsimdbpath = os.environ.get('OPSIMDBPATH') print(opsimdbpath) engine = create_eng...
bpgc-cte/python2017
Week 4/Lecture_9_Inheritance_Overloading_Overidding.ipynb
mit
class Student(): def __init__(self, name, id_no=None): self.name = name self.id_no = id_no if id_no is not None else "Not Allocated" def __str__(self): s = self.name return s + "\n" + "Name : " + self.name + " , ID : " + self.id_no def __add__(self, a): return s...
dmittov/misc
Kinder Surprise.ipynb
apache-2.0
def expect_value(k, p): steps = [k / p / (k - i) for i in range(k)] return sum(steps) k = 10 ps = [1., .5, .33, .25, .2, .1] count = np.vectorize(lambda p: expect_value(k, p), otypes=[np.float])(ps) plt.scatter(ps, count) plt.xlabel('Lion probability') plt.ylabel('Purchase count') count """ Explanation: Колл...
mohsinhaider/pythonbootcampacm
Errors and Exceptions/Errors and Exceptions.ipynb
mit
# Producing an Error print("hey there) """ Explanation: Errors and Exceptions Running into errors and exceptions is inevitable, and debugging is a huge part of modern-day product development. As of now, we've worked with the roots of Python syntax, and have encountered many types of errors that are built-in. Of course...
mattilyra/gensim
docs/notebooks/Poincare Tutorial.ipynb
lgpl-2.1
% cd ../.. %load_ext autoreload %autoreload 2 import os import logging import numpy as np from gensim.models.poincare import PoincareModel, PoincareKeyedVectors, PoincareRelations logging.basicConfig(level=logging.INFO) poincare_directory = os.path.join(os.getcwd(), 'docs', 'notebooks', 'poincare') data_directo...
ES-DOC/esdoc-jupyterhub
notebooks/mohc/cmip6/models/sandbox-2/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mohc', 'sandbox-2', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: MOHC Source ID: SANDBOX-2 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbul...
physion/ovation-python
examples/file-upload.ipynb
gpl-3.0
import ovation.core as core from ovation.session import connect from ovation.upload import upload_revision, upload_file, upload_folder from ovation.download import download_revision from pprint import pprint from getpass import getpass from tqdm import tqdm_notebook as tqdm """ Explanation: File (Revision) upload e...
GoogleCloudPlatform/bigquery-notebooks
notebooks/official/template_notebooks/visualizing_bigquery_public_data.ipynb
apache-2.0
%%bigquery SELECT source_year AS year, COUNT(is_male) AS birth_count FROM `bigquery-public-data.samples.natality` GROUP BY year ORDER BY year DESC LIMIT 15 """ Explanation: Vizualizing BigQuery data in a Jupyter notebook BigQuery is a petabyte-scale analytics data warehouse that you can use to run SQL queries ...
jamesjia94/BIDMach
tutorials/NVIDIA/BIDMat_Scala_Features.ipynb
bsd-3-clause
import BIDMat.{CMat,CSMat,DMat,Dict,IDict,FMat,FND,GMat,GDMat,GIMat,GLMat,GSMat,GSDMat, HMat,IMat,Image,LMat,Mat,ND,SMat,SBMat,SDMat} import BIDMat.MatFunctions._ import BIDMat.SciFunctions._ import BIDMat.Solvers._ import BIDMat.JPlotting._ Mat.checkMKL Mat.checkCUDA Mat.setInline if (Mat.hasCUDA > 0) ...
bonadio/bike-share-rnn
.ipynb_checkpoints/original-nn-checkpoint.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
tensorflow/federated
docs/openmined2020/openmined_conference_2020.ipynb
apache-2.0
#@title Upgrade tensorflow_federated and load TensorBoard #@test {"skip": true} !pip install --quiet --upgrade tensorflow-federated !pip install --quiet --upgrade nest-asyncio import nest_asyncio nest_asyncio.apply() %load_ext tensorboard import sys if not sys.warnoptions: import warnings warnings.simplefil...
JeffAbrahamson/MLWeek
practicum/teste_installation.ipynb
gpl-3.0
import logging import time """ Explanation: Confirmer l'installation de python Le seul but de ce notebook est de vous permettre de confirmer la bonne installation de python. Les exercises étaient testées avec python 2.7.12 et ipython 5.1.0. Il y a toute raison à croire que n'importe quelle version de python 2.7 suff...
morganics/BayesPy
examples/notebook/iris_anomaly_detection.ipynb
apache-2.0
%matplotlib notebook import pandas as pd import sys sys.path.append("../../../bayespy") import bayespy from bayespy.network import Builder as builder import logging import os import matplotlib.pyplot as plt from IPython.display import display logger = logging.getLogger() logger.addHandler(logging.StreamHandler()) l...
ananswam/bioscrape
inference examples/Stochastic Inference.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = "retina" from matplotlib import rcParams rcParams["savefig.dpi"] = 100 rcParams["figure.dpi"] = 100 rcParams["font.size"] = 20 %matplotlib inline import bioscrape as bs from bioscrape.types import Model from bioscrape.simulator import py_simulate_model import ...
RedHatInsights/insights-core
docs/notebooks/Insights Core Tutorial.ipynb
apache-2.0
import sys sys.path.insert(0, "../..") from insights.core import dr # Here's our component type with the clever name "component." # Insights Core provides several types that we'll come to later. class component(dr.ComponentType): pass """ Explanation: Red Hat Insights Core Insights Core is a framework for collec...
phasedchirp/Assorted-Data-Analysis
exercises/SlideRule-DS-Intensive/UD120/SVM.ipynb
gpl-2.0
import sys from sklearn.svm import SVC from time import time sys.path.append("../tools/") from email_preprocess import preprocess """ Explanation: Udacity Machine Learning mini-project 2 Prep stuff End of explanation """ features_train, features_test, labels_train, labels_test = preprocess() """ Explanation: Traini...
machinelearningnanodegree/stanford-cs231
solutions/vijendra/assignment2/Dropout.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 ...
MBARIMike/oxyfloat
notebooks/explore_cached_oxyfloat_data.ipynb
mit
import sys sys.path.insert(0, '../') from oxyfloat import ArgoData ad = ArgoData() """ Explanation: Explore locally cached Argo oxygen float data - second in a series of Notebooks Use the oxyfloat module to get data and Pandas to operate on it for testing ability to easily perform calibrations (See build_oxyfloat_cac...
janesjanes/sketchy
code/Retrieval_Example.ipynb
mit
import numpy as np from pylab import * %matplotlib inline import os import sys """ Explanation: This script is for retrieving images based on sketch query End of explanation """ #TODO: specify your caffe root folder here caffe_root = "X:\caffe_siggraph/caffe-windows-master" sys.path.insert(0, caffe_root+'/python') i...
adukic/nd101
first-neural-network/dlnd-your-first-neural-network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
mne-tools/mne-tools.github.io
0.24/_downloads/fcc5782db3e2930fc79f31bc745495ed/60_ctf_bst_auditory.ipynb
bsd-3-clause
# Authors: Mainak Jas <mainak.jas@telecom-paristech.fr> # Eric Larson <larson.eric.d@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.fi> # # License: BSD-3-Clause import os.path as op import pandas as pd import numpy as np import mne from mne import combine_evoked from mne.minimum_norm import ...
metpy/MetPy
v0.10/_downloads/7dd7941230ab04d65d899c66ed400ef4/xarray_tutorial.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import xarray as xr # Any import of metpy will activate the accessors import metpy.calc as mpcalc from metpy.testing import get_test_data from metpy.units import units """ Explanation: xarray with MetPy Tutorial xarray &lt;h...
daniel-koehn/DENISE-Black-Edition
par/pythonIO/DENISE-python_IO.ipynb
gpl-2.0
# Import Python libaries # ---------------------- import numpy as np # NumPy library from denise_IO.denise_out import * # "DENISE" library """ Explanation: Creating input files for DENISE Black-Edition Jupyter notebook for the definition of FD model and modelling/FWI/RTM parameters of DENISE Black...
cmorgan/toyplot
docs/canvas-layout.ipynb
bsd-3-clause
import numpy y = numpy.linspace(0, 1, 20) ** 2 import toyplot toyplot.plot(y, width=300); """ Explanation: .. _canvas-layout: Canvas Layout In Toyplot, axes (including :ref:cartesian-axes, :ref:table-axes, and others) are used to map data values into canvas coordinates. The axes range (the area on the canvas that th...
PyDataMallorca/WS_Introduction_to_data_science
ml_miguel/quien_es_quien.ipynb
gpl-3.0
import matplotlib import matplotlib.pyplot as plt %matplotlib inline matplotlib.rcParams['figure.figsize'] = (15.0, 6.0) import numpy as np import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) from IPython.display import Image """ Explanation: Cual es la mejor estrategia para adivinar? Por M...
ghvn7777/ghvn7777.github.io
content/fluent_python/12_inherit.ipynb
apache-2.0
class DoppelDict(dict): def __setitem__(self, key, value): super().__setitem__(key, [value] * 2) dd = DoppelDict(one=1) dd # 继承 dict 的 __init__ 方法忽略了我们覆盖的 __setitem__方法,'one' 值没有重复 dd['two'] = 2 # `[]` 运算符会调用我们覆盖的 __setitem__ 方法 dd dd.update(three=3) #继承自 dict 的 update 方法也不会调用我们覆盖的 __setitem__ 方法 dd """...
lileiting/goatools
notebooks/semantic_similarity.ipynb
bsd-2-clause
%load_ext autoreload %autoreload 2 import sys sys.path.insert(0, "..") from goatools import obo_parser go = obo_parser.GODag("../go-basic.obo") go_id3 = 'GO:0048364' go_id4 = 'GO:0044707' print(go[go_id3]) print(go[go_id4]) """ Explanation: Computing basic semantic similarities between GO terms Adapted from book c...
tensorflow/docs-l10n
site/en-snapshot/guide/tensor_slicing.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...
pjbull/data-science-is-software
notebooks/data-science-is-software-talk.ipynb
mit
# install the watermark extension !pip install watermark # once it is installed, you'll just need this in future notebooks: %load_ext watermark %watermark -a "Peter Bull" -d -v -p numpy,pandas -g """ Explanation: <table style="width:100%; border: 0px solid black;"> <tr style="width: 100%; border: 0px solid black...
wbinventor/openmc
examples/jupyter/nuclear-data.ipynb
mit
%matplotlib inline import os from pprint import pprint import shutil import subprocess import urllib.request import h5py import numpy as np import matplotlib.pyplot as plt import matplotlib.cm from matplotlib.patches import Rectangle import openmc.data """ Explanation: In this notebook, we will go through the salien...
marxav/hello-world
artificial_neural_network_101_tensorflow.ipynb
mit
# To enable Tensorflow 2 instead of TensorFlow 1.15, uncomment the next 4 lines #try: # %tensorflow_version 2.x #except Exception: # pass # library to store and manipulate neural-network input and output data import numpy as np # library to graphically display any data import matplotlib.pyplot as plt # library ...
ethen8181/Business-Analytics
ab_tests/bayesian_ab_test.ipynb
mit
# Website A had 1055 clicks and 28 sign-ups # Website B had 1057 clicks and 45 sign-ups values_A = np.hstack( ( [0] * (1055 - 28), [1] * 28 ) ) values_B = np.hstack( ( [0] * (1057 - 45), [1] * 45 ) ) print(values_A) print(values_B) """ Explanation: A/B Testing with Hierarchical Models Though A/B testing seems simple...
intel-analytics/analytics-zoo
docs/docs/colab-notebook/orca/quickstart/pytorch_lenet_mnist_data_creator_func.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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed un...
EvanBianco/striplog
tutorial/Striplog_object.ipynb
apache-2.0
%matplotlib inline import striplog striplog.__version__ from striplog import Legend, Lexicon, Interval, Component legend = Legend.default() lexicon = Lexicon.default() """ Explanation: Striplog objects This notebooks looks at the main striplog object. For the basic objects it depends on, see Basic objects. First, im...
bloomberg/bqplot
examples/Marks/Pyplot/Pie.ipynb
apache-2.0
data = np.random.rand(3) fig = plt.figure(animation_duration=1000) pie = plt.pie(data, display_labels="outside", labels=list(string.ascii_uppercase)) fig """ Explanation: Basic Pie Chart End of explanation """ n = np.random.randint(1, 10) pie.sizes = np.random.rand(n) """ Explanation: Update Data End of explanatio...
tritemio/multispot_paper
out_notebooks/usALEX-5samples-PR-raw-out-DexDem-17d.ipynb
mit
ph_sel_name = "DexDem" data_id = "17d" # ph_sel_name = "all-ph" # data_id = "7d" """ Explanation: Executed: Mon Mar 27 11:35:09 2017 Duration: 11 seconds. usALEX-5samples - Template This notebook is executed through 8-spots paper analysis. For a direct execution, uncomment the cell below. End of explanation """ f...
ES-DOC/esdoc-jupyterhub
notebooks/uhh/cmip6/models/sandbox-1/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'uhh', 'sandbox-1', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: UHH Source ID: SANDBOX-1 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radiat...
joshspeagle/dynesty
demos/Examples -- LogGamma.ipynb
mit
# system functions that are always useful to have import time, sys, os import warnings # basic numeric setup import numpy as np # inline plotting %matplotlib inline # plotting import matplotlib from matplotlib import pyplot as plt # seed the random number generator rstate = np.random.default_rng(1028) # re-definin...
PLN-FaMAF/DeepLearningEAIA
deep_learning_tutorial_1.ipynb
bsd-3-clause
import numpy import keras from keras.models import Sequential from keras.layers import Dense, Dropout from keras.datasets import mnist """ Explanation: Express Deep Learning in Python - Part 1 Do you have everything ready? Check the part 0! How fast can you build a MLP? In this first part we will see how to implement ...
rubensfernando/mba-analytics-big-data
Python/2016-07-29/aula4-parte3-tratamento-excecoes.ipynb
mit
10 *(1/0) 4 + spam*3 '2' + 2 """ Explanation: O básico sobre tratamento de exceções Erros detectados durante a execução são chamados de exceções e não são necessariamente fatais. A maioria das exceções não são lidadas pelos programas, entretanto, um resultado de mensagens de erros são ilustradas abaixo: End of expla...
jenshnielsen/HJCFIT
exploration/CH82.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from dcprogs.likelihood import QMatrix tau = 1e-4 qmatrix = QMatrix([[ -3050, 50, 3000, 0, 0 ], [ 2./3., -1502./3., 0, 500, 0 ], [ 15, 0, -2065, 50, 2000 ], ...
bashtage/statsmodels
examples/notebooks/ets.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline from statsmodels.tsa.exponential_smoothing.ets import ETSModel plt.rcParams["figure.figsize"] = (12, 8) """ Explanation: ETS models The ETS models are a family of time series models with an underlying state space model consisti...
Hexiang-Hu/mmds
week6/.ipynb_checkpoints/Quiz-Week6-checkpoint.ipynb
mit
import numpy as np p1 = (5, 4) p2 = (8, 3) p3 = (7, 2) p4 = (3, 3) def calc_wb(p1, p2): dx = ( p1[0] - p2[0] ) dy = ( p1[1] - p2[1] ) return ( ( float(dy) *2 / float(dy - dx), float(-dx)*2 / float(dy - dx) ),\ (dx*p2[1] - dy * p2[0])*2 / float(dy - dx) + 1) # b = dx*y1 - dy*x1 def cal_margin(...
ajgpitch/qutip-notebooks
examples/piqs-boundary-time-crystals.ipynb
lgpl-3.0
from time import clock from scipy.io import mmwrite import matplotlib.pyplot as plt from qutip import * from qutip.piqs import * """ Explanation: Boundary time crystals Notebook author: Nathan Shammah (nathan.shammah at gmail.com) We apply the Permutational Invariant Quantum Solver (PIQS) [1], imported in QuTiP as $\...
squishbug/DataScienceProgramming
05-Operating-with-Multiple-Tables/HW05/CheckHomework05.ipynb
cc0-1.0
import pandas as pd import numpy as np """ Explanation: Check Homework HW05 Use this notebook to check your solutions. This notebook will not be graded. End of explanation """ import hw5_answers reload(hw5_answers) from hw5_answers import * """ Explanation: Now, import your solutions from hw5_answers.py. The follow...
wmvanvliet/neuroscience_tutorials
conpy-intro/MEG_connectivity_exercise.ipynb
bsd-2-clause
# Don't worry about warnings in this exercise, as they can be distracting. import warnings warnings.simplefilter('ignore') # Import the required Python modules import mne import conpy import surfer # Import and configure the 3D graphics backend from mayavi import mlab mlab.init_notebook('png') # Tell MNE-Python to b...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a_soft/td1a_sql.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.soft - Notions de SQL Premiers pas avec le langage SQL. End of explanation """ from pyensae.datasource import download_data download_data("td8_velib.zip", website = 'xd') """ Explanation: Le langage SQL est utilisé pour manipuler de...
erickpeirson/statistical-computing
Statistical Learning.ipynb
cc0-1.0
import numpy as np from scipy.stats import uniform f = lambda x: np.log(x) x = np.linspace(0.1, 5.1, 100) y = f(x) Eps = uniform.rvs(-1., 2., size=(100,)) plt.plot(x, y, label='$f(x)$', lw=3) plt.scatter(x, y + Eps, label='y') plt.xlabel('x') plt.legend(loc='best') plt.show() """ Explanation: Statistical Learning Di...
tpin3694/tpin3694.github.io
machine-learning/adding_interaction_terms.ipynb
mit
# Load libraries from sklearn.linear_model import LinearRegression from sklearn.datasets import load_boston from sklearn.preprocessing import PolynomialFeatures import warnings # Suppress Warning warnings.filterwarnings(action="ignore", module="scipy", message="^internal gelsd") """ Explanation: Title: Adding Interac...
GEMScienceTools/rmtk
notebooks/vulnerability/derivation_fragility/equivalent_linearization/lin_miranda_2008/lin_miranda_2008.ipynb
agpl-3.0
from rmtk.vulnerability.derivation_fragility.equivalent_linearization.lin_miranda_2008 import lin_miranda_2008 from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: Lin and Miranda (2008) This method, described in Lin and Miranda (2008), estimates the maximum inelastic displacement of an exi...
dtamayo/rebound
ipython_examples/HyperbolicOrbits.ipynb
gpl-3.0
from io import StringIO import numpy as np import rebound epoch_of_elements = 53371.0 # [MJD, days] c = StringIO(u""" # id e q[AU] i[deg] Omega[deg] argperi[deg] t_peri[MJD, days] epoch_of_observation[MJD, days] 168026 12.181214 15.346358 136.782470 37.581438 268.412314 54776.806093 ...
rjurney/Agile_Data_Code_2
ch07/Making_Predictions.ipynb
mit
import pyspark.sql.functions as F import pyspark.sql.types as T from pyspark.sql import SparkSession # Initialize PySpark with MongoDB and Elastic support spark = ( SparkSession.builder.appName("Exploring Data with Reports") # Load support for MongoDB and Elasticsearch .config("spark.jars.packages", "org....
DJCordhose/speed-limit-signs
notebooks/retrain-cnn-step-3-fine-tuning-bottleneck-layer.ipynb
apache-2.0
import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline import matplotlib.pylab as plt import numpy as np from distutils.version import StrictVersion import sklearn print(sklearn.__version__) assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1') import tensorflow as tf t...
jpilgram/phys202-2015-work
assignments/assignment12/FittingModelsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 1 Imports End of explanation """ a_true = 0.5 b_true = 2.0 c_true = -4.0 """ Explanation: Fitting a quadratic curve For this problem we are going to work with the following mod...
tensorflow/examples
courses/udacity_intro_to_tensorflow_for_deep_learning/l10c02_nlp_multiple_models_for_predicting_sentiment.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...
vbalderdash/LMAsimulation
LMAsimulation_full.ipynb
mit
%pylab inline import pyproj as proj4 import numpy as np import matplotlib.pyplot as plt import pandas as pd import datetime import time import simulation_functions as sf # import read_logs from mpl_toolkits.basemap import Basemap from coordinateSystems import TangentPlaneCartesianSystem, GeographicSystem, MapProjecti...
tensorflow/recommenders
docs/examples/deep_recommenders.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...
kitu2007/dl_class
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
211217613/python_meetup
Word frequency python session.ipynb
unlicense
# Lets see how many lines are in the PDF # We can use the '!' special character to run Linux commands inside of our notebook !wc -l test.txt # Now lets see how many words !wc -w test.txt import nltk from nltk import tokenize # Lets open the file so we can access the ascii contents # fd stands for file descriptor b...
VirusTotal/vt-py
examples/jupyter/ransomware_report_usecases1.ipynb
apache-2.0
#@markdown Please, insert your VT API Key*: API_KEY = '' #@param {type: "string"} #@markdown **The API key should have Premium permissions, otherwise some of the use cases might not provide the expected results.* #@markdown """ Explanation: Jupyter Notebook - Ransomware report use cases 1 Copyright © 2021 Googl...
nproctor/phys202-2015-work
assignments/assignment04/TheoryAndPracticeEx01.ipynb
mit
from IPython.display import Image """ Explanation: Theory and Practice of Visualization Exercise 1 Imports End of explanation """ # Add your filename and uncomment the following line: Image(filename='graphie.JPG') """ Explanation: Graphical excellence and integrity Find a data-focused visualization on one of the fo...
ymero/pyDataScienceToolkits_Base
Visualization/(3)special_curves_plot.ipynb
mit
%matplotlib inline import numpy as np from matplotlib.pyplot import plot from matplotlib.pyplot import show import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec """ Explanation: 内容索引 利萨如曲线 --- 使用标准三角函数绘制 绘制方波 --- 利用无穷傅里叶级数表示 绘制锯齿波和三角波 End of explanation """ # 为简单起见,令A和B为1 t = np.linspace(-np.pi, n...
sdpython/ensae_teaching_cs
_doc/notebooks/notebook_eleves/2017-2018/dimensions_reduction.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline import matplotlib.pyplot as plt # traçage de graphiques import numpy as np # traitement des arrays numériques import pandas as pd from sklearn import datasets # datasets classiques from sklearn import preprocessing # normalisation les...
igabr/Metis_Projects_Chicago_2017
05-project-kojack/.ipynb_checkpoints/Final_Notebook-checkpoint.ipynb
mit
df = unpickle_object("FINAL_DATAFRAME_PROJ_5.pkl") df.head() def linear_extrapolation(df, window): pred_lst = [] true_lst = [] cnt = 0 all_rows = df.shape[0] while cnt < window: start = df.iloc[cnt:all_rows-window+cnt, :].index[0].date() end = df.iloc[cnt:all_rows-window+cnt, :]....
blehman/Data-Science-45min-Intros
networks-201/network_analysis.ipynb
unlicense
#relatively fast networks package (pip install python-igraph) that I used for these homeworks import igraph # slow-and-steady networks package. fewer bugs, easier drawing import networkx as nx # plots! import matplotlib.pyplot as plt from matplotlib import style %matplotlib inline # other packages from __future__ imp...
tolaoniyangi/dmc
notebooks/week-6/01-training a RNN model in Keras.ipynb
apache-2.0
import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import LSTM from keras.callbacks import ModelCheckpoint from keras.utils import np_utils from time import gmtime, strftime import os import re import pickle import random import sys ...
geilerloui/deep-learning
tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
mit-eicu/eicu-code
notebooks/demo/02-demographics-and-severity-of-illness.ipynb
mit
# Import libraries import pandas as pd import matplotlib.pyplot as plt import psycopg2 import os # Plot settings %matplotlib inline plt.style.use('ggplot') fontsize = 20 # size for x and y ticks plt.rcParams['legend.fontsize'] = fontsize plt.rcParams.update({'font.size': fontsize}) # Connect to the database - which i...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a/td1a_cenonce_session4.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.2 - Modules, fichiers, expressions régulières Le langage Python est défini par un ensemble de règle, une grammaire. Seul, il n'est bon qu'à faire des calculs. Les modules sont des collections de fonctionnalités pour interagir avec des ...
DS-100/sp17-materials
sp17/labs/lab06/lab06_solution.ipynb
gpl-3.0
!pip install ipython-sql %load_ext sql %sql sqlite:///./lab06.sqlite import sqlalchemy engine = sqlalchemy.create_engine("sqlite:///lab05.sqlite") connection = engine.connect() !pip install -U okpy from client.api.notebook import Notebook ok = Notebook('lab06.ok') """ Explanation: Lab 6: SQL End of explanation "...
dshean/iceflow
Iceflow visualization.ipynb
mit
%matplotlib inline import os import matplotlib.pyplot as plt # The two statements below are used mainly to set up a plotting # default style that's better than the default from matplotlib #import seaborn as sns plt.style.use('bmh') from shapely.geometry import Point #import pandas as pd import geopandas as gpd from ...
snegirigens/DLND
embeddings/Skip-Gram_word2vec.ipynb
mit
import time import numpy as np import tensorflow as tf import utils """ Explanation: Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p...
hadim/public_notebooks
Analysis/MSD_Bayes/notebook.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import pandas as pd from scipy import io from scipy import optimize import pymc3 as pm import theano import theano.tensor as t import matplotlib.pyplot as plt """ Explanation: Classify particle motion from MSD anaysis and bayesian inference (i...
cdawei/digbeta
dchen/music/aotm2011_subset.ipynb
gpl-3.0
%matplotlib inline %load_ext autoreload %autoreload 2 import os, sys import gzip import pickle as pkl import numpy as np import pandas as pd from scipy.optimize import check_grad from scipy.sparse import lil_matrix, issparse from collections import Counter import matplotlib.pyplot as plt import seaborn as sns sys.pa...
cloudmesh/book
notebooks/machinelearning/crossvalidation.ipynb
apache-2.0
from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn import metrics # read in the iris data iris = load_iris() # create X (features) and y (response) X = iris.data y = iris.target # use train/test split with diffe...
karlstroetmann/Formal-Languages
Ply/Html2Text.ipynb
gpl-2.0
data = \ ''' <html> <head> <meta charset="utf-8"> <title>Homepage of Prof. Dr. Karl Stroetmann</title> <link type="text/css" rel="stylesheet" href="style.css" /> <link href="http://fonts.googleapis.com/css?family=Rochester&subset=latin,latin-ext" rel="stylesheet" type="text/css"> <link h...
tleonhardt/LearningCython
Learning_Cython_video/Chapter11/dates/dateobject-withC.ipynb
mit
import numpy as np import pandas as pd def make_sample_data(size): d = dict( # Years: 1980 - 2015 year=np.random.randint(1980, 2016, int(size)), # Months 1 - 12 month=np.random.randint(1, 13, int(size)), # Day number: 1 - 28 day=np.random.randint(1, 28, int(size)), ...
paix120/DataScienceLearningClubActivities
Activity05/Mushroom Edibility Classification - Naive Bayes.ipynb
gpl-2.0
#import pandas and numpy libraries import pandas as pd import numpy as np import sys #sys needed only for python version #import gaussian naive bayes from scikit-learn import sklearn as sk #seaborn for pretty plots import seaborn as sns #display versions of python and packages print('\npython version ' + sys.version) ...
kazzz24/deep-learning
tensorboard/Anna_KaRNNa_Summaries.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
vravishankar/Jupyter-Books
Lists.ipynb
mit
vowels = ['a','e','i','o','u'] print(vowels) """ Explanation: Lists Lists are constructed with square brackets with elements separated by a comma. Lists are mutable, meaning the individual items in the list can be changed. Example 1 End of explanation """ list1 = [1,'a',"This is a list",5.25] print(list1) """ Expla...
pylada/pylada-light
notebooks/IPython high-throughput interface.ipynb
gpl-3.0
%load_ext pylada """ Explanation: Manipulating job-folders IPython is an ingenious combination of a bash-like terminal with a python shell. It can be used for both bash related affairs such as copying files around creating directories, and for actual python programming. In fact, the two can be combined to create a tru...
yandexdataschool/gumbel_lstm
binary_lstm.ipynb
mit
%env THEANO_FLAGS="device=gpu2" import numpy as np import theano import theano.tensor as T import lasagne import os """ Explanation: Contents We train an LSTM with gumbel-sigmoid gates on a toy language modelling problem. Such LSTM can than be binarized to reach signifficantly greater speed. End of explanation """ ...
BoasWhip/Black
Notebook/M269 Unit 4 Notes -- Search.ipynb
mit
def quickSelect(k, aList): if len(aList) == 1: return aList[0] # Base case pivotValue = aList[0] leftPart = [] rightPart = [] for item in aList[1:]: if item < pivotValue: leftPart.append(item) else: rightPart.append(item) if ...
UWashington-Astro300/Astro300-W17
06_PlottingWithPython.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from astropy.table import QTable """ Explanation: Plotting and Fitting with Python matplotlib is the main plotting library for Python End of explanation """ t = np.linspace(0,2,100) # 100 points linearly spaced between 0.0 and 2.0 s...
cniedotus/Python_scrape
.ipynb_checkpoints/Python3_tutorial-checkpoint.ipynb
mit
width = 20 height = 5*9 width * height """ Explanation: <center> Python and MySQL tutorial </center> <center> Author: Cheng Nie </center> <center> Check chengnie.com for the most recent version </center> <center> Current Version: Feb 12, 2016</center> Python Setup Since most students in this class use Windows 7, I wil...
uliang/First-steps-with-the-Python-language
Day 2 - Unit 3.2.ipynb
mit
PRSA.head() """ Explanation: 2. Density based plots with matplotlib In this section, we will be looking at density based plots. Plots like these address a problem with big data: How does one visualise a plot with 10,000++ data points and avoid overplotting. End of explanation """ plt.plot( PRSA.TEMP, PRSA["pm2.5"], ...
ericmjl/reassortment-simulator
Simulator Notebook.ipynb
mit
hosts = [] n_hosts = 1000 for i in range(n_hosts): if i < n_hosts / 2: hosts.append(Host(color='blue')) else: hosts.append(Host(color='red')) """ Explanation: Agent-Based Model to Dissect Contribution of Host Immunity and Contact Structure to Influenza Reassortment Eric J. Ma Runstadler Lab Me...
stanfordmlgroup/ngboost
examples/user-guide/content/5-dev.ipynb
apache-2.0
import sys sys.path.append('/Users/c242587/Desktop/projects/git/ngboost') """ Explanation: Developing NGBoost End of explanation """ from scipy.stats import laplace as dist import numpy as np from ngboost.distns.distn import RegressionDistn from ngboost.scores import LogScore class LaplaceLogScore(LogScore): # will...