repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
setiQuest/ML4SETI | tutorials/Step_5b_Underestanding_CNN.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
"""
Explanation: <a href="https://www.cognitiveclass.ai"><img src = "https://cognitiveclass.ai/wp-content/themes/bdu3.0/static/images/cc-logo.png" align = left></a>
<br>
<br>... |
Upward-Spiral-Science/spect-team | Code/Assignment-6/test_assumptions.ipynb | apache-2.0 | import numpy as np
# We don't want to ensure reproducibility, we want the sampling to be random everytime, this is because only then
# will iterative coverage of the rows of the large matrix be max
# Before we perform any identical-ness determination let's have a look at the shape of the matix
print "Shape of reduced... |
tiegz/ThreatExchange | ipynb/ThreatExchange Data Dashboard.ipynb | bsd-3-clause | from pytx.access_token import access_token
from pytx.logger import setup_logger
from pytx.vocabulary import PrivacyType as pt
# Specify the location of your token via one of several ways:
# https://pytx.readthedocs.org/en/latest/pytx.access_token.html
access_token()
"""
Explanation: ThreatExchange Data Dashboard
Purp... |
peterwittek/pelican-ipynb | tests/pelican/content/with-metadata.ipynb | apache-2.0 | a = 1
a
b = 'pew'
b
%matplotlib inline
import matplotlib.pyplot as plt
from pylab import *
x = linspace(0, 5, 10)
y = x ** 2
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()
import numpy as np
num_points = 130
y = np.random.random(num_points)
plt.plot(y)
"""
Explanation: Lorem ipsum dol... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_model_performance/labs/d_hyperparameter_tuning.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 AI Platform
TFVERSION = "1.14" # TF version for AI Platform
import os
os.environ["PROJECT"] = PROJECT
os.enviro... |
datactive/bigbang | examples/threads_analysis/ThreadsAnalysis.ipynb | mit | from bigbang.archive import Archive
from bigbang.archive import load as load_archive
from bigbang.thread import Thread
from bigbang.thread import Node
from bigbang.utils import remove_quoted
import matplotlib.pyplot as plt
import datetime
import pandas as pd
import csv
from collections import defaultdict
import os
"""... |
Sasanita/nmt-keras | examples/3_decoding_tutorial.ipynb | mit | from config import load_parameters
from data_engine.prepare_data import keep_n_captions
from keras_wrapper.cnn_model import loadModel
from keras_wrapper.dataset import loadDataset
params = load_parameters()
dataset = loadDataset('datasets/Dataset_tutorial_dataset.pkl')
"""
Explanation: NMT-Keras tutorial
3. Decoding w... |
google-research/google-research | socraticmodels/SocraticModels_ImageCaptioning.ipynb | apache-2.0 | openai_api_key = "your-api-key"
"""
Explanation: Copyright 2021 Google LLC.
SPDX-License-Identifier: 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/LICENS... |
Katsuya-Ishiyama/image_style_transfer | dev/image_style_transfer_using_cnn.ipynb | mit | import numpy as np
import pandas as pd
import tensorflow as tf
CONTENT_FILE = '/home/ishiyama/image_style_transfer/image/input/test_input_01.JPG'
STYLE_FILE = '/home/ishiyama/image_style_transfer/image/style/test_style_01.jpg'
class Image(np.ndarray):
"""画像を扱うためのnumpy.ndarray
XXX: 実装が大変なので一旦保留
... |
arnoldlu/lisa | ipynb/tests/Generic_EAS_Tests.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import logging
from conf import LisaLogging
LisaLogging.setup()#level=logging.WARNING)
import pandas as pd
from perf_analysis import PerfAnalysis
import trappy
from trappy import ILinePlot
from trappy.stats.grammar import Parser
"""
Explanation: Run Generic Aut... |
ibm-cds-labs/pixiedust | notebook/PixieDust Contribute.ipynb | apache-2.0 | import pixiedust
"""
Explanation: Contribute
By now, you've walked through PixieDust's intro notebooks and seen PixieDust in action. If you like what you saw, join the project!
Anyone can get involved. Here are some ways you can contribute:
Write a visualization
Sample visualization customization
Contribute your own ... |
mne-tools/mne-tools.github.io | 0.22/_downloads/5a3a8c2664be35abac537a97ac994e3e/plot_modifying_data_inplace.ipynb | bsd-3-clause | import mne
import os.path as op
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Modifying data in-place
It is often necessary to modify data once you have loaded it into memory.
Common examples of this are signal processing, feature extraction, and data
cleaning. Some functionality is pre-buil... |
tiffanyj41/hermes | src/data_prep/model/Python2Vec--Save Model.ipynb | apache-2.0 | code_lines = sqlCtx.read.json(
# Put the location to your data here
'git_repos/*.json.gz',
)
code_lines = code_lines.repartition(300)
"""
Explanation: Load the Data
End of explanation
"""
import re
def split_code(input):
strs = ' '.join(input)
patt = re.compile(ur"[\w]+", re.UNICODE)
return pat... |
sccolbert/talk-2015 | Notebook Tour.ipynb | mit | from IPython.display import display, Image, HTML
from talktools import website, nbviewer
"""
Explanation: Notebook Tour
End of explanation
"""
2+2
import math
math.atan?
"""
Explanation: The Jupyter Notebook is a web-based application that enables users to create documents that combine live code wth narrative nex... |
tschinz/iPython_Workspace | 02_WP/VHDL/HW Encoder and PLC Encoder.ipynb | gpl-2.0 | # Function to calculate the Bits needed for a given number
def unsigned_num_bits(num):
_nbits = 1
_n = num
while(_n > 1):
_nbits = _nbits + 1
_n = _n / 2
return _nbits
"""
Explanation: HwEnc Calculations
End of explanation
"""
import numpy as np
resolutions = [150, 360, 600, 1200, 2400, 4800] ... |
cxhernandez/msmbuilder | examples/Fs-Peptide-in-RAM.ipynb | lgpl-2.1 | # Download example dataset
from msmbuilder.example_datasets import FsPeptide
fs_peptide = FsPeptide(verbose=False)
xyz = fs_peptide.get().trajectories
print(fs_peptide.description())
"""
Explanation: Modeling dynamics of FS Peptide
This example shows a typical, basic usage of MSMBuilder to model dynamics of a protein ... |
ThyrixYang/LearningNotes | MOOC/stanford_cnn_cs231n/assignment3(without_extra)/.ipynb_checkpoints/LSTM_Captioning-checkpoint.ipynb | gpl-3.0 | # As usual, a bit of setup
from __future__ import print_function
import time, os, json
import numpy as np
import matplotlib.pyplot as plt
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.rnn_layers import *
from cs231n.captioning_solver import CaptioningSolver
from c... |
SamLau95/nbinteract | docs/notebooks/examples/examples_variability_of_the_sample_mean.ipynb | bsd-3-clause | united = Table.read_table('http://inferentialthinking.com/notebooks/united_summer2015.csv')
delay = united.select('Delay')
pop_mean = np.mean(delay.column('Delay'))
pop_mean
delay_opts = {
'xlabel': 'Delay (minute)',
'ylabel': 'Percent per minute',
'xlim': (-20, 200),
'ylim': (0, 0.037),
'bins': 2... |
neoscreenager/JupyterNotebookWhirlwindTourOfPython | whirlwindDataScienceTools.ipynb | gpl-3.0 | import numpy as np
x = np.arange(1, 10)
x
x ** 2
"""
Explanation: numpy scipy pandas matplotlib scikit-learn
NumPy: Numerical Python
NumPy provides an efficient way to store and manipulate multi-dimensional dense arrays in Python. The important features of NumPy are:
It provides an ndarray structure, which allows eff... |
danielbultrini/FXFEL | Quick-start plotting .ipynb | bsd-3-clause | import file_processor as fp #contains simple routines for sorting files and making directories
import processing_tools as pt #bulk of the processing
import int_plot as ip #allows for interactive plots
"""
Explanation: Plotting routines
a selection of plotting routines for easy access
End of explanation
"""
directo... |
organicmatters/Learnfastai | deeplearning1/nbs/lesson3.ipynb | apache-2.0 | from theano.sandbox import cuda
%matplotlib inline
import utils; reload(utils)
from utils import *
from __future__ import division, print_function
#path = "data/dogscats/sample/"
path = "data/dogscats/"
model_path = path + 'models/'
if not os.path.exists(model_path): os.mkdir(model_path)
batch_size=64
"""
Explanati... |
matthieu-lapeyre/pypot | samples/notebooks/Controlling a Poppy Creature using SNAP.ipynb | gpl-3.0 | from poppy.creatures import PoppyHumanoid
poppy = PoppyHumanoid(simulator='vrep')
"""
Explanation: How-To: Control a Poppy Creature using Snap!
Introduction
This notebook will describe how:
* you can connect the visual programming language Snap! to a Poppy Creature
* and how you can control it in real time using ou... |
phoebe-project/phoebe2-docs | development/examples/requiv_max_limit.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
b = phoebe.default_binary()
b.add_dataset('lc', compute_phases=phoebe.linspace(0,1,101))
"""
Explanation: jktebop: requiv_max_limit
Here we'll examine how well jktebop agrees with PHOEBE with increased distortion.
Setup
Let's first make sure we have the latest versi... |
WNoxchi/Kaukasos | FADL1/quick_dogscats.ipynb | mit | # git pull https://github.com/fastai.git
# cd fastai
# conda env create -f environment.yml
# source activate fastai
# python -m ipykernel install --user --name fastai --display-name "Python 3 (FastAI)"
# ## if working from another dir:
# ln -s <path to fastai/fastai> fastai
# %mkdir -p data/dogscats
from fastai.conv... |
exowanderer/SpitzerDeepLearningNetwork | Notebooks/tensorflow_DNNRegressor_Spitzer - SELU.ipynb | mit | import pandas as pd
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
import warnings
warnings.filterwarnings("ignore")
%matplotlib inline
from matplotlib import pyplot as plt
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler, Mi... |
ccauet/scikit-optimize | examples/ask-and-tell.ipynb | bsd-3-clause | import numpy as np
np.random.seed(1234)
%matplotlib inline
import matplotlib.pyplot as plt
plt.set_cmap("viridis")
"""
Explanation: Async optimization Loop
Tim Head, February 2017.
End of explanation
"""
from skopt.learning import ExtraTreesRegressor
from skopt import Optimizer
noise_level = 0.1
# Our 1D toy prob... |
SKA-ScienceDataProcessor/crocodile | examples/notebooks/facet-subgrid-impl.ipynb | apache-2.0 | %matplotlib inline
from matplotlib import pylab
import matplotlib.patches as patches
import matplotlib.path as path
from ipywidgets import interact
import numpy
import sys
import random
import itertools
import time
import scipy.special
import math
pylab.rcParams['figure.figsize'] = 16, 10
pylab.rcParams['image.cmap']... |
marsbroshok/tensorflow-rnn-events-prediction | GDC Meetup Paris GDELT-skflow-RNN.ipynb | mit | # Set up
from __future__ import division
import StringIO
import datalab.bigquery as bq
import tensorflow as tf
from tensorflow.contrib import skflow, learn
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas.tools.plotting import autocorrelation_plot
from pandas.tools.plotting import scat... |
mglerner/Evals | EvalReformatting-htmlpdf.ipynb | apache-2.0 | import makepdf
import wordcloud
"""
Explanation: Overview
You can either run this as a notebook, changing one variable below, or use the command-line makepdf.py script.
Requirements
The standard scientific Python stack, which comes with the Anaconda Python distribution ... that's what you should be using anyway.
word... |
cdipaolo/inflection | notebooks/tsla_regression_gpy.ipynb | mit | kernel = GPy.kern.RBF(input_dim=1, variance=1.5, lengthscale=0.75)
model = GPy.models.GPRegression(T, price, kernel=kernel, noise_var=0.2)
display(model)
model.plot()
"""
Explanation: Now let's try running Gaussian Process regression on these stock prices, using a poor choice of hyperparameters. Within the RBF (aka.... |
mmathioudakis/moderndb | 2016/assignment 3.ipynb | mit | ## Imports and SparkContext
import pyspark
import numpy as np # use numpy for advanced numeric operations
import ast # we'll use this module to read data
## SMALL dataset
## Run this cell *ONLY* if you want to be
## using the SMALL dataset
SMALL_FILE = "file:///data/small.input"
DATA_FILE = SMALL_FILE
## BIG data... |
hughperkins/pub-prototyping | maths/bayesian_linear_regression.ipynb | apache-2.0 | import torch
import numpy as np
import math
import matplotlib.pyplot as plt
num_samples = 7
torch.manual_seed(123)
order = 3
W_gnd = torch.randn(order + 1)
left = -3
right = 3
variance = torch.randn(1)[0] * 10
# print('variance', variance)
# help(torch.arange)
x1 = torch.arange(left, right, (right - left) / 250)
# pr... |
vahidpartovinia/pythonworkshop | jupyter/chapter01.ipynb | gpl-2.0 | a, b, c = 2, 3, "Hello World!"
print a, b, c
print "Hello World!"
print 3*3
print 3**2
print 2+2
"""
Explanation: Introduction to Python
In this chapter, you will start testing your python by <br>
1. printing basic operations,
2. defining different variable types,
3. looking into lists of objects,
4. making decis... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/markov_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# NBER recessions
from pandas_datareader.data import DataReader
from datetime import datetime
usrec = DataReader('USREC', 'fred', start=datetime(1947, 1, 1), end=datetime(2013, 4, 1))
"""
Explanatio... |
scikit-rf/scikit-rf | doc/source/examples/circuit/Lumped Element Circuits.ipynb | bsd-3-clause | import numpy as np # for np.allclose() to check that S-params are similar
import skrf as rf
rf.stylely()
"""
Explanation: Lumped Elements Circuits
In this notebook, we construct various network from basic lumped elements (resistor, capacitor, inductor), with the 'classic' and the Circuit approach. Generally the Circu... |
uvchik/pvlib-python | docs/tutorials/forecast_to_power.ipynb | bsd-3-clause | # built-in python modules
import datetime
import inspect
import os
# scientific python add-ons
import numpy as np
import pandas as pd
# plotting stuff
# first line makes the plots appear in the notebook
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib as mpl
# seaborn makes your plots look better... |
NORCatUofC/rain | nexrad-etl/Validate NEXRAD with Weather Underground.ipynb | mit | s3_client = boto3.client('s3')
resource = boto3.resource('s3')
# Disable signing for anonymous requests to public bucket
resource.meta.client.meta.events.register('choose-signer.s3.*', disable_signing)
def file_list(client, bucket, prefix=''):
paginator = client.get_paginator('list_objects')
for result in clie... |
steinam/teacher | jup_notebooks/kammerprüfung/.ipynb_checkpoints/Sommer_2017_GA_1_FI_AWP-checkpoint.ipynb | mit | %load_ext sql
%sql mysql://steinam:steinam@localhost/sommer_2017
"""
Explanation: Sommer 2017
HS 5
End of explanation
"""
%%sql
select G.*, R.*
from `gebaeude` G
left join Raum R on G.`GebID` = R.`GebID`
order by G.`Bezeichnung`, R.`Typ`
"""
Explanation: Die Bioscan GmbH plant ein System zur Zugangskontrolle. Da... |
H-E-L-P/XID_plus | docs/build/html/notebooks/examples/SED_emulator/Sensitivity_Analysis.ipynb | mit | # Define the model inputs
problem = {
'num_vars': 3,
'names': ['x1', 'x2', 'x3'],
'bounds': [[-3.14159265359, 3.14159265359],
[-3.14159265359, 3.14159265359],
[-3.14159265359, 3.14159265359]]
}
# Generate samples
param_values = saltelli.sample(problem, 1024)
param_values = s... |
thequackdaddy/tweedie | example/tweedie_demo.ipynb | bsd-2-clause | %matplotlib inline
from __future__ import print_function
import numpy as np
import scipy as sp
from tweedie import tweedie
import seaborn as sns
import statsmodels.api as sm
# Number of parameters for model
p = 20
# Number of simulated observations
n = 100000
np.random.seed(43)
exog = np.random.rand(n, p - 1)
exog... |
nicoguaro/FEM_resources | variational/ritz_beam.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from sympy import *
%matplotlib notebook
init_printing()
# Graphics setup
gray = '#757575'
plt.rcParams["mathtext.fontset"] = "cm"
plt.rcParams["text.color"] = gray
plt.rcParams["font.size"] = 12
plt.rcParams["xtick.color"] = gray
plt.rcParams["ytick.color"] = gray
p... |
rebeccabilbro/rebeccabilbro.github.io | _drafts/intro-doc-similarity-with-elasticsearch.ipynb | mit | import os
from sklearn.datasets.base import Bunch
from yellowbrick.download import download_all
## The path to the test data sets
FIXTURES = os.path.join(os.getcwd(), "data")
## Dataset loading mechanisms
datasets = {
"hobbies": os.path.join(FIXTURES, "hobbies")
}
def load_data(name, download=True):
"""
... |
kialio/gsfcpyboot | Day_02/07_WhiteBoard_III/Programming by contract, and functions of functions.ipynb | mit | 'eggs' < 'spam'
"""
Explanation: Programming by Contract
Thomas H Meyer
Department of Natural Resources and the Environment
University of Connecticut
thomas.meyer@uconn.edu
Programming by contract (PBC) is a programming style that uses formal logic to help programmers write high-quality code.
There is a lot to PBC; it... |
Pittsburgh-NEH-Institute/Institute-Materials-2017 | schedule/week_2/Integrating_tokenization_and_normalization.ipynb | gpl-3.0 | def tokenize(input):
pass
def normalize(input):
pass
sample = "Hello, Mom!"
tokens = tokenize(sample)
# print(tokens)
normalized = [normalize(token) for token in tokens]
print(normalized)
"""
Explanation: Integrating normalization with tokenization
Structure
We define functions to tokenize and normalize. We ... |
rvperry/phys202-2015-work | assignments/assignment03/NumpyEx01.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 1
Imports
End of explanation
"""
def checkerboard(size):
"""Return a 2d checkboard of 0.0 and 1.0 as a NumPy array"""
a=n... |
raoyvn/deep-learning | sentiment-network/Sentiment_Classification_Projects.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()... |
thewtex/SimpleITK-Notebooks | 62_Registration_Tuning.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.
OUTPUT... |
CalPolyPat/phys202-2015-work | assignments/assignment10/ODEsEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def solve_euler(derivs, y0, x):
"""Solve a 1d ODE using Euler's meth... |
gcallah/Indra | notebooks/InteractiveIndra.ipynb | gpl-3.0 | from indra.interactive import *
"""
Explanation: Indra2 basic system
interactive.py contains some sample code on how to use the new Indra system. This notebook will illustrate its contents.
Right now we have three types of entity at play here:
Entity: the base "thingie" from which all else descends. Operations on ent... |
DJCordhose/ai | notebooks/rl/berater-v5.ipynb | mit | !pip install git+https://github.com/openai/baselines >/dev/null
!pip install gym >/dev/null
"""
Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/rl/berater-v5.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab... |
Parsl/parsl_demos | First-Tutorial-Start-Here.ipynb | apache-2.0 | # Import Parsl
import parsl
from parsl import *
print(parsl.__version__)
"""
Explanation: Parsl Tutorial
Parsl is a native Python library that allows you to write functions that execute in parallel and tie them together with dependencies to create workflows. Parsl wraps Python functions as "Apps" using the @App decora... |
dream-olfaction/olfaction-prediction | opc_python/collaboration/target_data_preparation.ipynb | mit | # load the training data
data = pd.read_csv(os.path.abspath('__file__' + "/../../../data/TrainSet.txt"),sep='\t')
data.drop(['Intensity','Odor','Replicate','Dilution'],axis=1, inplace=1)
data.columns = ['#oID', 'individual'] + list(data.columns)[2:]
data.head()
# load leaderboard data and reshape them to match the t... |
G-Node/nix-demo | NWB pvc-7 use-case.ipynb | bsd-3-clause | from nixio import *
import numpy as np
import matplotlib.pylab as plt
%matplotlib inline
from utils.notebook import print_stats
from utils.plotting import Plotter
"""
Explanation: NWB use-case pvc-7
--- Data courtesy of Aleena Garner, Allen Institute for Brain Sciences ---
Here we demonstrate how data from the NWB pvc... |
karlstroetmann/Artificial-Intelligence | Python/6 Classification/Polynomial-Logistic-Regression.ipynb | gpl-2.0 | import numpy as np
import pandas as pd
"""
Explanation: Polynomial Logistic Regression
End of explanation
"""
DF = pd.read_csv('fake-data.csv')
DF.head()
"""
Explanation: The data we want to investigate is stored in the file 'fake-data.csv'. It is data that I have found somewhere. I am not sure whether this dat... |
MD2Korg/CerebralCortex | jupyter_demo/datastream_operation.ipynb | bsd-2-clause | %reload_ext autoreload
from util.dependencies import *
from cerebralcortex.util.helper_methods import get_study_names
"""
Explanation: Interacting with CerebralCortex Data
Cerebral Cortex is MD2K's big data cloud tool designed to support population-scale data analysis, visualization, model development, and interventio... |
mrcinv/moodle-questions | python/example_attached_files.ipynb | gpl-3.0 | %pylab inline
from moodle import *
"""
Explanation: Exercise sample: attached files
Change this sample according to your needs. Run all the cells, and upload resulting .xml file to Moodle.
Auxilary functions
End of explanation
"""
import random
random.seed(123)
parameters = [random.randint(100,1000) for i in range... |
paolorivas/homeworkfoundations | 12/Homework_12_Paolo_Rivas.ipynb | mit | df = pd.read_csv("311-2015.csv", nrows=200000)
#total number of rows
print("Total rows: {0}".format(len(df)))
#Alternative way to do it
#df2 = df.ix[:200000]
print("Total rows: {0}".format(len(df))) #20000 data points+1 for columns name
#you can see that df2 dataframe displays 20000 rows of data.
df.tail()
#time... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/solutions/training_example.ipynb | apache-2.0 | ! pip uninstall -y tensorflow
! pip install -q tensorflow-model-optimization
! pip install --upgrade tensorflow==2.6
import tempfile
import os
import tensorflow as tf
from tensorflow import keras
"""
Explanation: Quantization aware training in Keras example
Overview
Welcome to an end-to-end example for quantization... |
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn | doc/notebooks/automaton.is_synchronized.ipynb | gpl-3.0 | import vcsn
ctx = vcsn.context("lat<law_char, law_char>, b")
"""
Explanation: automaton.is_synchronized
Whether the automaton is synchronized:
- every transition has the same number of letters on every tape, except for a few leading to final states
- in each accepting path, disregarding spontaneous transitions, if a $... |
sthuggins/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
def random_line(m, b, sigma, size=10):
"""Create a line y = m*x + b + N(0,si... |
ekansa/open-context-jupyter | notebooks/Open Context API Murlo Objects.ipynb | mit | # Define a list of columns to drop.
drop_cols = [
'Fragment Noted',
'Depth Notes',
'Supplement Note',
'Fabric Description',
'Description',
'Size',
]
df.drop(columns=drop_cols, inplace=True)
# The API returns 'False' if a citation URI is not defined, it's better
# practice to make this a null.
d... |
malariagen/agam-vgsc-report | notebooks/artwork_ld.ipynb | mit | %run setup.ipynb
%matplotlib inline
# load in selected missense variants
tbl_variants_selected = etl.frompickle('../data/tbl_variants_missense_selected.pkl')
tbl_variants_selected.nrows()
# load in haplotypes
callset_haps = np.load('../data/haps_phase1.npz')
haps = allel.HaplotypeArray(callset_haps['haplotypes'])
pos... |
data-cube/agdc-v2-examples | notebooks/08_hovmoller_space_time_visualisation_advanced.ipynb | apache-2.0 | %pylab notebook
from __future__ import print_function
import datacube
import xarray as xr
from datacube.storage import masking
from datacube.storage.masking import mask_to_dict
from datacube.helpers import ga_pq_fuser
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import pyplot as plt
import matpl... |
CopernicusMarineInsitu/INSTACTraining | PythonNotebooks/PlatformPlots/plot_CMEMS_vessel.ipynb | mit | %matplotlib inline
import netCDF4
from netCDF4 import num2date
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.basemap import Basemap
"""
Explanation: The objective of this notebook is to show how to read and plot the data obtained with a vess... |
gwsb-istm-6212-fall-2016/syllabus-and-schedule | lectures/week-05/20160927-lecture-notes.ipynb | cc0-1.0 | !wget http://files.software-carpentry.org/survey.db
!pip install ipython-sql
%load_ext sql
%sql sqlite:///survey.db
"""
Explanation: More SQL DML and DDL
Data and environment setup
End of explanation
"""
%%sql
SELECT *
FROM Site;
%%sql
SELECT *
FROM Visited;
"""
Explanation: SQL JOINs
Note first that a simple J... |
irockafe/revo_healthcare | notebooks/MTBLS315/exploratory/auc_vs_rt_window_plots.ipynb | mit | import time
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
import numpy as np
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn.cross_va... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch4-Problem_4-07.ipynb | unlicense | %pylab notebook
%precision 1
"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 4
Problem 4-7
End of explanation
"""
Vl = 14.4e3 # [V]
S = 100e6 # [VA]
ra = 0.011 # [pu]
xs = 1.1 # [pu]
PF = 0.8
p = 2
fse = 50 # [Hz]
"""
Explanation: Description
A 100-MVA, 14.4-kV, 0.8-PF-lagging, 50-H... |
eds-uga/csci1360-fa16 | assignments/A11/A11_Q2.ipynb | mit | import sklearn.svm as svm
### BEGIN SOLUTION
### END SOLUTION
try:
train_svm
except:
assert False
else:
assert True
import numpy as np
np.random.seed(598497)
X = np.random.random((20, 2))
y = np.random.randint(2, size = 20)
m1 = train_svm(X, y, 10000.0)
assert m1.C == 10000.0
np.testing.assert_allclose... |
AllenDowney/ModSim | python/soln/chap04.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/'
... |
alice-i-cecile/symbolic-learning | Playground/Bayesian regression demo.ipynb | mit | import pandas as pd
import statsmodels.api as sm
# Normal response variable
stackloss_conversion = sm.datasets.get_rdataset("stackloss", "datasets")
#print (stackloss_conversion.__doc__)
# Lognormal response variable
engel_food = sm.datasets.engel.load_pandas()
#print (engel_food.data)
# Binary response variable
tit... |
SHDShim/pytheos | examples/6_p_scale_test_Tsuchiya2003_Au.ipynb | apache-2.0 | %config InlineBackend.figure_format = 'retina'
"""
Explanation: For high dpi displays.
End of explanation
"""
import matplotlib.pyplot as plt
import numpy as np
from uncertainties import unumpy as unp
import pytheos as eos
"""
Explanation: 0. General note
This example compares pressure calculated from pytheos and o... |
JKeun/lecture-statistics | ch02-variables.ipynb | mit | import pandas as pd
import numpy as np
np.random.seed(0)
data = np.random.randint(50, 100, size=(8, 5))
data[0][0] = 12
data
np.sort(data.flatten())
"""
Explanation: Ch 2. 자료의 정리
변수와 자료
도수분포표
1. 변수 ( variable, feature )
양적변수 ( quantitative variable, real value )
수치로 나타낼 수 있는 변수
- 이산변수 ( discrete )
- 정숫값을 취한 ... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/SDK_AutoML_Text_Extraction_Training.ipynb | apache-2.0 | !pip3 uninstall -y google-cloud-aiplatform
!pip3 install google-cloud-aiplatform
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
import sys
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()
"""
Explanation: Feedback or issues?
For any ... |
azhurb/deep-learning | sentiment-rnn/Sentiment_RNN.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_home/2020_profile.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Tech - profiling
Le profilage de code ou profiling en anglais signifie qu'on mesure le temps passé dans chaque partie d'un programme pour en découvrir les parties les plus coûteuses et les améliorer. On souhaite toujours accélérer un prog... |
cloudmesh/book | notebooks/machinelearning/machinelearning.ipynb | apache-2.0 | import pandas as pd
# read CSV file directly from a URL and save the results
data = pd.read_csv('http://www-bcf.usc.edu/~gareth/ISL/Advertising.csv', index_col=0)
# display the first 5 rows
data.head()
data.shape
"""
Explanation: What is machine learning?
One definition: "Machine learning is the semi-automated extr... |
CyberCRI/dataanalysis-herocoli-redmetrics | v1.52.2/Data mining/ruleAssociationMining.ipynb | cc0-1.0 | from orangecontrib.associate.fpgrowth import *
import pandas as pd
from numpy import *
questions = correctedScientific.columns
correctedScientificText = [[] for _ in range(correctedScientific.shape[0])]
for q in questions:
for index in range(correctedScientific.shape[0]):
r = correctedScientific.index[in... |
whitead/numerical_stats | unit_11/hw_2019/homework_11_key.ipynb | gpl-3.0 | import scipy.optimize as opt
import numpy as np
import matplotlib.pyplot as plt
def prob1(x):
return (x - 4)**4 / 8 + (x - 2)**2 / 2 - 4
r1 = opt.root(prob1, x0=0)
r2 = opt.root(prob1, x0=8)
x = np.linspace(1, 5, 500)
plt.plot(x, prob1(x))
plt.plot([r1.x, r2.x], [0, 0], 'ro')
plt.show()
print("The solution is {:... |
ClaudiaEsp/inet | Analysis/misc/Bidirectional connections as a function of distance.ipynb | gpl-2.0 | %pylab inline
import warnings
from inet import DataLoader, __version__
from inet.motifs import iicounter
from inet.utils import II_slice
print('Inet version {}'.format(__version__))
# use filenames in the dataset to read list of distances to be read
mydataset = DataLoader('../data/PV')
pvfiles = [ i for i in range(le... |
fastai/fastai | nbs/33_text.models.core.ipynb | apache-2.0 | #|export
_model_meta = {AWD_LSTM: {'hid_name':'emb_sz', 'url':URLs.WT103_FWD, 'url_bwd':URLs.WT103_BWD,
'config_lm':awd_lstm_lm_config, 'split_lm': awd_lstm_lm_split,
'config_clas':awd_lstm_clas_config, 'split_clas': awd_lstm_clas_split},}
# Transformer... |
tensorflow/hub | examples/colab/cord_19_embeddings.ipynb | apache-2.0 | # Copyright 2019 The TensorFlow Hub Authors. 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 app... |
jmhsi/justin_tinker | data_science/courses/deeplearning1/nbs/lesson5.ipynb | apache-2.0 | from keras.datasets import imdb
idx = imdb.get_word_index()
"""
Explanation: Setup data
We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment. Keras comes with some helpers for this dataset.
End of explanation
"""
idx_arr = sorted(idx, key=idx.get)
idx_arr[:10]
... |
mne-tools/mne-tools.github.io | 0.17/_downloads/cc5fb1aca3a8bac5564a9600e1b3630a/plot_compute_covariance.ipynb | bsd-3-clause | import os.path as op
import mne
from mne.datasets import sample
"""
Explanation: Computing a covariance matrix
Many methods in MNE, including source estimation and some classification
algorithms, require covariance estimations from the recordings.
In this tutorial we cover the basics of sensor covariance computations... |
banyh/ShareIPythonNotebook | Gensim - Topics and Transformations.ipynb | gpl-3.0 | from gensim import corpora, models, similarities
from nltk.corpus import brown
import nltk
import re
dictb = corpora.Dictionary([[word.lower() for word in sent]
for sent in brown.sents()])
print dictb
stopid = [dictb.id2token[w] for w in nltk.corpus.stopwords.words('english')
if ... |
ShubhamDebnath/Coursera-Machine-Learning | Course 4/Art Generation with Neural Style Transfer v2.ipynb | mit | import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np
import tensorflow as tf
%matplotlib inline
"""
Explanation: Deep Learning & Art: Neural Style Transfer
Welcome to the second assi... |
harmsm/pythonic-science | chapters/00_inductive-python/key/04_loops_key.ipynb | unlicense | for i in range(10):
print(i)
for i in range(15):
print(i)
"""
Explanation: Loops
Loops let you execute code over and over.
Basic Loops
Predict
What will this code do?
End of explanation
"""
for i in range(11):
print(i)
for i in range(21): # <- notice, you need 201 to get all the way to 20
print(i)
... |
walkon302/CDIPS_Recommender | notebooks/Recommendation_Compare_Methods.ipynb | apache-2.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
%matplotlib inline
import sys
import os
sys.path.append('../')
os.getcwd()
import src
import src.recommendation
reload(src.recommendation)
from src.recommendation import *
"""
Explanation: Recommenda... |
amirziai/learning | deep-learning/Convolutional-model-from-scratch.ipynb | mit | import numpy as np
import h5py
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
%load_ext autoreload
%autoreload 2
np.random.seed(1)
"""
Explanation: Convolut... |
saashimi/code_guild | wk2/extras/linked_lists/find_loop_start/find_loop_start_challenge.ipynb | mit | %run ../linked_list/linked_list.py
%load ../linked_list/linked_list.py
class MyLinkedList(LinkedList):
def find_loop_start(self):
# 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
P... |
yy/dviz-course | m08-histogram/m08-lab.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import altair as alt
import pandas as pd
import matplotlib
matplotlib.__version__
"""
Explanation: Module 8: Histogram and CDF
A deep dive into Histogram and boxplot.
End of explanation
"""
bins = [0, 1, 3, 5, 10, 24]
data = {0.5: 4300, 2: 690... |
FZJ-IEK3-VSA/tsam | examples/aggregation_representation.ipynb | mit | %load_ext autoreload
%autoreload 2
import copy
import os
import pandas as pd
import matplotlib.pyplot as plt
import tsam.timeseriesaggregation as tsam
%matplotlib inline
"""
Explanation: tsam - Representation
Example usage of the time series aggregation module (tsam)
Date: 29.04.2019
Author: Maximilian Hoffmann
Import... |
tensorflow/examples | courses/udacity_intro_to_tensorflow_for_deep_learning/l09c04_nlp_embeddings_and_sentiment.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
southpaw94/MachineLearning | TextExamples/3547_09_Code.ipynb | gpl-2.0 | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,nltk
# to install watermark just uncomment the following line:
#%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py
"""
Explanation: Sebastian Raschka, 2015
Python Machine Learning Essentials
Chapt... |
Soil-Carbon-Coalition/atlasdata | Format challenge data to csv.ipynb | mit | import pandas as pd
import numpy as np
import json
#fields for csv
site_fields = ['id', 'name', 'geometry','accuracy']
observation_fields = ['entered', 'values','observer_id', 'site_id', 'type_id', 'parentobs_id']
"""
Explanation: Formatting csv data for loading into atlasbiowork Postgres database
First, get column n... |
jarvis-fga/Projetos | Problema 2/jeferson/sentiment-analysis.ipynb | mit | import pandas
imdb = pandas.read_csv('data/imdb_labelled.txt', sep="\t", names=["sentences", "polarity"])
yelp = pandas.read_csv('data/yelp_labelled.txt', sep="\t", names=["sentences", "polarity"])
amazon = pandas.read_csv('data/amazon_cells_labelled.txt', sep="\t", names=["sentences", "polarity"])
big = pandas.DataF... |
mbuchove/notebook-wurk-b | stats/HW_5_PS.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import iv
import scipy.stats
from csv import reader
from __future__ import print_function
"""
Explanation: <h1>Astro 283 Homework 5</h1>
Bijan Pourhamzeh
End of explanation
"""
#Choose parameters and plot to see what it looks l... |
PythonFreeCourse/Notebooks | week07/2_Documentation.ipynb | mit | import math
def factorize_prime(number):
while number % 2 == 0:
yield 2
number = number // 2
# `number` must be odd at this point (we've just factored 2 out).
# Skip even numbers. Square root is good upper limit, check
# https://math.stackexchange.com/a/1039525 for more in... |
kit-cel/wt | mloc/ch7_Evolutionary_Algorithms/Differential_Evolution_Constraints.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import ticker
"""
Explanation: Optimization of Non-Differentiable Functions Using Differential Evolution with Constraints
This code is provided as supplementary material of the lecture Machine Learning and Optimization in Communications (MLOC).<br>
Thi... |
MD2Korg/CerebralCortex | jupyter_demo/cc_algorithms.ipynb | bsd-2-clause | %reload_ext autoreload
from util.dependencies import *
CC = Kernel("/home/jovyan/cc_conf/", study_name="default")
"""
Explanation: Cerebral Cortex Data Analysis Algorithms
Cerebral Cortex contains a library of algorithms that are useful for processing data and converting it into features or biomarkers. This page dem... |
InsightLab/data-science-cookbook | 2020/trabalho-03/Construindo KMeans.ipynb | mit | # import libraries
# linear algebra
import numpy as np
# data processing
import pandas as pd
# data visualization
from matplotlib import pyplot as plt
# load the data with pandas
dataset = pd.read_csv('dataset.csv', header=None)
dataset = np.array(dataset)
plt.scatter(dataset[:,0], dataset[:,1], s=10)
plt.show()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.