repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
abatula/MachineLearningIntro | SVM_Tutorial.ipynb | gpl-2.0 | # Print figures in the notebook
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import datasets # Import the dataset from scikit-learn
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split, KFold
# Import patch... |
chi-hung/PythonTutorial | tutorials/MatplotlibTutorial.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
%matplotlib inline
sns.set()
"""
Explanation: 目的:熟悉Matplotlib套件的使用
以點加線的方式,於一張圖上畫sin(x),並給定x, y軸名稱,給定圖的標題為my plot
將linewidth(線寬)設定為零
更改x範圍至[0, π ], y範圍至[0,1]
以plt.subplot()畫兩張圖,一張在左,為sin(x);另一張在右,為cos(x)
以plt.subplots()建圖
以pl... |
Applied-Groundwater-Modeling-2nd-Ed/Chapter_4_problems-1 | P4.2_Flopy_dam_cross_section.ipynb | gpl-2.0 | %matplotlib inline
import sys
import os
import shutil
import numpy as np
from subprocess import check_output
# Import flopy
import flopy
"""
Explanation: <img src="AW&H2015.tiff" style="float: left">
<img src="flopylogo.png" style="float: center">
Problem P4.2 Profile under a dam
In Problem P4.2 from page 172-173 in ... |
enakai00/jupyter_ml4se_commentary | Solutions/03-Random Numbers-solution.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
"""
Explanation: 確率分布と乱数の取得
End of explanation
"""
from numpy.random import randint
randint(1,7,2)
"""
Explanation: 練習問題
(1) 2個のサイコロを振った結果をシュミレーションします。次の例のように、1〜6の整数のペアを含むarrayを乱数で生成してください。
End of explanation... |
timothyb0912/pylogit | examples/notebooks/Prediction with PyLogit.ipynb | bsd-3-clause | # For recording the model specification
from collections import OrderedDict
# For making plots pretty
import seaborn
# For file input/output
import pandas as pd
# For vectorized math operations
import numpy as np
# For plotting
import matplotlib.pyplot as plt
# For model estimation and prediction
import pylogit as p... |
Almaz-KG/MachineLearning | ml-for-finance/python-for-financial-analysis-and-algorithmic-trading/01-Python-Crash-Course/Python Crash Course Exercises .ipynb | apache-2.0 | price = 300
import math
math.sqrt( price )
import math
math.sqrt( price )
"""
Explanation: Python Crash Course Exercises
This is an optional exercise to test your understanding of Python Basics. The questions tend to have a financial theme to them, but don't look to deeply into these tasks themselves, many of them d... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160608수_13일차_회귀분석 실습, 과최적화/1.보스턴 부동산 실습.ipynb | mit | # sns.pairplot(df_all, diag_kind="kde", kind="reg")
# plt.show()
sns.jointplot("RM", "MEDV", data=df)
plt.show()
import statsmodels.api as sm
model = sm.OLS(df.ix[:, -1], df.ix[:, :-1])
result = model.fit()
print(result.summary())
"""
Explanation: png, jpeg와 SVG의 차이. 만약 scatter plot 같은 경우 scatter가 매우 많을 때에는 png보다 용... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160601수_11일차_데이터 전처리 Data Preprocessing, (결정론적)선형 회귀 분석 Linear Regression Analysis/4.레버리지와 아웃라이어.ipynb | mit | from sklearn.datasets import make_regression
X0, y, coef = make_regression(n_samples=100, n_features=1, noise=20, coef=True, random_state=1)
# add high-leverage points
X0 = np.vstack([X0, np.array([[4], [3]])])
X = sm.add_constant(X0)
y = np.hstack([y, [300, 150]])
plt.scatter(X0, y)
plt.show()
model = sm.OLS(pd.Dat... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 2 Supervised learning/Lectures notebooks/7 bike sharing demand part 1/sklearn.case_part1.ipynb | mit | from sklearn import cross_validation, grid_search, linear_model, metrics
import numpy as np
import pandas as pd
%pylab inline
"""
Explanation: Sklearn
Bike Sharing Demand
Задача на kaggle: https://www.kaggle.com/c/bike-sharing-demand
По историческим данным о прокате велосипедов и погодным условиям необходимо оценить... |
BeyondTheClouds/enoslib | docs/jupyter/02_observability.ipynb | gpl-3.0 | import enoslib as en
# Enable rich logging
_ = en.init_logging()
# claim the resources
network = en.G5kNetworkConf(type="prod", roles=["my_network"], site="rennes")
conf = (
en.G5kConf.from_settings(job_type="allow_classic_ssh", job_name="enoslib_observability")
.add_network_conf(network)
.add_machine(
... |
desihub/desitarget | doc/nb/mws-interpolation.ipynb | bsd-3-clause | %pylab inline
import os
import numpy as np
import fitsio
import matplotlib.pyplot as plt
from desisim.io import read_basis_templates
import matplotlib as mpl
mpl.rcParams.update({'font.size': 16})
"""
Explanation: Interpolating the DESI stellar templates
The goal of this notebook is to demonstrate how the DESI ste... |
gfeiden/MagneticUpperSco | notes/imf.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Impact on Initial Mass Function
When determining stellar masses in young stellar associations, non-magnetic models are often adopted. However, if magnetic inhibition of convection is an important process in governing the structure o... |
kota7/mecabwrap-py | notebook/mecabwrap - Python Interface to MeCab for Unix and Windows.ipynb | mit | # Version for this notebook
!pip list | grep mecabwrap
"""
Explanation: mecabwrap
A Python Interface to MeCab for Unix and Windows
<table align="left">
<tr>
<td>
<a href="https://travis-ci.org/kota7/mecabwrap-py" target="_blank">
<img src="https://travis-ci.org/kota7/mecabwrap-py.svg?branch... |
mari-linhares/tensorflow-workshop | code_samples/RNN/weather_prediction/.ipynb_checkpoints/Lakshmanan-checkpoint.ipynb | apache-2.0 | #!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
root-mirror/training | SoftwareCarpentry/06-rdataframe-basics.ipynb | gpl-2.0 | import ROOT
treename = "dataset"
filename = "data/example_file.root"
df = ROOT.RDataFrame(treename, filename)
print(f"Columns in the dataset: {df.GetColumnNames()}")
"""
Explanation: ROOT RDataFrame
RDataFrame documentation
ROOT's high-level analysis interface. Users define their analysis as a sequence of operations... |
google/starthinker | colabs/trends_places_to_sheets_via_query.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: Trends Places To Sheets Via Query
Move using a WOEID query.
License
Copyright 2020 Google LLC,
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 ... |
wzxiong/DAVIS-Machine-Learning | labs/lab3.ipynb | mit | # %load ../standard_import.txt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import scale
from sklearn.model_selection import LeaveOneOut
from sklearn.linear_model import LinearRegression, lars_path, Lasso, LassoCV
%matplotlib inline
n=100
p=1000
X = np.random.rand... |
mayank-johri/LearnSeleniumUsingPython | Section 3 - Machine Learning/libs/core_libs/numpy/numpy.ipynb | gpl-3.0 | import numpy as np
a = np.array([1, 4, 5, 66, 77, 334], float)
print(a)
import matplotlib.pyplot as plt
plt.plot(a)
plt.show()
"""
Explanation: Numpy
NumPy is a Python library, which is mainly used for scientific computing. It contains a collection of tools and techniques that can be used to resolve number of proble... |
AllenDowney/ModSimPy | notebooks/trees.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... |
eriksalt/jupyter | Python Quick Reference/Classes.ipynb | mit | # simple definition. All member functions must take parameter self (this in c++)
class Car:
def drive(self):
print('vroom vroom...')
miata = Car()
miata.drive()
"""
Explanation: Python Classes Quick Reference
Table Of Contents
<a href="#1.-Simple-Class">Simple Class</a>
<a href="#2.-Member-Vari... |
Kaggle/learntools | notebooks/sql/raw/tut1.ipynb | apache-2.0 | from google.cloud import bigquery
"""
Explanation: Introduction
Structured Query Language, or SQL, is the programming language used with databases, and it is an important skill for any data scientist. In this course, you'll build your SQL skills using BigQuery, a web service that lets you apply SQL to huge datasets.
I... |
YuriyGuts/kaggle-quora-question-pairs | notebooks/feature-magic-pagerank.ipynb | mit | from pygoose import *
import hashlib
"""
Explanation: Feature: PageRank on Question Co-Occurrence Graph
This is a "magic" (leaky) feature that exploits the patterns in question co-occurrence graph (based on the kernel by @zfturbo).
Imports
This utility package imports numpy, pandas, matplotlib and a helper kg module ... |
martinjrobins/hobo | examples/sampling/adaptive-covariance-dram.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pints
import pints.plot
import pints.toy
# Load a forward model
model = pints.toy.LogisticModel()
# Create some toy data
real_parameters = [0.015, 500]
times = np.linspace(0, 1000, 1000)
org_values = model.simulate(real_parameters, times)
# Add noise
noise = ... |
tuanavu/coursera-university-of-washington | machine_learning/2_regression/assignment/week2/numpy-tutorial.ipynb | mit | import numpy as np # importing this way allows us to refer to numpy as np
"""
Explanation: Numpy Tutorial
Numpy is a computational library for Python that is optimized for operations on multi-dimensional arrays. In this notebook we will use numpy to work with 1-d arrays (often called vectors) and 2-d arrays (often cal... |
vorth/ipython | heptagons/Sevenfold Rotation.ipynb | apache-2.0 | # load the definitions from the previous notebooks
%run DrawingTheHeptagon.py
r = sigma-rho
s = rho-1
t = one-rho # the __sub__ function requires a HeptagonNumber on the left, so "1-rho" won't work
u = rho-1
def rotate(v) :
x, y = v
return ( r*x + t*y, s*x + u*y )
def plusv( v1, v2 ) :
h1, h2 = v1
h3... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/statespace_local_linear_trend.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from scipy.stats import norm
import statsmodels.api as sm
import matplotlib.pyplot as plt
"""
Explanation: State space modeling: Local Linear Trends
This notebook describes how to extend the statsmodels statespace classes to create and estimate a custom model.... |
agiovann/Constrained_NMF | demos/notebooks/demo_Ring_CNN.ipynb | gpl-2.0 | get_ipython().magic('load_ext autoreload')
get_ipython().magic('autoreload 2')
from IPython.display import display, clear_output
import glob
import logging
import numpy as np
import os
import cv2
logging.basicConfig(format=
"%(relativeCreated)12d [%(filename)s:%(funcName)20s():%(lineno)s] [%... |
AlJohri/DAT-DC-12 | notebooks/human_learning.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
# display plots in the notebook
%matplotlib inline
# increase default figure and font sizes for easier viewing
plt.rcParams['figure.figsize'] = (8, 6)
plt.rcParams['font.size'] = 14
"""
Explanation: Exercise: "Human learning" with iris data
Question: Can you predic... |
rainyear/pytips | Tips/2016-05-02-Class-and-Metaclass-ii.ipynb | mit | print(type(12))
print(type('python'))
class A:
pass
print(type(A))
"""
Explanation: Python 类与元类的深度挖掘 II
上一篇解决了通过调用类对象生成实例对象过程中可能遇到的命名空间相关的一些问题,这次我们向上回溯一层,看看类对象本身是如何产生的。
我们知道 type() 方法可以查看一个对象的类型,或者说判断这个对象是由那个类产生的:
End of explanation
"""
print(type.__doc__)
"""
Explanation: 通过这段代码可以看出,类对象 A 是由type() 产生的,也就是说 ty... |
trungdong/datasets-provanalytics-dmkd | Extra 3.1 - Historical Provenance - Application 2.ipynb | mit | import pandas as pd
df = pd.read_csv("collabmap/ancestor-graphs.csv", index_col='id')
df.head()
df.describe()
"""
Explanation: Extra 3.1 - Historical Provenance - Application 2: CollabMap Data Quality
Assessing the quality of crowdsourced data in CollabMap from their provenance.
In this notebook, we explore the perf... |
as595/AllOfYourBases | CDT-KickOff/TUTORIAL/KeplerLightCurveCelerite.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: KeplerLightCurveCelerite.ipynb
‹ KeplerLightCurve.ipynb › Copyright (C) ‹ 2017 › ‹ Anna Scaife - anna.scaife@manchester.ac.uk ›
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Softwar... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/image_feature_vector.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
ES-DOC/esdoc-jupyterhub | notebooks/cams/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cams', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CAMS
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbul... |
sebastian-janisch/udacity-machine-learning-nano-degree | capstone-project/Capstone-Project.ipynb | mit | import numpy as np
import pandas as pd
from data import QuandlYahooDataService
from data import FlatFileDataService
from data import FinancialDataService
import portfolioopt as pfopt
import datetime as datetime
import TradingAgent as TradingAgent
%matplotlib inline
path = '../data/'
fds = FinancialDataService(FlatFi... |
GoogleCloudPlatform/training-data-analyst | blogs/bigquery_datascience/bigquery_datascience.ipynb | apache-2.0 | %%bigquery df
WITH rawnumbers AS (
SELECT
departure_delay,
COUNT(1) AS num_flights,
COUNTIF(arrival_delay < 15) AS num_ontime
FROM
`bigquery-samples.airline_ontime_data.flights`
GROUP BY
departure_delay
HAVING
num_flights > 100
),
totals AS (
SELECT
SUM(num_flights) AS tot_flights,
SUM(num_ontime) AS... |
IST256/learn-python | content/lessons/11-WebAPIs/LAB-WebAPIs.ipynb | mit | # Run this to make sure you have the pre-requisites!
!pip install -q requests
# start by importing the modules we will need
import requests
import json
"""
Explanation: Class Coding Lab: Web Services and APIs
Overview
The web has long evolved from user-consumption to device consumption. In the early days of the web ... |
cgrudz/cgrudz.github.io | teaching/stat_775_2021_fall/activities/activity-2021-09-08.ipynb | mit | odds = [1, 3, 5, 7]
print('odds are:', odds)
"""
Explanation: Introduction to Python part VI (And a discussion of random vectors)
Activity 1: Discussion of multiple random variables
How is the notion of the expected value extended into multiple variables? What does this represent?
What is a marginal distribution / ... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_roi_erpimage_by_rt.ipynb | bsd-3-clause | # Authors: Jona Sassenhagen <jona.sassenhagen@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.datasets import testing
from mne import Epochs, io, pick_types
from mne.event import define_target_events
print(__doc__)
"""
Explanation: ===========================================================
Plot single tr... |
dtamayo/MachineLearning | Day2/titanic_svm.ipynb | gpl-3.0 | #import all the needed package
import numpy as np
import scipy as sp
import re
import pandas as pd
import sklearn
from sklearn.cross_validation import train_test_split,cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn import metrics
import matplotlib
from matplotlib import pyplot as plt
%ma... |
griffinfoster/fundamentals_of_interferometry | 4_Visibility_Space/4_5_2_uv_coverage_improving_your_coverage.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: <a id='beginning'></a> <!--\label{beginning}-->
* Outline
* Glossary
* 4. The Visibility space
* Previous: 4.5.1 UV Coverage: UV tracks
* Next:... |
elsonidoq/fito | examples/Iris Setosa.ipynb | mit | %matplotlib nbagg
%pylab
"""
Explanation: Very simple model selection example
End of explanation
"""
from fito.data_store import FileDataStore
ds = FileDataStore('caches')
"""
Explanation: In this example I want to show some of fito's features by example.
I'm going to use the famous Iris-Setosa dataset and perform... |
gitreset/Data-Science-45min-Intros | adaboost-101/adaboost_tutorial.ipynb | unlicense | # base requirements
from IPython.display import Image
from IPython.display import display
from datetime import *
import json
from copy import *
from pprint import *
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import json
import rpy2
%load_ext rpy2.ipython
%R require("ggplot2")
% matplotlib i... |
fggp/ctcsound | cookbook/09-showing-kvals.ipynb | lgpl-2.1 | %matplotlib qt5
"""
Explanation: Showing Csound k-Values in Matplotlib Animation
The goal of this notebook is to show how Csound control signals can be seen in real-time in the Python Matplotlib using the Animation module. This can be quite instructive for teaching Csound. Written by Joachim Heintz, August 2019.
Choos... |
mldbai/mldb | container_files/tutorials/Executing JavaScript Code Directly in SQL Queries Using the jseval Function Tutorial.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection("http://localhost")
"""
Explanation: Executing JavaScript Code Directly in SQL Queries Using the jseval Function Tutorial
MLDB provides a complete implementation of the SQL SELECT statement. Most of the functions you are used to using are available in your queries.
MLDB... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/ec-earth3-gris/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3-gris', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: EC-EARTH3-GRIS
Topic: Atmos
Sub-T... |
rahulkgup/deep-learning-foundation | gan_mnist/Intro_to_GANs_Solution.ipynb | mit | %matplotlib inline
import pickle as pkl
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')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
antoniomezzacapo/qiskit-tutorial | qiskit/aqua/chemistry/basic_howto.ipynb | apache-2.0 | from qiskit_aqua_chemistry import AquaChemistry
"""
Explanation: <img src="../../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left">
Qiskit Aqua: Chemistry basic how to
The latest version of this note... |
dsacademybr/PythonFundamentos | Cap01/DSA-Python-Cap01-ComoUtilizarJupyterNotebook.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</font>
<font color='blue'>Capítulo 1</font>
End of explanation
"""
print("Hello World")
2... |
MMesch/SHTOOLS | examples/notebooks/tutorial_3.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function # only necessary if using Python 2.x
import matplotlib.pyplot as plt
import numpy as np
from pyshtools.shclasses import SHCoeffs, SHGrid, SHWindow
lmax = 200
coeffs = np.zeros((2, lmax+1, lmax+1))
coeffs[0, 5, 2] = 1.
"""
Explanation: The pyshtools Class Inter... |
Jim00000/Numerical-Analysis | 6_Ordinary_Differential_Equations.ipynb | unlicense | # Import modules
import math
import numpy as np
import scipy
from scipy.integrate import ode
from matplotlib import pyplot as plt
"""
Explanation: ★ Ordinary Differential Equations ★
End of explanation
"""
def euler_method(f, a, b, y0, step=10):
t = a
w = y0
ws = np.zeros(step + 1)
ws[0] = y0
h =... |
manifoldai/merf | notebooks/Rossman Kaggle Data.ipynb | mit | %matplotlib inline
%reload_ext autoreload
%autoreload 2
import os, sys
import re
sys.path.append('..')
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context("poster")
import numpy as np
from sklearn.ensemble import RandomForestRegressor
import pandas as pd
from IPython.display import HTML, display
impo... |
skkandrach/foundations-homework | data-databases/Homework_5.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html = urlopen("http://static.decontextualize.com/cats.html").read()
document = BeautifulSoup(html, "html.parser")
"""
Explanation: Homework #5
This homework presents a sophisticated scenario in which you must design a SQL schema, insert data into it, an... |
ledeprogram/algorithms | class5/homework/Skinner_Barnaby_5_4.ipynb | gpl-3.0 | import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import statsmodels.formula.api as smf
"""
Explanation: Assignment 4
Using data from this FiveThirtyEight post, write code to calculate the correlation of the responses from the poll. Respond to the story in your PR. Is this a good example of data j... |
ajaybhat/DLND | Project 5/dlnd_face_generation.ipynb | apache-2.0 | data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input/R5KrjnANiKVhLWAkpXhNBe'
import time
import pylab as pl
from IPython import display
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', dat... |
bzamecnik/ml | snippets/keras/lstm_hello_world.ipynb | mit | %matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
mpl.rc('image', interpolation='nearest', cmap='gray')
mpl.rc('figure', figsize=(20,10))
"""
Explanation: Hello, LSTM!
In this project we'd like to explore the basic usage of LSTM (Long Short-Term Memory) which is a flavor o... |
asharel/ml | LAB4/src/practica_svm.ipynb | gpl-3.0 | # Imports
import numpy as np
import svm as svm
from sklearn.metrics.pairwise import polynomial_kernel
from sklearn.metrics.pairwise import rbf_kernel
# Datos de prueba:
n = 10
m = 8
d = 4
x = np.random.randn(n, d)
y = np.random.randn(m, d)
print (x.shape)
print (y.shape)
"""
Explanation: <font color="#04B404"><h1 al... |
xpharry/Udacity-DLFoudation | tutorials/gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
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')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
tiddler/AdversarialMNIST | notebook/AdversarialMNIST_sketch.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('/tmp/tensorflow/mnist/input_data', one_hot=True)
import seaborn as sns
sns.set_style('white')
colors_list = sns.color_palette("Paired", 10)
"""
Explanation: This is a sketch for Adversarial images in ... |
nanounanue/xvii-coneest-2015 | workshop/Introduccion_pyspark.ipynb | gpl-3.0 | def repetir(texto, num_veces):
return texto*num_veces
monty = "Monty Python "
repetir(monty, 3)
repetir("Hola Puno ", 5)
"""
Explanation: Python
Python como lenguaje tiene las siguientes características:
Alto nivel
Intepretado
Orientado a objetos (pero en realidad multiparadigma)
Ejemplo de programa
Para mostr... |
csdms/pymt | notebooks/sedflux3d.ipynb | mit | # Some magic to make plots appear within the notebook
%matplotlib inline
import numpy as np # In case we need to use numpy
import pymt.models
"""
Explanation: Sedflux3D
Link to this notebook: https://github.com/csdms/pymt/blob/master/notebooks/sedflux3d.ipynb
Install command: $ conda install notebook pymt_sedflux
... |
louridas/rwa | content/notebooks/chapter_08.ipynb | bsd-2-clause | def read_graph(filename, directed=False):
graph = {}
with open(filename) as input_file:
for line in input_file:
parts = line.split()
if len(parts) != 3:
continue # not a valid line, ignore
[n1, n2, w] = [ int (x) for x in parts ]
if n1 not ... |
xR86/ml-stuff | kaggle/machine-learning-with-a-heart/Lab4.ipynb | mit | import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import graphviz
import sklearn.tree
import sklearn.neighbors
import sklearn.naive_bayes
import sklearn.svm
import sklearn.metrics
import sklearn.preprocessing
import sklearn.model_selection
"""
Explanation: Tema 4.1 <a class="tocSkip"... |
gwachob/benford-notebook | benfords-law.ipynb | mit | first_digit(100)
first_digit(399)
"""
Explanation: That was exciting
End of explanation
"""
import random
def do_drawing(bucket_size, runs):
digits = [first_digit(random.randint(1,bucket_size)) for x in range(runs)]
return digits
"""
Explanation: Now, we're going to simulate picking numbers out of a hat, d... |
serenejiang/MrOS_VitaminD | notebooks/1.1 clean_mapping_biom.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
"""
Explanation: proper reading of biom table (output: biomtable.txt)
proper distinguishment between categorical and continous variables in mapping file
(output: mapping_cleaned_MrOS.txt)
End of explanation
"""
# convert... |
infilect/ml-course1 | keras-notebooks/ANN/3.6-classifying-newswires.ipynb | mit | from keras.datasets import reuters
(train_data, train_labels), (test_data, test_labels) = reuters.load_data(num_words=10000)
"""
Explanation: Classifying newswires: a multi-class classification example
This notebook contains the code samples found in Chapter 3, Section 5 of Deep Learning with Python. Note that the or... |
sdpython/ensae_teaching_cs | _doc/notebooks/competitions/2016/td2a_eco_competition_modeles_logistiques.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.ml - 2016 - Compétition ENSAE - Premiers modèles
Une compétition était proposée dans le cadre du cours Python pour un Data Scientist à l'ENSAE. Ce notebook facilite la prise en main des données et propose de mettre en oeuvre un modèle ... |
oroszl/szamprob | notebooks/Package02/mintapelda02.ipynb | gpl-3.0 | if 2+2==4:
print('A matematika még mindig működik')
"""
Explanation: Alapvető vezérlőutasítások
Bonyolultabb programok sok egymás után következő utasítás végrehajtásából állnak. Azt, hogy melyik utasítás mikor kerül végrehajtásra, a vezérlőutasítások határozzák meg. Minden program nyelvben két alapvető vezérlő ut... |
rvperry/phys202-2015-work | midterm/AlgorithmsEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact
"""
Explanation: Algorithms Exercise 3
Imports
End of explanation
"""
def char_probs(s):
"""Find the probabilities of the unique characters in the string s.
Parameters
----------
... |
zhaojijet/UdacityDeepLearningProject | examples/Sentiment RNN.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
with open('../sentiment_network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment_network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
pagutierrez/tutorial-sklearn | notebooks-spanish/06-aprendizaje_supervisado_regresion.ipynb | cc0-1.0 | x = np.linspace(-3, 3, 100)
print(x)
rng = np.random.RandomState(42)
y = np.sin(4 * x) + x + rng.uniform(size=len(x))
plt.plot(x, y, 'o');
"""
Explanation: Aprendizaje supervisado parte 2 -- Regresión
En regresión intentamos predecir una variable continua de salida -- al contrario que las variables nominales que pre... |
PrairieLearn/PrairieLearn | exampleCourse/questions/demo/annotated/MarkovChainGroupActivity/MarkovChains-Gambler/workspace/Markov-Chains-2.ipynb | agpl-3.0 | #grade (enter your code in this cell - DO NOT DELETE THIS LINE)
"""
Explanation: The Gambler's Ruin and Reducibility
Consider a gambler starting with some amount of money, say $\$1$.
The gambler is playing a game where they could either win $\$1$ or lose $\$1$ with equal probability. The goal is to win $\$3$ before... |
mclaughlin6464/pearce | notebooks/Make SHAM Cfg for MCMC Analysis SLAC.ipynb | mit | import yaml
import copy
from os import path
import numpy as np
orig_cfg_fname = '/home/users/swmclau2//Git/pearce/bin/mcmc/nh_gg_sham_hsab_mcmc_config.yaml'
with open(orig_cfg_fname, 'r') as yamlfile:
orig_cfg = yaml.load(yamlfile)
orig_cfg
#this will enable easier string formatting
sbatch_template = """#!/bin/b... |
dtamayo/reboundx | ipython_examples/StochasticForcesCartesian.ipynb | gpl-3.0 | import rebound
sim = rebound.Simulation()
sim.add(m=1.) # free floating particle
"""
Explanation: Adding stochastic forces in cartesian coordinates
In this example, we add a stochastic force in the x and y direction to a free floating particle.
End of explanation
"""
sim.integrator = "leapfrog"
sim.dt = 0.01
"""
Ex... |
datascienceinc/workshops | food_deserts/06-food-deserts-first-attempt.ipynb | cc0-1.0 | !sudo pip install pyshp
%matplotlib inline
import matplotlib.pyplot as plt
import osmapi
import matplotlib
import matplotlib.cm as cm
import requests
import matplotlib.pyplot as plt
from matplotlib.colors import colorConverter
from scipy import spatial
import numpy as np
import pandas as pd # odd dependency, must impo... |
lehnertu/TEUFEL | scripts/ToroidalMirror_OL8.ipynb | gpl-3.0 | import numpy as np
from scipy import constants
import pygmsh
from MeshedFields import *
"""
Explanation: If not yet available some libraries and their python bindings have to be installed :<br>
- gmsh (best installed globally through package management system)
- python3 -m pip install pygmsh --user
- VTK (best install... |
johnpfay/environ859 | 07_DataWrangling/notebooks/03-Getting-to-know-Pandas.ipynb | gpl-3.0 | #Import the package
import pandas as pd
"""
Explanation: What is Pandas?
One of the best options for working with tabular data in Python is to use the Python Data Analysis Library (a.k.a. Pandas). The Pandas library provides data structures, produces high quality plots with matplotlib and integrates nicely with other ... |
snucsne/CSNE-Course-Source-Code | CSNE2444-Intro-to-CS-I/jupyter-notebooks/ch12-tuples.ipynb | mit | a_tuple = ( 'a', 'b', 'c', 'd', 'e' )
a_tuple = 'a', 'b', 'c', 'd', 'e'
a_tuple = 'a',
type( a_tuple )
"""
Explanation: Chapter 12: Tuples
Contents
- Tuples are immutable
- Tuple assignment
- Tuples as return values
- Variable-length argument tuples
- Lists and tuples
- Dictionaries and tuples
- Comparing tuples
- S... |
drericstrong/Blog | 20170308_AbaloneWithKerasPart3.ipynb | agpl-3.0 | # Data preprocessing from Part 1
import datetime
import pandas as pd
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Dense
abalone_df = pd.read_csv('abalone.csv',names=['Sex','Length','Diameter','Height',
'Whole Weight','Shucked Weight', 'Viscera Wei... |
rainyear/pytips | Tips/2016-03-24-Sort-and-Sorted.ipynb | mit | from random import randrange
lst = [randrange(1, 100) for _ in range(10)]
print(lst)
lst.sort()
print(lst)
"""
Explanation: Python 内置排序方法
Python 提供两种内置排序方法,一个是只针对 List 的原地(in-place)排序方法 list.sort(),另一个是针对所有可迭代对象的非原地排序方法 sorted()。
所谓原地排序是指会立即改变被排序的列表对象,就像 append()/pop() 等方法一样:
End of explanation
"""
lst = [randrange... |
bayesimpact/bob-emploi | data_analysis/notebooks/datasets/rome/update_from_v331_to_v332.ipynb | gpl-3.0 | import collections
import glob
import os
from os import path
import matplotlib_venn
import pandas
rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv')
OLD_VERSION = '331'
NEW_VERSION = '332'
old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION)))
new_version_files = frozenset(glob.g... |
alexgorban/models | research/deeplab/deeplab_demo.ipynb | apache-2.0 | import os
from io import BytesIO
import tarfile
import tempfile
from six.moves import urllib
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
from PIL import Image
%tensorflow_version 1.x
import tensorflow as tf
"""
Explanation: Overview
This colab demonstrates the steps to use... |
tensorflow/graphics | tensorflow_graphics/notebooks/mesh_segmentation_demo.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... |
jennybrown8/python-notebook-coding-intro | lesson9exercises.ipynb | apache-2.0 | # Run this before you run the cells below. It sets up our data tools.
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
"""
Explanation: Bonus: Data Processing and Graphing Demo
This is an exploration of cleaning up data for purposes of graphing. Run the cell just below to set up the gr... |
julienchastang/unidata-python-workshop | failing_notebooks/CompositeRadar.ipynb | mit | # Set-up for notebook
%matplotlib inline
# Some needed imports
import datetime as dt
import matplotlib.pyplot as plt
import matplotlib as mpl
import cartopy
import numpy as np
from netCDF4 import Dataset
from siphon.catalog import TDSCatalog
from metpy.plots import ctables
"""
Explanation: <div style="width:1000 px">... |
Haishi2016/Vault818 | Water-Treatment/Perceptron and LTU.ipynb | mit | import numpy as np
from sklearn.datasets import load_iris
from sklearn.linear_model import Perceptron
iris = load_iris()
X = iris.data[:, (2,3)] # petal Length, petal width
y = (iris.target == 0).astype(np.int)
per_clf = Perceptron(max_iter=100, tol=-np.infty, random_state=42)
per_clf.fit(X, y)
y_pred = per_clf.pred... |
ljubisap/ml-dojo-part-I | Machine Learning Dojo - Part I.ipynb | apache-2.0 | from IPython.display import Image, display, HTML
Image("images/munich.jpg")
display(HTML("<table><tr><td><p><b>Rain Princess - Leonid Afremov</b></p><img src='images/princess.jpeg'></td><td><b><p>Munich + Rain Princess + Machine Learning</b></p><img src='images/munich-princess-out.jpg'></td></tr></table>"))
display(H... |
ealogar/curso-python | advanced/0_Iterators_generators_and_coroutines.ipynb | apache-2.0 | spam = [0, 1, 2, 3, 4]
for item in spam:
print item
else:
print "Looped whole list"
# What is really happening here?
it = iter(spam) # Obtain an iterator
try:
item = it.next() # Retrieve first item through the iterator
while True:
# Body of the... |
npuichigo/ttsflow | third_party/tensorflow/tensorflow/tools/docker/notebooks/3_mnist_from_scratch.ipynb | apache-2.0 | from __future__ import print_function
from IPython.display import Image
import base64
Image(data=base64.decodestring("iVBORw0KGgoAAAANSUhEUgAAAMYAAABFCAYAAAARv5krAAAYl0lEQVR4Ae3dV4wc1bYG4D3YYJucc8455yCSSIYrBAi4EjriAZHECyAk3rAID1gCIXGRgIvASIQr8UTmgDA5imByPpicTcYGY+yrbx+tOUWpu2e6u7qnZ7qXVFPVVbv2Xutfce+q7hlasmTJktSAXrnn8... |
atlury/deep-opencl | DL0110EN/6.1.3.Activation max pooling .ipynb | lgpl-3.0 | import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage, misc
import torch.nn.functional as F
"""
Explanation: <div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="http://cocl.us/pytorch_link_top"><img src = "http://cocl.us/Pytorch_top" ... |
CopernicusMarineInsitu/INSTACTraining | PythonNotebooks/PlatformPlots/Plot_TimeSeries1.ipynb | mit | datafile = "~/CMEMS_INSTAC/INSITU_MED_NRT_OBSERVATIONS_013_035/history/mooring/IR_TS_MO_61198.nc"
"""
Explanation: Read variables and units
We assume the data file is present in the following directory:
End of explanation
"""
import os
datafile = os.path.expanduser(datafile)
with netCDF4.Dataset(datafile, 'r') as d... |
dlsun/symbulate | docs/graphics.ipynb | mit | from symbulate import *
%matplotlib inline
"""
Explanation: Symbulate Documentation
Symbulate Graphics
The .plot() method produces a graphic of simulated values of random variables or processes.
<a id='contents'></a>
Rug plot of individual values
Impulse plot
Histogram
Density
Scatterplot
Tile plot
Two-dimensional hi... |
elastic/examples | Machine Learning/Query Optimization/notebooks/doc2query - 2 - best_fields.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
import importlib
import os
import sys
from copy import deepcopy
from elasticsearch import Elasticsearch
from skopt.plots import plot_objective
# project library
sys.path.insert(0, os.path.abspath('..'))
import qopt
importlib.reload(qopt)
from qopt.notebooks import evaluate_mrr100... |
tensorflow/text | docs/tutorials/transformer.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... |
tensorflow/docs-l10n | site/zh-cn/tutorials/generative/cvae.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... |
MoonRaker/siphon | examples/notebooks/wms/ncWMS_Example.ipynb | mit | import cartopy
import matplotlib as mpl
import matplotlib.pyplot as plt
from owslib.wms import WebMapService
from siphon.catalog import get_latest_access_url
"""
Explanation: How to use Siphon and Cartopy to visualize data served by a THREDDS Data Server (TDS) via ncWMS
End of explanation
"""
catalog = 'http://thred... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/launching_into_ml/labs/first_model.ipynb | apache-2.0 | import os
"""
Explanation: First BigQuery ML models for Taxifare Prediction
In this notebook, we will use BigQuery ML to build our first models for taxifare prediction.
BigQuery ML provides a fast way to build ML models on large structured and semi-structured datasets.
Learning objectives
Choose the correct BigQuery ... |
RobinCPC/algorithm-practice | Basic/BinaryTree.ipynb | mit | class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
if __name__ == '__main__':
rootNode = TreeNode(5)
rootNode.left = TreeNode(4)
rootNode.right = TreeNode(6)
print rootNode.val
print rootNode.left.val
print rootNode.right.val
"""
Exp... |
kurniawanen/tugas-sains-manajemen | .ipynb_checkpoints/Untitled-Copy1-checkpoint.ipynb | mit | # Find center point of customer, buat nyari
# long
long_centroid = sum(customer['long'])/len(customer)
# lat
lat_centroid = sum(customer['lat'])/len(customer)
# Find distance from customer point to central customer point
customer['distSort'] = np.sqrt( (customer.long-long_centroid)**2 + (customer.lat-lat_centroid)**2)... |
msultan/msmbuilder | examples/Ward-Clustering.ipynb | lgpl-2.1 | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
xy1 = np.random.randn(50,2)
xy2 = np.random.randn(50,2)+1
xy = np.concatenate([xy1,xy2])
plt.scatter(xy[:,0], xy[:,1])
plt.tight_layout()
"""
Explanation: Ward Clustering
We fit some random points to 2 clusters using the Ward metric and then pr... |
probml/pyprobml | notebooks/book1/22/matrix_factorization_recommender.ipynb | mit | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
!wget http://files.grouplens.org/datasets/movielens/ml-100k.zip
!ls
!unzip ml-100k
folder = "ml-100k"
!wget http://files.grouplens.org/datasets/movielens/ml-1m.zip
!unzip ml-1m
!ls
folder = "ml-1m"
ratings_list = [
[int(x) for x in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.