repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
brclark-usgs/flopy
examples/Notebooks/flopy3_Zaidel_example.ipynb
bsd-3-clause
%matplotlib inline import os import sys import platform import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import flopy print(sys.version) print('numpy version: {}'.format(np.__version__)) print('matplotlib version: {}'.format(mpl.__version__)) print('flopy version: {}'.format(flopy.__version_...
diegocavalca/Studies
deep-learnining-specialization/1. neural nets and deep learning/resources/Deep Neural Network - Application v3.ipynb
cc0-1.0
import time import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage from dnn_app_utils_v2 import * %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams[...
WNoxchi/Kaukasos
FADL1/L7CA_lesson7-cifar10.ipynb
mit
%matplotlib inline %reload_ext autoreload %autoreload 2 """ Explanation: CIFAR 10 21 Jan 2018 22 Jan 2018 End of explanation """ from fastai.conv_learner import * PATH = "data/cifar10/" os.makedirs(PATH, exist_ok=True) classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck') stats ...
Tahsin-Mayeesha/Udacity-Machine-Learning-Nanodegree
projects/creating_customer_segments/customer_segments.ipynb
mit
# Import libraries necessary for this project import numpy as np import pandas as pd import renders as rs import seaborn as sns from IPython.display import display # Allows the use of display() for DataFrames # Show matplotlib plots inline (nicely formatted in the notebook) %matplotlib inline # Load the wholesale cus...
scheib/chromium
third_party/tensorflow-text/src/docs/tutorials/bert_glue.ipynb
bsd-3-clause
#@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...
littlewizardLI/Udacity-ML-nanodegrees
Project-practice--naive_bayes_tutorial/Naive_Bayes_tutorial.ipynb
apache-2.0
''' Solution ''' import pandas as pd # Dataset from - https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection df = pd.read_table('smsspamcollection/SMSSpamCollection', sep='\t', header=None, names=['label', 'sms_message']) # Output printing out first 5 col...
metpy/MetPy
v0.11/_downloads/c1a3b4ec1d09d4debc078297d433a9b2/Point_Interpolation.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature from matplotlib.colors import BoundaryNorm import matplotlib.pyplot as plt import numpy as np from metpy.cbook import get_test_data from metpy.interpolate import (interpolate_to_grid, remove_nan_observations, remove_repeat_coo...
sonelu/pypot
samples/notebooks/Benchmark your Poppy robot.ipynb
gpl-3.0
from __future__ import print_function, division from ipywidgets import interact %pylab inline """ Explanation: Benchmark your Poppy robot The goal of this notebook is to help you identify the performance of your robot and where the bottle necks are. We will measure: * the time to read/write the position to one motor...
ChadFulton/statsmodels
examples/notebooks/glm_weights.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.formula.api as smf import statsmodels.api as sm """ Explanation: Weighted Generalized Linear Models End of explanation """ print(sm.datasets.fair.NOTE) """ Explanation: Weighted GLM: Poisson response data Load data In this example, we'll use the affair datas...
ELind77/gensim
docs/notebooks/Tensorboard_visualizations.ipynb
lgpl-2.1
import gensim import pandas as pd import smart_open import random # read data dataframe = pd.read_csv('movie_plots.csv') dataframe """ Explanation: TensorBoard Visualizations In this tutorial, we will learn how to visualize different types of NLP based Embeddings via TensorBoard. TensorBoard is a data visualization f...
jbannister/Stanford
Latent_Me.ipynb
mit
!git clone https://github.com/Puzer/stylegan %cd stylegan # Use the version this notebook was built with !git checkout c3fb250c65840c8837ded78e34485227755c2473 !mkdir raw_images aligned_images generated_images latent_representations """ Explanation: <a href="https://colab.research.google.com/github/jbannister/Stanfo...
ZoranPandovski/al-go-rithms
machine_learning/python/gradient boosted tree regressor/GBDTRegressor.ipynb
cc0-1.0
import numpy as np from sklearn.tree import DecisionTreeRegressor """ Explanation: Simple Implementation of Gradient Boosted Decision Tree For Regression for this implementation we use squared loss divided by 2 as loss function for GBDT $$L(y^{true}, y^{pred}) = \frac{1}{2} (y^{true} - y^{pred})^2 $$ so that our loss ...
RTHMaK/RPGOne
scipy-2017-sklearn-master/notebooks/04 Training and Testing Data.ipynb
apache-2.0
from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier iris = load_iris() X, y = iris.data, iris.target classifier = KNeighborsClassifier() """ Explanation: SciPy 2016 Scikit-learn Tutorial Training and Testing Data To evaluate how well our supervised models generalize, we can spli...
zzsza/Datascience_School
15. 선형 회귀 분석/02. 선형 회귀 분석의 기초.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline from sklearn.datasets import make_regression bias = 100 X0, y, coef = make_regression(n_samples=100, n_features=1, bias=bias, noise=10, coef=True, random_state=1) X = np.hstack([np.ones_like(X0), X0]) np.ones_like(X0)[:5] # no...
molpopgen/fwdpy
docs/pages/popsizes.ipynb
gpl-3.0
%matplotlib inline %pylab inline from __future__ import print_function import numpy as np import array import matplotlib.pyplot as plt #population size N=1000 #nlist corresponds to a constant population size for 10N generations #note the "dtype" argument. Without it, we'd be defaulting to int64, #which is a 64-bit sig...
mne-tools/mne-tools.github.io
0.19/_downloads/2369809188e1e28fb4d0ad564cdfa36d/plot_source_space_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, source_band_induced_power print(__doc__) """ Explanation: Compute induced power in...
pybel/pybel-tools
notebooks/Directed, Polar Heat Diffusion.ipynb
mit
import random import sys import time from abc import ABC, abstractmethod from collections import defaultdict from dataclasses import dataclass from itertools import product from typing import Optional import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd...
timothyb0912/pylogit
examples/notebooks/mlogit Benchmark--Train and Fishing.ipynb
bsd-3-clause
from collections import OrderedDict # For recording the model specification import pandas as pd # For file input/output import numpy as np # For vectorized math operations import pylogit as pl # For MNL model estimation ...
amorgun/shad-ml-notebooks
notebooks/s1-1/intro.ipynb
unlicense
a = 1 + 2 a a + 1 _ ? sum ! ps -xa | grep python import time %time time.sleep(1) """ Explanation: IPython Python End of explanation """ import numpy as np np.array([[1,2,3], [7,1,2]]) data = np.array([1,2,3,4,5]) data data[1:-2] data + 1 data * 2 data * data np.sum(data * data) data.dot(data) data > 2...
bloomberg/bqplot
examples/Marks/Pyplot/HeatMap.ipynb
apache-2.0
import numpy as np from ipywidgets import Layout import bqplot.pyplot as plt from bqplot import ColorScale """ Explanation: Heatmap The HeatMap mark represents a 2d matrix of values as a color image. It can be used to visualize a 2d function, or a grayscale image for instance. HeatMap is very similar to the GridHeatMa...
GoogleCloudPlatform/asl-ml-immersion
notebooks/text_models/solutions/text_generation.ipynb
apache-2.0
import os import time import numpy as np import tensorflow as tf """ Explanation: Text generation with an RNN Learning Objectives Learn how to generate text using a RNN Create training examples and targets for text generation Build a RNN model for sequence generation using Keras Subclassing Create a text generator a...
quantumlib/OpenFermion
docs/tutorials/bosonic_operators.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...
NuGrid/NuPyCEE
DOC/Capabilities/AddingDataToStellab.ipynb
bsd-3-clause
%matplotlib nbagg import matplotlib.pyplot as plt from NuPyCEE import stellab as st """ Explanation: Adding Stellar Data to STELLAB Contributors: Christian Ritter In construction End of explanation """ s1=st.stellab() xaxis='[Fe/H]' yaxis='[O/Fe]' s1.plot_spectro(fig=1,xaxis=xaxis,galaxy='carina') plt.xlim(-4.5,1),...
OpenWeavers/openanalysis
doc/Langauge/14 - Inheritance.ipynb
gpl-3.0
class Person: # Constructor def __init__(self, name, age): self.name = name self.age = age def __str__(self): return 'name = {}\nage = {}'.format(self.name,self.age) # Inherited or Sub class class Employee(Person): def __init__(self, name, age, employee_id): ...
eriksalt/jupyter
Python Quick Reference/Collections.ipynb
mit
from collections import deque dq = deque() dq.append(1) dq.append(2) dq.appendleft(3) dq v = dq.pop() v dq.popleft() dq """ Explanation: Python Collections Quick Reference Table Of Contents <a href="#1.-Deque">Deque</a> <a href="#2.-Heapq">Heapq</a> <a href="#3.-Counter">Counter</a> 1. Deque End of explanation "...
jrg365/gpytorch
examples/07_Pyro_Integration/Clustered_Multitask_GP_Regression.ipynb
mit
import math import torch import pyro import gpytorch from matplotlib import pyplot as plt %matplotlib inline %load_ext autoreload %autoreload 2 # this is for running the notebook in our testing framework import os smoke_test = ('CI' in os.environ) """ Explanation: Clustered Multitask GP (w/ Pyro/GPyTorch High-Level ...
deepfield/ibis
docs/source/notebooks/tutorial/10-Adding-a-new-reduction-expression.ipynb
apache-2.0
import ibis.expr.datatypes as dt import ibis.expr.rules as rlz from ibis.expr.operations import Reduction, Arg class BitwiseAnd(Reduction): arg = Arg(rlz.column(rlz.integer)) where = Arg(rlz.boolean, default=None) output_type = rlz.scalar_like('arg') """ Explanation: Extending Ibis Part 2: Adding a New ...
mne-tools/mne-tools.github.io
0.19/_downloads/2b9ae87368ee06cd9589fd87e1be1d30/plot_time_frequency_mixed_norm_inverse.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse from mne.inverse_sparse import tf_mixed_n...
danielfather7/teach_Python
SEDS_Hw/seds-hw-2-procedural-python-part-1-danielfather7/SEDS-HW2.ipynb
gpl-3.0
import os filename = 'HCEPDB_moldata.zip' if os.path.exists(filename): print('File already exists.') else: print("File doesn't exist.") import requests url = 'http://faculty.washington.edu/dacb/HCEPDB_moldata.zip' req = requests.get(url) assert req.status_code == 200 with open(filename, 'wb') as f: f.wri...
NICTA/revrand
demos/reparameterization_trick.ipynb
apache-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as pl pl.style.use('ggplot') from scipy.stats import norm from scipy.special import expit from scipy.integrate import quadrature from scipy.misc import derivative from revrand.mathfun.special import softplus from revrand.optimize import sgd, Adam # Ini...
AhmetHamzaEmra/Deep-Learning-Specialization-Coursera
Neural Networks and Deep Learning/Python_Basics_With_Numpy_v3.ipynb
mit
### START CODE HERE ### (≈ 1 line of code) test = 'Hello World' ### END CODE HERE ### print ("test: " + test) """ Explanation: Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fami...
ktaneishi/deepchem
examples/notebooks/Conditional_GAN.ipynb
mit
import deepchem as dc import numpy as np import tensorflow as tf n_classes = 4 class_centers = np.random.uniform(-4, 4, (n_classes, 2)) class_transforms = [] for i in range(n_classes): xscale = np.random.uniform(0.5, 2) yscale = np.random.uniform(0.5, 2) angle = np.random.uniform(0, np.pi) m = [[xscale...
probml/pyprobml
deprecated/bernoulli_hmm_example.ipynb
mit
!pip install git+git://github.com/lindermanlab/ssm-jax-refactor.git import ssm """ Explanation: <a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/bernoulli_hmm_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In...
mspieg/principals-appmath
PolynomialFun.ipynb
cc0-1.0
%matplotlib inline import numpy as np import scipy.linalg as la import matplotlib.pyplot as plt """ Explanation: <table> <tr align=left><td><img align=left src="./images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved MIT license. ...
seg/2016-ml-contest
MandMs/03_Facies_classification_MandMs_feature_engineering_derivatives_moments_glcms_nofacies_data.ipynb
apache-2.0
# import data and filling missing PE values with average filename = 'nofacies_data.csv' training_data = pd.read_csv(filename) training_data['PE'].fillna((training_data['PE'].mean()), inplace=True) print np.shape(training_data) training_data['PE'].fillna((training_data['PE'].mean()), inplace=True) print np.shape(tra...
gwtsa/gwtsa
examples/notebooks/9_Response function comparison.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from scipy.special import gammainc, gammaincinv from scipy.integrate import quad import pandas as pd import pastas as ps %matplotlib inline rain = ps.read.read_knmi('data_notebook_5/etmgeg_260.txt', variables='RH').series evap = ps.read.read_knmi('data_notebook_5/etmg...
ES-DOC/esdoc-jupyterhub
notebooks/cas/cmip6/models/sandbox-3/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cas', 'sandbox-3', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: CAS Source ID: SANDBOX-3 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbulen...
netodeolino/TCC
TCC 02/Resultados/Janeiro/Janeiro.ipynb
mit
all_crime_tipos.head(10) all_crime_tipos_top10 = all_crime_tipos.head(10) all_crime_tipos_top10.plot(kind='barh', figsize=(12,6), color='#3f3fff') plt.title('Top 10 crimes por tipo (Jan 2017)') plt.xlabel('Número de crimes') plt.ylabel('Crime') plt.tight_layout() ax = plt.gca() ax.xaxis.set_major_formatter(ticker.StrM...
phoebe-project/phoebe2-docs
2.1/tutorials/requiv_crit_semidetached.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Critical Radii: Semidetached Systems Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %ma...
laurentperrinet/Khoei_2017_PLoSCB
notebooks/SI_controls.ipynb
mit
%%writefile experiment_SI_controls.py """ A bunch of control runs """ import MotionParticlesFLE as mp gen_dot = mp.generate_dot import numpy as np import os from default_param import * image = {} experiment = 'SI' N_scan = 5 base = 10. #mp.N_trials = 4 for stimulus_tag, im_arg in zip(stim_labels, stim_args): #for st...
GoogleCloudPlatform/training-data-analyst
blogs/sme_academy/tfx/03_train.ipynb
apache-2.0
import tensorflow as tf import tensorflow_data_validation as tfdv import tensorflow_transform as tft print('TF version: {}'.format(tf.__version__)) print('TFT version: {}'.format(tft.__version__)) print('TFDV version: {}'.format(tfdv.__version__)) PROJECT = 'cloud-training-demos' # Replace with your PROJECT BUCKET...
amcdawes/QMlabs
Lab 8 - Two-particle systems.ipynb
mit
import matplotlib.pyplot as plt from numpy import sqrt,pi,sin,cos,arange from qutip import * """ Explanation: Two-particle systems An introduction to multi-particle spaces, starting with photon polarization states. This lab answers the question: How do we describe the state of two photons? End of explanation """ H =...
FISHunderscore/Pendulum-Wave
Pendulum-Wave.ipynb
gpl-3.0
import math from math import pi lengthsM = [] danceDuration = 60 mostOscils = 51 # Where n is the index of the pendulum (starting at 0) length = lambda n: 9.81 * (danceDuration / (2*pi*(mostOscils + n)))**2 for n in range(12): # 12 pendulums, indexed 0-11 lengthsM.append(length(n)) # Convert lengths to inches fo...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_cluster_stats_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.time_frequency import single_trial_power from mne.stats import permutation_cluster_test from mne.datasets import sample print(_...
wyndwarrior/HouseRank
DataCollection/craigslist_scraper.ipynb
mit
url_base = 'http://sfbay.craigslist.org/search/eby/apa' params = dict(search_distance=4, postal=94720) rsp = requests.get(url_base, params=params) html = bs4(rsp.text, 'html.parser') apts = html.find_all('p', attrs={'class': 'row'}) import time cl_data = [] for i in [0,100,200,300,400,500,600,700,800,900,1000,1100]: ...
ruleva1983/udacity-mle
boston_housing/boston_housing.ipynb
gpl-3.0
# Import libraries necessary for this project import numpy as np import pandas as pd import visuals as vs # Supplementary code from sklearn.cross_validation import ShuffleSplit # Pretty display for notebooks %matplotlib inline # Load the Boston housing dataset data = pd.read_csv('housing.csv') prices = data['MEDV'] f...
nwhidden/ND101-Deep-Learning
gan_mnist/Intro_to_GANs_Exercises.ipynb
mit
%matplotlib inline import pickle as pkl 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') """ Explanation: Generative Adversarial Network In this notebook, we'll be building a generativ...
poethacker/hello
Clustering.ipynb
apache-2.0
import warnings warnings.filterwarnings("ignore") from collections import Counter import numpy as np from scipy import stats import pandas as pd import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn import metrics from sklearn.metrics import pairwise_distances from sklearn.cluster import Aggl...
queirozfcom/python-sandbox
python3/notebooks/crimes/task.ipynb
mit
# to cluster districts by crimes, I will represent each district as a vector with the counts for each crime # that happened in there # but District is a floating point number # how many different Districts are there? districts = df.District.unique() # ok so even though it's a float it's probably a categorical column...
bassio/omicexperiment
omicexperiment/docs/02_experiment_filters.ipynb
bsd-3-clause
%load_ext autoreload %autoreload 2 #Load our data from omicexperiment.experiment.microbiome import MicrobiomeExperiment mapping = "example_map.tsv" biom = "example_fungal.biom" tax = "blast_tax_assignments.txt" exp = MicrobiomeExperiment(biom, mapping,tax) """ Explanation: Experiment objects filters - the rationale...
catalystcomputing/DSIoT-Python-sessions
Session4/code/02 Decision Tree Classifier - random_state.ipynb
apache-2.0
# Imports from sklearn import metrics from sklearn.tree import DecisionTreeClassifier import pandas as pd # Training Data training_raw = pd.read_table("../data/training_data.dat") df_training = pd.DataFrame(training_raw) # test Data test_raw = pd.read_table("../data/test_data.dat") df_test = pd.DataFrame(test_raw) # t...
stbaercom/europython2015_logging
europython_2015_logging_talk.ipynb
mit
from datetime import datetime def my_division_p(dividend, divisor): try: print("Debug, Division : {}/{}".format(dividend,divisor)) result = dividend / divisor return result except (ZeroDivisionError, TypeError): print("Error, Division Failed") return None def division_ta...
marcelomiky/PythonCodes
Coursera/CICCP2/.ipynb_checkpoints/Curso Introdução à Ciência da Computação com Python - Parte 2-checkpoint.ipynb
mit
def cria_matriz(tot_lin, tot_col, valor): matriz = [] #lista vazia for i in range(tot_lin): linha = [] for j in range(tot_col): linha.append(valor) matriz.append(linha) return matriz x = cria_matriz(2, 3, 99) x def cria_matriz(tot_lin, tot_col, valor): matriz =...
AllenDowney/ModSim
soln/chap07.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/' ...
eric11/PMCnetworks
1-scape-parse/parser-postprocessing.ipynb
mit
import sqlite3 conn = sqlite3.connect('pmcv2-full.db') c = conn.cursor() c.execute('''CREATE INDEX pmidix ON refs(pmid)''') c.execute('''CREATE INDEX pmcidix ON pmcidmap(pmid)''') c.execute('''CREATE INDEX metaix ON meta(pmid)''') c.execute('''CREATE INDEX authorsix ON authors(pmid)''') c.execute('''CREATE INDEX keywo...
Silmathoron/nest-simulator
doc/model_details/noise_generator.ipynb
gpl-2.0
import sympy sympy.init_printing() x = sympy.Symbol('x') sympy.series((1-sympy.exp(-x))/(1+sympy.exp(-x)), x) """ Explanation: The NEST noise_generator Hans Ekkehard Plesser, 2015-06-25 This notebook describes how the NEST noise_generator model works and what effect it has on model neurons. NEST needs to be in your PY...
Kaggle/learntools
notebooks/ml_explainability/raw/tut5_shap_advanced.ipynb
apache-2.0
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier data = pd.read_csv('../input/fifa-2018-match-statistics/FIFA 2018 Statistics.csv') y = (data['Man of the Match'] == "Yes") # Convert from string "Yes"/"No" to binary feature_...
vravishankar/Jupyter-Books
Errors+and+Exceptions.ipynb
mit
print('Hello) """ Explanation: Errors and Exceptions While executing a python program we may encounter errors. There are 2 types of errors: Syntax Errors - When you don't follow the proper structure of the python program (Like missing a quote during initialising a string). Exceptions - Sometimes even when the syntax ...
markdewing/qmc_algorithms
Wavefunctions/Explain_Bspline.ipynb
mit
xs = Symbol('x') knots = [0,1,2,3,4,5,6] # Third-order bspline sym_basis = bspline_basis_set(3, knots, xs) # Form for one basis function sym_basis[0] # Plot some basis functions nbasis_to_plot = 3 npoints_to_plot = 40 basis_y = np.zeros((nbasis_to_plot, npoints_to_plot)) xvals = np.zeros(npoints_to_plot) for i in ran...
ProfessorKazarinoff/staticsite
content/code/flask/sqlite_play.ipynb
gpl-3.0
import sqlite3 db = sqlite3.connect("name_database.db") """ Explanation: To create a new database, we first import sqlite3 and then instantiate a new database object with the sqlite3.connect() method. End of explanation """ # create a database called name_database.db # add one table to the database called names_tabl...
Jay-Jay-D/LeanSTP
Jupyter/KitchenSinkQuantBookTemplate.ipynb
apache-2.0
%matplotlib inline # Imports from clr import AddReference AddReference("System") AddReference("QuantConnect.Common") AddReference("QuantConnect.Jupyter") AddReference("QuantConnect.Indicators") from System import * from QuantConnect import * from QuantConnect.Data.Custom import * from QuantConnect.Data.Market import Tr...
anilcs13m/Projects
MovieReviewSentimentAnalysis/MovieReveiw/.ipynb_checkpoints/NLP_Movies-checkpoint.ipynb
gpl-2.0
import re from bs4 import BeautifulSoup """ Explanation: Natural Language Processing in a Kaggle Competition: Movie Reviews <img src='Movie_thtr.jpg', width = 800, height = 600> Source I decided to try playing around with a Kaggle competition. In this case, I entered the "When bag of words meets bags of popcorn" cont...
sassoftware/sas-viya-programming
communities/Your First CAS Connection from Python.ipynb
apache-2.0
# Import the SWAT package which contains the CAS interface import swat # Create a CAS session on mycas1 port 12345 conn = swat.CAS('mycas1', 12345, 'username', 'password') """ Explanation: Your First CAS Connection from Python Let's start with a gentle introduction to the Python CAS client by doing some basic operat...
mgalardini/2017_python_course
notebooks/[3]-Exercises.ipynb
gpl-2.0
# Import the packages that will be usefull for this part of the lesson from collections import OrderedDict, Counter import pandas as pd from pprint import pprint # Small trick to get a larger display from IPython.core.display import display, HTML display(HTML("<style>.container { width:90% !important; }</style>")) ""...
Olsthoorn/TransientGroundwaterFlow
exercises_notebooks/FirstExercise.ipynb
gpl-3.0
import numpy as np # import numerical package and locally call it np import matplotlib.pyplot as plt from scipy.special import k0 # import the K0-bessel function import scipy # import scientific package K0 = scipy.special.k0 # assign variable name K0 to function k0 # this makes K0 and k0 point at the same memory loca...
with-git/tensorflow
tensorflow/tools/docker/notebooks/3_mnist_from_scratch.ipynb
apache-2.0
from __future__ import print_function from IPython.display import Image import base64 Image(data=base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAAMYAAABFCAYAAAARv5krAAAYl0lEQVR4Ae3dV4wc1bYG4D3YYJucc8455yCSSIYrBAi4EjriAZHECyAk3rAID1gCIXGRgIvASIQr8UTmgDA5imByPpicTcYGY+yrbx+tOUWpu2e6u7qnZ7qXVFPVVbv2Xutfce+q7hlasmTJktSAXrnn8...
chinmaymk/machine-learning-experiments
03-adult-income-by-census.ipynb
mit
def read_data(path): return pd.read_csv(path, index_col=False, skipinitialspace=True, names=['age', 'workclass', 'fnlwgt', 'education', 'education_num', 'marital_status', 'occupation', 'relationship', 'race', 'sex', ...
Kaggle/learntools
notebooks/data_viz_to_coder/raw/tut3.ipynb
apache-2.0
#$HIDE$ import pandas as pd pd.plotting.register_matplotlib_converters() import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns print("Setup Complete") """ Explanation: Now that you can create your own line charts, it's time to learn about more chart types! By the way, if this is your first experi...
kit-cel/wt
qc/basic_concepts_Python.ipynb
gpl-2.0
# defining lists sport_list = [ 'cycling', 'football', 'fitness' ] first_prime_numbers = [ 2, 3, 5, 7, 11, 13, 17, 19 ] # getting contents sport = sport_list[ 2 ] third_prime = first_prime_numbers[ 2 ] # printing print( 'All sports:', sport_list ) print( 'Sport to be done:', sport ) print( '\nFirst primes:', first_p...
weissmanlab/magic
magicplots.ipynb
mit
import numpy as np %matplotlib inline import matplotlib import matplotlib.pyplot as plt import magic """ Explanation: Setup Import packages and modules End of explanation """ stats = ['your_prefix1', 'your_prefix2', 'your_prefix3'] # Example: ['chr1_pair', 'chr1_tbl', 'chr2_pair', 'itip'] """ Explanation: Change t...
jsharpna/DavisSML
2018_material/labs/lab1-soln.ipynb
mit
# Import the necessary packages import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import LeaveOneOut from sklearn import linear_model, neighbors %matplotlib inline plt.style.use('ggplot') # Where to save the figures PROJECT_ROOT_DIR = ".." datapath = PROJECT_ROOT_DIR +...
zklgame/CatEyeNets
test/BatchNormalization.ipynb
mit
import os os.chdir(os.getcwd() + '/..') # Run some setup code for this notebook import random import numpy as np import matplotlib.pyplot as plt from utils.data_utils import get_CIFAR10_data from utils.metrics_utils import rel_error %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size o...
certik/climate
RSS.ipynb
mit
#!wget http://www.remss.com/data/msu/data/netcdf/uat4_tb_v03r03_avrg_chTLT_197812_201308.nc3.nc #!mv uat4_tb_v03r03_avrg_chTLT_197812_201308.nc3.nc data/ #!wget http://www.remss.com/data/msu/data/netcdf/uat4_tb_v03r03_anom_chTLT_197812_201308.nc3.nc #!mv uat4_tb_v03r03_anom_chTLT_197812_201308.nc3.nc data/ """ Explan...
sergivalverde/cnn-ms-lesion-segmentation
example_1.ipynb
gpl-3.0
%load_ext autoreload %autoreload 2 import os from collections import OrderedDict from base import * from build_model_nolearn import cascade_model from config import * """ Explanation: Multiple Sclerosis (MS) lesion segmentation of MRI images using a cascade of two 3D convolutional neural networks This script assumes...
Kaggle/learntools
notebooks/computer_vision/raw/ex5.ipynb
apache-2.0
# Setup feedback system from learntools.core import binder binder.bind(globals()) from learntools.computer_vision.ex5 import * # Imports import os, warnings import matplotlib.pyplot as plt from matplotlib import gridspec import numpy as np import tensorflow as tf from tensorflow.keras.preprocessing import image_datas...
sueiras/training
tensorflow/02-text/01-char_languaje_model/Text_generation_with_Quijote.ipynb
gpl-3.0
# Header from __future__ import print_function import numpy as np import tensorflow as tf print('Tensorflow version: ', tf.__version__) import time #Show images import matplotlib.pyplot as plt %matplotlib inline # plt configuration plt.rcParams['figure.figsize'] = (10, 10) # size of images plt.rcParams['image....
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/machine_learning_in_the_enterprise/labs/model_monitoring.ipynb
apache-2.0
import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLOUD_NOTEBOOK: USER_FLAG = "--user" # Import necessa...
kevinjliang/Duke-Tsinghua-MLSS-2017
01B_TensorFlow_Fundamentals.ipynb
apache-2.0
import tensorflow as tf """ Explanation: The TensorFlow Tutorial I wish I had This notebook is adapted from notes that I took when learning TensorFlow. It provides a slow, thorough introduction to the fundamentals of TensorFlow, answering questions like: What exactly is TensorFlow? Why do we need it? How does the comp...
lrq3000/unireedsolomon
Generating the exponent and log tables.ipynb
mit
generator = ff.GF2int(3) generator """ Explanation: I used 3 as the generator for this field. For a field defined with the polynomial x^8 + x^4 + x^3 + x + 1, there may be other generators (I can't remember) End of explanation """ generator*generator generator*generator*generator generator**1 generator**2 genera...
liangjg/openmc
examples/jupyter/hexagonal-lattice.ipynb
mit
%matplotlib inline import openmc fuel = openmc.Material(name='fuel') fuel.add_nuclide('U235', 1.0) fuel.set_density('g/cm3', 10.0) fuel2 = openmc.Material(name='fuel2') fuel2.add_nuclide('U238', 1.0) fuel2.set_density('g/cm3', 10.0) water = openmc.Material(name='water') water.add_nuclide('H1', 2.0) water.add_nuclide...
LorenzoBi/courses
TSAADS/tutorial 2/.ipynb_checkpoints/Untitled-checkpoint.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy.io as sio from sklearn import datasets, linear_model %matplotlib inline def set_data(p, x): temp = x.flatten() n = len(temp[p:]) x_T = temp[p:].reshape((n, 1)) X_p = np.ones((n, p + 1)) for i in range(1, p + 1): X_p[:, i] = tem...
UWSEDS/LectureNotes
Fall2018/09_UnitTests/unit-tests.ipynb
bsd-2-clause
import numpy as np # Code Under Test def entropy(ps): items = ps * np.log(ps) return np.abs(-np.sum(items)) # Smoke test entropy([0.2, 0.8]) """ Explanation: Unit Tests Overview and Principles Testing is the process by which you exercise your code to determine if it performs as expected. The code you are test...
NuSTAR/nustar_pysolar
notebooks/Convert_Example.ipynb
mit
import sys from os.path import * import os # For loading the NuSTAR data from astropy.io import fits # Load the NuSTAR python libraries from nustar_pysolar import convert, utils """ Explanation: Code for converting an observation to solar coordinates Step 1: Run the pipeline on the data to get mode06 files with the...
tensorflow/docs-l10n
site/ja/addons/tutorials/layers_weightnormalization.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is d...
rudyryk/LearnAI
notebooks/2_fullyconnected.ipynb
unlicense
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import os import numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range """ Explanation: Deep Learning Assignment 2 Previou...
m3at/Labelizer
Labelizer_part1.ipynb
mit
#%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py %load_ext watermark # for reproducibility %watermark -a 'Paul Willot' -mvp numpy,scipy,spacy """ Explanation: Extracting Structure from Scientific Abstracts using a LSTM neural network Paul Willot This project was made for the ICADL 20...
ledeprogram/algorithms
class7/donow/hon_jingyi_donow_7.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data, plot, and create a logistic regressi...
zhuanxuhit/deep-learning
embeddings/Skip-Grams-Solution.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...
mne-tools/mne-tools.github.io
0.21/_downloads/2567f25ca4c6b483c12d38184d7fe9d7/plot_decoding_xdawn_eeg.ipynb
bsd-3-clause
# Authors: Alexandre Barachant <alexandre.barachant@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import StratifiedKFold from sklearn.pipeline import make_pipeline from sklearn.linear_model import LogisticRegression from sklearn.metrics import c...
gcallah/Indra
notebooks/Agent.ipynb
gpl-3.0
cd .. from indra2.agent import Agent """ Explanation: Indra Agent Class agent.py is the base class of all agents, environments, and objects contained in an environment. Its basic character is that it is a vector, and supports basic vector and matrix operations. End of explanation """ def newt_action(agent): pri...
Jackporter415/phys202-2015-work
assignments/midterm/InteractEx06.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.display import Image from IPython.html.widgets import interact, interactive, fixed """ Explanation: Interact Exercise 6 Imports Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell. End of explan...
ewulczyn/talk_page_abuse
src/analysis/Characterizing Attackers and Victims.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import warnings warnings.filterwarnings('ignore') import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd from load_utils import * from analysis_utils import compare_groups,get_genders d = load_diffs() df_events, df_blocked_use...
mne-tools/mne-tools.github.io
0.20/_downloads/075ba1175413b0aa0dc66e721f312729/plot_mixed_norm_inverse.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.inverse_sparse import mixed_norm, make_stc_from_dipoles from mne.minimum_norm import make_inverse...
grokkaine/biopycourse
day2/.ipynb_checkpoints/ML_regression-checkpoint.ipynb
cc0-1.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model diabetes = datasets.load_diabetes() #diabetes print(diabetes.data.shape, diabetes.target.shape) print(diabetes.data[:5,:3]) print(diabetes.target) ft = 2 # feature type 0 - age, 1 - sex, 2 - bmi X = diab...
stevenydc/2015lab1
hw0.ipynb
mit
import sys print sys.version """ Explanation: Homework 0 Survey due 4th September, 2015 Submission due 10th September, 2015 Welcome to CS109 / STAT121 / AC209 / E-109 (http://cs109.org/). In this class, we will be using a variety of tools that will require some initial configuration. To ensure everything goes smooth...
charlesreid1/rejoyce
Lestrygonians Part 4.ipynb
mit
%matplotlib inline import nltk, re, io import numpy as np import pandas as pd import seaborn as sns from matplotlib.pylab import * txtfile = 'txt/08lestrygonians.txt' from nltk.tokenize import RegexpTokenizer tokenizer = RegexpTokenizer(r'\w+') with io.open(txtfile) as f: tokens = tokenizer.tokenize(f.read()) p...
UWSEDS/LectureNotes
Spring2019/02_Procedural_Python/Procedural Programming.ipynb
bsd-2-clause
instructors = ['Dave', 'Joe', 'Bernease', 'Dorkus the Clown'] instructors """ Explanation: Procedural programming in python Topics Flow control, part 1 If For range() function Some hacky hack time Exercises <hr> <hr> Review of Data Types | type | description | |------|------------| | primitive | int, float, string,...
owlas/magpy
docs/source/notebooks/two-particle-equilibrium.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from tqdm import tqdm_notebook #import tqdm import magpy as mp %matplotlib inline """ Explanation: Two particle equilibrium If you haven't read the One particle equilibrium notebook yet, go and read it now. In the previous noteb...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/05_review/6_deploy.ipynb
apache-2.0
PROJECT = "cloud-training-demos" # Replace with your PROJECT BUCKET = "cloud-training-bucket" # Replace with your BUCKET REGION = "us-central1" # Choose an available region for Cloud MLE TFVERSION = "1.14" # TF version for CMLE to use import os os.environ["BUCKET"] = BUCKET os.environ["PROJ...
empet/PSCourse
MarkovChains.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import networkx as nx """ Explanation: Lanturi Markov ireductibile si aperiodice End of explanation """ def GraphTr(Q): G=nx.from_numpy_matrix(Q, create_using=nx.DiGraph()) nx.draw(G, node_color='b', alpha=0.3) """ Explanation: Definim o ...