repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
rcrehuet/Python_for_Scientists_2017
notebooks/solutions/6_1_linear_regression.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline x = np.arange(10.) y = 5*x+3 np.random.seed(3) y+= np.random.normal(scale=10,size=x.size) plt.scatter(x,y); def lin_reg(x,y): """ Perform a linear regression of x vs y. x, y are 1 dimensional numpy arrays returns alpha and beta for ...
nick-youngblut/SIPSim
ipynb/bac_genome/n1147/validation_rep3.ipynb
mit
workDir = '/home/nick/notebook/SIPSim/dev/bac_genome1147/validation_rep3/' genomeDir = '/var/seq_data/ncbi_db/genome/Jan2016/bac_complete_spec-rep1_rn/' R_dir = '/home/nick/notebook/SIPSim/lib/R/' figureDir = '/home/nick/notebook/SIPSim/figures/bac_genome_n1147/' bandwidth = 0.8 DBL_scaling = 0.5 subsample_dist = 'log...
tensorflow/docs-l10n
site/zh-cn/lattice/tutorials/custom_estimators.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...
Jackporter415/phys202-2015-work
assignments/assignment05/InteractEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 2 Imports End of explanation """ #CHANGE TICK MARKERS def plot_sine1(a,b): x = np.linspace(0,4*np.pi,20...
jennybrown8/python-notebook-coding-intro
lesson4exercises.ipynb
apache-2.0
def hokeypokey(limb): print("You put your " + limb +" in,") print("You put your " + limb + " out,") print("You put your " + limb +" in,") print("and you shake it all about.") print("You do the hokey pokey and you turn yourself around,") print("and that's what it's all about!") print("") ...
tensorflow/text
docs/tutorials/text_similarity.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...
stitchfix/d3-jupyter-tutorial
bar_chart_with_update.ipynb
mit
from IPython.core.display import display, HTML from string import Template import pandas as pd import json, random HTML('<script src="lib/d3/d3.min.js"></script>') """ Explanation: D3 Bar Chart with Update This example is based on the canonical simple bar chart example, but with a minor twist - a data update is added...
Xilinx/PYNQ
boards/Pynq-Z1/base/notebooks/video/opencv_filters_webcam.ipynb
bsd-3-clause
from pynq.overlays.base import BaseOverlay from pynq.lib.video import * base = BaseOverlay("base.bit") """ Explanation: OpenCV Filters Webcam In this notebook, several filters will be applied to webcam images. Those input sources and applied filters will then be displayed either directly in the notebook or on HDMI out...
chengsoonong/crowdastro
notebooks/56_nonlinear_astro_features.ipynb
mit
import h5py, numpy, sklearn.linear_model, sklearn.cross_validation, sklearn.metrics with h5py.File('../data/training.h5') as f: raw_astro_features = f['features'][:, :4] dist_features = f['features'][:, 4] image_features = f['features'][:, 5:] w1_w2 = raw_astro_features[:, 0] - raw_astro_features[...
chapman-phys227-2016s/hw-7-ChinmaiRaman
hw7.ipynb
mit
xp = np.linspace(0, np.pi, 5) yp = np.sin(xp) #Lagrange's interpolation polynomial p_L = p1.LagrangeInterpolation(xp, yp) x = 1.2 print 'p_L(%g) = %g' % (x, p_L(x)) print 'sin(%g) = %g' % (x, np.sin(x)) p_L.plot() """ Explanation: Chinmai Raman Homework 7 7.8 Wrapping functions in a class Visualizes $p_L(x)$ for x be...
sebastiandres/mat281
clases/Unidad1-IntroduccionYProyectos/Clase01-IntroduccionYReglas/IntroduccionYReglas.ipynb
cc0-1.0
from matplotlib import pyplot as plt import numpy as np x = np.linspace(1E-8,np.pi/6,1000) y = x*np.sin(1./x) plt.plot(x, y) plt.plot(x, x) plt.plot(x, -x) plt.show() """ Explanation: <header class="w3-container w3-teal"> <img src="images/utfsm.png" alt="" height="100px" align="left"/> <img src="images/mat.png" alt=""...
abhinav-upadhyay/intro-to-python
notebooks/Conditionals in Python.ipynb
bsd-2-clause
import random toss = random.random() # returns a random value between 0 and 1 if toss > 0.5: print 'I won' """ Explanation: Conditions in Python Python has a very natural looking syntax for conditionals and boolean operations if statment in Python if True: do something End of explanation """ toss = ran...
neothemachine/rawpy-notebooks
simple-convert/simple-convert.ipynb
unlicense
%matplotlib inline import matplotlib as mpl mpl.rcParams['figure.figsize'] = 5, 10 from matplotlib.pyplot import imshow """ Explanation: Converting a RAW file to a standard image format In this notebook we read and process a RAW image and save it in a standard image format. The sample image used here can be found on r...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n08_simple_q_learner_full_training.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
510908220/python-toolbox
books/files/question.ipynb
mit
import os os.listdir('question/one') # %load question/one/main.py from . import m # %load question/one/m.py import sys import os print('cwd', os.getcwd()) print('__file__:', __file__) print('argv[0]:', sys.argv[0]) print('__name__:', __name__) """ Explanation: 文件相关的问题整理 问题一:difference between __file__ and sys.argv[...
lparolin/state_estimation
notebook/Example 1.ipynb
mit
#Import base libraries import numpy as np import matplotlib.pyplot as plt import random from matplotlib import animation, rc from IPython.display import HTML import importlib # Import libraries for the examples import os import sys module_path = os.path.abspath(os.path.join('../python')) if module_path not in sys.path...
tpin3694/tpin3694.github.io
regex/match_any_of_a_list_of_symbols.ipynb
mit
# Load regex package import re """ Explanation: Title: Match Any Of A List Of Characters Slug: match_any_of_a_list_of_symbols Summary: Match Any Of A List Of Characters Date: 2016-05-01 12:00 Category: Regex Tags: Basics Authors: Chris Albon Based on: Regular Expressions Cookbook Preliminaries End of explanation """...
statsmodels/statsmodels.github.io
v0.13.2/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,...
agile-geoscience/striplog
docs/tutorial/02_Basic_objects.ipynb
apache-2.0
import striplog striplog.__version__ # If you get a lot of warnings here, just run it again. """ Explanation: Basic objects A striplog depends on a hierarchy of objects. This notebook shows the objects and their basic functionality. Lexicon: A dictionary containing the words and word categories to use for rock descr...
asarnow/pubs-analysis
analysis.ipynb
agpl-3.0
# First, we must perform the incantations. %pylab inline import pandas as pd # Parse data file. proteins = pd.read_table('data/pubs2015/proteinGroups.txt', low_memory=False) # Find mass spec intensity columns. intensity_cols = [c for c in proteins.columns if 'intensity ' in c.lower() and 'lfq' not in c.lo...
LucaCanali/Miscellaneous
Spark_Physics/CMS_Higgs_opendata/H_ZZ_4l_analysis_basic_monte_carlo_signal.ipynb
apache-2.0
# Run this if you need to install Apache Spark (PySpark) # !pip install pyspark # Install sparkhistogram # Note: if you cannot install the package, create the computeHistogram # function as detailed at the end of this notebook. !pip install sparkhistogram # Run this to download the dataset # See further details at...
m2dsupsdlclass/lectures-labs
labs/05_conv_nets_2/ConvNets_for_Classification_and_Localization_rendered.ipynb
mit
from __future__ import division import numpy as np import xml.etree.ElementTree as etree import os import os.path as op # Parse the xml annotation file and retrieve the path to each image, # its size and annotations def extract_xml_annotation(filename): z = etree.parse(filename) objects = z.findall("./object")...
maxalbert/tohu
notebooks/v5/Primitive_generators.ipynb
mit
import tohu from tohu.v5.primitive_generators import * from tohu.v5.utils import print_generated_sequence print(f'Tohu version: {tohu.__version__}') """ Explanation: Primitive generators This notebook contains tests for tohu's primitive generators. End of explanation """ g = Constant('quux') print_generated_sequen...
jupyter-widgets/ipywidgets
docs/source/examples/Widget List.ipynb
bsd-3-clause
import ipywidgets as widgets """ Explanation: Index - Back - Next Widget List End of explanation """ widgets.IntSlider( value=7, min=0, max=10, step=1, description='Test:', disabled=False, continuous_update=False, orientation='horizontal', readout=True, readout_format='d' ) "...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/sandbox-1/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-1', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: SANDBOX-1 Topic: Ocean Sub-Topics: Tim...
mauriciogtec/PropedeuticoDataScience2017
Alumnos/Alejandro_Hdz/Tarea 2 - Alejandro Hernández Farías.ipynb
mit
from PIL import Image import numpy as np import matplotlib.pyplot as plt im = Image.open("/Users/alex/PropedeuticoDataScience2017/foto.jpg") im = im.convert('LA') col,ren = im.size data = np.zeros((ren*col, 5)) mat = np.array(list(im.getdata(band=0)), float) mat.shape = (im.size[1], im.size[0]) mat = np.matrix(mat) p...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch6-Example_6-05d_gen.ipynb
unlicense
%pylab notebook """ Explanation: Electric Machinery Fundamentals 5th edition Chapter 6 (Code examples) Example 6-5 (d) - for generator and motor Creates a plot of the torque-speed curve of the induction motor as depicted in Figure 6-62. Note: You should first click on "Cell &rarr; Run All" in order that the plots get...
mediagit2016/workcamp-maschinelles-lernen-grundlagen
20-10-14-ml-workcamp/wc-arbeiten-tf-11-aufgabe.ipynb
gpl-3.0
# Definition der Funktion umrechnung def umrechnung(C): F = #Ihr Code hier# return #Ihr Code hier# # # Rufen Sie die definierte Funktion mit unterschiedlichen Werten (8,12.5,23,44.6) # einmal auf. Sie sollten die Ergebnisse (46.4, 54.5, 73.4, 112.28) erhalten. # Aufruf - Ersetzen Sie #Wert# durch Ihre Zahl - B...
ngcm/training-public
FEEG6016 Simulation and Modelling/04-Molecular-Dynamics-Lab-2.ipynb
mit
from IPython.core.display import HTML css_file = 'https://raw.githubusercontent.com/ngcm/training-public/master/ipython_notebook_styles/ngcmstyle.css' HTML(url=css_file) """ Explanation: Molecular Dynamics: Lab 2 In part based on Fortran code from Furio Ercolessi and the CHEM126 course of Kalju Khan. End of explanatio...
wgong/open_source_learning
learn_stem/fun_with_mypets.ipynb
apache-2.0
HTML("<img src=../images/office-suite.jpg>") """ Explanation: Fun with MyPETS Table of Contents Motivation Introduction Problem Statement Import packages History of Open Source Movement How to learn STEM (or MyPETS) References Contributors Appendix Motivation <a class="anchor" id="hid_why"></a> Current Cho...
Jackporter415/phys202-2015-work
assignments/assignment11/OptimizationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Optimization Exercise 1 Imports End of explanation """ def hat(x,a,b): V = -a*x**2 + b*x**4 return V assert hat(0.0, 1.0, 1.0)==0.0 assert hat(0.0, 1.0, 1.0)==0.0 assert hat(1.0, 10.0, 1.0)==-...
lwahedi/CurrentPresentation
talks/MDI4/MDI_FA18_pt1.ipynb
mit
import pickle mydata = [1,2,3,4,5,6,7,8,9,10] pickle.dump(mydata, open('mydata.p','wb')) """ Explanation: Collecting and Using Data in Python Laila A. Wahedi, PhD Massive Data Institute Postdoctoral Fellow <br>McCourt School of Public Policy<br> Follow along: Slides: http://Wahedi.us, Tutorial Interactive Notebook: h...
kabrapratik28/Stanford_courses
cs231n/assignment3/NetworkVisualization-TensorFlow.ipynb
apache-2.0
# As usual, a bit of setup from __future__ import print_function import time, os, json import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from cs231n.classifiers.squeezenet import SqueezeNet from cs231n.data_utils import load_tiny_imagenet from cs231n.image_utils import preprocess_image, deproc...
teuben/astr288p
notebooks/01-intro.ipynb
mit
a = 1.0 b = 2 c = "3" # let's pause and remember python has dynamic types. # float, integer and string are determined automatically from the way we enter it print(a,b,c) """ Explanation: Python Intro Notebooks What you are reading here is text in a cell in a notebook. A notebook can have many cells. This is a text (...
BONSAMURAIS/bonsai
legacy-examples/Overdetermined system resolution - sugar in soft drinks and spirits.ipynb
bsd-3-clause
from sklearn import linear_model import matplotlib.pyplot as plt import numpy as np ## without removing outliers ## wo extension = with outliers sugarwo = np.array([2.62E7,1.46E8,1.02E7,1.03E8,6.82E6,9.00E7,8.78E6,7.22E7,5.90E7,7.54E6,8.03E7,5.49E8,3.40E8,6.18E6]) wine = np.array([4.70E7,9.13E8,0,3.34E9,0,5.11E9,0,4....
enakai00/jupyter_ml4se_commentary
Solutions/02-Matrix and Vector-solution.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pandas import Series, DataFrame """ Explanation: NumPyによるベクトルと行列の計算 End of explanation """ m = np.array([[2,3],[4,5]]) v = np.array([[6],[7]]) w = np.dot(m, v) m v w """ Explanation: 練習問題 (1) 次の (2,2)行列 m と(2,1)行列(縦ベクトル)v をarrayオブジェクトとして...
AhmetHamzaEmra/Deep-Learning-Specialization-Coursera
Convolutional Neural Networks/Convolution+model+-+Step+by+Step+-+v2.ipynb
mit
import numpy as np import h5py import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' %load_ext autoreload %autoreload 2 np.random.seed(1) """ Explanation: Convolut...
giacomov/fermi_school_like
Summer_school_2016.ipynb
bsd-3-clause
# Load the software ("import the module" in python jargon) from fermi_school_like import * # Import matplotlib for plotting from matplotlib import pyplot as plt # This show the plots inline in the notebook %matplotlib inline """ Explanation: Likelihood primer These are some quick exercises to familiarize yourself ...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/sandbox-3/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: MPI-M Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Transport, Emissions, Con...
rvuduc/cse6040-ipynbs
01--intro-py.ipynb
bsd-3-clause
x = 5 x_squared = x * x x_to_the_4th = x_squared * x_squared x_to_the_4th """ Explanation: CSE 6040, Fall 2015 [01]: Intro to Python In this class, you will do a lot of development in the Python language. Python is great for rapid prototyping, meaning you can get started quickly. Yet, it's much more than a toy languag...
blua/deep-learning
embeddings/.ipynb_checkpoints/Skip-Gram word2vec-checkpoint.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...
googledatalab/notebooks
samples/ML Toolbox/Image Classification/Coast/Local End to End.ipynb
apache-2.0
import mltoolbox.image.classification as model from google.datalab.ml import * worker_dir = '/content/datalab/tmp/coast' preprocessed_dir = worker_dir + '/coast300' model_dir = worker_dir + '/model300' train_set = BigQueryDataSet('SELECT image_url, label FROM coast.train WHERE rand() < 0.04') model.preprocess(train_s...
arcyfelix/Courses
18-05-28-Complete-Guide-to-Tensorflow-for-Deep-Learning-with-Python/02-Tensorflow-Basics/06-Regression-Exercise.ipynb
apache-2.0
import pandas as pd df = pd.read_csv('./data/cal_housing_clean.csv') df.head() df.describe().T y = df['medianHouseValue'] x = df.drop('medianHouseValue', axis = 1) from sklearn.model_selection import train_test_split X_train, X_test, Y_train, Y_test = train_test_split(x, y, ...
tensorflow/text
docs/guide/decoding_api.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...
microsoft/dowhy
docs/source/example_notebooks/dowhy_refutation_testing.ipynb
mit
import dowhy from dowhy import CausalModel import pandas as pd import numpy as np # Config dict to set the logging level import logging.config DEFAULT_LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'loggers': { '': { 'level': 'WARN', }, } } logging.config.dict...
PourroyJean/ProgrammingNote
notebook/Note python/Data Analysis.ipynb
apache-2.0
import numpy as np import xlrd #With pandas import matplotlib.pyplot as plt import pandas as pd """ Explanation: PYTHON PROGRAMMING FOR DATA ANALYSIS From basics to more sophisticated command for data visualisation 0. Requirement 1. Basics python command 1. Lists 2. Numpy 3. Matplotlib 3. Dictionnaires 1. Pandas lib 1...
rocketproplab/Guides
Guides/python/betterGraphs-bokeh.ipynb
mit
import numpy as np from scipy.integrate import odeint from bokeh.plotting import figure, show from bokeh.io import output_notebook """ Explanation: Create Better Graphs with Bokeh This guide walks through the process of creating better graphs with bokeh. The coolest thing about bokeh is that it lets you create interac...
alexandrejaguar/strata-sv-2015-tutorial
03 - Data 1.ipynb
bsd-3-clause
# Import Pandas and then load the data. from pandas import read_csv df = read_csv('SFDeptPurchases.csv') """ Explanation: SF Purchases Example In this example, interact is used to build a UI for exploring San Francisco department purchases by city agency data. End of explanation """ df[:5] """ Explanation: You can ...
tommyogden/maxwellbloch
docs/examples/mbs-two-sech-6pi.ipynb
mit
import numpy as np SECH_FWHM_CONV = 1./2.6339157938 t_width = 1.0*SECH_FWHM_CONV # [τ] print('t_width', t_width) mb_solve_json = """ { "atom": { "fields": [ { "coupled_levels": [[0, 1]], "rabi_freq_t_args": { "n_pi": 6.0, "centre": 0.0, "width": %f }, ...
arne-cl/alt-mulig
python/scraping_list_of_countries.ipynb
gpl-3.0
xpath_result = tree.xpath('/html/body/div[3]/div[3]/div[4]/div/table[2]') table = xpath_result[0] for elem in table: print(elem) """ Explanation: xpath always returns a list of results, but there's only one, so we'll use that: End of explanation """ def print_outline(tree, indent=0): """print the outline of...
tylere/docker-tmpnb-ee
notebooks/1 - IPython Notebook Examples/IPython Project Examples/Interactive Widgets/File Upload Widget.ipynb
apache-2.0
class FileWidget(widgets.DOMWidget): _view_name = Unicode('FilePickerView', sync=True) value = Unicode(sync=True) filename = Unicode(sync=True) def __init__(self, **kwargs): """Constructor""" widgets.DOMWidget.__init__(self, **kwargs) # Call the base. # Allow the us...
google/starthinker
colabs/dv360_targeter.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: DV360 Bulk Targeting Editor Allows bulk targeting DV360 through Sheets and BigQuery. 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 Licens...
roatienza/Deep-Learning-Experiments
versions/2020/MLP/code/tf.keras/linear.ipynb
mit
from __future__ import absolute_import from __future__ import division from __future__ import print_function # numpy package import numpy as np # for plotting import matplotlib.pyplot as plt # keras modules from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras....
HrantDavtyan/Data_Scraping
2018/Text_mining_-_Clustering.ipynb
apache-2.0
import time import requests import numpy as np import pandas as pd from itertools import chain from bs4 import BeautifulSoup import matplotlib.pyplot as plt from textblob import TextBlob from gensim.models import word2vec from scipy.cluster.hierarchy import ward, dendrogram from sklearn.metrics.pairwise import cosine...
napjon/krisk
notebooks/waterfall-barline.ipynb
bsd-3-clause
import numpy as np import pandas as pd import krisk.plot as kk from krisk import init_notebook; init_notebook() np.random.seed(0) df = pd.DataFrame({'val': -1 + 10 * np.random.randn(10)}) df.head() kk.waterfall(df['val']) """ Explanation: Starting from 0.3, krisk support waterfall chart and barline chart. End of ex...
poppy-project/community-notebooks
tutorials-education/poppy_4dof_arm_mini_pousser_de_cube.ipynb
lgpl-3.0
from poppy.creatures import Poppy4dofArmMini mini_dof = Poppy4dofArmMini(simulator='vrep') """ Explanation: Activité : déplacer un objet à l'aide d'un bras robotisé Compétences visées par cette activité : Résoudre un problème par l'expérimentation. Comparer l'approche par l'expérimentation avec avec l'approche par l...
lwcook/horsetail-matching
notebooks/Targets.ipynb
mit
from horsetailmatching import HorsetailMatching, GaussianParameter from horsetailmatching.demoproblems import TP3 from scipy.optimize import minimize import numpy as np import matplotlib.pyplot as plt def plotHorsetail(theHM, c='b', label=''): (q, h, t), _, _ = theHM.getHorsetail() plt.plot(q, h, c=c, label=l...
geography-munich/sciprog
material/scipy_intro.ipynb
apache-2.0
from scipy import stats import numpy as np """ Explanation: SciPy introduction The SciPy framework builds on top of the low-level NumPy framework for multidimensional arrays, and provides a large number of higher-level scientific algorithms. Some of the topics that SciPy covers are: Special functions (scipy.special) ...
kfollette/AST337-Fall2017
Labs/Lab2/Lab2.ipynb
mit
# Load packages import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: AST 337 In-Class Lab #2 Wednesday, September 13, 2017 Names: [insert your names here] In this lab, you will (1) work directly with published astronomical data from the VizieR database, (2) conti...
jpzhangvincent/MobileAppMarketAnalysis
notebooks/Correlation between app size and app quality.ipynb
mit
rating_df = app[["name","size","overall_rating", "current_rating", 'num_current_rating', "num_overall_rating"]].dropna() rating_cleaned = {'1 star':1, "1 and a half stars": 1.5, '2 stars': 2, '2 and a half stars':2.5, "3 stars":3, "3 and a half stars":3.5, "4 stars": 4, '4 and a half stars': 4.5, "5 s...
LaurelOak/hydro-teaching-resources
Assignment6StreamflowOrovilleDam.ipynb
bsd-3-clause
# Import numerical tools import numpy as np #Import pandas for reading in and managing data import pandas as pd # Import pyplot for plotting import matplotlib.pyplot as plt #Import seaborn (useful for plotting) import seaborn as sns # Magic function to make matplotlib inline; other style specs must come AFTER %matp...
scotthuang1989/Python-3-Module-of-the-Week
data_structure/Counter — Count Hashable Objects.ipynb
apache-2.0
import collections print(collections.Counter(['a', 'b', 'c', 'a', 'b', 'b'])) print(collections.Counter({'a': 2, 'b': 3, 'c': 1})) print(collections.Counter(a=2, b=3, c=1)) """ Explanation: A Counter is a container that keeps track of how many times equivalent values are added. It can be used to implement the same al...
fjaviersanchez/McQ_Workshop
McQ_workshop.ipynb
mit
science_image_path_g = 'data/seo_m66_g-band_180s_apagul_1.fits' #Type the path to your image sci_g = fits.open(science_image_path_g) sci_im_g = fits.open(science_image_path_g)[0].data plt.imshow(sci_im_g,cmap='gray', vmax=1800, norm=matplotlib.colors.LogNorm()) plt.colorbar() """ Explanation: Let's take a look at the ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/feature_engineering/solutions/3_keras_basic_feat_eng.ipynb
apache-2.0
# Run the chown command to change the ownership !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Install Sklearn # scikit-learn simple and efficient tools for predictive data analysis # Built on NumPy, SciPy, and matplotlib !python3 -m pip install --user sklearn # You can use any Python source fil...
napsternxg/DataMiningPython
NLP checks.ipynb
gpl-3.0
nltk.download("movie_reviews") nltk.download("punkt") from nltk.corpus import movie_reviews movie_reviews.categories() movie_reviews.words() sents = movie_reviews.sents() len(sents) sents[0] for i, s in enumerate(sents[:10]): print "S[%s]:\t%s" % (i, " ".join(s)) """ Explanation: NLTK checks More details at...
jmhsi/justin_tinker
data_science/courses/deeplearning2/pytorch-tut.ipynb
apache-2.0
x = torch.Tensor(5, 3); x x = torch.rand(5, 3); x x.size() y = torch.rand(5, 3) x + y torch.add(x, y) result = torch.Tensor(5, 3) torch.add(x, y, out=result) # anything ending in '_' is an in-place operation y.add_(x) # adds x to y in-place # standard numpy-like indexing with all bells and whistles x[:,1] """ ...
ES-DOC/esdoc-jupyterhub
notebooks/snu/cmip6/models/sandbox-1/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'snu', 'sandbox-1', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: SNU Source ID: SANDBOX-1 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbulen...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/03_tensorflow/labs/c_dataset.ipynb
apache-2.0
from google.cloud import bigquery import tensorflow as tf import numpy as np import shutil print(tf.__version__) """ Explanation: <h1> 2c. Loading large datasets progressively with the tf.data.Dataset </h1> In this notebook, we continue reading the same small dataset, but refactor our ML pipeline in two small, but si...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/66_Registration_Demons.ipynb
apache-2.0
import SimpleITK as sitk import numpy as np # If the environment variable SIMPLE_ITK_MEMORY_CONSTRAINED_ENVIRONMENT is set, this will override the ReadImage # function so that it also resamples the image to a smaller size (testing environment is memory constrained). %run setup_for_testing import registration_utilitie...
csaladenes/csaladenes.github.io
present/mcc2/PythonDataScienceHandbook/05.12-Gaussian-Mixtures.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns; sns.set() import numpy as np """ Explanation: <!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; t...
kpn-advanced-analytics/modelFactoryPy
Template/Template_postgres.ipynb
mit
main.getConnection() # this will also create main.engine variable model_id = 'titanic_training' #main.addModelId('titanic_training','Training on titanic data','passengerid') main.getSessionId(model_id) # this will also create main.session_id variable """ Explanation: 1. Get connection; define model_id, get session i...
rasbt/python-machine-learning-book
code/ch10/ch10.ipynb
mit
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,sklearn,seaborn """ Explanation: Copyright (c) 2015, 2016 Sebastian Raschka https://github.com/rasbt/python-machine-learning-book MIT License Python Machine Learning - Code Examples Chapter 10 - Predicting Continuous Target Varia...
tpin3694/tpin3694.github.io
machine-learning/variance_thresholding_for_feature_selection.ipynb
mit
from sklearn import datasets from sklearn.feature_selection import VarianceThreshold """ Explanation: Title: Variance Thresholding For Feature Selection Slug: variance_thresholding_for_feature_selection Summary: How to select the best features for machine learning using variance thresholding in Python. Date: 2017-09...
NYUDataBootcamp/Materials
Code/notebooks/bootcamp_web_apis.ipynb
mit
import pandas as pd # data package import matplotlib.pyplot as plt # graphics import datetime as dt # date tools, used to note current date import sys # these are new import requests %matplotlib inline print('\nPython version: ', sys.version) print('Pandas version: ', pd.__version__) prin...
graphistry/pygraphistry
demos/more_examples/simple/MarvelTutorial.ipynb
bsd-3-clause
import graphistry, igraph, pandas as pd # To specify Graphistry account & server, use: # graphistry.register(api=3, username='...', password='...') # For more options, see https://github.com/graphistry/pygraphistry#configure """ Explanation: PyGraphistry Example: Graphing the Marvel Universe Plots hero social networ...
martinjrobins/hobo
examples/sampling/adaptive-covariance-haario-bardenet.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import pints import pints.plot import pints.toy # Load a forward model model = pints.toy.LogisticModel() # Create some toy data real_parameters = [0.015, 500] times = np.linspace(0, 1000, 1000) org_values = model.simulate(real_parameters, times) # Add noise noise = ...
tensorflow/docs-l10n
site/ko/tutorials/generative/adversarial_fgsm.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...
mpacer/nb_struct2app
nbgrader.ipynb
mit
def squares(n): """Compute the squares of numbers from 1 to n, such that the ith element of the returned list equals i^2. """ ### BEGIN SOLUTION if n < 1: raise ValueError("n must be greater than or equal to 1") return [i ** 2 for i in range(1, n + 1)] ### END SOLUTION """ Exp...
sdpython/pyquickhelper
_unittests/ut_helpgen/notebooks_rst/having_a_form_in_a_notebook.ipynb
mit
from IPython.display import HTML, Javascript, display_html, display_javascript input_form = """ <div style="background-color:gainsboro; width:500px; padding:10px;"> <label>Variable Name: </label> <input type="text" id="var_name" value="myvar" size="170" /> <label>Variable Value: </label> <input type="text" id="var_va...
zaqwes8811/micro-apps
self_driving/deps/Kalman_and_Bayesian_Filters_in_Python_master/Appendix-A-Installation.ipynb
mit
from __future__ import division, print_function """ Explanation: Table of Contents Installation End of explanation """ print(3+7.2) """ Explanation: This book is written in Jupyter Notebook, a browser based interactive Python environment that mixes Python, text, and math. I choose it because of the interactive feat...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/ner_mtl.ipynb
apache-2.0
!pip install hanlp -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/ner_mtl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Ope...
googledatalab/notebooks
samples/ML Toolbox/Regression/Census/6 Cleanup.ipynb
apache-2.0
workspace_path = '/content/datalab/workspace/census' !rm -fr {workspace_path} """ Explanation: Removing files This is an optional notebook in the census sample series. Run any cell if you want to remove the files or models that were made in previous notebooks. This assumes you did not change the default locations or n...
ondrolexa/sg2
20_Introduction_to_stress_in_geology.ipynb
mit
%pylab inline S = array([[10, 0], [0, 5]]) tau = [] sn = [] for theta in pi*uniform(size=5000): n = array([cos(theta), sin(theta)]) sv = dot(S, n) sn.append(dot(sv, n)) tau.append(norm(sv-n*dot(sv, n))) plot(sn, tau, 'k.') axis('equal') margins(x=0.1, y=0.1) show() """ Explanation: Stress in geology...
tensorflow/docs-l10n
site/ko/addons/tutorials/average_optimizers_callback.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...
gwsb-istm-6212-fall-2016/syllabus-and-schedule
lectures/week-06/20161004-lecture-notes.ipynb
cc0-1.0
%load_ext sql !createdb week6 %sql postgresql://dchud@localhost:5432/week6 !wget https://raw.githubusercontent.com/gwsb-istm-6212-fall-2016/syllabus-and-schedule/master/projects/project-01/2016q1.csv.zip !unzip 2016q1.csv.zip !wc -l 2016q1.csv !csvcut -n 2016q1.csv """ Explanation: SQL Indexes and basic ETL This...
steinam/teacher
jup_notebooks/data-science-ipython-notebooks-master/python-data/unit_tests.ipynb
mit
!pip install nose """ Explanation: This notebook was prepared by Donne Martin. Source and license info is on GitHub. Nose Unit Tests with IPython Notebook Nose Testing is a vital part of software development. Nose extends unittest to make testing easier. Install Nose Run the following command line: End of explanation...
HSE-LaMBDA/modern-technologies-for-ml-and-big-data
lecture1/NumPy_crash_course.ipynb
mit
import numpy as np """ Explanation: Matplotlib and NumPy crash course You may install numpy, matplotlib, sklearn and many other usefull package e.g. via Anaconda distribution. End of explanation """ np.array(range(10)) np.ndarray(shape=(5, 4)) np.linspace(0, 1, num=20) np.arange(0, 20) np.zeros(shape=(5, 4)) np...
rayxi2dot71828/FluentPython
Chapter 2 - Iterables Consistency.ipynb
mit
couleurs = ["rouge", "orange", "jaune", "vert", "bleu", "indigo", "violet"] tailles = ["page", "homme", "demi patron", "patron", "grand patron"] [(couleur, taille) for couleur in couleurs for taille in tailles] couleurs_et_tailles = ((couleur, taille) for couleur in couleurs for taille in tailles) couleurs_et_taille...
sassoftware/sas-viya-programming
deeplearning/twitter_sentiment/RNN_Twitter_Sentiment_Analysis.ipynb
apache-2.0
import swat from IPython.display import display swat.options.cas.exception_on_severity = 2 s = swat.CAS('rdcgrd075.unx.sas.com', 3217,authinfo=r'/u/saleem/.authinfo') s.loadactionset('deeplearn') """ Explanation: Twitter Sentiment Analysis Businesses and organizations around the world know that the first requiremen...
Grzego/nn-workshop
1-neural-networks-intro/neural-networks-completed.ipynb
mit
# skorzystamy z gotowej funkcji do pobrania tego zbioru from sklearn.datasets import fetch_mldata mnist = fetch_mldata('MNIST original') """ Explanation: Dane treningowe Ponieważ będziemy potrzebowali na czymś wytrenować naszą sieć neuronową skorzystamy z popularnego zbioru w Machine Learningu czyli MNIST. Zbiór ten z...
MATH497project/MATH497-DiabeticRetinopathy
ICO Data Object Example.ipynb
mit
import ICO import os import pandas as pd import time """ Explanation: ICO Data object example End of explanation """ data = ICO.Data(os.getcwd()+'/data/') """ Explanation: The Data object is initialized with the path to the directory of .pickle files. On creation it reads in the pickle files, but does not transform...
aborgher/Main-useful-functions-for-ML
Python_jupyter_utilities/myFunctions.ipynb
gpl-3.0
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import xgboost as xgb from sklearn.metrics import roc_curve, auc from sklearn.metrics import precision_recall_curve df = pd.read_csv("iris.csv") """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Rot...
birnstiel/disktemperature
tests/test_evolutionary_tracks.ipynb
gpl-3.0
from disktemperature import pmstracks import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import style from constants import R_sun,AU,year,L_sun %matplotlib inline style.use(['seaborn-dark',{'axes.grid': True,'font.size':18,'figure.figsize':(10,8),'lines.linewidth':2}]); ""...
tanghaibao/goatools
notebooks/Enrichment_analyses_human_phenotype_ontology.ipynb
bsd-2-clause
fin_study = 'data/hpo/genes.list' # Study genes fin_pop = 'data/hpo/gobackground.list' # Population genes fin_obo = 'data/hpo/hp.obo' # DAG containing HPO terms fin_anno = 'data/hpo/hpo.annotation.tab' # Annotation of genes-to-HPO terms """ Explanation: Do enrichment analyses using the Human ...
mne-tools/mne-tools.github.io
0.20/_downloads/ef81cbafce45c79dbfcdf37970a37c57/plot_source_space_snr.ipynb
bsd-3-clause
# Author: Padma Sundaram <tottochan@gmail.com> # Kaisu Lankinen <klankinen@mgh.harvard.edu> # # License: BSD (3-clause) import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse import numpy as np import matplotlib.pyplot as plt print(__doc__) data_path = s...
mne-tools/mne-tools.github.io
stable/_downloads/9d142d98d094666b7fd2d94155f8b3ec/decoding_unsupervised_spatial_filter.ipynb
bsd-3-clause
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Asish Panda <asishrocks95@gmail.com> # # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.decoding import UnsupervisedSpatialFilter from sklearn.decomposition import PCA, FastICA...
cloudmesh/book
notebooks/opencv/secchi.ipynb
apache-2.0
import os, sys from os.path import expanduser os.path home = expanduser("~") sys.path.append('/usr/local/Cellar/opencv/3.3.1_1/lib/python3.6/site-packages/') sys.path.append(home + '/.pyenv/versions/OPENCV/lib/python3.6/site-packages/') import cv2 cv2.__version__ ! pip install numpy > tmp.log ! pip install matplotlib >...
MingChen0919/learning-apache-spark
notebooks/01-data-strcture/.ipynb_checkpoints/1.2-dataframe-checkpoint.ipynb
mit
from pyspark import SparkContext sc = SparkContext(master = 'local') from pyspark.sql import SparkSession spark = SparkSession.builder \ .appName("Python Spark SQL basic example") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() """ Explanation: DataFrame object Crea...
Naereen/notebooks
Trying_the_SnakeViz_Jupyter_extension_for_profiling__27-02-2021.ipynb
mit
!python3 -m pip install snakeviz %load_ext snakeviz """ Explanation: Trying the SnakeViz Jupyter extension for profiling I want to try the https://jiffyclub.github.io/snakeviz/ SnakeViz Jupyter extension for profiling Python code right inside the Jupyter notebook! Author: Lilian Besson (@Naereen ; License: MIT Licen...
roryyorke/python-control
examples/cruise.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from math import pi import control as ct """ Explanation: Cruise control Richard M. Murray and Karl J. Åström 17 Jun 2019 The cruise control system of a car is a common feedback system encountered in everyday life. The system attempts to maintain a constant velocity i...