repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
ywcui1990/htmresearch | projects/neural_correlations/EXP1-Random/NeuCorr_Exp1.ipynb | agpl-3.0 | import numpy as np
import random
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from nupic.bindings.algorithms import TemporalMemory as TM
from htmresearch.support.neural_correlations_utils import *
uintType = "uint32"
random.seed(1)
symbolsPerSequence = 10
numSequences = 1000
epochs = 1... |
scotthuang1989/Python-3-Module-of-the-Week | internet/json.ipynb | apache-2.0 | data = [{'a': 'A', 'b': (2, 4), 'c': 3.0}]
print('DATA:', repr(data))
data_string = json.dumps(data)
print('JSON:', data_string)
print(type(data_string))
"""
Explanation: Encoding and Decoding Simple Data Types
End of explanation
"""
data = [{'a': 'A', 'b': (2, 4), 'c': 3.0}]
print('DATA :', data)
data_string =... |
tpin3694/tpin3694.github.io | machine-learning/make_simulated_data_for_regression.ipynb | mit | import pandas as pd
from sklearn.datasets import make_regression
"""
Explanation: Title: Make Simulated Data For Regression
Slug: make_simulated_data_for_regression
Summary: Make a simulated dataset for regression using scikit-learn.
Date: 2017-01-16 12:00
Category: Machine Learning
Tags: Basics
Authors: Chris Albon ... |
dusenberrymw/incubator-systemml | projects/breast_cancer/Preprocessing.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
import shutil
import matplotlib.pyplot as plt
import numpy as np
from breastcancer.preprocessing import preprocess, save, train_val_split
# Ship a fresh copy of the `breastcancer` package to the Spark workers.
# Note: The zip must include the `breastca... |
planet-os/notebooks | api-examples/mfwam_global_hurricane.ipynb | mit | import os
from dh_py_access import package_api
import dh_py_access.lib.datahub as datahub
import xarray as xr
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import imageio
import shutil
import datetime
import matplotlib as mpl
mpl.rcParams['font.family'] = 'Avenir Lt Std'
mp... |
detcitty/intro-numerical-methods | 6_interpolation.ipynb | mit | data = numpy.array([[-1.5, -0.5], [0.0, 0.0]])
N = data.shape[0] - 1
M = data.shape[0]
x = numpy.linspace(-2.0, 2.0, 100)
# ====================================================
# Compute the Lagrange basis (\ell_i(x))
lagrange_basis = numpy.ones((N + 1, x.shape[0]))
for i in xrange(N + 1):
for j in xrange(N + 1):
... |
cpcloud/ibis | docs/ibis-for-sql-programmers.ipynb | apache-2.0 | import ibis
ibis.options.sql.default_limit = None
"""
Explanation: Ibis for SQL Programmers
Ibis provides a full-featured replacement for SQL
SELECT queries, but expressed with Python code that is:
Type-checked and validated as you go. No more debugging cryptic
database errors; Ibis catches your mistakes right a... |
jamesmarva/maths-with-python | 03-loops-control-flow.ipynb | mit | from math import pi
def degrees_to_radians(theta_d):
"""
Convert an angle from degrees to radians.
Parameters
----------
theta_d : float
The angle in degrees.
Returns
-------
theta_r : float
The angle in radians.
"""
theta_r = pi / 180.0 *... |
buntyke/TRo2017 | Experiments/Exp5/experiment2.ipynb | mit | # import the modules
import sys
import GPy
import csv
import numpy as np
import cPickle as pickle
import scipy.stats as stats
import sklearn.metrics as metrics
from matplotlib import pyplot as plt
%matplotlib notebook
# load the dataset
Data = pickle.load(open('../Data/FeatureData.p','rb'))
names = ['K1S1P1T1','K1S1... |
swirlingsand/self-driving-car-nanodegree-nd013 | CarND-LetNet/LeNet-Lab-Solution.ipynb | mit | from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", reshape=False)
X_train, y_train = mnist.train.images, mnist.train.labels
X_validation, y_validation = mnist.validation.images, mnist.validation.labels
X_test, y_test = mnist.test.images, mn... |
jseppanen/cifar_lasagne | cifar_lasagne.ipynb | bsd-3-clause | # get data
X_train, y_train, X_val, y_val, X_test, y_test = load_cifar10()
print('Train data shape: ', X_train.shape)
print('Train labels shape: ', y_train.shape)
print('Validation data shape: ', X_val.shape)
print('Validation labels shape: ', y_val.shape)
print('Test data shape: ', X_test.shape)
print('Test labels sha... |
google-research/large_scale_mmdma | examples/tutorial101.ipynb | apache-2.0 | !pip install lsmmdma
import lsmmdma
from lsmmdma import train
from lsmmdma.data import data_pipeline
from lsmmdma import metrics
import numpy as np
import torch
from IPython import display
from IPython.display import Image
from matplotlib import animation
from matplotlib import cm
import matplotlib.pyplot as plt
"""... |
donaghhorgan/COMP9033 | labs/09b - Agglomerative clustering.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import urllib2
from sklearn.cluster import AgglomerativeClustering
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import FunctionTransformer
"""
Explanation: Lab 09b: Agglomerative clustering
Intr... |
google/jax | tests/notebooks/colab_tpu.ipynb | apache-2.0 | import jax
import jaxlib
!cat /var/colab/hostname
print(jax.__version__)
print(jaxlib.__version__)
"""
Explanation: <a href="https://colab.research.google.com/github/google/jax/blob/main/tests/notebooks/colab_tpu.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In ... |
rvuduc/cse6040-ipynbs | 27--kmeans-part1.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
"""
Explanation: CSE 6040, Fall 2015 [27]: K-means Clustering, Part 1
Last week, we studied the classification problem using the logistic regression algorithm. Since each data point needs to be labeled, it is called the supervised learnin... |
atulsingh0/MachineLearning | ML_UoW/Course01_Regression/Week04_Ridge_Regression_Assignment01.ipynb | gpl-3.0 | import graphlab as gl
import numpy as np
"""
Explanation: Regression Week 4: Ridge Regression (interpretation)
In this notebook, we will run ridge regression multiple times with different L2 penalties to see which one produces the best fit. We will revisit the example of polynomial regression as a means to see the eff... |
sjsrey/pysal | notebooks/explore/segregation/local_measures_example.ipynb | bsd-3-clause | import pysal.lib
from pysal.explore import segregation
import geopandas as gpd
import matplotlib.pyplot as plt
from pysal.explore.segregation.local import MultiLocationQuotient, MultiLocalDiversity, MultiLocalEntropy, MultiLocalSimpsonInteraction, MultiLocalSimpsonConcentration, LocalRelativeCentralization
"""
Explan... |
ecervera/Baxter-Vision | 00 Compute Items Mask.ipynb | mit | import json
from utils import load_items
with open('parameters.json', 'r') as infile:
params = json.load(infile)
RESIZE_X = params['resize']['x']
RESIZE_Y = params['resize']['y']
ITEM_FOLDER = params['item_folder']
BACKGROUND_THRESHOLD = params['background_threshold']
items = load_items(ITEM_FOLDER)
"""
Explana... |
empet/LinAlgCS | Python.ipynb | bsd-3-clause | n=2
print type(n)
x=23.75
type(x)
b=False
c=True
print b
type(c)
"""
Explanation: Python
Python este un limbaj interpretat. Interpretorul citeste linie dupa line din program si semnaleaza codul care nu are sens pe masura ce il ruleaza.
Python este caracterizat ca fiind dynamically typed. Ce inseamna aceasta car... |
kmunve/APS | aps/notebooks/wind_drift.ipynb | mit | %matplotlib inline
import netCDF4
import numpy as np
import pylab as plt
plt.rcParams['figure.figsize'] = (14, 5)
"""
Explanation: Snow drift potential
End of explanation
"""
ncdata = netCDF4.Dataset('http://thredds.met.no/thredds/dodsC/arome25/arome_metcoop_default2_5km_latest.nc')
x_wind_v = ncdata.variables['x_w... |
harmsm/pythonic-science | chapters/00_inductive-python/07_tuples-and-dicts-and-strings.ipynb | unlicense | some_tuple = (10,20,30)
print(some_tuple[1])
some_tuple = (10,20,30)
print(some_tuple[:])
"""
Explanation: Tuples
Tuples are like lists, but are immutable, meaning that once you've made them they can't be changed.
Predict what this code will do.
End of explanation
"""
some_tuple = (10,20,30)
some_tuple[1] = 50
so... |
ulitosCoder/DataAnalysis | lesson01/.ipynb_checkpoints/L1_Starter_Code-checkpoint.ipynb | gpl-2.0 | import unicodecsv
## Longer version of code (replaced with shorter, equivalent version below)
# enrollments = []
# f = open('enrollments.csv', 'rb')
# reader = unicodecsv.DictReader(f)
# for row in reader:
# enrollments.append(row)
# f.close()
def read_csv(filename):
with open(filename, 'rb') as f:
re... |
liyigerry/msm_test | examples/uncertainty.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as pp
from mdtraj.utils import timing
from msmbuilder.cluster import NDGrid
from msmbuilder.example_datasets import QuadWell
from msmbuilder.msm import BayesianMarkovStateModel
from msmbuilder.msm import ContinuousTimeMSM
"""
Explanation: This example demo... |
petermchale/mutation_accumulation | example/analysis.ipynb | mit | from IPython.display import Image
Image(filename="trajectories.png", width=350, height=350)
"""
Explanation: Analysis of Monte Carlo simulations of mutation accumulation in stem cells
This Notebook lives at Github.
Many adult tissues renew themselves continually via a pool of cells called stem cells. Stem cell divisi... |
anshbansal/anshbansal.github.io | udacity_data_science_notes/Data_Wrangling_with_MongoDB/lesson_02/lesson_02.ipynb | mit | import xml.etree.ElementTree as ET
import pprint
def get_root(fname):
tree = ET.parse(fname)
return tree.getroot()
article_file = 'exampleResearchArticle.xml'
root = get_root(article_file)
for child in root:
print child.tag
"""
Explanation: Intro to XML
Design Goals
platform independent data transfer
e... |
elastic/examples | Machine Learning/Query Optimization/notebooks/0 - Analyzers.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
import importlib
import os
import sys
from elasticsearch import Elasticsearch
# project library
sys.path.insert(0, os.path.abspath('..'))
import qopt
importlib.reload(qopt)
from qopt.notebooks import evaluate_mrr100_dev
# use a local Elasticsearch or Cloud instance (https://clou... |
rringham/deep-learning-notebooks | udacity/2_fullyconnected.ipynb | mit | # 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 numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
"""
Explanation: Deep Learning
Assignment 2
Previously in 1_n... |
metpy/MetPy | v0.6/_downloads/Skew-T_Layout.ipynb | bsd-3-clause | import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, Hodograph, SkewT
from metpy.units import units
"""
Explanation: Skew-T with Complex Layout
Combine a Sk... |
chengsoonong/crowdastro | notebooks/10_potential_host_detection.ipynb | mit | import collections
import itertools
import logging
import pprint
import sys
import warnings
import matplotlib.pyplot
import numpy
import skimage.feature
sys.path.insert(1, '..')
import crowdastro.data
import crowdastro.rgz_analysis.consensus
import crowdastro.show
%matplotlib inline
warnings.simplefilter('ignore', U... |
antoniomezzacapo/qiskit-tutorial | community/teach_me_qiskit_2018/cryptography/Cryptography.ipynb | apache-2.0 | # Import numpy for random number generation
import numpy as np
# importing Qiskit
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, Aer
# Import basic plotting tools
from qiskit.tools.visualization import plot_histogram
"""
Explanation: <img src="../../../images/qiskit-heading.gif" alt=... |
pcm-ca/pcm-ca.github.io | pages/informatication/extra-files/codes/home-works/Taller 1 - Gráficos y ajustes.ipynb | mit | # Ejecute esta celda para importar las librerías y funciones necesarias
%matplotlib notebook
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
import numpy as np
import matplotlib.pyplot as plt
from numpy import polyfit, polyval
from scipy.stats import linregress
from scipy.opti... |
Aryan-Barbarian/bigbang | examples/Cohort Visualization.ipynb | gpl-2.0 | url = "scipy-user"
arx = Archive(url,archive_dir="../archives")
arx.data[:1]
"""
Explanation: One interesting question for open source communities is whether they are growing. Often the founding members of a community would like to see new participants join and become active in the community. This is important for co... |
bspalding/research_public | lectures/Instability of regression coefficients.ipynb | apache-2.0 | import numpy as np
from statsmodels import regression, stats
import statsmodels.api as sm
import matplotlib.pyplot as plt
import scipy as sp
def linreg(X,Y):
# Running the linear regression
x = sm.add_constant(X) # Add a row of 1's so that our model has a constant term
model = regression.linear_model.OLS(Y... |
marc-moreaux/Deep-Learning-classes | notebooks/keras_tutorial.ipynb | mit | # Import the MNIST dataset
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# Check the amount of data we have
print x_train.shape, y_train.shape
print x_test.shape, y_test.shape
# Normalize the MNIST data
x_train = x_train/255.
x_test = x_test/255.
# Reshape the data
x_train... |
jdossgollin/CWC_ANN | Week02/XOR-numpy-network.ipynb | mit | import numpy as np
import random
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Simple Neural Network with One Hidden Layer to Approximate Noisy XOR
This notebook covers a Python-based gradient descent solution for a simple neural network with one hidden layer.
The network is ... |
jriehl/numba | examples/notebooks/j0 in Numba.ipynb | bsd-2-clause | %pylab inline
import numpy as np
from numba import jit
import math
"""
Explanation: I have always wanted to write a ufunc function in Python. With Numba, you can --- and it will be fast.
End of explanation
"""
@jit('f8(f8,f8[:])', nopython=True)
def polevl(x, coef):
N = len(coef)
ans = coef[0]
i = 1
... |
beangoben/HistoriaDatos_Higgs | Dia1/2_PandasIntro.ipynb | gpl-2.0 | import pandas as pd
import numpy as np # modulo de computo numerico
import matplotlib.pyplot as plt # modulo de graficas
# esta linea hace que las graficas salgan en el notebook
%matplotlib inline
"""
Explanation: Hola Pandas!
Pandas = Manejo de informacion facil!
Que es pandas?
Pandas es un libreria de alto rendimie... |
jArumugam/BigFish | notebooks/NB02 snap graph properties.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams["figure.figsize"] = (10,10)
import seaborn as sns
import snap
import os
import sys
"""
Explanation: Objective
To quantify graph properties in the data
Data Source
NYC TLC
Yellow 2016 December
$ head yellow_tripdata_2016-12.csv
$ ... |
MinnowBoard/fishbowl-notebooks | Dotstar-LED.ipynb | mit | from pyDrivers import dotstar
"""
Explanation: Dotstar LED
Dotstar LEDs are individually addressable LED strips for use with Arduinos, Raspberry Pis, and the Minnowboard. It connects to the device through the SPI pins and is driven here by Python.
Start by importing the class file for the LEDs:
End of explanation
"""... |
lawsonro3/python-scripts | python_scripts/openfoam/sowfa_precursor/sowfa_precursor_example.ipynb | apache-2.0 | import numpy as np
from importlib import reload
import sowfa_precursor
sowfa_precursor = reload(sowfa_precursor)
%matplotlib inline
"""
Explanation: Example of how to use the sowfa_precursor API to look at presursor simulation stats
Inputs are stored in sowfa_precursor.Sim.input
Outputs that are calculated are stored... |
tensorflow/quantum | docs/tutorials/hello_many_worlds.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... |
FordyceLab/AcqPack | notebooks/Experiment20170517.ipynb | mit | import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
"""
Explanation: SETUP
End of explanation
"""
# config directory must have "__init__.py" file
# from the 'config' directory, import the following classes:
from config import Motor, ASI_Controller, Autosipper
from co... |
MaXiaoyueMaX/data-science-notes | content/python/python-basics-string-basics.ipynb | gpl-3.0 | # three ways of creating a string
a = 'string'
b = "string"
c = str(3.14)
print a, type(a)
print b, type(b)
print c, type(c)
# concatenation using "+"
s = 'A ' + 'sentence ' + 'can '+'be made' + 'like this!'
print s
"""
Explanation: Title: Python Basics: String Basics
Date: 2017-10-26 13:26
Modified: 2017-10-30 13... |
the-deep-learners/TensorFlow-LiveLessons | notebooks/live_training/dense_sentiment_classifier_LT.ipynb | mit | import keras
from keras.datasets import imdb
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
from keras.layers import Dense, Flatten, Dropout
from keras.layers import Embedding # new!
from keras.callbacks import ModelCheckpoint # new!
import os # new!
from sklearn.metrics im... |
bashalex/datapot | notebooks/CategoricalExample.ipynb | gpl-3.0 | import datapot as dp
import pandas as pd
import time
"""
Explanation: Dataset with categorical features.
Here you can see how datapot works with Mushroom Data Set.
The important detail about this dataset is that all it's features are categorical.
End of explanation
"""
datapot = dp.DataPot()
import bz2
ftr = bz2.B... |
ketch/PseudoSpectralPython | PSPython_03-FFT-aliasing-filtering.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation
from IPython.display import HTML
font = {'size' : 15}
matplotlib.rc('font', **font)
"""
Explanation: Content provided under a Creative Commons Attribution license, CC-BY 4.0; code under MIT License. (c... |
ingJSNA/IS-assigment2 | games.ipynb | mit | class Game:
"""A game is similar to a problem, but it has a utility for each
state and a terminal test instead of a path cost and a goal
test. To create a game, subclass this class and implement
legal_moves, make_move, utility, and terminal_test. You may
override display and successors or you can in... |
atlury/deep-opencl | cs480/21 Reinforcement Learning for Two Player Games.ipynb | lgpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from copy import copy
"""
Explanation: $$\newcommand{\Rv}{\mathbf{R}}
\newcommand{\rv}{\mathbf{r}}
\newcommand{\Qv}{\mathbf{Q}}
\newcommand{\Qnv}{\mathbf{Qn}}
\newcommand{\Av}{\mathbf{A}}
\newcommand{\Aiv}{\mathbf{Ai}}
\newcommand{\av}{\mathbf{a}}
\... |
diegocavalca/Studies | deep-learnining-specialization/1. neural nets and deep learning/week4/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[... |
magenta/ddsp | ddsp/colab/tutorials/1_synths_and_effects.ipynb | apache-2.0 | # Copyright 2021 Google LLC. All Rights Reserved.
#
# 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 a... |
peakrisk/peakrisk | posts/hurricane-joaquin-pressure.ipynb | gpl-3.0 | data.pressure[-1*24*24:].plot()
# See how this compares to "normal" pressure
# Plot the last 10 days
data.pressure[-10*24*24:].plot()
data.tail()
!pwd
"""
Explanation: See the pressure plummet as Joaquin approaches Bermuda
Pressure is still dropping as of 17.50pm BDA time.
It looks like pressure was starting to bo... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 5 Data analysis applications/Homework/2 project wage forecast for Russia/wages.ipynb | mit | plt.figure(figsize(15,10))
sm.tsa.seasonal_decompose(wages.WAG_C_M).plot()
print("Критерий Дики-Фуллера: p=%f" % sm.tsa.stattools.adfuller(wages.WAG_C_M)[1])
"""
Explanation: свойства ряда:
* повышающийся тренд
* годовая сезонность
* автокоррелированность
* в начале ряда размах сезонных колебаний значительно меньше, ч... |
dsacademybr/PythonFundamentos | Cap09/Notebooks/DSA-Python-Cap09-Analise-Exploratoria-de-Dados.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 9</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Impor... |
acdarby/Python_lectures | Lecture_3.ipynb | gpl-3.0 | message = "Hello world"
print ("My message is:", message)
"""
Explanation: Dictionaries, lists and looping structures
Overview
Recap:
Dictionary
Structure for storing values with keys
List
Structure for storing ordered values
Loop (for/while)
Allows iterative processing (e.g. line-by-line)
Recap on strin... |
nifannn/data-science-from-scratch | Chapter5.ipynb | mit | num_friends = [100,49,41,40,25,21,21,19,19,18,18,16,15,15,15,15,14,14,13,13,13,13,12,12,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,... |
stijnvanhoey/course_gis_scripting | _solved/04-gis-python-vectors.ipynb | bsd-3-clause | with fiona.open('../data/deelbekkens/Deelbekken.shp') as deelbekkens:
feature = next(iter(deelbekkens)) # Just one checking the first
print("Bekken: ", feature['properties']['BEKNAAM'])
print("Vectortype: ", feature['geometry']['type'])
print(feature['geometry']['coordinates'][0][0])
"""
Explanation: F... |
cubewise-code/TM1py-samples | Data/reading_data.ipynb | mit | #import pandas to get data from csv file
import pandas as pd
# pd.read_csv will store the information into a pandas dataframe called df
df = pd.read_csv('reading_data.csv')
#A pandas dataframe has lots of cool pre-built functions such as:
# print the result
df.head()
#write data to csv
df.to_csv('my_new_filePyPal.cs... |
rsterbentz/phys202-2015-work | assignments/assignment07/AlgorithmsEx01.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
"""
Explanation: Algorithms Exercise 1
Imports
End of explanation
"""
def tokenize(s, stop_words=None, punctuation='`~!@#$%^&*()_-+={[}]|\:;"<,>.?/}\t'):
"""Split a string into a list of words, removing punctuation and stop words."""
... |
oslugr/contaminAND | datos/Random_Forests/contaminAND_gr_congresos_RandomForests_datasetcompleto.ipynb | gpl-3.0 | import pandas as pd
import datetime
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import roc_auc_score
congr_datasetDF = pd.DataFrame.from_csv('https://raw.githubusercontent.com/oslugr/contaminAND/master/datos/contaminAN... |
Upward-Spiral-Science/the-vat | Code/classificationANDregression_simulation_AL.ipynb | apache-2.0 | # Import Necessary Libraries
import numpy as np
import os, csv
from matplotlib import pyplot as plt
import scipy
# Regression
from sklearn import cross_validation
from sklearn.cross_validation import LeaveOneOut
from sklearn.linear_model import LinearRegression
from sklearn.svm import SVR
from sklearn.neighbors impo... |
citxx/sis-python | crash-course/loops.ipynb | mit | for i in range(5): # Обратите внимание на двоеточие и отступ
print(i)
"""
Explanation: <h1>Содержание<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Цикл-for" data-toc-modified-id="Цикл-for-1">Цикл for</a></span></li><li><span><a href="#Цикл-while" data-toc-modified-id... |
liufuyang/deep_learning_tutorial | course-deeplearning.ai/course5-rnn/Week 2/Emojify/Emojify - v2.ipynb | mit | import numpy as np
from emo_utils import *
import emoji
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Emojify!
Welcome to the second assignment of Week 2. You are going to use word vector representations to build an Emojifier.
Have you ever wanted to make your text messages more expressive? You... |
mmadsen/experiment-seriation-classification | analysis/sc-1-3/sc-1-seriation-classification-analysis.ipynb | apache-2.0 | import numpy as np
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import cPickle as pickle
from copy import deepcopy
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix
train_graphs = pickle.load(open("train-freq-graphs... |
sns-chops/multiphonon | examples/getdos2-V_Ei120meV.ipynb | mit | import os, numpy as np
import histogram.hdf as hh, histogram as H
from matplotlib import pyplot as plt
%matplotlib notebook
# %matplotlib inline
import mantid
from multiphonon.sqe import plot as plot_sqe
from multiphonon.ui.getdos import Context, NxsWizardStart, QEGridWizardStart, GetDOSWizStart
"""
Explanation: Densi... |
atulsingh0/MachineLearning | scikit-learn/Matplotlib_Tutorial_05.ipynb | gpl-3.0 | # import
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# generating some data points
X = np.random.random_integers(20, 50, 1000)
Y = np.random.random_integers(20, 50, 1000)
"""
Explanation: Matplotlib tutorial 05
Histogram Plots
It's a graphical representation of a frequency distribution... |
hmenke/pairinteraction | doc/sphinx/examples_python/pair_potential_near_surface.ipynb | gpl-3.0 | %matplotlib inline
# Arrays
import numpy as np
# Plotting
import matplotlib.pyplot as plt
from itertools import product
# Operating system interfaces
import os, sys
# Parallel computing
from multiprocessing import Pool
# pairinteraction :-)
from pairinteraction import pireal as pi
# Create cache for matrix elemen... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/labs/d_traineval.ipynb | apache-2.0 | from google.cloud import bigquery
import tensorflow as tf
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: <h1> 2d. Distributed training and monitoring </h1>
In this notebook, we refactor to call train_and_evaluate instead of hand-coding our ML pipeline. This allows us to carry out evaluation a... |
the-deep-learners/study-group | demos-for-talks/Keras_MNIST_ConvNet.ipynb | mit | from __future__ import print_function
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras import backend as K
"""
Explanati... |
4dsolutions/Python5 | Generating the FCC.ipynb | mit | from itertools import permutations
g = permutations((2,1,1,0))
unique = {p for p in g} # set comprehension
print(unique)
"""
Explanation: Oregon Curriculum Network <br />
Discovering Math with Python
Generating the Face Centered Cubic lattice (FCC)
The Face Centered Cubic lattice is equivalently the CCP (cubic center... |
griffinfoster/fundamentals_of_interferometry | 8_Calibration/8_problem_set.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
"""
Explanation: <a id='beginning'></a> <!--\label{beginning}-->
* Outline
* Glossary
* 8. Calibration
Import standard modules:
End of explanation
"""
from IPython.d... |
basnijholt/orbitalfield | Induced-gap-tuning.ipynb | bsd-2-clause | # import os
# from scripts.hpc05 import HPC05Client
# os.environ['SSH_AUTH_SOCK'] = os.path.join(os.path.expanduser('~'), 'ssh-agent.socket')
# cluster = HPC05Client()
from ipyparallel import Client
cluster = Client()
v = cluster[:]
lview = cluster.load_balanced_view()
len(v)
"""
Explanation: Start a ipcluster from t... |
ga7g08/ga7g08.github.io | _notebooks/2015-05-06-Gaussian-mixture-model-for-pulsar-population-II.ipynb | mit | import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pandas as pd
%matplotlib inline
DATA_FILE = "ATNF_data_file.txt"
data = np.genfromtxt(DATA_FILE, skip_header=4, skip_footer=1, dtype=None)
F0 = np.genfromtxt(data[:, 1])
F1 = np.genfromtxt(data[:, 2])
df = pd.DataFrame(dict(F0=F0, F1=... |
saashimi/code_guild | wk2/extras/linked_lists/delete_mid/delete_mid_challenge.ipynb | mit | %run ../linked_list/linked_list.py
%load ../linked_list/linked_list.py
class MyLinkedList(LinkedList):
def delete_node(self, node):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook... |
metpy/MetPy | v0.12/_downloads/8532b75251585046a16f04a9afaef079/Advanced_Sounding.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, SkewT
from metpy.units import units
"""
Explanation: Advanced Sounding
Plot a sounding using MetPy with more advanced features.
Beyond just plotting data, this ... |
catalyst-cooperative/pudl | test/validate/notebooks/validate_gens_eia860.ipynb | mit | %load_ext autoreload
%autoreload 2
import sys
import pandas as pd
import sqlalchemy as sa
import pudl
import warnings
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
handler = logging.StreamHandler(stream=sys.stdout)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatter... |
ProfessorKazarinoff/staticsite | content/code/matplotlib_plots/reading_3_files_types_in_pandas.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
df = pd.read_csv('tensile_test_data.csv', )
df.head()
"""
Explanation: Engineers can collect data in a number of formats. One is simply written. If an engineer has written data, this can be entered maually into a numpy array or... |
drericstrong/Blog | 20161017_TimeAligning1.ipynb | agpl-3.0 | import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
#'s' represents stored data, 'h' represents hidden data
sig = pd.DataFrame(data={'Time':range(17),
'Value':[1,1,1,1,1,2,2,2,3,2,3,3,2,2,2,2,2],
'Flag':['s','h','h','h','s','s'... |
antoniomezzacapo/qiskit-tutorial | community/aqua/optimization/partition.ipynb | apache-2.0 | from qiskit_aqua import Operator, run_algorithm, get_algorithm_instance
from qiskit_aqua.input import get_input_instance
from qiskit_aqua.translators.ising import partition
import numpy as np
"""
Explanation: Using Qiskit Aqua for partition problems
This Qiskit Aqua Optimization notebook demonstrates how to use the VQ... |
qinwf-nuan/keras-js | notebooks/layers/recurrent/LSTM.ipynb | mit | data_in_shape = (3, 6)
rnn = LSTM(4, activation='tanh', recurrent_activation='hard_sigmoid')
layer_0 = Input(shape=data_in_shape)
layer_1 = rnn(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
weights = []
for i, w in enumerate(model.get_weights()):
np... |
tjof2/pgure-svt | examples/PGURE-SVT-HyperSpy-Demo.ipynb | gpl-3.0 | %matplotlib notebook
import numpy as np
import hyperspy.api as hs
from pguresvt import hspy, mixed_noise_model
"""
Explanation: PGURE-SVT Demonstration
PGURE-SVT (Poisson-Gaussian Unbiased Risk Estimator - Singular Value Thresholding) is an algorithm designed to denoise image sequences acquired in microscopy. It exp... |
Kaggle/learntools | notebooks/feature_engineering_new/raw/ex6.ipynb | apache-2.0 | # Setup feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.feature_engineering_new.ex6 import *
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import warnings
from category_encoders import MEstimateEncoder
from sklearn.model_selection... |
scikit-rf/scikit-rf | doc/source/examples/circuit/Wilkinson Power Splitter.ipynb | bsd-3-clause | # standard imports
import numpy as np
import matplotlib.pyplot as plt
import skrf as rf
rf.stylely()
# frequency band
freq = rf.Frequency(start=0, stop=2, npoints=501, unit='GHz')
# characteristic impedance of the ports
Z0_ports = 50
# resistor
R = 100
line_resistor = rf.media.DefinedGammaZ0(frequency=freq, Z0=R)
re... |
TheOregonian/long-term-care-db | notebooks/analysis/.ipynb_checkpoints/facilities-analysis-before-state-updates-checkpoint.ipynb | mit | import pandas as pd
import numpy as np
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
df = pd.read_csv('../../data/processed/facilities-before-state-updates.csv')
"""
Explanation: This is a dataset of Assisted Living, Nursing and Residential Care f... |
tpin3694/tpin3694.github.io | machine-learning/gaussian_naive_bayes_classifier.ipynb | mit | # Load libraries
from sklearn import datasets
from sklearn.naive_bayes import GaussianNB
"""
Explanation: Title: Gaussian Naive Bayes Classifier
Slug: gaussian_naive_bayes_classifier
Summary: How to train a Gaussian naive bayes classifer in Scikit-Learn
Date: 2017-09-22 12:00
Category: Machine Learning
Tags: Naive... |
getsmarter/bda | module_5/M5_NB1_BandicootIntroduction.ipynb | mit | import os
import pandas as pd
import bandicoot as bc
import numpy as np
import matplotlib
"""
Explanation: <div align="right">Python 3.6 Jupyter Notebook</div>
Introduction to Bandicoot
Your completion of the notebook exercises will be graded based on your ability to do the following:
Understand: Do your pseudo-code... |
gfeiden/Notebook | Daily/20150803_pressure_reduc_spots.ipynb | mit | import numpy as np
# confirm sunspot estimate above
Bz = np.sqrt(12.*np.pi*10**4.92)
print "Sunspot Bz (G): {:8.3e}".format(Bz)
print "Sunspot umbral temperature (K): {:6.1f}".format(5779.*0.4**0.4)
"""
Explanation: On the Reduced Gas Pressure in Spots
What is the gas temerature expected within a spot if only a reduc... |
gxxjjj/QuantEcon.py | solutions/discrete_dp_solutions.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import division, print_function
import numpy as np
import scipy.sparse as sparse
import matplotlib.pyplot as plt
from quantecon.markov import DiscreteDP
"""
Explanation: quant-econ Solutions: Discrete Dynamic Programming
Solutions for http://quant-econ.net/py/discrete_dp.html
Prepar... |
TobiasLe/python-MD | 02_numpy_md/recall_last_session.ipynb | gpl-3.0 | class Ball:
def __init__(self, start_position, start_velocity, radius):
self.position = start_position
self.velocity = start_velocity
self.radius = radius
def move(self, time_step):
self.position[0] += self.velocity[0] * time_step
self.position[1] += self.velocity[1]... |
ajkerr0/kappa | tutorial/attachment.ipynb | mit | %matplotlib inline
import kappa
amber = kappa.Amber()
cnt = kappa.build(amber, "cnt")
kappa.plot.bonds(cnt, faces=True)
"""
Explanation: Attachment Tutorial
This document will briefly describe how to attach molecules to each other.
Molecules that are capable of 'bonding' have defined interfaces which can be viewed ... |
santipuch590/deeplearning-tf | dl_tf_BDU/3.RNN/ML0120EN-3.1-Review-LSTM-MNIST-Database.ipynb | mit | %matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("../../data/MNIST/", one_hot=True)
"""
Explanation: <center> Sequence classific... |
gear/CarND | lanelines-p1/OpenCV-1-basics.ipynb | mit | from IPython import display
from matplotlib import pyplot as plt
from matplotlib import image as mpimg
import numpy as np
import cv2
%matplotlib inline
"""
Explanation: OpenCV Part 1: Drawing on images
This tutorial helps getting started with OpenCV. The materials in this tutorial is the accumulation of the official ... |
jamessdixon/Kaggle.HomeDepot | ProjectSearchRelevance.Python/Home Depot Product Search Relevance Polynomial.ipynb | mit | import graphlab as gl
from nltk.stem import *
"""
Explanation: Home Depot Product Search Relevance
The challenge is to predict a relevance score for the provided combinations of search terms and products. To create the ground truth labels, Home Depot has crowdsourced the search/product pairs to multiple human raters.
... |
mne-tools/mne-tools.github.io | 0.24/_downloads/06371e7a69d2c0314dea0a4363315ef2/css.ipynb | bsd-3-clause | # Author: John G Samuelsson <johnsam@mit.edu>
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.simulation import simulate_sparse_stc, simulate_evoked
"""
Explanation: Cortical Signal Suppression (CSS) for removal of cortical signals
This script shows an example o... |
tabakg/potapov_interpolation | Time_Sims_nonlin_testing_and_comments.ipynb | gpl-3.0 | from sympy.physics.quantum import *
from sympy.physics.quantum.boson import *
from sympy.physics.quantum.operatorordering import *
import Potapov_Code.Roots as Roots
import Potapov_Code.Potapov as Potapov
import Potapov_Code.Time_Delay_Network as Time_Delay_Network
import Potapov_Code.Time_Sims_nonlin as Time_Sims_non... |
midvalestudent/Math307 | Examples/CubicSpline.ipynb | cc0-1.0 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
class CubicSpline():
''' cubic spline of a function
- equally-spaced knots
- derivatives specified at endpoints
'''
def __init__(self, fn, xmin, xmax, n, df_left, df_right):
''' set up the spline by sol... |
GEMScienceTools/rmtk | notebooks/vulnerability/model_generator/SPBELA_approach/SPBELA.ipynb | agpl-3.0 | from rmtk.vulnerability.model_generator.SPBELA_approach import SPBELA
from rmtk.vulnerability.common import utils
%matplotlib inline
"""
Explanation: Generation of capacity curves using SP-BELA
The Simplified Pushover-based Earthquake Loss Assessment (SP-BELA) methodology allows the calculation of the displacement ca... |
bhtucker/agents | scripts/Initial Analysis.ipynb | mit | segments = analysis.plot_learning_df(df, key='li', no_mismatch=False, full_mismatch=False, some_mismatch=True)
"""
Explanation: Learning Plots
Observe that the likelihood of the shortest path increases!
End of explanation
"""
analysis.plot_learning_df(df, key='learnt_over_best',
no_mismatch... |
google/learned_optimization | docs/notebooks/Part5_Meta_training_with_GradientLearner.ipynb | apache-2.0 | import numpy as np
import jax.numpy as jnp
import jax
from matplotlib import pylab as plt
from learned_optimization.outer_trainers import full_es
from learned_optimization.outer_trainers import truncated_pes
from learned_optimization.outer_trainers import gradient_learner
from learned_optimization.outer_trainers impor... |
amccaugh/phidl | docs/tutorials/movement.ipynb | mit | import phidl.geometry as pg
from phidl import quickplot as qp
from phidl import Device
# Start with a blank Device
D = Device()
# Create some more shape Devices
T = pg.text('hello', size = 10, layer = 1)
E = pg.ellipse(radii = (10,5))
R = pg.rectangle(size = (10,3), layer = 2)
# Add the shapes to D as references
tex... |
mne-tools/mne-tools.github.io | 0.19/_downloads/8763e6c899a8b9971980be1308b5f693/plot_dics.ipynb | bsd-3-clause | # Author: Marijn van Vliet <w.m.vanvliet@gmail.com>
#
# License: BSD (3-clause)
"""
Explanation: DICS for power mapping
In this tutorial, we'll simulate two signals originating from two
locations on the cortex. These signals will be sinusoids, so we'll be looking
at oscillatory activity (as opposed to evoked activity)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.