repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Lukx19/UvA-ML1 | 10158006_10185453_11896493_lab2.ipynb | mit | NAME = "Laura Ruis"
NAME2 = "Fredie Haver"
NAME3 = "Lukás Jelínek"
EMAIL = "lauraruis@live.nl"
EMAIL2 = "frediehaver@hotmail.com"
EMAIL3 = "lukas.jelinek1@gmail.com"
"""
Explanation: Save this file as studentid1_studentid2_lab#.ipynb
(Your student-id is the number shown on your student card.)
E.g. if you work with 3 p... |
h-mayorquin/time_series_basic | examples/2015-09-21(How Fourier Transform and Inverse Fourier Transform Work).ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sampling_rate = 20 # This quantity is on Hertz
step = 1.0 / sampling_rate
Tmax = 20.0
time = np.arange(0, Tmax, step)
N_to_use = 1024 # Should be a power of two.
"""
Explanation: How the FFT (Fast Fourier Tranform) works in Python and how to us... |
phoebe-project/phoebe2-docs | 2.3/tutorials/datasets_advanced.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Advanced: Datasets
Datasets tell PHOEBE how and at what times to compute the model. In some cases these will include the actual observational data, and in other cases may only include the times at which you want to compute a synthetic model.
If you're not already f... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/recommendation_systems/solutions/als_bqml_hybrid.ipynb | apache-2.0 | import os
import tensorflow as tf
PROJECT = "your-project-id-here" # REPLACE WITH YOUR PROJECT ID
# Do not change these
os.environ["PROJECT"] = PROJECT
os.environ["TFVERSION"] = '2.5'
"""
Explanation: Training Hybrid Recommendation Model with the MovieLens Dataset
Note: It is recommended that you complete the compani... |
probml/pyprobml | deprecated/IPM_divergences.ipynb | mit | import jax
import random
import numpy as np
import jax.numpy as jnp
import seaborn as sns
import matplotlib.pyplot as plt
import scipy
!pip install dm-haiku
!pip install optax
import haiku as hk
import optax
sns.set(rc={"lines.linewidth": 2.8}, font_scale=2)
sns.set_style("whitegrid")
"""
Explanation: <a href="ht... |
cgpotts/cs224u | hw_formatting_guide.ipynb | apache-2.0 | __author__ = "Insop"
__version__ = "CS224u, Stanford, Spring 2022"
"""
Explanation: Homework and bake-off code: Formatting guide
End of explanation
"""
def test_create_glove_embedding(func):
vocab = ['NLU', 'is', 'the', 'future', '.', '$UNK', '<s>', '</s>']
# DON'T modify functions like this!
#
# gl... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/08_image/mnist_models.ipynb | apache-2.0 | import os
PROJECT = "cloud-training-demos" # REPLACE WITH YOUR PROJECT ID
BUCKET = "cloud-training-demos-ml" # REPLACE WITH YOUR BUCKET NAME
REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
MODEL_TYPE = "dnn" # "linear", "dnn", "dnn_dropout", or "cnn"
# Do not change these
os.environ["PROJECT... |
snowch/movie-recommender-demo | notebooks/Prerequisites 01 - Spark Hello World.ipynb | apache-2.0 | import socket
"""
Explanation: Spark Cluster Overview
Spark applications run as independent sets of processes on a cluster, coordinated by the SparkContext object in your main program (called the driver program).
End of explanation
"""
print( "Hello World from " + socket.gethostname() )
"""
Explanation: This code r... |
evanmiltenburg/python-for-text-analysis | Assignments/ASSIGNMENT-4b-BA.ipynb | apache-2.0 | import json
my_tweets = json.load(open('my_tweets.json'))
for id_, tweet_info in my_tweets.items():
print(id_, tweet_info)
break
"""
Explanation: Assignment 4b-BA: Sentiment analysis using VADER
Due: Friday October 15, 2021, before 14:30
Please note that this is Assignment 4 for the Bachelor version of the P... |
GoogleCloudPlatform/bigquery-notebooks | notebooks/community/analytics-componetized-patterns/retail/recommendation-system/bqml-scann/01_train_bqml_mf_pmi.ipynb | apache-2.0 | from datetime import datetime
import matplotlib.pyplot as plt
import seaborn as sns
from google.cloud import bigquery
"""
Explanation: Part 1: Learn item embeddings based on song co-occurrence
This notebook is the first of five notebooks that guide you through running the Real-time Item-to-item Recommendation with Bi... |
mari-linhares/tensorflow-workshop | test_install.ipynb | apache-2.0 | import tensorflow as tf
print("Expected version is 1.2.0 or higher")
print("You have version %s" % tf.__version__)
"""
Explanation: You can press shift + enter to quickly advance through each line of a notebook. Try it!
Check that you have a recent version of TensorFlow installed, v1.2.0 or higher.
End of explanation
... |
mdeff/ntds_2016 | algorithms/02_ex_clustering.ipynb | mit | # Load libraries
# Math
import numpy as np
# Visualization
%matplotlib notebook
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy import ndimage
# Print output of LFR code
import subprocess
# Sparse matrix
import ... |
peterwittek/qml-rg | Archiv_Session_Spring_2017/Exercises/06_aps_with_classifiers.ipynb | gpl-3.0 | import numpy as np
import os
from skimage.transform import resize
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
import tools as im
from matplotlib import pyplot as plt
%matplotlib inline
path=os.getcwd()+'/' # finds the path of the folder in which the notebook is
path_train=path+'images/t... |
knu2xs/arcgis-machine-learning-demonstrations | Retrieve Data as Pandas Data Frame.ipynb | apache-2.0 | import arcgis
"""
Explanation: Import the Python API module and Instantiate the GIS object
Import the Python API
End of explanation
"""
gis_retail = arcgis.gis.GIS('Pro')
"""
Explanation: Create an GIS object instance using the account currently logged in through ArcGIS Pro
End of explanation
"""
trade_area_itemi... |
pfschus/fission_bicorrelation | methods/singles_n_sum.ipynb | mit | import os
import sys
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
import os
import scipy.io as sio
import sys
import pandas as pd
from tqdm import *
# Plot entire array
np.set_printoptions(threshold=np.nan)
import seaborn as sns
sns.set_style(style='white')
sys.path.append('../scripts/... |
svdwulp/da-programming-1 | week_03_oefeningen_uitwerkingen.ipynb | gpl-2.0 | # 1.1
getallen_a = []
# 1.2
for i in range(2, 11, 2):
getallen_a.append(i)
# 1.3
print("Lijst getallen_a:", getallen_a)
print("Lengte of aantal elementen:", len(getallen_a))
print("Getal op plek 0:", getallen_a[0])
print("Getal op plek 3:", getallen_a[3])
print("Getal op plek -1:", getallen_a[-1])
# 1.4
getallen_a.... |
ixkael/AstroHackWeek2015 | day1/day1_ecosystem.ipynb | gpl-2.0 | from __future__ import print_function
import math
import numpy as np
"""
Explanation: Orienting Yourself
Image: @jakevdp
How to install packages using conda
If you're using anaconda, you probably already have most (if not all) of these installed. If you installed miniconda:
conda install numpy
Conda also has channel... |
UWashington-Astro300/Astro300-W17 | 05_Python_StringsAndStuff.ipynb | mit | import numpy as np
from astropy import units as u
"""
Explanation: Strings and Stuff in Python
End of explanation
"""
s = 'spam'
s,len(s),s[0],s[0:2]
s[::-1]
"""
Explanation: Strings are just arrays of characters
End of explanation
"""
s = 'spam'
e = "eggs"
s + e
s + " " + e
4 * (s + " ") + e
print(4 * (s... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Visualization/Matplotlib/Matplotlib Concepts Lecture.ipynb | mit | import matplotlib.pyplot as plt
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Matplotlib Overview Lecture
Introduction
Matplotlib is the "grandfather" library of data visualization with Python. It was created by John Hunter. He created it to try to replicate MatLab'... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/official/explainable_ai/sdk_custom_image_classification_batch_explain.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: Custom training image classification model for batch prediction with explainabilty
... |
uber/pyro | tutorial/source/boosting_bbvi.ipynb | apache-2.0 | import os
from collections import defaultdict
from functools import partial
import numpy as np
import pyro
import pyro.distributions as dist
import scipy.stats
import torch
import torch.distributions.constraints as constraints
from matplotlib import pyplot
from pyro.infer import SVI, Trace_ELBO
from pyro.optim import ... |
sassoftware/sas-viya-programming | python/AX2016/Machine Learning Algorithm Comparison.ipynb | apache-2.0 | import pandas as pd
import swat
from matplotlib import pyplot as plt
from swat.render import render_html
%matplotlib inline
"""
Explanation: Machine Learning Algorithm Comparison
This example illustrates fitting and comparing several Machine Learning algorithms for classifying the binary target in the
HMEQ dat... |
gcgruen/homework | data-databases-homework/.ipynb_checkpoints/Homework_3_Gruen-checkpoint.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html_str = urlopen("http://static.decontextualize.com/widgets2016.html").read()
document = BeautifulSoup(html_str, "html.parser")
"""
Explanation: Homework assignment #3
These problem sets focus on using the Beautiful Soup library to scrape web pages.
Pr... |
erikdrysdale/erikdrysdale.github.io | _rmd/extra_cancer/cancer_calc.ipynb | mit | import os
import pandas as pd
import numpy as np
import plotnine
from plotnine import *
from matplotlib import cm, colors
from plydata.cat_tools import *
# Load the CSV files
df_cancer = pd.read_csv('1310039401.csv',usecols=['year','number'])
df_cancer.rename(columns={'year':'years','number':'cancer'}, inplace=True)
d... |
pdamodaran/yellowbrick | examples/bbengfort/testing.ipynb | apache-2.0 | %matplotlib inline
import os
import sys
import nltk
import pickle
# To import yellowbrick
sys.path.append("../..")
"""
Explanation: Visual Diagnosis of Text Analysis with Baleen
This notebook has been created as part of the Yellowbrick user study. I hope to explore how visual methods might improve the workflow o... |
M0nica/python-foundations-hw | 08/.ipynb_checkpoints/08-checkpoint.ipynb | mit | # workon dataanalysis - my virtual environment
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# df = pd.read_table('34933-0001-Data.tsv')
odf = pd.read_csv('accreditation_2016_03.csv')
odf.head()
odf.columns
odf['Campus_City'].value_counts().head(10)
top_cities = odf['Campus_City'].value_co... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/official/migration/UJ6 Vertex SDK AutoML Text Classification.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex AI: Vertex AI Migration: AutoML Text Classification
<table align="left">
<td>
<a h... |
darkomen/TFG | medidas/03082015/modelado.ipynb | cc0-1.0 | #Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import signal
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
%pylab inlin... |
superbobry/pymc3 | pymc3/examples/GLM-logistic.ipynb | apache-2.0 | %matplotlib inline
import pandas as pd
import numpy as np
import pymc3 as pm
import matplotlib.pyplot as plt
import seaborn
import warnings
warnings.filterwarnings('ignore')
from collections import OrderedDict
from time import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.opti... |
DavidPowell/openmodes-examples | Modelling Coupled Elements.ipynb | gpl-3.0 | # setup 2D and 3D plotting
%matplotlib inline
from openmodes.ipython import matplotlib_defaults
matplotlib_defaults()
import matplotlib.pyplot as plt
import numpy as np
import os.path as osp
import openmodes
from openmodes.constants import c, eta_0
from openmodes.model import EfieModelMutualWeight
from openmodes.so... |
dbouquin/DATA_620 | 620_project2_101716.ipynb | mit | import networkx as nx
import os
import ads as ads
import matplotlib.pyplot as plt
import pandas as pd
from networkx.algorithms import bipartite as bi
os.environ["ADS_DEV_KEY"] = "kNUoTurJ5TXV9hsw9KQN1k8wH4U0D7Oy0CJoOvyw"
ads.config.token = 'ADS_DEV_KEY'
#Search for papers (50 most cited) on stars (very general sea... |
jorisvandenbossche/2015-EuroScipy-pandas-tutorial | solved - 03 - Indexing and selecting data.ipynb | bsd-2-clause | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
try:
import seaborn
except ImportError:
pass
# redefining the example objects
# series
population = pd.Series({'Germany': 81.3, 'Belgium': 11.3, 'France': 64.3,
'United Kingdom': 64.9, 'Netherla... |
bearing/dosenet-analysis | Programming Lesson Modules/Module 8- Measures of Central Tendency.ipynb | mit | %matplotlib inline
import csv
import io
import urllib.request
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
url = 'https://radwatch.berkeley.edu/sites/default/files/dosenet/etch.csv'
response = urllib.request.urlopen(url)
reader = csv.reader(io.Text... |
semipi/programming-humanoid-robot-in-python | joint_control/add_training_data.ipynb | gpl-2.0 | %pylab inline
imshow(imread('robot_pose_image/Stand.png'))
"""
Explanation: add data to training set
The provided train data may not sufficient to get good pose recognization results. In case the pose is not recognized correctly, this data can be manually added to the train data.
Defined Poses
Stand: the weight is su... |
darioizzo/d-CGP | doc/sphinx/notebooks/dCGPANNs_for_classification.ipynb | gpl-3.0 | # Initial import
import dcgpy
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
from sklearn.utils import shuffle
import timeit
%matplotlib inline
"""
Explanation: Training a FFNN in dCGPANN vs. Keras (classification)
A Feed Forward Neural network is a widely used ANN model for regression and c... |
theandygross/HIV_Methylation | PreProcessing/save_detection_p_values.ipynb | mit | PATH = '/cellar/users/agross/TCGA_Code/Methlation/'
cd $PATH
import NotebookImport
from Setup.Imports import *
"""
Explanation: Save Detection P-Values
I have saved the detection p-values in .csv files in the MINFI processing pipeline. Here I am just converting those files into HDFS to make it a bit easier to read ... |
therealAJ/python-sandbox | data-science/learning/ud2/Part 1 Exercise Solutions/Data Capstone Projects/911 Calls/911 Calls Data Capstone Project .ipynb | gpl-3.0 | import numpy as np
import pandas as pd
"""
Explanation: 911 Calls Capstone Project
For this capstone project we will be analyzing some 911 call data from Kaggle. The data contains the following fields:
lat : String variable, Latitude
lng: String variable, Longitude
desc: String variable, Description of the Emergency ... |
georgetown-analytics/machine-learning | examples/erblinm/Post-Operative.ipynb | mit | %matplotlib inline
import os
import json
import time
import pickle
import requests
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import category_encoders as ce
URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/postoperative-patient-data/post-operative.dat... |
anhquan0412/deeplearning_fastai | deeplearning1/nbs/lesson1.ipynb | apache-2.0 | %matplotlib inline
#change image dim ordering?
# from keras import backend
# backend.set_image_dim_ordering('th')
"""
Explanation: Using Convolutional Neural Networks
Welcome to the first week of the first deep learning certificate! We're going to use convolutional neural networks (CNNs) to allow our computer to see ... |
gillenbrown/betterplotlib | docs/examples.ipynb | mit | %matplotlib inline
import betterplotlib as bpl
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Using betterplotlib
This page will demonstrate the power of betterplotlib, and hopefully show why it can be useful to you.
End of explanation
"""
bpl.default_style()
"""
Explanation: The first thing be... |
dssg/diogenes | examples/CPDB/CPDB.ipynb | mit | #Record arrays
allegations = read.open_csv_url('https://raw.githubusercontent.com/jamestwhedbee/DataProjects/master/CPDB/Allegations.csv',parse_datetimes=['IncidentDate','StartDate','EndDate'])
citizens = read.open_csv_url('https://raw.githubusercontent.com/jamestwhedbee/DataProjects/master/CPDB/Citizens.csv')
officer... |
NicolasHemidy/udacity-data-nanodegree | P3/OSMProject - Plaisir.ipynb | apache-2.0 | tags = {}
for event, elem in ET.iterparse("sample.osm"):
if elem.tag not in tags:
tags[elem.tag]= 1
else:
tags[elem.tag] += 1
print tags
"""
Explanation: Audit of the file
End of explanation
"""
tags_details = {}
keys = ["amenity","shop","sport","place","service","building"]
def create_tags_... |
leon-adams/datascience | notebooks/linear-classifier.ipynb | mpl-2.0 | # Run some setup code for this notebook.
import sys
import os
sys.path.append('..')
import graphlab
"""
Explanation: Implementing logistic regression from scratch
The goal of this notebook is to implement your own logistic regression classifier. We will:
Extract features from Amazon product reviews.
Convert an SFrame... |
mit-crpg/openmc | examples/jupyter/mgxs-part-ii.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-dark')
import openmoc
import openmc
import openmc.mgxs as mgxs
import openmc.data
from openmc.openmoc_compatible import get_openmoc_geometry
%matplotlib inline
"""
Explanation: Multigroup Cross Section Generation Part II: Advanced Features
Th... |
JackDi/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"""
b= ... |
daniel-koehn/Theory-of-seismic-waves-II | 03_Intro_finite_differences/lecture_notebooks/1_fd_intro.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 parts of this notebook ... |
DIPlib/diplib | examples/python/tensor_images.ipynb | apache-2.0 | import diplib as dip
"""
Explanation: Tensor images
This notebook gives an overview of the concept of tensor images, and demonstrates how to use this feature.
End of explanation
"""
img = dip.ImageRead('../trui.ics')
img.Show()
"""
Explanation: After reading the "PyDIP basics" notebook, you should be familiar with ... |
lexual/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter2_MorePyMC/Chapter2.ipynb | mit | import pymc as pm
parameter = pm.Exponential("poisson_param", 1)
data_generator = pm.Poisson("data_generator", parameter)
data_plus_one = data_generator + 1
"""
Explanation: Chapter 2
This chapter introduces more PyMC syntax and design patterns, and ways to think about how to model a system from a Bayesian perspect... |
cogstat/cogstat | cogstat/docs/CogStat analyses showcase.ipynb | gpl-3.0 | %matplotlib inline
import os
import warnings
warnings.filterwarnings('ignore')
from cogstat import cogstat as cs
print(cs.__version__)
cs_dir, dummy_filename = os.path.split(cs.__file__) # We use this for the demo data
"""
Explanation: Showcase of various CogStat analyses
Below you can see a few examples what anal... |
karlstroetmann/Artificial-Intelligence | Python/4 Automatic Theorem Proving/AST-2-Dot.ipynb | gpl-2.0 | import graphviz as gv
"""
Explanation: Drawing Abstract Syntax Trees with GraphViz
End of explanation
"""
def tuple2dot(t):
dot = gv.Digraph('Abstract Syntax Tree')
Nodes_2_Names = {}
assign_numbers((), t, Nodes_2_Names)
create_nodes(dot, (), t, Nodes_2_Names)
return dot
"""
Explanation: The fun... |
nproctor/phys202-2015-work | assignments/assignment11/OptimizationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize as opt
"""
Explanation: Optimization Exercise 1
Imports
End of explanation
"""
def hat(x,a,b):
return -a*x**2 + b*x**4
assert hat(0.0, 1.0, 1.0)==0.0
assert hat(0.0, 1.0, 1.0)==0.0
assert hat(1.0, 10.0, 1.0)==-9.0
"""
E... |
SamLau95/nbinteract | docs/notebooks/examples/examples_central_limit_theorem.ipynb | bsd-3-clause | colors = make_array('Purple', 'Purple', 'Purple', 'White')
model = Table().with_column('Color', colors)
model
props = make_array()
num_plants = 200
repetitions = 1000
for i in np.arange(repetitions):
sample = model.sample(num_plants)
new_prop = np.count_nonzero(sample.column('Color') == 'Purple')/num_plant... |
InsightLab/data-science-cookbook | 2020/trabalho-02/Trabalho 2 - Implementacao Perceptron.ipynb | mit | import numpy as np
class Perceptron(object):
"""Perceptron classifier.
Parameters
------------
eta : float
Learning rate (between 0.0 and 1.0)
n_iter : int
Passes over the training dataset.
random_state : int
Random number generator seed for random weight
initializatio... |
jorisvandenbossche/2015-EuroScipy-pandas-tutorial | solved - 04 - Groupby operations.ipynb | bsd-2-clause | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
try:
import seaborn
except ImportError:
pass
pd.options.display.max_rows = 10
"""
Explanation: Groupby operations
Some imports:
End of explanation
"""
df = pd.DataFrame({'key':['A','B','C','A','B','C','A','B','C'],
... |
diana-hep/c2numpy | commonblock/commonblock-demo.ipynb | apache-2.0 | import numpy
import commonblock
tracks = commonblock.NumpyCommonBlock(
trackermu_qoverp = numpy.zeros(1000, dtype=numpy.double),
trackermu_qoverp_err = numpy.zeros(1000, dtype=numpy.double),
trackermu_phi = numpy.zeros(1000, dtype=numpy.double),
trackermu_eta = numpy.zeros(1000, dtype... |
iamfullofspam/hep_ml | notebooks/DemoNeuralNetworks.ipynb | apache-2.0 | !cd toy_datasets; wget -O ../data/MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID.txt
import numpy, pandas
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
data = pandas.read_csv('../data/MiniBooNE_PID.... |
abhi1509/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
sellaroliandrea/matrix | .ipynb_checkpoints/matrici2-checkpoint.ipynb | mit | import sys; sys.path.append('pyggb')
%reload_ext geogebra_magic
%ggb --width 800 --height 400 --showToolBar 0 --showResetIcon 1 trasformazioni.ggb
"""
Explanation: Alcune applicazioni delle matrici
Subito dopo aver introdotto le matrici e viste le operazioni fondamentali di somma, prodotto e determinante una domanda s... |
TheOregonian/long-term-care-db | notebooks/analysis/washington-gardens.ipynb | mit | import pandas as pd
import numpy as np
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
df = pd.read_csv('../../data/processed/complaints-3-25-scrape.csv')
"""
Explanation: Data were munged here.
End of explanation
"""
move_in_date = '2015-05-01'
"... |
ptosco/rdkit | Docs/Notebooks/RGroupDecomposition-StereoChemTest.ipynb | bsd-3-clause | from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
IPythonConsole.ipython_useSVG=True
from rdkit.Chem import rdRGroupDecomposition
from IPython.display import HTML
from rdkit import rdBase
rdBase.DisableLog("rdApp.debug")
import pandas as pd
from rdkit.Chem import PandasTools
m = Chem.MolFromSmarts("C1... |
subimal/class-demos | LissajousFigures.ipynb | gpl-3.0 | import numpy as np
import pylab as pl
"""
Explanation: <a href="https://colab.research.google.com/github/subimal/class-demos/blob/master/LissajousFigures.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lissajous figures
Import the required libraies
... |
nlesc-sherlock/analyzing-corpora | notebooks/IntroductionToTopicModeling.ipynb | apache-2.0 | %pylab inline
import scipy.stats as ss
n = 10
w = random.random(size=n)
w = w / sum(w)
topics = []
for i in range(n):
mu = random.uniform(-5,5)
t = ss.norm(mu,1)
topics.append(t)
"""
Explanation: Overview
Generally speaking, a topic model is a probability distribution of words over a document. But what... |
RaspberryJamBe/ipython-notebooks | notebooks/en-gb/Communication - Send mails.ipynb | cc0-1.0 | MAIL_SERVER = "mail.****.com"
FROM_ADDRESS = "noreply@****.com"
TO_ADDRESS = "my_friend@****.com"
"""
Explanation: Requirement:
For sending mail you need an outgoing mail server (that, in the case of this script, also needs to allow unauthenticated outgoing communication). Fill out the required credentials in the folo... |
do-mpc/do-mpc | documentation/source/example_gallery/industrial_poly.ipynb | lgpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import sys
from casadi import *
# Add do_mpc to path. This is not necessary if it was installed via pip
sys.path.append('../../../')
# Import do_mpc package:
import do_mpc
"""
Explanation: Industrial polymerization reactor
In this Jupyter Notebook we illustrate the ... |
icoxfog417/scikit-learn-notebook | scikit-learn-tutorial.ipynb | mit | # enable showing matplotlib image inline
%matplotlib inline
"""
Explanation: Introduction
機械学習とは、その名の通り「機械」を「学習」させることで、あるデータに対して予測を行えるようにすることです。
機械とは、具体的には数理・統計的なモデルになります。
学習とは、そのモデルのパラメータを、実際のデータに沿うよう調整することです。
学習の方法は大きく分けて2つあります。
教師有り学習(Supervised learning): データと、そこから予測されるべき値(正解)を与えることで学習させます。
分類(Classification... |
sys-bio/tellurium | examples/notebooks/core/tellurium_plotting.ipynb | apache-2.0 | import tellurium as te, roadrunner
r = te.loada ('''
$Xo -> S1; k1*Xo;
S1 -> $X1; k2*S1;
k1 = 0.2; k2 = 0.4; Xo = 1; S1 = 0.5;
at (time > 20): S1 = S1 + 0.35
''')
# Simulate the first part up to 20 time units
m = r.simulate (0, 50, 100, ["time", "S1"])
# using latex syntax to render math
r.plot(m... |
Merinorus/adaisawesome | Homework/05 - Taming Text/HW05_awesometeam_Q4.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import networkx as nx
import math
import community
import matplotlib.pyplot as plt
G=nx.Graph()
emails = pd.read_csv('hillary-clinton-emails/emails.csv')
receivers = pd.read_csv('hillary-clinton-emails/EmailReceivers.csv')
emails = emails[pd.notnull(emails['SenderPersonId'])]
n... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/time_series_prediction/labs/3_modeling_bqml.ipynb | apache-2.0 | PROJECT = !(gcloud config get-value core/project)
PROJECT = PROJECT[0]
%env PROJECT = {PROJECT}
%env REGION = "us-central1"
"""
Explanation: Time Series Prediction with BQML and AutoML
Objectives
1. Learn how to use BQML to create a classification time-series model using CREATE MODEL.
2. Learn how to use BQML to cre... |
khalido/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
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... |
raoyvn/deep-learning | tv-script-generation/submission/solution_dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
quantopian/research_public | notebooks/lectures/Mean_Reversion_on_Futures/answers/notebook.ipynb | apache-2.0 | # Useful Functions
def find_cointegrated_pairs(data):
n = data.shape[1]
score_matrix = np.zeros((n, n))
pvalue_matrix = np.ones((n, n))
keys = data.keys()
pairs = []
for i in range(n):
for j in range(i+1, n):
S1 = data[keys[i]]
S2 = data[keys[j]]
resul... |
mspieg/dynamical-systems | LorenzEquations.ipynb | cc0-1.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from mpl_toolkits.mplot3d import Axes3D
from numpy.linalg import eigvals
"""
Explanation: <table>
<tr align=left><td><img align=left src="./images/CC-BY.png">
<td>Text provided under a Creative Commons Attributi... |
lmoresi/UoM-VIEPS-Intro-to-Python | Notebooks/Numpy+Scipy/1 - Introduction to Numpy.ipynb | mit | import numpy as np
## This is a list of everything in the module
np.__all__
an_array = np.array([0,1,2,3,4,5,6])
print an_array
print
print type(an_array)
print
help(an_array)
A = np.zeros((4,4))
print A
print
print A.shape
print
print A.diagonal()
print
A[0,0] = 2.0
print A
np.fill_diagonal(A, 1.0)
print A
B = ... |
tensorflow/docs-l10n | site/ko/guide/distributed_training.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... |
ibm-cds-labs/pixiedust | notebook/Intro to PixieDust Spark 2.x.ipynb | apache-2.0 | !pip install --user --upgrade pixiedust
"""
Explanation: Hello PixieDust!
This sample notebook provides you with an introduction to many features included in PixieDust. You can find more information about PixieDust at https://pixiedust.github.io/pixiedust/. To ensure you are running the latest version of PixieDust unc... |
santiago-salas-v/walas | PAT MeOH Kinetik.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
from tc_lib import *
%matplotlib inline
plt.style.use('seaborn-deep')
# Stoechiometrische Koeffizienten
nuij = np.zeros([len(namen), 3])
# Hydrierung von CO2
nuij[[
namen.index('CO2'),
namen.index('H2'),
namen.index('CH3OH'),
... |
shankari/folium | examples/WidthHeight.ipynb | mit | width, height = 480, 350
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width=width,
height=height,
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_0.html'))
fig
"""
Explanation: Using same width and height trigge... |
jmschrei/pomegranate | tutorials/B_Model_Tutorial_3_Hidden_Markov_Models.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn; seaborn.set_style('whitegrid')
import numpy
from pomegranate import *
numpy.random.seed(0)
numpy.set_printoptions(suppress=True)
%load_ext watermark
%watermark -m -n -p numpy,scipy,pomegranate
"""
Explanation: Hidden Markov Models
author: Jacob Schr... |
squishbug/DataScienceProgramming | 04-Pandas-Data-Tables/HW04/CheckHomework04.ipynb | cc0-1.0 | import pandas as pd
import numpy as np
"""
Explanation: Check Homework HW04
Use this notebook to check your solutions. This notebook will not be graded.
End of explanation
"""
import hw4_answers
reload(hw4_answers)
from hw4_answers import *
"""
Explanation: Now, import your solutions from hw4_answers.py. The follow... |
chi-hung/PythonTutorial | code_examples/KerasMNISTDemo.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
import pandas as pd
import sklearn
import os
import requests
from tqdm._tqdm_notebook import tqdm_notebook
import tarfile
"""
Explanation: Classify handwritten digits with Keras
Data from: the MNIST dataset
Download ... |
zlxs23/Python-Cookbook | data_structure_and_algorithm_py3_6.ipynb | apache-2.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}
# Make a dictionary of tech stocks
tech_names = {'AAPL', 'IBM', 'HPQ', 'MSFT'}
p2 = {key: value for key, v... |
google/xarray-beam | docs/rechunking.ipynb | apache-2.0 | import apache_beam as beam
import numpy as np
import xarray_beam as xbeam
import xarray
def create_records():
for offset in [0, 4]:
key = xbeam.Key({'x': offset, 'y': 0})
data = 2 * offset + np.arange(8).reshape(4, 2)
chunk = xarray.Dataset({
'foo': (('x', 'y'), data),
... |
MonicaGutierrez/PracticalMachineLearningClass | notebooks/02-IntroMachineLearning.ipynb | mit | # Import libraries
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set();
cmap = mpl.colors.ListedColormap(sns.color_palette("hls", 3))
# Create a random set of examples
from sklearn.datasets.samples_generator import make_blobs
X, Y = make_blobs(n_samples=50, centers=2,r... |
Caranarq/01_Dmine | Datasets/CFE/Usuarios Electricos (P0609).ipynb | gpl-3.0 | descripciones = {
'P0609': 'Usuarios Electricos'
}
# Librerias utilizadas
import pandas as pd
import sys
import urllib
import os
import csv
import zipfile
# Configuracion del sistema
print('Python {} on {}'.format(sys.version, sys.platform))
print('Pandas version: {}'.format(pd.__version__))
import platform; prin... |
marcinofulus/LDLtransport | LDL_transport_model.ipynb | gpl-3.0 | %pylab inline
import numpy as np
from scipy.sparse import dia_matrix
import scipy as sp
import scipy.sparse
import scipy.sparse.linalg
import matplotlib
import matplotlib.pyplot as plt
newparams = { 'savefig.dpi': 100, 'figure.figsize': (12/2., 5/2.) }
plt.rcParams.update(newparams)
params = {'legend.fontsize': 8,... |
feststelltaste/software-analytics | notebooks/Knowledge Islands.ipynb | gpl-3.0 | import git
from io import StringIO
import pandas as pd
# connect to repo
git_bin = git.Repo("../../buschmais-spring-petclinic/").git
# execute log command
git_log = git_bin.execute('git log --no-merges --no-renames --numstat --pretty=format:"%x09%x09%x09%aN"')
# read in the log
git_log = pd.read_csv(StringIO(git_log... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/text_models/solutions/automl_for_text_classification_vertex.ipynb | apache-2.0 | import os
import pandas as pd
from google.cloud import bigquery
"""
Explanation: AutoML for Text Classification with Vertex AI
Learning Objectives
Learn how to create a text classification dataset for AutoML using BigQuery
Learn how to train AutoML to build a text classification model
Learn how to evaluate a model t... |
liganega/Gongsu-DataSci | previous/notes2017/old/NB-08-More_About_Functions.ipynb | gpl-3.0 | %load_ext tutormagic
%%tutor
L = [1, 2, 3]
a = L.pop()
L
"""
Explanation: 함수
함수의 활용에 대해 좀 더 자세히 살펴본다.
함수의 부작용(side effect)
return과 print의 활용법
함수의 부작용(side effect)
리스트 관련 메소드인 pop() 함수의 경우 특정값을 리턴하는 것과 더불어 리턴하는 값을 해당 리스트에서 삭제하는 부가 기능을 수행한다. 즉 메모리 상태가 변경된다. 이와같이 함수가 값을 리턴하는 것 이외에 메모리 상태를 변경한다면 이를 함수의 부작용이라 부른다.
예제:... |
dennisobrien/PublicNotebooks | fivethirtyeight/2017-07-14 How long a series.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.misc
import seaborn as sns
def series_win_probability_of_length(n, m, p=0.6, verbose=False):
"""Return the probability of `n` wins for a series of length `m` games with a base win probaility of `p`.
The win... |
JENkt4k/pynotes-general | D3Notes/D3.js Workbook.ipynb | gpl-3.0 | %%writefile tutorial.bar.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
}
</style>
<div class="chart"></div>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>
var... |
jinzishuai/learn2deeplearn | deeplearning.ai/C5.SequenceModel/Week2_NLP_WordEmbeddings/assignment/Word Vector Representation/Operations on word vectors - v1.ipynb | gpl-3.0 | import numpy as np
from w2v_utils import *
"""
Explanation: Operations on word vectors
Welcome to your first assignment of this week!
Because word embeddings are very computionally expensive to train, most ML practitioners will load a pre-trained set of embeddings.
After this assignment you will be able to:
Load pr... |
DaanVanHauwermeiren/data-transformation-analysis | envision/MIME_to_csv.ipynb | mit | import pandas as pd
import os
import sys
import mimetypes
import email
import glob
"""
Explanation: Table of Contents
<p>
converting htm files in MIME format to csv files
load libraries
End of explanation
"""
mht_files = glob.glob(os.path.join(os.path.curdir, '*.mht'))
"""
Explanation: ref: http://stackoverflow.c... |
UDST/activitysim | activitysim/examples/example_mtc/notebooks/getting_started.ipynb | bsd-3-clause | !pip install activitysim
"""
Explanation: Getting Started with ActivitySim
This getting started guide is a Jupyter notebook. It is an interactive Python 3 environment that describes how to set up, run, and begin to analyze the results of ActivitySim modeling scenarios. It is assumed users of ActivitySim are familiar w... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/gls.ipynb | bsd-3-clause | import statsmodels.api as sm
"""
Explanation: Generalized Least Squares
End of explanation
"""
data = sm.datasets.longley.load(as_pandas=False)
data.exog = sm.add_constant(data.exog)
print(data.exog[:5])
"""
Explanation: The Longley dataset is a time series dataset:
End of explanation
"""
ols_resid = sm.OLS(data... |
terencezl/scientific-python-walkabout | scientific-python-walkabout.ipynb | mit | # copying a referecne vs copying as a new list
# copying a refernce
a = [3,4,5]
b = a
print(b is a)
b[2] = 555
print(a, b)
# slice copying as a new list
a = [3,4,5]
b = a[:] # meaning slicing all
print(b is a)
b[2] = 666
print(a, b)
# removing something from a list
# wrong
a = [1,2,3,3,3,3,4]
for i in a:
if i =... |
milesgranger/cluster-clyde | examples/Demo.ipynb | mit | %matplotlib inline
# Hide info messages from paramiko
import logging
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.WARN)
import time
import random
import threading
import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
import matplotlib.pyplot as ... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/sandbox-1/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-1', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CMCC
Source ID: SANDBOX-1
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbul... |
ga7g08/ga7g08.github.io | _notebooks/2015-07-22-Setting-nice-axes-labels-in-matplotlib.ipynb | mit | x = np.linspace(0, 10, 1000)
y = 1e10 * np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
plt.show()
"""
Explanation: Setting nice axes labels in matplotlib
In this post I want to collect some ideas I had on setting nice labels in matplotlib. In particular, for scientific papers we usually want a label like "time [s]"... |
IBMStreams/streamsx.topology | samples/python/topology/notebooks/MultiGraph/MultiGraph.ipynb | apache-2.0 | from streamsx.topology.topology import Topology
from streamsx.topology import context
from some_module import jsonRandomWalk, movingAverage
#from streamsx import rest
import json
# Define operators
rw = jsonRandomWalk()
ma_150 = movingAverage(150)
ma_50 = movingAverage(50)
# Define topology & submit
top = Topology("m... |
lisitsyn/shogun | doc/ipython-notebooks/neuralnets/autoencoders.ipynb | bsd-3-clause | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from scipy.io import loadmat
from shogun import features, MulticlassLabels, Math
# load the dataset
dataset = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat'))
Xall = dataset['data']
# the usps dataset... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.