repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
AllenDowney/ModSimPy | soln/insulin_soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import functions from the modsim.py module
from modsim import *
"""
Explanation: Modeling and Simulati... |
tpin3694/tpin3694.github.io | machine-learning/handling_imbalanced_classes_with_downsampling.ipynb | mit | # Load libraries
import numpy as np
from sklearn.datasets import load_iris
"""
Explanation: Title: Handling Imbalanced Classes With Downsampling
Slug: handling_imbalanced_classes_with_downsampling
Summary: How to handle imbalanced classes with downsampling during machine learning in Python.
Date: 2016-09-06 12:00
Cat... |
davidthomas5412/PanglossNotebooks | MassLuminosityProject/GenerateMockDataAndImportanceSample_2017_01_22.ipynb | mit | import pandas as pd
from massinference.angle import Angle
# opening, white-listing, renaming
usecols = ['GalID', 'pos_0[rad]', 'pos_1[rad]', 'M_Subhalo[M_sol/h]', 'z_spec']
guo = pd.read_table(
'/Users/user/Code/Pangloss/data/GGL_los_8_0_0_0_0_N_4096_ang_4_Guo_galaxies_on_plane_27_to_63.images.txt',
usecols=u... |
SJSlavin/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
quantumlib/Cirq | docs/tutorials/educators/textbook_algorithms.ipynb | apache-2.0 | try:
import cirq
except ImportError:
print("installing cirq...")
!pip install cirq --quiet
import cirq
print("installed cirq.")
import random
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Textbook algorithms in Cirq
<table class="tfo-notebook-buttons" align="left">
<td>
... |
intel-analytics/BigDL | python/dllib/colab-notebook/dllib_keras_api.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed un... |
CodeNeuro/notebooks | worker/notebooks/neurofinder/tutorials/training-example-block.ipynb | mit | import numpy as np
from scipy.stats import norm
from thunder import SourceExtraction
from thunder.extraction import OverlapBlockMerger
"""
Explanation: Running and evaluating a block algorithm
In this notebook we run a block-wise algorithm on a training data set and evaluate performance.
Setup environment
End of expla... |
balmandhunter/jupyter-tips-and-tricks | notebooks/06-Extras.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format='retina'
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('talk')
sns.set_style('darkgrid')
plt.rcParams['figure.figsize'] = 12, 8 # plotsize
import numpy as np
import pandas as pd
# plot residuals
from itertools import groupby # NOT REG... |
wesleybeckner/salty | examples/salty_web_scraping.ipynb | mit | import statistics
import requests
import json
import pickle
import salty
import numpy as np
import matplotlib.pyplot as plt
import numpy.linalg as LINA
from scipy import stats
from scipy.stats import uniform as sp_rand
from scipy.stats import mode
from sklearn.linear_model import Lasso
from sklearn.model_selection impo... |
DavidPowell/openmodes-examples | Visualising Modes.ipynb | gpl-3.0 | # the numpy library contains useful mathematical functions
import numpy as np
# import useful python libraries
import os.path as osp
# import the openmodes packages
import openmodes
# setup 2D plotting
%matplotlib inline
from openmodes.ipython import matplotlib_defaults
matplotlib_defaults()
import matplotlib.pyplo... |
tritemio/multispot_paper | out_notebooks/usALEX-5samples-PR-raw-out-all-ph-7d.ipynb | mit | ph_sel_name = "all-ph"
data_id = "7d"
# ph_sel_name = "all-ph"
# data_id = "7d"
"""
Explanation: Executed: Mon Mar 27 11:34:11 2017
Duration: 8 seconds.
usALEX-5samples - Template
This notebook is executed through 8-spots paper analysis.
For a direct execution, uncomment the cell below.
End of explanation
"""
fro... |
phoebe-project/phoebe2-docs | 2.1/examples/minimal_synthetic.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
%matplotlib inline
"""
Explanation: Minimal Example to Produce a Synthetic Light Curve
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 rel... |
astroumd/GradMap | notebooks/Lectures2021/Lecture3/Lecture3_Instructor.ipynb | gpl-3.0 | import numpy as np
"""
Explanation: Review from the previous lecture
In yesterday's Lecture 2, you learned how to use the numpy module, how to make your own functions, and how to import and export data. Below is a quick review before we move on to Lecture 3.
Remember, to use the numpy module, first it must be imported... |
geopandas/geopandas | doc/source/gallery/plotting_with_folium.ipynb | bsd-3-clause | # Import Libraries
import pandas as pd
import geopandas
import folium
import matplotlib.pyplot as plt
df1 = pd.read_csv('volcano_data_2010.csv')
# Keep only relevant columns
df = df1.loc[:, ("Year", "Name", "Country", "Latitude", "Longitude", "Type")]
df.info()
# Create point geometries
geometry = geopandas.points_f... |
drcgw/bass | .ipynb_checkpoints/Kitchen Sink-Bass-checkpoint.ipynb | gpl-3.0 | from bass import *
"""
Explanation: Welcome to the Development Version of BASS
This notebook is inteded for very advanced users, as there is almost no interactivity features. However, this notebook is all about speed. If you know exactly what you are doing, then this is the notebook for you.
BASS: Biomedical Analysis ... |
festivalhopper/music-transcription | notebooks/onset_detection_random_forest.ipynb | gpl-3.0 | X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# bound = int(len(X)*0.8)
# X_train = X[:bound, :]
# X_test = X[bound:, :]
# y_train = y[:bound]
# y_test = y[bound:]
print(X_train.shape)
print(y_train.shape)
print(X_test.shape)
print(y_test.shape)
ss = StandardScaler()
X_tra... |
trangel/Data-Science | .ipynb_checkpoints/UCL-adult-vectorizer-checkpoint.ipynb | gpl-3.0 | #This routine to plot learning curve is from sklearn documentation.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from sklearn.datasets import load_digits
from sklearn.model_selection import learning_curve
from sklearn.model_selection import Sh... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_read_bem_surfaces.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
fname = data_path + '/subjects/sample/bem/sample-5120-5120-5120-bem-sol.fif'
surfaces = mne.read_bem_surfaces(fname, patch_stats... |
computational-class/cjc2016 | code/04.PythonCrawlerGovernmentReport.ipynb | mit | import requests
from bs4 import BeautifulSoup
from IPython.display import display_html, HTML
HTML('<iframe src=http://www.hprc.org.cn/wxzl/wxysl/lczf/ width=1000 height=500></iframe>')
# the webpage we would like to crawl
"""
Explanation: 数据抓取
抓取历届政府工作报告
王成军
wangchengjun@nju.edu.cn
计算传播网 http://computational-com... |
syednasar/talks | language-translation/.ipynb_checkpoints/dlnd_language_translation-checkpoint.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
GoogleCloudPlatform/training-data-analyst | CPB100/lab4a/demandforecast2.ipynb | apache-2.0 | !sudo pip install --user pandas-gbq
!pip install --user pandas_gbq
!pip install tensorflow==1.15.3
"""
Explanation: <h1>Demand forecasting with BigQuery and TensorFlow</h1>
In this notebook, we will develop a machine learning model to predict the demand for taxi cabs in New York.
To develop the model, we will need to... |
mbaumer/OM10 | notebooks/issue22_LRG_position_matching.ipynb | mit | %matplotlib inline
import om10,os
import numpy as np
import matplotlib.pyplot as plt
import triangle
"""
Explanation: LRG Position Matching
We need a sample of LRGs that span the range of redshifts and i-band magnitudes found in the OM10 catalog. The sample can be kept small by selecting in color as well as magnitude ... |
timgasser/bcycle-austin | notebooks/bcycle_all_data_clean.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
plt.rc('xtick', labelsize=14)
plt.rc('ytick', labelsize=14)
# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%au... |
bpgc-cte/python2017 | Week 2/Lecture_2_Lists_and_Slicing.ipynb | mit | squares=[0,1,4,9,16,25] #list_name = [value1,value2,value3,...]
print(squares)
print("Length is:",len(squares))
print(squares[3])
squares.append(36)
print(squares)
squares.append("forty-nine")
print(squares)
squares.extend([64,81])
print(squares)
squares[7]=49
print(squares)
print(squares[0:3])
4 in squares
""... |
david4096/bioapi-examples | python_notebooks/1kg_variant_service.ipynb | apache-2.0 | from ga4gh.client import client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
#Obtain dataSet id REF: -> `1kg_metadata_service`
dataset = c.search_datasets().next()
"""
Explanation: GA4GH 1000 Genomes Variant Service Example
This example illustrates how to access the GA4GH variant service.
The GA4GH variant se... |
dlsun/symbulate | labs/Lab 4 - Poisson Processes.ipynb | mit | from symbulate import *
%matplotlib inline
"""
Explanation: Symbulate Lab 4 - Poisson Processes
This Jupyter notebook provides a template for you to fill in. Read the notebook from start to finish, completing the parts as indicated. To run a cell, make sure the cell is highlighted by clicking on it, then press SHIFT... |
tallakahath/pymatgen | examples/Ordering Disordered Structures.ipynb | mit | # Let us start by creating a disordered CuAu fcc structure.
from pymatgen import Structure, Lattice
specie = {"Cu0+": 0.5, "Au0+": 0.5}
cuau = Structure.from_spacegroup("Fm-3m", Lattice.cubic(3.677), [specie], [[0, 0, 0]])
print cuau
"""
Explanation: Introduction
This notebook demonstrates how to carry out an orderi... |
datapolitan/lede_algorithms | class3_2/3-2_DoNow_Answers.ipynb | gpl-2.0 | import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
import numpy as np
"""
Explanation: <img src="images/hanford_variables.png">
1. Import the necessary packages to read in the data, plot, and create a linear regression model
End of explanation
"""
... |
ES-DOC/esdoc-jupyterhub | notebooks/bnu/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', 'bnu', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: BNU
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions Co... |
UWashington-Astro300/Astro300-A16 | 04_Python_LoopsAndStrings.ipynb | mit | import numpy as np
from astropy.table import QTable
from astropy import units as u
"""
Explanation: Strings and Control Flow
End of explanation
"""
s = 'spam'
s,len(s),s[0],s[0:2]
s[::-1]
"""
Explanation: Strings
Strings are just arrays of characters
End of explanation
"""
e = "eggs"
s + e
s + " " + e
4 * (... |
basnijholt/holoviews | doc/Homepage.ipynb | bsd-3-clause | import numpy as np
import holoviews as hv
hv.notebook_extension('matplotlib')
fractal = hv.Image(np.load('mandelbrot.npy'))
((fractal * hv.HLine(y=0)).hist() + fractal.sample(y=0))
"""
Explanation: HoloViews is a Python library that makes analyzing and visualizing scientific or engineering data much simpler, more int... |
scr4t/rep | howto/04-howto-folding.ipynb | apache-2.0 | %pylab inline
"""
Explanation: About
This notebook demonstrates stacking machine learning algorithm - folding, which physics use in their analysis.
End of explanation
"""
!cd toy_datasets; wget -O MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID.tx... |
commial/miasm | doc/locationdb/locationdb.ipynb | gpl-2.0 | # Import and create a locationDB
from miasm.core.locationdb import LocationDB
loc_db = LocationDB()
print(repr(loc_db))
# Create a location with default attributes (no offset, no symbol name)
loc_a = loc_db.add_location()
print(loc_a)
# Create a second location with an offset
loc_b = loc_db.add_location(offset=112233)... |
nickkunz/smogn | examples/smogn_example_3_adv.ipynb | gpl-3.0 | ## suppress install output
%%capture
## install pypi release
# !pip install smogn
## install developer version
!pip install git+https://github.com/nickkunz/smogn.git
"""
Explanation: SMOGN (0.1.0): Usage
Example 3: Advanced
Installation
First, we install SMOGN from the Github repository. Alternatively, we could ins... |
diegocavalca/Studies | deep-learnining-specialization/4. Convolutional Neural Networks/resources/Autonomous driving application - Car detection - v1.ipynb | cc0-1.0 | import argparse
import os
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
import scipy.io
import scipy.misc
import numpy as np
import pandas as pd
import PIL
import tensorflow as tf
from keras import backend as K
from keras.layers import Input, Lambda, Conv2D
from keras.models import load_model, Mo... |
skkandrach/foundations-homework | data-databases/D&D-Homework-4_graded.ipynb | mit | numbers_str = '496,258,332,550,506,699,7,985,171,581,436,804,736,528,65,855,68,279,721,120'
"""
Explanation: Grade: 10 / 11 -- look for "TA-COMMENT"
Homework #4
These problem sets focus on list comprehensions, string operations and regular expressions.
Problem set #1: List slices and list comprehensions
Let's start wi... |
Mdround/fastai-deeplearning1 | deeplearning1/nbs/wordvectors.ipynb | apache-2.0 | import zipfile
with zipfile.ZipFile(path + "glove.6B.zip","r") as zip_ref:
zip_ref.extractall(path)
%ls $path
"""
Explanation: Preprocessing
... but you can't access it! So MDR has done, it, below...
Download and unzip the data - MDR
(Don't re-run the below unless needed - it's >800Mb, and takes about 3-4 min to ... |
GEMScienceTools/rmtk | notebooks/vulnerability/mdof_to_sdof/first_mode/first_mode.ipynb | agpl-3.0 | %matplotlib inline
from rmtk.vulnerability.common import utils
from rmtk.vulnerability.mdof_to_sdof.first_mode import first_mode
pushover_file = "../../../../../rmtk_data/capacity_curves_Vb-dfloor.csv"
idealised_type = 'quadrilinear'; # 'bilinear', 'quadrilinear' or 'none'
capacity_curves = utils.read_capacity_curves... |
mapattacker/cheatsheets | .ipynb_checkpoints/network_basics-checkpoint.ipynb | mit | import psycopg2
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
conn = psycopg2.connect(database="postgres", user="postgres", password="***", host="127.0.0.1", port="5432")
query = """SELECT fromnode, tonode, distance from edges"""
df = pd.read_sql_qu... |
azubiolo/itstep | it_step/intro_ml/lab_2/classify_generated_data.ipynb | mit | %matplotlib inline
import numpy as np
# class '0'
features_0 = [-1.5, 0] + np.random.randn(100, 2)
labels_0 = np.zeros(100)
# class '1'
features_1 = [+1.5, 0] + np.random.randn(100, 2)
labels_1 = np.ones(100)
# show the training set with matplotlib
import matplotlib.pyplot as plt
plt.figure()
plt.plot(features_0[:,... |
iurilarosa/thesis | codici/Archiviati/numpy/Hough Numpy.ipynb | gpl-3.0 | import scipy.io
import pandas
import numpy
import os
from matplotlib import pyplot
from scipy import sparse
import multiprocessing
%matplotlib inline
#carico file dati
percorsoFile = "/home/protoss/Documenti/TESI/DATI/peakmap1.mat.mat"
#print(picchi.shape)
#picchi[0]
#nb: picchi ha 0-tempi
# 1-frequenz... |
mne-tools/mne-tools.github.io | 0.17/_downloads/635035741daf88c18928d17907998cb3/plot_run_ica.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.preprocessing import ICA, create_ecg_epochs
from mne.datasets import sample
print(__doc__)
"""
Explanation: Compute ICA components on epochs
ICA is fit to MEG raw data.
We assume that the non-stationary EOG artifacts... |
sfomel/ipython | LiterateProgramming.ipynb | gpl-2.0 | from m8r import view
"""
Explanation: Literate programming using IPython notebooks
Literate programming is a concept promoted by Donald Knuth, the famous computer scientist (and the author of the Art of Computer Programming.) According to this concept, computer programs should be written in a combination of the progra... |
eds-uga/csci1360e-su17 | assignments/A2/A2_Q2.ipynb | mit | def return_ordinals(numbers):
out_list = []
### BEGIN SOLUTION
### END SOLUTION
return out_list
inlist = [5, 6, 1, 9, 5, 5, 3, 3, 9, 4]
outlist = ["5th", "6th", "1st", "9th", "5th", "5th", "3rd", "3rd", "9th", "4th"]
for y_true, y_pred in zip(outlist, return_ordinals(inlist)):
assert... |
natematias/research_in_python | dimensionality/Reducing Dimensionality with Principal Component Analysis.ipynb | mit | %matplotlib inline
import codecs
import json
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.graphics.gofplots import qqplot
from scipy import stats as ss
import csv
from collections import Counter
from collections import defaultdict
import seaborn as sns
from scipy import stat... |
manchester9/intro-to-nltk | NLP with NLTK.ipynb | mit | import nltk
nltk.download()
"""
Explanation: Introduction to NLP with NLTK
Natural Language Processing (NLP) is often taught at the academic level from the perspective of computational linguists. However, as data scientists, we have a richer view of the natural language world - unstructured data that by its very natu... |
syednasar/datascience | ml-template/Example Machine Learning Notebook-Copy1.ipynb | mit | import pandas as pd
iris_data = pd.read_csv('iris-data.csv')
iris_data.head()
"""
Explanation: A template for Data Science
By Nasar, S.
It is recommended to view this notebook in nbviewer for the best viewing experience.
Table of contents
Introduction
License
Required libraries
The problem domain
Step 1: An... |
mne-tools/mne-tools.github.io | 0.24/_downloads/d2352ab4b72ce7d1dc05c76bda6ef71d/55_setting_eeg_reference.ipynb | bsd-3-clause | import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
raw.crop(tmax=60).load_data()
raw.pick(['EEG 0{:... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-3/cmip6/models/sandbox-1/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: TEST-INSTITUTE-3
Source ID: SANDBOX-1
Topic: Land
Sub-Topics: Soil, Snow, ... |
seifip/udacity-deep-learning-nanodegree | intro-to-rnns/Anna_KaRNNa_Exercises.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is bas... |
MTG/essentia | src/examples/python/musicbricks-tutorials/3-sine_subtraction.ipynb | agpl-3.0 | # import essentia in streaming mode
import essentia
import essentia.streaming as es
"""
Explanation: Sine subtraction - MusicBricks Tutorial
Introduction
This tutorial will guide you through some tools for performing spectral analysis and synthesis using the Essentia library (http://www.essentia.upf.edu).
This algori... |
adrn/GaiaPairsFollowup | notebooks/Rough wavelength solution.ipynb | mit | hdu1 = fits.open("/Users/adrian/projects/gaia-wide-binaries/data/mdm-spring-2017/n3/n3.0104.fit")[0]
hdu2 = fits.open("/Users/adrian/projects/gaia-wide-binaries/data/mdm-spring-2017/n3/n3.0105.fit")[0]
spec1 = hdu1.data
spec2 = hdu2.data
print(hdu1.header['OBJECT'], hdu2.header['OBJECT'])
spec_1ds = []
for spec in [... |
mne-tools/mne-tools.github.io | 0.23/_downloads/c6baf7c1a2f53fda44e93271b91f45b8/50_beamformer_lcmv.ipynb | bsd-3-clause | # Authors: Britta Westner <britta.wstnr@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample, fetch_fsaverage
from mne.beamformer import make_lcmv, apply_lcmv
"""
Explanation: Source reconstruction using an L... |
mu4farooqi/deep-learning-projects | tv-script-generation/dlnd_tv_script_generation.ipynb | gpl-3.0 | """
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 scri... |
rishuatgithub/MLPy | torch/PYTORCH_NOTEBOOKS/02-ANN-Artificial-Neural-Networks/04a-Full-ANN-Code-Along-Regression.ipynb | apache-2.0 | import torch
import torch.nn as nn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: <img src="../Pierian-Data-Logo.PNG">
<br>
<strong><center>Copyright 2019. Created by Jose Marcial Portilla.</center></strong>
Full Artificial Neural Network Code Along
In the l... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session03/Day2/OOP_solns.ipynb | mit | import matplotlib.pyplot as plt
import random
import numpy as np
%matplotlib inline
"""
Explanation: DSFP Object Oriented Programming Notebook
Incorporating classes, objects, and functions into your code will improve its efficiency, readability, and make it easier to extend to other programs down the road. This note... |
psychemedia/ou-robotics-vrep | robotVM/notebooks/Demo - vrep magic.ipynb | apache-2.0 | #Set up the notebook to work with the V-REP simulator
%run 'Set-up.ipynb'
%run 'Loading scenes.ipynb'
#Load the Pioneer models
%run 'vrep_models/PioneerP3DX.ipynb'
"""
Explanation: VREP Magic Demo - Pioneer Robot
Demonstration using the Pioneer robot:
use downward facing RGB sensors to follow a line.
End of explanat... |
mohanprasath/Course-Work | numpy/numpy_exercises_from_kyubyong/Linear_algebra_Solutions.ipynb | gpl-3.0 | import numpy as np
np.__version__
"""
Explanation: Linear algebra
End of explanation
"""
x = [1,2]
y = [[4, 1], [2, 2]]
print np.dot(x, y)
print np.dot(y, x)
print np.matmul(x, y)
print np.inner(x, y)
print np.inner(y, x)
"""
Explanation: Matrix and vector products
Q1. Predict the results of the following code.
En... |
VUInformationRetrieval/IR2016_2017 | 04_analysis.ipynb | gpl-2.0 | import pickle, bz2
from collections import defaultdict, namedtuple, Counter
from math import log10, sqrt
from IPython.display import display, HTML
import matplotlib.pyplot as plt
# show plots inline within the notebook
%matplotlib inline
# set plots' resolution
plt.rcParams['savefig.dpi'] = 100
Ids_file = 'data/malar... |
DTOcean/dtocean-core | notebooks/DTOcean Tidal Hydrodynamics Example.ipynb | gpl-3.0 | %matplotlib inline
from IPython.display import display, HTML
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (14.0, 8.0)
import numpy as np
from dtocean_core import start_logging
from dtocean_core.core import Core
from dtocean_core.menu import DataMenu, ModuleMenu, ProjectMenu
from dtocean_core.pip... |
lcharleux/numerical_analysis | doc/Optimisation/notebooks/Optimization.ipynb | gpl-2.0 | from scipy import optimize
def f(X):
"""
Cost function.
"""
return (X**2).sum()
X0 = [1.,1.] # Initial guess
sol = optimize.minimize(f, X0, method = "nelder-mead")
X = sol.x
print "Solution: ", X
"""
Explanation: Optimization
Scope
Mathematical optimization aims at solving various kinds of problems by min... |
FRBs/DM | docs/nb/DM_Halos and DM_IGM.ipynb | bsd-3-clause | # imports
from importlib import reload
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as IUS
from astropy import units as u
from frb.halos import ModifiedNFW
from frb import halos as frb_halos
from frb import igm as frb_igm
from frb.figures import utils as ff_utils
from matplotlib impo... |
rbondesan/ssd | ssd_alpha.ipynb | mit | # General import
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple
from itertools import count
#from copy import deepcopy
#from PIL import Image
import math
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autogr... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/text_models/labs/keras_for_text_classification.ipynb | apache-2.0 | import os
import pandas as pd
from google.cloud import bigquery
%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... |
tensorflow/docs-l10n | site/ko/federated/tutorials/custom_federated_algorithms_1.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... |
ewulczyn/ewulczyn.github.io | ipython/what_if_ab_testing_is_like_science/what_if_ab_testing_is_like_science.ipynb | mit | import numpy as np
np.random.seed(seed=0)
from statsmodels.stats.weightstats import ztest
from statsmodels.stats.power import tt_ind_solve_power
from scipy.stats import bernoulli
class Test():
def __init__(self, significance, power, mde, optimistic):
self.significance = significance
self.power... |
followcat/guilium | doc/design.ipynb | lgpl-3.0 | from graphviz import Digraph
G = Digraph(name='test-procedure', node_attr={'shape': 'plaintext'})
G.node('Input')
G.node('Report')
G.node('Checkmate', '''<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD ROWSPAN="3" PORT="result">Result<BR/>stack</TD>
<TD COLSPAN="3">test</TD>
</... |
zlxs23/Python-Cookbook | .ipynb_checkpoints/data_structure_and_algorithm_py3_4-checkpoint.ipynb | apache-2.0 | a = {
'x':1,
'y':2,
'z':3
}
b = {
'w':10,
'x':11,
'y':2
}
# In a ::: x : 1 ,y : 2
# In b ::: x : 11,y : 2
"""
Explanation: 1.9 查找两字典的相同点
怎样在两字典中寻找相同点(相同的key or 相同的 value)
End of explanation
"""
# Find keys in common
kc = a.keys() & b.keys()
print('a 和 b 共有的键',kc)
# Find keys in a that are not... |
jgrizou/explauto | notebook/full_tutorial.ipynb | gpl-3.0 | from explauto.environment import environments
environments.keys()
"""
Explanation: Explauto, an open-source Python library to study autonomous exploration in developmental robotics
Explauto is an open-source Python library providing a unified API to design and compare various exploration strategies driving various sen... |
NumCosmo/NumCosmo | notebooks/DataNCount/run_ascaso_mcmc_binned.ipynb | gpl-3.0 | #CCL cosmology
cosmo_ccl = ccl.Cosmology(Omega_c = 0.30711 - 0.048254, Omega_b = 0.048254, h = 0.677, sigma8 = 0.8822714165197718, n_s=0.96, Omega_k = 0, transfer_function='eisenstein_hu')
#ccl_cosmo_set_high_prec (cosmo_ccl)
cosmo_numcosmo, dist, ps_lin, ps_nln, hmfunc = create_nc_obj (cosmo_ccl)
psf = hmfunc.peek_p... |
skkandrach/foundations-homework | data-databases/D&D-Homework-4.ipynb | mit | numbers_str = '496,258,332,550,506,699,7,985,171,581,436,804,736,528,65,855,68,279,721,120'
"""
Explanation: Homework #4
These problem sets focus on list comprehensions, string operations and regular expressions.
Problem set #1: List slices and list comprehensions
Let's start with some data. The following cell contain... |
Mdround/fastai-deeplearning1 | deeplearning1/nbs/statefarm.ipynb | apache-2.0 | from theano.sandbox import cuda
cuda.use('gpu0')
%matplotlib inline
from __future__ import print_function, division
path = "data/state/"
#path = "data/state/sample/"
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
batch_size=64
"""
Explanation: Enter State Farm
End of explanation... |
hanezu/cs231n-assignment | 17-assignment2/ConvolutionalNetworks.ipynb | mit | # As usual, a bit of setup
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.cnn import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient
from cs231n.layers import *
fro... |
fossdevil/Assignments | PRNN/Assignment/Assignment3/word2Vec.ipynb | mit | def sentenceExtractionForTraining(dirName, fileName, classes):
sentencesClass = []
for i in range(0,len(classes)):
sentences = readFile(dirName+fileName[i])
sentencesClass.append(sentences)
return sentencesClass
def readFile(fileName):
f = open(fileName,"r+")
sentences = []
for ... |
google-research/google-research | nested_rhat/nRhat_convergence.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
UIUC-iSchool-DataViz/fall2017 | week07/examples_week07.ipynb | bsd-3-clause | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Basics of Pandas
The last few weeks we have been using low-level methods to read data in to Python and manipulate it. This week we will be exploring pandas to accelerate this process.
Pandas is based around the notion that arrays... |
Mashimo/datascience | 01-Regression/LogisticRegressionSM.ipynb | apache-2.0 | import pandas as pd
data = pd.read_csv("../datasets/ex2data1.txt", header=None,
names=['Exam1', 'Exam2', 'Admitted'])
data.head()
"""
Explanation: Example of Logistic regression
Predict student admission based on exams result
Data is taken from Andrew Ng's CS229 course on Machine Learning at Stan... |
winpython/winpython_afterdoc | docs/keras-intro_brianspiering.ipynb | mit | reset -fs
import keras
# What is the backend / execution engine?
keras.backend.backend()
"""
Explanation: <center><img src="images/title.png" width="95%"/></center>
<center><a href="http://bit.ly/pybay-keras">bit.ly/pybay-keras</a></center>
Who Am I?
<center>Brian Spiering</center>
What Do I Do?
<b><center>Professo... |
cleuton/datascience | datavisualization/data_visualization_python_english.ipynb | apache-2.0 | import numpy as np
%matplotlib inline
temp_cidade1 = np.array([33.15,32.08,32.10,33.25,33.01,33.05,32.00,31.10,32.27,33.81])
temp_cidade2 = np.array([35.17,36.23,35.22,34.33,35.78,36.31,36.03,36.23,36.35,35.25])
temp_cidade3 = np.array([22.17,23.25,24.22,22.31,23.18,23.31,24.11,23.53,24.38,21.25])
"""
Explanation: Da... |
wangg12/caffe | examples/01-learning-lenet.ipynb | bsd-2-clause | import os
os.chdir('..')
import sys
sys.path.insert(0, './python')
import caffe
from pylab import *
%matplotlib inline
"""
Explanation: Python solving with LeNet
In this example, we'll explore learning with Caffe in Python, using the fully-exposed Solver interface.
End of explanation
"""
# Download and prepare dat... |
icrtiou/coursera-ML | ex6-SVM/2- Gaussian kernels.ipynb | mit | mat = sio.loadmat('./data/ex6data2.mat')
print(mat.keys())
data = pd.DataFrame(mat.get('X'), columns=['X1', 'X2'])
data['y'] = mat.get('y')
data.head()
data.shape
"""
Explanation: load data
End of explanation
"""
sns.set(context="notebook", style="white", palette=sns.diverging_palette(240, 10, n=2))
sns.lmplot('X1... |
microsoft/dowhy | docs/source/example_notebooks/dowhy_causal_api.ipynb | mit | import dowhy.datasets
import dowhy.api
import numpy as np
import pandas as pd
from statsmodels.api import OLS
data = dowhy.datasets.linear_dataset(beta=5,
num_common_causes=1,
num_instruments = 0,
num_samples=1000,
treatment_is_binary=True)
df = data['df']
df['y'] = df['y'] + np.rando... |
jskDr/jamespy_py3 | .ipynb_checkpoints/jcy test-checkpoint.ipynb | mit | A = [2,2,3]
jcy.f_test(A)
print A
C = np.array([0,0], dtype = np.float64)
A = np.array([1,2], dtype = np.float64)
B = np.array([3,5], dtype = np.float64)
%timeit jcy.jsum_float( C, A, B, 1000)
print C
%timeit jpy.jsum_float( C, A, B, 1000)
print C
"""
Explanation: Numpy testing
End of explanation
"""
%timeit jcy.... |
google-research/meta-dataset | Leaderboard.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... |
mbdevpl/maildaemon | examples.ipynb | apache-2.0 | import maildaemon
"""
Explanation: maildaemon package
End of explanation
"""
cfg = maildaemon.load_config()
connections = cfg['connections']
"""
Explanation: reading configuration
End of explanation
"""
from maildaemon.imap_daemon import IMAPDaemon
from maildaemon.smtp_connection import SMTPConnection
from maild... |
ageron/ml-notebooks | 14_recurrent_neural_networks.ipynb | apache-2.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
try:
# %tensorflow_version only exists in Colab.
%tensorflow_version 1.x
except Exception:
pass
# to make this notebook's output stable across runs
def r... |
julienchastang/unidata-python-workshop | notebooks/AWIPS/Watch_and_Warning_Polygons.ipynb | mit | from awips.dataaccess import DataAccessLayer
from awips.tables import vtec
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
from cartopy.feature import ... |
mne-tools/mne-tools.github.io | 0.19/_downloads/131324ab94fb4e4c09fa41f4692da130/plot_custom_inverse_solver.ipynb | bsd-3-clause | import numpy as np
from scipy import linalg
import mne
from mne.datasets import sample
from mne.viz import plot_sparse_source_estimates
data_path = sample.data_path()
fwd_fname = data_path + '/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif'
ave_fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
cov_fname = data_... |
QinetiQ-datascience/Docker-Data-Science | WooWeb-Presentation/Workspace/Widgets/Widget Styling.ipynb | mit | from ipywidgets import Button, Layout
b = Button(description='(50% width, 80px height) button',
layout=Layout(width='50%', height='80px'))
b
"""
Explanation: Layout and Styling of Jupyter widgets
This notebook presents how to layout and style Jupyter interactive widgets to build rich and reactive widget-ba... |
ryneches/SuchTree | docs/slides3.ipynb | bsd-3-clause | %pylab inline
from SuchTree import SuchTree, SuchLinkedTrees, pearson
import pandas as pd
import numpy as np
import seaborn
"""
Explanation: Hird's Birds
In which I flagrantly parasitize Sarah's paper Comparative Gut Microbiota of 59 Neotropical Bird Species for my own nefarious purposes.
End of explanation
"""
T1 =... |
brain-bzh/INT277 | plot_nilearn_101.ipynb | mit | # Let us use a Nifti file that is shipped with nilearn
from nilearn.datasets import MNI152_FILE_PATH
# Note that the variable MNI152_FILE_PATH is just a path to a Nifti file
print('Path to MNI152 template: %r' % MNI152_FILE_PATH)
"""
Explanation: Basic nilearn example: manipulating and looking at data
A simple exampl... |
jacobjma/PyQSTEM | examples/STEM_potential_comparison.ipynb | gpl-3.0 | from __future__ import print_function
%matplotlib inline
import collections
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib as mpl
from ase.io import read
from pyqstem.util import atoms_plot
from pyqstem import PyQSTEM
from pyqstem.potentials ... |
tensorflow/docs-l10n | site/ja/model_optimization/guide/quantization/training_comprehensive_guide.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... |
mne-tools/mne-tools.github.io | 0.20/_downloads/7c31b7bed6ff2a9686e321d607181951/plot_background_ica.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from sklearn.decomposition import FastICA, PCA
np.random.seed(0) # set seed for reproducible results
n_samples = 2000
time = np.linspace(0, 8, n_samples)
s1 = np.sin(2 * time) # Signal 1 : sinusoidal signal
s2 = np.sign(np.sin(3 * time)) ... |
alexandrnikitin/algorithm-sandbox | courses/DAT256x/Module04/04-03-Comparing Data.ipynb | mit | %matplotlib inline
import pandas as pd
from matplotlib import pyplot as plt
df = pd.DataFrame({'Name': ['Dan', 'Joann', 'Pedro', 'Rosie', 'Ethan', 'Vicky', 'Frederic', 'Jimmie', 'Rhonda', 'Giovanni', 'Francesca', 'Rajab', 'Naiyana', 'Kian', 'Jenny'],
'Grade':[50,50,46,95,50,5,57,42,26,72,78,60,40,17... |
abhi1509/deep-learning | autoencoder/Convolutional_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
kerimlcr/ab2017-dpyo | ornek/osmnx/osmnx-0.3/examples/02-example-osm-to-shapefile.ipynb | gpl-3.0 | import osmnx as ox
%matplotlib inline
ox.config(log_file=True, log_console=True, use_cache=True)
"""
Explanation: Get shapefiles from OpenStreetMap with OSMnx
Overview of OSMnx
GitHub repo
Examples, demos, tutorials
End of explanation
"""
# from some place name, create a GeoDataFrame containing the geometry of the ... |
ML4DS/ML4all | C2.kNN_Classification/kNN_Classification_student.ipynb | mit | # To visualize plots in the notebook
%matplotlib inline
# Import some libraries that will be necessary for working with data and displaying plots
import csv # To read csv files
import random
import matplotlib.pyplot as plt
import numpy as np
from scipy import spatial
from sklearn import neighbors, datasets
"""
E... |
tappinganalytics/ALTEN | image_classification.ipynb | apache-2.0 | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
mattmcd/PyBayes | scripts/uk_covid_20210201.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import arviz as az
import pymc3 as pm
%matplotlib inline
from uk_covid19 import Cov19API
overview_filter = [
"areaType=overview"
]
admissions_and_deaths = {
"date": "date",
"ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.