repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/keras_for_text_classification.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: Keras for Text Classification
Learning Objectives
1. Learn how to create a text classification datasets using BigQuery
1. Learn how to tokenize and integerize a corpus of text for training in Keras
1. Lea... |
eyaltrabelsi/my-notebooks | Lectures/Generators.ipynb | mit | %%memit
g = generators(range(10**8))
print(sum(g))
%%memit
i = iterators(range(10**8))
print(sum(i))
"""
Explanation: Memory of Genrators Vs Iterators 😇
For the generator's work, you need to keep in memory the variables of the generator function.
But you don't have to keep the entire collection in memory, so usuall... |
darkomen/TFG | medidas/13082015/.ipynb_checkpoints/Análisis de datos Ensayo 2-Copy1-checkpoint.ipynb | cc0-1.0 | #Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
#Abrimos el fichero csv con los datos... |
JorisBolsens/PYNQ | Pynq-Z1/notebooks/examples/pmod_grove_buzzer.ipynb | bsd-3-clause | from pynq import Overlay
Overlay("base.bit").download()
"""
Explanation: Grove Buzzer v1.2
This example shows how to use the Grove Buzzer v1.2.
A Grover Buzzer, and PYNQ Grove Adapter are required.
To set up the Pynq-Z1 for this notebook, the PYNQ Grove Adapter is connected to PMODB and the Grove Buzzer is connected ... |
vadim-ivlev/STUDY | handson-data-science-python/DataScience-Python3/Distributions.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
values = np.random.uniform(-10.0, 10.0, 100000)
plt.hist(values, 50)
plt.show()
"""
Explanation: Examples of Data Distributions
Uniform Distribution
End of explanation
"""
from scipy.stats import norm
import matplotlib.pyplot as plt
x = np.aran... |
LucaCanali/Miscellaneous | Impala_SQL_Jupyter/Impala_SQL_Magic_Kerberos.ipynb | apache-2.0 | %load_ext sql
"""
Explanation: Apache Impala and SQL magic for IPython/Jupyter notebooks
with Kerberos authentication
1. Load SQL magic extension (uses ipython-sql by Catherine Devlin)
End of explanation
"""
%config SqlMagic.connect_args="{'kerberos_service_name':'impala', 'auth_mechanism':'GSSAPI'}"
%sql impala://i... |
Upward-Spiral-Science/spect-team | Code/Assignment-3/Descriptive_Exploratory_Answers_2.ipynb | apache-2.0 | # Ignore different types of ADHD for now
df_disorder_results = df_disorders.drop('ADHD_Type', inplace=False, axis=1)
# Find records that has zero values across all the columns (disorders)
# Extract a list of Patient_IDs corresponding to healthy participants
healthy_ids = df_disorder_results[(df_disorder_results.T==0).... |
nishantsbi/pattern_classification | dimensionality_reduction/projection/linear_discriminant_analysis.ipynb | gpl-3.0 | %load_ext watermark
%watermark -v -d -u -p pandas,scikit-learn,numpy,matplotlib
"""
Explanation: Sebastian Raschka
- Link to the containing GitHub Repository: https://github.com/rasbt/pattern_classification
- Link to this IPython Notebook on GitHub: linear_discriminant_analysis.ipynb
End of explanation
"""
feature... |
tensorflow/docs-l10n | site/ja/io/tutorials/postgresql.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... |
Jackie789/JupyterNotebooks | CorrectingForAssumptions.ipynb | gpl-3.0 | import math
import warnings
from IPython.display import display
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn import linear_model
#import statsmodels.formula.api as smf
#import statsmodels as smf
# Display preferences.
%matplotlib inline
pd.options.disp... |
google/neural-tangents | notebooks/weight_space_linearization.ipynb | apache-2.0 | !pip install --upgrade pip
!pip install -q tensorflow-datasets
!pip install --upgrade jax[cuda11_cudnn805] -f https://storage.googleapis.com/jax-releases/jax_releases.html
!pip install -q git+https://www.github.com/google/neural-tangents
from jax import jit
from jax import grad
from jax import random
import jax.numpy... |
thewtex/SimpleITK-Notebooks | 61_Registration_Introduction_Continued.ipynb | apache-2.0 | import SimpleITK as sitk
# Utility method that either downloads data from the network or
# if already downloaded returns the file name for reading from disk (cached data).
from downloaddata import fetch_data as fdata
# Always write output to a separate directory, we don't want to pollute the source directory.
import... |
tritemio/multispot_paper | realtime kinetics/8-spot dsDNA steady-state - Summary.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from pathlib import Path
from scipy.stats import linregress
dir_ = r'C:\Data\Antonio\data\8-spot 5samples data\2013-05-15/'
filenames = [str(f) for f in Path(dir_).glob('*.hdf5')]
filenames
keys = [f.stem.... |
benvanwerkhoven/kernel_tuner | tutorial/diffusion_use_optparam.ipynb | apache-2.0 | nx = 1024
ny = 1024
"""
Explanation: Tutorial: From physics to tuned GPU kernels
This tutorial is designed to show you the whole process starting from modeling a physical process to a Python implementation to creating optimized and auto-tuned GPU application using Kernel Tuner.
In this tutorial, we will use diffusion ... |
cristhro/Machine-Learning | ejercicio 5/.ipynb_checkpoints/Practica 5-checkpoint.ipynb | gpl-3.0 | from imdb import IMDb
from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()
ia = IMDb()
listaPelis = ia.get_top250_movies()
listaPelis
"""
Explanation: Sacar la lista de 250 Pelis
End of explanation
"""
for i in range(10,250):
peli = listaPelis[i]
peli2 = ia.get_movie(pe... |
SheffieldML/GPyOpt | manual/GPyOpt_modular_bayesian_optimization.ipynb | bsd-3-clause | %pylab inline
import GPyOpt
import GPy
"""
Explanation: GPyOpt: Modular Bayesian Optimization
Written by Javier Gonzalez, Amazon Reseach Cambridge
Last updated, July 2017.
In the Introduction Bayesian Optimization GPyOpt we showed how GPyOpt can be used to solve optimization problems with some basic functionalities. T... |
sujitpal/polydlot | src/tensorflow/02-mnist-cnn.ipynb | apache-2.0 | from __future__ import division, print_function
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import accuracy_score, confusion_matrix
import numpy as np
import matplotlib.pyplot as plt
import os
import tensorflow as tf
%matplotlib inline
DATA_DIR = "../../data"
TRAIN_FILE = os.path.join(DATA_DIR... |
SteveDiamond/cvxpy | examples/notebooks/dqcp/hypersonic_shape_design.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import math
x = np.linspace(.25,1,num=201)
obj = []
for i in range(len(x)):
obj.append(math.sqrt(1/x[i]**2-1))
plt.plot(x,obj)
import cvxpy as cp
x = cp.Variable(pos=True)
obj = cp.sqrt(cp.inv_pos(cp.square(x))-1)
print("Th... |
anhaidgroup/py_entitymatching | notebooks/guides/step_wise_em_guides/Removing Features From Feature Table.ipynb | bsd-3-clause | # Import py_entitymatching package
import py_entitymatching as em
import os
import pandas as pd
"""
Explanation: Introduction
This IPython notebook illustrates how to remove features from feature table.
First, we need to import py_entitymatching package and other libraries as follows:
End of explanation
"""
# Get th... |
RaRe-Technologies/gensim | docs/notebooks/topic_coherence-movies.ipynb | lgpl-2.1 | from __future__ import print_function
import re
import os
from scipy.stats import pearsonr
from datetime import datetime
from gensim.models import CoherenceModel
from gensim.corpora.dictionary import Dictionary
from smart_open import smart_open
"""
Explanation: Benchmark testing of coherence pipeline on Movies data... |
jlecoeur/kalman_notebook | altitude_sonar_baro_gps_accel/kalman_altitude_sonar_baro_gps_accel.ipynb | gpl-2.0 | m = 10000 # timesteps
dt = 1/ 250.0 # update loop at 250Hz
t = np.arange(m) * dt
freq = 0.1 # Hz
amplitude = 0.5 # meter
alt_true = 405 + amplitude * np.cos(2 * np.pi * freq * t)
height_true = 5 + amplitude * np.cos(2 * np.pi * freq * t)
vel_true = - amplitude * (2 * np.pi * freq) * np.sin(2 * np.pi * f... |
mne-tools/mne-tools.github.io | 0.24/_downloads/4d3b714a9291625bb4b01d7f9c7c3a16/compute_source_psd_epochs.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD-3-Clause
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, compute_source_psd_epochs
print(__doc__)
data_path = sample.data_path()
fname_inv = data_path + '/MEG/sample/... |
tombstone/models | research/nst_blogpost/4_Neural_Style_Transfer_with_Eager_Execution.ipynb | apache-2.0 | import os
img_dir = '/tmp/nst'
if not os.path.exists(img_dir):
os.makedirs(img_dir)
!wget --quiet -P /tmp/nst/ https://upload.wikimedia.org/wikipedia/commons/d/d7/Green_Sea_Turtle_grazing_seagrass.jpg
!wget --quiet -P /tmp/nst/ https://upload.wikimedia.org/wikipedia/commons/0/0a/The_Great_Wave_off_Kanagawa.jpg
!wge... |
GoogleCloudPlatform/training-data-analyst | quests/serverlessml/07_caip/solution/train_caip.ipynb | apache-2.0 | import logging
import nbformat
import sys
import yaml
def write_parameters(cell_source, params_yaml, outfp):
with open(params_yaml, 'r') as ifp:
y = yaml.safe_load(ifp)
# print out all the lines in notebook
write_code(cell_source, 'PARAMS from notebook', outfp)
# print out YAML file... |
james-prior/euler | euler-008-largest-product-in-a-series-20161128.ipynb | mit | from __future__ import print_function
import string
import operator
from functools import reduce
s = '''
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
6689... |
readywater/caltrain-predict | .ipynb_checkpoints/03explore-checkpoint.ipynb | mit | # Import necessary libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sys
import re
import random
import operator
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.cross_validation import KFold
from sklearn.ensemble import GradientBoostingClassifier
... |
google/eng-edu | ml/cc/prework/ko/intro_to_pandas.ipynb | apache-2.0 | # 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 the L... |
rrbb014/data_science | fastcampus_dss/2016_05_18/0518_01.__연립방정식과 역행렬.ipynb | mit | A = np.array([[1, 3, -2], [3, 5, 6], [2, 4, 3]])
A
b = np.array([[5], [7], [8]])
b
Ainv = np.linalg.inv(A)
Ainv
x = np.dot(Ainv, b) # 앞에
x
np.dot(A, x) - b #수치적인 에러떄문에 0이 나오지않는다. inverse 명령은 실생활에서 사용하지않는다. 역행렬이 뭔지 알고싶을때만 쓴다.
x, resid, rank, s = np.linalg.lstsq(A, b) # A가 안정적인거여서 똑같이 나왔지만...
x
"""
Explanati... |
williamdjones/protein_binding | notebooks/Step 1 Random Forest Feature Selection (In Progress).ipynb | mit | import time
import glob
import h5py
import multiprocessing
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use("seaborn-muted")
from utils.input_pipeline import load_data, load_protein
from scipy.stats import randint as sp_randint
from sklearn.model_selection import cross_val_score, Ra... |
PyLadiesCZ/pyladies.cz | original/v1/s002-hello-world/ostrava/feedback-homeworks.ipynb | mit | tah_cloveka = 'kámen'
tah_pocitace = 'papír'
if tah_cloveka == 'kámen' and tah_pocitace == 'kámen'or tah_cloveka == 'nůžky' and tah_pocitace == 'nůžky' or tah_cloveka == 'papír' and tah_pocitace == 'papír':
print('Plichta.')
elif tah_cloveka == 'kámen' and tah_pocitace == 'nůžky' or tah_cloveka == 'nůžky'and tah_p... |
dualphase90/Learning-Neural-Networks | NN in Scikit Learn.ipynb | mit | ## Input
X = [[0., 0.], [1., 1.]]
## Labels
y = [0, 1]
## Create Model
clf = MLPClassifier(solver='lbfgs', alpha=1e-5,
hidden_layer_sizes=(5, 2), random_state=1)
## Fit
clf.fit(X, y)
## Make Predictions
clf.predict([[2., 2.], [-1., -2.]])
"""
Explanation: Classification
Class MLPClassifier imple... |
bt3gl/Machine-Learning-Resources | ml_notebooks/basics.ipynb | gpl-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... |
yvesdubief/UVM-ME249-CFD | .ipynb_checkpoints/ME249-Lecture-3-checkpoint.ipynb | gpl-2.0 | %matplotlib inline
# plots graphs within the notebook
%config InlineBackend.figure_format='svg' # not sure what this does, may be default images to svg format
from IPython.display import Image
from IPython.core.display import HTML
def header(text):
raw_html = '<h4>' + str(text) + '</h4>'
return raw_html
def... |
Brunel-Visualization/Brunel | python/examples/Whiskey.ipynb | apache-2.0 | import pandas as pd
from numpy import log, abs, sign, sqrt
import brunel
whiskey = pd.read_csv("data/whiskey.csv")
print('Data on whiskies:', ', '.join(whiskey.columns))
"""
Explanation: Whiskey Data
This data set contains data on a small number of whiskies
End of explanation
"""
%%brunel data('whiskey') x(country... |
maropu/spark | python/docs/source/getting_started/quickstart.ipynb | apache-2.0 | from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
"""
Explanation: Quickstart
This is a short introduction and quickstart for the PySpark DataFrame API. PySpark DataFrames are lazily evaluated. They are implemented on top of RDDs. When Spark transforms data, it does not immediately compu... |
kit-cel/lecture-examples | ccgbc/ch2_Codes_Basic_Concepts/Block_Code_Decoding_Performance.ipynb | gpl-2.0 | import numpy as np
import numpy.polynomial.polynomial as npp
from scipy.stats import norm
from scipy.special import comb
import matplotlib.pyplot as plt
"""
Explanation: Bounded Distance Decoding Performance of a Linear Block Code
This code is provided as supplementary material of the lecture Channel Coding 2 - Advanc... |
tcstewar/testing_notebooks | Function Space description.ipynb | gpl-2.0 | domain = np.linspace(-1, 1, 2000)
def gaussian(mag, mean, sd):
return mag * np.exp(-(domain-mean)**2/(2*sd**2))
pylab.plot(domain, gaussian(mag=1, mean=0, sd=0.1))
pylab.show()
"""
Explanation: Function Spaces in Nengo
Here is proposed new utilities to add to Nengo to support function space representations.
The ... |
ameliecordier/iutdoua-info_algo2015 | 2015-12-10 - TD17 - Tableaux et tris, trace et complexité.ipynb | cc0-1.0 | # Exemple = [2, 3, 4, 6, 7, 0, 0, 0, 0]
def decalageADroite(tab, i, derniereCase):
for a in range (derniereCase,i-1,-1):
print(a)
tab[a+1]=tab[a]
return tab
# Je suppose que je veux insérer "5" dans la case 3, et que je sais que mon tableau se finit dans la case 4
print(... |
Alexoner/mooc | cs231n/assignment3/q2.ipynb | apache-2.0 | # A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from time import time
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# for auto-reloading extenrnal modules
# see http:/... |
michael-hoffman/titanic-revisited | Titanic_ML_v1.ipynb | gpl-3.0 | # data analysis and wrangling
import pandas as pd
import numpy as np
import scipy
# visualization
import matplotlib.pyplot as plt
import seaborn as sns
# machine learning
from sklearn.svm import SVC
from sklearn import preprocessing
import fancyimpute
from sklearn.model_selection import train_test_split
from sklearn.... |
omoju/udacityUd120Lessons | Feature Selection.ipynb | gpl-3.0 | from __future__ import division
data_point = data_dict['METTS MARK']
frac = data_point["from_poi_to_this_person"] / data_point["to_messages"]
print frac
def computeFraction( poi_messages, all_messages ):
""" given a number messages to/from POI (numerator)
and number of all messages to/from a person (deno... |
tensorflow/docs-l10n | site/zh-cn/tutorials/distribute/save_and_load.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... |
pglauner/misc | src/cs730/3_regularization.ipynb | gpl-2.0 | # 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
"""
Explanation: Deep Learning
Assignment 3
Previously in 2_fullyconnected.ipynb, you tra... |
idwaker/git_python_session | Numpy and Pandas.ipynb | unlicense | from array import array
array('i', [1, 2, 3])
import numpy as np
np.array([1, 5, 6, 9])
arr = np.array([1, 5, 6, 9])
arr.dtype
np.array([1.2, 5.6, 4, 9.0, 7])
np.array([1.2, 5.6, 4, 9.0, 7]).dtype
np.array(['1', 5, 6])
np.arange(1, 9)
m1 = np.arange(1, 9)
m1
m1.shape
m1.size
m1 * 4
m1* 2
m1 + (m1 * 2)
... |
flohorovicic/pynoddy | docs/notebooks/simple_dipping_layer.ipynb | gpl-2.0 | from matplotlib import rc_params
from IPython.core.display import HTML
css_file = 'pynoddy.css'
# HTML(open(css_file, "r").read())
import sys, os
import matplotlib.pyplot as plt
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of reposi... |
tcstewar/testing_notebooks | nikhil/Custom Learning Rule with membrane voltage.ipynb | gpl-2.0 | model = nengo.Network()
with model:
pre = nengo.Ensemble(n_neurons=1, dimensions=1, encoders=[[1]], gain=[2], bias=[0])
post = nengo.Ensemble(n_neurons=1, dimensions=1, encoders=[[1]], gain=[2], bias=[0],
neuron_type=nengo.LIF(tau_rc=0.1))
stim_pre = nengo.Node(lambda t: 1 if ... |
mne-tools/mne-tools.github.io | 0.17/_downloads/47de0e2137654670a631ea71dfab4b62/plot_lcmv_beamformer_volume.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
# sphinx_gallery_thumbnail_number = 3
import mne
from mne.datasets import sample
from mne.beamformer import make_lcmv, apply_lcmv
print(__doc__)
"""
Explanation: Compute LCMV inverse solution in volume source space
Co... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/feature_engineering/labs/2_bqml_adv_feat_eng-lab.ipynb | apache-2.0 | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
"""
Explanation: LAB 02: Advanced Feature Engineering in BQML
Learning Objectives
Create SQL statements to evaluate the model
Extract temporal features
Perform a feature cross on temp... |
rressi/MyNotebooks | Numba_Demo_001.ipynb | mit | def sum_p(X):
y = 0
for x_i in range(int(X)):
y += x_i
return y
"""
Explanation: Numba Demo 1
Sum of first X integers
Given this simple function:
$$sum(x) = \sum\limits_{x=0}^X x$$
Lets define $sum_p(x)$ in pure Python
End of explanation
"""
from numba import jit
@jit
def sum_j(X):
y = 0
... |
zomansud/coursera | ml-foundations/week-2/Assignment - Week 2.ipynb | mit | import graphlab
"""
Explanation: Load GrahpLab Create
End of explanation
"""
#limit number of worker processes to 4
graphlab.set_runtime_config('GRAPHLAB_DEFAULT_NUM_PYLAMBDA_WORKERS', 4)
#set canvas to open inline
graphlab.canvas.set_target('ipynb')
"""
Explanation: Basic settings
End of explanation
"""
sales =... |
smorton2/think-stats | code/chap12ex.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
import numpy as np
import pandas as pd
import random
import thinkstats2
import thinkplot
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkst... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/reusable_embeddings.ipynb | apache-2.0 | import os
from google.cloud import bigquery
import pandas as pd
%load_ext google.cloud.bigquery
"""
Explanation: Reusable Embeddings
Learning Objectives
1. Learn how to use a pre-trained TF Hub text modules to generate sentence vectors
1. Learn how to incorporate a pre-trained TF-Hub module into a Keras model
1. Lea... |
berlemontkevin/Jupyter_Notebook | Statistical_Physics/Percolation.ipynb | apache-2.0 | from pylab import *
from scipy.ndimage import measurements
%matplotlib inline
L = 100
r = rand(L,L)
p = 0.4
z = r < p
imshow(z, origin='lower', interpolation='nearest')
colorbar()
title("Matrix")
show()
"""
Explanation: Percolation dans les modèles de lattice
Rapide étude des différents clusters sur un modèle de l... |
gschivley/Teaching-python | Python and Jupyter basics/Python basics - RISE presentation.ipynb | mit | x = 4
print x, type(x)
x = 'hello'
print x, type(x)
x = 1 # x is an integer
x = 'hello' # now x is a string
x = [1, 2, 3] # now x is a list
print x
print type(x)
print len(x)
"""
Explanation: Some Python and Jupyter Basics
<br>
Greg Schivley
<br>
With material taken from the Whirlwind Tour of Python
This s... |
cubewise-code/TM1py-samples | Samples/exploratory_analysis.ipynb | mit | from TM1py.Services import TM1Service
from TM1py.Utils import Utils
import pandas as pd
import xlwings as xw
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
"""
Explanation: <h1 style="font-size:42px; text-align:center; margin-bottom:30px;"><span style="color:SteelBlue">TM1... |
bashtage/statsmodels | examples/notebooks/tsa_filters.ipynb | bsd-3-clause | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
dta = sm.datasets.macrodata.load_pandas().data
index = pd.Index(sm.tsa.datetools.dates_from_range("1959Q1", "2009Q3"))
print(index)
dta.index = index
del dta["year"]
del dta["quarter"]
print(sm.datasets.macrodata.N... |
aboucaud/python-euclid2016 | notebooks/05-Euclid.ipynb | bsd-3-clause | # this must be included at the top of a python2 src file
# to ensure most python3 features that are backported
# to python2 are available
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object, ... |
CompPhysics/MachineLearning | doc/src/Optimization/autodiff/examples_allowed_functions-Copy1.ipynb | cc0-1.0 | import autograd.numpy as np
from autograd import grad
"""
Explanation: Examples of the supported features in Autograd
Before using Autograd for more complicated calculations, it might be useful to experiment with what kind of functions Autograd is capable of finding the gradient of. The following Python functions are ... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/26_sirajs_text_summarisation/notebooks/01-How_to_make_a_text_summarizer/train.ipynb | mit | import os
# os.environ['THEANO_FLAGS'] = 'device=cpu,floatX=float32'
import keras
keras.__version__
"""
Explanation: you should use GPU but if it is busy then you always can fall back to your CPU
End of explanation
"""
FN0 = 'vocabulary-embedding'
"""
Explanation: Use indexing of tokens from vocabulary-embedding t... |
renekm/CD-atualizado- | exercicios/Exercicio aula 17.ipynb | gpl-3.0 | %matplotlib inline
import os
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy import stats
from scipy.stats import norm
"""
Explanation: Atividade: Soma de variáveis aleatórias
Aula 17
Preparo Prévio:
1. Seção 5.1 – págs 137 a 140: aborda como fazer uma distribuição de probabilidade ... |
tensorflow/docs-l10n | site/ja/federated/tutorials/simulations.ipynb | apache-2.0 | #@test {"skip": true}
!pip install --quiet --upgrade tensorflow-federated
!pip install --quiet --upgrade nest-asyncio
import nest_asyncio
nest_asyncio.apply()
import collections
import time
import tensorflow as tf
import tensorflow_federated as tff
source, _ = tff.simulation.datasets.emnist.load_data()
def map_f... |
jeicher/cobrapy | documentation_builder/simulating.ipynb | lgpl-2.1 | import pandas
pandas.options.display.max_rows = 100
import cobra.test
model = cobra.test.create_test_model("textbook")
"""
Explanation: Simulating with FBA
Simulations using flux balance analysis can be solved using Model.optimize(). This will maximize or minimize (maximizing is the default) flux through the objectiv... |
AlphaGit/deep-learning | embeddings/Skip-Gram_word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_soft/td1a_cython_edit_correction.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.soft - Calcul numérique et Cython - correction
End of explanation
"""
def distance_edition(mot1, mot2):
dist = { (-1,-1): 0 }
for i,c in enumerate(mot1) :
dist[i,-1] = dist[i-1,-1] + 1
dist[-1,i] = dist[-1,i-1... |
strikingmoose/chi_lars_face_detection | notebook/12 - Building & Training Convolutional Neural Network (AWS).ipynb | apache-2.0 | # Install tflearn
import os
os.system("sudo pip install tflearn tqdm boto3 opencv-python")
"""
Explanation: 12 - Building & Training Convolutional Neural Network
Preface
Note that this same notebook crashed my laptop when I tried to train my CNN, so I'm migrating this onto AWS. This notebook's code is a similar copy o... |
ISosnovik/UVA_AML17 | week_2/1.Blocks.ipynb | mit | import automark as am
username = 'sosnovik'
am.register_id(username, ('ivan sosnovik', 'i.sosnovik@uva.nl'))
am.get_progress(username)
"""
Explanation: Assignment 1
Blocks
The main idea of this assignment is to allow you to undestand how neural networks (NNs) work. We will cover the main aspects such as the Backpropa... |
DeepLearningUB/DeepLearningMaster | 3. Tensorflow programming model.ipynb | mit | import tensorflow as tf
print(tf.__version__)
# Basic constant operations = to assign a value to a tensor
a = tf.constant(2)
b = tf.constant(3)
c = a+b
d = a*b
e = c+d
# non interactive session
with tf.Session() as sess:
print("a=2")
print("b=3")
print("(a+b)+(a*b) = %i" % sess.run(e))
"""
Explanation:... |
manojkumar-github/NLP-TextAnalytics | IntentMatching/sentence_similarity_gensim_wmd.ipynb | mit | # Importing the dependecies
import gensim
"""
Explanation: Short-Sentence Similarity using Gensim Word Mover Distance
1. Gensim Word-Movers model
Reference:
Note: Refer to other similarity functions
https://radimrehurek.com/gensim/models/word2vec.html
End of explanation
"""
#load word2vec model, here GoogleNews is u... |
Heerozh/deep-learning | tv-script-generation/dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
CyberCRI/dataanalysis-herocoli-redmetrics | v1.52/Tests/1.5 Google form analysis - PCA.ipynb | cc0-1.0 | %run "../Functions/1. Google form analysis.ipynb"
"""
Explanation: Google form analysis tests
Purpose: determine in what extent the current data can accurately describe correlations, underlying factors on the score.
Especially concerning the 'before' groups: are there underlying groups explaining the discrepancies in ... |
azhurb/deep-learning | sentiment_network/Sentiment Classification - How to Best Frame a Problem for a Neural Network (Project 2).ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
mne-tools/mne-tools.github.io | 0.24/_downloads/99a2efbcf51159fbb58f12830f81525d/compute_csd.ipynb | bsd-3-clause | # Author: Marijn van Vliet <w.m.vanvliet@gmail.com>
# License: BSD-3-Clause
from matplotlib import pyplot as plt
import mne
from mne.datasets import sample
from mne.time_frequency import csd_fourier, csd_multitaper, csd_morlet
print(__doc__)
"""
Explanation: Compute a cross-spectral density (CSD) matrix
A cross-spe... |
phoebe-project/phoebe2-docs | 2.1/tutorials/LC.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: 'lc' Datasets and Options
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
"""
%matplotlib in... |
AustinPUG/PGDay2016 | Numba inside PostgreSQL.ipynb | bsd-3-clause | import psycopg2
"""
Explanation: Very Brief Demo of Numba Speedup inside PostgreSQL
Background
This notebook was originally presented as part of a talk at PGDay Austin 2016 by Davin Potts (davin AT discontinuity DOT net).
The talk built up to this notebook by first providing stories about computer vision technologies ... |
root-mirror/training | SummerStudentCourse/2019/Exercises/ROOTBooks/CreateAHistogram_Solution.ipynb | gpl-2.0 | import ROOT
"""
Explanation: Create a Histogram
Create a histogram, fill it with random numbers, set its colour to blue, draw it.
Can you:
- Can you use the native Python random number generator for this?
- Can you make your plot interactive using JSROOT?
- Can you document what you did in markdown?
End of explanation... |
chetan51/nupic.research | projects/whydense/cifar-100/HyperparameterAnalysis.ipynb | gpl-3.0 | browser = RayTuneExperimentBrowser(os.path.expanduser("~/nta/results/VGG19SparseFull"))
df = browser.best_experiments(min_test_accuracy=0.0, min_noise_accuracy=0.0, sort_by="test_accuracy")
df.head(5)
df.columns
df.iloc[0]
"""
Explanation: Load data and general exploration
End of explanation
"""
len(df[df['epoch... |
ML4DS/ML4all | R1.Intro_Regression/.ipynb_checkpoints/regression_intro-checkpoint.ipynb | mit | # Import some libraries that will be necessary for working with data and displaying plots
# To visualize plots in the notebook
%matplotlib inline
import numpy as np
import scipy.io # To read matlab files
import pandas as pd # To read data tables from csv files
# For plots and graphical results
import matplo... |
georgetown-analytics/machine-learning | examples/pbwitt/Testing Paul Witt Yellowbrick .ipynb | mit | %matplotlib inline
import os
import json
import time
import pickle
import requests
import numpy as np
import pandas as pd
import yellowbrick as yb
import matplotlib.pyplot as plt
df=pd.read_csv("/Users/pwitt/Documents/machine-learning/examples/pbwitt/Dataset/Training/Features_Variant_1.csv")
# Fetch the data if ... |
mdeff/ntds_2017 | projects/reports/face_manifold/NTDS_Project.ipynb | mit | import os
import numpy as np
from sklearn.tree import ExtraTreeRegressor
from sklearn import manifold
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from matplotlib import animation
from PIL import Image
import pickle
from scipy.linalg import norm
import networkx as nx
from scipy import spatial
... |
vzg100/Post-Translational-Modification-Prediction | .ipynb_checkpoints/Lysine Acetylation -MLP -dbptm-checkpoint.ipynb | mit | from pred import Predictor
from pred import sequence_vector
from pred import chemical_vector
"""
Explanation: Template for test
End of explanation
"""
par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"]
for i in par:
print("y", i)
y = Predictor()
y.load_data(file="Data/Trainin... |
musketeer191/job_analytics | .ipynb_checkpoints/user_apply_job-checkpoint.ipynb | gpl-3.0 | # Global vars
DATA_DIR = 'D:/larc_projects/job_analytics/data/clean/'
RES_DIR = 'd:/larc_projects/job_analytics/results/'
AGG_DIR = RES_DIR + 'agg/'
FIG_DIR = RES_DIR + 'figs/'
apps = pd.read_csv(DATA_DIR + 'apps_with_time.csv')
apps.shape
# Rm noise (numbers) in job_title column
apps['is_number'] = map(is_number, ap... |
enbanuel/phys202-2015-work | assignments/assignment07/AlgorithmsEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Algorithms Exercise 2
Imports
End of explanation
"""
def find_peaks(a):
"""Find the indices of the local maxima in a sequence."""
# YOUR CODE HERE
#I always start with an empty list k.
k=... |
lithiumdenis/MLSchool | 7. Анализ тональности.ipynb | mit | import codecs
fileObj = codecs.open( 'data/TextWorks/training.txt', "r", "utf_8_sig" )
lines = fileObj.readlines()
#with open( 'data/TextWorks/training.txt'
# # Путь к вашему training.txt-файлу
# ) as handle:
# lines = handle.readlines()
data = [x.strip().split('\t') for x in lines]
df = pd.DataF... |
MehtapIsik/assaytools | examples/competition-fluorescence-assay/2b MLE fit for three component binding - simulated data.ipynb | lgpl-2.1 | import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
import seaborn as sns
%pylab inline
#Competitive binding function
#This function and its assumptions are defined in greater detail in this notebook:
## modelling-CompetitiveBinding-ThreeComponentBinding.ipynb
def three_component_competiti... |
MissouriDSA/twitter-locale | twitter/twitter_2.ipynb | mit | # BE SURE TO RUN THIS CELL BEFORE ANY OF THE OTHER CELLS
import psycopg2
import pandas as pd
# query database
statement = """
SELECT *
FROM twitter.tweet
WHERE job_id = 261
LIMIT 1000;
"""
try:
connect_str = "dbname='twitter' user='dsa_ro_user' host='dbase.dsa.missouri.edu'password='readonly'"
# use our con... |
mne-tools/mne-tools.github.io | 0.24/_downloads/ab20eadd8e6e3c70dc4dd75cfef6ca4c/60_visualize_stc.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample, fetch_hcp_mmp_parcellation
from mne.minimum_norm import apply_inverse, read_inverse_operator
from mne import read_evokeds
data_path = sample.data_path()
sample_dir = op.join(data_path, 'MEG', 'sample')... |
Upward-Spiral-Science/uhhh | code/.ipynb_checkpoints/[Assignment 11] JM-checkpoint.ipynb | apache-2.0 | y_sum = [0] * len(vol[0,:,0])
for i in range(len(vol[0,:,0])):
y_sum[i] = sum(sum(vol[:,i,:]))
ax = sns.barplot(x=range(len(y_sum)), y=y_sum, color="b")
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
"""
Explanation: Great — we're done with setup.
Analysis — Week 2
1. Layers of Cortex
Let's look closer ... |
kubeflow/examples | financial_time_series/Financial Time Series with Finance Data.ipynb | apache-2.0 | !pip3 install google-cloud-bigquery==1.6.0 pandas==0.23.4 matplotlib==3.0.3 scipy==1.2.1 --user
"""
Explanation: TensorFlow Machine Learning with Financial Data on Google Cloud Platform
This solution presents an accessible, non-trivial example of machine learning with financial time series on Google Cloud Platform (GC... |
alfkjartan/control-computarizado | introduction/notebooks/Continuous-PID.ipynb | mit | # Uncomment and run the commands in this cell if a packages is missing
!pip install slycot
!pip install control
%matplotlib widget
import ipywidgets as widgets
import matplotlib.pyplot as plt
import numpy as np
import control.matlab as cm
"""
Explanation: Tuning the parameters of a PID controller
In this notebook you... |
maubarsom/ORFan-proteins | phage_assembly/5_annotation/asm_v1.2/orf_160621/.ipynb_checkpoints/4_select_reliable_orfs-checkpoint.ipynb | mit | #Load blast hits
blastp_hits = pd.read_csv("2_blastp_hits.csv")
blastp_hits.head()
#Filter out Metahit 2010 hits, keep only Metahit 2014
blastp_hits = blastp_hits[blastp_hits.db != "metahit_pep"]
"""
Explanation: 1. Load blast hits
End of explanation
"""
#Assumes the Fasta file comes with the header format of EMBOSS... |
chbrandt/pynotes | xmatch/xNN_v1-mock_sources.ipynb | gpl-2.0 | %matplotlib inline
from matplotlib import pyplot as plt
from matplotlib import cm
import numpy
plt.rcParams['figure.figsize'] = (10.0, 10.0)
"""
Explanation: The search for nearest-neighbors between (two) mock catalogs
As a first step in working over the cross-matching of two astronomical catalogs, below I experim... |
shngli/Data-Mining-Python | Mining massive datasets/Frequent itemsets.ipynb | gpl-3.0 | import os
import sys
# N = 100,000; M = 50,000,000; S = 5,000,000,000
# N = 40,000; M = 60,000,000; S = 3,200,000,000
# N = 50,000; M = 80,000,000; S = 1,500,000,000
# N = 100,000; M = 100,000,000; S = 1,200,000,000
soln = [[100000, 50000000, 5000000000],
[40000, 60000000, 3200000000],
[50000, 80000000... |
skipamos/code_guild | wk0/notebooks/.ipynb_checkpoints/primes_challenge-checkpoint.ipynb | mit | def list_primes(n):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Thunder Shiviah. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Implement list_primes(n), which returns a list of primes up to n (inclusive).
Constraints
Test Cases
Algorithm
C... |
AllenDowney/ModSim | soln/chap09.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/'
... |
mikebentley15/baxter_projectyouth | sandbox/play.ipynb | mit | import rospy
import baxter_interface
from baxter_interface import CHECK_VERSION
"""
Explanation: The below imports will only work if you have ros and baxter tools installed and working, which isn't the case on my laptop.
End of explanation
"""
def tryGetLine(inStream):
'Returns a line if there is one, else an em... |
christophmark/bayesloop | docs/source/tutorials/modelselection.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt # plotting
import seaborn as sns # nicer plots
sns.set_style('whitegrid') # plot styling
import numpy as np
import bayesloop as bl
# prepare study for coal mining data
S = bl.Study()
S.loadExampleData()
L = bl.om.Poisson('accident_rate', bl.oint(0, 6,... |
eigenholser/python-magic-methods | slides.ipynb | mit | methods = []
for item in dir(2):
if item.startswith('__') and item.endswith('__'):
methods.append(item)
print(methods)
"""
Explanation: Python Magic...Methods
<br/>
<br/>
Scott Overholser
<br/>
<br/>
https://github.com/eigenholser/python-magic-methods
Terminology
"Dunder" is used to reference "double und... |
KshitijT/fundamentals_of_interferometry | 1_Radio_Science/1_9_a_brief_introduction_to_interferometry.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: Outline
Glossary
1. Radio Science using Interferometric Arrays
Previous: 1.8 Astronomical radio sources
Next: 1.10 The Limits of Single Dish Astronomy
... |
GoogleCloudPlatform/openmrs-fhir-analytics | dwh/test_query_lib.ipynb | apache-2.0 | from datetime import datetime
import pandas
from typing import List, Any
import pyspark.sql.functions as F
import query_lib
import indicator_lib
BASE_DIR='./test_files/parquet_big_db'
#CODE_SYSTEM='http://snomed.info/sct'
CODE_SYSTEM='http://www.ampathkenya.org'
# Note since this issue is resolved we don't need BASE_... |
kkhenriquez/python-for-data-science | Week-7-MachineLearning/Weather Data Clustering using k-Means.ipynb | mit | from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
import python_utils
import pandas as pd
import numpy as np
from itertools import cycle, islice
import matplotlib.pyplot as plt
from pandas.tools.plotting import parallel_coordinates
%matplotlib inline
"""
Explanation: <p style="font-f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.