repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
khrapovs/metrix | notebooks/mle_logit.ipynb | mit | import numpy as np
import matplotlib.pylab as plt
import seaborn as sns
np.set_printoptions(precision=4, suppress=True)
sns.set_context('notebook')
%matplotlib inline
"""
Explanation: Logit
$$Y_{i}^{*}=X_{i}\theta+e_{i}$$
$$Y_{i}=\begin{cases}
1, & Y_{i}^{}>0,\
0, & Y_{i}^{}\leq0.
\end{cases}$$
End of explanation
""... |
jtwhite79/pyemu | examples/pst_demo.ipynb | bsd-3-clause | from __future__ import print_function
import os
import numpy as np
import pyemu
from pyemu import Pst
"""
Explanation: The Pst class
The pst_handler module contains the Pst class for dealing with pest control files. It relies heavily on pandas to deal with tabular sections, such as parameters, observations, and prior... |
mne-tools/mne-tools.github.io | 0.22/_downloads/82590448493c884f52ea0c7ddc5b446b/plot_publication_figure.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Daniel McCloy <dan.mccloy@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
"""
Explanation: Make figures more publication ready
In this example, we show several use cases to take MNE plots and
customize them fo... |
SteveDiamond/cvxpy | examples/notebooks/dqcp/concave_fractional_function.ipynb | gpl-3.0 | !pip install --upgrade cvxpy
import cvxpy as cp
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Fractional optimization
This notebook shows how to solve a simple concave fractional problem, in which the objective is to maximize the ratio of a nonnegative concave function and a positive
convex func... |
arcyfelix/Courses | 18-11-22-Deep-Learning-with-PyTorch/07-Deploying PyTorch Models/Deploying_PyTorch_models_in_production.ipynb | apache-2.0 | torch.__version__
"""
Explanation: Requirements
End of explanation
"""
# Let's create an example model using ResNet-18
model = torchvision.models.resnet18()
model
# Creating a sample of the input
# It will be used to pass it to the network to build the dimensions
sample = torch.rand(size=(1, 3, 224, 224))
# Creat... |
harsh6292/machine-learning-nd | projects/titanic_survival_exploration/titanic_survival_exploration.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualizations code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Load the dataset
in_file... |
dtamayo/reboundx | ipython_examples/CustomSplittingIntegrationSchemes.ipynb | gpl-3.0 | import rebound
import reboundx
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def makesim():
sim = rebound.Simulation()
sim.G = 4*np.pi**2
sim.add(m=1.)
sim.add(m=1.e-4, a=1.)
sim.add(m=1.e-4, a=1.5)
sim.move_to_com()
return sim
"""
Explanation: Adding Custom Operato... |
astropy/ccdproc | ccdproc/tests/run_profile.ipynb | bsd-3-clause | _, _ = run_memory_profile(num_files, sampling_interval, size=image_size,
memory_limit=memory_limit, combine_method='average')
"""
Explanation: Seem to need to do one run before the profiling
Every time the first run looks different than the rest, so we run one and throw it out.
End of explan... |
cfjhallgren/shogun | doc/ipython-notebooks/gaussian_process/gaussian_processes.ipynb | gpl-3.0 | %matplotlib inline
# import all shogun classes
from shogun import *
import random
import numpy as np
import matplotlib.pyplot as plt
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from math import exp
"""
Explanation: Gaussian Processes in Shogun
By Heiko Strathmann - <a href="mailto:heiko.str... |
voyagenius/ds | EDA.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
import pandas as pd
import numpy as np
import geocoder
import re
import math
"""
Explanation: Data Ingestion & Exploratory Analysis of the UFO Database
Unidentified Flying Objects (UFOs) have been an interesting topi... |
kgrodzicki/machine-learning-specialization | course-3-classification/module-5-decision-tree-assignment-2-blank.ipynb | mit | import graphlab
"""
Explanation: Implementing binary decision trees
The goal of this notebook is to implement your own binary decision tree classifier. You will:
Use SFrames to do some feature engineering.
Transform categorical variables into binary variables.
Write a function to compute the number of misclassified e... |
akshaybabloo/Car-ND | Term_1/TensorFlow_3/TensorFlow_Lab/lab.ipynb | mit | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
louridas/rwa | content/notebooks/chapter_02.ipynb | bsd-2-clause | g = {
0: [1, 2, 3],
1: [0, 4],
2: [0],
3: [0, 5],
4: [1, 5],
5: [3, 4, 6, 7],
6: [5],
7: [5],
}
# print whole graph
print(g)
# print adjacency list of node 0
print(g[0])
# print adjacency list of node 5
print(g[5])
"""
Explanation: Exploring the Labyrinth
Chapter 2 of Real World Algo... |
ES-DOC/esdoc-jupyterhub | notebooks/bnu/cmip6/models/sandbox-1/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'bnu', 'sandbox-1', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: BNU
Source ID: SANDBOX-1
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection, ... |
hsim13372/cs207-FinalProject | examples/basic-tutorial.ipynb | mit | # Import modules
import numpy
import os
from chemkinlib.utils import Parser
from chemkinlib.utils import visualizer
from chemkinlib.reactions import ReactionSystems
from chemkinlib.config import DATA_DIRECTORY
"""
Explanation: ChemKinLib Basic Tutorial
Welcome to ChemKinLib! Here is a quick tutorial on how to use sele... |
mimoralea/applied-reinforcement-learning | notebooks/solutions/03-planning-algorithms.ipynb | mit | import numpy as np
import pandas as pd
import tempfile
import pprint
import json
import sys
import gym
from gym import wrappers
from subprocess import check_output
from IPython.display import HTML
"""
Explanation: Planning Algorithms
Do you remember on lesson 2 and 3 we discussed algorithms that basically solve MDPs?... |
adfriedm/Geometric-K-Server-Experiments | .ipynb_checkpoints/comparison_test_nodataframe-checkpoint.ipynb | mit | splice_avg_times, plg_avg_times, asplice_avg_times, pqt_avg_times = \
compute_avg_times(n_pairs_li, n_reps, gen_pd_edges, p_hat, verbose=True)
"""
Explanation: Run Average Time Experiment
End of explanation
"""
fig, ax = plt.subplots()
ax.set_yscale('log')
ax.plot(n_pairs_li, splice_avg_times, color='b', linestyle='... |
arcyfelix/Courses | 18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/Part 2 - Neural Networks in PyTorch.ipynb | apache-2.0 | # Import necessary packages
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import torch
import helper
import matplotlib.pyplot as plt
"""
Explanation: Neural networks with PyTorch
Deep learning networks tend to be massive with dozens or hundreds of layers, that's where the ter... |
NEONScience/NEON-Data-Skills | tutorials/Python/Lidar/lidar-biomass/calc-biomass_py/calc-biomass_py.ipynb | agpl-3.0 | data_path = '/Users/olearyd/Git/data/'
"""
Explanation: syncID: e6ccf19a4b454ca594388eeaa88ebe12
title: "Calculate Vegetation Biomass from LiDAR Data in Python"
description: "Learn to calculate the biomass of standing vegetation using a canopy height model data product."
dateCreated: 2017-06-21
authors: Tristan Goul... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/art_and_science_of_ml/solutions/training_models_at_scale.ipynb | apache-2.0 | # Use the chown command to change the ownership of repository to user
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Install the Google Cloud BigQuery
!pip install --user google-cloud-bigquery==1.25.0
"""
Explanation: Training Models at Scale with AI Platform
Learning Objectives:
1. Learn how ... |
ijingo/incubator-singa | doc/en/docs/notebook/core.ipynb | apache-2.0 | from singa import device
default_dev = device.get_default_device()
gpu = device.create_cuda_gpu() # the first gpu device
gpu
"""
Explanation: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0.
SINGA Core Classes
<img sr... |
DLTK/DLTK | examples/tutorials/04_input_normalisation_and_augmentation.ipynb | apache-2.0 | import SimpleITK as sitk
import os
import pandas as pd
from matplotlib import pyplot as plt
from dltk.io.augmentation import *
from dltk.io.preprocessing import *
%matplotlib inline
"""
Explanation: Normalisation and Augmentation in Medical Imaging
An essential preprocessing step in medical imaging (especially with... |
OSGeo-live/CesiumWidget | GSOC/notebooks/ipython/examples/IPython Kernel/Beyond Plain Python.ipynb | apache-2.0 | print("Hi")
"""
Explanation: IPython: beyond plain Python
When executing code in IPython, all valid Python syntax works as-is, but IPython provides a number of features designed to make the interactive experience more fluid and efficient.
First things first: running code, getting help
In the notebook, to run a cell of... |
Oslandia/open-data-bikes-analysis | notebooks/shared_bike_timeseries.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
%matplotlib inline
"""
Explanation: Analyse données Vélos partagées
End of explanation
"""
lyon = pd.read_csv("./data/lyon.csv", parse_dates = ['last_update'])
lyon = lyon.query("last_update >= '2017-08-21' and last_update ... |
datacommonsorg/api-python | notebooks/analyzing_obesity_prevalence.ipynb | apache-2.0 | from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from google.colab import drive
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import json
"""
Explanation: <a href="https://colab.research.google.com/github/datacommonsorg/api-python/blob/ma... |
ramseylab/networkscompbio | class12_pagerank_python3_template.ipynb | apache-2.0 | import pandas
import igraph
import numpy
import matplotlib.pyplot
import random
"""
Explanation: CS446/546 - Class Session 12 - Pagerank/Katz/Eigenvector centrality
In this class session we are going to compute the outgoing-edge PageRank centrality of each gene (vertex) in a human gene regulatory network (a directed g... |
jchuahtacc/WikiNetworking | lessons/Part 1 - Crawling Wikipedia.ipynb | mit | import wikinetworking as wn
import networkx as nx
from pyquery import PyQuery
%matplotlib inline
print "OK"
"""
Explanation: Part 1 - Crawling Wikipedia
Introduction
We're going to create a social network of characters in the Marvel Cinematic Universe. You are looking at a Jupyter notebook. Each section is a cell tha... |
sairamprasad999/udacity-deep-learning | resources/cs228-python-tutorial.ipynb | mit | def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) / 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
print quicksort([3,6,8,10,1,2,1])
"""
Explana... |
MLWave/kepler-mapper | docs/notebooks/Cancer-demo.ipynb | mit | import sys
try:
import pandas as pd
except ImportError as e:
print("pandas is required for this example. Please install with conda or pip and then try again.")
sys.exit()
import numpy as np
import sklearn
from sklearn import ensemble
import kmapper as km
from kmapper.plotlyviz import *
from sklearn.decomp... |
antoniomezzacapo/qiskit-tutorial | community/terra/qis_intro/amplitude_and_phase.ipynb | apache-2.0 | # useful additional packages
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
# importing Qiskit
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer, IBMQ
# import basic plot tools
from qiskit.tools.visualization import matplotlib_circuit_drawer as circuit_drawer
... |
aebrahim/cobrapy | documentation_builder/deletions.ipynb | lgpl-2.1 | import pandas
from time import time
import cobra.test
from cobra.flux_analysis import \
single_gene_deletion, single_reaction_deletion, \
double_gene_deletion, double_reaction_deletion
cobra_model = cobra.test.create_test_model("textbook")
ecoli_model = cobra.test.create_test_model("ecoli")
"""
Explanation: ... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
liganega/Gongsu-DataSci | ref_materials/excs/Lab-07.ipynb | gpl-3.0 | import urllib
def NOAA_string():
url = "http://weather.noaa.gov/pub/data" +\
"/observations/metar/decoded/RKSG.TXT"
noaa_data_string = urllib.urlopen(url).read()
return noaa_data_string
print(NOAA_string())
def NOAA_temperature(s):
L = s.split('\n')
Line7 = L[6].split()
print(str(int(... |
jhamilius/chain | notebooks/.ipynb_checkpoints/chain-graph-subset-checkpoint.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import networkx as nx
import pygraphviz as pgv
import pydot as pyd
from networkx.drawing.nx_agraph import graphviz_layout
from networkx.drawing.nx_agraph import write_dot
"""
Explanation: Graph Construction and feature engineerin... |
phoebe-project/phoebe2-docs | development/tutorials/solver.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u # units
import numpy as np
logger = phoebe.logger()
"""
Explanation: Solvers: The Inverse Problem
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as... |
justanr/notebooks | quotes_as_a_service.ipynb | mit | from app import app
if __name__ == '__main__':
app.run(debug=True, reload=True)
"""
Explanation: My love of Flask is well known. It's a great microframework that puts you in control of the pieces needed in your webapp. It comes with templating, requests, responses, cookies, sessions, routing and... really, that's... |
mne-tools/mne-tools.github.io | 0.18/_downloads/9efe11126cdcc2ec888d5af516acf1cf/plot_object_evoked.ipynb | bsd-3-clause | # sphinx_gallery_thumbnail_number = 2
import os.path as op
import matplotlib.pyplot as plt
import mne
"""
Explanation: The :class:Evoked <mne.Evoked> data structure: evoked/averaged data
The :class:Evoked <mne.Evoked> data structure is mainly used for storing
averaged data over trials. In MNE the evoked ... |
nick-youngblut/SIPSim | ipynb/bac_genome/SSU_genes_per_ng_DNA.ipynb | mit | import os
workDir = '/home/nick/notebook/SIPSim/dev/bac_genome1210/SSU_genes_per_ng_DNA/'
rnammerDir = os.path.join(workDir + 'rnammer')
genomeDir = '/home/nick/notebook/SIPSim/dev/bac_genome1210/genomes/'
"""
Explanation: Estimating the number of 16S rRNA genes per ng of DNA
Used to estimate the number of 16S genes... |
phoebe-project/phoebe2-docs | development/examples/pblum_method_compare.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
import numpy as np
import matplotlib.pyplot as plt
b = phoebe.default_binary()
b.add_dataset('lc')
b.add_compute('ellc')
"""
Explanation: Comparing pblum methods
Here we'll look into the influence of pblum_method on the resulting luminosities as a function of the s... |
statsmaths/stat665 | lectures/lec22/.ipynb_checkpoints/notebook19-checkpoint.ipynb | gpl-2.0 | %pylab inline
import copy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.datasets import mnist, cifar10
from keras.models import Sequential, Graph
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.optimizers import SGD, RMSprop
from keras.utils i... |
mlandry1/CarND | Labs/Term3/Lesson 10 - 11/CarND-Object-Detection-Lab.ipynb | mit | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageDraw
from PIL import ImageColor
import time
from scipy.stats import norm
%matplotlib inline
plt.style.use('ggplot')
"""
Explanation: CarND Object Detection Lab
Let's get started!
End of explanation
""... |
kgrodzicki/machine-learning-specialization | course-3-classification/module-9-precision-recall-assignment-blank.ipynb | mit | import graphlab
from __future__ import division
import numpy as np
graphlab.canvas.set_target('ipynb')
"""
Explanation: Exploring precision and recall
The goal of this second notebook is to understand precision-recall in the context of classifiers.
Use Amazon review data in its entirety.
Train a logistic regression m... |
dsacademybr/PythonFundamentos | Cap07/DesafioDSA/Missao4/missao4.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 7</font>
Download: http://github.com/dsacademybr
End of explanation
"""
class S... |
AEW2015/PYNQ_PR_Overlay | Pynq-Z1/notebooks/Video_PR/Text_Overlay_Filter.ipynb | bsd-3-clause | from pynq.drivers.video import HDMI
from pynq import Bitstream_Part
from pynq.board import Register
from pynq import Overlay
Overlay("demo.bit").download()
"""
Explanation: Don't forget to delete the hdmi_out and hdmi_in when finished
Text Overlay Filter Example
In this notebook, we will demonstrate how to use the ov... |
albertfxwang/grizli | examples/NewSpectrumFits.ipynb | mit | %matplotlib inline
import glob
import time
import os
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pyfits
import drizzlepac
import grizli
print(grizli.__version__)
"""
Explanation: The fitting tools have been updated in fitting.py to unify the way that the MultiBeam or drizzled stack... |
TeamLab/Gachon_CS50_OR_KMOOC | assignment/ps2/gaussian_elimination.ipynb | mit | import gachon_autograder_client as g_autograder
THE_TEMLABIO_ID = "#YOUR_ID"
PASSWORD = "#YOUR_PASSWORD"
ASSIGNMENT_NAME = "gaussian_elimination"
g_autograder.get_assignment(THE_TEMLABIO_ID , PASSWORD, ASSIGNMENT_NAME)
"""
Explanation: Lab #2 - Gaussian Elimination with python
Copyright 2017 © document created by ... |
chicagopython/CodingWorkshops | problems/data_science/Analysis-Workshop.ipynb | gpl-3.0 | import meetup.api
import pandas as pd
from IPython.display import Image, display, HTML
from itertools import combinations
"""
Explanation: Data Analysis using Pandas
Pandas has become the defacto package for data analysis. In this workshop, we are going to use the basics of pandas to analyze the interests of today's g... |
ericmjl/scikit-learn-tutorial | 03 Classification.ipynb | mit | # Load the sequences into memory
sequences = [s for s in SeqIO.parse('data/20160127_HA_prediction.fasta', 'fasta') if len(s.seq) == 566] # we are cheating and not bothering with an alignment.
len(sequences)
# Load the sequence IDs into memory
seqids = [s.id for s in SeqIO.parse('data/20160127_HA_prediction.fasta', 'f... |
AssembleSoftware/IoTPy | examples/ExamplesOfMulticorePartOne.ipynb | bsd-3-clause | def f(in_streams, out_streams):
map_element(lambda v: v+100, in_streams[0], out_streams[0])
def g(in_streams, out_streams):
s = Stream('s')
map_element(lambda v: v*2, in_streams[0], s)
print_stream(s, 's')
def h(in_streams, out_streams):
map_element(lambda v: v*2, in_streams[0], out_streams[0])
d... |
mayank-johri/LearnSeleniumUsingPython | Section 2 - Advance Python/Chapter S2.01 - Functional Programming/01.02_Comprehensions.ipynb | gpl-3.0 | # Original
doubled_numbers = []
for n in range(1,6):
doubled_numbers.append(n*2)
print(doubled_numbers)
#list compreshensions
doubled_numbers = [n * 2 for n in range(1,12,2)] # 1 ,3, 5, 7, 9, 11
print(doubled_numbers)
"""
Explanation: 01.02 Comprehensions
Using comprehensions is often a way both to make code mor... |
bosscha/alma-calibrator | notebooks/2mass/13_environment-with_gaia.ipynb | gpl-2.0 | from astroquery.gaia import Gaia
tables = Gaia.load_tables(only_names=True)
for table in (tables):
print (table.get_qualified_name())
#obj = ["3C 454.3", 343.49062, 16.14821, 1.0]
obj = ["PKS J0006-0623", 1.55789, -6.39315, 1]
#obj = ["M87", 187.705930, 12.391123, 1.0]
#### name, ra, dec, radius of cone (in deg)
... |
alansaul/ods | notebooks/pods/datasets/spellman_yeast.ipynb | bsd-3-clause | import pods
import pylab as plt
%matplotlib inline
data = pods.datasets.spellman_yeast()
"""
Explanation: Datasets: The Spellman Yeast Data
Open Data Science Initiative
29th May 2014 Neil D. Lawrence
This data set collection is from an classic early microarray paper on the yeast cell cycle, Spellman et al (1998).
End... |
qutip/qutip-notebooks | examples/quantum-gates.ipynb | lgpl-3.0 | %matplotlib inline
from IPython.display import Image
from numpy import pi
import numpy as np
from qutip import *
from qutip_qip.operations import *
from qutip_qip.circuit import QubitCircuit, Gate
"""
Explanation: QuTiP example: Quantum Gates and their usage
Author: Anubhav Vardhan (anubhavvardhan@gmail.com)
User-d... |
CAChemE/learn | Desactivacion-RFP/RFP-desactivacion.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from IPython.html.widgets import interact
from scipy.integrate import odeint
from mpl_toolkits.mplot3d import Axes3D
plt.style.use('bmh')
"""
Explanation: Reactor flujo pistón con desactivación catalítica.
Autor: Carlos Planelles (CAChemE.org) - L... |
trangel/Data-Science | reinforcement_learning/practice_a3c.ipynb | gpl-3.0 | from __future__ import print_function, division
from IPython.core import display
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
#If you are running on a server, launch xvfb to record game videos
#Please make sure you have xvfb installed
import os
if type(os.environ.get("DISPLAY")) is not str or ... |
sdpython/ensae_teaching_cs | _doc/notebooks/1a/histogramme_rapide.ipynb | mit | import random
num = [random.randint(0,10) for i in range(1000)]
hist = {}
for i in num:
hist[i] = hist.get(i, 0) + 1
hist
"""
Explanation: 1A.1 - Histogramme et dictionnaire
Compter les occurences de nombres dans une liste est assez facile avec un dictionnaire et on peut l'écrire de plusieurs manières différente... |
chris1610/pbpython | notebooks/Amortization-Model-Article.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
from datetime import date
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
"""
Explanation: Amortization Example in Pandas
Code to support article at Practical Business Python
Setup the imports and matplotlib plotting
End of ex... |
fionapigott/Data-Science-45min-Intros | decision-trees-101/decision_trees_101.ipynb | unlicense | %pylab inline
"""
Explanation: Introduction
Idea behind decision tree: split the space of the attribute variables with recursive, binary splits, with the aim of high purity for all regions.
The collection of paths to all regions makes a tree.
Vocabulary
attribute, or attribute variable: a dimension in which a data ... |
jeroarenas/MLBigData | 2_Classification/Classification I-student.ipynb | mit | %matplotlib inline
###########################################################
# TODO: Replace <FILL IN> with appropriate code
###########################################################
from sklearn import datasets
from sklearn.cross_validation import train_test_split
import numpy as np
from sklearn.preprocessing im... |
buguen/pyosv | doc/notebook/pythreejs.ipynb | mit | ball = Mesh(geometry=SphereGeometry(radius=1), material=LambertMaterial(color='red'), position=[2,1,0])
scene = Scene(children=[ball, AmbientLight(color=0x777777), make_text('Hello World!', height=.6)])
c = PerspectiveCamera(position=[0,5,5], up=[0,0,1], children=[DirectionalLight(color='white',
... |
thehackerwithin/berkeley | code_examples/survey_f17/survey.ipynb | bsd-3-clause | import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: The Hacker Within Fall 2017 survey
by R. Stuart Geiger, freely dual licensed CC-BY 4.0, MIT license
Importing and processing data
Importing libraries
End of explanation
"""
df = pd.read_csv("thwfall2017-survey.csv")
df = df[1:]
... |
facundoq/facundoq.github.io | courses/images/res/material_resuelto/02_numpy/Tutorial de Numpy.ipynb | gpl-2.0 | # importamos la librería numpy, y le damos como nombre np dentro del programa
import numpy as np
"""
Explanation: Numpy
Objetivo: Aprender a crear y manipular matrices utilizando la librería Numpy de Python.
Conocimientos previos: Programación básica en Python, concepto de vector y matriz.
Numpy es una librería para r... |
phoebe-project/phoebe2-docs | development/tutorials/settings.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Advanced: Settings
The Bundle also contains a few Parameters that provide settings for that Bundle. Note that these are not system-wide and only apply to the current Bundle. They are however maintained when saving and loading a Bundle.
Setup
Let's first make sure ... |
wikistat/Exploration | HumanActivityRecognition/Explo-Python-HAR-metier.ipynb | gpl-3.0 | # Importation des principals librairies et
# Affichage des graphiques dans le notebook
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
"""
Explanation: <center>
<a href="http://www.insa-toulouse.fr/" ><img src="http://www.math.univ-toulouse.fr/~besse/Wikistat/Ima... |
tcstewar/testing_notebooks | spa_power/Spa Hex representation.ipynb | gpl-2.0 | def power(s, e):
x = np.fft.ifft(np.fft.fft(s.v) ** e).real
return spa.SemanticPointer(data=x)
"""
Explanation: First, here's the SPA power function:
End of explanation
"""
def spatial_dot(v, X, Y, Z, xs, ys, transform=1):
vs = np.zeros((len(ys),len(xs)))
for i,x in enumerate(xs):
for j, y i... |
mathcoding/Programmazione2 | Introduzione a Python - Parte seconda.ipynb | mit | from random import randint
help(randint)
As = [randint(1,10) for _ in range(10)]
print(As)
"""
Explanation: NOTA: si consiglia di eseguire una riga alla volta di questo notebook, come fatto a lezione, cercando di capire sia cosa fa ciascuna funzione, sia soprattutto cercando di capire gli eventuali messaggi di error... |
abhi1509/deep-learning | intro-to-tensorflow/intro_to_tensorflow.ipynb | mit | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
1412kid/computationalphysics_n2014301020035 | Chapter3/chapter3.2/README.ipynb | mit |
def forcedDampedNonlinearPendulum(omgd, fd = 1.2, q = 0.5 , gOverL = 1.):
def foo(t,X):
[omega, theta] = X
return array([- gOverL*math.sin(theta) - q*omega + fd*math.sin(omgd*t), omega])
return foo
"""
Explanation: 周期驱动有阻尼非线性单摆的混沌特性
以前的作业中,我们已经定义了在给定时间区间内求解一般微分方程的函数dSolve,
dSolve in Chap1 ... |
eggie5/ipython-notebooks | pca/Dimensionality Reduction using PCA.ipynb | mit | import loader as support #support library to read mnist files into memory
import gaussian_classifier as gf
import time
%pylab inline
X_train, Y_train = support.loadmnist('data/train-images-idx3-ubyte',
'data/train-labels-idx1-ubyte')
X_test, Y_test = support.loadmnist('data/t10k-images-idx3-ubyte',
'data/t10k-labels... |
jdamiani27/DataSciUF-Tutorial-Student | DataSciUF - Python I.ipynb | mit | # This is a comment
"""
Explanation: Python Basics
Syntax
Python is an object oriented scripting language and does not require a specific first or last line (such as <code>public static void main</code> in Java or <code>return</code> in C).
There are no curly braces {} to define code blocks or semi-colons ; to end a ... |
spulido99/NetworksAnalysis | DiderGonzalez/Taller 1/Taller 1. Teoría de Grafos.ipynb | mit | # Se agrega la distancia en Kilometros, tomada de https://www.timeanddate.com/worldclock/distance.html
routemap = [('St. Louis', 'Miami',1707),
('St. Louis', 'San Diego',2518),
('St. Louis', 'Chicago',422),
('San Diego', 'Chicago',2792),
('San Diego', 'San Franci... |
hethapu/big-data-python-class | Lectures/Lecture6-Streams/SGD TESTING.ipynb | mit | from sklearn.linear_model import SGDClassifier
X = [[0., 0.], [1., 1.]] #N_samples, N_features - training samples
y = [0, 1] # n_samples - target values for training the samples
clf = SGDClassifier(loss="hinge", penalty="l2")
clf.fit(X, y)
clf.predict([[2.,2.]]) # predict new value
clf.coef_ # fits a linear mod... |
datactive/bigbang | examples/activity/Auditing Fernando.ipynb | mit | from bigbang.archive import Archive
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""
Explanation: This note will show you how to use BigBang to investigate a particular project participant's activity.
We will focus on Fernando Perez's role within the IPython community.
First, imports.
End of ... |
griffinfoster/fundamentals_of_interferometry | 2_Mathematical_Groundwork/2_13_spherical_trigonometry.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
2. Mathematical Groundwork
Previous: 2.12 Solid Angle
Next: 2.14 CLEAN in 1D
Import standard modules:
End of explanation
"""
p... |
astarostin/MachineLearningSpecializationCoursera | course4/week3 - Линейная регрессия - demo.ipynb | apache-2.0 | import statsmodels
import scipy as sc
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
from statsmodels.graphics.regressionplots import plot_leverage_resid2
import matplotlib.pyplot as plt
%pylab inline
"""
Explanation: Линейная регрессия
End of explanat... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.17 extract subset of dict.ipynb | gpl-3.0 | prices = {
'ACME': 45.23,
'AAPL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
# Make a dictionary of all prices over 200
p1 = {key: value for key, value in prices.items() if value > 200}
p1
# Make a dictionary of tech stocks
tech_names = {'AAPL', 'IBM', 'HPQ', 'MSFT'}
p2 = {key: value for k... |
a-mt/dev-roadmap | docs/!ml/notebooks/Word Embeddings.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
scores_xavier = np.array([88,92])
scores_niko = np.array([94,87])
scores_alena = np.array([90,48])
plt.arrow(0, 0, scores_xavier[0], scores_xavier[1], width=1, color='blue', label='xavier')
plt.arrow(0, 0, scores_niko[0], scores_niko[1], width=1, color='orange',... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160705화수_25,26일차_뉴럴 네트워크 Neural Network/6.CNN.ipynb | mit | import scipy.ndimage
img = 255 - sp.misc.face(gray=True).astype(float)
k = np.zeros((2,2))
k[:,0] = 1; k[:,1] = -1
img2 = np.maximum(0, sp.ndimage.filters.convolve(img, k))
plt.figure(figsize=(10,5))
plt.subplot(121)
plt.imshow(img)
plt.grid(False)
plt.subplot(122)
plt.imshow(img2)
plt.grid(False)
"""
Explanation: Con... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_model_performance/a_feature_engineering_dnn.ipynb | apache-2.0 | import tensorflow as tf
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: Introduction to Feature Engineering
Learning Objectives
* Improve the accuracy of a model by using feature engineering
* Understand there's two places to do feature engineering in Tensorflow
1. Using the tf.feature_... |
marcus-nystrom/python_course | Week7_lecture.ipynb | gpl-3.0 | # Go through all files in a folder and combine them
import glob, os
files = glob.glob('img' + os.sep + 'vs_results' + os.sep + '*.csv')
f_out = open('out.csv', 'wb')
for i, f in enumerate(files):
# Get the participant number from the file name
p_id = f[-6:-4]
# open the file and read it's conte... |
jorgemauricio/INIFAP_Course | ejercicios/Seaborn/1_Graficas_Distribucion.ipynb | mit | import seaborn as sns
%matplotlib inline
"""
Explanation: Distribution Plots
Let's discuss some plots that allow us to visualize the distribution of a data set. These plots are:
distplot
jointplot
pairplot
rugplot
kdeplot
Imports
End of explanation
"""
tips = sns.load_dataset('tips')
tips.head()
"""
Explanation... |
msampathkumar/datadriven_pumpit | pumpit/pumpit.ipynb | apache-2.0 | import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scripts.tools import game
%matplotlib inline
# %load_ext writeandexecute
plt.style.use('ggplot')
sns.set(color_codes=True)
# seed
np.random.seed(69572)
# import sys
# sys.path = sys.path + ['/Users/samp... |
martinjrobins/hobo | examples/plotting/mcmc-predicted-time-series.ipynb | bsd-3-clause | import pints
import pints.toy as toy
import numpy as np
import matplotlib.pyplot as plt
# Load a forward model
model = toy.LogisticModel()
# Create some toy data
real_parameters = [0.015, 500]
times = np.linspace(0, 1000, 100)
org_values = model.simulate(real_parameters, times)
# Add noise
noise = 50
values = org_va... |
tensorflow/docs-l10n | site/ko/tutorials/structured_data/time_series.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... |
xianjunzhengbackup/code | tensorflow/adding_operation_and_tensorboar_with_graph.ipynb | mit | writer.close()
sess.close()
a=tf.constant([5,3],name='input_a')
b=tf.reduce_prod(a,name='prod_b')
c=tf.reduce_sum(a,name='sum_c')
d=tf.add(b,c,name='add_d')
sess=tf.Session()
sess.run(d)
"""
Explanation: The above command will output graph to my_graph directory
Then run the command '$ tensorboard --logdir="my_g... |
jakobrunge/tigramite | tutorials/tigramite_tutorial_sliding_window_analysis.ipynb | gpl-3.0 | # Imports
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
%matplotlib inline
## use `%matplotlib notebook` for interactive figures
# plt.style.use('ggplot')
import tigramite
from tigramite import data_processing as pp
from tigramite.toymodels import structural_causal_processes as toys
fr... |
chayapan/pyfolio | pyfolio/examples/bayesian.ipynb | apache-2.0 | %matplotlib inline
import pyfolio as pf
"""
Explanation: Bayesian performance analysis example in pyfolio
There are a few advanced analysis methods in pyfolio based on Bayesian statistics.
The main benefit of these methods is uncertainty quantification. All the traditional measures of performance, like the Sharpe rat... |
weleen/mxnet | example/notebooks/moved-from-mxnet/predict-with-pretrained-model.ipynb | apache-2.0 | %matplotlib inline
import mxnet as mx
import logging
import numpy as np
from skimage import io, transform
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# Load the pre-trained model
prefix = "Inception/Inception-BN"
num_round = 126
model = mx.model.FeedForward.load(prefix, num_round, ctx=mx.gpu(), numpy_... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/kubeflow_pipelines/cicd/labs/kfp_cicd.ipynb | apache-2.0 | ENDPOINT = "<YOUR_ENDPOINT>"
PROJECT_ID = !(gcloud config get-value core/project)
PROJECT_ID = PROJECT_ID[0]
"""
Explanation: CI/CD for a KFP pipeline
Learning Objectives:
1. Learn how to create a custom Cloud Build builder to pilote CAIP Pipelines
1. Learn how to write a Cloud Build config file to build and push all ... |
borja876/Thinkful-DataScience-Borja | Challenge Neural Networks.ipynb | mit | # Create a list of all of our book files.
book_filenames_austen = sorted(glob.glob("/home/borjaregueral/train/austen/*.txt"))
book_filenames_chesterton = sorted(glob.glob("/home/borjaregueral/train/chesterton/*.txt"))
book_filenames_conandoyle = sorted(glob.glob("/home/borjaregueral/train/conandoyle/*.txt"))
book_filen... |
dinrker/PredictiveModeling | Session 0 - Python_Basics.ipynb | mit | # you don't have to rename numpy to np but it's customary to do so
import numpy as np
# you can create a 1-d array with a list of numbers
a = np.array([1, 4, 6])
print 'a:'
print a
print 'a.shape:', a.shape
print
# you can create a 2-d array with a list of lists of numbers
b = np.array([[6, 7], [3, 1], [4, 0]])
prin... |
great-expectations/great_expectations | tests/test_fixtures/upgrade_helper/great_expectations_v20_project_with_v30_configuration_and_v20_checkpoints/notebooks/spark/validation_playground.ipynb | apache-2.0 | import json
import great_expectations as ge
import great_expectations.jupyter_ux
from great_expectations.datasource.types import BatchKwargs
import datetime
"""
Explanation: Validation Playground
Watch a short tutorial video or read the written tutorial
This notebook assumes that you created at least one expectation s... |
mrustl/flopy | examples/groundwater_paper/Notebooks/example_1.ipynb | bsd-3-clause | import numpy as np
import flopy.modflow as fpm
import flopy.utils as fpu
"""
Explanation: Example for FloPy$_3$ methods note
Import the {\tt modflow} and {\tt utilities} subpackages of FloPy and give them the aliases {\tt fpm} and {\tt fpu}, respectively
End of explanation
"""
exe = "mf2005"
model = fpm.Modflow(mode... |
vishal3011/Machine-Learning-Nanodegree | Finding_Donors_For_Charity/finding_donors.ipynb | mit | # Import libraries necessary for this project
import numpy as np
import pandas as pd
from time import time
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualization code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Loa... |
gfeiden/Notebook | Projects/ngc2516_spots/sta_spots_lithium.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
cd /Users/grefe950/Projects/starspot/models/age_120.0+z_0.00/sts/
"""
Explanation: Spots and A(Li)
Exploring the impact of short-timescale spots on observed lithium abundances.
Start with some preliminaries.
End of explanation
"""
# routine to lo... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/ets.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
from statsmodels.tsa.exponential_smoothing.ets import ETSModel
plt.rcParams["figure.figsize"] = (12, 8)
"""
Explanation: ETS models
The ETS models are a family of time series models with an underlying state space model consisti... |
Donnyvdm/courses | Machine Learning/1. Foundations A Case Study Approach/Week 2/Predicting House Prices.ipynb | unlicense | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cross_validation import train_test_split
from sklearn import linear_model
from math import sqrt
plt.style.use('ggplot')
%matplotlib inline
sales = pd.read_csv("../data/home_data.csv")
sales.head(10)
sales.dtypes
"""
Explanation: Mac... |
kemerelab/NeuroHMM | SubstateDecoding.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import sys
sys.path.insert(0, 'helpers')
from efunctions import * # load my helper function(s) to save pdf figures, etc.
from hc3 import load_data, get_sessions
from hmmlearn import hmm # see https://github.com/ckemere/hmmlea... |
ioos/notebooks_demos | notebooks/2017-11-30-rerddap.ipynb | mit | %load_ext rpy2.ipython
"""
Explanation: Calling R libraries from Python
In this example we will explore the Coral Reef Evaluation and Monitoring Project (CREMP) data available in the Gulf of Mexico Coastal Ocean Observing System (GCOOS) ERDDAP server.
To access the server we will use the rerddap library and export the... |
wzxiong/DAVIS-Machine-Learning | homeworks/HW5.ipynb | mit | import pandas as pd
import numpy as np
bank = pd.read_csv('bank/bank-full.csv',sep=";")
bank.head()
X = bank.iloc[:,:-1]
y = bank['y']
y = (y == 'yes')*1
X = np.array(X)
from sklearn.preprocessing import OneHotEncoder
"""
Explanation: STA 208: Homework 5
Instructions
We use a script that extracts your answers by ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.